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

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



On 5/3/19, Martijn Dekker <martijn@xxxxxxxx> 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



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