From: dana <dana@dana.is>
To: zsh-workers@zsh.org
Subject: [BUG] err_exit misbehaviour involving function call inside else
Date: Thu, 14 Dec 2017 16:40:12 -0600 [thread overview]
Message-ID: <E908A97A-5F6B-4C97-AE8E-7FA89547B03B@dana.is> (raw)
I'm afraid i have another one.
The following script prints '0' in ksh93, dash, and bash, but '1' in zsh:
fn() { return 1; }
(
set -e
if [ x = y ]; then
fn || :
else
fn || :
fi
:
)
echo $?
It doesn't attempt to execute the `|| :` part at all, just immediately returns
after `fn`.
It seems like it has something to do specifically with calling a function inside
the body of an `else`. If i change `x = y` to `x = x`, then the first `fn || :`
behaves as expected. Or if i change `fn` to `false`, that works too. Or if i
remove the conditional entirely.
Unfortunately i ran up against my inexperience again trying to track it down.
dana
next reply other threads:[~2017-12-14 22:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-14 22:40 dana [this message]
2017-12-14 23:00 ` Bart Schaefer
2017-12-15 7:51 ` dana
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=E908A97A-5F6B-4C97-AE8E-7FA89547B03B@dana.is \
--to=dana@dana.is \
--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).