Package: lintian Followup-For: Bug #786421 Control: tag -1 patch Please find attached a patch that implements this check.
-- 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 d0063b7243b913cb12981bd3d38410615a9b262d Mon Sep 17 00:00:00 2001 From: Felipe Sateler <fsate...@debian.org> Date: Sat, 13 Jun 2015 12:45:35 -0300 Subject: [PATCH] checks/systemd.{desc,pm} Add check to detect service files that use spaces around the = in the key definition. (Closes: #786421) --- checks/systemd.desc | 11 +++++++++++ checks/systemd.pm | 3 +++ debian/changelog | 3 +++ t/tests/systemd-general/debian/debian/test.service | 1 + t/tests/systemd-general/tags | 2 ++ 5 files changed, 20 insertions(+) diff --git a/checks/systemd.desc b/checks/systemd.desc index 1ba05d5..690ba4d 100644 --- a/checks/systemd.desc +++ b/checks/systemd.desc @@ -81,3 +81,14 @@ Severity: serious Certainty: certain Info: The package contains a service file that is not a regular file or resolvable symlink. + +Tag: service-key-has-whitespace +Severity: important +Certainty: certain +Info: The systemd service file contains space in the key definitions + . + Service files should not have spaces surrounding the <tt>=</tt> key. + They are not explicitly supported by systemd, and third party tools + have been known to break. + . + Please remove the spaces surrounding the key definition. diff --git a/checks/systemd.pm b/checks/systemd.pm index b79c7ac..f03149d 100644 --- a/checks/systemd.pm +++ b/checks/systemd.pm @@ -188,6 +188,9 @@ sub extract_service_file_values { return; } my @lines = service_file_lines($file); + if (any { /^[[:alnum:]]+(\s*=\s|\s+=)/ } @lines) { + tag 'service-key-has-whitespace', $file; + } if (any { /^\.include / } @lines) { my $parent_dir = $file->parent_dir; @lines = map { diff --git a/debian/changelog b/debian/changelog index d14263b..9c9c23a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -47,6 +47,9 @@ lintian (2.5.32) UNRELEASED; urgency=medium different "public-domain licenses", as they are expected to describe what something is in public domain. (Closes: #787248) + * checks/systemd.{desc,pm}: + + [FS] Add check to detect service files that use spaces around + the = in the key definition. (Closes: #786421) * collection/{debfiles,doc-base-files,init.d,menu-files}{,.desc}: + [NT] Remove deprecated and unused collections. These were diff --git a/t/tests/systemd-general/debian/debian/test.service b/t/tests/systemd-general/debian/debian/test.service index 9d73aca..a327823 100644 --- a/t/tests/systemd-general/debian/debian/test.service +++ b/t/tests/systemd-general/debian/debian/test.service @@ -3,6 +3,7 @@ After=network.target \ syslog.target [Service] +ExecStartPre = /bin/true ExecStart=/usr/bin/test [Install] diff --git a/t/tests/systemd-general/tags b/t/tests/systemd-general/tags index ad662b4..cf2828e 100644 --- a/t/tests/systemd-general/tags +++ b/t/tests/systemd-general/tags @@ -1,6 +1,8 @@ E: systemd-general: init-script-is-not-a-file etc/init.d/fifo-pipe-as-init E: systemd-general: service-file-is-not-a-file etc/systemd/system/fifo-pipe-as-init.service E: systemd-general: service-file-is-not-a-file etc/systemd/system/fifo-pipe-as-init.service +E: systemd-general: service-key-has-whitespace etc/systemd/system/test.service +E: systemd-general: service-key-has-whitespace etc/systemd/system/test.service 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-script systemd-general -- 2.1.4