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

[SCM] Debian package checker branch, master, updated. 2.2.18-58-g6574892



The following commit has been merged in the master branch:
commit 65748925485742d304801c05cd6965e64effdcf7
Author: Russ Allbery <rra@debian.org>
Date:   Thu Dec 24 17:39:06 2009 -0800

    Add changelog and tweak the $local_fs/$remote_fs check
    
    Rename the tags for consistency with other tags, mark the tags as
    experimental, and massage the wording of the tag description.

diff --git a/checks/init.d b/checks/init.d
index a34a63b..2ba3b7c 100644
--- a/checks/init.d
+++ b/checks/init.d
@@ -238,14 +238,16 @@ sub check_init {
 
 	# Pretty dummy way to handle conditionals, but should be enough
 	# for simple init scripts
-	$in_file_test = 1 if ($l =~ m/\bif\s+.+?[\s+-[fe]\s+/);
+	$in_file_test = 1 if ($l =~ m/\bif\s+.+?\[\s+-[fe]\s+/);
 	$in_file_test = 0 if ($l =~ m/\bfi\b/);
 	if (!$in_file_test && $l =~ m,^\s*\.\s+["'"]?(/etc/default/[\$\w/-]+),) {
 	    tag "init.d-script-sourcing-without-test", "/etc/init.d/$_:$. $1";
 	}
 
-	$needs_fs{'remote'} = 1 if ($l =~ m,^[^#]*/usr,);
-	$needs_fs{'local'}  = 1 if ($l =~ m,^[^#]*/var,);
+	# This should be more sophisticated: ignore heredocs, ignore quoted
+	# text and the arguments to echo, etc.
+	$needs_fs{'remote'} = 1 if ($l =~ m,^[^\#]*/usr,);
+	$needs_fs{'local'}  = 1 if ($l =~ m,^[^\#]*/var,);
 
 	while ($l =~ s/^[^\#]*?(start|stop|restart|force-reload)//o) {
 	    $tag{$1} = 1;
@@ -328,17 +330,17 @@ sub check_init {
 	    unless $provides_self;
     }
 
-    # if $remote_fs is needed $local_fs is not, as it is implied
+    # 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 "missing-dependency-on-remote_fs", "/etc/init.d/$_: $keyword"
+	    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(?:\s|$),));
-	    tag "missing-dependency-on-local_fs", "/etc/init.d/$_: $keyword"
+	    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(?:\s|$),));
 	}
diff --git a/checks/init.d.desc b/checks/init.d.desc
index 895a4f3..19504e8 100644
--- a/checks/init.d.desc
+++ b/checks/init.d.desc
@@ -294,34 +294,31 @@ Info: The given <tt>/etc/init.d</tt> script indicates it should be
  it probably needs the same handling when halting the system (runlevel 0)
  or switching to single-user mode (runlevel 1).
 
-Tag: missing-dependency-on-remote_fs
+Tag: init.d-script-missing-dependency-on-remote_fs
 Severity: important
 Certainty: possible
+Experimental: yes
 Info: The given init script seems to refer to <tt>/usr</tt>, possibly
  using a file or binary from there.  Without a dependency on
- <tt>$remote_fs</tt> on, possibly both, required-start and
- required-stop the init script might be started too early or stopped
- too late.  That is, the init script might be called before
- <tt>/usr</tt> is mounted, or after it is unmounted, respectively.
+ <tt>$remote_fs</tt> in Required-Start or Required-Stop, as appropriate,
+ the init script might be run before <tt>/usr</tt> is mounted or after
+ it's unmounted.
  .
- Using should-start or should-stop to declare the dependency is
- conceptually incorrect.  By doing so, the init script will always be
- positioned as if <tt>$remote_fs</tt> had been set on a required-
- field, and is therefore ignored by this check.
+ Using Should-Start or Should-Stop to declare the dependency is
+ conceptually incorrect since the $remote_fs facility are always
+ available.  Required-Start or Required-Stop should be used instead.
 Ref: http://wiki.debian.org/LSBInitScripts
 
-Tag: missing-dependency-on-local_fs
+Tag: init.d-script-missing-dependency-on-local_fs
 Severity: important
 Certainty: possible
+Experimental: yes
 Info: The given init script seems to refer to <tt>/var</tt>, possibly
- using a file.  Without a dependency on <tt>$local_fs</tt> on, possibly
- both, required-start and required-stop the init script might be started
- too early or stopped too late.  That is, the init script might be
- called before <tt>/var</tt> is mounted read/write, or after it is
- unmounted, respectively.
+ using a file from there.  Without a dependency on <tt>$local_fs</tt> in
+ Required-Start or Required-Stop, as appropriate, the init script might be
+ run before <tt>/var</tt> is mounted or after it's unmounted.
  .
- Using should-start or should-stop to declare the dependency is
- conceptually incorrect.  By doing so, the init script will always be
- positioned as if <tt>$local_fs</tt> had been set on a required-
- field, and is therefore ignored by this check.
+ Using Should-Start or Should-Stop to declare the dependency is
+ conceptually incorrect since the $local_fs facility are always
+ available.  Required-Start or Required-Stop should be used instead.
 Ref: http://wiki.debian.org/LSBInitScripts
diff --git a/debian/changelog b/debian/changelog
index 6328b5c..4e4f71c 100755
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,8 @@ lintian (2.3.0) UNRELEASED; urgency=low
 
   * Summary of tag changes:
     + Added:
+      - init.d-script-missing-dependency-on-local_fs (experimental)
+      - init.d-script-missing-dependency-on-remote_fs (experimental)
       - obsolete-relation-form-in-source
     + Removed:
       - build-depends-without-arch-dep
@@ -37,6 +39,10 @@ lintian (2.3.0) UNRELEASED; urgency=low
       (Closes: #557786)
     + [RA] For lib-recommends-documentation, exclude packages ending in
       -tools or -bin.  Thanks, Jay Berkenbilt.  (Closes: #557883)
+  * checks/init.d{,.desc}:
+    + [RA] Add checks for missing dependencies on $local_fs or $remote_fs
+      based on what files appear to be used in the init scripts.  Patch
+      from Raphael Geissert.  (Partly addresses #405454)
   * checks/manpages.desc:
     + [RA] Clarify the long description of hyphen-used-as-minus-sign.
       Note that Debian groff is currently patched to avoid this problem,
diff --git a/t/tests/init.d-lsb-headers/desc b/t/tests/init.d-lsb-headers/desc
index 3645eb0..32c6463 100644
--- a/t/tests/init.d-lsb-headers/desc
+++ b/t/tests/init.d-lsb-headers/desc
@@ -8,9 +8,9 @@ Test-For:
  init.d-script-has-bad-start-runlevel
  init.d-script-has-bad-stop-runlevel
  init.d-script-has-conflicting-start-stop
+ init.d-script-missing-dependency-on-remote_fs
+ init.d-script-missing-dependency-on-local_fs
  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
- missing-dependency-on-remote_fs
- missing-dependency-on-local_fs
diff --git a/t/tests/init.d-lsb-headers/tags b/t/tests/init.d-lsb-headers/tags
index d218a8a..b6b7e97 100644
--- a/t/tests/init.d-lsb-headers/tags
+++ b/t/tests/init.d-lsb-headers/tags
@@ -1,5 +1,3 @@
-E: init.d-lsb-headers-local: missing-dependency-on-local_fs /etc/init.d/init.d-lsb-headers-local: required-start
-E: init.d-lsb-headers-remote: missing-dependency-on-remote_fs /etc/init.d/init.d-lsb-headers-remote: required-start
 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
@@ -18,3 +16,5 @@ W: init.d-lsb-headers: init.d-script-possible-missing-stop /etc/init.d/init.d-ls
 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
+X: init.d-lsb-headers-local: init.d-script-missing-dependency-on-local_fs /etc/init.d/init.d-lsb-headers-local: required-start
+X: init.d-lsb-headers-remote: init.d-script-missing-dependency-on-remote_fs /etc/init.d/init.d-lsb-headers-remote: required-start

-- 
Debian package checker


Reply to: