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

Bug#837057: lintian: Please catch some false-positives in systemd-service-file-missing-install-key



Package: lintian
Severity: wishlist
Version: 2.5.47
Tags: patch

Hi,

Attached is the following:

  commit 78664328f5fe568ea15f7e57a4c5378425301e22
  Author: Chris Lamb <lamby@debian.org>
  Date:   Thu Sep 8 12:24:05 2016 +0100
  
      c/systemd: Reduce certainty of systemd-service-file-missing-install-key.
      
      Signed-off-by: Chris Lamb <lamby@debian.org>
  
   checks/systemd.desc                       | 4 +---
   t/tests/systemd-complex-service-file/tags | 2 +-
   2 files changed, 2 insertions(+), 4 deletions(-)
  
  commit 7c6c8b12b962993fd3e06ee9453e25f3fef685fb
  Author: Chris Lamb <lamby@debian.org>
  Date:   Thu Sep 8 12:33:36 2016 +0100
  
      c/systemd.pm: Don't emit systemd-service-file-missing-install-key for "template" .service files.
      
      Signed-off-by: Chris Lamb <lamby@debian.org>
  
   checks/systemd.pm                                                | 3 ++-
   t/tests/systemd-complex-service-file/debian/debian/install       | 3 ++-
   t/tests/systemd-complex-service-file/debian/debian/test@.service | 5 +++++
   3 files changed, 9 insertions(+), 2 deletions(-)
  
  commit b4584f232df1f64dbabacbbac3b1496ccf2418f2
  Author: Chris Lamb <lamby@debian.org>
  Date:   Thu Sep 8 12:36:57 2016 +0100
  
      c/systemd: Don't emit systemd-service-file-missing-install-key if it contain an "Also=" section.
      
      Signed-off-by: Chris Lamb <lamby@debian.org>
  
   checks/systemd.pm                                                | 1 +
   t/tests/systemd-complex-service-file/debian/debian/install       | 1 +
   t/tests/systemd-complex-service-file/debian/debian/test4.service | 8 ++++++++
   3 files changed, 10 insertions(+)
  
  commit b380c64f21805dca56cfa84c48b83cca5381b3ef
  Author: Chris Lamb <lamby@debian.org>
  Date:   Thu Sep 8 12:48:09 2016 +0100
  
      c/systemd: Don't emit systemd-service-file-missing-install-key for Type=oneshot.
  
   checks/systemd.pm                                                | 1 +
   t/tests/systemd-complex-service-file/debian/debian/install       | 1 +
   t/tests/systemd-complex-service-file/debian/debian/test5.service | 6 ++++++
   3 files changed, 8 insertions(+)


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      lamby@debian.org / chris-lamb.co.uk
       `-
From 78664328f5fe568ea15f7e57a4c5378425301e22 Mon Sep 17 00:00:00 2001
From: Chris Lamb <lamby@debian.org>
Date: Thu, 8 Sep 2016 12:24:05 +0100
Subject: [PATCH 1/4] c/systemd: Reduce certainty of
 systemd-service-file-missing-install-key.

Signed-off-by: Chris Lamb <lamby@debian.org>
---
 checks/systemd.desc                       | 4 +---
 t/tests/systemd-complex-service-file/tags | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/checks/systemd.desc b/checks/systemd.desc
index 86bfa51..d4aea02 100644
--- a/checks/systemd.desc
+++ b/checks/systemd.desc
@@ -129,12 +129,10 @@ Ref: systemd.unit(5)
 
 Tag: systemd-service-file-missing-install-key
 Severity: normal
-Certainty: possible
+Certainty: wild-guess
 Info: The systemd service file does not contain a <tt>WantedBy=</tt> or
  <tt>RequiredBy=</tt> key in its <tt>[Install]</tt> section.
  .
  Forgetting to add such a line (e.g. <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/t/tests/systemd-complex-service-file/tags b/t/tests/systemd-complex-service-file/tags
index fafa0e8..11095e2 100644
--- a/t/tests/systemd-complex-service-file/tags
+++ b/t/tests/systemd-complex-service-file/tags
@@ -1,5 +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-install-key lib/systemd/system/test2.service
+I: systemd-complex-service-file: systemd-service-file-missing-install-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.9.3

From 7c6c8b12b962993fd3e06ee9453e25f3fef685fb Mon Sep 17 00:00:00 2001
From: Chris Lamb <lamby@debian.org>
Date: Thu, 8 Sep 2016 12:33:36 +0100
Subject: [PATCH 2/4] c/systemd.pm: Don't emit
 systemd-service-file-missing-install-key for "template" .service files.

Signed-off-by: Chris Lamb <lamby@debian.org>
---
 checks/systemd.pm                                                | 3 ++-
 t/tests/systemd-complex-service-file/debian/debian/install       | 3 ++-
 t/tests/systemd-complex-service-file/debian/debian/test@.service | 5 +++++
 3 files changed, 9 insertions(+), 2 deletions(-)
 create mode 100644 t/tests/systemd-complex-service-file/debian/debian/test@.service

diff --git a/checks/systemd.pm b/checks/systemd.pm
index b6a2153..aa0e1d0 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -203,7 +203,8 @@ sub check_systemd_service_file {
           unless extract_service_file_values($file, 'Unit', 'Documentation',1);
         tag 'systemd-service-file-missing-install-key', $file,
           unless extract_service_file_values($file, 'Install', 'WantedBy',1)
-          or extract_service_file_values($file, 'Install', 'RequiredBy',1);
+          or extract_service_file_values($file, 'Install', 'RequiredBy',1)
+          or $file =~ m,@\.service$,;
     }
 
     return 1;
diff --git a/t/tests/systemd-complex-service-file/debian/debian/install b/t/tests/systemd-complex-service-file/debian/debian/install
index f4ca3c8..10c1616 100644
--- a/t/tests/systemd-complex-service-file/debian/debian/install
+++ b/t/tests/systemd-complex-service-file/debian/debian/install
@@ -1,3 +1,4 @@
 debian/test.service lib/systemd/system/
 debian/test2.service lib/systemd/system/
-debian/test3.service lib/systemd/system/
\ No newline at end of file
+debian/test3.service lib/systemd/system/
+debian/test@.service lib/systemd/system/
diff --git a/t/tests/systemd-complex-service-file/debian/debian/test@.service b/t/tests/systemd-complex-service-file/debian/debian/test@.service
new file mode 100644
index 0000000..d54ea5d
--- /dev/null
+++ b/t/tests/systemd-complex-service-file/debian/debian/test@.service
@@ -0,0 +1,5 @@
+[Unit]
+Documentation=https://www.example.com/
+
+[Service]
+ExecStart=/usr/bin/test
-- 
2.9.3

From b4584f232df1f64dbabacbbac3b1496ccf2418f2 Mon Sep 17 00:00:00 2001
From: Chris Lamb <lamby@debian.org>
Date: Thu, 8 Sep 2016 12:36:57 +0100
Subject: [PATCH 3/4] c/systemd: Don't emit
 systemd-service-file-missing-install-key if it contain an "Also=" section.

Signed-off-by: Chris Lamb <lamby@debian.org>
---
 checks/systemd.pm                                                | 1 +
 t/tests/systemd-complex-service-file/debian/debian/install       | 1 +
 t/tests/systemd-complex-service-file/debian/debian/test4.service | 8 ++++++++
 3 files changed, 10 insertions(+)
 create mode 100644 t/tests/systemd-complex-service-file/debian/debian/test4.service

diff --git a/checks/systemd.pm b/checks/systemd.pm
index aa0e1d0..b670c37 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -204,6 +204,7 @@ sub check_systemd_service_file {
         tag 'systemd-service-file-missing-install-key', $file,
           unless extract_service_file_values($file, 'Install', 'WantedBy',1)
           or extract_service_file_values($file, 'Install', 'RequiredBy',1)
+          or extract_service_file_values($file, 'Install', 'Also',1)
           or $file =~ m,@\.service$,;
     }
 
diff --git a/t/tests/systemd-complex-service-file/debian/debian/install b/t/tests/systemd-complex-service-file/debian/debian/install
index 10c1616..a4ea934 100644
--- a/t/tests/systemd-complex-service-file/debian/debian/install
+++ b/t/tests/systemd-complex-service-file/debian/debian/install
@@ -1,4 +1,5 @@
 debian/test.service lib/systemd/system/
 debian/test2.service lib/systemd/system/
 debian/test3.service lib/systemd/system/
+debian/test4.service lib/systemd/system/
 debian/test@.service lib/systemd/system/
diff --git a/t/tests/systemd-complex-service-file/debian/debian/test4.service b/t/tests/systemd-complex-service-file/debian/debian/test4.service
new file mode 100644
index 0000000..d63a719
--- /dev/null
+++ b/t/tests/systemd-complex-service-file/debian/debian/test4.service
@@ -0,0 +1,8 @@
+[Unit]
+Documentation=https://www.example.com/
+
+[Service]
+ExecStart=/usr/bin/test
+
+[Install]
+Also=test3
-- 
2.9.3

From b380c64f21805dca56cfa84c48b83cca5381b3ef Mon Sep 17 00:00:00 2001
From: Chris Lamb <lamby@debian.org>
Date: Thu, 8 Sep 2016 12:48:09 +0100
Subject: [PATCH 4/4] c/systemd: Don't emit
 systemd-service-file-missing-install-key for Type=oneshot.

---
 checks/systemd.pm                                                | 1 +
 t/tests/systemd-complex-service-file/debian/debian/install       | 1 +
 t/tests/systemd-complex-service-file/debian/debian/test5.service | 6 ++++++
 3 files changed, 8 insertions(+)
 create mode 100644 t/tests/systemd-complex-service-file/debian/debian/test5.service

diff --git a/checks/systemd.pm b/checks/systemd.pm
index b670c37..d22140c 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -205,6 +205,7 @@ sub check_systemd_service_file {
           unless extract_service_file_values($file, 'Install', 'WantedBy',1)
           or extract_service_file_values($file, 'Install', 'RequiredBy',1)
           or extract_service_file_values($file, 'Install', 'Also',1)
+          or grep { /^oneshot$/ } extract_service_file_values($file, 'Service', 'Type')
           or $file =~ m,@\.service$,;
     }
 
diff --git a/t/tests/systemd-complex-service-file/debian/debian/install b/t/tests/systemd-complex-service-file/debian/debian/install
index a4ea934..763129d 100644
--- a/t/tests/systemd-complex-service-file/debian/debian/install
+++ b/t/tests/systemd-complex-service-file/debian/debian/install
@@ -2,4 +2,5 @@ debian/test.service lib/systemd/system/
 debian/test2.service lib/systemd/system/
 debian/test3.service lib/systemd/system/
 debian/test4.service lib/systemd/system/
+debian/test5.service lib/systemd/system/
 debian/test@.service lib/systemd/system/
diff --git a/t/tests/systemd-complex-service-file/debian/debian/test5.service b/t/tests/systemd-complex-service-file/debian/debian/test5.service
new file mode 100644
index 0000000..64a7562
--- /dev/null
+++ b/t/tests/systemd-complex-service-file/debian/debian/test5.service
@@ -0,0 +1,6 @@
+[Unit]
+Documentation=https://www.example.com/
+
+[Service]
+Type=oneshot
+ExecStart=/usr/bin/test
-- 
2.9.3


Reply to: