From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16793 invoked by alias); 28 Sep 2016 10:25:48 -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: 39472 Received: (qmail 4435 invoked from network); 28 Sep 2016 10:25:48 -0000 X-Qmail-Scanner-Diagnostics: from out2-smtp.messagingengine.com 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(66.111.4.26):SA:0(0.0/5.0):. Processed in 0.625759 secs); 28 Sep 2016 10:25:48 -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=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: d.s@daniel.shahaf.name X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at daniel.shahaf.name does not designate permitted sender hosts) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= daniel.shahaf.name; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=mesmtp; bh=EOLK7ILhRdSsBQiICIUGaD5h+Ws=; b=VOSADb dQIbM7Ifrq4U1FndIqHNCjLUBxMtrMSzCK2DK0XfrDdTre3ygRDmsO0HLVGyAsvX gpgUPKBWtTyn+fI9KEI9gC0p51D4EHYU7z/PH61XLmNCji+6Tnva59pPTdoyJldP vuIcjy7NmVQdQi4QLn+2ryTgRjPaIS3OFH8vQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-sasl-enc :x-sasl-enc; s=smtpout; bh=EOLK7ILhRdSsBQiICIUGaD5h+Ws=; b=dg1pY dK9+R8iAzKINdnzjxYnVTwwf0BKlHYLoonCYyOIJ5TyRpWeumfRw5BRYmL/feRPu Zcp0xkmY8oXLksU4vRyx5MVhfcC1obs9boSaZEI2Bo6NK733TCjtA1hTGWTsG5+l +HObqvWhIDO98hItLGCFUxCWvBhbEUUtop7oKo= X-Sasl-enc: Zmtp6AYl7jdnJd8D+U/uDjMo5bvSK1c3IpUq52LrV+C8 1475058337 Date: Wed, 28 Sep 2016 10:24:17 +0000 From: Daniel Shahaf To: zsh-workers@zsh.org Subject: Re: PATCH: [for consideration] TMPSUFFIX Message-ID: <20160928102417.GA2729@fujitsu.shahaf.local2> References: <160925155112.ZM23899@torch.brasslantern.com> <20160926072546.GA28316@fujitsu.shahaf.local2> <160926091922.ZM26758@torch.brasslantern.com> <20160927070039.GA20798@fujitsu.shahaf.local2> <160927122050.ZM13394@torch.brasslantern.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <160927122050.ZM13394@torch.brasslantern.com> User-Agent: Mutt/1.5.23 (2014-03-12) Bart Schaefer wrote on Tue, Sep 27, 2016 at 12:20:50 -0700: > On Sep 27, 7:00am, Daniel Shahaf wrote: > } Using ERRFLAG_ERROR risks aborting too much code (39154 being a recent > } example). > > I'm not sure that's really a valid example for this case -- the trouble > there was not that too much code was aborted, rather that because of a > surrounding use of "eval" not *enough* code was aborted; a scripting > error. What can we do to cause enough code to be aborted in that case? Perhaps something like the following: [[[ diff --git a/Completion/Base/Core/_dispatch b/Completion/Base/Core/_dispatch index 3f6fe5b..8c5220f 100644 --- a/Completion/Base/Core/_dispatch +++ b/Completion/Base/Core/_dispatch @@ -60,7 +60,13 @@ done if [[ -n "$comp" && "$name" != "${argv[-1]}" ]]; then _compskip=patterns - eval "$comp" && ret=0 + { + eval "$comp" && ret=0 + } always { + if (( TRY_BLOCK_ERROR )); then + ... throw the exception ... + fi + } [[ "$_compskip" = (all|*patterns*) ]] && return ret fi ]]] where the ellipsis throws the exception that occurred in the 'eval'. (Sidebar: if errflag ever had the ERRFLAG_HARD bit set but the ERRFLAG_ERROR bit unset, then $TRY_BLOCK_ERROR would be zero; this can't currently occur because ERRFLAG_HARD always occurs alongside ERRFLAG_ERROR..) > } A middle way would be to force the simple command that =(:) was part to > } return 127. > > If we were to parallel other redirection errors, the command should > just return 1. Otherwise I'd say we should report the actual error > number instead of always 127. Agreed. (My bad for being unclear: I said "127" but I meant "non-zero".) > However, I don't see any obvious way to do either of those things from > inside stringsubst().