From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24229 invoked by alias); 15 Sep 2017 21:13:55 -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: 41713 Received: (qmail 24382 invoked by uid 1010); 15 Sep 2017 21:13:55 -0000 X-Qmail-Scanner-Diagnostics: from mx.spodhuis.org 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(94.142.241.89):SA:0(-4.2/5.0):. Processed in 2.281292 secs); 15 Sep 2017 21:13:55 -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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.1 X-Envelope-From: zsh-workers+phil.pennock@spodhuis.org X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=spodhuis.org; s=d201708; h=Content-Type:MIME-Version:Message-ID:Subject:To: From:Date:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=gazbXNFN0qk3U61OvM0ZfdMYh5u6nFwtRo+gRHabLHo=; b=EjZDa/MIXRICgBq4YvjNpq8WOZ SrmwUkLY4V35KWXKNWdGqikuQe53bqJ7MYNnKBwpOaV4/HZxt0C2s0DJGGO8ShCGlQfODbkVHsLv+ 5Uem6/7TZBEJRHlVqj59R3js7xJ4q5tejpaDbQJW7HMPrgykliCLOKy3MXPInLRSnpCJJrQZPzVZt Emz7gCwv6CYmHkbWMlCXXzcsj2G8; Date: Fri, 15 Sep 2017 16:13:42 -0500 From: Phil Pennock To: zsh-workers@zsh.org Subject: Regression / err_return / arithmetic 5.4.x ? Message-ID: <20170915211342.GA6027@tower.spodhuis.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline OpenPGP: url=https://www.security.spodhuis.org/PGP/keys/0x4D1E900E14C1CC04.asc Folks, A function I use has stopped working on the box with zsh 5.4.2 installed but still works on 5.3.1. It looks as though the impact of a false arithmetic return in the control for a while loop is causing early function return instead of being considered "handled" by being part of the control structure. The function is called "arin" and is one of a bunch of autoloads-via-symlink which reference a common "xwhois" function. --------------------------8< whence -f arin >8-------------------------- arin () { setopt local_options warn_create_global err_return no_unset #... local -i loop=1 while ((loop--)) do case $cmd in #... (arin|arinwhois) registry=whois.arin.net ;; esac done $whois -h $registry -- "${override_args:-}$*" | less -FXM } --------------------------8< whence -f arin >8-------------------------- ---------------------------8< fail: 5.4.2 >8---------------------------- % whence -v ztrace{ ztrace{ is an alias for () { setopt localoptions xtrace; % ztrace{ arin 192.0.2.1 } +(anon):0> arin 192.0.2.1 +arin:4> setopt local_options warn_create_global err_return no_unset +arin:6> local cmd=arin +arin:7> local whois='' +arin:8> local registry +arin:9> local override_args +arin:10> local f +arin:11> f=whois +arin:13> [[ -x /usr/bin/whois ]] +arin:14> whois=/usr/bin/whois +arin:15> break +arin:19> [[ -z /usr/bin/whois ]] +arin:24> local -i loop=1 +arin:25> (( loop-- )) +arin:27> case arin (xwhois) +arin:27> case arin (ripe|ripewhois) +arin:27> case arin (testripe|testripewhois) +arin:27> case arin (org|orgwhois) +arin:27> case arin (core|corewhois) +arin:27> case arin (arin|arinwhois) +arin:46> registry=whois.arin.net +arin:25> (( loop-- )) ---------------------------8< fail: 5.4.2 >8---------------------------- Return status from that function is 1. On 5.3.1, the same invocation adds: -----------------------8< success extra: 5.3.1 >8----------------------- +arin:64> /usr/bin/whois -h whois.arin.net -- 121.42.217.44 +arin:64> less -FXM -----------------------8< success extra: 5.3.1 >8----------------------- I can remove the err_return safety check, but this looks like a regression, so I'm reporting it. 5.3.1% zsh -fc 'setopt err_return;(){ local -i l=3; while ((l--)) { echo ": $l" }; echo done }; echo $?' : 2 : 1 : 0 done 0 5.3.1% 5.4.2% % zsh -fc 'setopt err_return;(){ local -i l=3; while ((l--)) { echo ": $l" }; echo done }; echo $?' : 2 : 1 : 0 1 5.4.2%