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

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

- M.

             reply	other threads:[~2019-05-03 17:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 17:20 Martijn Dekker [this message]
2019-05-03 18:08 ` Mikael Magnusson
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=bc4ab83e-2eb0-6737-1f2c-3530e508b68c@inlv.org \
    --to=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).