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

Re: Command line bug since zsh 3.1.7...



Bart Schaefer wrote:
> There are still other cases where zsh doesn't crash, but doesn't produce
> an error either.  E.g. (even without the following patch):
> 
> schaefer[643] bash -c 'echo |{;}'
> bash: syntax error near unexpected token `;}'
> bash: -c: line 1: `echo |{;}'
> schaefer[644] Src/zsh -fc 'echo |{;}'
> schaefer[645] 

zsh tends to be a bit more lenient with this sort of thing anyway.
Here, the ";" unambiguously indicates the end of a command line, which
just happens to be empty.  I'm not completely sure it's a bug.  Compare,
for example, the behaviour of "for f in ; do; done".  It's quite useful
that this simply does nothing.  (Whether it's valid according to the
various standards is another matter.)

> (Perhaps the patch should set tok = LEXERR only when tok == ENDINPUT ?
> I couldn't decide.)

It looks safer the way it is.

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR Ltd., Science Park, Milton Road,
Cambridge, CB4 0WH, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



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