Bug#904558: What should happen when maintscripts fail to restart a service
Ian Jackson wrote:
>> I personally think that it would make sense for the policy to at least
>> recommend what should happen with regards to maintainer scripts and
>> typical operations that are performed in them.
>
> There is already a section on error handling in scripts, which (IMO
> correctly) says that shell scripts should use set -e.
>
> When I wrote that, it didn't occur to me that anyone would think that
> a failure by a postinst script to perform an intended operation should
> be treated any other way than a failure of the postinst script.
That was perhaps also written before we started to realise that maintainer
scripts are actually best avoided as they tend to be complicated, fragile,
difficult to do right and make upgrades harder for the package manager. In
the intervening two decades, we've gone from "maintainer scripts are cool"
to "the best maintainer script is the one that doesn't exist".
So yes, ignoring errors seems wrong but…
>> And, while I'm open to be convinced otherwise, I don't see any benefit
>> from postinst (particularly postinst + configure) ever failing.
>
> Frankly I'm disturbed to be reading this, here. See above.
>
> If the postinst fails, then the user has the opportunity to fix the
> root cause and rerun dpkg-source --configure --pending. That will
> then repair the system completely.
… causing a snowball of errors in an awkward half-upgraded environment is
nasty.
The problem comes when you don't yet have the right tools installed to be
able to fix the problem. We see that scenario often enough in #debian where
someone has a failed upgrade and we try to collect more information via
pastebinit, strace, traceroute, netcat, gdb, etc; we frequently discover
that the relevant tool isn't installed and because apt is sufficiently
unhappy about broken packages and a half-completed upgrade, you can't ask it
to install the tool at that point in time.
In the upgrade scenario, while you're trying to fix one particular problem,
you're also in a completely untested half-upgraded situation and so latent
bugs in any number of other tools may also be exposed.
So while ignoring errors is wrong, so is making it harder to fix them. This
isn't a question of absolutes.
cheers
Stuart
--
Stuart Prescott http://www.nanonanonano.net/ stuart@nanonanonano.net
Debian Developer http://www.debian.org/ stuart@debian.org
GPG fingerprint 90E2 D2C1 AD14 6A1B 7EBB 891D BBC1 7EBB 1396 F2F7
Reply to: