Package: trousers
Version: 0.3.5-2
Severity: normal
Tags: patch

Hi,

I think that the init script shouldn't use the --background option as
it prevents start-stop-daemon to check if the daemon has really started.

According to the manpage of start-stop-daemon:

-b, --background
     Typically used with programs that don't detach on their own. This
     option will force start-stop-daemon to fork before starting the
     process,  and  force  it  into  the  background. WARNING:
     start-stop-daemon  cannot  check  the  exit  status if the process
     fails to execute for any reason. This is a last resort, and is
     only meant for programs that either make no sense forking on their
     own, or where it's not feasible to add the code for them to do
     this themselves.

See the attached patch (not tested though).

I think I'm the one to blame for this :)

Cheers

Laurent Bigonville
diff -Nru trousers-0.3.7/debian/trousers.init trousers-0.3.7/debian/trousers.init
--- trousers-0.3.7/debian/trousers.init	2011-11-21 21:11:52.000000000 +0100
+++ trousers-0.3.7/debian/trousers.init	2011-11-24 18:32:14.000000000 +0100
@@ -35,9 +35,10 @@
 			exit 0
 		fi
 
-		start-stop-daemon --start --quiet --background --make-pid --pidfile /var/run/${NAME}.pid --user ${USER} --chuid ${USER} --exec ${DAEMON} -- -f ${DAEMON_OPTS}
+		start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid --user ${USER} --chuid ${USER} --exec ${DAEMON} -- ${DAEMON_OPTS}
 		RETVAL="$?"
 		log_end_msg $RETVAL
+		[ "$RETVAL" = 0 ] && pidofproc $DAEMON > /var/run/${NAME}.pid
 		exit $RETVAL
 		;;
 

Reply via email to