Package: couriergraph
Version: 0.25-4
Severity: normal
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Hi

The stop action of couriergraph's init script might kill an unrelated
process (e.g. if couriergraph daemon dies, and the stop action is
later on invoked, and some other process get's the pid from the
original running couriergraph.pl process).

This is also something start-stop-daemon manpage states:

MATCHING OPTIONS
       -p, --pidfile pid-file
              Check whether a process has created the file pid-file.
              Note: using this matching option alone might cause
              unintended processes to be acted on, if the old process
              terminated without being able to remove the pid-file.

So best would be to also (like 0.25-4.3 for start) to use --name.

And per [1], it might be also good suggestion to use --retry and to
not sleep for the restart action between start and stop.

 [1]: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=692496#27

Julien Cristau <jcris...@debian.org> suggested that this could be
improved.

Regards,
Salvatore

- -- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/8 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCgAGBQJQpsimAAoJEHidbwV/2GP+tWgP/1RnIbCAxhY21oKHU/Gt/5+x
eojrjxe8X3t4upEgo1IpEFqoh8ayW9lnuC5/B6YqCBmoPqEN/eA/a/Sl2KAzak/v
82GBn4NFu6V+PKmmF9fYEIe7k/K2zGLqfdV+TBMeio8Q6h7IEbJGTx3q46GELx+4
8eurkhx5oiylQ8p9esuVhaZjbgAYAe2LTsYWd40C1r8+BE9UECATkZAo0pvUhLmB
MG7bb2mW0mDsCVYz3iJg/yhrBlHB6+Swd0sZ3IRtVZ57QFI3S9shf9CphiRsCTf3
+Kao7v4FHbbTatP/JBt5CFol3yYJYfIdInG2E/5rRPU4etFRij98UKBTdFUYxefz
dx16SnDxfhKDFveKnKadOg26YiZxvQHthUmBpzHVqqHUgqHJ3dUeq/sf4FMAXqkU
nc1ICDiwGJtEWkMNP5De0CKfd79OzQd8POxX3cphHdjFWKXr/4oBjkKrmmwiJL+M
1QT0yeO5Ev72J7Fg5VlDB7ubgSco8+xsjqCRHluv5pToa1KY1Fo5cE1C8jgdOBoH
14IG3omb97bSbCodBRGxVoZcoRzlGwnIRkp1/BjBqff57yGs3CN7RGWJ5RtXTi+e
NH99MJuIR1PftzLTHVyXb4HQ+dszPLpzI/mUpLFx6CdlMI4XYoIKKxXOQ5ZvB5oM
r4wHCXQHBZQtdhc6qxP+
=xnI8
-----END PGP SIGNATURE-----
>From d000539173e8de112c804c47b9cea525d25be0f8 Mon Sep 17 00:00:00 2001
From: Salvatore Bonaccorso <car...@debian.org>
Date: Sat, 17 Nov 2012 00:08:53 +0100
Subject: [PATCH] Improve init script stop and restart action

Use --name to killing an unrelated process. Furthermore use --retry to
wait for the process to actually die.

Don't sleep during restart action.
---
 debian/init |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/debian/init b/debian/init
index 8c24b29..d9d0121 100644
--- a/debian/init
+++ b/debian/init
@@ -41,14 +41,13 @@ case "$1" in
 
   stop)
 	echo -n "Stopping $DESC: "
-	start-stop-daemon --stop --oknodo --pidfile $PIDFILE
+	start-stop-daemon --stop --oknodo --pidfile $PIDFILE --name couriergraph.pl --retry 1
 	rm -f $PIDFILE
 	echo "$NAME."
   ;;
 
   restart|force-reload)
 	$0 stop
-	sleep 1
 	$0 start
   ;;
 
-- 
1.7.10.4

Reply via email to