summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilippe Altherr <philippe.altherr@gmail.com>2025-10-26 13:39:33 -0700
committerBart Schaefer <schaefer@zsh.org>2025-10-26 13:39:33 -0700
commit477c6890b0e9e934c5dbccb3f335da0f175f1a8f (patch)
tree335439f8059e56ec6d3edf2fb6dabdc8e23ae555
parent54002: silence compiler warning for static function (diff)
downloadzsh-477c6890b0e9e934c5dbccb3f335da0f175f1a8f.tar
zsh-477c6890b0e9e934c5dbccb3f335da0f175f1a8f.tar.gz
zsh-477c6890b0e9e934c5dbccb3f335da0f175f1a8f.tar.bz2
zsh-477c6890b0e9e934c5dbccb3f335da0f175f1a8f.tar.lz
zsh-477c6890b0e9e934c5dbccb3f335da0f175f1a8f.tar.xz
zsh-477c6890b0e9e934c5dbccb3f335da0f175f1a8f.tar.zst
zsh-477c6890b0e9e934c5dbccb3f335da0f175f1a8f.zip
53732: avoid tail-call exec in always block
-rw-r--r--ChangeLog4
-rw-r--r--Src/loop.c2
-rw-r--r--Test/A01grammar.ztst6
3 files changed, 11 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b64579ab1..ab940073b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2025-10-26 Bart Schaefer <schaefer@zsh.org>
+
+ * Philippe: 53732: avoid tail-call exec in always block
+
2025-10-24 Oliver Kiddle <opk@zsh.org>
* 54002: Src/parse.c: silence compiler warning for static function
diff --git a/Src/loop.c b/Src/loop.c
index 979285abc..ba01b1da5 100644
--- a/Src/loop.c
+++ b/Src/loop.c
@@ -774,7 +774,7 @@ exectry(Estate state, int do_exec)
contflag = 0;
state->pc = always;
- execlist(state, 1, do_exec);
+ execlist(state, 1, 0);
if (try_errflag)
errflag |= ERRFLAG_ERROR;
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 660602caf..a65dc57f1 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -720,6 +720,12 @@
>always 1
>try 2
+ () { { return 2 } always { return 3 } }
+2:Exit status of always block is ignored
+
+ () { ( { return 2 } always { ( return 3 ) } ) }
+2:Regression test for exit status of always block is ignored also in tailcalls
+
(
mywrap() { echo BEGIN; true; echo END }
mytest() { { exit 3 } always { mywrap }; print Exited before this }