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

Natanael Copa natanael.copa at gmail.com
Wed Aug 30 20:25:06 UTC 2006


On Wed, 2006-08-30 at 12:29 -0400, Rob Landley wrote:
> On Wednesday 30 August 2006 1:55 am, Natanael Copa wrote:
> > > Which is a broken heuristic where busybox is involved.  I believe the
> second
> > > field of /proc/$pid/stat gives you the name the executable was originally
> > > called under (even if was called by path or rewrote its argv[0] or some
> > > such), and that's what "killall" goes based off of.
> >
> > That is what 'start-stop-daemon --name' uses. I would rather go for
> > argv[0], using first field in /proc/$pid/cmdline
> 
> BusyBox doesn't modify its command line anymore, aside from the getopt()
> permutation (which I hope to remove someday).
> 
> > See patch I posted with subject "[PATCH] proposal for fix bug 770
> > (start-stop-daemon)"
> >
> > http://busybox.net/lists/busybox/2006-August/023949.html
> >
> > It works even if --exec arg is a symblink to busybox.
> 
> So why doesn't start-stop-daemon --name work then?  (The name it uses
> dereferences the symlink?)

AFAIK --name works fine with busybox.

The more common used --exec does not.

> > > But that doesn't help if
> > > somebody calls "busybox httpd", does it?
> >
> > You'd never call "busybox httpd" with start-stop-daemon --exec.
> 
> Well, I wouldn't, no.  But that has more to do with start-stop-daemon, and not
> particularly trusting our current httpd daemon to be able to serve even
> static pages...
>
> > --exec require you have a full pathname to executable and if you use
> > --exec /bin/busybox <anything> you are telling ssd to check
> > if /bin/busybox is alredy running before starting another.
> 
> Sounding a bit like pilot error.
> 
> Ok, so confirming: the fix checks to make sure that there isn't a version
> running that was called under the same name as the one we're about to launch?

Yes exactly.

> Does the command line's argv[0] include the path it was called at?

english is not my native language and im not 100% what you mean here. Do
you mean if current working dir is tored too? its not.

If you start your deamon with "//usr/sbin/./crond" that what you get in
cmdline. The fix won't detect difference between //usr/sbin/./crond
and /usr/sbin/crond

start-stop-daemon is almost only used in scripts, specially init.d
scripts and for that, you will always use absolute paths. Its not
perfect but it makes the most common used way to use start-stop-daemon
to work with busybox daemon links - and it does it without increasing
the size.


--
Natanael Copa




More information about the busybox mailing list