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

[lintian] 01/01: WIP: Add init.d-script-needs-depends-on-lsb-base-for-status-of-proc tag.



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

lamby pushed a commit to branch stricter-lsb-base-depends-839861
in repository lintian.

commit 0828c266ac77239fffe25e6bfe473603a4dfbad1
Author: Chris Lamb <lamby@debian.org>
Date:   Sun Oct 9 12:35:42 2016 +0100

    WIP: Add init.d-script-needs-depends-on-lsb-base-for-status-of-proc tag.
---
 checks/init.d.desc              |  7 +++++++
 checks/init.d.pm                | 11 +++++++++--
 t/tests/init.d-lsb-depends/desc |  4 +++-
 t/tests/init.d-lsb-depends/tags |  1 +
 4 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/checks/init.d.desc b/checks/init.d.desc
index 5b19b3a..06bb64b 100644
--- a/checks/init.d.desc
+++ b/checks/init.d.desc
@@ -376,3 +376,10 @@ Certainty: possible
 Info: The given init script sources the <tt>/lib/lsb/init-functions</tt> utility
  functions without declaring the corresponding dependency on lsb-base
  (&gt;= 3.0-6).
+
+Tag: init.d-script-needs-depends-on-lsb-base-for-status-of-proc
+Severity: important
+Certainty: possible
+Info: The given init script uses the <tt>status_of_proc</tt> utility from
+ <tt>/lib/lsb/init-functions</tt> utility functions without declaring the
+ corresponding dependency on lsb-base (&gt;= 3.2-13).
diff --git a/checks/init.d.pm b/checks/init.d.pm
index 7b0fa7d..b3fa827 100644
--- a/checks/init.d.pm
+++ b/checks/init.d.pm
@@ -318,8 +318,10 @@ sub check_init {
         $needs_fs{'remote'} = 1 if ($l =~ m,^[^\#]*/usr/,);
         $needs_fs{'local'}  = 1 if ($l =~ m,^[^\#]*/var/,);
 
-        while ($l =~ s/^[^\#]*?(start|stop|restart|force-reload|status)//o) {
-            $tag{$1} = 1;
+        if ($l =~ m{^[^\#]*?status_of_proc}
+            && !$info->relation('strong')->implies('lsb-base (>= 3.2-13)')) {
+            tag 'init.d-script-needs-depends-on-lsb-base-for-status-of-proc',
+              $initd_path, "(line $.)";
         }
 
         if ($l =~ m{^\s*\.\s+/lib/lsb/init-functions}
@@ -327,6 +329,11 @@ sub check_init {
             tag 'init.d-script-needs-depends-on-lsb-base',
               $initd_path, "(line $.)";
         }
+
+        # Modify $l as late as possible in loop
+        while ($l =~ s/^[^\#]*?(start|stop|restart|force-reload|status)//o) {
+            $tag{$1} = 1;
+        }
     }
     close($fd);
 
diff --git a/t/tests/init.d-lsb-depends/desc b/t/tests/init.d-lsb-depends/desc
index e0f6565..4aa74fb 100644
--- a/t/tests/init.d-lsb-depends/desc
+++ b/t/tests/init.d-lsb-depends/desc
@@ -1,4 +1,6 @@
 Testname: init.d-lsb-depends
 Version: 1.0
 Description: Test for packages missing dependencies on lsb-base
-Test-For: init.d-script-needs-depends-on-lsb-base
+Test-For:
+ init.d-script-needs-depends-on-lsb-base
+ init.d-script-needs-depends-on-lsb-base-for-status-of-proc
diff --git a/t/tests/init.d-lsb-depends/tags b/t/tests/init.d-lsb-depends/tags
index 21e92fd..9d521ef 100644
--- a/t/tests/init.d-lsb-depends/tags
+++ b/t/tests/init.d-lsb-depends/tags
@@ -1 +1,2 @@
 E: init.d-lsb-depends: init.d-script-needs-depends-on-lsb-base etc/init.d/init.d-lsb-depends (line 30)
+E: init.d-lsb-depends: init.d-script-needs-depends-on-lsb-base-for-status-of-proc etc/init.d/init.d-lsb-depends (line 62)

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


Reply to: