[PATCH] init-d-script: fix do_status when DAEMON=none

Trek trek00 at inbox.ru
Mon Aug 31 20:19:45 BST 2020


On Mon, 31 Aug 2020 20:25:50 +0200 (CEST)
Thorsten Glaser <t.glaser at tarent.de> wrote:

> This does not match the description. What you’re doing here
> is to expand $DAEMON to “none” if it’s empty or unset but your
> description says it doesn’t work if “none” is used, but you’re
> setting it to “none” in more cases?

yes, sorry, the commit description is not that useful

actually with the patch "allow to disable --exec or --name options", if
DAEMON is equal to "none" then it sets DAEMON to empty value, but
status_of_proc expects exactly two parameters, DAEMON and NAME (plus
the optional -p PIDFILE)

so if DAEMON is set to "none" inside the script using the init-d-script
framework, then status_of_proc can't work; to make it work as expected
DAEMON needs to be always not-emtpy when calling status_of_proc

well, reading it again, I don't know if I can explain that better :|

to understand, may be it's simpler to test it, with an init script like:

  DAEMON=none
  START_ARGS="--background --make-pidfile --startas /bin/sleep"
  DAEMON_ARGS=200
  PIDFILE=/tmp/test.pid

without this patch do_status will do:

  status_of_proc -p /tmp/test.pid "" none

with the patch instead:

  status_of_proc -p /tmp/test.pid none none

ciao!



More information about the Debian-init-diversity mailing list