From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27242 invoked by alias); 20 Aug 2010 08:55:48 -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: 28176 Received: (qmail 7374 invoked from network); 20 Aug 2010 08:55:45 -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: Fri, 20 Aug 2010 09:55:27 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Bug#593426: zsh: Status of background jobs not updated Message-ID: <20100820095527.4ef353e1@csr.com> In-Reply-To: <100819212253.ZM27882@torch.brasslantern.com> References: <20100818025148.13456.14691.reportbug@salamander.skynet.lan> <20100818182959.GA29785@scru.org> <20100818210959.2a9d4d25@pws-pc> <100819212253.ZM27882@torch.brasslantern.com> Organization: Cambridge Silicon Radio X-Mailer: Claws Mail 3.7.6 (GTK+ 2.18.9; i686-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 20 Aug 2010 08:55:37.0117 (UTC) FILETIME=[751124D0:01CB4045] X-Scanned-By: MailControl A-06-00-00 (www.mailcontrol.com) on 10.68.0.126 On Thu, 19 Aug 2010 21:22:51 -0700 Bart Schaefer wrote: > On Aug 18, 9:09pm, Peter Stephenson wrote: > } > } + } else if (sig == SIGCONT) { > } + Job jn; > } + Process pn; > } + if (findproc(pid, &jn, &pn, 0)) { > } + if (WIFSTOPPED(pn->status)) > } + pn->status = SP_RUNNING; > } + } > } + } > > Hmm, are we really guaranteed that the job has started running again > just because we killed it with SIGCONT? E.g., if the reason it was > stopped is because it got a TTIN or TTOU, is there a possible race > here because it's just going to immediately stop again? Well, signals are queued at this point, so if there's another stop signal it should be handled after marking the process as continued. But it would still be better to check the status by waiting at appropriate points, which needs the fix to take care of the case that the child has actually exited I mentioned before, which needs a lot of care as it's dealing with some basic and race-prone stuff. -- 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