possible bug with start-stop-daemon and --test?
Denys Vlasenko
vda.linux at googlemail.com
Tue Apr 5 00:42:36 UTC 2011
On Monday 04 April 2011 09:35, Ed W wrote:
> On 04/04/2011 00:51, Denys Vlasenko wrote:
> > On Thursday 31 March 2011 17:24, Ed W wrote:
> >> Hi, the "full-fat" version of start-stop-daemon tends to be used in init
> >> scripts using the --test option to see if the daemon is actually running
> >> or crashed. This isn't obviously working as expected for me with
> >> busybox-1.18.3 ?
> >>
> >> $ start-stop-daemon -K --test --pidfile /tmp/my.pid && echo true
> >> stopped process in pidfile '/tmp/my.pid' (pid 999999999)
> >> true
> >>
> >> I think the current behaviour isn't expected (man page says it should
> >> return non zero)? Would a fix be straightforward?
> >
> > Yes, fixing this should be easy. But first, what is the expected behavior,
> > including the message? "stopped process in pidfile FOO" doesn't
> > look good... what "standard" start-stop-daemon says in this case?
> >
>
> I think there might be a cut'n'paste typo here in that I may have
> removed a "-v" from my command above. Full repro case here:
>
>
> Using start-stop-daemon from "openrc 0.6.8" (gentoo amd64)
>
> # echo 9999999 > /tmp/my.pid && start-stop-daemon -K --test --pidfile
> /tmp/my.pid -v && echo true
> * Will stop PID in pidfile `/tmp/my.pid'
> * start-stop-daemon: no matching processes found
>
>
> On busybox 1.18.3
>
> $ echo 9999999 > /tmp/my.pid && start-stop-daemon -K --test --pid
> file /tmp/my.pid -v && echo true
> stopped process in pidfile '/tmp/my.pid' (pid 9999999)
> true
>
> (note the "true" result returned with busybox? $? is 1 with openrc,
> it's 0 with busybox)
>
>
> Expected behaviour is noted here:
> http://www.busybox.net/BusyBox.html
>
> -K only:
> -t,--test Match only, exit with 0 if a process is found
>
> Obviously it's not explicit about return value if the process is NOT
> found, but I think it's inferred that it shouldn't be zero? I only have
> gentoo machines to hand, but as a data point they return 1 in the event
> of a process not found?
>
> # echo 9999999 > /tmp/my.pid && start-stop-daemon -K --test --pidfile
> /tmp/my.pid -v; echo "return: $?"
> * Will stop PID in pidfile `/tmp/my.pid'
> * start-stop-daemon: no matching processes found
> return: 1
>
>
> In the case of Gentoo the startup scripts use the idiom above quite a
> bit to check for correct startup, crashed jobs and whether to cleanup
> dead pids. So with -t always returning 0 it's somewhat neutered some of
> my init scripts? (I guess other distros are moving to fancy upstart
> derivatives so might not have noticed?)
Fixed in git:
# echo 9999999 >/tmp/my.pid && ./busybox start-stop-daemon -K --test -v --pidfile /tmp/my.pid; echo $?
start-stop-daemon: warning: killing process 9999999: No such process
1
--
vda
More information about the busybox
mailing list