[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#650584: lsb-base: killproc does not wait for process to end



tags 650584 +patch
thanks

Le 30.11.2011 23:37, Daniel Nelson a écrit :
> The killproc function called without a signal does not wait for the
> process to end as required by the lsb specification, and never sends
> SIGKILL if the process does not end.
> 
> I believe this was introduced with the fix for #451529, which removed
> the '--retry 5' option from start-stop-daemon.  The real cause of that
> bug was fixed in start-stop-daemon, #451531, and so it should be okay to
> add back this option.

Hi Daniel, and thanks for your bugreport,

I propose the attached patch, that only re-adds the "--retry 5" to the
start-stop-daemon call that happens when no signal is specified,
according to the letter of the LSB.

Comments/Opinions ?

Cheers,

odyX
From d6496c323b50e5900a8465fc4f0c1e95677f2755 Mon Sep 17 00:00:00 2001
From: Didier Raboud <odyx@debian.org>
Date: Wed, 7 Mar 2012 13:26:01 +0100
Subject: [PATCH] In killproc(), re-add a '--retry 5' to s-s-d when no signal is specified.

According to the letter of the LSB:

killproc:"If a signal is specified, (...) the program is sent that signal.
          Otherwise, a SIGTERM followed by a SIGKILL after an unspecified
          number of seconds shall be sent."

According to start-stop-daemon manpage, that's what `--retry 5` does, with `5
seconds` being the `unspecified` of LSB, hence the `--retry 5` is only added
in the case where no signal is specified.

Closes: #650584
Reported-by: Daniel Nelson <torham@connect2.com>
Signed-off-by: Didier Raboud <odyx@debian.org>
---
 init-functions |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/init-functions b/init-functions
index c646073..08e7f40 100644
--- a/init-functions
+++ b/init-functions
@@ -134,22 +134,23 @@ killproc () {
     else
         name_param="--pidfile $pidfile"
     fi
 
     sig=$(echo ${2:-} | sed -e 's/^-\(.*\)/\1/')
     sig=$(echo $sig | sed -e 's/^SIG\(.*\)/\1/')
-    if [ -z "$sig" ] || [ "$sig" = 15 ] || [ "$sig" = TERM ]; then
+    if [ "$sig" = 15 ] || [ "$sig" = TERM ]; then
         is_term_sig="terminate_signal"
     fi
     status=0
     if [ ! "$is_term_sig" ]; then
         if [ -n "$sig" ]; then
             /sbin/start-stop-daemon --stop --signal "$sig" \
 		--quiet $name_param || status="$?"
         else
             /sbin/start-stop-daemon --stop \
+		--retry 5 \
 		--quiet $name_param || status="$?"
         fi
     else
         /sbin/start-stop-daemon --stop --quiet \
 	    --oknodo $name_param || status="$?"
     fi
-- 
1.7.2.5

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: