groff-commit
[Top][All Lists]
Advanced

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

[groff] 01/03: Catch nroff/groff version desync.


From: G. Branden Robinson
Subject: [groff] 01/03: Catch nroff/groff version desync.
Date: Mon, 13 Apr 2020 08:59:51 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit e44b590c872aa7d334cfceab0b40ac7291684541
Author: G. Branden Robinson <address@hidden>
AuthorDate: Mon Apr 13 21:33:19 2020 +1000

    Catch nroff/groff version desync.
    
    Note that this commit will likely lead to a failing test case (but
    perhaps not, if your build environment lacks a system groff).
    
    It's too easy for the nroff version to get desynced from the groff
    version when we're running test cases, leading to spurious results.
    Make it easier to see a discrepancy.
    
    * src/roff/nroff/nroff.sh: Call groff with -v or --version when we are
      called that way.
    
    * src/roff/nroff/tests/verbose_option_works.sh.in: Check the nroff
      version being tested against the groff version being wrapped.  This
      exposes a bug; the system groff rather than the build tree groff was
      being invoked.
    
    Also delete an old comment in nroff.sh.  The file uses the Stephen
    Bourne "brace style" now, so the issue is unlikely to recur.
---
 ChangeLog                                       | 14 ++++++++++++++
 src/roff/nroff/nroff.sh                         |  4 +---
 src/roff/nroff/tests/verbose_option_works.sh.in |  9 +++++++++
 3 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 00fe35f..60f8da1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2020-04-13  G. Branden Robinson <address@hidden>
 
+       It's too easy for the nroff version to get desynced from the
+       groff version when we're running test cases, leading to spurious
+       results.  Make it easier to see a discrepancy.
+
+       * src/roff/nroff/nroff.sh: Call groff with -v or --version when
+       we are called that way.
+
+       * src/roff/nroff/tests/verbose_option_works.sh.in: Check the
+       nroff version being tested against the groff version being
+       wrapped.  This exposes a bug; the system groff rather than the
+       build tree groff was being invoked.
+
+2020-04-13  G. Branden Robinson <address@hidden>
+
        Make our assert() C99-conformant.
 
        groff has its own implementation of the standard C library's
diff --git a/src/roff/nroff/nroff.sh b/src/roff/nroff/nroff.sh
index 220ccdb..ccddddb 100644
--- a/src/roff/nroff/nroff.sh
+++ b/src/roff/nroff/nroff.sh
@@ -59,8 +59,6 @@ case "`exec 2>/dev/null ; locale charmap`" in
     esac ;;
 esac
 
-# 'for i; do' (with the semicolon) doesn't work with some versions of sh
-
 Topt=
 opts=
 dry_run=
@@ -93,7 +91,7 @@ do
       dry_run=yes ;;
     -v | --version)
       echo "GNU nroff (groff) version @VERSION@"
-      exit 0 ;;
+      opts="$opts $1" ;;
     --help)
       cat <<EOF
 usage: nroff [-cChipStUV] [-dCS] [-mNAME] [-MDIR] [-nNUM] [-oLIST]
diff --git a/src/roff/nroff/tests/verbose_option_works.sh.in 
b/src/roff/nroff/tests/verbose_option_works.sh.in
index f30fa8d..4f9086c 100755
--- a/src/roff/nroff/tests/verbose_option_works.sh.in
+++ b/src/roff/nroff/tests/verbose_option_works.sh.in
@@ -23,8 +23,17 @@ export LC_ALL=C
 # Ensure a predictable command search path.
 @GROFF_BIN_PATH_SETUP@
 
+set -e
+
 nroff="${abs_top_builddir:-.}/nroff"
 
+nroff_ver=$("$nroff" -v | awk 'NR == 1 {print $NF}')
+groff_ver=$("$nroff" -v | awk 'NR == 2 {print $NF}')
+
+echo nroff: $nroff_ver >&2
+echo groff: $groff_ver >&2
+test "$nroff_ver" = "$groff_ver"
+
 echo "testing 'nroff -V'" >&2
 expected="PATH=$GROFF_RUNTIME$PATH groff -Tascii -mtty-char"
 actual=$("$nroff" -V)



reply via email to

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