zsh-workers
 help / color / mirror / code / Atom feed
From: Phil Pennock <zsh-workers+phil.pennock@spodhuis.org>
To: zsh-workers@zsh.org
Subject: Regression / err_return / arithmetic 5.4.x ?
Date: Fri, 15 Sep 2017 16:13:42 -0500	[thread overview]
Message-ID: <20170915211342.GA6027@tower.spodhuis.org> (raw)

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%


             reply	other threads:[~2017-09-15 21:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15 21:13 Phil Pennock [this message]
2017-09-15 21:55 ` Bart Schaefer
2017-09-16  2:38   ` Bart Schaefer
2017-09-18  0:50     ` Bart Schaefer
2017-12-06 17:10       ` Roman Neuhauser
2017-12-06 17:35         ` Peter Stephenson
2017-12-06 19:39           ` Bart Schaefer
2017-12-06 23:02             ` Daniel Shahaf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170915211342.GA6027@tower.spodhuis.org \
    --to=zsh-workers+phil.pennock@spodhuis.org \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).