GNU bug report logs - #43862
[PATCH] grep: set RE_NO_SUB for calling regex only to check syntax

Previous Next

Package: grep;

Reported by: Norihiro Tanaka <noritnk <at> kcn.ne.jp>

Date: Thu, 8 Oct 2020 09:41:01 UTC

Severity: normal

Tags: patch

Done: Jim Meyering <jim <at> meyering.net>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 43862-done <at> debbugs.gnu.org (full text, mbox):

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: Jim Meyering <jim <at> meyering.net>
Cc: 43862-done <at> debbugs.gnu.org
Subject: Re: bug#43862: [PATCH] grep: set RE_NO_SUB for calling regex only to
 check syntax
Date: Mon, 02 Nov 2020 13:21:42 +0900
On Sun, 1 Nov 2020 11:39:55 -0800
Jim Meyering <jim <at> meyering.net> wrote:

> We must accept the fact that extreme regular expressions will cause
> resource exhaustion like that when processed by classical regex_*
> functions. This is yet another good reason to prefer PCRE and to use
> grep's -P option. In that case, it fails like this:
> 
> $ printf '(%080000d)\n' | sed 's/0/|/g' |grep -Pf- /dev/null
> grep: regular expression is too large
> 
> I have just pushed your patch, but without adding a test.

I also investigated the slowdown, and I reached the same view as you.

The regex consumes a lot of memory for patterns with normous epsilon
closures.





This bug report was last modified 4 years and 205 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.