Bug#670092: [lintian] Patch
Package: lintian
Version: 2.5.12
control: tags -1 + patch
This patch will do the work
From 9d940f3cb5cc03f639e5055a0573cee2b87f69de Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastien=20ROUCARI=C3=88S?= <roucaries.bastien@gmail.com>
Date: Mon, 20 May 2013 20:26:22 +0200
Subject: [PATCH] Warn about any reference to /lib/init in init.d scripts
/lib/init/rw has gone away, and the scripts in /lib/init/*.sh represent
internal implementation details of initscripts, *not* public API for
other packages to use. Nonetheless, some packages incorrectly reference
those scripts, notably /lib/init/vars.sh.
---
checks/init.d | 13 ++++++++++---
checks/init.d.desc | 9 +++++++++
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/checks/init.d b/checks/init.d
index b081b2a..9164331 100644
--- a/checks/init.d
+++ b/checks/init.d
@@ -181,7 +181,7 @@ foreach my $initd_file (keys %initd_postinst) {
# Check if file exists in package and check the script for other issues if
# it was included in the package.
if (-f $initd_path) {
- check_init ($initd_file, $initd_path);
+ check_init ($initd_file, $initd_path, $info);
} elsif (not -l $initd_path) {
tag 'init.d-script-not-included-in-package', "etc/init.d/$initd_file";
}
@@ -210,7 +210,7 @@ for my $script (readdir($dirfd)) {
# that we get more complete Lintian coverage in the first pass.
unless ($initd_postinst{$script}) {
tag $tagname, "etc/init.d/$script";
- check_init ($script, $script_path) if -f $script_path;
+ check_init ($script, $script_path, $info) if -f $script_path;
}
}
closedir($dirfd);
@@ -218,7 +218,7 @@ closedir($dirfd);
}
sub check_init {
- my ($initd_file, $initd_path) = @_;
+ my ($initd_file, $initd_path, $info) = @_;
# In an upstart system, such as Ubuntu, init scripts are symlinks to
# upstart-job. It doesn't make sense to check the syntax of upstart-job,
@@ -290,6 +290,13 @@ sub check_init {
# text and the arguments to echo, etc.
$needs_fs{'remote'} = 1 if ($l =~ m,^[^\#]*/usr/,);
$needs_fs{'local'} = 1 if ($l =~ m,^[^\#]*/var/,);
+
+ # /lib/init/* scripts are only for use by init
+ unless ($info->field('package') eq 'initscripts') {
+ if ($l =~ m,^[^\#]*/lib/init/,) {
+ tag 'init.d-script-call-internal-API';
+ }
+ }
while ($l =~ s/^[^\#]*?(start|stop|restart|force-reload|status)//o) {
$tag{$1} = 1;
diff --git a/checks/init.d.desc b/checks/init.d.desc
index 84a8c7a..c66c2db 100644
--- a/checks/init.d.desc
+++ b/checks/init.d.desc
@@ -366,3 +366,12 @@ Info: The given init script declares a dependency on a virtual facility
If the dependency can not be satisfied upon the package's
installation, insserv will refuse the activation of the init.d script.
Ref: http://wiki.debian.org/LSBInitScripts
+
+Tag: init.d-script-call-internal-API
+Severity: normal
+Certainty: possible
+Info: The given init script call an internal API under /lib/init.
+ /lib/init/rw has gone away, and the scripts in /lib/init/*.sh represent
+ internal implementation details of initscripts, *not* public API for
+ other packages to use. Nonetheless, some packages incorrectly reference
+ those scripts, notably /lib/init/vars.sh.
\ No newline at end of file
--
1.7.10.4
Reply to: