mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-04-19 16:44:02 +02:00
48787: Fix command status after failed if
If "if" had a hard error in the condition, and there was no else clause, the command status was incorrectly cleared to zero. Add test.
This commit is contained in:
parent
c1f932d668
commit
9e38ab8178
|
@ -1,3 +1,8 @@
|
|||
2021-05-06 Peter Stephenson <p.stephenson@samsung.com>
|
||||
|
||||
* 48787: Src/loop.c, Test/A01grammar.ztst: status was incorrect
|
||||
on hard error flagged by condition in "if" without "else".
|
||||
|
||||
2021-05-03 dana <dana@dana.is>
|
||||
|
||||
* unposted (see 48613): Etc/FAQ.yo: Move section 3.31 to 2.8
|
||||
|
|
|
@ -583,7 +583,7 @@ execif(Estate state, int do_exec)
|
|||
cmdpop();
|
||||
} else {
|
||||
noerrexit = olderrexit;
|
||||
if (!retflag)
|
||||
if (!retflag && !errflag)
|
||||
lastval = 0;
|
||||
}
|
||||
state->pc = end;
|
||||
|
|
|
@ -939,3 +939,8 @@ F:Note that the behaviour of 'exit' inside try-list inside a function is unspeci
|
|||
$ZTST_testdir/../Src/zsh -fc '{ ( ) } always { echo foo }'
|
||||
0:exec last command optimization inhibited for try/always
|
||||
>foo
|
||||
|
||||
a='${'
|
||||
if : ${(e)a}; then echo x; fi
|
||||
1:Status on bad substitution in if without else
|
||||
?(eval):2: bad substitution
|
||||
|
|
Loading…
Reference in New Issue