Source: lm-sensors
Version: 1:3.4.0-3
Tags: patch
User: [email protected]
Usertags: initscript-actions

Dear maintainer,

lm-sensors's initscript does not check whether the process has actually
terminated before returning successfully.

This can result in a non-deterministic race condition where resources
that are required by a corresponding "start" or "restart" action (eg.
TCP ports, exclusive filesystem locks, etc.) are not yet available to
the new instance because the older process is still releasing them in
the background.

This then results in the new process failing to start which is often
hidden from the sysadmin for some time unless a monitoring system is
in use. Note that adding "sleep" calls merely masks the problem and
is thus not a valid fix.

For the same/parallel reasons, the stop and restart actions should
return a non-zero exit code if the daemon failed to stop.

Patch attached.


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      [email protected] / chris-lamb.co.uk
       `-
diff --git a/debian/fancontrol.init b/debian/fancontrol.init
index 2caa3d6..f14df72 100644
--- a/debian/fancontrol.init
+++ b/debian/fancontrol.init
@@ -40,13 +40,13 @@ case "$1" in
        ;;
   stop)
        log_daemon_msg "Stopping $DESC" "$NAME"
-       start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --startas 
$DAEMON $CONF
+       start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --retry 30 
--startas $DAEMON $CONF
+       ret=$?
        rm -f $PIDFILE
-       log_end_msg $?
+       log_end_msg $ret
        ;;
   restart)
        $0 stop
-       sleep 3
        $0 start
        ;;
   force-reload)
@@ -55,12 +55,10 @@ case "$1" in
        fi
        ;;
   status)
-       status_of_proc $DAEMON $NAME $CONF && exit 0 || exit $?
+       status_of_proc $DAEMON $NAME $CONF
        ;;
   *)
        log_success_msg "Usage: /etc/init.d/fancontrol 
{start|stop|restart|force-reload|status}"
        exit 1
        ;;
 esac
-
-exit 0
diff --git a/debian/sensord.init b/debian/sensord.init
index 4d70d43..90e19df 100644
--- a/debian/sensord.init
+++ b/debian/sensord.init
@@ -40,12 +40,11 @@ case "$1" in
        ;;
   stop)
        log_daemon_msg "Stopping $DESC" "$NAME"
-       start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --exec 
$DAEMON
+       start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --retry 30 
--exec $DAEMON
        log_end_msg $?
        ;;
   restart)
        $0 stop
-       sleep 1
        $0 start
        ;;
   force-reload)
@@ -54,11 +53,9 @@ case "$1" in
        fi
        ;;
   status)
-       status_of_proc $DAEMON $NAME && exit 0 || exit $?
+       status_of_proc $DAEMON $NAME
        ;;
   *)
        echo "Usage: /etc/init.d/sensord 
{start|stop|restart|force-reload|status}"
        exit 1
 esac
-
-exit 0

Reply via email to