git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Thu, 10 Aug 2017 08:08:20 +0200	[thread overview]
Message-ID: <faa74d6d-90b5-2de1-6478-854d3d52d30e@web.de> (raw)
In-Reply-To: <xmqqwp6c63bm.fsf@gitster.mtv.corp.google.com>

Am 09.08.2017 um 19:47 schrieb Junio C Hamano:
> 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.

Ah, right, now I get your calculation in the email I replied to above.
"^0*$" has a probability of 2/255 to produce false positives.

Thanks,
René

  reply	other threads:[~2017-08-10  6:08 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
2017-08-10  6:08                       ` René Scharfe [this message]
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=faa74d6d-90b5-2de1-6478-854d3d52d30e@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).