Subject: bug#30172: dvi, ps, and pdf targets use AM_MAKEINFOFLAGS

From: Mike Frysinger <[email-masked]>
Date: Tue, 8 Feb 2022 00:23:25 -0500

On 19 Jan 2018 16:30, Mathieu Lirzin wrote:
> The test suite fails for “t/txinfo-many-output-formats.sh” and
> “t/txinfo-many-output-formats-vpath.sh”.
> 
>   $ make check \
>       TESTS="t/txinfo-many-output-formats.sh t/txinfo-many-output-formats-vpath.sh"
>
> TEXINPUTS=".:$TEXINPUTS" \
> MAKEINFO='/bin/sh /home/mthl/src/automake/t/txinfo-many-output-formats.dir/missing makeinfo --unsupported-option  -I .' \
> texi2dvi  --build-dir=main.t2d -o main.dvi  \
> main.texi
> Unknown option: unsupported-option
> This is TeXk, Version 3.14159265 (TeX Live 2017) (preloaded format=tex)
> /gnu/store/cphfgqpcs458ab72692jsxm903amqvc2-profile/bin/texi2dvi: tex exited with bad status, quitting.
> make[1]: *** [Makefile:406: main.dvi] Error 1

hmm, you're hitting a codepath that you shouldn't be in texinfo.  texi2dvi
normally doesn't run $MAKEINFO.  it does so as a fallback if the tex install
seems to be broken (won't properly expand macros).  i'm guessing that's what
you have on your system (misbehaving tex install), so texi2dvi fell back to
running the $MAKEINFO setting.

let's look at the tests causing you trouble.

> --- a/t/txinfo-many-output-formats-vpath.sh
> +++ b/t/txinfo-many-output-formats-vpath.sh
> @@ -155,6 +155,9 @@ test ! -e share/$me/html/main.html
>  test ! -e share/$me/html/main2.html
>  test ! -e share/$me/html/main3.html
>  
> +# Restore the makefile without a broken AM_MAKEINFOFLAGS definition.
> +cp -f $srcdir/Makefile.sav $srcdir/Makefile.am
> +
>  $MAKE dvi
>  test -f main.dvi
>  test -f sub/main2.dvi
> @@ -198,8 +201,6 @@ test ! -e share/$me/pdf/main2.pdf
>  test ! -e share/$me/pdf/main3.pdf
>  test ! -e share/$me/pdf/hello
>  
> -# Restore the makefile without a broken AM_MAKEINFOFLAGS definition.
> -cp -f $srcdir/Makefile.sav $srcdir/Makefile.am
>  using_gmake || $MAKE Makefile
>  $MAKE distcheck

the point of txinfo-many-output-formats-vpath.sh is:
# Test support for building HTML documentation, and the many
# install-DOC flavors, in VPATH builds.

it feels a bit weird that it's also validating flag behavior here:
# Make sure AM_MAKEINFOHTMLFLAGS is supported, and override AM_MAKEINFO.

but it is what it is i guess.  i think your patch has the right idea, but it
also needs to rebuild the makefile before continuing.
	(cd $srcdir && $AUTOMAKE)
	./config.status Makefile

> --- a/t/txinfo-many-output-formats.sh
> +++ b/t/txinfo-many-output-formats.sh

same feedback for this test

> Here is what could be done:
> 
>   1. Fix the manual to state that AM_MAKEINFOFLAGS is used for every
>      non-html documentation target.
> 
>   2. Remove $(AM_MAKEINFOFLAGS) from the dvi, ps, and pdf targets
> 
> I am not sure what should be done.  Enlightened suggestions are welcome.

we want to keep AM_MAKEINFOFLAGS when invoking $(MAKEINFO) i think.
we discussed this at bit in https://bugs.gnu.org/23599

i don't think we want to advertise it as such in the manual though as the
flags aren't normally used ... they're a fallback for a situation that
shouldn't have happened, and when it does, AM_MAKEINFOFLAGS is assisting
in that fallback/recovery codepath.  it's certainly not ideal, but i'm not
sure we can easily or usefully convey this nuance in the manual without it
just confusing most readers.  so all things considered, the status quo seems
like the least worst option.  totally open to someone wanting to wordsmith
this though :).
-mike