[debhelper-devel] maintainer scripts and `exit 0`

Lukas Schwaighofer lukas at schwaighofer.name
Sun Jun 18 22:33:18 UTC 2017


Hi Niels, hi Ralf,

great to see that there's a tool in development that might be suitable
to find affected scripts.  However, I think we should first take a step
back and think about how we would like the problem to be solved.


My current opinion is (disclaimer: not much packaging experience): The
#DEBHELPER# in any maintainer script (if present) must be reached
in all cases, with the only exception of exiting with an error code.

Why I think that would be a good rule/convention:
* Clarity of the scripts: Either non-zero exit code (dpkg will complain)
  or debhelper commands, if used at all, were run successfully.
* Future proof: `compat` version bump or something added to
  `debian/maintscripts` will not break the maintainer scripts in
  unexpected ways.
* Easy to detect: Without constructing an AST, we can at least
  already detect `exit 0` before #DEBHELPER# somewhat reliably using a
  regular expression.  With the AST we can also detect the #DEBHELPER#
  being wrapped in an `if` clause.

Other thoughts:
* This should also be adhered for "triggered".  There is really no
  reason to explicitly exit, debhelper won't do anything bad.  Who
  knows, maybe there's yet some use for debhelper for "triggered" in
  the future…
* Selectively disabling maintainer scripts for some cases (as Niels
  mentioned earlier) would no longer be possible.  I can't really
  imagine a case where one would want that for all generated debhelper
  code anyways.  (Selectively) disabling the shell code generation and
  instead doing $whatever manually in the maintainer scripts is
  possible anyways.
* Probably there should also be a detection about not using #DEBHELPER#
  in a script.  We might want to check for "all or  nothing" here:
  Either #DEBHELPER# is present in all of the maintainer scripts, or it
  is not present in any of them and they must all exist.  Otherwise I
  expect commands in `debian/maintscripts` will do weird things…

If we can reach a consensus that this or a similar convention should be
applied to maintainer scripts, we simply need to update the
debhelper(7) man page to explain it and write a lintian tag.


Regards
Lukas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.alioth.debian.org/pipermail/debhelper-devel/attachments/20170619/708e96af/attachment.sig>


More information about the debhelper-devel mailing list