GNU bug report logs - #33249
[PATCH] grep: grouping of patterns including back reference

Previous Next

Package: grep;

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

Date: Sat, 3 Nov 2018 11:43:01 UTC

Severity: normal

Tags: patch

Done: Paul Eggert <eggert <at> cs.ucla.edu>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Norihiro Tanaka <noritnk <at> kcn.ne.jp>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 33249 <at> debbugs.gnu.org
Subject: bug#33249: [PATCH] grep: grouping of patterns including back reference
Date: Sun, 04 Nov 2018 08:21:18 +0900
On Sat, 3 Nov 2018 08:29:39 -0700
Paul Eggert <eggert <at> cs.ucla.edu> wrote:

> Norihiro Tanaka wrote:
> > By this change, each fragment is divided into
> > groups by whether the fragment includes back reference in a pattern or
> > not. a frgment which includes back reference constitutes group, and all
> > frgments which include back reference also constitute a group.
> 
> Surely this is not sufficient. An invocation of grep like this:
> 
> grep -E '(a
> b)'
> 
> should be an error, but with the proposed patch won't it be equivalent to "grep -E '(a|b)'" since the pattern has no back-references?

Even the pattern has no back-references, compilation by regex run for
each line.  So Syntax errors will be detected as even your present.

  212:      if (!regex_compile (dc, p, len, dc->pcount, lineno, !backref))
  213:        compilation_failed = true;

  $ env LC_ALL=C src/grep -E '(a
  b)' ~/in
  src/grep: Unmatched ( or \(





This bug report was last modified 5 years and 236 days ago.

Previous Next


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