summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2022-06-03 17:52:19 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2022-06-03 18:09:38 -0700
commit762bd0aa660b0c1c02597e0d2e5c5fbf9bab1b91 (patch)
tree3347e5cd0fd53109bd8ff5ae0a5c659a18de89e9
parent1ba2b66ea45f9bc43cdc0f6f93efa59157d2b2ba (diff)
downloadgnulib-762bd0aa660b0c1c02597e0d2e5c5fbf9bab1b91.tar.gz
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.
-rw-r--r--ChangeLog12
-rwxr-xr-xbuild-aux/bootstrap4
-rw-r--r--build-aux/bootstrap.conf2
-rwxr-xr-xcheck-AC_LIBOBJ2
-rwxr-xr-xgnulib-tool14
-rw-r--r--lib/regex-quote.c4
-rw-r--r--tests/test-regex-quote.c4
-rw-r--r--top/maint.mk8
8 files changed, 31 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 95d1314cdc..5fe5e9ee23 100644
--- 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
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 9c14d24f5e..1f375eef2f 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -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
diff --git a/build-aux/bootstrap.conf b/build-aux/bootstrap.conf
index 16bb3d5e30..da8993ae90 100644
--- a/build-aux/bootstrap.conf
+++ b/build-aux/bootstrap.conf
@@ -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
diff --git a/check-AC_LIBOBJ b/check-AC_LIBOBJ
index 8642ed916f..e722fff422 100755
--- a/check-AC_LIBOBJ
+++ b/check-AC_LIBOBJ
@@ -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
diff --git a/gnulib-tool b/gnulib-tool
index e420b321d2..5993143f3c 100755
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -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++])"
diff --git a/lib/regex-quote.c b/lib/regex-quote.c
index 24beb2508d..9b92e98910 100644
--- a/lib/regex-quote.c
+++ b/lib/regex-quote.c
@@ -26,10 +26,10 @@
#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)
diff --git a/tests/test-regex-quote.c b/tests/test-regex-quote.c
index 79b429ecd3..2282d5f662 100644
--- a/tests/test-regex-quote.c
+++ b/tests/test-regex-quote.c
@@ -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
diff --git a/top/maint.mk b/top/maint.mk
index b9f483bf97..2740c11d36 100644
--- a/top/maint.mk
+++ b/top/maint.mk
@@ -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)