Update of bug #68901 (group groff):
Status: None => Confirmed
Assigned to: None => gbranden
_______________________________________________________
Follow-up Comment #1:
Thanks for the report!
[comment #0 original submission:]
> In groff 1.25.0 the GROFF_G macro enables the "g" command prefix
> whenever troff produces anything other than exactly "1".
Yes. As you noted, that's a pretty severe test.
> During cross-compilation the troff found on PATH is the freshly built
> GNU troff, but run bare it cannot load its device files (the font/
> device search paths aren't configured). It therefore prints an error
> instead of reporting .g = 1, e.g.:
>
> troff: fatal error: cannot load 'DESC' description file for device 'ps'
>
> Because the probe merges stderr into stdout (2>&1), that error text
> becomes the output, which is not "1", so configure concludes an
> incompatible troff is installed and enables the prefix.
Yes. I've also found this to be the case when _groff_ is built with ASAN and
installed, such that this ASAN-enhanced _groff_ is the first one found in the
$PATH, and "ASAN_OPTIONS=detect_leaks=0" is not in the environment. That
_troff_ then exits with a non-zero exit status due to memory leaks, which are
numerous in the _groff_ code base.
> Only prefixed
> binaries are then installed (gtroff, gnroff, gtbl, geqn, ...), while
> programs expecting troff, nroff, tbl, and eqn cannot find them. A
> visible downstream effect is man-db producing empty output for man
> pages.
>
> Expected behavior: enable the "g" prefix only when troff runs
> successfully and reports that it is not GNU troff. If the probe fails
> to run, leave the prefix disabled.
I think that's a good idea.
> This complements the fix for Savannah #68775, which handled the case of
> no troff being installed at all.
Right.
> (Optional) It would also help to let users override "g" explicitly via
> the environment.
That's a good idea, but a separate idea. I think we might want to change the
`GROFF_G` macro to check the `GROFF_COMMAND_PREFIX` environment variable.
_groff_(1):
Environment
Environment variables in the host system affect the behavior of
programs supplied by groff as follows.
...
GROFF_COMMAND_PREFIX
Apply a prefix to certain GNU roff commands. groff can be
configured at compile time to apply a prefix to the names of
programs it provides that had counterparts in AT&T troff, so
that name collisions are avoided at run time. The default
prefix is empty.
When used, this prefix is conventionally the letter āgā.
For example, GNU troff would be installed as gtroff.
Besides troff, the prefix applies to the formatter wrapper
nroff; the preprocessors eqn, grn, pic, refer, tbl, and
soelim; and the utilities indxbib and lookbib.
> Attaching my solution as patch[.]
Thanks. Here it is inline. I find that viewing the diff with `-b` makes the
logic change clearer.
$ git diff -b
diff --git a/m4/groff.m4 b/m4/groff.m4
index e16ff3dea..7f415021b 100644
--- a/m4/groff.m4
+++ b/m4/groff.m4
@@ -1065,12 +1065,15 @@
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
+ 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
AC_MSG_RESULT([yes])
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?68901>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc
Description: PGP signature
