hush: fix a bug where we don't properly handle f() { a=A; b=B; }; a= f
function old new delta unset_local_var 20 274 +254 leave_var_nest_level - 98 +98 set_vars_and_save_old 128 164 +36 enter_var_nest_level - 32 +32 builtin_local 46 50 +4 pseudo_exec_argv 554 544 -10 redirect_and_varexp_helper 77 64 -13 run_pipe 1890 1641 -249 unset_local_var_len 267 - -267 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 3/3 up/down: 424/-539) Total: -115 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
3
shell/hush_test/hush-vars/var_nested1.right
Normal file
3
shell/hush_test/hush-vars/var_nested1.right
Normal file
@@ -0,0 +1,3 @@
|
||||
Expected:AB Actual:AB
|
||||
Expected:Ab Actual:Ab
|
||||
Expected:ab Actual:ab
|
16
shell/hush_test/hush-vars/var_nested1.tests
Executable file
16
shell/hush_test/hush-vars/var_nested1.tests
Executable file
@@ -0,0 +1,16 @@
|
||||
f() { a=A; b=B; }
|
||||
|
||||
a=a
|
||||
b=b
|
||||
f
|
||||
echo Expected:AB Actual:$a$b
|
||||
|
||||
a=a
|
||||
b=b
|
||||
b= f
|
||||
echo Expected:Ab Actual:$a$b
|
||||
|
||||
a=a
|
||||
b=b
|
||||
a= b= f
|
||||
echo Expected:ab Actual:$a$b
|
1
shell/hush_test/hush-vars/var_nested2.right
Normal file
1
shell/hush_test/hush-vars/var_nested2.right
Normal file
@@ -0,0 +1 @@
|
||||
aB
|
2
shell/hush_test/hush-vars/var_nested2.tests
Executable file
2
shell/hush_test/hush-vars/var_nested2.tests
Executable file
@@ -0,0 +1,2 @@
|
||||
# the bug was easier to trigger in one-liner form
|
||||
a=a; b=b; f() { a=A; b=B; }; a= f; echo $a$b
|
Reference in New Issue
Block a user