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

Benda Xu heroxbd at gentoo.org
Thu Nov 15 10:02:12 GMT 2018


tags 822753 moreinfo
thanks

Thanks Petter,

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.
>
> With that background, it is no reason not to always return 0 unless
> incorrect arguments are used on the command line.
>
> As /etc/init.d/rc is not running with 'set -e', it do not really matter
> if the scripts exit with an error 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.

@J Mo, thank you for the bug report.  If you have a more specific demo
on why `exit 0` in /lib/init/init-d-script is incorrect, don't hesitate
to reopen this bug.

Yours,
Benda




More information about the Debian-init-diversity mailing list