aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shell/ash.c3
-rw-r--r--shell/ash_test/ash-misc/env_and_func.right2
-rwxr-xr-xshell/ash_test/ash-misc/env_and_func.tests2
-rw-r--r--shell/ash_test/ash-vars/var_leak.right2
-rwxr-xr-xshell/ash_test/ash-vars/var_leak.tests4
-rwxr-xr-xshell/hush_test/hush-misc/env_and_func.tests2
6 files changed, 5 insertions, 10 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 5c431c9ff..6cda7251e 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9600,9 +9600,7 @@ evalfun(struct funcnode *func, int argc, char **argv, int flags)
9600 shellparam.optind = 1; 9600 shellparam.optind = 1;
9601 shellparam.optoff = -1; 9601 shellparam.optoff = -1;
9602#endif 9602#endif
9603 pushlocalvars();
9604 evaltree(func->n.ndefun.body, flags & EV_TESTED); 9603 evaltree(func->n.ndefun.body, flags & EV_TESTED);
9605 poplocalvars(0);
9606 funcdone: 9604 funcdone:
9607 INT_OFF; 9605 INT_OFF;
9608 funcline = savefuncline; 9606 funcline = savefuncline;
@@ -10235,7 +10233,6 @@ evalcommand(union node *cmd, int flags)
10235 goto readstatus; 10233 goto readstatus;
10236 10234
10237 case CMDFUNCTION: 10235 case CMDFUNCTION:
10238 poplocalvars(1);
10239 /* See above for the rationale */ 10236 /* See above for the rationale */
10240 dowait(DOWAIT_NONBLOCK, NULL); 10237 dowait(DOWAIT_NONBLOCK, NULL);
10241 if (evalfun(cmdentry.u.func, argc, argv, flags)) 10238 if (evalfun(cmdentry.u.func, argc, argv, flags))
diff --git a/shell/ash_test/ash-misc/env_and_func.right b/shell/ash_test/ash-misc/env_and_func.right
index 5fc3488ae..4a1545058 100644
--- a/shell/ash_test/ash-misc/env_and_func.right
+++ b/shell/ash_test/ash-misc/env_and_func.right
@@ -1,2 +1,2 @@
1var=val 1var=val
2var=val 2var=old
diff --git a/shell/ash_test/ash-misc/env_and_func.tests b/shell/ash_test/ash-misc/env_and_func.tests
index 3efef1a41..1c63eafd8 100755
--- a/shell/ash_test/ash-misc/env_and_func.tests
+++ b/shell/ash_test/ash-misc/env_and_func.tests
@@ -3,6 +3,6 @@ f() { echo "var=$var"; }
3# bash: POSIXLY_CORRECT behavior is to "leak" new variable values 3# bash: POSIXLY_CORRECT behavior is to "leak" new variable values
4# out of function invocations (similar to "special builtins" behavior); 4# out of function invocations (similar to "special builtins" behavior);
5# but in "bash mode", they don't leak. 5# but in "bash mode", they don't leak.
6# hush does not "leak" values. ash does. 6# hush does not "leak" values. ash used to, but now does not.
7var=val f 7var=val f
8echo "var=$var" 8echo "var=$var"
diff --git a/shell/ash_test/ash-vars/var_leak.right b/shell/ash_test/ash-vars/var_leak.right
index 01a5e3263..764680086 100644
--- a/shell/ash_test/ash-vars/var_leak.right
+++ b/shell/ash_test/ash-vars/var_leak.right
@@ -1,4 +1,4 @@
1should be empty: '' 1should be empty: ''
2should be empty: '' 2should be empty: ''
3should be not empty: 'val2' 3should be not empty: 'val2'
4should be not empty: 'val3' 4should be empty: ''
diff --git a/shell/ash_test/ash-vars/var_leak.tests b/shell/ash_test/ash-vars/var_leak.tests
index 5242e24eb..adf66692e 100755
--- a/shell/ash_test/ash-vars/var_leak.tests
+++ b/shell/ash_test/ash-vars/var_leak.tests
@@ -15,9 +15,7 @@ VAR=''
15VAR=val2 exec 2>&1 15VAR=val2 exec 2>&1
16echo "should be not empty: '$VAR'" 16echo "should be not empty: '$VAR'"
17 17
18# ash follows the "function call is a special builtin" rule here
19# (bash does not do it)
20f() { true; } 18f() { true; }
21VAR='' 19VAR=''
22VAR=val3 f 20VAR=val3 f
23echo "should be not empty: '$VAR'" 21echo "should be empty: '$VAR'"
diff --git a/shell/hush_test/hush-misc/env_and_func.tests b/shell/hush_test/hush-misc/env_and_func.tests
index 3efef1a41..1c63eafd8 100755
--- a/shell/hush_test/hush-misc/env_and_func.tests
+++ b/shell/hush_test/hush-misc/env_and_func.tests
@@ -3,6 +3,6 @@ f() { echo "var=$var"; }
3# bash: POSIXLY_CORRECT behavior is to "leak" new variable values 3# bash: POSIXLY_CORRECT behavior is to "leak" new variable values
4# out of function invocations (similar to "special builtins" behavior); 4# out of function invocations (similar to "special builtins" behavior);
5# but in "bash mode", they don't leak. 5# but in "bash mode", they don't leak.
6# hush does not "leak" values. ash does. 6# hush does not "leak" values. ash used to, but now does not.
7var=val f 7var=val f
8echo "var=$var" 8echo "var=$var"