groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/35: [nroff]: Improve shell behavior check.


From: G. Branden Robinson
Subject: [groff] 01/35: [nroff]: Improve shell behavior check.
Date: Tue, 10 Dec 2024 16:35:30 -0500 (EST)

gbranden pushed a commit to branch master
in repository groff.

commit c34c6cc58cfb03f3cdb614b9e2dffb8da4cce924
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sat Dec 7 08:51:32 2024 -0600

    [nroff]: Improve shell behavior check.
    
    ...and fix goof in test script.
    
    * src/roff/nroff/nroff.sh: Replace proxy `unset`-based test with an
      actual measurement of parameter expansion.
    
    * src/roff/nroff/tests/verbose_option_works.sh: Fix spurious failure of
      test for grep(1) supporting `-q` and `-x` options.  Continues commit
      e05cf6d3b3, 4 December.
    
    Every time I have to deal with Solaris, it's like gazing into the Abyss.
    
    A test failure of "src/roff/nroff/tests/verbose_option_works.sh" is
    expected on Solaris 10, because 2 of the checks in that script verify
    that option clustering works, and with Solaris 10 /bin/sh, it doesn't.
    The test failure is therefore not spurious.  One can edit the installed
    nroff script in place to use "/usr/xpg4/bin" in its shebang line.
---
 ChangeLog                                    | 13 +++++++++++++
 HACKING                                      | 14 ++++++++++----
 src/roff/nroff/nroff.sh                      |  8 +++++++-
 src/roff/nroff/tests/verbose_option_works.sh |  2 +-
 4 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e12ee4bca..d2dbb6e3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2024-12-07  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [nroff]: Improve shell behavior check and fix goof in test
+       script.
+
+       * src/roff/nroff/nroff.sh: Replace proxy `unset`-based test with
+       an actual measurement of parameter expansion.
+       * src/roff/nroff/tests/verbose_option_works.sh: Fix spurious
+       failure of test for grep(1) supporting `-q` and `-x` options.
+       Continues commt e05cf6d3b3, 4 December.
+
+       * HACKING: Document Solaris frustrations.
+
 2024-12-09  Deri James  <deri@chuzzlewit.myzen.co.uk>
 
        Data provided to .pso must terminate with \n.
diff --git a/HACKING b/HACKING
index b2b4a1533..227c7ed00 100644
--- a/HACKING
+++ b/HACKING
@@ -246,11 +246,17 @@ Here are some portability notes on writing automated 
tests.
     };
     }
 
-* Solaris 10 cksum's output is non-conforming with XPG4.  It uses tabs
-  as field delimiters instead of spaces.
+* Solaris 10's /usr/bin/cksum output is non-conforming with XPG4.  It
+  uses tabs as field delimiters instead of spaces.
 
-* Solaris 10 tr exits with an error if you try to use a POSIX character
-  class (such as "[:cntrl:]") in any locale but "C".
+* Solaris 10's /usr/bin/grep is non-conforming with XPG4; it lacks
+  support for the `-E`, `-F`, `-q`, and `-x` options.
+
+* Solaris 10's /bin/sh is non-conforming with XPG4; it does not support
+  POSIX parameter expansion syntax.
+
+* Solaris 10's /usr/bin/tr exits with an error if you try to use a POSIX
+  character class (such as "[:cntrl:]") in any locale but "C".
 
 * Solaris 10's /usr/xpg4/bin/sh is non-conforming with XPG4.
   (Good job, guys!)
diff --git a/src/roff/nroff/nroff.sh b/src/roff/nroff/nroff.sh
index b66b8bdef..cf1390478 100644
--- a/src/roff/nroff/nroff.sh
+++ b/src/roff/nroff/nroff.sh
@@ -23,7 +23,13 @@
 
 # Screen for shells non-conforming with POSIX Issue 4 (1994).
 badshell=yes
-unset groff_ku7kiodu || badshell=
+# Solaris 10 /bin/sh is so wretched that it not only doesn't support
+# standard parameter expansion, but it also writes diagnostic messages
+# to the standard output instead of standard error.
+if [ -n "$SHELL" ]
+then
+  "$SHELL" -c 'prog=${0##*/}' >/dev/null 2>&1 && badshell=
+fi
 
 if [ -n "$badshell" ]
 then
diff --git a/src/roff/nroff/tests/verbose_option_works.sh 
b/src/roff/nroff/tests/verbose_option_works.sh
index a9f3f6526..56cf8b1b6 100755
--- a/src/roff/nroff/tests/verbose_option_works.sh
+++ b/src/roff/nroff/tests/verbose_option_works.sh
@@ -18,7 +18,7 @@
 # along with this program. If not, see <http://www.gnu.org/licenses/>.
 #
 
-if ! echo foobar | grep -qx . >/dev/null 2>&1
+if ! echo foobar | grep -qx foobar >/dev/null 2>&1
 then
     echo "$0: grep command does not support -qx options; skipping" >&2
     exit 77 # skip



reply via email to

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