zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk
Subject: Re: trap DEBUG + set -o DEBUG_BEFORE_CMD not setting $? nonzero in current CVS
Date: Mon, 4 Aug 2008 18:49:57 +0100	[thread overview]
Message-ID: <20080804184957.421f87c9@news01> (raw)
In-Reply-To: <6cd6de210808040308k529da37dh40b8dd1799086420@mail.gmail.com>

On Mon, 4 Aug 2008 06:08:39 -0400
"Rocky Bernstein" <rocky.bernstein@gmail.com> wrote:
> The following code doesn't show $? as nonzero inside trap DEBUG using the
> CVS source I just downloaded and built.
> 
> However I don't get this problem on the Ubuntu zsh-beta or zsh.
> Removing DEBUG_BEFORE_CMD (or I guess having debug run after the
> command) does set/show $? properly.
> 
> #!/tmp/zsh/Src/zsh -f
> #!/src/external-cvs/zsh/Src/zsh -f
> set -o DEBUG_BEFORE_CMD
> trap 'print $?' DEBUG
> fdasfsdafd  # invalid command
> :

Turns out to be unfinished business with the previous patch:  that code I
patched needs also to be told when we're not in a trap at all.  It was
triggering after the trap, resetting the status.

I must write tests for both.

Index: Src/init.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/init.c,v
retrieving revision 1.89
diff -u -r1.89 init.c
--- Src/init.c	4 Aug 2008 17:32:20 -0000	1.89
+++ Src/init.c	4 Aug 2008 17:46:26 -0000
@@ -191,7 +191,7 @@
 	    exit(lastval);
 	if (((!interact || sourcelevel) && errflag) || retflag)
 	    break;
-	if (trapreturn >= 0) {
+	if (intrap && trapreturn >= 0) {
 	    lastval = trapreturn;
 	    trapreturn = 0;
 	}


-- 
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


  reply	other threads:[~2008-08-04 17:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-04 10:08 Rocky Bernstein
2008-08-04 17:49 ` Peter Stephenson [this message]
2008-08-05  8:33   ` Peter Stephenson
2008-08-05 23:25     ` Rocky Bernstein
2008-08-06  8:49       ` 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=20080804184957.421f87c9@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).