From: Peter Stephenson <pws@csr.com>
To: "Rocky Bernstein" <rocky.bernstein@gmail.com>
Cc: zsh-workers@sunsite.dk
Subject: Re: Weird exit caused in a trap DEBUG which sources a file.
Date: Fri, 01 Aug 2008 16:31:18 +0100 [thread overview]
Message-ID: <200808011531.m71FVIFl028545@news01.csr.com> (raw)
In-Reply-To: <6cd6de210808010821g3117fe62y82bd580811dbba8a@mail.gmail.com>
"Rocky Bernstein" wrote:
> On Fri, Aug 1, 2008 at 9:37 AM, Peter Stephenson <pws@csr.com> wrote:
> > Thanks, this is what I needed.
>
> No, thank you! I just tried the patch and it works fine.
Good.
> So there's no mystery. I've been porting the bash debugger code to
> zsh. So far, print/eval, stepping and some stack frame commands work.
> But this is far from ready for general consumption.
This will be very useful.
> > The signals.c hunk is to save and restore trapreturn for nested trap
> > handlers. I'm not sure it's necessary; I am sure it's not wrong and
> > prevents hostages to fortune.
>
> Not sure the additional code is necessary or that nested trap handlers
> are necessary? I'm pretty sure you mean the former. Nested trap
> handlers are useful.
Yes, I'm talking about the additional code. I think it probably *is*
necessary for consistency, but there are cases where we disable nested
handling (so for example we don't run a DEBUG trap on commands when
we're inside a DEBUG trap).
> It seems weird that trapreturn is is initialised to -1 for a
> function trap and
> -2 for a non-function trap and decremented for subsequent function
> calls. Because this means that trapreturn for a for a function trap
> that calls a function would have the same value as for a non-function
> trap.
This is because of the way an explicit "return" from a trap works (which
is documented in the manual). "return" with non-zero status from a
shell function forces the parent function to return; "return" with any
status from a non-function trap forces the immediately surrounding
function to return. In other words, the difference is there's an extra
level of functions in one case which we have to jump over for the
special return.
--
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-08-01 15:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-31 2:38 Rocky Bernstein
2008-07-31 9:01 ` Peter Stephenson
2008-07-31 10:05 ` Rocky Bernstein
2008-08-01 12:29 ` Rocky Bernstein
2008-08-01 13:37 ` Peter Stephenson
2008-08-01 15:21 ` Rocky Bernstein
2008-08-01 15:31 ` Peter Stephenson [this message]
2008-08-02 11:21 ` Rocky Bernstein
2008-08-03 10:42 ` Peter Stephenson
2008-08-03 11:28 ` Rocky Bernstein
2008-08-03 11:50 ` Peter Stephenson
2008-08-05 11:18 ` Rocky Bernstein
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=200808011531.m71FVIFl028545@news01.csr.com \
--to=pws@csr.com \
--cc=rocky.bernstein@gmail.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).