bug-texinfo
[Top][All Lists]
Advanced

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

Re: texinfo-tex-4.13a: texi2dvi fails to diagnose error


From: Eric Blake
Subject: Re: texinfo-tex-4.13a: texi2dvi fails to diagnose error
Date: Wed, 9 Nov 2011 21:59:33 +0000 (UTC)
User-agent: Loom/3.14 (http://gmane.org/)

Jim Meyering <jim <at> meyering.net> writes:

> Regarding the bug whereby texi2dvi fails to diagnose the
> problem, you might want to make this change, assuming
> the effects of "set +e" are local to that sub-shell.
> If not, or maybe just to be safe, also add "set -e" right
> after the ")":
> 
> --- texi2dvi  2011-02-09 20:00:17.000000000 +0100
> +++ texi2dvi  2011-11-09 20:38:45.043064827 +0100
> @@ -1196,6 +1196,7 @@ run_makeinfo ()
>         echo '\input texinfo.tex @bye' >txiversion.tex

Ouch - this is a non-portable use of echo.  You CANNOT expect backslashes
to make it through echo, but should use printf instead.

>         # Be sure that if tex wants to fail, it is not interactive:
>         # close stdin.
> +       set +e
>         $TEX txiversion.tex </dev/null >txiversion.out 2>txiversion.err
>      )
>      if test $? != 0; then

That won't work.  According to:

http://austingroupbugs.net/view.php?id=52

disabling set -e in a subshell still does not affect the fact that the
parent shell will exit immediately if the subshell has non-zero status.
For example:

$ bash -c 'set -e; ( set +e; false ); echo hi'
$

Rather, you need to use a construct that will act on the non-zero status,
such as:

$ bash -c 'set -e; if ! ( false ); then echo hi; fi'
hi

or in context of texi2dvi:

if (
  ...
  printf %s\\n '\input texinfo.tex @bye' > txiversion.tex
  $TEX txiversion.tex </dev/null >txiversion.out 2>txiversion.err
); then
  # error recovery...
fi

-- 
Eric Blake





reply via email to

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