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

Re: Why the maintainer bother to use set -e instead of #!/bin/sh -e for all maintainer scripts?



e2xbegqsdyt21hfc <e2xbegqsdyt21hfc@yahoo.com> writes:

> $ zcat /usr/share/doc/libkrb53/changelog.Debian.gz | grep 'Use set'
>   * Use set -e instead of #!/bin/sh -e for all maintainer scripts.
> $
>
> Why bother? What difference does it make?

set -e is always honored; -e on the #! line is only honored if the script
is run as a regular executable, not explicitly with sh.  Normally it makes
no difference; the exception is if you run the test manually while
debugging it.  The reason why Lintian added a (pedantic) tag for this is
that when you're debugging a postinst script and you run it with sh -x
/var/lib/dpkg/info/foo.postinst, and then it doesn't exit on error, it's
surprising and can be dangerous.

It's an unusual situation, which is why it's only tagged with --pedantic.

-- 
Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>


Reply to: