summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Src/exec.c2
-rw-r--r--Src/loop.c8
-rw-r--r--Test/C03traps.ztst14
4 files changed, 21 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index a5a235389..aa2253522 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
diff --git a/Src/exec.c b/Src/exec.c
index 235faf3ba..bcc8065a2 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -1409,7 +1409,7 @@ sublist_done:
exit(lastval);
}
if (errreturn) {
- retflag = 2;
+ retflag = 1;
breaks = loops;
}
}
diff --git a/Src/loop.c b/Src/loop.c
index 7d1528efe..4def9b652 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -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;
}
diff --git a/Test/C03traps.ztst b/Test/C03traps.ztst
index d179dc46d..4b2843a47 100644
--- a/Test/C03traps.ztst
+++ b/Test/C03traps.ztst
@@ -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