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

Bug#788629: lintian: check that systemd service files are not in /usr/lib/systemd/system



Package: lintian
Followup-For: Bug #788629

Attached is an updated patch that includes a test.

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.0.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages lintian depends on:
ii  binutils                       2.25-8
ii  bzip2                          1.0.6-8
ii  diffstat                       1.58-1
ii  file                           1:5.22+15-2
ii  gettext                        0.19.4-1
ii  hardening-includes             2.7
ii  intltool-debian                0.35.0+20060710.2
ii  libapt-pkg-perl                0.1.29+b2
ii  libarchive-zip-perl            1.39-1
ii  libclass-accessor-perl         0.34-1
ii  libclone-perl                  0.38-1
ii  libdpkg-perl                   1.18.1
ii  libemail-valid-perl            1.195-1
ii  libfile-basedir-perl           0.03-1
ii  libipc-run-perl                0.94-1
ii  liblist-moreutils-perl         0.410-1
ii  libparse-debianchangelog-perl  1.2.0-3
ii  libtext-levenshtein-perl       0.12-1
ii  libtimedate-perl               2.3000-2
ii  liburi-perl                    1.64-1
ii  man-db                         2.7.0.2-5
ii  patchutils                     0.3.4-1
ii  perl [libdigest-sha-perl]      5.20.2-6
ii  t1utils                        1.38-4
ii  xz-utils                       5.1.1alpha+20120614-2+b3

Versions of packages lintian recommends:
ii  dpkg                            1.18.1
ii  libautodie-perl                 2.25-1
ii  libperlio-gzip-perl             0.18-3+b1
ii  perl                            5.20.2-6
ii  perl-modules [libautodie-perl]  5.20.2-6

Versions of packages lintian suggests:
pn  binutils-multiarch     <none>
ii  dpkg-dev               1.18.1
ii  libhtml-parser-perl    3.71-2
ii  libtext-template-perl  1.46-1
ii  libyaml-perl           1.13-1

-- no debconf information
>From 7517f721d5ba0b84e2fb6ad74e3d10690ab991de Mon Sep 17 00:00:00 2001
From: Felipe Sateler <fsateler@debian.org>
Date: Sat, 13 Jun 2015 11:37:31 -0300
Subject: [PATCH] checks/systemd.{desc,pm}: mark service files in /usr/lib as
 invalid

Systemd in debian will not look at /usr/lib/service
---
 checks/systemd.desc                           | 2 ++
 checks/systemd.pm                             | 3 +++
 debian/changelog                              | 3 +++
 t/tests/systemd-general/debian/debian/install | 1 +
 t/tests/systemd-general/tags                  | 2 ++
 5 files changed, 11 insertions(+)

diff --git a/checks/systemd.desc b/checks/systemd.desc
index ed1b777..1ba05d5 100644
--- a/checks/systemd.desc
+++ b/checks/systemd.desc
@@ -10,6 +10,8 @@ Certainty: certain
 Info: The package ships a systemd service file outside
  <tt>/lib/systemd/system/</tt>
  .
+ Systemd in debian searches for unit files in <tt>/lib/systemd/system/</tt>
+ and <tt>/etc/systemd/system</tt>.
  System administrators should have the possibility to overwrite a
  service file (or parts of it, in newer systemd versions) by placing a
  file in <tt>/etc/systemd/system</tt>, so the canonical location used
diff --git a/checks/systemd.pm b/checks/systemd.pm
index 05cb8d1..b79c7ac 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -55,6 +55,9 @@ sub run {
         if ($file =~ m,^etc/systemd/system/.*\.service$,) {
             tag 'systemd-service-file-outside-lib', $file;
         }
+        if ($file =~ m,^usr/lib/systemd/system/.*\.service$,) {
+            tag 'systemd-service-file-outside-lib', $file;
+        }
         if ($file =~ m,/systemd/system/.*\.service$,) {
             check_systemd_service_file($info, $file);
             for my $name (extract_service_file_names($info, $file)) {
diff --git a/debian/changelog b/debian/changelog
index 7f97b41..d14263b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -110,6 +110,9 @@ lintian (2.5.32) UNRELEASED; urgency=medium
   * mail-templates/source-is-missing:
     + [BR] Apply patch from Holger Levsen improving language.
 
+  * checks/systemd.{desc,pm}:
+    + [FS] mark service files in /usr/lib as invalid
+
  -- Niels Thykier <niels@thykier.net>  Sat, 30 May 2015 18:42:22 +0200
 
 lintian (2.5.31) unstable; urgency=medium
diff --git a/t/tests/systemd-general/debian/debian/install b/t/tests/systemd-general/debian/debian/install
index 363d12a..56cf085 100644
--- a/t/tests/systemd-general/debian/debian/install
+++ b/t/tests/systemd-general/debian/debian/install
@@ -1,2 +1,3 @@
 debian/test.service etc/systemd/system/
+debian/test.service usr/lib/systemd/system/
 debian/test.conf etc/tmpfiles.d/
diff --git a/t/tests/systemd-general/tags b/t/tests/systemd-general/tags
index ad662b4..7a2767c 100644
--- a/t/tests/systemd-general/tags
+++ b/t/tests/systemd-general/tags
@@ -6,8 +6,10 @@ E: systemd-general: special-file etc/systemd/system/fifo-pipe-as-init.service 06
 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
+E: systemd-general: systemd-service-file-outside-lib usr/lib/systemd/system/test.service
 E: systemd-general: systemd-tmpfiles.d-outside-usr-lib etc/tmpfiles.d/test.conf
 W: systemd-general: init.d-script-does-not-source-init-functions etc/init.d/systemd-general
 W: systemd-general: maintainer-script-calls-systemctl postrm:6
 W: systemd-general: script-in-etc-init.d-not-registered-via-update-rc.d etc/init.d/fifo-pipe-as-init
 W: systemd-general: systemd-service-file-refers-to-obsolete-target etc/systemd/system/test.service syslog.target
+W: systemd-general: systemd-service-file-refers-to-obsolete-target usr/lib/systemd/system/test.service syslog.target
-- 
2.1.4


Reply to: