]> Savannah Git Hosting - gnulib.git/commitdiff
regex-quote: \] -> ] in EREs and BREs
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 4 Jun 2022 00:52:19 +0000 (17:52 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 4 Jun 2022 01:09:38 +0000 (18:09 -0700)
* build-aux/bootstrap:
* build-aux/bootstrap.conf (gettext_external):
* check-AC_LIBOBJ:
* lib/regex-quote.c (bre_special, ere_special):
* gnulib-tool (func_modules_transitive_closure)
(func_emit_autoconf_snippet, func_import, func_create_testdir):
* tests/test-regex-quote.c (test_bre, test_ere):
* top/maint.mk (longopt_re, gpg_key_ID):
Don’t use \] in BREs and EREs, as POSIX says the interpretation is
undefined.

ChangeLog
build-aux/bootstrap
build-aux/bootstrap.conf
check-AC_LIBOBJ
gnulib-tool
lib/regex-quote.c
tests/test-regex-quote.c
top/maint.mk

index 95d1314cdc785b0c4ed951ec90aa7bcb0d77d44c..5fe5e9ee23a62cd1db8668027c42fb8cdadec561 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,17 @@
 2022-06-03  Paul Eggert  <eggert@cs.ucla.edu>
 
+       regex-quote: \] -> ] in EREs and BREs
+       * build-aux/bootstrap:
+       * build-aux/bootstrap.conf (gettext_external):
+       * check-AC_LIBOBJ:
+       * lib/regex-quote.c (bre_special, ere_special):
+       * gnulib-tool (func_modules_transitive_closure)
+       (func_emit_autoconf_snippet, func_import, func_create_testdir):
+       * tests/test-regex-quote.c (test_bre, test_ere):
+       * top/maint.mk (longopt_re, gpg_key_ID):
+       Don’t use \] in BREs and EREs, as POSIX says the interpretation is
+       undefined.
+
        filevercmp: don’t treat entire filename as suffix
        Problem reported by Artém S. Tashkinóv in:
        https://lists.gnu.org/r/bug-gnulib/2022-06/msg00012.html
index 9c14d24f5e8b845d134672833fd9007d86d6e356..1f375eef2fd515a6c2cc07210ddf23a5b32c12e9 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2022-03-21.01; # UTC
+scriptversion=2022-06-04.00; # UTC
 
 # Bootstrap this package from checked-out sources.
 
@@ -487,7 +487,7 @@ fi
 
 # Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
 found_aux_dir=no
-grep '^[        ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'\])' configure.ac \
+grep '^[        ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'])' configure.ac \
     >/dev/null && found_aux_dir=yes
 grep '^[        ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
     >/dev/null && found_aux_dir=yes
index 16bb3d5e304f22d403c90be2d1ecc384c21656c2..da8993ae90271768608c86bb18ac93e4e44b736e 100644 (file)
@@ -38,7 +38,7 @@ XGETTEXT_OPTIONS=$XGETTEXT_OPTIONS'\\\
 gettext_external=0
 grep '^[        ]*AM_GNU_GETTEXT(external\>' configure.ac > /dev/null &&
   gettext_external=1
-grep '^[        ]*AM_GNU_GETTEXT(\[external\]' configure.ac > /dev/null &&
+grep '^[        ]*AM_GNU_GETTEXT(\[external]' configure.ac > /dev/null &&
   gettext_external=1
 
 if test $gettext_external = 1; then
index 8642ed916f080f80e7b187f713e75df2ef9face8..e722fff422371a354e60bd515ab004efb6fc5528 100755 (executable)
@@ -20,7 +20,7 @@
 exitcode=0
 for module in `./gnulib-tool --list`; do
   f=modules/$module
-  for g in `sed -n -e 's/^ *AC_LIBOBJ(\[\(.*\)\]).*/\1/p' < $f`; do
+  for g in `sed -n -e 's/^ *AC_LIBOBJ(\[\(.*\)]).*/\1/p' < $f`; do
     if grep "^lib/$g\.c\$" $f >/dev/null; then
       :
     else
index e420b321d29698438c433ebebb38056b675ff2f9..5993143f3cb21f0f6da4e7de810b81ceadc9bae0 100755 (executable)
@@ -3178,8 +3178,8 @@ func_modules_transitive_closure ()
                 sed_extract_condition1='/^ *'"$escaped_dep"' *$/{
                   s/^.*$/true/p
                 }'
-                sed_extract_condition2='/^ *'"$escaped_dep"' *\[.*\] *$/{
-                  s/^ *'"$escaped_dep"' *\[\(.*\)\] *$/\1/p
+                sed_extract_condition2='/^ *'"$escaped_dep"' *\[.*] *$/{
+                  s/^ *'"$escaped_dep"' *\[\(.*\)] *$/\1/p
                 }'
                 condition=`func_get_dependencies $module | sed -n -e "$sed_extract_condition1" -e "$sed_extract_condition2"`
                 if test "$condition" = true; then
