[PATCH] Make start-stop-daemon handle sending signals better

Natanael Copa natanael.copa at gmail.com
Mon Aug 28 21:42:24 UTC 2006


On Mon, 2006-08-28 at 16:17 -0500, Jason Schoon wrote:
> On 8/28/06, Natanael Copa <natanael.copa at gmail.com> wrote:
>         
>         There is a bug about syslogd not starting (looks like the
>         problem
>         affects any busybox applet)
>         
>         http://bugs.busybox.net/view.php?id=770
>         
> 
> On this one, I see the problem, but I don't know a clean, correct
> solution.  The problem is that start-stop-daemon looks through the
> list of processes and checks if the new one is already running by
> comparing device and inode.  However, in the case of Busybox, that is
> going to be true for every single command.  However, the only thing I
> can think of is adding a check for size as well.  That definately
> isn't a solid solution though.  A string match on the name would be
> good, but that would require stripping paths ( or not ).  

IMHO the "correct" way to solve it would be to check both the st_dev and
st_ino *and* check the cmdline. (like showed in the untested patch)

To save space we could just replace the pid_is_exec with pid_is_cmdline
in the attched patch. It would open for new potential cornercase bugs
like:

start-stop-daemon --start --exec /usr/bin/somedaemon
mount /dev/seomthing /usr
start-stop-daemon --start --exec /usr/bin/somedaemon

and other strange things. But for normal operation it should work just
fine to replace pid_is_exec with the attatched (and still untested)
pid_is_cmdline.

Let me know what you think and I'll send a new (tested) patch tomorrow.

> 
>         Another thing not yet in bugtracking system:
>         
>         --stop --pidfile prints the pid unless --quiet is added. 
>         
>         This behaviour should be changed to no pidfile is printed
>         unless
>         --verbose/-v is specified.
> 
> On this one, it seems more like a preference thing.  I don't use the
> "FANCY" define, so I don't even have a verbose flag.  I'll leave this
> one to others to decide, I don't ever do anything with the output, so
> the string doesn't matter to me. 

I run gentoo init.d scripts with busybox. To me its valuable that they
are compatible.

--
Natanael Copa

-------------- next part --------------
A non-text attachment was scrubbed...
Name: start_stop_daemon.c.patch
Type: text/x-patch
Size: 909 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20060828/7ba182f7/attachment-0002.bin 


More information about the busybox mailing list