Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

err_exit misbehaviour involving function call inside else #3

Open
okdana opened this issue Jul 2, 2018 · 0 comments
Open

err_exit misbehaviour involving function call inside else #3

okdana opened this issue Jul 2, 2018 · 0 comments
Labels
acknowledged Reported and acknowledged on the ML bug

Comments

@okdana
Copy link
Owner

okdana commented Jul 2, 2018

(workers/42126)

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.

Bart replied:

See the thread w/Subject: "set -e" handling is broken with zsh 5.3.1 and 5.4.1

In particular workers/41608 and workers/41615 ... I wonder if you have
found the regression that wasn't found at the time of that patch.

At the very least this sounds related.

Still an issue in 5.5.1.

@okdana okdana added bug acknowledged Reported and acknowledged on the ML labels Jul 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged Reported and acknowledged on the ML bug
Projects
None yet
Development

No branches or pull requests

1 participant