]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: avoid \] in REs
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 4 Jun 2022 02:25:59 +0000 (19:25 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 4 Jun 2022 02:45:47 +0000 (19:45 -0700)
* cfg.mk (sc_dd_max_sym_length, sc_prohibit_man_see_also_period):
Do not rely on undefined interpretation of \] in regular expressions.

cfg.mk
src/fmt.c
src/tr.c

diff --git a/cfg.mk b/cfg.mk
index c0ef67e030326127e388387172b9e7525cec7a8f..7d9f40d67ba797ff71694c326c6c190debef5390 100644 (file)
--- a/cfg.mk
+++ b/cfg.mk
@@ -76,8 +76,8 @@ sc_dd_O_FLAGS:
 dd_c = $(srcdir)/src/dd.c
 sc_dd_max_sym_length:
 ifneq ($(wildcard $(dd_c)),)
-       @len=$$( (sed -n '/conversions\[\] =$$/,/^};/p' $(dd_c);\
-                sed -n '/flags\[\] =$$/,/^};/p' $(dd_c) )      \
+       @len=$$( (sed -n '/conversions\[] =$$/,/^};/p' $(dd_c);\
+                sed -n '/flags\[] =$$/,/^};/p' $(dd_c) )       \
                |sed -n '/"/s/^[^"]*"\([^"]*\)".*/\1/p'| wc -L);\
        max=$$(sed -n '/^#define LONGEST_SYMBOL /s///p' $(dd_c) \
              |tr -d '"' | wc -L);              \
@@ -496,7 +496,7 @@ sc_ensure_comma_after_id_est:
 # a period.  Check the first line after each "SEE ALSO" line in man/*.x:
 sc_prohibit_man_see_also_period:
        @grep -nB1 '\.$$' $$($(VC_LIST_EXCEPT) | grep 'man/.*\.x$$')    \
-           | grep -A1 -e '-\[SEE ALSO\]' | grep '\.$$' &&              \
+           | grep -A1 -e '-\[SEE ALSO]' | grep '\.$$' &&               \
          { echo '$(ME): do not end "SEE ALSO" section with a period'   \
              1>&2; exit 1; } || :
 
index 05bafabd6c27e6bdc8dd6803ec9d6939c683f1b3..e5a48e6bfbba72f941cd9c606bbc1f8700297335 100644 (file)
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -672,7 +672,7 @@ same_para (int c)
 /* Read a line from input file F, given first non-blank character C
    after the prefix, and the following indent, and break it into words.
    A word is a maximal non-empty string of non-white characters.  A word
-   ending in [.?!]["')\]]* and followed by end-of-line or at least two
+   ending in [.?!][])"']* and followed by end-of-line or at least two
    spaces ends a sentence, as in emacs.
 
    Return the first non-blank character of the next line.  */
index 0bfe8024b8dd606996cddde7168a565d669f7c4a..e2aa33e7643cee12eb8ac1907389bc2455164f15 100644 (file)
--- a/src/tr.c
+++ b/src/tr.c
@@ -825,7 +825,7 @@ find_bracketed_repeat (const struct E_string *es, size_t start_idx,
 }
 
 /* Return true if the string at ES->s[IDX] matches the regular
-   expression '\*[0-9]*\]', false otherwise.  The string does not
+   expression '\*[0-9]*]', false otherwise.  The string does not
    match if any of its characters are escaped.  */
 
 ATTRIBUTE_PURE
@@ -942,7 +942,7 @@ build_spec_list (const struct E_string *es, struct Spec_list *result)
         try_bracketed_repeat:
 
           /* Determine whether this is a bracketed repeat range
-             matching the RE \[.\*(dec_or_oct_number)?\].  */
+             matching the RE \[.\*(dec_or_oct_number)?].  */
           err = find_bracketed_repeat (es, i + 1, &char_to_repeat,
                                        &repeat_count,
                                        &closing_bracket_idx);