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

Re: completion on brace + 4 characters doesn't work



On Apr 29, 10:44am, Vincent Lefevre wrote:
}
} > The code there apparently assumes a naive implementation of strcpy()
} > that goes left-to-right incrementing the source and destination
} > pointers in lock step.
} 
} It also assumes that the length of the string is less than len

Not really, because if the naive copy is done then the only thing
that matters is that len >= 0.

} (because the source and the destination may not overlap).  The
} compiler can use this fact to optimize the code. And as this is
} not true, the generated code may be incorrect.

Yes, I was aware of all this, I just didn't think it was worth spelling
out (it's implicitly not "naive").  Keep in mind that this portion of
zle_tricky.c was written at least 10 years ago by a college student;
zsh was rarely if ever built with highly-optimized compilers/libc on
64-bit platforms, at the time.

Which is why I said:

} > It would not surprise me to
} > find this assumption made elsewhere in the zsh sources.

I don't suppose you could run through the entire "make check" test
suite under valgrind?  Even that won't exercise everything but it'll
find the ones most likely to bite somebody.



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