diff options
author | Peter Stephenson <pws@zsh.org> | 2016-08-31 11:31:55 +0100 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2016-08-31 11:31:55 +0100 |
commit | 8e329ccb0a1dd5f6dca437f93e107c2cc9c6f8f7 (patch) | |
tree | ab614be19f612888a9b7526989f81a00a6662849 | |
parent | 8ce98c75f5330eecfa474e342146b8d057abcefc (diff) | |
download | zsh-8e329ccb0a1dd5f6dca437f93e107c2cc9c6f8f7.tar.gz zsh-8e329ccb0a1dd5f6dca437f93e107c2cc9c6f8f7.tar.xz zsh-8e329ccb0a1dd5f6dca437f93e107c2cc9c6f8f7.zip |
39141: Use zsh instead of sh in SHLVL test.
This removes ambiguous behaviour of sh which may or may not increment SHLVL.
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | Test/D04parameter.ztst | 26 |
2 files changed, 17 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog index c1ef1044c..5a3763950 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2016-08-31 Peter Stephenson <p.stephenson@samsung.com> + * 39141: Test/D04parameter.ztst: use zsh in SHLVL test to remove + ambiguous behaviour of sh. + * Stephane: 39125: Src/exec.c, Test/D04parameter.ztst: More care decrementing SHLVL on exec; not needed in subshells. diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 75ace5a9b..e779aaba8 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -1718,24 +1718,26 @@ >2 >2 + # SHLVL is incremented twice and decremented once in between. SHLVL=1 - $ZTST_testdir/../Src/zsh -fc 'sh -c "echo \$SHLVL"' - $ZTST_testdir/../Src/zsh -fc '(sh -c "echo \$SHLVL")' - $ZTST_testdir/../Src/zsh -fc '( (sh -c "echo \$SHLVL"))' + $ZTST_testdir/../Src/zsh -fc $ZTST_testdir/../Src/zsh' -fc "echo \$SHLVL"' + $ZTST_testdir/../Src/zsh -fc '('$ZTST_testdir/../Src/zsh' -fc "echo \$SHLVL")' + $ZTST_testdir/../Src/zsh -fc '( ('$ZTST_testdir/../Src/zsh' -fc "echo \$SHLVL"))' 0:SHLVL decremented upon implicit exec optimisation ->1 ->1 ->1 - - SHLVL=1 - $ZTST_testdir/../Src/zsh -fc '(sh -c "echo \$SHLVL"); exit' - $ZTST_testdir/../Src/zsh -fc '(exec sh -c "echo \$SHLVL"); exit' - $ZTST_testdir/../Src/zsh -fc '( (sh -c "echo \$SHLVL"); exit)' -0:SHLVL not decremented upon exec in subshells >2 >2 >2 + # SHLVL is incremented twice with no decrement in between. + SHLVL=1 + $ZTST_testdir/../Src/zsh -fc '('$ZTST_testdir/../Src/zsh' -fc "echo \$SHLVL"); exit' + $ZTST_testdir/../Src/zsh -fc '(exec '$ZTST_testdir/../Src/zsh' -fc "echo \$SHLVL"); exit' + $ZTST_testdir/../Src/zsh -fc '( ('$ZTST_testdir/../Src/zsh' -fc "echo \$SHLVL"); exit)' +0:SHLVL not decremented upon exec in subshells +>3 +>3 +>3 + # The following tests the return behaviour of parsestr/parsestrnoerr alias param-test-alias='print $'\''\x45xpanded in substitution'\' param='$(param-test-alias)' |