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

Re: Issue with histreduceblanks



On Thu, Sep 26, 2013 at 10:47 AM, Raghavendra Prabhu <
raghu.prabhu13@xxxxxxxxx> wrote:

> On Thu, Sep 26, 2013 at 10:42 PM, Bart Schaefer
> <schaefer@xxxxxxxxxxxxxxxx> wrote:> Did you see/try this?
> Yes.
>
> Tested with different combinations:


> ==================
> zsh -f
> Archie% print Only two kinds of witnesses exist.  The first live in a
> neighborhood where !#:7 !#:8 !#:9
> print Only two kinds of witnesses exist.  The first live in a
> neighborhood where The first live
> Only two kinds of witnesses exist. The first live in a neighborhood
> where The first live
>

OK, this is a clue, of sorts.  When you reference !#:7, the parser first
builds an array of the starting and ending positions of each of the words
on the command line, and then pulls out the characters between the seventh
start and seventh end.  So the fact that !#:7 !#:8 !#:9 worked correctly
means it's not having trouble locating the beginning and end of words.


> Archie% print Only two kinds of witnesses exist. he  fisst lvee in a
> neighorrhood whrre he  fisst ivee
>

And here we see that e.g. "live" is sometimes crunched into "lvee" but
other times into "ivee".  Which points to a problem with memcpy() being
handed overlapping regions when doing the actual blank reduction.   This
might be a compiler optimization issue; in any case I think memcpy() is not
guaranteed to work with overlapping regions and histreduceblanks() ought to
be using memmove() instead.  I seem to recall us having to fix this in a
different part of the shell some while ago.


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