From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13264 invoked by alias); 23 Aug 2017 17:03:21 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 41588 Received: (qmail 29400 invoked by uid 1010); 23 Aug 2017 17:03:21 -0000 X-Qmail-Scanner-Diagnostics: from know-smtprelay-omc-9.server.virginmedia.net by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(80.0.253.73):SA:0(-1.9/5.0):. Processed in 6.11888 secs); 23 Aug 2017 17:03:21 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, SPF_PASS,T_DKIM_INVALID autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: p.w.stephenson@ntlworld.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | X-Originating-IP: [86.21.219.59] X-Authenticated-User: p.w.stephenson@ntlworld.com X-Spam: 0 X-Authority: v=2.1 cv=aJkN0uJm c=1 sm=1 tr=0 a=utowdAHh8RITBM/6U1BPxA==:117 a=utowdAHh8RITBM/6U1BPxA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=kj9zAlcOel0A:10 a=x7bEGLp0ZPQA:10 a=pGLkceISAAAA:8 a=mue1-eCmsPJr4bF-W8IA:9 a=CjuIK1q_8ugA:10 a=6kGIvZw6iX1k4Y-7sg4_:22 Date: Wed, 23 Aug 2017 17:56:08 +0100 From: Peter Stephenson To: Radon Rosborough , zsh-workers@zsh.org Subject: Re: Question about err_return Message-ID: <20170823175608.4e89cca4@ntlworld.com> In-Reply-To: References: X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.28; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ntlworld.com; s=meg.feb2017; t=1503507370; bh=SnBDSSuSW1rnHFbOnv7EphMly+fQZcGuFgVo0cUuwMY=; h=Date:From:To:Subject:In-Reply-To:References; b=XSd47KVtJ41m4mnZMnrIV/C4JxUwqsgWsTVb0F+YaM7eAdBFx1b1Gjlw/Tun2a69d 3UU7etWZRqfe8po5xCMo0ITBwD90pA1AUtvGkYScGwjQsDq370SKMsERmBXExUav+l Q/JukLPZ9f+gz1bPOkdrFsmXbFK6IrDy0d6ITCxDcJIyMp9fxG8VyeU9PLJ7E3IY3Q 3sEpUHTG5aewbFT8GqPF9JiHonhvMRypFVnt0ryKSkMbFnW52oa6/P4nZNyxcAW9tb MbBWbDF3WxLJEhUmLEz6FObJIt14747d2AsVZZg3KDaF26KTRY3coHllrDmlwbXYyV cbZOmI8nQOeKA== On Sun, 20 Aug 2017 22:28:34 -0700 Radon Rosborough wrote: > Hi all, > > I have a question about err_return. Specifically, why does the > following: > > function { setopt err_return; false; echo 'oh no' } > > print nothing, while > > function { setopt err_return; false; echo 'oh no' } && true > > prints 'oh no'? This seems very inconsistent to me, as I would expect > the result of 'x && true' to be the same as 'x' in all circumstances. It's probably just a bug that we don't reset the state inside functions. We did have tests assuming it worked this way, but it's not documented and not obvious, so I think it makes sense to change it. I can do this, but I need to be careful about one subtlety: whether ERR_EXIT is still suppressed in that case. I think the answer is yes --- it applies globally rather than hierarchically. To go with bash, it would mean (so far as I can see) this applies even if err_exit is explicitly set in the function --- i.e. suppression of the effect really is controlled by internal and not user-visible state. In that case I'll have to do a bit more work separating out the innards of the two options. pws