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

[SCM] Debian package checker branch, master, updated. 2.3.3-89-g87c8237



The following commit has been merged in the master branch:
commit 87c8237e1b95e3768feecc42bfd50c202dfc7ad1
Author: Russ Allbery <rra@debian.org>
Date:   Mon Mar 22 11:50:16 2010 -0700

    Allow $all to satisfy $remote_fs in Required-Start
    
    * checks/init.d{,.desc}:
      + [RA] Allow $all to satisfy a $remote_fs or $local_fs requirement in
        Required-Start, but (per the wiki) not Required-Stop.  Thanks,
        Michael Meskes.  (Closes: #574970)

diff --git a/checks/init.d b/checks/init.d
index 60323f6..ee69a93 100644
--- a/checks/init.d
+++ b/checks/init.d
@@ -361,20 +361,45 @@ sub check_init {
     # If $remote_fs is needed $local_fs is not, since it's implied.
     $needs_fs{'local'} = 0 if $needs_fs{'remote'};
 
-    for my $keyword qw(required-start should-start required-stop should-stop) {
-	if ($keyword =~ m/^required-(start|stop)$/
-	    && defined $lsb{"default-$1"} && length($lsb{"default-$1"})) {
-
-	    tag "init.d-script-missing-dependency-on-remote_fs", "/etc/init.d/$_: $keyword"
-		if ($needs_fs{'remote'} && (!defined $lsb{$keyword}
-		    || $lsb{$keyword} !~ m,(?:^|\s)(?:\$remote_fs|umountnfs)(?:\s|$),));
-	    tag "init.d-script-missing-dependency-on-local_fs", "/etc/init.d/$_: $keyword"
-		if ($needs_fs{'local'} && (!defined $lsb{$keyword}
-		    || $lsb{$keyword} !~ m,(?:^|\s)(?:\$(local|remote)_fs|umountn?fs)(?:\s|$),));
+    # Separately check Required-Start and Required-Stop, since while they're
+    # similar, they're not quite identical.  This could use some further
+    # restructuring by pulling the regexes out as data tied to start/stop and
+    # remote/local and then combining the loops.
+    if (defined $lsb{'default-start'} && length($lsb{'default-start'})) {
+	my @required = split(' ', $lsb{'required-start'} || '');
+	if ($needs_fs{remote}) {
+	    unless (grep { /^\$(?:remote_fs|all)\z/ } @required) {
+		tag 'init.d-script-missing-dependency-on-remote_fs',
+		    "/etc/init.d/$_: required-start";
+	    }
+	}
+	if ($needs_fs{local}) {
+	    unless (grep { /^\$(?:local_fs|remote_fs|all)\z/ } @required) {
+		tag 'init.d-script-missing-dependency-on-local_fs',
+		    "/etc/init.d/$_: required-start";
+	    }
+	}
+    }
+    if (defined $lsb{'default-stop'} && length($lsb{'default-stop'})) {
+	my @required = split(' ', $lsb{'required-stop'} || '');
+	if ($needs_fs{remote}) {
+	    unless (grep { /^(?:\$remote_fs|umountnfs)\z/ } @required) {
+		tag 'init.d-script-missing-dependency-on-remote_fs',
+		    "/etc/init.d/$_: required-stop";
+	    }
 	}
+	if ($needs_fs{local}) {
+	    unless (grep { /^(?:\$(?:local|remote)_fs|umountn?fs)\z/ } @required) {
+		tag 'init.d-script-missing-dependency-on-local_fs',
+		    "/etc/init.d/$_: required-stop";
+	    }
+	}
+    }
+
+    # Check syntax rules that apply to all of the keywords.
+    for my $keyword qw(required-start should-start required-stop should-stop) {
 	next unless defined $lsb{$keyword};
 	for my $dependency (split(/\s+/, $lsb{$keyword})) {
-
 	    if (defined $implied_dependencies{$dependency}) {
 		tag 'init.d-script-should-depend-on-virtual-facility',
 		    "/etc/init.d/$_",
diff --git a/checks/init.d.desc b/checks/init.d.desc
index 4768ce8..df0e92f 100644
--- a/checks/init.d.desc
+++ b/checks/init.d.desc
@@ -315,6 +315,8 @@ Info: The given init script seems to refer to <tt>/usr</tt>, possibly
  Using Should-Start or Should-Stop to declare the dependency is
  conceptually incorrect since the $remote_fs facility is always
  available.  Required-Start or Required-Stop should be used instead.
+ Also, please note that $all should not be used in Required-Stop, only
+ Required-Start.
 Ref: http://wiki.debian.org/LSBInitScripts
 
 Tag: init.d-script-missing-dependency-on-local_fs
diff --git a/debian/changelog b/debian/changelog
index 85bd7ba..b576b1b 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -65,13 +65,16 @@ lintian (2.3.4) UNRELEASED; urgency=low
       (star symbol).  Thanks, Niels Thykier.  (Closes: #574771)
     + [RG] New checks for incorrect and unknown locale codes in
       /usr/share/locale subdirectories.
-  * checks/init.d:
+  * checks/init.d{,.desc}:
     + [RA] Exclude symlinks to upstart-job from init script syntax checks.
       Based on a patch by Jos Boumans.  (Closes: #569492)
     + [RA] Allow umountnfs to satisfy a $remote_fs requirement and
       umountnfs or umountfs to satisfy a $local_fs requirement in LSB
       headers, avoiding false positives in unusual situations such as
       rsyslog.  Thanks, Michael Biebl.  (Closes: #571280)
+    + [RA] Allow $all to satisfy a $remote_fs or $local_fs requirement in
+      Required-Start, but (per the wiki) not Required-Stop.  Thanks,
+      Michael Meskes.  (Closes: #574970)
   * checks/manpages.desc:
     + [RA] Clarify the long description for manpage-has-bad-whatis-entry.
       Thanks, Jari Aalto.  (Closes: #573837)

-- 
Debian package checker


Reply to: