From: Junio C Hamano <gitster@pobox.com>
To: "René Scharfe" <l.s.r@web.de>
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, 09 Aug 2017 10:47:25 -0700 [thread overview]
Message-ID: <xmqqwp6c63bm.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <13394372-1494-6650-05ec-0122e02664d3@web.de> ("René Scharfe"'s message of "Wed, 9 Aug 2017 19:20:43 +0200")
René Scharfe <l.s.r@web.de> writes:
> There could be any characters except NUL and LF between the 4096 zeros
> and "0$" for the latter to match wrongly, no? So there are 4095
> opportunities for the misleading pattern in a page, with probabilities
> like this:
>
> 0$ 1/256 * 2/256
> .0$ 254/256 * 1/256 * 2/256
> ..0$ (254/256)^2 * 1/256 * 2/256
> .{3}0$ (254/256)^3 * 1/256 * 2/256
>
> .{4094}0$ (254/256)^4094 * 1/256 * 2/256
>
> That sums up to ca. 1/256 (did that numerically). Does that make
> sense?
Yes, thanks. I think the number would be different for "^0*$" (the
above is for "0$") and moves it down to ~1/30000, but as I said,
allowing additional false success rate is unnecessary (even if it is
miniscule enough to be acceptable), so let's take the 64*64 patch.
>> So we are saying that we accept ~1/100 false success rate, but
>> additional ~1/30000 is unacceptable.
>>
>> I do not know if I buy that argument, but I do think that additional
>> false success rate, even if it is miniscule, is unnecessary. So as
>> long as everybody's regexp library is happy with "^0{64}{64}$",
>> let's use that.
>
> The parentheses are necessary ("^(0{64}){64}$"), at least on OpenBSD.
Sorry, what I wrote was merely a typo; the one from you I applied
did have the parens so we are good.
Thanks.
next prev parent reply other threads:[~2017-08-09 17:47 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
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 [this message]
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqwp6c63bm.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=dcoppa@openbsd.org \
--cc=git@vger.kernel.org \
--cc=l.s.r@web.de \
--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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).