gbranden pushed a commit to branch master
in repository groff.

commit 6c64fbedc9eacf2014cc40ef96c45cfb2806afa2
Author: G. Branden Robinson <[email protected]>
AuthorDate: Thu Jun 19 11:34:23 2025 -0500

    [tmac]: Fix nonportable test.
    
    * tmac/tests/an-ext_SY-and-YS-work.sh: Use printf(1), not echo(1), when
      an argument contains backslashes.  Thanks to Dave Kemper and Deri
      James for reporting test failures arising from the non-portability of
      backslash usage in echo(1) arguments, which frustratingly did not
      create problems on any systems readily available to me.
---
 ChangeLog                           |  9 +++++++++
 tmac/tests/an-ext_SY-and-YS-work.sh | 26 ++++++++++++++------------
 2 files changed, 23 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 77b02f1b2..1b42c8167 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2025-06-14  G. Branden Robinson <[email protected]>
+
+       * tmac/tests/an-ext_SY-and-YS-work.sh: Use printf(1), not
+       echo(1), when an argument contains backslashes.  Thanks to Dave
+       Kemper and Deri James for reporting test failures arising from
+       the non-portability of backslash usage in echo(1) arguments,
+       which frustratingly did not create problems on any systems
+       readily available to me.
+
 2025-06-09  G. Branden Robinson <[email protected]>
 
        * font/devutf8/devutf8.am (DEVUTF8FONTS): Tweak ordering of
diff --git a/tmac/tests/an-ext_SY-and-YS-work.sh 
b/tmac/tests/an-ext_SY-and-YS-work.sh
index d3c7d3b1a..48317991c 100755
--- a/tmac/tests/an-ext_SY-and-YS-work.sh
+++ b/tmac/tests/an-ext_SY-and-YS-work.sh
@@ -29,7 +29,7 @@ wail () {
 
 input='.TH foo 1 2023-05-13 "groff test suite"
 .SH Name
-foo \\- a command with a very short name
+foo \- a command with a very short name
 .
 .
 .SH Synopsis
@@ -46,11 +46,11 @@ This pre-synopsis text is not often used in practice.
 .
 .P
 .SY foo
-.B \\-h
+.B \-h
 .YS
 .
 .SY foo
-.B \\-\\-help
+.B \-\-help
 .YS
 .
 This post-synopsis text is not often used in practice.
@@ -60,7 +60,7 @@ This post-synopsis text is not often used in practice.
 The real work is done by
 .MR bar 1 .'
 
-output=$(echo "$input" | "$groff" -man -T ascii -P -cbou)
+output=$(printf "%s\n" "$input" | "$groff" -man -T ascii -P -cbou)
 echo "$output"
 
 echo 'checking for 1v of space before non-nested SY request' >&2
@@ -98,7 +98,7 @@ echo "$output" \
 
 input2='.TH foo 3 2024-05-06 "groff test suite"
 .SH Name
-foo \\- a small library for converting strings to integers
+foo \- a small library for converting strings to integers
 .
 .
 .SH Synopsis
@@ -136,7 +136,8 @@ foo \\- a small library for converting strings to integers
 .BI TYPE\~ max );
 .YS'
 
-output2=$(echo "$input2" | "$groff" -rLL=80n -man -T ascii -P -cbou)
+output2=$(printf "%s\n" "$input2" \
+    | "$groff" -rLL=80n -man -T ascii -P -cbou)
 echo "$output2"
 
 echo 'checking for indentation reuse' >&2
@@ -149,18 +150,19 @@ echo "$output2" | grep -q 're-$' && wail
 input3='.
 .TH foo 1 2025-06-06 "groff test suite"
 .SH Name
-foo \\- frobnicate a bar
+foo \- frobnicate a bar
 .SH Synopsis
 .SY foo
-.B \\-\\-baz
-.YS \\&
+.B \-\-baz
+.YS \&
 .
 .P
-.SY \\%ridiculously\\-long\\-command\\-name\\-can\\-you\\-believe\\-it
-\\%\\-\\-equally\\-bafflingly\\-garrulous\\-and\\-interminable\\-option
+.SY \%ridiculously\-long\-command\-name\-can\-you\-believe\-it
+\%\-\-equally\-bafflingly\-garrulous\-and\-interminable\-option
 .'
 
-output3=$(echo "$input3" | "$groff" -rLL=80n -man -T ascii -P -cbou)
+output3=$(printf "%s\n" "$input3" \
+    | "$groff" -rLL=80n -man -T ascii -P -cbou)
 echo "$output3"
 
 echo 'checking that long unbreakable words do not overset' >&2

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

Reply via email to