From: Peter Stephenson <pws@csr.com>
To: "Zsh Hackers' List" <zsh-workers@sunsite.dk>
Subject: Re: preventing the leading space in process substitution
Date: Thu, 11 Sep 2008 14:05:05 +0100 [thread overview]
Message-ID: <20080911140505.6c040bf4@news01> (raw)
In-Reply-To: <6cd6de210809110544u569838dk5a93a739fa267822@mail.gmail.com>
On Thu, 11 Sep 2008 08:44:07 -0400
"Rocky Bernstein" <rocky.bernstein@gmail.com> 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 <pws@csr.com> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
next prev parent reply other threads:[~2008-09-11 13:06 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20080909144101.GA30693@lapse.rw.madduck.net>
[not found] ` <200809101124.m8ABOlKI005063@news01.csr.com>
[not found] ` <080910074842.ZM19151@torch.brasslantern.com>
[not found] ` <200809101510.m8AFAajX007203@news01.csr.com>
[not found] ` <080910090554.ZM19272@torch.brasslantern.com>
[not found] ` <6cd6de210809101151q4d0a2a35p452fe656e0ee7dd5@mail.gmail.com>
2008-09-11 12:00 ` Peter Stephenson
2008-09-11 12:44 ` Rocky Bernstein
2008-09-11 13:05 ` Peter Stephenson [this message]
2008-09-11 14:35 ` Bart Schaefer
2008-09-11 14:54 ` Peter Stephenson
2008-09-11 15:59 ` Rocky Bernstein
2008-09-11 17:11 ` PATCH: indent in code output (was Re: preventing the leading space ...) Peter Stephenson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080911140505.6c040bf4@news01 \
--to=pws@csr.com \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).