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

[lintian] 01/01: c/init.d: Nothing requires $remote_fs any longer



This is an automated email from the git hooks/post-receive script.

nthykier pushed a commit to branch master
in repository lintian.

commit 5f78dc23eee3d210b495ce89315b0ffaa57bb414
Author: Niels Thykier <niels@thykier.net>
Date:   Thu Apr 20 17:37:01 2017 +0000

    c/init.d: Nothing requires $remote_fs any longer
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/init.d.desc              | 22 ++--------------------
 checks/init.d.pm                | 24 ++++--------------------
 debian/changelog                |  4 ++++
 t/tests/init.d-lsb-headers/desc |  1 -
 t/tests/init.d-lsb-headers/tags |  1 -
 5 files changed, 10 insertions(+), 42 deletions(-)

diff --git a/checks/init.d.desc b/checks/init.d.desc
index 5b19b3a..f655deb 100644
--- a/checks/init.d.desc
+++ b/checks/init.d.desc
@@ -220,11 +220,9 @@ Tag: init.d-script-uses-usr-interpreter
 Severity: normal
 Certainty: possible
 Info: The given <tt>/etc/init.d</tt> script specifies an interpreter in
- its shebang located under <tt>/usr</tt>.  This means the init script will
- fail if run at a point in the boot sequence before the <tt>/usr</tt>
- partition has been mounted.
+ its shebang located under <tt>/usr</tt>.
  .
- It also indicates that the init script may be using a non-essential
+ It indicates that the init script may be using a non-essential
  interpreter.  Since init scripts are configuration files, they may be
  left on the system after their package has been removed but not purged.
  At that point, the package dependencies are not guaranteed to exist and
@@ -320,22 +318,6 @@ Info: The given <tt>/etc/init.d</tt> script indicates it should be
  customize the runlevels at their will.
 Ref: policy 9.3.3.1
 
-Tag: init.d-script-missing-dependency-on-remote_fs
-Severity: important
-Certainty: possible
-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> 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 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: https://wiki.debian.org/LSBInitScripts
-
 Tag: init.d-script-missing-dependency-on-local_fs
 Severity: important
 Certainty: possible
diff --git a/checks/init.d.pm b/checks/init.d.pm
index 1f6984d..a0f0aff 100644
--- a/checks/init.d.pm
+++ b/checks/init.d.pm
@@ -243,7 +243,7 @@ sub check_init {
     return if not $initd_path->is_open_ok;
     my (%tag, %lsb);
     my $in_file_test = 0;
-    my %needs_fs = ('remote' => 0, 'local' => 0);
+    my $needs_fs = 0;
     my $fd = $initd_path->open;
     while (my $l = <$fd>) {
         if ($. == 1) {
@@ -315,8 +315,7 @@ sub check_init {
 
         # 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/,);
+        $needs_fs = 1 if ($l =~ m,^[^\#]*/var/,);
 
         while ($l =~ s/^[^\#]*?(start|stop|restart|force-reload|status)//o) {
             $tag{$1} = 1;
@@ -417,22 +416,13 @@ sub check_init {
           unless $provides_self;
     }
 
-    # If $remote_fs is needed $local_fs is not, since it's implied.
-    $needs_fs{'local'} = 0 if $needs_fs{'remote'};
-
     # 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}) {
-            if (none { /^\$(?:remote_fs|all)\z/ } @required) {
-                tag 'init.d-script-missing-dependency-on-remote_fs',
-                  "${initd_path}: required-start";
-            }
-        }
-        if ($needs_fs{local}) {
+        if ($needs_fs) {
             if (none { /^\$(?:local_fs|remote_fs|all)\z/ } @required) {
                 tag 'init.d-script-missing-dependency-on-local_fs',
                   "${initd_path}: required-start";
@@ -441,13 +431,7 @@ sub check_init {
     }
     if (defined $lsb{'default-stop'} && length($lsb{'default-stop'})) {
         my @required = split(' ', $lsb{'required-stop'} || '');
-        if ($needs_fs{remote}) {
-            if (none { /^(?:\$remote_fs|\$all|umountnfs)\z/ } @required) {
-                tag 'init.d-script-missing-dependency-on-remote_fs',
-                  "${initd_path}: required-stop";
-            }
-        }
-        if ($needs_fs{local}) {
+        if ($needs_fs) {
             if (none { /^(?:\$(?:local|remote)_fs|\$all|umountn?fs)\z/ }
                 @required) {
                 tag 'init.d-script-missing-dependency-on-local_fs',
diff --git a/debian/changelog b/debian/changelog
index 4fd192f..6f6a667 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -44,6 +44,10 @@ lintian (2.5.51) UNRELEASED; urgency=medium
     + [NT] Improve the empty-binary-package tag by adding more common
       files that should be ignored.  Thanks to Helmut Grohne for all the
       research behind it.  (Closes: #856857)
+  * checks/init.d.{desc,pm}:
+    + [NT] Remove check for init.d scripts accessing /usr without a
+      $remote_fs dependency as /usr must now be mounted by the initramfs.
+      (Closes: #829649)
   * checks/menu-format.{desc,pm}:
     + [NT] Update the reference to Desktop Entry Specification to point
       to version 1.1.
diff --git a/t/tests/init.d-lsb-headers/desc b/t/tests/init.d-lsb-headers/desc
index 184b1e4..a348757 100644
--- a/t/tests/init.d-lsb-headers/desc
+++ b/t/tests/init.d-lsb-headers/desc
@@ -9,7 +9,6 @@ Test-For:
  init.d-script-has-bad-stop-runlevel
  init.d-script-has-conflicting-start-stop
  init.d-script-has-duplicate-lsb-keyword
- init.d-script-missing-dependency-on-remote_fs
  init.d-script-missing-dependency-on-local_fs
  init.d-script-missing-lsb-short-description
  init.d-script-missing-start
diff --git a/t/tests/init.d-lsb-headers/tags b/t/tests/init.d-lsb-headers/tags
index 3119a22..5b8b65f 100644
--- a/t/tests/init.d-lsb-headers/tags
+++ b/t/tests/init.d-lsb-headers/tags
@@ -3,7 +3,6 @@ E: init.d-lsb-headers-all: init.d-script-depends-on-all-virtual-facility etc/ini
 E: init.d-lsb-headers-all: init.d-script-depends-on-all-virtual-facility etc/init.d/init.d-lsb-headers-all should-start
 E: init.d-lsb-headers-local: init.d-script-missing-dependency-on-local_fs etc/init.d/init.d-lsb-headers-local: required-start
 E: init.d-lsb-headers-parsing: init.d-script-starts-in-stop-runlevel etc/init.d/init.d-lsb-headers-parsing 0
-E: init.d-lsb-headers-remote: init.d-script-missing-dependency-on-remote_fs etc/init.d/init.d-lsb-headers-remote: required-start
 E: init.d-lsb-headers-virtual: init.d-script-depends-on-all-virtual-facility etc/init.d/init.d-lsb-headers-virtual required-stop
 E: init.d-lsb-headers-virtual: init.d-script-depends-on-unknown-virtual-facility etc/init.d/init.d-lsb-headers-virtual $something_that_doesnt_exist
 E: init.d-lsb-headers: init.d-script-should-depend-on-virtual-facility etc/init.d/init.d-lsb-headers mountall -> $local_fs

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git


Reply to: