[Pkg-sysvinit-devel] Bug#822674: sysvinit-utils: /lib/init/init-d-script do_status() probably needs to specify -p $PIDFILE

J Mo jmomo at jmomo.net
Tue Apr 26 10:52:41 UTC 2016


Package: sysvinit-utils
Version: 2.88dsf-59.3
Severity: normal

I am troubleshooting a problem with the courier package suite (courier-imap as example).

I found that in /lib/init/init-d-script, the do_status() function calls status_of_proc() without the -p argument, leaving the PIDFILE to be assumed by pidofproc. This, despite the case that init-d-script makes it's own assumption and declaration about what the daemon PIDFILE should be.

In any case where the PIDFILE declared in the init script is different from what pidofproc assumes it to be, failure occurs because the assumed PIDFILE does not exist.

I would suggest altering the do_status() func from:
	status_of_proc "$DAEMON" "$NAME" && return 0 || return $?

To:
	status_of_proc "$DAEMON" "$NAME" -p "$PIDFILE" && return 0 || return $?

While I'm at it, I don't understand the functionality of "&& return 0 || return $?". This could be removed and there would be no change in behavior. Is this an artifact of history?

In that case:
	status_of_proc "$DAEMON" "$NAME" -p "$PIDFILE"



My one concern is regarding the possibility of PIDFILE=none being set in the init script. If it's necessary (I can't think of a reason why) to maintain the current behavior of not feeding the -p argument to status_of_proc, we could do:

	status_of_proc "$DAEMON" "$NAME" ${PIDFILE:="-p $PIDFILE"} && return 0 || return $?

However, if there is no PIDFILE set, a more rational thing to do would seem to be to never run status_of_proc in the first place since you can't get status on something that isn't running (or didn't leave a PID file behind).




-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.3.0-1-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages sysvinit-utils depends on:
ii  init-system-helpers  1.29
ii  libc6                2.22-7
ii  startpar             0.59-3

sysvinit-utils recommends no packages.

Versions of packages sysvinit-utils suggests:
pn  bootlogd  <none>
pn  sash      <none>

-- no debconf information



More information about the Pkg-sysvinit-devel mailing list