gbranden pushed a commit to branch master
in repository groff.

commit 1b18652e180c9313f495693abe74e20f5a5d72f5
Author: Jaipaul Cheernam <[email protected]>
AuthorDate: Thu Nov 12 09:00:00 2026 +0000

    m4/groff.m4: Fix Savannah #68901.
    
    * m4/groff.m4 (GROFF_G): Apply the "g" command prefix only when the
      troff on PATH runs and reports a non-GNU ".g" value, not whenever its
      output differs from "1".  A troff that is installed but fails to
      run--as the native groff does when cross compiling, lacking its device
      files--is no longer mistaken for a groff-incompatible troff.
    
    [An existing troff program might fail to produce any output if it's
    compiled (a) for a different ABI or (b) with ASAN and
    `ASAN_OPTIONS=detect_leaks=0` is not in the environment.  Owing to its
    age, GNU troff has lots of memory leaks and cleaning them up is a
    long-term project.  (This is likely true of other troffs as well.)
    
    Fixes <https://savannah.gnu.org/bugs/?686901.  Problem introduced by me
    in commit 96b8274a90, 14 October, itself following up commit 142b8d93fc,
    8 October.  Evidently this stuff is harder than it looks.  --GBR]
---
 ChangeLog   | 21 +++++++++++++++++++++
 m4/groff.m4 | 11 +++++++----
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 20bb9df2a..d2680c708 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,24 @@
+2026-11-12  Jaipaul Cheernam <[email protected]>
+
+       * m4/groff.m4 (GROFF_G): Apply the "g" command prefix only when
+       the troff on PATH runs and reports a non-GNU ".g" value, not
+       whenever its output differs from "1".  A troff that is installed
+       but fails to run--as the native groff does when cross
+       compiling, lacking its device files--is no longer mistaken for
+       a groff-incompatible troff.
+
+       [An existing troff program might fail to produce any output if
+       it's compiled (a) for a different ABI or (b) with ASAN and
+       `ASAN_OPTIONS=detect_leaks=0` is not in the environment.  Owing
+       to its age, GNU troff has lots of memory leaks and cleaning them
+       up is a long-term project.  (This is likely true of other troffs
+       as well.)
+
+       Fixes <https://savannah.gnu.org/bugs/?686901.  Problem
+       introduced by me in commit 96b8274a90, 14 October, itself a
+       follow-up to commit 142b8d93fc, 8 October.  Evidently this stuff
+       is harder than it looks.  --GBR]
+
 2026-11-12  G. Branden Robinson <[email protected]>
 
        [troff]: Report macro file search path in `--version` output.
diff --git a/m4/groff.m4 b/m4/groff.m4
index e16ff3dea..7f415021b 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -1065,11 +1065,14 @@ AC_DEFUN([GROFF_TMAC],
 AC_DEFUN([GROFF_G], [
   g=
   AC_MSG_CHECKING([whether a groff-incompatible troff is installed])
-  if test -n "`command -v troff`" \
-    && test "`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>&1) \
-      2>/dev/null`" != 1
+  if test -n "`command -v troff`"
   then
-    g=g
+    troff_dotg=`(echo .tm '|n(.g' | tr '|' '\\\\' | troff -z -i 2>/dev/null) \
+      2>/dev/null`
+    if test -n "$troff_dotg" && test "$troff_dotg" != 1
+    then
+      g=g
+    fi
   fi
   if test "$g" = "g"
   then

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

Reply via email to