From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8558 invoked by alias); 23 Dec 2013 05:47:42 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 32178 Received: (qmail 1333 invoked from network); 23 Dec 2013 05:47:35 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 From: Bart Schaefer Message-id: <131222214708.ZM19322@torch.brasslantern.com> Date: Sun, 22 Dec 2013 21:47:08 -0800 In-reply-to: <20131223020623.GA480@ma.sdf.org> Comments: In reply to Paul Ackersviller "Re: (potential regression in 5.0.3)" (Dec 23, 2:06am) References: <131220122701.ZM15525@torch.brasslantern.com> <20131220235149.GA21721@xvii.vinc17.org> <20131220235955.GB21721@xvii.vinc17.org> <20131221001235.GC21721@xvii.vinc17.org> <131220181950.ZM15385@torch.brasslantern.com> <131220194223.ZM29152@torch.brasslantern.com> <20131221180846.78a5a013@pws-pc.ntlworld.com> <131221125718.ZM24141@torch.brasslantern.com> <20131221223424.6b7a55a7@pws-pc.ntlworld.com> <131221173459.ZM1039@torch.brasslantern.com> <20131223020623.GA480@ma.sdf.org> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-workers@zsh.org Subject: Re: (potential regression in 5.0.3) MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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) {