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

Bug#568926: lintian seems to insist on set -e and doesn't like #!/bin/sh -e



* Russ Allbery <rra@debian.org> [2010-02-08 23:58:30 CET]:
> Gerfried Fuchs <rhonda@debian.at> writes:
> >  In a maintainerscript that starts off with "#!/bin/sh -e" an additional
> > "set -e" doesn't make much sense - though it seems like lintian insists
> > on this style. It would be pretty convenient if lintian would allow
> > handing the -e on the shebang line too.
> 
> Lintian should support either but give you an info-level tag for using the
> first form, which includes an explanation for why this is not the
> recommended style.  Is that not the behavior that you're seeing?

 Ah, now I see the difference. Though, I'd like to challenge the
explenation:

 This is fine for normal operation, but if the script is run by
 hand with "sh /path/to/script" (common in debugging), "-e"
 will not be in effect.  It's therefore better to use "set -e" in
 the body of the script.

 This explenation assumes that all scripts are posix compliant shell
scripts - which they don't have to be. They can be bash scripts or perl
scripts too. Given that one *has* to check what type of script it is
(like, head -1 script) it is directly visible from there that -e is set.

 . o O ( and actually one would probably use set -ex script for
debugging anyway, plain "sh script" is rather uncommon for debugging)

 Just some thoughts. :)
Rhonda



Reply to: