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

[lintian] 01/04: c/systemd: Detect spaces around the = in the key definition



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

nthykier pushed a commit to branch master
in repository lintian.

commit 38335e55d907e718250154d482de61c0aae24ec5
Author: Felipe Sateler <fsateler@debian.org>
Date:   Sat Jun 13 12:45:35 2015 -0300

    c/systemd: Detect spaces around the = in the key definition
    
    Add check to detect service files that use spaces around the = in the
    key definition.
    
    Closes: #786421
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 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                       |  1 +
 5 files changed, 19 insertions(+)

diff --git a/checks/systemd.desc b/checks/systemd.desc
index d8a2e55..f84835f 100644
--- a/checks/systemd.desc
+++ b/checks/systemd.desc
@@ -83,3 +83,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 01a5352..56e6e61 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -57,6 +57,9 @@ lintian (2.5.32) UNRELEASED; urgency=medium
   * checks/systemd.{desc,pm}:
     + [NT] Apply patch from Felipe Sateler to mark service files in
       /usr/lib as invalid.  (Closes: #788629)
+    + [NT] Apply patch from Felipe Sateler 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 7a2767c..3c23df1 100644
--- a/t/tests/systemd-general/tags
+++ b/t/tests/systemd-general/tags
@@ -1,6 +1,7 @@
 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: 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

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


Reply to: