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
