about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBarton E. Schaefer <schaefer@zsh.org>2015-09-02 19:11:54 -0700
committerBarton E. Schaefer <schaefer@zsh.org>2015-09-02 19:11:54 -0700
commit9f5dffa1f33ec43c306bdf3c87cebba5fcc95b64 (patch)
treec46534e1fc5ddc2333a6a1792946f180f985019a
parentcdbd1b258192fa27c17241877f460c5543827759 (diff)
downloadzsh-9f5dffa1f33ec43c306bdf3c87cebba5fcc95b64.tar.gz
zsh-9f5dffa1f33ec43c306bdf3c87cebba5fcc95b64.tar.xz
zsh-9f5dffa1f33ec43c306bdf3c87cebba5fcc95b64.zip
36393: process queued signals during dotrap()
-rw-r--r--ChangeLog4
-rw-r--r--Src/signals.c5
-rw-r--r--Test/A05execution.ztst9
3 files changed, 18 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index fe0457638..66bba712e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2015-09-02  Barton E. Schaefer  <schaefer@zsh.org>
+
+	* 36393: Src/signals.c: process queued signals during dotrap()
+
 2015-09-02  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* 36378: Src/exec.c: skip directories when looking for autoload
diff --git a/Src/signals.c b/Src/signals.c
index f45c1860c..aa0b5aaa7 100644
--- a/Src/signals.c
+++ b/Src/signals.c
@@ -1348,6 +1348,7 @@ void
 dotrap(int sig)
 {
     void *funcprog;
+    int q = queue_signal_level();
 
     if (sigtrapped[sig] & ZSIG_FUNC) {
 	HashNode hn = gettrapnode(sig, 0);
@@ -1370,5 +1371,9 @@ dotrap(int sig)
     if ((sigtrapped[sig] & ZSIG_IGNORED) || !funcprog || errflag)
 	return;
 
+    dont_queue_signals();
+
     dotrapargs(sig, sigtrapped+sig, funcprog);
+
+    restore_queue_signals(q);
 }
diff --git a/Test/A05execution.ztst b/Test/A05execution.ztst
index a504ac41a..52738181d 100644
--- a/Test/A05execution.ztst
+++ b/Test/A05execution.ztst
@@ -288,3 +288,12 @@ F:anonymous function, and a descriptor leak when backgrounding a pipeline
 >0
 >0
 >0
+
+# Regression test for workers/36392
+  print -u $ZTST_fd 'This test takes 3 seconds and hangs the shell when it fails...'
+  callfromchld() { true && { print CHLD } }
+  TRAPCHLD() { callfromchld }
+  sleep 2 & sleep 3; print OK
+0:Background job exit does not affect reaping foreground job
+>CHLD
+>OK