From a2c579050fbf40eb9192f043e901e6b2eff3ab50 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Wed, 15 Apr 2015 09:44:19 +0100 Subject: 34887: Fix POSIX_BUILTINS with assignment. In the form var=val command special-builtin-or-func the var is restored after execution, unlike the case where "command" is absent. Clear up case in code that handles this. Add tests. --- Test/E01options.ztst | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'Test') diff --git a/Test/E01options.ztst b/Test/E01options.ztst index 32135344f..5c453c80b 100644 --- a/Test/E01options.ztst +++ b/Test/E01options.ztst @@ -783,6 +783,19 @@ >print is a shell builtin ?(eval):8: command not found: print + # With non-special command: original value restored + # With special builtin: new value kept + # With special builtin preceeded by "command": original value restored. + (setopt posixbuiltins + FOO=val0 + FOO=val1 true; echo $FOO + FOO=val2 times 1>/dev/null 2>&1; echo $FOO + FOO=val3 command times 1>/dev/null 2>&1; echo $FOO) +0:POSIX_BUILTINS and restoring variables +>val0 +>val2 +>val2 + # PRINTEXITVALUE only works if shell input is coming from standard input. # Goodness only knows why. $ZTST_testdir/../Src/zsh -f <<<' -- cgit 1.4.1