From 8ce98c75f5330eecfa474e342146b8d057abcefc Mon Sep 17 00:00:00 2001 From: Stephane Chazelas Date: Tue, 30 Aug 2016 13:44:26 +0100 Subject: 39125: More care needed decrementing SHLVL on exec. Not needed in subshell. --- Test/D04parameter.ztst | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Test/D04parameter.ztst') diff --git a/Test/D04parameter.ztst b/Test/D04parameter.ztst index 063007956..75ace5a9b 100644 --- a/Test/D04parameter.ztst +++ b/Test/D04parameter.ztst @@ -1716,6 +1716,24 @@ $ZTST_testdir/../Src/zsh -fc '(echo $SHLVL)' 0:SHLVL appears sensible when about to exit shell >2 +>2 + + 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"))' +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 # The following tests the return behaviour of parsestr/parsestrnoerr -- cgit 1.4.1