[lintian] 01/03: Warn about packages that use ENABLED="true" (etc.) in /etc/default files.
This is an automated email from the git hooks/post-receive script.
lamby pushed a commit to branch master
in repository lintian.
commit 88d5ff256c83a6b5923919289954c9c72ab99577
Author: Chris Lamb <lamby@debian.org>
Date: Wed Feb 7 20:11:48 2018 +0000
Warn about packages that use ENABLED="true" (etc.) in /etc/default files.
---
checks/init.d.desc | 20 ++++++++++++++++++++
checks/init.d.pm | 17 +++++++++++++++++
debian/changelog | 3 +++
.../debian/debian/init.d-general.default | 9 +++++++++
4 files changed, 49 insertions(+)
diff --git a/checks/init.d.desc b/checks/init.d.desc
index 415fdb2..7285a99 100644
--- a/checks/init.d.desc
+++ b/checks/init.d.desc
@@ -370,3 +370,23 @@ Info: The given init script appears to contain content from the
.
Please double-check the script and/or replace it with content suitable to
this binary package.
+
+Tag: init.d-script-should-always-start-service
+Severity: important
+Certainty: possible
+Info: The specified file under <tt>/etc/default/</tt> includes a line
+ such as <tt>ENABLED="true"</tt> or similar.
+ .
+ This was a older practice used so that the package's init script would
+ not start the service until the local system administrator changed this
+ value.
+ .
+ However, this hides from the underlying init system whether or not the
+ daemon should actually be started, leading to confusing behavior
+ including <tt>service package start</tt> returning success without the
+ service actually starting.
+ .
+ Please remove this mechanism and either move to automatically starting
+ this daemon or disable autostarting via <tt>defaults-disabled</tt> or
+ similar.
+Ref: policy 9.3.3.1, update-rc.d(8)
diff --git a/checks/init.d.pm b/checks/init.d.pm
index c5e6edd..d8d05f1 100644
--- a/checks/init.d.pm
+++ b/checks/init.d.pm
@@ -200,6 +200,7 @@ sub run {
# other issues if it was included in the package.
check_init($initd_path, $info);
}
+ check_defaults($info);
return unless $initd_dir and $initd_dir->is_dir;
@@ -484,6 +485,22 @@ sub check_init {
return;
}
+sub check_defaults {
+ my ($info) = @_;
+ my $dir = $info->index_resolved_path('etc/default/');
+ return unless $dir and $dir->is_dir;
+ for my $path ($dir->children) {
+ return if not $path->is_open_ok;
+ my $fd = $path->open;
+ while (<$fd>) {
+ tag 'init.d-script-should-always-start-service', $path, "(line $.)"
+ if m/^\s*#*\s*(?:ENABLED|DISABLED)=/;
+ }
+ close($fd);
+ }
+ return;
+}
+
1;
# Local Variables:
diff --git a/debian/changelog b/debian/changelog
index befcd05..0182b69 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -25,6 +25,9 @@ lintian (2.5.74) UNRELEASED; urgency=medium
* checks/java.{desc,pm}:
+ [CL] Only warn about bad-jar-name for "public" .jar files.
(Closes: #889628)
+ * checks/init.d.{desc,pm}:
+ + [CL] Warn about packages that use ENABLED="true" (etc.) in
+ /etc/default files.
* checks/patch-systems.pm:
+ [CL] Avoid emitting "Can't use an undefined value as an ARRAY
reference" warnings when debian/patches is a file, not a directory.
diff --git a/t/tests/init.d-general/debian/debian/init.d-general.default b/t/tests/init.d-general/debian/debian/init.d-general.default
new file mode 100644
index 0000000..9389211
--- /dev/null
+++ b/t/tests/init.d-general/debian/debian/init.d-general.default
@@ -0,0 +1,9 @@
+ENABLED="false"
+ENABLED=false
+DISABLED="true"
+DISABLED=true
+
+# ENABLED="false"
+# ENABLED=false
+# DISABLED="true"
+# DISABLED=true
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/lintian/lintian.git
Reply to: