diff options
-rw-r--r-- | shell/ash.c | 3 | ||||
-rw-r--r-- | shell/ash_test/ash-misc/env_and_func.right | 2 | ||||
-rwxr-xr-x | shell/ash_test/ash-misc/env_and_func.tests | 2 | ||||
-rw-r--r-- | shell/ash_test/ash-vars/var_leak.right | 2 | ||||
-rwxr-xr-x | shell/ash_test/ash-vars/var_leak.tests | 4 | ||||
-rwxr-xr-x | shell/hush_test/hush-misc/env_and_func.tests | 2 |
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 @@ | |||
1 | var=val | 1 | var=val |
2 | var=val | 2 | var=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. |
7 | var=val f | 7 | var=val f |
8 | echo "var=$var" | 8 | echo "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 @@ | |||
1 | should be empty: '' | 1 | should be empty: '' |
2 | should be empty: '' | 2 | should be empty: '' |
3 | should be not empty: 'val2' | 3 | should be not empty: 'val2' |
4 | should be not empty: 'val3' | 4 | should 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='' | |||
15 | VAR=val2 exec 2>&1 | 15 | VAR=val2 exec 2>&1 |
16 | echo "should be not empty: '$VAR'" | 16 | echo "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) | ||
20 | f() { true; } | 18 | f() { true; } |
21 | VAR='' | 19 | VAR='' |
22 | VAR=val3 f | 20 | VAR=val3 f |
23 | echo "should be not empty: '$VAR'" | 21 | echo "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. |
7 | var=val f | 7 | var=val f |
8 | echo "var=$var" | 8 | echo "var=$var" |