gbranden pushed a commit to branch master
in repository groff.

commit 2768a5891c6a9c0a2bbaf99f7f5d578aa9122248
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Mar 9 23:18:55 2026 -0500

    [groff]: Improve test of Savannah #67139.
    
    * src/roff/groff/tests/do-not-crash-on-mismatched-diversion-request.sh:
      Revise and expand test.  Stop checking for core dump file, as this is
      not necessarily reliable.  Instead seed test input with formattable
      words that we expect to be present or not, depending on whether and
      where the formatter exits abnormally.  Check that closing a `box`
      diversion with `di` is not a fatal error, and that closing a `di`
      diversion with `box` _is_ fatal.
    
    Thanks to Bob Friesenhahn and Zack Weinberg for the suggestion to not
    rely on core dump files as failure oracles.
    
    Tested by temporarily reverting commit 251115ed5a.
    
    ANNOUNCE: Acknowledge Bob and Zack.
---
 ANNOUNCE                                           |  2 +
 ChangeLog                                          | 14 +++++++
 ...do-not-crash-on-mismatched-diversion-request.sh | 43 ++++++++++++++++------
 3 files changed, 47 insertions(+), 12 deletions(-)

diff --git a/ANNOUNCE b/ANNOUNCE
index b8c3bcdc9..bbcc19534 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -208,6 +208,8 @@ of this release.
    similar from the contrib/ change log files may also be necessary. ]]
 
 Bjarni Ingi Gislason
+Bob Friesenhahn
 Clem Cole
 Peng Zhang
 Rocket Ma
+Zack Weinberg
diff --git a/ChangeLog b/ChangeLog
index 59fc3fb2e..48ee23ed4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2026-03-09  G. Branden Robinson <[email protected]>
+
+       * src/roff/groff/tests/\
+       do-not-crash-on-mismatched-diversion-request.sh: Revise and
+       expand test.  Stop checking for core dump file, as this is not
+       necessarily reliable.  Instead seed test input with formattable
+       words that we expect to be present or not, depending on whether
+       and where the formatter exits abnormally.  Check that closing a
+       `box` diversion with `di` is not a fatal error, and that closing
+       a `di` diversion with `box` _is_ fatal.
+
+       Thanks to Bob Friesenhahn and Zack Weinberg for the suggestion
+       to not rely on core dump files as failure oracles.
+
 2026-03-05  G. Branden Robinson <[email protected]>
 
        [troff]: Add internal mechanism for distinguishing validity of
diff --git 
a/src/roff/groff/tests/do-not-crash-on-mismatched-diversion-request.sh 
b/src/roff/groff/tests/do-not-crash-on-mismatched-diversion-request.sh
index 06f8e1557..ce16a33b5 100755
--- a/src/roff/groff/tests/do-not-crash-on-mismatched-diversion-request.sh
+++ b/src/roff/groff/tests/do-not-crash-on-mismatched-diversion-request.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright 2025 G. Branden Robinson
+# Copyright 2025-2026 G. Branden Robinson
 #
 # This file is part of groff, the GNU roff typesetting system.
 #
@@ -16,26 +16,45 @@
 #
 # You should have received a copy of the GNU General Public License
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
 
 groff="${abs_top_builddir:-.}/test-groff"
 
+fail=
+
+wail () {
+  echo "...FAILED" >&2
+  fail=yes
+}
+
 # troff should not perform invalid memory access when using `box` to
 # close a regular diversion.  Savannah #67139.
 
-if [ -e core ]
-then
-  echo "$0: 'core' file already exists; skipping" >&2
-  exit 77 # skip
-fi
+input1='.
+.box d1
+.di
+.box
+HAPAX
+.'
 
-input='.
-.di d
+output1=$(printf '%s\n' "$input1" | "$groff" -a)
+echo "$output1"
+
+echo "checking that closing box diversion with 'di' is not fatal" >&2
+echo "$output1" | grep -q 'HAPAX' || wail
+
+input2='.
+.br
+.di d2
 .box
-all is well
+LEGOMENON
 .'
 
-output=$(printf '%s\n' "$input" | "$groff" -a)
-! test -e core
+output=$(printf '%s\n' "$input2" | "$groff" -a)
+echo "$output2"
+
+echo "checking that closing non-box diversion with 'box' is fatal" >&2
+! echo "$output2" | grep -q 'LEGOMENON' || wail
+
+test -z "$fail"
 
 # vim:set autoindent expandtab shiftwidth=4 tabstop=4 textwidth=72:

_______________________________________________
groff-commit mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/groff-commit

Reply via email to