zsh-workers
 help / color / mirror / code / Atom feed
* [BUG] program flow corruption involving dot script and 'until' loop
@ 2019-05-03 17:20 Martijn Dekker
  2019-05-03 18:08 ` Mikael Magnusson
  2019-05-03 19:09 ` Peter Stephenson
  0 siblings, 2 replies; 3+ messages in thread
From: Martijn Dekker @ 2019-05-03 17:20 UTC (permalink / raw)
  To: Zsh hackers list

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

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

end of thread, other threads:[~2019-05-03 19:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 17:20 [BUG] program flow corruption involving dot script and 'until' loop Martijn Dekker
2019-05-03 18:08 ` Mikael Magnusson
2019-05-03 19:09 ` Peter Stephenson

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