bug-texinfo
[Top][All Lists]
Advanced

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

Re: texi2dvi: set -e, use tar


From: Akim Demaille
Subject: Re: texi2dvi: set -e, use tar
Date: Tue, 10 Jan 2006 10:30:17 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

>>> "Karl" == Karl Berry <address@hidden> writes:

 > Hi Akim,
 >             * util/texi2dvi: set -e.

 > I have had nothing but problems with -e.  Whenever I have used it, I
 > always end up taking it again, because a nonzero exit status simply does
 > not always mean failure.  Are you really sure we need this?
 > What do we gain?

tex is horribly verbose, which causes actual failures to remain
hidden.  For instance it took me quite some time to spot the failure
of cp below, which triggered a failure in a very distant area.
Similarly, the broken `local' was hidden because of set +e.  So I grew
tired of fighting against my own laziness: let's use set -e, and treat
errors instead of ignoring them until they bite you hard.

 >             Stop using the idiom "test && action" in favor of "if test; then
 >             action; fi".

 > Hmm, I'm not crazy about this either.

Sure, I'm not either, but I'm very ready to pay that price instead of
keeping missing genuine errors.

 > I assume it was because of the set -e -- another problem with it;
 > && seems like a perfectly reasonable shell construct, why prevent
 > ourselves from being able to use it?

Because this idiom is dangerous.  It's like ignoring errno in C
programming.

 > Also, one source line becoming three doesn't seem good to me.  The
 > script is already too long ...

Better longer and safer than shorter and buggy.

 >             (xref_files_save): Use tar instead of cp.

 > Because ... ?  Although I don't suppose it matters in practice.  cp just
 > seems simpler.

I hoped the comment in the code was clear enough:

    # The following line improves `cp $xref_files_orig "$work_bak"'
    # by preserving the directory parts.  Think of
    # cp chap1/main.aux chap2/main.aux $work_bak.
    tar cf - $xref_files_orig | (cd "$work_bak" && tar xf -)






reply via email to

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