From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22325 invoked by alias); 13 Jun 2011 11:46:03 -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: 29477 Received: (qmail 25996 invoked from network); 13 Jun 2011 11:45:59 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, SPF_HELO_PASS autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at csr.com does not designate permitted sender hosts) Date: Mon, 13 Jun 2011 12:07:47 +0100 From: Peter Stephenson To: Subject: Re: killing suspended jobs makes zsh hang after 47d1215 Message-ID: <20110613120747.2f018471@pwslap01u.europe.root.pri> In-Reply-To: <110612185339.ZM28551@torch.brasslantern.com> References: <86aadnwtl2.fsf@gmail.com> <110612072211.ZM26399@torch.brasslantern.com> <110612075958.ZM27334@torch.brasslantern.com> <8662oaha3g.fsf@gmail.com> <110612185339.ZM28551@torch.brasslantern.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [10.103.11.49] X-Scanned-By: MailControl A-10-80-00 (www.mailcontrol.com) on 10.71.0.138 On Sun, 12 Jun 2011 18:53:39 -0700 Bart Schaefer wrote: > On Jun 13, 4:02am, Pan Tsu wrote: > } > } % cat | cat & > } [1] 91580 97756 > } [1] + suspended (tty input) cat | cat > } % % > } [1] + continued cat | cat > } ^C > } load: 0.06 no foreground process group > } > } (gdb) p pn->status > } $1 = 19 > } (gdb) p WIFSIGNALED(pn->status) > > So I begin to suspect that what we really want here is > > Index: Src/jobs.c > --- Src/jobs.c.~1.83.~ 2011-06-12 08:05:58.000000000 -0700 > +++ Src/jobs.c 2011-06-12 18:51:37.000000000 -0700 > @@ -190,7 +190,7 @@ > * to return in a different job. > */ > if (pn->pid == pid && (pn->status == SP_RUNNING || > - WIFSTOPPED(pn->status))) { > + !WIFEXITED(pn->status))) { > *pptr = pn; > *jptr = jobtab + i; > return 1; This is getting confusing. WIFSIGNALED() indicates the process exited, but on a signal rather than due to an exit call. Why would we need to distinguish those two cases? It may be we need to distinguish the callers. The original bug was when a process that had exited, that was part of a job that had not yet terminated, was being used inappropriately (see zsh-workers/28965). In this case it appears that under similar circumstances we need the terminated job. What is it in the current case that means we need the process number even though the process has exited? -- Peter Stephenson Software Engineer Tel: +44 (0)1223 692070 Cambridge Silicon Radio Limited Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, UK Member of the CSR plc group of companies. CSR plc registered in England and Wales, registered number 4187346, registered office Churchill House, Cambridge Business Park, Cowley Road, Cambridge, CB4 0WZ, United Kingdom More information can be found at www.csr.com. Follow CSR on Twitter at http://twitter.com/CSR_PLC and read our blog at www.csr.com/blog