[debhelper-devel] maintainer scripts and `exit 0`
Ralf Treinen
treinen at irif.fr
Sun Jun 18 19:32:32 UTC 2017
Hi Niels, hi Lukas,
On Sun, Jun 18, 2017 at 09:05:00AM +0000, Niels Thykier wrote:
> Lukas Schwaighofer:
> > Hi,
> >
> > I looked at a postinst script earlier today and realized that an
> > `exit 0` in maintainer scripts before the commands expanded from
> > #DEBHELPER# is (almost always) wrong. That is because the debhelper
> > inserted code may still want to act, even though the maintainer's own
> > code is done.
> >
>
> Hi Lukas,
>
> Thanks for bring this up. :)
>
> CC'ing Ralf: As I recall, he is working on some analysis tool of
> maintainer scripts and this seems like a good thing to catch.
Thanks a lot for having thought of us, this looks like a nice application
for the lintshell tool we are currently developing [1] (this is all very
fresh, we just finished a first release of the underlying parser, and
lintshell itself isn't released yet).
I wonder what would be a reliable way of detecting in the final
maintainer script (the one which is in the binary package) the portion
which has been inserted by debhelper. Is checking for
"# generated by other debhelper scripts"
a reliable way to detect that part? How can we detect the end of the
part inserted by debhelper? An alternative might be to work directly on
the maintainer script snippet in the source package.
> > I suspect the only exception where the `exit 0` may be justified is
> > the "triggered" parameter of postinst. But if we were to allow that,
> > writing a lintian tag that can reliably detect this problem would
> > become very hard.
> >
>
> Indeed.
Hmm, that might be doable since we are working on a concrete syntax tree
of the shell script, not on the textual level.
-Ralf.
[1] https://gitlab.inria.fr/regisgia/lintshell
More information about the debhelper-devel
mailing list