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

Bug#151992: marked as done (start-stop-daemon broken "--test --stop" combination (patch))



Your message dated Fri, 12 Jul 2002 12:24:03 -0400
with message-id <E17T3D9-00055K-00@auric.debian.org>
and subject line Bug#151992: fixed in dpkg 1.10.3
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 5 Jul 2002 09:49:49 +0000
>From thomas.morin@webmotion.com Fri Jul 05 04:49:49 2002
Return-path: <thomas.morin@webmotion.com>
Received: from horus.webmotion.com (horus.webmotion.ca) [209.87.243.246] (root)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 17QPim-0003QW-00; Fri, 05 Jul 2002 04:49:49 -0500
Received: from horus.webmotion.ca (httpd@localhost [127.0.0.1])
	by horus.webmotion.ca (8.12.3/8.12.3/Debian -4) with ESMTP id g659njAa008774
	(version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=FAIL)
	for <submit@bugs.debian.org>; Fri, 5 Jul 2002 05:49:45 -0400
Received: (from httpd@localhost)
	by horus.webmotion.ca (8.12.3/8.12.3/Debian -4) id g659niU8008772
	for submit@bugs.debian.org; Fri, 5 Jul 2002 05:49:44 -0400
X-Authentication-Warning: horus.webmotion.ca: httpd set sender to thomas.morin@webmotion.com using -f
Received: from machine107.rd.francetelecom.com ( [machine107.rd.francetelecom.com])
	as user thomas@localhost by webmail.webmotion.com with HTTP;
	Fri,  5 Jul 2002 11:49:44 +0200
