zsh-workers
 help / color / mirror / code / Atom feed
From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: TRAPZERR() in chpwd()
Date: Tue, 2 May 2000 13:15:15 +0200 (MET DST)	[thread overview]
Message-ID: <200005021115.NAA02390@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Peter Stephenson's message of Tue, 02 May 2000 10:19:42 +0100


Peter Stephenson wrote:

> Paul Ackersviller wrote:
> > I believe the change must've come after 3.1.6, since it exhibits the same
> > behaviour as 3.0.7 in my experience.  It's only 3.1.7-pre-1 and (some?)
> > development versions leading up to it.
> 
> Right, I think it's the wordcode stuff.  I'm pretty sure I spent some time
> (possibly more than once...) getting this right a fair while ago.
> 
> Sven, can you confirm that this is the right fix before I commit it?  Or if
> not, what is, because this can't be too far away from the right answer.
> It seems to work with all the basic tests I've tried.

It made things like `false && echo a; echo b' fail. The `echo b'
wasn't executed.

Hm, why not just setting dontrap unconditionally in the WC_SUBLIST_AND 
branch? Seems to work fine.

No, wait, `{ false && true } || false' doesn't trigger the trap. Hm,
is this an old bug? The simplest way to solve this is by saving and
restoring donetrap around the execution of the pipelines.


I haven't committed the patch... does anyone see a problem with it?

Bye
 Sven

Index: Src/exec.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/exec.c,v
retrieving revision 1.5
diff -u -r1.5 exec.c
--- Src/exec.c	2000/04/10 09:18:27	1.5
+++ Src/exec.c	2000/05/02 11:14:45
@@ -770,7 +770,7 @@
     static int donetrap;
     Wordcode next;
     wordcode code;
-    int ret, cj, csp, ltype;
+    int ret, cj, csp, ltype, odt;
     int old_pline_level, old_list_pipe, oldlineno;
     /*
      * ERREXIT only forces the shell to exit if the last command in a &&
@@ -809,6 +809,7 @@
 	code = *state->pc++;
 	while (wc_code(code) == WC_SUBLIST) {
 	    next = state->pc + WC_SUBLIST_SKIP(code);
+	    odt = donetrap;
 	    if (!oldnoerrexit)
 		noerrexit = (WC_SUBLIST_TYPE(code) != WC_SUBLIST_END);
 	    switch (WC_SUBLIST_TYPE(code)) {
@@ -818,6 +819,7 @@
 		    execsimple(state);
 		else
 		    execpline(state, code, ltype, (ltype & Z_END) && exiting);
+		donetrap = odt;
 		state->pc = next;
 		goto sublist_done;
 		break;
@@ -827,6 +829,7 @@
 		if ((ret = ((WC_SUBLIST_FLAGS(code) & WC_SUBLIST_SIMPLE) ?
 			    execsimple(state) :
 			    execpline(state, code, Z_SYNC, 0)))) {
+		    donetrap = odt;
 		    state->pc = next;
 		    code = *state->pc++;
 		    next = state->pc + WC_SUBLIST_SKIP(code);
@@ -843,7 +846,9 @@
 			donetrap = 1;
 			goto sublist_done;
 		    }
-		}
+		    donetrap = 1;
+		} else
+		    donetrap = odt;
 		cmdpush(CS_CMDAND);
 		break;
 	    case WC_SUBLIST_OR:
@@ -852,6 +857,7 @@
 		if (!(ret = ((WC_SUBLIST_FLAGS(code) & WC_SUBLIST_SIMPLE) ?
 			     execsimple(state) :
 			     execpline(state, code, Z_SYNC, 0)))) {
+		    donetrap = odt;
 		    state->pc = next;
 		    code = *state->pc++;
 		    next = state->pc + WC_SUBLIST_SKIP(code);
@@ -868,7 +874,8 @@
 			donetrap = 1;
 			goto sublist_done;
 		    }
-		}
+		} else
+		    donetrap = odt;
 		cmdpush(CS_CMDOR);
 		break;
 	    }

--
Sven Wischnowsky                         wischnow@informatik.hu-berlin.de


             reply	other threads:[~2000-05-02 11:15 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-05-02 11:15 Sven Wischnowsky [this message]
2000-05-02 12:01 ` Peter Stephenson
  -- strict thread matches above, loose matches on Subject: below --
2000-05-02 12:28 Sven Wischnowsky
     [not found] <20000428161546.A8208@tdc134.comm.mot.com>
     [not found] ` <1000429044220.ZM30544@candle.brasslantern.com>
     [not found]   ` <20000501131328.A11940@tdc134.comm.mot.com>
     [not found]     ` <1000501182216.ZM13391@candle.brasslantern.com>
2000-05-01 21:37       ` Paul Ackersviller
2000-05-02  9:19         ` 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=200005021115.NAA02390@beta.informatik.hu-berlin.de \
    --to=wischnow@informatik.hu-berlin.de \
    --cc=zsh-workers@sunsite.auc.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).