groff-commit
[Top][All Lists]
Advanced

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

[groff] 34/50: [tests]: Fix "od -c" portability problem.


From: G. Branden Robinson
Subject: [groff] 34/50: [tests]: Fix "od -c" portability problem.
Date: Sat, 21 May 2022 12:17:28 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit e197762252f0dd75f50fd3a50e0273b812ec5793
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Fri May 20 05:14:11 2022 -0500

    [tests]: Fix "od -c" portability problem.
    
    * src/devices/grotty/tests/basic_latin_glyphs_map_correctly.sh: Fix
      portability problem: POSIX says that "od -c" (and "od -t c") are
      supposed to emit printing characters as defined by the underlying
      locale, but GNU coreutils od doesn't do this and macOS od does.  Set
      `LC_ALL` to "C" when running it to force 3-digit octal reporting of
      characters with their eighth bit set.
    
    Fixes <https://savannah.gnu.org/bugs/?62357>.  Thanks to John
    Gardner for the report.  Also see <https://pubs.opengroup.org/\
    onlinepubs/9699919799/utilities/od.html>.
---
 ChangeLog                                                   | 13 +++++++++++++
 .../grotty/tests/basic_latin_glyphs_map_correctly.sh        |  2 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 10e7596c..44038d44 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2022-05-20  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * src/devices/grotty/tests/basic_latin_glyphs_map_correctly.sh:
+       Fix portability problem: POSIX says that "od -c" (and "od -t c")
+       are supposed to emit printing characters as defined by the
+       underlying locale, but GNU coreutils od doesn't do this and
+       macOS od does.  Set `LC_ALL` to "C" when running it to force
+       3-digit octal reporting of characters with their eighth bit set.
+
+       Fixes <https://savannah.gnu.org/bugs/?62357>.  Thanks to John
+       Gardner for the report.  Also see <https://pubs.opengroup.org/\
+       onlinepubs/9699919799/utilities/od.html>.
+
 2022-05-19  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * INSTALL.extra (In Case of Trouble): Add advice on using the
diff --git a/src/devices/grotty/tests/basic_latin_glyphs_map_correctly.sh 
b/src/devices/grotty/tests/basic_latin_glyphs_map_correctly.sh
index a5e9e654..9e9ccfc5 100755
--- a/src/devices/grotty/tests/basic_latin_glyphs_map_correctly.sh
+++ b/src/devices/grotty/tests/basic_latin_glyphs_map_correctly.sh
@@ -165,7 +165,7 @@ do
 #0000320   e   :     342 200 230  \n   m   o   d   i   f   i   e   r
 #0000340   t   i   l   d   e   :     313 234  \n
 #0000352
-        output_od=$(echo "$output" | od -t c)
+        output_od=$(echo "$output" | LC_ALL=C od -t c)
         printf "' " >&2
         printf '%s\n' "$output_od" \
             | grep -Eq '0000200 +q +u +o +t +e +: +342 +200 +231' \



reply via email to

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