about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <barts@users.sourceforge.net>2001-10-13 17:53:21 +0000
committerBart Schaefer <barts@users.sourceforge.net>2001-10-13 17:53:21 +0000
commit4bd3be1153b3acbc6ad84cc30338ec5b5b68b220 (patch)
tree047a4d602b940431a08176a8ca0f8124c4d87802
parent3b9e0363689b06b61ef0533c6afe2b9287381bb4 (diff)
downloadzsh-4bd3be1153b3acbc6ad84cc30338ec5b5b68b220.tar.gz
zsh-4bd3be1153b3acbc6ad84cc30338ec5b5b68b220.tar.xz
zsh-4bd3be1153b3acbc6ad84cc30338ec5b5b68b220.zip
Save/restore state around DEBUG trap call.
-rw-r--r--ChangeLog8
-rw-r--r--Src/exec.c11
2 files changed, 16 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 60b0ee31f..54a6c149f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,12 @@
 	* 15882: zshconfig.ac, Etc/MACHINES, Test/C02cond.ztst: fix
 	build and test problems on MacOS X (Darwin).
 
+2001-10-11  Bart Schaefer  <schaefer@zsh.org>
+
+	* 16013: Src/exec.c: Properly save/restore state around the
+	DEBUG trap, so that its return value does not alter the return
+	value of current command (among other things).
+
 2001-10-08  Peter Stephenson  <pws@csr.com>
 
 	* 15974: Etc/BUGS, LICENCE: mention trap EXIT bug fixed (ish)
@@ -375,7 +381,7 @@
 	* user/3940: Src/Zle/zle_tricky.c: make expand-word not always
 	restore the command line
 
-001-06-22  Andrej Borsenkow  <bor@zsh.org>
+2001-06-22  Andrej Borsenkow  <bor@zsh.org>
 
 	* 15021: Src/prompt.c, Doc/Zsh/prompt.yo: revert to old %l
 	semantic; add new %y character instead as suggested by Wayne
diff --git a/Src/exec.c b/Src/exec.c
index 4f2916eec..aa2e3437b 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -886,11 +886,18 @@ execlist(Estate state, int dont_change_job, int exiting)
 	state->pc--;
 sublist_done:
 
-	cmdsp = csp;
 	noerrexit = oldnoerrexit;
 
-	if (sigtrapped[SIGDEBUG])
+	if (sigtrapped[SIGDEBUG]) {
+	    exiting = donetrap;
+	    ret = lastval;
 	    dotrap(SIGDEBUG);
+	    lastval = ret;
+	    donetrap = exiting;
+	    noerrexit = oldnoerrexit;
+	}
+
+	cmdsp = csp;
 
 	/* Check whether we are suppressing traps/errexit *
 	 * (typically in init scripts) and if we haven't  *