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

Re: free() error on simple input scripts



On Wed, 10 Dec 2014 00:45:42 +0900
Jun T. <takimoto-j@xxxxxxxxxxxxxxxxx> wrote:
> 2014/12/07 15:36, Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> 
> >    source =(<<<$'d\\\0')
> 
> The input backslash-null is metafiled by shingetline() to
> backslash-meta-space (since 0 xor 32 = 32 = ' '), but it seems
> the lexer does not treat the meta after backslash specially and
> interprets the space as a word separator; this results in a
> word ending with meta.
> 
> What is the "correct" behavior for the input backslash-null?
> The following may be a possibility but I'm not sure.
> (The ifdef DEBUG part is copied from line 1059 in the same file)

I *think* your patch is correct.

Certainly, it is valid to get metafied input at the lexer.  See for
example the end of zleread() which calls zlegetline() which calls
zlelineasstring (typically --- unless we already have a metafied line)
which metafies the line that's about to be returned.

I'm a bit surprised the lexer doesn't have more cases like this, or a
more general way of dealing with metafied characters, but handling a
backslash the way you suggest looks perfectly OK.  However, wait and see
what Bart says, too.

pws



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