Bug#945464: /lib/init/init-d-script: stop action: missing --oknodo in s-s-d invocation
Dmitry Bogatov
KAction at disroot.org
Wed Nov 27 03:39:20 GMT 2019
control: tags -1 +confirmed
[2019-11-25 12:06] Jan Braun <janbraun at gmx.de>
> Dear Maintainer,
>
> The /lib/init/init-d-script errorneously returns failure when asked to
> stop a non-running service:
> [...]
>
> And indeed, one call to start-stop-daemon in /lib/init/init-d-script is
> missing the --oknodo flag. Namely, the first call in the stop action:
> [...]
> Adding --oknodo in line 76 (line 2 in the quote) should fix this bug.
Thank you very much for your detailed analysis. I included --oknodo flag
as you suggested. Unless there is objections in upcoming few days, I
will upload it.
> Additionally, I'd like to point out that the calculation of the return
> code in this function seems fishy to me: it will always be the return
> code of the first s-s-d invocation, unless the second invocation returns
> 2 (which aiui means "a process survived SIGKILL" in this context).
> Wouldn't taking the maximum (or sum) of the two return codes be more
> sensible?
Sum is definitely not apporiate, since there is standard that specifies
meanings of error codes of init.d script[^1]. But you raise valid point,
and it is not clear to me why exit code 2 is handled specially.
Also, returning 2 should mean "invalid or excess argument(s)",
which is not the case. Should't we return exit code 1 in all cases when
s-s-d fails?
Collegues, opinions? Maybe anybody remember why it was done this way?
[^1]: https://fedoraproject.org/wiki/EPEL:SysVInitScripts?rd=Packaging:SysVInitScript
--
Note, that I send and fetch email in batch, once in a few days.
Please, mention in body of your reply when you add or remove recepients.
More information about the Debian-init-diversity
mailing list