grep-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

grep branch, master, updated. v3.7-77-g1546617


From: Paul Eggert
Subject: grep branch, master, updated. v3.7-77-g1546617
Date: Tue, 24 May 2022 20:47:39 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  15466174352557a5f9993aba8afb0cf9397b5b2c (commit)
       via  8e0c90966da12c25689c662515731af3c7177d99 (commit)
      from  e7f8e8eb1fd41b308ee10741bbd8068acc1847c2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=15466174352557a5f9993aba8afb0cf9397b5b2c


commit 15466174352557a5f9993aba8afb0cf9397b5b2c
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Tue May 24 16:14:12 2022 -0700

    grep: warn about ‘(+x)’ etc.
    
    These expressions are not portable and don’t always work as
    expected, so warn about them.  For example, “grep -E '(+)'”
    doesn’t act like “grep '\(\+\)'”.
    * src/dfasearch.c (GEAcompile): Warn about a repetition op at the
    start of a regular expression or subexpression, except for ‘*’ in
    BREs which is portable.

diff --git a/NEWS b/NEWS
index 112d85b..499eadf 100644
--- a/NEWS
+++ b/NEWS
@@ -14,7 +14,10 @@ GNU grep NEWS                                    -*- outline 
-*-
   Regular expressions with stray backslashes now cause warnings, as
   their unspecified behavior can lead to unexpected results.
   For example, '\a' and 'a' are not always equivalent
-  <https://bugs.gnu.org/39768>.  The warnings are intended as a
+  <https://bugs.gnu.org/39768>.  Similarly, regular expressions or
+  subexpressions that start with a repetition operator now also cause
+  warnings due to their unspecified behavior; for example, *a(+b|{1}c)
+  now has three reasons to warn.  The warnings are intended as a
   transition aid; they are likely to be errors in future releases.
 
   Regular expressions like [:space:] are now errors even if
diff --git a/src/dfasearch.c b/src/dfasearch.c
index 7547a8a..8d832f0 100644
--- a/src/dfasearch.c
+++ b/src/dfasearch.c
@@ -197,6 +197,8 @@ GEAcompile (char *pattern, idx_t size, reg_syntax_t 
syntax_bits,
   if (match_icase)
     syntax_bits |= RE_ICASE;
   int dfaopts = (DFA_CONFUSING_BRACKETS_ERROR | DFA_STRAY_BACKSLASH_WARN
+                 | DFA_PLUS_WARN
+                 | (syntax_bits & RE_CONTEXT_INDEP_OPS ? DFA_STAR_WARN : 0)
                  | (eolbyte ? 0 : DFA_EOL_NUL));
   dfasyntax (dc->dfa, &localeinfo, syntax_bits, dfaopts);
   bool bs_safe = !localeinfo.multibyte | localeinfo.using_utf8;

http://git.savannah.gnu.org/cgit/grep.git/commit/?id=8e0c90966da12c25689c662515731af3c7177d99


commit 15466174352557a5f9993aba8afb0cf9397b5b2c
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Tue May 24 16:14:12 2022 -0700

    grep: warn about ‘(+x)’ etc.
    
    These expressions are not portable and don’t always work as
    expected, so warn about them.  For example, “grep -E '(+)'”
    doesn’t act like “grep '\(\+\)'”.
    * src/dfasearch.c (GEAcompile): Warn about a repetition op at the
    start of a regular expression or subexpression, except for ‘*’ in
    BREs which is portable.

diff --git a/NEWS b/NEWS
index 112d85b..499eadf 100644
--- a/NEWS
+++ b/NEWS
@@ -14,7 +14,10 @@ GNU grep NEWS                                    -*- outline 
-*-
   Regular expressions with stray backslashes now cause warnings, as
   their unspecified behavior can lead to unexpected results.
   For example, '\a' and 'a' are not always equivalent
-  <https://bugs.gnu.org/39768>.  The warnings are intended as a
+  <https://bugs.gnu.org/39768>.  Similarly, regular expressions or
+  subexpressions that start with a repetition operator now also cause
+  warnings due to their unspecified behavior; for example, *a(+b|{1}c)
+  now has three reasons to warn.  The warnings are intended as a
   transition aid; they are likely to be errors in future releases.
 
   Regular expressions like [:space:] are now errors even if
diff --git a/src/dfasearch.c b/src/dfasearch.c
index 7547a8a..8d832f0 100644
--- a/src/dfasearch.c
+++ b/src/dfasearch.c
@@ -197,6 +197,8 @@ GEAcompile (char *pattern, idx_t size, reg_syntax_t 
syntax_bits,
   if (match_icase)
     syntax_bits |= RE_ICASE;
   int dfaopts = (DFA_CONFUSING_BRACKETS_ERROR | DFA_STRAY_BACKSLASH_WARN
+                 | DFA_PLUS_WARN
+                 | (syntax_bits & RE_CONTEXT_INDEP_OPS ? DFA_STAR_WARN : 0)
                  | (eolbyte ? 0 : DFA_EOL_NUL));
   dfasyntax (dc->dfa, &localeinfo, syntax_bits, dfaopts);
   bool bs_safe = !localeinfo.multibyte | localeinfo.using_utf8;

-----------------------------------------------------------------------

Summary of changes:
 NEWS            | 5 ++++-
 gnulib          | 2 +-
 src/dfasearch.c | 2 ++
 3 files changed, 7 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
grep



reply via email to

[Prev in Thread] Current Thread [Next in Thread]