Package: lintian Version: 2.5.45 Severity: wishlist Tags: patch Hi,
Attached is the following: commit 58a167f6f89dd33d29806919966cc839ccf8e0f5 Author: Chris Lamb <[email protected]> Date: Thu Jul 28 12:57:16 2016 -0400 c/systemd: Warn about .service files with a missing WantedBy target. Signed-off-by: Chris Lamb <[email protected]> checks/systemd.desc | 12 ++++++++++++ checks/systemd.pm | 2 ++ .../systemd-complex-service-file/debian/debian/test3.service | 3 +++ t/tests/systemd-complex-service-file/desc | 1 + t/tests/systemd-complex-service-file/tags | 1 + 5 files changed, 19 insertions(+) Regards, -- ,''`. : :' : Chris Lamb `. `'` [email protected] / chris-lamb.co.uk `-
From 58a167f6f89dd33d29806919966cc839ccf8e0f5 Mon Sep 17 00:00:00 2001 From: Chris Lamb <[email protected]> Date: Thu, 28 Jul 2016 12:57:16 -0400 Subject: [PATCH] c/systemd: Warn about .service files with a missing WantedBy target. Signed-off-by: Chris Lamb <[email protected]> --- checks/systemd.desc | 12 ++++++++++++ checks/systemd.pm | 2 ++ .../systemd-complex-service-file/debian/debian/test3.service | 3 +++ t/tests/systemd-complex-service-file/desc | 1 + t/tests/systemd-complex-service-file/tags | 1 + 5 files changed, 19 insertions(+) diff --git a/checks/systemd.desc b/checks/systemd.desc index 07dea64..a5063c7 100644 --- a/checks/systemd.desc +++ b/checks/systemd.desc @@ -126,3 +126,15 @@ Info: The systemd service file does not contain a <tt>Documentation</tt> key. Documentation for systemd service files can be automatically viewed using <tt>systemctl help servicename</tt> if this field is present. Ref: systemd.unit(5) + +Tag: systemd-service-file-missing-wanted-by-key +Severity: normal +Certainty: certain +Info: The systemd service file does not contain a <tt>WantedBy=multi-user.target</tt> key + in its <tt>[Install]</tt> section. + . + Forgetting to add such a line (eg. <tt>WantedBy=multi-user.target</tt>) + results in the service file not being started by default. + . + If this is intentional, please override this warning. +Ref: systemd.unit(5) diff --git a/checks/systemd.pm b/checks/systemd.pm index face504..4ef82ae 100644 --- a/checks/systemd.pm +++ b/checks/systemd.pm @@ -201,6 +201,8 @@ sub check_systemd_service_file { if (not $file->is_symlink or $file->link ne '/dev/null') { tag 'systemd-service-file-missing-documentation-key', $file, unless extract_service_file_values($file, 'Unit', 'Documentation',1); + tag 'systemd-service-file-missing-wanted-by-key', $file, + unless extract_service_file_values($file, 'Install', 'WantedBy',1); } return 1; diff --git a/t/tests/systemd-complex-service-file/debian/debian/test3.service b/t/tests/systemd-complex-service-file/debian/debian/test3.service index 5fe96f6..3862626 100644 --- a/t/tests/systemd-complex-service-file/debian/debian/test3.service +++ b/t/tests/systemd-complex-service-file/debian/debian/test3.service @@ -3,3 +3,6 @@ [Unit] After= After = syslog.target + +[Install] +WantedBy=multi-user.target diff --git a/t/tests/systemd-complex-service-file/desc b/t/tests/systemd-complex-service-file/desc index 98ec594..a7d5d4f 100644 --- a/t/tests/systemd-complex-service-file/desc +++ b/t/tests/systemd-complex-service-file/desc @@ -7,3 +7,4 @@ Test-For: service-key-has-whitespace systemd-service-file-refers-to-obsolete-target systemd-service-file-missing-documentation-key + systemd-service-file-missing-wanted-by-key diff --git a/t/tests/systemd-complex-service-file/tags b/t/tests/systemd-complex-service-file/tags index 34cb40a..00a01d9 100644 --- a/t/tests/systemd-complex-service-file/tags +++ b/t/tests/systemd-complex-service-file/tags @@ -1,4 +1,5 @@ E: systemd-complex-service-file: service-key-has-whitespace lib/systemd/system/test3.service at line 3 I: systemd-complex-service-file: systemd-service-file-missing-documentation-key lib/systemd/system/test3.service +W: systemd-complex-service-file: systemd-service-file-missing-wanted-by-key lib/systemd/system/test2.service W: systemd-complex-service-file: systemd-service-file-refers-to-obsolete-target lib/systemd/system/test.service dbus.target W: systemd-complex-service-file: systemd-service-file-refers-to-obsolete-target lib/systemd/system/test2.service syslog.target -- 2.8.1