@@ -4637,7 +4637,7 @@ func_emit_autoconf_snippet ()
           fi
         } \
       | { if $disable_gettext; then
-            sed -e 's/AM_GNU_GETTEXT(\[external\])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
+            sed -e 's/AM_GNU_GETTEXT(\[external])/dnl you must add AM_GNU_GETTEXT([external]) or similar to configure.ac./'
           else
             # Don't indent AM_GNU_GETTEXT_VERSION line, as that confuses
             # autopoint through at least GNU gettext version 0.18.2.
@@ -5033,12 +5033,12 @@ func_import ()
         s,#.*$,,
         s,^dnl .*$,,
         s, dnl .*$,,
-        /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST\], \[/ {
+        /AC_DEFUN(\['"${cached_macro_prefix}"'_FILE_LIST], \[/ {
           s,^.*$,cached_files=",p
           n
           ta
           :a
-          s,^\]).*$,",
+          s,^]).*$,",
           tb
           s,["$`\\],,g
           p
@@ -6694,7 +6694,7 @@ func_create_testdir ()
            esac
          fi
        done \
-         | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
+         | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)])/\1/'
        if test "$libtool" = true; then
          echo "LT_INIT([win32-dll])"
          echo "LT_LANG([C++])"
@@ -6806,7 +6806,7 @@ func_create_testdir ()
        func_get_autoconf_early_snippet "$module"
      fi
    done \
-     | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)\])/\1/'
+     | sed -e '/^$/d;' -e 's/AC_REQUIRE(\[\([^()]*\)])/\1/'
    if test "$libtool" = true; then
      echo "LT_INIT([win32-dll])"
      echo "LT_LANG([C++])"
index 24beb2508dea5285099ecc4efb15719df3c6cef7..9b92e9891019aa8795c5d79d7c2de72eb7e9a19a 100644 (file)
 #include "xalloc.h"
 
 /* Characters that are special in a BRE.  */
-static const char bre_special[] = "$^.*[]\\";
+static const char bre_special[] = "$^.*[\\";
 
 /* Characters that are special in an ERE.  */
-static const char ere_special[] = "$^.*[]\\+?{}()|";
+static const char ere_special[] = "$^.*[\\+?{}()|";
 
 struct regex_quote_spec
 regex_quote_spec_posix (int cflags, bool anchored)
index 79b429ecd34dba6176783911b44d8e61080fe52f..2282d5f6627525d2b0e32825fac96658d5dea136 100644 (file)
@@ -78,14 +78,14 @@ static void
 test_bre (void)
 {
   check ("aBc", 0, "aBc");
-  check ("(foo[$HOME])", 0, "(foo\\[\\$HOME\\])");
+  check ("(foo[$HOME])", 0, "(foo\\[\\$HOME])");
 }
 
 static void
 test_ere (void)
 {
   check ("aBc", REG_EXTENDED, "aBc");
-  check ("(foo[$HOME])", REG_EXTENDED, "\\(foo\\[\\$HOME\\]\\)");
+  check ("(foo[$HOME])", REG_EXTENDED, "\\(foo\\[\\$HOME]\\)");
 }
 
 int
index b9f483bf973f64b09195b7279e9a03620f6fc9f2..2740c11d360a70c026800d3fe97a27d89c26cc11 100644 (file)
@@ -823,7 +823,7 @@ sc_trailing_blank:
 # Match lines like the following, but where there is only one space
 # between the options and the description:
 #   -D, --all-repeated[=delimit-method]  print all duplicate lines\n
-longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
+longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*]?)?
 sc_two_space_separator_in_usage:
        @prohibit='^   *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$'         \
        halt='help2man requires at least two spaces between an option and its description'\
@@ -1390,7 +1390,7 @@ gpg_key_ID ?=                                                             \
   $$(cd $(srcdir)                                                      \
      && git cat-file tag v$(VERSION)                                   \
         | $(gpgv) --status-fd 1 --keyring /dev/null - - 2>/dev/null    \
-        | $(AWK) '/^\[GNUPG:\] ERRSIG / {print $$3; exit}')
+        | $(AWK) '/^\[GNUPG:] ERRSIG / {print $$3; exit}')
 gpg_key_email ?=                                                       \
   $$(gpg --list-key --with-colons $(gpg_key_ID) 2>/dev/null            \
        | $(AWK) -F: '/^uid/ {print $$10; exit}'                        \
@@ -1743,8 +1743,8 @@ _gl_TS_unmarked_extern_vars ?=
 # a macro like this: GLOBAL(type, var_name, initializer), then you
 # can override this definition to automatically extract those names:
 # export _gl_TS_var_match = \
-#   /^(?:$(_gl_TS_extern)) .*?\**(\w+)(\[.*?\])?;/ || /\bGLOBAL\(.*?,\s*(.*?),/
-_gl_TS_var_match ?= /^(?:$(_gl_TS_extern)) .*?(\w+)(\[.*?\])?;/
+#   /^(?:$(_gl_TS_extern)) .*?\**(\w+)(\[.*?])?;/ || /\bGLOBAL\(.*?,\s*(.*?),/
+_gl_TS_var_match ?= /^(?:$(_gl_TS_extern)) .*?(\w+)(\[.*?])?;/
 
 # The names of object files in (or relative to) $(_gl_TS_dir).
 _gl_TS_obj_files ?= *.$(OBJEXT)