zsh-workers
 help / color / mirror / code / Atom feed
From: Mikael Magnusson <mikachu@gmail.com>
To: Martijn Dekker <martijn@inlv.org>
Cc: Zsh hackers list <zsh-workers@zsh.org>
Subject: Re: [BUG] program flow corruption involving dot script and 'until' loop
Date: Fri, 3 May 2019 20:08:18 +0200	[thread overview]
Message-ID: <CAHYJk3R7mfMCxdTjQLh1akqQt7ExVovUUjoNA9XmOKEmv74x5Q@mail.gmail.com> (raw)
In-Reply-To: <bc4ab83e-2eb0-6737-1f2c-3530e508b68c@inlv.org>

On 5/3/19, Martijn Dekker <martijn@inlv.org> wrote:
> ===begin test.sh===
> #! /bin/sh
> fn() {
> 	echo beginfn
> 	. ./dot.sh
> 	echo endfn$?
> }
> echo begin
> fn
> echo end
> ===end test.sh===
>
> ===begin dot.sh===
> #! /bin/sh
> echo dot
> until return 42; do
> 	:
> done
> ===end dot.sh===
>
> Actual output:
> $ zsh test.sh
> begin
> beginfn
> dot
>
> Expected output:
> $ zsh test.sh
> begin
> beginfn
> dot
> endfn42
> end
>
> Looks like the 'return' in the dot script causes zsh to just give up on
> the program altogether.
>
> If 'return 42' is changed to 'return' in dot.sh, the bug disappears. If
> it is changed to '(exit 42); return', the bug re-appears.
>
> I've tested zsh versions down to 5.0.6; they all act identically.

If I run this interactively
. =(echo until return 1\; do done)
it returns 1 immediately but I am no longer able to invoke any user
widgets (which in my case is both self-insert and accept-line, so it
is quite limiting :).

-- 
Mikael Magnusson

  reply	other threads:[~2019-05-03 18:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 17:20 Martijn Dekker
2019-05-03 18:08 ` Mikael Magnusson [this message]
2019-05-03 19:09 ` Peter Stephenson

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=CAHYJk3R7mfMCxdTjQLh1akqQt7ExVovUUjoNA9XmOKEmv74x5Q@mail.gmail.com \
    --to=mikachu@gmail.com \
    --cc=martijn@inlv.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).