zsh-workers
 help / color / mirror / code / Atom feed
* sigwinch interrupts builtin 'wait'
@ 2008-03-21  1:21 Mikael Magnusson
  2008-03-21  1:22 ` Mikael Magnusson
  2008-03-25 18:12 ` Peter Stephenson
  0 siblings, 2 replies; 3+ messages in thread
From: Mikael Magnusson @ 2008-03-21  1:21 UTC (permalink / raw)
  To: zsh-workers

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

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sigwinch interrupts builtin 'wait'
  2008-03-21  1:21 sigwinch interrupts builtin 'wait' Mikael Magnusson
@ 2008-03-21  1:22 ` Mikael Magnusson
  2008-03-25 18:12 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Mikael Magnusson @ 2008-03-21  1:22 UTC (permalink / raw)
  To: zsh-workers

On 21/03/2008, 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

Obviously I meant ; there, not &&.

-- 
Mikael Magnusson


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: sigwinch interrupts builtin 'wait'
  2008-03-21  1:21 sigwinch interrupts builtin 'wait' Mikael Magnusson
  2008-03-21  1:22 ` Mikael Magnusson
@ 2008-03-25 18:12 ` Peter Stephenson
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Stephenson @ 2008-03-25 18:12 UTC (permalink / raw)
  To: zsh-workers

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/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-25 18:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-21  1:21 sigwinch interrupts builtin 'wait' Mikael Magnusson
2008-03-21  1:22 ` Mikael Magnusson
2008-03-25 18:12 ` Peter Stephenson

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).