Re: [PATCH 2/3] diff_populate_filespec: NUL-terminate buffers

2016-09-08 Thread Jeff King
On Thu, Sep 08, 2016 at 09:57:43AM -0700, Junio C Hamano wrote: > Jeff King writes: > > > Between the two options for regexec_buf(), I think you have convinced me > > that REG_STARTEND is better than just using compat/regex everywhere. I > > do think the fallback for platforms like musl should b

Re: [PATCH 2/3] diff_populate_filespec: NUL-terminate buffers

2016-09-08 Thread Johannes Schindelin
Hi Peff & Junio, On Thu, 8 Sep 2016, Junio C Hamano wrote: > Jeff King writes: > > > Between the two options for regexec_buf(), I think you have convinced me > > that REG_STARTEND is better than just using compat/regex everywhere. I > > do think the fallback for platforms like musl should be "u

Re: [PATCH 2/3] diff_populate_filespec: NUL-terminate buffers

2016-09-08 Thread Junio C Hamano
Jeff King writes: > Between the two options for regexec_buf(), I think you have convinced me > that REG_STARTEND is better than just using compat/regex everywhere. I > do think the fallback for platforms like musl should be "use > compat/regex" and not doing an expensive copy (which in most cases

Re: [PATCH 2/3] diff_populate_filespec: NUL-terminate buffers

2016-09-08 Thread Jeff King
On Thu, Sep 08, 2016 at 09:49:38AM +0200, Johannes Schindelin wrote: > > > diff --git a/diff.c b/diff.c > > > index 534c12e..2c5a360 100644 > > > --- a/diff.c > > > +++ b/diff.c > > > @@ -951,7 +951,13 @@ static int find_word_boundaries(mmfile_t *buffer, > > > regex_t *word_regex, > > > { > > >

Re: [PATCH 2/3] diff_populate_filespec: NUL-terminate buffers

2016-09-08 Thread Johannes Schindelin
Hi Junio, On Wed, 7 Sep 2016, Junio C Hamano wrote: > Jeff King writes: > > > What happens to those poor souls on systems without REG_STARTEND? Do > > they get to keep segfaulting? > > > > I think the solution is to push them into setting NO_REGEX. So looking > > at this versus a "regexecn", it

Re: [PATCH 2/3] diff_populate_filespec: NUL-terminate buffers

2016-09-08 Thread Johannes Schindelin
Hi Peff, On Tue, 6 Sep 2016, Jeff King wrote: > On Tue, Sep 06, 2016 at 06:02:59PM +0200, Johannes Schindelin wrote: > > > It will still be quite tricky, because we have to touch a function that is > > rather at the bottom of the food chain: diff_populate_filespec() is called > > from fill_textc

Re: [PATCH 2/3] diff_populate_filespec: NUL-terminate buffers

2016-09-07 Thread Junio C Hamano
Jeff King writes: > What happens to those poor souls on systems without REG_STARTEND? Do > they get to keep segfaulting? > > I think the solution is to push them into setting NO_REGEX. So looking > at this versus a "regexecn", it seems: > > - this lets people keep using their native regexec if

Re: [PATCH 2/3] diff_populate_filespec: NUL-terminate buffers

2016-09-06 Thread Jeff King
On Tue, Sep 06, 2016 at 06:02:59PM +0200, Johannes Schindelin wrote: > It will still be quite tricky, because we have to touch a function that is > rather at the bottom of the food chain: diff_populate_filespec() is called > from fill_textconv(), which in turn is called from pickaxe_match(), and >

Re: [PATCH 2/3] diff_populate_filespec: NUL-terminate buffers

2016-09-06 Thread Johannes Schindelin
Hi Peff, On Tue, 6 Sep 2016, Jeff King wrote: > On Mon, Sep 05, 2016 at 05:45:06PM +0200, Johannes Schindelin wrote: > > > It is true that many code paths populate the mmfile_t structure > > silently appending a NUL, e.g. when running textconv on a temporary > > file and reading the results back

Re: [PATCH 2/3] diff_populate_filespec: NUL-terminate buffers

2016-09-06 Thread Jeff King
On Mon, Sep 05, 2016 at 05:45:06PM +0200, Johannes Schindelin wrote: > It is true that many code paths populate the mmfile_t structure silently > appending a NUL, e.g. when running textconv on a temporary file and > reading the results back into an strbuf. > > The assumption is most definitely wr

[PATCH 2/3] diff_populate_filespec: NUL-terminate buffers

2016-09-05 Thread Johannes Schindelin
While the xdiff machinery is quite capable of working with strings given as pointer and size, Git's add-on functionality simply assumes that we are operating on NUL-terminated strings, e.g. y running regexec() on the provided pointer, with no way to pass the size, too. In general, this assumption