From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12274 invoked from network); 2 May 2000 12:02:47 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 2 May 2000 12:02:47 -0000 Received: (qmail 8076 invoked by alias); 2 May 2000 12:02:26 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 11066 Received: (qmail 8063 invoked from network); 2 May 2000 12:02:26 -0000 Date: Tue, 02 May 2000 13:01:53 +0100 From: Peter Stephenson Subject: Re: TRAPZERR() in chpwd() In-reply-to: "Your message of Tue, 02 May 2000 13:15:15 +0200." <200005021115.NAA02390@beta.informatik.hu-berlin.de> To: zsh-workers@sunsite.auc.dk (Zsh hackers list) Message-id: <0FTX00MMQLF5AU@la-la.cambridgesiliconradio.com> Content-transfer-encoding: 7BIT Sven wrote > It made things like `false && echo a; echo b' fail. The `echo b' > wasn't executed. > > 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? Yes, the `donetrap' test which makes sure that the trap is only executed once for each occurrence of a non-zero return status isn't working. (I think this is pretty much the only reason for having donetrap as a static variable, so saving it and restoring it essentially disables its staticness altogether, although there may well be some subtlety I'm missing.) % trap 'print ERRR-or!' ZERR % f() { false; } % f ERRR-or! ERRR-or! How about a less drastic version of my previous patch? I think the point is that we just need the `donetrap' effect but not the goto effect (which I should have realised before). We also need some more TRAPZERR stuff in Test/08traps.ztst for this kind of thing. 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:58:56 @@ -842,7 +842,8 @@ * for this sublist. */ donetrap = 1; goto sublist_done; - } + } else if (WC_SUBLIST_TYPE(code) == WC_SUBLIST_END) + donetrap = 1; } cmdpush(CS_CMDAND); break; @@ -867,7 +868,8 @@ * for this sublist. */ donetrap = 1; goto sublist_done; - } + } else if (WC_SUBLIST_TYPE(code) == WC_SUBLIST_END) + donetrap = 1; } cmdpush(CS_CMDOR); break; -- Peter Stephenson Cambridge Silicon Radio, Unit 300, Science Park, Milton Road, Cambridge, CB4 0XL, UK Tel: +44 (0)1223 392070