groff-commit
[Top][All Lists]
Advanced

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

[groff] 06/80: Fix Savannah #66476 (strict POSIX.1-2017 regexes)


From: G. Branden Robinson
Subject: [groff] 06/80: Fix Savannah #66476 (strict POSIX.1-2017 regexes)
Date: Sat, 30 Nov 2024 04:02:12 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit a6bb85ea44726a1f0a7761a3a962a5941478a992
Author: Paul Eggert <eggert@cs.ucla.edu>
AuthorDate: Fri Nov 22 10:59:33 2024 -0800

    Fix Savannah #66476 (strict POSIX.1-2017 regexes)
    
    * arch/djgpp/config.sed:
    * bootstrap.conf:
    * contrib/mm/tests/lists-indent-correctly.sh:
    * src/roff/groff/tests/backslash-X-works.sh:
    * src/roff/groff/tests/device-control-special-character-handling.sh:
    * src/roff/groff/tests/device-request-works.sh: Use strict POSIX.1-2017
      regexes with grep and sed.
    
    In POSIX.1-2017, the regular expression '\]' has undefined behavior.
    In POSIX.1-2024 it's equivalent to ']', but the groff build process
    should not yet rely on this.
    
    Fixes <https://savannah.gnu.org/bugs/?66476>.
---
 ChangeLog                                               | 17 +++++++++++++++++
 arch/djgpp/config.sed                                   |  2 +-
 bootstrap.conf                                          |  2 +-
 contrib/mm/tests/lists-indent-correctly.sh              |  6 +++---
 src/roff/groff/tests/backslash-X-works.sh               |  2 +-
 .../tests/device-control-special-character-handling.sh  |  4 ++--
 src/roff/groff/tests/device-request-works.sh            |  2 +-
 7 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index af8e607c9..29b39589d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2024-11-22  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * arch/djgpp/config.sed:
+       * bootstrap.conf:
+       * contrib/mm/tests/lists-indent-correctly.sh:
+       * src/roff/groff/tests/backslash-X-works.sh:
+       * src/roff/groff/tests/\
+       device-control-special-character-handling.sh:
+       * src/roff/groff/tests/device-request-works.sh: Use strict
+       POSIX.1-2017 regexes with grep and sed.
+
+       In POSIX.1-2017, the regular expression '\]' has undefined
+       behavior.  In POSIX.1-2024 it's equivalent to ']', but the groff
+       build process should not yet rely on this.
+
+       Fixes <https://savannah.gnu.org/bugs/?66476>.
+
 2024-11-21  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * src/libs/libgroff/font.cpp (font::load): Declare `start_code`
diff --git a/arch/djgpp/config.sed b/arch/djgpp/config.sed
index 72c5fb130..fc310f704 100644
--- a/arch/djgpp/config.sed
+++ b/arch/djgpp/config.sed
@@ -11,7 +11,7 @@
 
 # DOS-style absolute file names should be supported as well
 /\*) srcdir=/s,/\*,[\\\\/]* | [A-z]:[\\\\/]*,
