Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug: Wrong completion of $(( $(!cmd
- X-seq: zsh-workers 23128
- From: Peter Stephenson <pws@xxxxxxx>
- To: Zsh Hackers <zsh-workers@xxxxxxxxxx>
- Subject: Re: Bug: Wrong completion of $(( $(!cmd
- Date: Tue, 23 Jan 2007 15:35:28 +0000
- In-reply-to: <070123072344.ZM12121@xxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <slrnepu2ml.2tv.joerg@xxxxxxxxxxxx> <20070122234306.GA24536@xxxxxxxxxxxxxxx> <200701231304.l0ND4b3t011195@xxxxxxxxxxxxxx> <070123072344.ZM12121@xxxxxxxxxxxxxxxxxxxxxx>
Bart Schaefer wrote:
> On Jan 23, 1:04pm, Peter Stephenson wrote:
> }
> } The problem is somewhere here (in lex.c). If dquote_parse() returns
> } non-zero it's an error indication, not a character, so the hungetc(c)
> } is definitely wrong in that case.
>
> I don't think that's true.
I presume you mean the second statement. If you've got any evidence
against the first statement I'd like to see it.
> If you look at the tail end of dquote_parse()
> you'll see that if lexstop is false the return value of dquote_parse() is
> overloaded -- it's both an error indication AND the most recently read
> character from the input stream. That's what hungetc() is trying to put
> back in that spot in cmd_or_math().
>
> That doesn't make it correct, but that's what's going on. There must be
> (or have been at some past time) some other reason higher up the parse
> tree why that final character needed to be retained.
I looked a bit further and it seems it's used in gettokstr() to
hungetc() a character when we have an error. I don't understand what
that buys when we can't parse the input anyway, particularly since we
don't even know if it's a valid character because of the other way of
setting the value; could it have been a hack to get history lines to be
stored properly after an error? I recall we improved that at some
point, so this hack may not be necessary.
I traced it (the "err = c" thing in dquote_parse()) back in the code to
3.0.0, which is before the use in cmd_or_math() that is causing the
problem, so it wasn't introduced specifically for that, and
cmd_or_math() was roughly the way it now is right back in 3.0.8.
Consequently (although what you say is true) I don't see anything wrong
with the proposed change.
--
Peter Stephenson <pws@xxxxxxx> Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070
To access the latest news from CSR copy this link into a web browser: http://www.csr.com/email_sig.php
To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview
Messages sorted by:
Reverse Date,
Date,
Thread,
Author