zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-workers <zsh-workers@sunsite.dk>
Subject: Re: sigwinch interrupts builtin 'wait'
Date: Tue, 25 Mar 2008 18:12:46 +0000	[thread overview]
Message-ID: <20080325181246.5d34c12e@pws-pc> (raw)
In-Reply-To: <237967ef0803201821u1987f55et596614a56e11100e@mail.gmail.com>

On Fri, 21 Mar 2008 02:21:30 +0100
"Mikael Magnusson" <mikachu@gmail.com> 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@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


      parent reply	other threads:[~2008-03-25 18:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-21  1:21 Mikael Magnusson
2008-03-21  1:22 ` Mikael Magnusson
2008-03-25 18:12 ` Peter Stephenson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080325181246.5d34c12e@pws-pc \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).