Message-ID: <[🔎] 1025862584.3d256bb84788c@webmail.webmotion.com>
Date: Fri,  5 Jul 2002 11:49:44 +0200
From: Thomas Morin <thomas.morin@webmotion.com>
To: submit@bugs.debian.org
Subject: start-stop-daemon broken "--test --stop" combination (patch)
MIME-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
User-Agent: Internet Messaging Program (IMP) 3.1
X-Virus-Scanned: by amavisd-milter (http://amavis.org/)
Delivered-To: submit@bugs.debian.org

Package: dpkg 
Version: 1.10
Severity: normal

I noticed the bug while trying to restart Tomcat (tomcat4 package). 

Due to the fact that the executable name, and command name of tomcat, is
not what start-stop-daemon sould try to match (daemon is started with
java), we can't use "--test --start" to test if daemon is running, 
because we want to ommit --name, --exec, so that s-s-d doesn't tries to
match this, but we can't do that with --start.

But in "--test --stop" mode (the only one we can use to test without
specifying --name or --exec or --startas), the return code actually
returned depends of the number of processes _actually_ killed, but this
number is zero, because we are in test mode.

Test case:
  - start tomcat4 with '/etc/init.d/tomcat4 start'
  - check it is actually running
  - run :

   start-stop-daemon --test --stop  --pidfile /var/run/tomcat4.pid --user
tomcat4  --verbose

   What we expect is that this command test if it would stop the process,
and returns zero if yes. 

Actual result:

  Would send signal 15 to 3025.
  No process in pidfile `/var/run/tomcat4.pid' found running; none killed.

  return code is 1  (echo $?)


Relevant code portions:

run_stop_schedule(void)
{
   ...
        anykilled = 0; 
        retry_nr = 0;

        if (schedule == NULL) {
                do_stop(signal_nr, quietmode, &n_killed, &n_notkilled, 0);
                if (n_notkilled > 0 && quietmode <= 0)
                        printf("%d pids were not killed\n", n_notkilled);
                if (n_killed)
                        anykilled = 1;
                goto x_finished;
        }

    ...
     x_finished:
        if (!anykilled) {
                if (quietmode <= 0)
                        printf("No %s found running; none killed.\n",
what_stop);
                return exitnodo;
        } else {
                return 0;
        }
}



/* return 1 on failure */
static void
do_stop(int signal_nr, int quietmode, int *n_killed, int *n_notkilled, int
retry_nr)
{
        struct pid_list *p;

        do_findprocs();

        *n_killed = 0;
        *n_notkilled = 0;

        if (!found)
                return;

        clear(&killed);

        for (p = found; p; p = p->next) {
                if (testmode)
                        printf("Would send signal %d to %d.\n",
                               signal_nr, p->pid);

[ We actually see this printf message in testcase output ]

                else if ...
       
      ...
}


So what happens is that in test mode, n_killed isn't increased (do_stop),
then anykilled (run_stop_schedule) still is zero after do_stop, then in
x_finished: the exit code is 0.

A solution is to increase n_killed, even if we are in test mode :

--- start-stop-daemon.c.orig	2002-07-05 11:29:31.000000000 +0200
+++ start-stop-daemon.c	2002-07-05 11:29:55.000000000 +0200
@@ -941,9 +941,11 @@
  	clear(&killed);
 
 	for (p = found; p; p = p->next) {
-
	if (testmode)
+
	if (testmode) {
 
		printf("Would send signal %d to %d.\n",
 
		       signal_nr, p->pid);
+
		(*n_killed)++;
+
	}
  		else if (kill(p->pid, signal_nr) == 0) {
 
		push(&killed, p->pid);
  	
	(*n_killed)++;



This modification actually solves the problem described here, I did not
test it further, but it is clear it only affect "--test" mode, and it
affects it lightly, so I wouldn't expect side effects.



---------------------------------------
Received: (at 151992-close) by bugs.debian.org; 12 Jul 2002 16:39:16 +0000
>From troup@auric.debian.org Fri Jul 12 11:39:16 2002
Return-path: <troup@auric.debian.org>
Received: from auric.debian.org [206.246.226.45] (mail)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 17T3Rr-000166-00; Fri, 12 Jul 2002 11:39:16 -0500
Received: from troup by auric.debian.org with local (Exim 3.12 1 (Debian))
	id 17T3D9-00055K-00; Fri, 12 Jul 2002 12:24:03 -0400
From: Adam Heath <doogie@debian.org>
To: 151992-close@bugs.debian.org
X-Katie: $Revision: 1.17 $
Subject: Bug#151992: fixed in dpkg 1.10.3
Message-Id: <E17T3D9-00055K-00@auric.debian.org>
Sender: James Troup <troup@auric.debian.org>
Date: Fri, 12 Jul 2002 12:24:03 -0400
Delivered-To: 151992-close@bugs.debian.org

We believe that the bug you reported is fixed in the latest version of
dpkg, which is due to be installed in the Debian FTP archive:

dpkg-dev_1.10.3_all.deb
  to pool/main/d/dpkg/dpkg-dev_1.10.3_all.deb
dpkg-doc_1.10.3_all.deb
  to pool/main/d/dpkg/dpkg-doc_1.10.3_all.deb
dpkg_1.10.3.dsc
  to pool/main/d/dpkg/dpkg_1.10.3.dsc
dpkg_1.10.3.tar.gz
  to pool/main/d/dpkg/dpkg_1.10.3.tar.gz
dpkg_1.10.3_i386.deb
  to pool/main/d/dpkg/dpkg_1.10.3_i386.deb
dselect_1.10.3_i386.deb
  to pool/main/d/dpkg/dselect_1.10.3_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 151992@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Adam Heath <doogie@debian.org> (supplier of updated dpkg package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Thu, 11 Jul 2002 22:58:43 -0500
Source: dpkg
Binary: dpkg-static dselect dpkg-dev dpkg-doc dpkg
Architecture: source all i386
Version: 1.10.3
Distribution: unstable
Urgency: low
Maintainer: Dpkg Development <debian-dpkg@lists.debian.org>
Changed-By: Adam Heath <doogie@debian.org>
Description: 
 dpkg       - Package maintenance system for Debian
 dpkg-dev   - Package building tools for Debian
 dpkg-doc   - Dpkg Internals Documentation
 dselect    - a user tool to manage Debian packages
Closes: 151992 152132 152161 152270
Changes: 
 dpkg (1.10.3) unstable; urgency=low
 .
   * Move dselect.cfg to dselect package. Closes: Bug#152132
   * Install methods into /usr/lib/dpkg/methods, not /usr/lib/dpkg.  Closes:
     #152161.
   * Fix test inversion in start-stop-daemon, when checking the pid given in
     a pid file.  Thanks Thomas Morin <thomas.morin@enst-bretagne.fr>.
     Closes: #152270.
   * If in --test mode, and --stop is given, increment n_killed, so that
     start-stop-daemon returns the proper exit value.  Thanks Thomas Morin
     <thomas.morin@enst-bretagne.fr>.  Closes: #151992.
Files: 
 7f4ce003847b18563e46b612ef545679 716 base required dpkg_1.10.3.dsc
 04552f3e53a56ccdaeacf8631c17b788 1566940 base required dpkg_1.10.3.tar.gz
 78b7b9e3ebc7bb9d71ed726ffba26d17 1159826 base required dpkg_1.10.3_i386.deb
 ccafb68f04dff1e6bcdbfe3f0a749458 89756 base required dselect_1.10.3_i386.deb
 147f24e8676e926bf981311ecf8e5b4d 1151291 byhand - dpkg-1.10.3_i386.nondebbin.tar.gz
 371867b0e9c6d24388a45f06fea09f9e 1316948 byhand - dpkg-1.10.3_i386-static.nondebbin.tar.gz
 edaa6d7ff71ab6ca746ef9a69cda9873 111708 utils standard dpkg-dev_1.10.3_all.deb
 dd964053bfc15290bac2f626b64db5db 10692 doc optional dpkg-doc_1.10.3_all.deb
 04552f3e53a56ccdaeacf8631c17b788 1566940 byhand - dpkg-1.10.3.tar.gz

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

iD8DBQE9LmBtiix9wovUpIkRAim6AJ9GQ/IHvKIlNxeOE57FHRoQAH7FsgCfefBe
3+LwPt55UQu8hXV8nS/NZCo=
=MJCz
-----END PGP SIGNATURE-----


-- 
To UNSUBSCRIBE, email to debian-dpkg-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: