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

Re: [BUG] In reference to patch 39815, about (z) flag and $( parse error



On Thu, Oct 12, 2017 at 7:54 AM, Sebastian Gniazdowski
<psprint@xxxxxxxxxxx> wrote:
> On 11 października 2017 at 19:02:31, Bart Schaefer (schaefer@xxxxxxxxxxxxxxxx) wrote:
>> Hmm, so the problem appears to be that when parsing a comment, we
>> actually need the NEWLIN token to mark the end of the comment.
>> When parsing code, we need NEWLIN to be ignored as whitespace and
>> not tokenized.
>
> Have you any possible places for the fix?

It'd most likely need to be in bufferwords(), which somehow needs to
know that the STRING token returned from the lexer is [or not] a
comment and that therefore it should [or not] ignore the subsequent
NEWLIN.  However, that cascades all the way down into gettok() which
is where the "#" character is recognized and everything from there up
to but not including the newline is consumed.

> I've ran bisect, and the "<= 5.0.6 doesn't have Z+cn+ problem" holds up to this patch:
>
> commit c0d01a6fe0c67911650730cf13a2b9a0db16e59b
> Date:   Tue Jan 6 17:05:17 2015 +0000
>
>     Fix command substitutions to parse contents as they are read in.

(PWS, it would be helpful if you could include workers article numbers
in your commit logs.)

That commit is this:

        * 34160: Src/init.c, Src/input.c, Src/lex.c, Src/parse.c,
        Src/zsh.h, Test/D08cmdsubst.ztst: fix the problem that command
        and similar substitutions weren't properly parsed so could end
        prematurely.  Use improved resolution in context save and restore
        to allow parsing the substitution while tracking the string.

So it's not that 5.0.6 was correct, it's that we've swapped one
problem [that affects more than just (Z:n:)] for another.



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