From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15697 invoked from network); 3 Oct 2005 15:11:08 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 3 Oct 2005 15:11:08 -0000 Received: (qmail 6364 invoked from network); 3 Oct 2005 15:11:02 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 3 Oct 2005 15:11:02 -0000 Received: (qmail 12417 invoked by alias); 3 Oct 2005 15:10:56 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 21812 Received: (qmail 12403 invoked from network); 3 Oct 2005 15:10:56 -0000 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by sunsite.dk with SMTP; 3 Oct 2005 15:10:56 -0000 Received: (qmail 5703 invoked from network); 3 Oct 2005 15:10:55 -0000 Received: from cluster-c.mailcontrol.com (HELO rly12c.srv.mailcontrol.com) (168.143.177.190) by a.mx.sunsite.dk with SMTP; 3 Oct 2005 15:10:53 -0000 Received: from exchange03.csr.com (mailhost1.csr.com [81.105.217.43]) by rly12c.srv.mailcontrol.com (MailControl) with ESMTP id j93FAoJ5016036 for ; Mon, 3 Oct 2005 16:10:51 +0100 Received: from csr.com ([10.102.144.127]) by exchange03.csr.com with Microsoft SMTPSVC(5.0.2195.6713); Mon, 3 Oct 2005 16:12:47 +0100 To: zsh-workers@sunsite.dk Subject: Re: Exception handling and "trap" vs. TRAPNAL() In-reply-to: <1051003145142.ZM4427@candle.brasslantern.com> References: <20050929200741.GA1156@DervishD> <20050930124130.45eb0463.pws@csr.com> <20051001153756.GA12183@DervishD> <1051001183818.ZM27904@candle.brasslantern.com> <20051001202856.GA134@DervishD> <1051002044052.ZM28373@candle.brasslantern.com> <20051002190940.437F9866F@pwstephenson.fsnet.co.uk> <1051002195518.ZM2163@candle.brasslantern.com> <20051002230027.GA194@DervishD> <1051003013758.ZM3107@candle.brasslantern.com> <20051003095738.3de5a059.pws@csr.com> <1051003145142.ZM4427@candle.brasslantern.com> Comments: In-reply-to Bart Schaefer message dated "Mon, 03 Oct 2005 14:51:41 -0000." Date: Mon, 03 Oct 2005 16:10:51 +0100 Message-ID: <5929.1128352251@csr.com> From: Peter Stephenson X-OriginalArrivalTime: 03 Oct 2005 15:12:47.0424 (UTC) FILETIME=[E9A97400:01C5C82C] Content-Type: text/plain MIME-Version: 1.0 X-Scanned-By: MailControl A-05-40-00 (www.mailcontrol.com) on 10.67.0.122 X-Spam-Checker-Version: SpamAssassin 3.0.4 (2005-06-05) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.0.4 Bart Schaefer wrote: > It could also be argued that, if the trap should behave like an "eval", > it ought to set $? = 1 when an error occurs inside the trap (but still > not cause an interrupt condition). The example of bash2 contradicts > that position. Can anyone who is reading this try ksh? ksh appears to set the status to 1. > Here's a possible compromise: Use my second patch, but propagate the > error if and only if we're in the try-block of an always-construct. > That's guaranteed not to break old code, and continues to behave like > bash2 in the absence of "always". Can dotrapargs() determine that it > is in "always" context without too much trouble? It can test try_errflag, which is usually -1 when not in an always block and >= 0 otherwise. However that's the value of TRY_BLOCK_ERROR which can be set by the user, so isn't actually guaranteed to be -1 outside. Either adding another flag not tied to a variable or rejecting user attempts to set TRY_BLOCK_ERROR when it's current value is less than zero (and therefore presumably only let it be set to such a number) would work around this. But do you mean how can it test if it's in the try block part? There's no explicit test for that at the moment, but it's easy to add a variable. pws This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com