hush: fix mishandling of a'b'c=fff as assignments. They are not.
function old new delta parse_stream 1920 2004 +84 done_word 715 752 +37 parse_and_run_stream 328 333 +5 builtin_exec 25 29 +4 pseudo_exec_argv 138 139 +1 run_list 2006 1999 -7 is_assignment 215 134 -81 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 5/2 up/down: 131/-88) Total: 43 bytes
This commit is contained in:
9
shell/hush_test/hush-misc/assignment1.right
Normal file
9
shell/hush_test/hush-misc/assignment1.right
Normal file
@@ -0,0 +1,9 @@
|
||||
if1:0
|
||||
while1:0
|
||||
until1:0
|
||||
if2:0
|
||||
while2:0
|
||||
until2:0
|
||||
if3:0
|
||||
while3:0
|
||||
until3:0
|
42
shell/hush_test/hush-misc/assignment1.tests
Executable file
42
shell/hush_test/hush-misc/assignment1.tests
Executable file
@@ -0,0 +1,42 @@
|
||||
# Assignments after some keywords should still work
|
||||
|
||||
if a=1 true; then a=1 true; elif a=1 true; then a=1 true; else a=1 true; fi
|
||||
echo if1:$?
|
||||
while a=1 true; do a=1 true; break; done
|
||||
echo while1:$?
|
||||
until a=1 false; do a=1 true; break; done
|
||||
echo until1:$?
|
||||
|
||||
if a=1 true
|
||||
then a=1 true
|
||||
elif a=1 true
|
||||
then a=1 true
|
||||
else a=1 true
|
||||
fi
|
||||
echo if2:$?
|
||||
while a=1 true
|
||||
do a=1 true
|
||||
break
|
||||
done
|
||||
echo while2:$?
|
||||
until a=1 false
|
||||
do a=1 true
|
||||
break
|
||||
done
|
||||
echo until2:$?
|
||||
|
||||
if
|
||||
a=1 true; then
|
||||
a=1 true; elif
|
||||
a=1 true; then
|
||||
a=1 true; else
|
||||
a=1 true; fi
|
||||
echo if3:$?
|
||||
while
|
||||
a=1 true; do
|
||||
a=1 true; break; done
|
||||
echo while3:$?
|
||||
until
|
||||
a=1 false; do
|
||||
a=1 true; break; done
|
||||
echo until3:$?
|
2
shell/hush_test/hush-misc/assignment2.rigth
Normal file
2
shell/hush_test/hush-misc/assignment2.rigth
Normal file
@@ -0,0 +1,2 @@
|
||||
hush: can't exec 'a=b': No such file or directory
|
||||
1
|
4
shell/hush_test/hush-misc/assignment2.tests
Executable file
4
shell/hush_test/hush-misc/assignment2.tests
Executable file
@@ -0,0 +1,4 @@
|
||||
# This must not be interpreted as an assignment
|
||||
a''=b true
|
||||
echo $?
|
||||
# (buglet: $? should be 127. it is currently 1)
|
Reference in New Issue
Block a user