1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-09-28 15:01:21 +02:00

unposted: back out 36707, add test case for 36766

This commit is contained in:
Barton E. Schaefer 2015-10-03 22:11:09 -07:00
parent b581c3fece
commit cb26e11c70
4 changed files with 21 additions and 7 deletions

@ -1,5 +1,9 @@
2015-10-03 Barton E. Schaefer <schaefer@zsh.org>
* unposted (cf. 36696): Test/C03traps.ztst: test case for 36766
* unposted: Src/exec.c, Src/loop.c: back out 36707, fixed by 36766
* 36766: Src/exec.c: fix incorrect reset of noerrexit during
"if" conditions

@ -1409,7 +1409,7 @@ sublist_done:
exit(lastval);
}
if (errreturn) {
retflag = 2;
retflag = 1;
breaks = loops;
}
}

@ -552,12 +552,8 @@ execif(Estate state, int do_exec)
run = 1;
break;
}
if (retflag) {
if (retflag == 2)
retflag = 0; /* Never ERR_RETURN here */
else
break;
}
if (retflag)
break;
s = 1;
state->pc = next;
}

@ -450,6 +450,20 @@
fn
1:ERRRETURN in "else" branch (regression test)
$ZTST_testdir/../Src/zsh -f =(<<<"
if false; then
:
else
if [[ -n '' ]]; then
a=2
fi
print Yes
fi
")
0:ERRRETURN when false "if" is the first statement in an "else" (regression)
>Yes
F:Must be tested with a top-level script rather than source or function
%clean
rm -f TRAPEXIT