gbranden pushed a commit to branch master
in repository groff.

commit e2bef095c83691002515625adc9f7944c31ea3db
Author: G. Branden Robinson <[email protected]>
AuthorDate: Mon Apr 20 21:28:36 2026 -0500

    [groff]: Regression-test Savannah #68260.
    
    * src/roff/groff/tests/backslash-right-brace-ends-string-definition.sh:
      Do it.
    
    * src/roff/groff/groff.am (groff_TESTS): Run test.
    
    Test fails at this commit.
---
 ChangeLog                                          |  8 +++
 src/roff/groff/groff.am                            |  1 +
 ...backslash-right-brace-ends-string-definition.sh | 63 ++++++++++++++++++++++
 3 files changed, 72 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 476409174..5dd0f7588 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2026-04-20  G. Branden Robinson <[email protected]>
+
+       [groff]: Regression-test Savannah #68257.
+
+       * src/roff/groff/tests/\
+       backslash-right-brace-ends-string-definition.sh: Do it.
+       * src/roff/groff/groff.am (groff_TESTS): Run test.
+
 2026-04-20  G. Branden Robinson <[email protected]>
 
        * src/roff/troff/token.h (token::is_terminator): Add
diff --git a/src/roff/groff/groff.am b/src/roff/groff/groff.am
index 2885d19ec..2c0d21779 100644
--- a/src/roff/groff/groff.am
+++ b/src/roff/groff/groff.am
@@ -49,6 +49,7 @@ groff_TESTS = \
   src/roff/groff/tests/backslash-X-works.sh \
   src/roff/groff/tests/backslash-Y-works.sh \
   src/roff/groff/tests/backslash-exclamation-early-does-not-fail.sh \
+  src/roff/groff/tests/backslash-right-brace-ends-string-definition.sh \
   src/roff/groff/tests/backslash-s-works-with-single-digit-argument.sh \
   src/roff/groff/tests/bd-request-works.sh \
   src/roff/groff/tests/br-and-brp-requests-work.sh \
diff --git 
a/src/roff/groff/tests/backslash-right-brace-ends-string-definition.sh 
b/src/roff/groff/tests/backslash-right-brace-ends-string-definition.sh
new file mode 100755
index 000000000..c8b6c0188
--- /dev/null
+++ b/src/roff/groff/tests/backslash-right-brace-ends-string-definition.sh
@@ -0,0 +1,63 @@
+#!/bin/sh
+#
+# Copyright 2026 G. Branden Robinson
+#
+# This file is part of groff, the GNU roff typesetting system.
+#
+# groff is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# groff is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# 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"
+   fail=yes
+}
+
+# Regression-test Savannah #68260.  Brace escape sequences should not be
+# stored in a string definition.
+
+input='.
+.ec @
+.ds s1 AB@{CD@}EF
+.tm s1=@*(s1
+.ie 1 @{@
+.  ds s2 abc@}def
+.tm s2=@*(s2
+.el .tm OOPS
+.'
+
+output=$(printf '%s\n' "$input" | "$groff" 2>&1)
+echo "$output"
+
+echo "checking that brace escape sequences are discarded" \
+    "from string definition outside of macro definition" >&2
+echo "$output" | grep -qx 's1=ABCDEF' || wail
+
+# The formatter honors the closing brace escape sequence for control
+# flow purposes, but does not store it in the string, and doesn't
+# terminate the branch being taken until the end of the input line.
+# The last element of behavior is shocking to C programmers, but it's
+# what troff has always done.  See "Conditional Blocks" in groff's
+# Texinfo manual.
+
+echo "checking that brace escape sequences are discarded" \
+    "from string definition inside of macro definition" >&2
+output=$(printf '%s\n' "$input" | "$groff" 2>&1)
+echo "$output" | grep -qx 's2=abcdef' || 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