From: Paul Eggert Date: Sat, 4 Jun 2022 02:25:59 +0000 (-0700) Subject: maint: avoid \] in REs X-Git-Tag: v9.2~184 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93e099e4c3b659b2e329f655fbdc73fdf594a66e;p=thirdparty%2Fcoreutils.git maint: avoid \] in REs * cfg.mk (sc_dd_max_sym_length, sc_prohibit_man_see_also_period): Do not rely on undefined interpretation of \] in regular expressions. --- diff --git a/cfg.mk b/cfg.mk index c0ef67e030..7d9f40d67b 100644 --- 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; } || : diff --git a/src/fmt.c b/src/fmt.c index 05bafabd6c..e5a48e6bfb 100644 --- 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. */ diff --git a/src/tr.c b/src/tr.c index 0bfe8024b8..e2aa33e764 100644 --- 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);