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

[lintian] 04/05: Add check for rcS.d init scripts without native systemd unit



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

nthykier pushed a commit to branch master
in repository lintian.

commit 40cfb4d163a0fda5797b995ecb3a4a8b34f3babb
Author: Felipe Sateler <fsateler@debian.org>
Date:   Sat Jun 27 12:20:19 2015 -0300

    Add check for rcS.d init scripts without native systemd unit
    
    [nthykier: fix a case of "Mixed high and low-precedence booleans"]
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/systemd.desc                        | 14 ++++++++++++++
 checks/systemd.pm                          | 12 ++++++++++--
 t/tests/systemd-general/debian/debian/init |  2 +-
 t/tests/systemd-general/desc               |  1 +
 t/tests/systemd-general/tags               |  1 +
 5 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/checks/systemd.desc b/checks/systemd.desc
index f84835f..6554f58 100644
--- a/checks/systemd.desc
+++ b/checks/systemd.desc
@@ -47,6 +47,20 @@ Info: The listed init.d script has no systemd equivalent.
  Your package ships a service file, but for the listed init.d script, there is
  no corresponding systemd service file.
 
+Tag: systemd-no-service-for-init-rcS-script
+Severity: serious
+Certainty: certain
+Ref: https://wiki.debian.org/Teams/pkg-systemd/rcSMigration
+Info: The rcS init.d script has no systemd equivalent.
+ .
+ Systemd has a SysV init.d script compatibility mode. It provides access to
+ each SysV init.d script as long as there is no native service file with the
+ same name (e.g. <tt>/lib/systemd/system/rsyslog.service</tt> corresponds to
+ <tt>/etc/init.d/rsyslog</tt>).
+ .
+ Services in rcS.d are particularly problematic, because they often cause
+ dependency loops, as they are ordered very early in the boot sequence.
+
 Tag: init.d-script-does-not-source-init-functions
 Severity: normal
 Certainty: certain
diff --git a/checks/systemd.pm b/checks/systemd.pm
index eea80be..5319152 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -84,6 +84,7 @@ sub check_init_script {
     my ($info, $file, $services) = @_;
     my $basename = $file->basename;
     my $lsb_source_seen;
+    my $is_rcs_script = 0;
 
     if (!$file->is_regular_file) {
         unless ($file->is_open_ok) {
@@ -96,12 +97,14 @@ sub check_init_script {
         lstrip;
         if ($. == 1 and m{\A [#]! \s*/lib/init/init-d-script}xsm) {
             $lsb_source_seen = 1;
-            last;
         }
+        if (m,#.*Default-Start:.*S,) {
+            $is_rcs_script = 1;
+        }
+
         next if /^#/;
         if (m,(?:\.|source)\s+/lib/(?:lsb/init-functions|init/init-d-script),){
             $lsb_source_seen = 1;
-            last;
         }
     }
     close($fh);
@@ -112,6 +115,11 @@ sub check_init_script {
     # make the package work with systemd.
     tag 'systemd-no-service-for-init-script', $basename
       if (%{$services} and not $services->{$basename});
+
+    # rcS scripts are particularly bad, warn even if there is
+    # no systemd integration
+    tag 'systemd-no-service-for-init-rcS-script', $basename
+      if (not $services->{$basename} and $is_rcs_script);
     return;
 }
 
diff --git a/t/tests/systemd-general/debian/debian/init b/t/tests/systemd-general/debian/debian/init
index afffa18..42cb175 100644
--- a/t/tests/systemd-general/debian/debian/init
+++ b/t/tests/systemd-general/debian/debian/init
@@ -3,7 +3,7 @@
 # Provides:          systemd-general
 # Required-Start:    $remote_fs $syslog
 # Required-Stop:     $remote_fs $syslog
-# Default-Start:     2 3 4 5
+# Default-Start:     S 2 3 4 5
 # Default-Stop:      0 1 6
 # Short-Description: Example initscript
 # Description:       This file should be used to construct scripts to be
diff --git a/t/tests/systemd-general/desc b/t/tests/systemd-general/desc
index 0bffbeb..f865251 100644
--- a/t/tests/systemd-general/desc
+++ b/t/tests/systemd-general/desc
@@ -12,3 +12,4 @@ Test-For:
  systemd-tmpfiles.d-outside-usr-lib
  systemd-service-file-refers-to-obsolete-target
  systemd-no-service-for-init-script
+ systemd-no-service-for-init-rcS-script
diff --git a/t/tests/systemd-general/tags b/t/tests/systemd-general/tags
index 6f693e3..3dc3b91 100644
--- a/t/tests/systemd-general/tags
+++ b/t/tests/systemd-general/tags
@@ -4,6 +4,7 @@ E: systemd-general: service-key-has-whitespace etc/systemd/system/test.service a
 E: systemd-general: service-key-has-whitespace usr/lib/systemd/system/test.service at line 3
 E: systemd-general: special-file etc/init.d/fifo-pipe-as-init 0644
 E: systemd-general: special-file etc/systemd/system/fifo-pipe-as-init.service 0644
+E: systemd-general: systemd-no-service-for-init-rcS-script systemd-general
 E: systemd-general: systemd-no-service-for-init-script systemd-general
 E: systemd-general: systemd-service-file-outside-lib etc/systemd/system/fifo-pipe-as-init.service
 E: systemd-general: systemd-service-file-outside-lib etc/systemd/system/test.service

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


Reply to: