Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

[BUG] program flow corruption involving dot script and 'until' loop



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



Messages sorted by: Reverse Date, Date, Thread, Author