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

Re: bug in 'repeat' syntax (zsh-3.0.7)



On Dec 5,  4:26pm, Dominik Vogt wrote:
} Subject: bug in 'repeat' syntax (zsh-3.0.7)
}
} There is a minor bug in the parsing of the 'repeat' command in
} zsh-3.0.7.  The repeat count can be any token you like, as long
} as it starts with a digit.

That's happening because the word following the `repeat' keyword is
parsed as a zsh "string" token, meaning it can be a variable reference,
a command or process substitution, a glob, etc.  Most of those don't
make sense, of course, but a variable reference does.

Zsh then expands the string token and calls atoi() on the result.  One
side effect of atoi() is that it ignores trailing garbage after the
integer.  There are several places where this happens, e.g.

    kill -2foo $!

will send SIGINT to the most recent child process.

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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