zsh-workers
 help / color / mirror / code / Atom feed
* [BUG] err_exit misbehaviour involving function call inside else
@ 2017-12-14 22:40 dana
  2017-12-14 23:00 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: dana @ 2017-12-14 22:40 UTC (permalink / raw)
  To: zsh-workers

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] err_exit misbehaviour involving function call inside else
  2017-12-14 22:40 [BUG] err_exit misbehaviour involving function call inside else dana
@ 2017-12-14 23:00 ` Bart Schaefer
  2017-12-15  7:51   ` dana
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2017-12-14 23:00 UTC (permalink / raw)
  To: dana; +Cc: zsh-workers

On Thu, Dec 14, 2017 at 2:40 PM, dana <dana@dana.is> wrote:
>
> It seems like it has something to do specifically with calling a function inside
> the body of an `else`.

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [BUG] err_exit misbehaviour involving function call inside else
  2017-12-14 23:00 ` Bart Schaefer
@ 2017-12-15  7:51   ` dana
  0 siblings, 0 replies; 3+ messages in thread
From: dana @ 2017-12-15  7:51 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-workers

On 14 Dec 2017, at 17:00, Bart Schaefer <schaefer@brasslantern.com> wrote:
>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.

It does certainly seem to be in the same general area.

It gives the '1' result in zsh 5.1.1, so it probably was not introduced by that
particular change. zsh 5.0.2 correctly produces '0', however. Maybe a clue.

dana


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-12-15  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-14 22:40 [BUG] err_exit misbehaviour involving function call inside else dana
2017-12-14 23:00 ` Bart Schaefer
2017-12-15  7:51   ` dana

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).