zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-workers@zsh.org
Subject: Re: (potential regression in 5.0.3)
Date: Sun, 22 Dec 2013 21:47:08 -0800	[thread overview]
Message-ID: <131222214708.ZM19322@torch.brasslantern.com> (raw)
In-Reply-To: <20131223020623.GA480@ma.sdf.org>

On Dec 23,  2:06am, Paul Ackersviller wrote:
}
} I've ran across something else that first looked like a regression,
} but upon further inspection Test/A05execution.ztst was doing this
} for a couple of months.  Strangely, it goes into an infinite loop,
} but only when run in the background.  It does this for me on both
} Linux and FreeBSD, starting from the commit
} c3114a7735c85b79771e08bd156470bde1a36950, but on 5.0.2 too.

It's a known issue that changing the MONITOR option from off to on
can cause the acquire_pgrp() routine to go into an infinite loop,
depending on the shape of the process tree from the foreground.
The jobs.c diff in c3114a7 partly fixed that, but the new A05execution
test needs setopt MONITOR to create the conditions it is regressing,
so it is still possible for that to trigger a loop.

Here's an attempt to resolve the remaining infinite-loop condition:

diff --git a/Src/jobs.c b/Src/jobs.c
index a321172..8719465 100644
--- a/Src/jobs.c
+++ b/Src/jobs.c
@@ -2619,6 +2619,7 @@ acquire_pgrp(void)
     sigset_t blockset, oldset;
 
     if ((mypgrp = GETPGRP()) > 0) {
+	long lastpgrp = mypgrp;
 	sigemptyset(&blockset);
 	sigaddset(&blockset, SIGTTIN);
 	sigaddset(&blockset, SIGTTOU);
@@ -2639,6 +2640,9 @@ acquire_pgrp(void)
 	    if (read(0, NULL, 0) != 0) {} /* Might generate SIGT* */
 	    signal_block(blockset);
 	    mypgrp = GETPGRP();
+	    if (mypgrp == lastpgrp && !interact)
+		break; /* Unlikely that pgrp will ever change */
+	    lastpgrp = mypgrp;
 	}
 	if (mypgrp != mypid) {
 	    if (setpgrp(0, 0) == 0) {


  reply	other threads:[~2013-12-23  5:47 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-20 19:24 Fwd (potential regression in 5.0.3): Bug#732726: zsh function freeze Axel Beckert
2013-12-20 20:27 ` Bart Schaefer
2013-12-20 20:49   ` Axel Beckert
2013-12-20 23:51   ` Vincent Lefevre
2013-12-20 23:59     ` Vincent Lefevre
2013-12-21  0:12       ` Vincent Lefevre
2013-12-21  2:19         ` Bart Schaefer
2013-12-21  3:42           ` Bart Schaefer
2013-12-21  7:16             ` Bart Schaefer
2013-12-21 18:08             ` Peter Stephenson
2013-12-21 20:57               ` Bart Schaefer
2013-12-21 22:34                 ` Peter Stephenson
2013-12-22  1:34                   ` Bart Schaefer
2013-12-23  2:06                     ` (potential regression in 5.0.3) Paul Ackersviller
2013-12-23  5:47                       ` Bart Schaefer [this message]
2014-01-02 18:06                     ` Fwd (potential regression in 5.0.3): Bug#732726: zsh function freeze Peter Stephenson
2014-01-02 20:40                       ` Bart Schaefer

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=131222214708.ZM19322@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-workers@zsh.org \
    /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).