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

[lintian] 02/03: check if systemd service alias has an .service extension Closes: #808369



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

nthykier pushed a commit to branch master
in repository lintian.

commit 3e5d5cc694bada28cfd960e5148cca08c0f6397f
Author: Evgeni Golov <evgeni@debian.org>
Date:   Sat Dec 19 09:31:02 2015 +0100

    check if systemd service alias has an .service extension Closes: #808369
    
    Signed-off-by: Niels Thykier <niels@thykier.net>
---
 checks/systemd.desc                                | 9 +++++++++
 checks/systemd.pm                                  | 2 ++
 t/tests/systemd-general/debian/debian/test.service | 1 +
 t/tests/systemd-general/desc                       | 1 +
 t/tests/systemd-general/tags                       | 2 ++
 5 files changed, 15 insertions(+)

diff --git a/checks/systemd.desc b/checks/systemd.desc
index 828b66b..e895606 100644
--- a/checks/systemd.desc
+++ b/checks/systemd.desc
@@ -108,3 +108,12 @@ Info: The systemd service file contains space in the key definitions
  have been known to break.
  .
  Please remove the spaces surrounding the key definition.
+
+Tag: systemd-service-alias-without-extension
+Severity: normal
+Certainty: certain
+Ref: http://www.freedesktop.org/software/systemd/man/systemd.unit.html#Alias=
+Info: The service file lists an alias without an file extension.
+ .
+ The spec mandates that the extension of the listed alias matches
+ the extension of the unit itself.
diff --git a/checks/systemd.pm b/checks/systemd.pm
index aef5c32..cbd725f 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -164,6 +164,8 @@ sub get_systemd_service_names {
           = extract_service_file_values($info, $file, 'Install', 'Alias', 1);
 
         for my $alias (@aliases) {
+            tag 'systemd-service-alias-without-extension', $file
+              if $alias !~ m/\.service$/;
             $alias =~ s/\.service$//;
             $safe_add_service->($alias, $file);
         }
diff --git a/t/tests/systemd-general/debian/debian/test.service b/t/tests/systemd-general/debian/debian/test.service
index 54611f4..45c8e6d 100644
--- a/t/tests/systemd-general/debian/debian/test.service
+++ b/t/tests/systemd-general/debian/debian/test.service
@@ -9,3 +9,4 @@ ExecStart=/usr/bin/test
 [Install]
 WantedBy=multi-user.target
 Alias=systemd-aliasd.service
+Alias=anothertest
diff --git a/t/tests/systemd-general/desc b/t/tests/systemd-general/desc
index f865251..4d12ddb 100644
--- a/t/tests/systemd-general/desc
+++ b/t/tests/systemd-general/desc
@@ -13,3 +13,4 @@ Test-For:
  systemd-service-file-refers-to-obsolete-target
  systemd-no-service-for-init-script
  systemd-no-service-for-init-rcS-script
+ systemd-service-alias-without-extension
diff --git a/t/tests/systemd-general/tags b/t/tests/systemd-general/tags
index 9f35134..c1651ef 100644
--- a/t/tests/systemd-general/tags
+++ b/t/tests/systemd-general/tags
@@ -15,5 +15,7 @@ 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/bootmisc.sh
 W: systemd-general: script-in-etc-init.d-not-registered-via-update-rc.d etc/init.d/fifo-pipe-as-init
 W: systemd-general: script-in-etc-init.d-not-registered-via-update-rc.d etc/init.d/masked
+W: systemd-general: systemd-service-alias-without-extension etc/systemd/system/test.service
+W: systemd-general: systemd-service-alias-without-extension usr/lib/systemd/system/test.service
 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

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


Reply to: