Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: sigwinch interrupts builtin 'wait'
- X-seq: zsh-workers 24733
 
- From: Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
 
- To: zsh-workers <zsh-workers@xxxxxxxxxx>
 
- Subject: Re: sigwinch interrupts builtin 'wait'
 
- Date: Tue, 25 Mar 2008 18:12:46 +0000
 
- In-reply-to: <237967ef0803201821u1987f55et596614a56e11100e@xxxxxxxxxxxxxx>
 
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
 
- References: <237967ef0803201821u1987f55et596614a56e11100e@xxxxxxxxxxxxxx>
 
On Fri, 21 Mar 2008 02:21:30 +0100
"Mikael Magnusson" <mikachu@xxxxxxxxx> wrote:
> Seems to not happen in 4.2.5, but on my own computer which has cvs
> from very recently, and a friend's computer that has 4.3.5. To
> reproduce:
> % sleep 50 &
> % wait %1 && echo $?
> <resize terminal>
> 156
This came in with 22281.  The intention was to make "wait" return
immediately for signals that had traps.  Rather embarrassingly, however,
I forgot to add a test that the signal had a trap.  The (last_signal >=
0) is paranoia.  The expensive shells you get in Harrods' system
utilities department probably don't have that.
(Doesn't anyone else run into system-level bugs in the shell, by the
way???)
Index: Src/jobs.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v
retrieving revision 1.61
diff -u -r1.61 jobs.c
--- Src/jobs.c	18 Dec 2007 10:42:36 -0000	1.61
+++ Src/jobs.c	25 Mar 2008 18:05:52 -0000
@@ -1170,7 +1170,8 @@
 
 	last_signal = -1;
 	signal_suspend(SIGCHLD);
-	if (last_signal != SIGCHLD && wait_cmd) {
+	if (last_signal != SIGCHLD && wait_cmd && last_signal >= 0 &&
+	    (sigtrapped[last_signal] & ZSIG_TRAPPED)) {
 	    /* wait command interrupted, but no error: return */
 	    restore_queue_signals(q);
 	    return 128 + last_signal;
@@ -1208,7 +1209,8 @@
 	       !(jn->stat & STAT_DONE) &&
 	       !(interact && (jn->stat & STAT_STOPPED))) {
 	    signal_suspend(SIGCHLD);
-	    if (last_signal != SIGCHLD && wait_cmd)
+	    if (last_signal != SIGCHLD && wait_cmd && last_signal >= 0 &&
+		(sigtrapped[last_signal] & ZSIG_TRAPPED))
 	    {
 		/* builtin wait interrupted by trapped signal */
 		restore_queue_signals(q);
-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/
Messages sorted by:
Reverse Date,
Date,
Thread,
Author