From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27081 invoked from network); 11 Jul 2009 23:17:29 -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=BAYES_00,UNPARSEABLE_RELAY 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; 11 Jul 2009 23:17:29 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 25087 invoked from network); 11 Jul 2009 23:17:23 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Jul 2009 23:17:23 -0000 Received: (qmail 12558 invoked by alias); 11 Jul 2009 23:17:14 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 27133 Received: (qmail 12519 invoked from network); 11 Jul 2009 23:17:13 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 11 Jul 2009 23:17:13 -0000 Received: from ciao.gmane.org (main.gmane.org [80.91.229.2]) by bifrost.dotsrc.org (Postfix) with ESMTPS id 04F5580307FA for ; Sun, 12 Jul 2009 01:17:09 +0200 (CEST) Received: from list by ciao.gmane.org with local (Exim 4.43) id 1MPloa-00021k-GR for zsh-workers@sunsite.dk; Sat, 11 Jul 2009 23:17:08 +0000 Received: from c-24-10-247-15.hsd1.ut.comcast.net ([c-24-10-247-15.hsd1.ut.comcast.net]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Jul 2009 23:17:08 +0000 Received: from ebb9 by c-24-10-247-15.hsd1.ut.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 11 Jul 2009 23:17:08 +0000 X-Injected-Via-Gmane: http://gmane.org/ To: zsh-workers@sunsite.dk From: Eric Blake Subject: Re: non-interactive set -m Date: Sat, 11 Jul 2009 23:16:51 +0000 (UTC) Message-ID: References: <200907111905.n6BJ54oS026712@pws-pc.ntlworld.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: main.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 24.10.247.15 (Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080702 Firefox/2.0.0.16 Mnenhy/0.7.5.666) Sender: news X-Virus-Scanned: ClamAV 0.94.2/9555/Sat Jul 11 10:31:19 2009 on bifrost X-Virus-Status: Clean Peter Stephenson ntlworld.com> writes: > > Peter Stephenson wrote: > > (The other chunk is because we allow "jobs" to work in a subshell > > so you can pipe its output---if you "set -m" you're effectively making > > the shell the output for "jobs" twice.) > ^ > > The missing word is "save". When you do "set -m" in the subshell you're > wiping the record of the parent shell's job control---that's inevitable > if you now want the subshell to do its own job control. > POSIX says the following about sh: A shell execution environment consists of the following: ... Options turned on at invocation or by set ... Process IDs of the last commands in asynchronous lists known to this shell environment; ... A subshell environment shall be created as a duplicate of the shell environment, except that signal traps set by that shell environment shall be set to the default values. It also says, for wait: If it is called in a subshell or separate utility execution environment, such as one of the following: (wait) ... it returns immediately because there are no known process IDs to wait for in those environments. 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. So we are getting closer, but still not there. $ zsh -ci 'echo $-; (echo $-)' should have identical output on both lines (the subshell should not lose the fact that -m was set in the parent shell). Likewise, I argue that this should follow bash's behavior, and not print anything between 'got' and 'here' since there are no jobs known to the subshell: $ zsh -ci 'sleep 1& (echo got; jobs; echo here)' -- Eric Blake