-/\$]\*) INSTALL=/s,\[/\$\]\*,[\\\\/$]* | [A-z]:[\\\\/]*,
+/\$]\*) INSTALL=/s,\[/\$]\*,[\\\\/$]* | [A-z]:[\\\\/]*,
 
 # Who said each line has only \012 at its end?
 /DEFS=`sed -f/s,'\\012','\\012\\015',
diff --git a/bootstrap.conf b/bootstrap.conf
index 01e4b4b3c..893c9a450 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -74,7 +74,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/contrib/mm/tests/lists-indent-correctly.sh 
b/contrib/mm/tests/lists-indent-correctly.sh
index eb028886b..be944bd17 100755
--- a/contrib/mm/tests/lists-indent-correctly.sh
+++ b/contrib/mm/tests/lists-indent-correctly.sh
@@ -258,7 +258,7 @@ echo "checking indentation of ML list with text indent, 
second line" >&2
 echo "$output" | grep -Eq "^ {12}e17" || wail
 
 echo "checking indentation of RL list, first line" >&2
-echo "$output" | grep -Eq "^ {8}\[1\] f1" || wail
+echo "$output" | grep -Eq "^ {8}\[1] f1" || wail
 
 echo "checking indentation of RL list, second line" >&2
 echo "$output" | grep -Eq "^ {12}f17" || wail
@@ -288,7 +288,7 @@ echo "checking indentation of prefixed DL list, second 
line" >&2
 echo "$output" | grep -Eq "^ {12}j17" || wail
 
 echo "checking indentation of prefixed RL list, first line" >&2
-echo "$output" | grep -Eq "^ {7}\* \[1\] k1" || wail
+echo "$output" | grep -Eq "^ {7}\* \[1] k1" || wail
 
 echo "checking indentation of prefixed RL list, second line" >&2
 echo "$output" | grep -Eq "^ {12}k17" || wail
@@ -312,7 +312,7 @@ echo "checking indentation of padless prefixed DL list, 
second line" >&2
 echo "$output" | grep -Eq "^ {12}n17" || wail
 
 echo "checking indentation of padless prefixed RL list, first line" >&2
-echo "$output" | grep -Eq "^ {7}\*\[1\] o1" || wail
+echo "$output" | grep -Eq "^ {7}\*\[1] o1" || wail
 
 echo "checking indentation of padless prefixed RL list, second line" >&2
 echo "$output" | grep -Eq "^ {12}o17" || wail
diff --git a/src/roff/groff/tests/backslash-X-works.sh 
b/src/roff/groff/tests/backslash-X-works.sh
index a40ea416a..62a426c7c 100755
--- a/src/roff/groff/tests/backslash-X-works.sh
+++ b/src/roff/groff/tests/backslash-X-works.sh
@@ -49,7 +49,7 @@ do
     || wail
   echo "$output"
   # 3 backslashes
-  echo "$output" | grep -q 'x * X *pdf: \\\[u007E\]' || wail
+  echo "$output" | grep -q 'x * X *pdf: \\\[u007E]' || wail
 done
 
 test -z "$fail"
diff --git a/src/roff/groff/tests/device-control-special-character-handling.sh 
b/src/roff/groff/tests/device-control-special-character-handling.sh
index 0321eda91..ceb2c1104 100755
--- a/src/roff/groff/tests/device-control-special-character-handling.sh
+++ b/src/roff/groff/tests/device-control-special-character-handling.sh
@@ -53,7 +53,7 @@ echo "$output" \
 
 #echo "checking device request, default escape character" >&2
 #echo "$output" \
-#  | grep -qx 'x X bogus1: req to-do\\\[u1F00\] -'"'"'"`^\\~' \
+#  | grep -qx 'x X bogus1: req to-do\\\[u1F00] -'"'"'"`^\\~' \
 #  || wail
 
 echo "checking X escape sequence, alternate escape character" >&2
@@ -62,7 +62,7 @@ echo "$output" \
 
 #echo "checking device request, alternate escape character" >&2
 #echo "$output" \
-#  | grep -qx 'x X bogus2: req to-do\\\[u1F00\] -'"'"'"`^\\~' \
+#  | grep -qx 'x X bogus2: req to-do\\\[u1F00] -'"'"'"`^\\~' \
 #  || wail
 
 input='.
diff --git a/src/roff/groff/tests/device-request-works.sh 
b/src/roff/groff/tests/device-request-works.sh
index 52a801a97..ae6d304b9 100755
--- a/src/roff/groff/tests/device-request-works.sh
+++ b/src/roff/groff/tests/device-request-works.sh
@@ -62,7 +62,7 @@ do
     || wail
   echo "$output"
   # 3 backslashes
-  echo "$output" | grep -Eq 'x * X *pdf: \\\[u007E\]' || wail
+  echo "$output" | grep -Eq 'x * X *pdf: \\\[u007E]' || wail
 done
 
 test -z "$fail"



reply via email to

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