Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Regression / err_return / arithmetic 5.4.x ?
- X-seq: zsh-workers 41713
- From: Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Regression / err_return / arithmetic 5.4.x ?
- Date: Fri, 15 Sep 2017 16:13:42 -0500
- 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;
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- 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%
Messages sorted by:
Reverse Date,
Date,
Thread,
Author