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

[SCM] Debian package checker branch, master, updated. 2.2.14-44-gfee7702



The following commit has been merged in the master branch:
commit ad2cb1e4bf2d656ac3aa84195febef7f9e97f83b
Author: Raphael Geissert <atomo64@gmail.com>
Date:   Sun Aug 30 20:35:36 2009 -0500

    Check for init scripts not stopping in all runlevels
    
    Init scripts that stop in any of 0, 1, or 6 should probably stop in all
    of them.

diff --git a/checks/init.d b/checks/init.d
index a6bb3ae..ed740e4 100644
--- a/checks/init.d
+++ b/checks/init.d
@@ -281,8 +281,10 @@ sub check_init {
 	}
     }
     if ($lsb{'default-stop'}) {
+	my %stop;
 	for my $runlevel (split (/\s+/, $lsb{'default-stop'})) {
 	    if ($runlevel =~ /^[sS0-6]$/) {
+		$stop{$runlevel} = 1;
 		if ($start{$runlevel}) {
 		    tag "init.d-script-has-conflicting-start-stop", "/etc/init.d/$_ $runlevel";
 		}
@@ -293,6 +295,15 @@ sub check_init {
 		tag "init.d-script-has-bad-stop-runlevel", "/etc/init.d/$_ $runlevel";
 	    }
 	}
+
+	if ((defined($stop{"0"}) || defined($stop{"1"}) || defined($stop{"6"}))
+	    && !(defined($stop{"0"}) && defined($stop{"1"}) && defined($stop{"6"}))) {
+
+	    my $missing = join(' ', grep { !defined($stop{$_}) } qw(0 1 6));
+
+	    tag "init.d-script-possible-missing-stop", "/etc/init.d/$_ $missing"
+		unless (grep {$initd_file eq "init.d/$_"} qw(killprocs sendsigs halt reboot));
+	}
     }
     if ($lsb{'provides'}) {
 	my $provides_self;
diff --git a/checks/init.d.desc b/checks/init.d.desc
index 0ff2009..d987dc5 100644
--- a/checks/init.d.desc
+++ b/checks/init.d.desc
@@ -278,3 +278,13 @@ Info: The given <tt>/etc/init.d</tt> script depends on a non-virtual
  Properly using virtual facilities allows multiple implementations of the
  same facility and accomodates systems where that specific facility may
  not be enough to provide everything the script expects.
+
+Tag: init.d-script-possible-missing-stop
+Severity: important
+Certainty: possible
+Info: The given <tt>/etc/init.d</tt> script indicates it should be
+ stopped at either runlevel 0, 1, or 6 but not at the three of them.
+ This is usually a mistake when writing the <tt>Default-Stop</tt>
+ information. For example, if it is safe for the daemon started by the
+ given init script to be stopped by <tt>sendsigs</tt> at runlevels 0
+ and 6 then there should be no reason to special case runlevel 1.
diff --git a/t/tests/init.d-lsb-headers/desc b/t/tests/init.d-lsb-headers/desc
index 76de822..1d5a57f 100644
--- a/t/tests/init.d-lsb-headers/desc
+++ b/t/tests/init.d-lsb-headers/desc
@@ -7,6 +7,7 @@ Test-For:
  init.d-script-does-not-provide-itself
  init.d-script-has-bad-start-runlevel
  init.d-script-has-bad-stop-runlevel
+ init.d-script-possible-missing-stop
  init.d-script-provides-virtual-facility
  init.d-script-should-depend-on-virtual-facility
  init.d-script-starts-in-stop-runlevel
diff --git a/t/tests/init.d-lsb-headers/tags b/t/tests/init.d-lsb-headers/tags
index 4d6a436..fa0568d 100644
--- a/t/tests/init.d-lsb-headers/tags
+++ b/t/tests/init.d-lsb-headers/tags
@@ -3,6 +3,7 @@ E: init.d-lsb-headers: init.d-script-should-depend-on-virtual-facility /etc/init
 E: init.d-lsb-headers: init.d-script-should-depend-on-virtual-facility /etc/init.d/init.d-lsb-headers networking -> $network
 E: init.d-lsb-headers: init.d-script-should-depend-on-virtual-facility /etc/init.d/init.d-lsb-headers portmap -> $portmap
 E: init.d-lsb-headers: init.d-script-should-depend-on-virtual-facility /etc/init.d/init.d-lsb-headers sysklogd -> $syslog
+E: init.d-lsb-headers: init.d-script-possible-missing-stop /etc/init.d/init.d-lsb-headers 1
 W: init.d-lsb-headers: init-d-script-stops-in-s-runlevel /etc/init.d/init.d-lsb-headers
 W: init.d-lsb-headers: init.d-script-does-not-provide-itself /etc/init.d/init.d-lsb-headers
 W: init.d-lsb-headers: init.d-script-has-bad-start-runlevel /etc/init.d/init.d-lsb-headers X

-- 
Debian package checker


Reply to: