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

Bug#718563: lintian: tag service-file-is-not-a-file fails when service is linked to /dev/null



Package: lintian
Version: 2.5.15
Severity: normal
Tags: patch

The lintian tag service-file-is-not-a-file has a false positive when a
service unit is linked to /dev/null

The systemd unit documentation says:

# If a unit file is empty (i.e. has the file size 0) or is symlinked
# to /dev/null its configuration will not be loaded and it appears
# with a load state of "masked", and cannot be activated. Use this as
# an effective way to fully disable a unit, making it impossible to
# start it even manually.

I've attached a patch to fix the issue. It is also available as the
branch "fix/service-file-is-not-a-file" at
git://gitorious.org/ssm-deb/lintian.git

-- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 3.10-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE= (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash

Versions of packages lintian depends on:
ii  binutils                       2.23.52.20130727-1
ii  bzip2                          1.0.6-4
ii  diffstat                       1.55-3
ii  file                           1:5.14-2
ii  gettext                        0.18.3-1
ii  hardening-includes             2.3
ii  intltool-debian                0.35.0+20060710.1
ii  libapt-pkg-perl                0.1.29
ii  libarchive-zip-perl            1.30-7
ii  libclass-accessor-perl         0.34-1
ii  libclone-perl                  0.34-1
ii  libdpkg-perl                   1.17.1
ii  libemail-valid-perl            0.190-1
ii  libfile-basedir-perl           0.03-1
ii  libipc-run-perl                0.92-1
ii  liblist-moreutils-perl         0.33-1+b1
ii  libparse-debianchangelog-perl  1.2.0-1
ii  libtext-levenshtein-perl       0.06~01-2
ii  libtimedate-perl               1.2000-1
ii  liburi-perl                    1.60-1
ii  man-db                         2.6.5-2
ii  patchutils                     0.3.2-2
ii  perl [libdigest-sha-perl]      5.14.2-21
ii  t1utils                        1.37-2

Versions of packages lintian recommends:
ii  libautodie-perl                 2.20-1
ii  libperlio-gzip-perl             0.18-1+b2
ii  perl-modules [libautodie-perl]  5.14.2-21

Versions of packages lintian suggests:
pn  binutils-multiarch     <none>
ii  dpkg-dev               1.17.1
ii  libhtml-parser-perl    3.71-1
pn  libtext-template-perl  <none>
ii  xz-utils               5.1.1alpha+20120614-2

-- no debconf information
>From ef9b199ba2d2315fc44a3cf96bdab8a5259ef980 Mon Sep 17 00:00:00 2001
From: Stig Sandbeck Mathisen <ssm@debian.org>
Date: Fri, 2 Aug 2013 11:49:24 +0200
Subject: [PATCH] Ensure the tag service-file-is-not-a-file accepts symlinks
 to /dev/null

---
 checks/systemd.pm |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/checks/systemd.pm b/checks/systemd.pm
index 03c3d94..5c7085f 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -177,8 +177,13 @@ sub extract_service_file_values {
     my $section;
 
     my $unpacked_file = $info->unpacked ($file);
-    unless (-f $unpacked_file &&
-            is_ancestor_of ($info->unpacked, $unpacked_file)) {
+    unless (
+        (   -f $unpacked_file
+            && is_ancestor_of( $info->unpacked, $unpacked_file )
+        )
+        || ( $file->is_symlink && $file->link eq '/dev/null' )
+        )
+    {
         tag 'service-file-is-not-a-file', $file;
         return;
     }
-- 
1.7.10.4


Reply to: