From: "René Scharfe" <l.s.r@web.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"Git List" <git@vger.kernel.org>,
"David Coppa" <dcoppa@openbsd.org>,
"SZEDER Gábor" <szeder.dev@gmail.com>
Subject: Re: [PATCH] t4062: stop using repetition in regex
Date: Wed, 9 Aug 2017 00:34:30 +0200 [thread overview]
Message-ID: <cd60d779-fe38-4f0e-4d36-2c40b2afec7d@web.de> (raw)
In-Reply-To: <xmqq7eydae7r.fsf@gitster.mtv.corp.google.com>
Am 09.08.2017 um 00:26 schrieb Junio C Hamano:
> Junio C Hamano <gitster@pobox.com> writes:
>
>> So I find Dscho's concern quite valid, even though I do believe you
>> when you say the code somehow segfaults. I just can not tell
>> how/why it would segfault, though---it is possible that regexec()
>> implementation is stupid and does not realize that it can return early
>> reporting success without looking at the rest of the buffer, but
>> somehow I find it unlikely.
>>
>> Puzzled.
>>
>>> You get different results? How is that possible? The search string is
>>> NUL-terminated in each case, while the point of the test is that the
>>> file contents isn't, right?
>
> Intellectual curiosity tells me we may want to find out why it
> fails, but in the meantime, I think replacing the test with "0$" to
> force the scanner to find either the end of line or the end of the
> buffer may be a good workaround. We do not have to care how many of
> random bytes are in front of the last "0" in order to ensure that
> the regexec_buf() does not overstep to 4097th byte, while seeing
> that regexec() that does not know how long the haystack is has to do
> so, no?
Our regexec() calls strlen() (see my other reply).
Using "0$" looks like the best option to me.
René
next prev parent reply other threads:[~2017-08-08 22:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-08 6:53 [PATCH] t4062: stop using repetition in regex René Scharfe
2017-08-08 14:49 ` Johannes Schindelin
2017-08-08 15:18 ` René Scharfe
2017-08-08 22:09 ` Junio C Hamano
2017-08-08 22:26 ` Junio C Hamano
2017-08-08 22:34 ` René Scharfe [this message]
2017-08-09 5:29 ` Junio C Hamano
2017-08-09 6:15 ` René Scharfe
2017-08-09 14:15 ` René Scharfe
2017-08-09 14:25 ` David Coppa
2017-08-09 21:49 ` Johannes Schindelin
2017-08-09 16:07 ` Junio C Hamano
2017-08-09 17:20 ` René Scharfe
2017-08-09 17:47 ` Junio C Hamano
2017-08-10 6:08 ` René Scharfe
2017-08-11 18:20 ` Junio C Hamano
2017-08-08 22:27 ` René Scharfe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cd60d779-fe38-4f0e-4d36-2c40b2afec7d@web.de \
--to=l.s.r@web.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=dcoppa@openbsd.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=szeder.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).