bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] ensure that the regexp [b-a] is diagnosed as invalid


From: Jim Meyering
Subject: [PATCH] ensure that the regexp [b-a] is diagnosed as invalid
Date: Wed, 03 Feb 2010 17:05:57 +0100

I've just pushed the following patch.
It's needed by grep, to accommodate changes I'm about to push there.

It adds a test to gl_REGEX that ensures that re_compiler_pattern
diagnoses [b-a] as invalid when using RE_SYNTAX_POSIX_EGREP.
The net result is no change on x86_64, since on such systems,
the included regex code was already required due to a later test.
However, on [3-6]86-based systems, this macro used to allow
the containing application to use a glibc-provided regex, but with
this change, it will always require the gnulib-supplied one.

I'll file a glibc bug shortly.

>From 18f8ae4bbed4d919e564fe54b94feb6bce2c4c8f Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Tue, 19 Jan 2010 08:25:12 +0100
Subject: [PATCH] ensure that the regexp [b-a] is diagnosed as invalid

* m4/regex.m4 (gl_REGEX): Ensure that re_compiler_pattern
diagnoses [b-a] as invalid when using RE_SYNTAX_POSIX_EGREP.
Currently, glibc-2.11.90-10 fails to do that.
---
 m4/regex.m4 |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/m4/regex.m4 b/m4/regex.m4
index a702252..6bd6b8f 100644
--- a/m4/regex.m4
+++ b/m4/regex.m4
@@ -94,10 +94,17 @@ AC_DEFUN([gl_REGEX],
             s = re_compile_pattern ("a[[:@:>@:]]b\n", 11, &regex);
             /* This should fail with _Invalid character class name_ error.  */
             if (!s)
               return 1;

+            /* Ensure that [b-a] is diagnosed as invalid. */
+            re_set_syntax (RE_SYNTAX_POSIX_EGREP);
+            memset (&regex, 0, sizeof regex);
+            s = re_compile_pattern ("a[b-a]", 6, &regex);
+            if (s == 0)
+              return 1;
+
             /* This should succeed, but does not for glibc-2.1.3.  */
             memset (&regex, 0, sizeof regex);
             s = re_compile_pattern ("{1", 2, &regex);

             if (s)
--
1.7.0.rc1.193.ge8618




reply via email to

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