debhelper, start-stop-daemon -exec, and restarting daemons during upgrade
(dunno why i'm not getting these replies in my email - i thought the
bugtracker was supposed to send them to the original submitter of the
bug. it's getting annoying though. i'll try "subscribing" to the bug)
On April 26, joeyh wrote:
> start-stop-daemon behaves as I described when -exec is used, as
> documented on its man page. At least 1/3 of init scripts run it that
> way, and would all instantly fail if debhelper were changed. (This
> number seems to have gone down somewhat, it used to be nearer to 100%.)
it still makes them the exception rather than the rule - they are the
ones that need special handling in the pre/post inst scripts.
even if they were the majority, i'd bet that most of them don't actually
need '-exec', they're just doing it because they cut-and-pasted from
some other example init.d script.
it also implies that a bug report needs to be filed against dpkg because
'start-stop-daemon -exec' doesn't properly cope with upgrades.
it's entirely normal that an executable will be replaced during an
upgrade.
it's also entirely normal that daemon packages will and should do a
restart in the postinst rather than stop in prerm and start in postinst.
and a package maintainer should be able to expect that dpkg,
start-stop-daemon, and debhelper will all support that without error.
one question that occurs to me is: does start-stop-daemon's
'-exec' option actually serve any useful purpose, or was it just a
useful-sounding idea that doesn't really do anything useful?
maybe, as suggested in bug 202719, start-stop-daemon should check
/proc/PID/stat rather than /proc/PID/exe. or /proc/PID/cmdline
or /proc/PID/status. unlike the /proc/PID/exe symlink, that doesn't
change just because the binary has changed.
I just did some testing, and it looks like start-stop-daemon only fails
to stop the daemon if the binary has been renamed/mv-ed. it still
stops it if the binary has been deleted...so --remove and --purge work.
if '-exec' is actually useful, then maybe what it needs to do is check
whether /proc/PID/exe is either the original binary or whatever dpkg
renames it to during an upgrade. that would retain the same
functionality while coping much better with upgrades.
craig
--
craig sanders <cas@taz.net.au>
Reply to: