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

"Didier 'OdyX' Raboud" <[email protected]>
Newsgroups gmane.linux.debian.devel.lsb
Organization Debian, the Universal OS
Message-ID <4F575FB1.2060701__5428.99141223661$1331126587$gmane$org@debian.org>
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
0001-In-killproc-re-add-a-retry-5-to-s-s-d-when-no-signal.patch (text/plain, 1.7 KB)
From d6496c323b50e5900a8465fc4f0c1e95677f2755 Mon Sep 17 00:00:00 2001
From: Didier Raboud <[email protected]>
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 <[email protected]>
Signed-off-by: Didier Raboud <[email protected]>
---
 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
signature.asc (application/pgp-signature, 663 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)

iQGcBAEBAgAGBQJPV1+xAAoJEIvPpx7KFjRVBWcMAIVhPAPLcRUmU8juZvXPwUq7
0xnna+VWzpjvd2X/q8yg4ZPLMPqlIxZz081HPB7FFrc+6Um39yq0FOUcduZAIjOs
c5LUiIp+i4yBhbD6rkqAvFcmVs4HAWh/dTTvGpxpJ+QMky+O/LdjkgT1xlr8TJPq
LXpU7T9jHOzC5dp8EF8j/t7MSr+dZOQ0/P1n07NNCmuY6PM2acYjnABqstek0Xld
FaPOJpeu7iRoANQyBGi8s5kO+sGnKsosyyqJ+dtr5xoiiSKfetwmpRyRQXhJKUbU
cxrr8rYhH0ZH+wtqriLlLodZgHQQd+jESl6Y+tXfID49zWfAuzFK+X5HrM1WPYIT
oa8+aH17q8sJV43m0k1mjalU8kKKkdqZ9KJxjOyGZVmZEP4veRrsVfJvasrQ5pvy
0hqyqCBTqsTiSzeOzKzyKrMTxj4W4DH7qGIrGk1ERCGgitFEqFS/jh23FmnUTOAP
EdcAC9EXSbkUSCcpEVgqFO22LKxWGIUAQGphX2zfEQ==
=U0l7
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.