From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4786 invoked from network); 12 Jul 2009 15:02:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.5 Received: from new-brage.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.254.104) by ns1.primenet.com.au with SMTP; 12 Jul 2009 15:02:34 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 79455 invoked from network); 12 Jul 2009 15:02:27 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 12 Jul 2009 15:02:27 -0000 Received: (qmail 16490 invoked by alias); 12 Jul 2009 15:02:19 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27135 Received: (qmail 16467 invoked from network); 12 Jul 2009 15:02:18 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 12 Jul 2009 15:02:18 -0000 Received: from mtaout02-winn.ispmail.ntl.com (mtaout02-winn.ispmail.ntl.com [81.103.221.48]) by bifrost.dotsrc.org (Postfix) with ESMTP id C31A580307FA for ; Sun, 12 Jul 2009 17:02:02 +0200 (CEST) Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20090712150202.QZTM6611.mtaout02-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com> for ; Sun, 12 Jul 2009 16:02:02 +0100 Received: from pws-pc ([81.107.42.185]) by aamtaout01-winn.ispmail.ntl.com (InterMail vG.2.02.00.01 201-2161-120-102-20060912) with ESMTP id <20090712150202.VUWW13254.aamtaout01-winn.ispmail.ntl.com@pws-pc> for ; Sun, 12 Jul 2009 16:02:02 +0100 Date: Sun, 12 Jul 2009 16:01:56 +0100 From: Peter Stephenson To: zsh-workers@sunsite.dk Subject: Re: non-interactive set -m Message-ID: <20090712160156.265f294b@pws-pc> In-Reply-To: References: <200907111905.n6BJ54oS026712@pws-pc.ntlworld.com> X-Mailer: Claws Mail 3.7.1 (GTK+ 2.16.2; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.0 c=1 a=9vXuR5GGAAAA:8 a=NLZqzBF-AAAA:8 a=GfTYluTqnjPtr4CHCNcA:9 a=cJibBIDGQSQsVYe1AZAA:7 a=baced2IP2vNYDlnJBBiSiIQQUYsA:4 a=eDFNAWYWrCwA:10 a=_dQi-Dcv4p4A:10 X-Virus-Scanned: ClamAV 0.94.2/9555/Sat Jul 11 10:31:19 2009 on bifrost X-Virus-Status: Clean On Sat, 11 Jul 2009 23:16:51 +0000 (UTC) Eric Blake wrote: > I interpret this to mean that subshells of a parent process with job > control on must also have job control on, but that their list of > tracked processes is nuked. These look fairly straightforward, if we don't run into problems later on. They can be attached to POSIX_JOBS---that's why I gave it a generic name originally. This looks to me like quite a big change in the way background processes from subshells work, but if it's what POSIX users expects that's fine---I'm not expecting anyone to turn the option on just for fun. Index: Doc/Zsh/options.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v retrieving revision 1.83 diff -u -r1.83 options.yo --- Doc/Zsh/options.yo 10 Jul 2009 11:08:48 -0000 1.83 +++ Doc/Zsh/options.yo 12 Jul 2009 14:59:11 -0000 @@ -1280,10 +1280,26 @@ pindex(NOPOSIXJOBS) cindex(bg, output in POSIX format) cindex(fg, output in POSIX format) +cindex(job control, in subshell) +cindex(jobs, output in subshell) item(tt(POSIX_JOBS) )( -When putting jobs in the background or foreground with tt(bg) or tt(fg), -just print the text of the job as required by POSIX, -rather than the full information that would be output by tt(jobs). +This option makes job control more compliant with the POSIX standard. + +When the option is not set, the tt(MONITOR) option is unset on entry to +subshells, so that job control is no longer active. When the option is +set, the tt(MONITOR) option and job control remain active in the +subshell, but note that the subshell has no access to jobs in the parent +shell. + +When the option is not set, jobs put in the background or foreground +with tt(bg) or tt(fg) are displayed with the same information that would +be reported by tt(jobs). When the option is set, only the text is +printed. The output from tt(jobs) itself is not affected by the option. + +When the option is not set, job information from the parent +shell is saved for output within a subshell (for example, within a +pipeline). When the option is set, the output of tt(jobs) is empty +unless job control has been activated within the subshell. ) enditem() Index: Src/exec.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/exec.c,v retrieving revision 1.169 diff -u -r1.169 exec.c --- Src/exec.c 11 Jul 2009 19:06:52 -0000 1.169 +++ Src/exec.c 12 Jul 2009 14:59:12 -0000 @@ -944,7 +950,9 @@ } if (!(sigtrapped[SIGQUIT] & ZSIG_IGNORED)) signal_default(SIGQUIT); - opts[MONITOR] = opts[USEZLE] = 0; + if (!isset(POSIXJOBS)) + opts[MONITOR] = 0; + opts[USEZLE] = 0; zleactive = 0; if (flags & ESUB_PGRP) clearjobtab(monitor); Index: Src/jobs.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/jobs.c,v retrieving revision 1.70 diff -u -r1.70 jobs.c --- Src/jobs.c 11 Jul 2009 19:06:52 -0000 1.70 +++ Src/jobs.c 12 Jul 2009 14:59:12 -0000 @@ -1292,6 +1292,8 @@ { int i; + if (isset(POSIXJOBS)) + oldmaxjob = 0; for (i = 1; i <= maxjob; i++) { /* * See if there is a jobtable worth saving. @@ -1299,7 +1301,7 @@ * once for each subshell of a shell with job control, * so doesn't create a leak. */ - if (monitor && jobtab[i].stat) + if (monitor && !isset(POSIXJOBS) && jobtab[i].stat) oldmaxjob = i+1; else if (jobtab[i].stat & STAT_INUSE) freejob(jobtab + i, 0); -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/