/lib/init/init-d-script: exit 0 at end of script prevents all other exit codes

Dmitry Bogatov KAction at debian.org
Fri Nov 16 12:34:46 GMT 2018

control: reopen -1

[2018-11-15 18:02] Benda Xu <heroxbd at gentoo.org>
> Petter Reinholdtsen <pere at hungry.com> writes:
> > [Benda Xu]
> >> Do you think init-d-script unconditionally returning 0 is a typo?
> >> Should it be `exit $?` instead?
> >
> > Not quite sure, but as far as I know, the init.d scripts do not have a
> > standard for exit codes.  There is no use of exit codes from init.d
> > scripts in /etc/init.d/rc.  Error handling and reporting during start
> > and stop is supposed to take place within the init.d script itself, not
> > passed on to the caller as an exit code.
> > [...]
> Nice explanation, thank you indeed.  So it actually does not matter what
> it returns from init-d-script.  I think we could close this bug for the
> moment.

Wait, no. There is. See #427889 and policy 9.3.2. By the way, seems
#427889 could be closed...

Also, by just common sence, program that return 0 in case of failure is
bad, very bad.  What if I want to call /etc/init.d/{foo} in my own

There are scripts around, that pass exit code {rc.local, hostname}; there
are scripts around, that do not (random example - wicd).

So either we

 * violate LSB and adjust all initscripts to return 0 always.
   I strongly oppose.

 * consider script, that swallows exit code to be buggy. I support it,
   but there is a lot of scripts in wild that do so. I do /not/ volonteer
   to fix them.

All in all, let us remove last line in `init-d-script'.

More information about the Debian-init-diversity mailing list