[SCM] Debian package checker branch, master, updated. 2.2.14-44-gfee7702
The following commit has been merged in the master branch:
commit 0bed1a16b61af486e21890ec2a15ab2728072734
Author: Russ Allbery <rra@debian.org>
Date: Sun Sep 13 13:51:38 2009 -0700
Style and tag updates for init.d-script-possible-missing-stop
Lower the severity of this tag to normal, since in most cases it probably
isn't causing user-visible errors. Redo the code in a few places and
expand the tag description.
diff --git a/checks/init.d b/checks/init.d
index 9aa7f47..39b20c7 100644
--- a/checks/init.d
+++ b/checks/init.d
@@ -223,7 +223,7 @@ sub check_init {
if (defined $lsb{$keyword});
tag "init.d-script-has-unknown-lsb-keyword", "/etc/init.d/$_:$. $keyword"
unless (defined ($lsb_keywords{$keyword}) || $keyword =~ /^x-/);
- $lsb{$keyword} = length($value)? $value : '';
+ $lsb{$keyword} = defined($value) ? $value : '';
$last = $keyword;
} elsif ($l =~ /^\#(\t| )/ && $last eq 'description') {
my $value = $l;
@@ -266,7 +266,7 @@ sub check_init {
# Check the runlevels.
my %start;
- if (defined($lsb{'default-start'})) {
+ if (defined $lsb{'default-start'}) {
for my $runlevel (split (/\s+/, $lsb{'default-start'})) {
if ($runlevel =~ /^[sS0-6]$/) {
$start{lc $runlevel} = 1;
@@ -280,11 +280,11 @@ sub check_init {
}
}
}
- if (defined($lsb{'default-stop'})) {
+ if (defined $lsb{'default-stop'}) {
my %stop;
for my $runlevel (split (/\s+/, $lsb{'default-stop'})) {
if ($runlevel =~ /^[sS0-6]$/) {
- $stop{$runlevel} = 1;
+ $stop{$runlevel} = 1 unless $runlevel =~ /[sS]/;
if ($start{$runlevel}) {
tag "init.d-script-has-conflicting-start-stop", "/etc/init.d/$_ $runlevel";
}
@@ -296,13 +296,17 @@ sub check_init {
}
}
- 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));
+ # Scripts that stop in any of 0, 1, or 6 probably should stop in all
+ # of them, with some special exceptions.
+ my $stop = join(' ', sort keys %stop);
+ if (defined($stop) and $stop ne '0 1 6') {
+ my $base = $initd_file;
+ $base =~ s,.*/,,;
+ unless (grep { $base eq $_ } qw(killprocs sendsigs halt reboot)) {
+ my @missing = grep { !defined $stop{$_} } qw(0 1 6);
+ tag 'init.d-script-possible-missing-stop', "/etc/init.d/$_",
+ @missing;
+ }
}
}
if ($lsb{'provides'}) {
diff --git a/checks/init.d.desc b/checks/init.d.desc
index d987dc5..0a30f23 100644
--- a/checks/init.d.desc
+++ b/checks/init.d.desc
@@ -280,11 +280,16 @@ Info: The given <tt>/etc/init.d</tt> script depends on a non-virtual
not be enough to provide everything the script expects.
Tag: init.d-script-possible-missing-stop
-Severity: important
+Severity: normal
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.
+ stopped at one of the runlevels 0, 1, or 6 but not at all of them.
+ This is usually a mistake. Normally, facilities that need to be stopped
+ at any of those runlevels need to be stopped at all of them.
+ .
+ For example, if it is safe for the facility provided by this init script
+ given init script to be stopped by <tt>sendsigs</tt> at runlevels 0 and
+ 6, there should be no reason to special case runlevel 1. If the facility
+ needs special shutdown handling when rebooting the system (runlevel 6),
+ it probably needs the same handling when halting the system (runlevel 0)
+ or switching to single-user mode (runlevel 1).
diff --git a/t/tests/init.d-lsb-headers/tags b/t/tests/init.d-lsb-headers/tags
index 2cc4689..1503b44 100644
--- a/t/tests/init.d-lsb-headers/tags
+++ b/t/tests/init.d-lsb-headers/tags
@@ -1,11 +1,10 @@
-E: init.d-lsb-headers-parsing: init.d-script-possible-missing-stop /etc/init.d/init.d-lsb-headers-parsing 1 6
-E: init.d-lsb-headers: init.d-script-possible-missing-stop /etc/init.d/init.d-lsb-headers 1
E: init.d-lsb-headers: init.d-script-should-depend-on-virtual-facility /etc/init.d/init.d-lsb-headers mountall -> $local_fs
E: init.d-lsb-headers: init.d-script-should-depend-on-virtual-facility /etc/init.d/init.d-lsb-headers mountnfs -> $remote_fs
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
W: init.d-lsb-headers-parsing: init.d-script-has-conflicting-start-stop /etc/init.d/init.d-lsb-headers-parsing 0
+W: init.d-lsb-headers-parsing: init.d-script-possible-missing-stop /etc/init.d/init.d-lsb-headers-parsing 1 6
W: init.d-lsb-headers-parsing: init.d-script-starts-in-stop-runlevel /etc/init.d/init.d-lsb-headers-parsing 0
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
@@ -13,6 +12,7 @@ W: init.d-lsb-headers: init.d-script-has-bad-start-runlevel /etc/init.d/init.d-l
W: init.d-lsb-headers: init.d-script-has-bad-stop-runlevel /etc/init.d/init.d-lsb-headers Y
W: init.d-lsb-headers: init.d-script-has-conflicting-start-stop /etc/init.d/init.d-lsb-headers 0
W: init.d-lsb-headers: init.d-script-has-conflicting-start-stop /etc/init.d/init.d-lsb-headers 6
+W: 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-provides-virtual-facility /etc/init.d/init.d-lsb-headers $bad_facility
W: init.d-lsb-headers: init.d-script-starts-in-stop-runlevel /etc/init.d/init.d-lsb-headers 0
W: init.d-lsb-headers: init.d-script-starts-in-stop-runlevel /etc/init.d/init.d-lsb-headers 6
--
Debian package checker
Reply to: