On Fri, 9 Sep 2016, Jeff King wrote:
> On Fri, Sep 09, 2016 at 11:52:50AM +0200, Johannes Schindelin wrote:
> > > Also I agree with Peff that a test with an embedded NUL would be a
> > > good thing.
> > This is something I will leave to somebody else, as it was not my
> > intention to fix this and I *really* have more pressing things to do right
> > now... Sorry!
> I think it is literally just squashing this into your final patch:
> diff --git a/t/t4061-diff-pickaxe.sh b/t/t4061-diff-pickaxe.sh
> index f0bf50b..37b8dde 100755
> --- a/t/t4061-diff-pickaxe.sh
> +++ b/t/t4061-diff-pickaxe.sh
> @@ -19,4 +19,13 @@ test_expect_success '-G matches' '
> test 4096-zeroes.txt = "$(cat out)"
> +test_expect_success '-G matches after embedded NUL' '
> + printf "one\0two" >file &&
> + git add file &&
> + git commit -m embedded &&
> + echo embedded >expect &&
> + git log -Gtwo --format=%s >actual &&
> + test_cmp expect actual
Thank you for providing me with the patch.
However, the whole idea of supporting regular expressions on buffers with
embedded NULs *is* different from the purpose of this patch series.
And in my quick web search, I got the impression that the presence of
REG_STARTEND really does not guarantee that regexec() won't stop at the
first NUL when rm_eo points after it.
So yeah, the patch would be easy to squash in, but the entire "rat's tail"
of making sure that this works everywhere, *in addition* to making sure
that the crash on mmap()ed buffers no longer occurs, would just delay this
And unfortunately I do not have time for that right now.