From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4024 invoked from network); 11 Sep 2008 13:06:23 -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 news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 11 Sep 2008 13:06:23 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 3136 invoked from network); 11 Sep 2008 13:06:17 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 11 Sep 2008 13:06:17 -0000 Received: (qmail 17341 invoked by alias); 11 Sep 2008 13:06:08 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 25643 Received: (qmail 17319 invoked from network); 11 Sep 2008 13:06:04 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 11 Sep 2008 13:06:04 -0000 Received: from cluster-g.mailcontrol.com (cluster-g.mailcontrol.com [208.87.233.190]) by bifrost.dotsrc.org (Postfix) with ESMTPS id D6AAC802710A for ; Thu, 11 Sep 2008 15:05:57 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([193.128.72.68]) by rly18g.srv.mailcontrol.com (MailControl) with ESMTP id m8BD4dEU027092 for ; Thu, 11 Sep 2008 14:05:51 +0100 Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Thu, 11 Sep 2008 14:05:10 +0100 Date: Thu, 11 Sep 2008 14:05:05 +0100 From: Peter Stephenson To: "Zsh Hackers' List" Subject: Re: preventing the leading space in process substitution Message-ID: <20080911140505.6c040bf4@news01> In-Reply-To: <6cd6de210809110544u569838dk5a93a739fa267822@mail.gmail.com> References: <20080909144101.GA30693@lapse.rw.madduck.net> <200809101124.m8ABOlKI005063@news01.csr.com> <080910074842.ZM19151@torch.brasslantern.com> <200809101510.m8AFAajX007203@news01.csr.com> <080910090554.ZM19272@torch.brasslantern.com> <6cd6de210809101151q4d0a2a35p452fe656e0ee7dd5@mail.gmail.com> <20080911130005.7c5e2b7c@news01> <6cd6de210809110544u569838dk5a93a739fa267822@mail.gmail.com> Organization: CSR X-Mailer: Claws Mail 3.5.0 (GTK+ 2.12.8; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 11 Sep 2008 13:05:10.0668 (UTC) FILETIME=[0588B4C0:01C9140F] X-Scanned-By: MailControl A-08-50-13 (www.mailcontrol.com) on 10.71.0.128 X-Virus-Scanned: ClamAV 0.92.1/8217/Thu Sep 11 14:12:16 2008 on bifrost X-Virus-Status: Clean On Thu, 11 Sep 2008 08:44:07 -0400 "Rocky Bernstein" wrote: > A gentle nudge on having trap DEBUG (if not other traps as well) inherited > in subshells. ;-) They are currently reset explicitly. I think for most traps that's to avoid the subshell picking up a signal destined for the parent shell (unless the trap has specifically been set in the subshell), but it's possible Bart has detailed knowledge. I can't see why we shouldn't keep the debug-related traps, ZERR and DEBUG, alive in subshells. It doesn't look like the behaviour was ever documented. Would anyone expect the current behaviour? I hadn't realised until you pointed it out. Index: Doc/Zsh/builtins.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/builtins.yo,v retrieving revision 1.112 diff -u -r1.112 builtins.yo --- Doc/Zsh/builtins.yo 5 Sep 2008 09:05:22 -0000 1.112 +++ Doc/Zsh/builtins.yo 11 Sep 2008 13:01:02 -0000 @@ -1330,7 +1330,9 @@ and the tt(trap) statement is not executed inside the body of a function, then the command var(arg) is executed when the shell terminates. -tt(ZERR), tt(DEBUG), and tt(EXIT) traps are not executed inside other traps. +tt(ZERR), tt(DEBUG), and tt(EXIT) traps are not executed inside other +traps. tt(ZERR) and tt(DEBUG) traps are kept within subshells, while +other traps are reset. Note that traps defined with the tt(trap) builtin are slightly different from those defined as `tt(TRAP)var(NAL) () { ... }', as the latter have Index: Src/exec.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/exec.c,v retrieving revision 1.149 diff -u -r1.149 exec.c --- Src/exec.c 10 Sep 2008 15:57:17 -0000 1.149 +++ Src/exec.c 11 Sep 2008 13:01:02 -0000 @@ -869,7 +869,8 @@ if (!(flags & ESUB_KEEPTRAP)) for (sig = 0; sig < VSIGCOUNT; sig++) - if (!(sigtrapped[sig] & ZSIG_FUNC)) + if (!(sigtrapped[sig] & ZSIG_FUNC) && + sig != SIGDEBUG && sig != SIGZERR) unsettrap(sig); monitor = isset(MONITOR); if (flags & ESUB_NOMONITOR) -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070