groff-commit
[Top][All Lists]
Advanced

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

[groff] 08/24: [hdbtl]: Guard against Solaris tr(1) brain damage.


From: G. Branden Robinson
Subject: [groff] 08/24: [hdbtl]: Guard against Solaris tr(1) brain damage.
Date: Mon, 2 Dec 2024 22:52:28 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit 92fa8c7f64fbcd56396a7230e8d17c75d9d29dbc
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Mon Dec 2 16:15:06 2024 -0600

    [hdbtl]: Guard against Solaris tr(1) brain damage.
    
    * contrib/hdtbl/examples/fonts_n.in:
    * contrib/hdtbl/examples/fonts_x.in: Guard against substandard tr(1)
      implementation on Solaris 10 by forcing locale to "C" when using a
      POSIX regular expression character class.
    
    * HACKING: Document this land mine.
---
 HACKING                           | 2 ++
 contrib/hdtbl/ChangeLog           | 7 +++++++
 contrib/hdtbl/examples/fonts_n.in | 4 +++-
 contrib/hdtbl/examples/fonts_x.in | 4 +++-
 4 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/HACKING b/HACKING
index 49a815884..9a2118a11 100644
--- a/HACKING
+++ b/HACKING
@@ -246,6 +246,8 @@ Here are some portability notes on writing automated tests.
     };
     }
 
+* Solaris 10 tr exits with an error if you try to use a POSIX character
+  class (such as "[:cntrl:]") in any locale but "C".
 
 Updating gnulib
 ---------------
diff --git a/contrib/hdtbl/ChangeLog b/contrib/hdtbl/ChangeLog
index 4a272c74b..ee260d9ec 100644
--- a/contrib/hdtbl/ChangeLog
+++ b/contrib/hdtbl/ChangeLog
@@ -1,3 +1,10 @@
+2024-12-02  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       * examples/fonts_n.in:
+       * examples/fonts_x.in: Guard against substandard tr(1)
+       implementation on Solaris 10 by forcing locale to "C" when using
+       a POSIX regular expression character class.
+
 2024-11-27  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        Fix Savannah #66479 (1b/2).
diff --git a/contrib/hdtbl/examples/fonts_n.in 
b/contrib/hdtbl/examples/fonts_n.in
index d2d2d8263..7c7408714 100644
--- a/contrib/hdtbl/examples/fonts_n.in
+++ b/contrib/hdtbl/examples/fonts_n.in
@@ -57,10 +57,12 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .  el \
 .    ds *args \\n[.fn]
 .
+.\" Solaris 10 `tr` barfs if POSIX character classes are used in a
+.\" locale other than "C".
 .  pso sh -c \
        "printf '%s' '.ds *f ' ; \
         ls \\*[fontpath]/dev\*[.T] \
-        | tr '[:cntrl:]' '[ *]'; \
+        | env LC_ALL=C tr '[:cntrl:]' '[ *]'; \
         echo"
 .
 .  while !"\\*[*args]"" \{\
diff --git a/contrib/hdtbl/examples/fonts_x.in 
b/contrib/hdtbl/examples/fonts_x.in
index 45ff81afc..93ea80ec6 100644
--- a/contrib/hdtbl/examples/fonts_x.in
+++ b/contrib/hdtbl/examples/fonts_x.in
@@ -57,10 +57,12 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 .  el \
 .    ds *args \\n[.fn]
 .
+.\" Solaris 10 `tr` barfs if POSIX character classes are used in a
+.\" locale other than "C".
 .  pso sh -c \
        "printf '%s' '.ds *f ' ; \
         ls \\*[fontpath]/dev\*[.T] \
-        | tr '[:cntrl:]' '[ *]'; \
+        | env LC_ALL=C tr '[:cntrl:]' '[ *]'; \
         echo"
 .
 .  while !"\\*[*args]"" \{\



reply via email to

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