--- Begin Message ---
- To: Debian Bug Tracking System <submit@bugs.debian.org>
- Subject: systemd.pm: does not correctly pair .sh-suffixed init scripts with non-.sh native units
- From: Felipe Sateler <fsateler@debian.org>
- Date: Wed, 23 Mar 2016 12:16:03 -0300
- Message-id: <145874616367.12882.5961836804840874753.reportbug@felipepc>
Package: lintian
Version: 2.5.42.1
Severity: normal
Tags: patch
Hi,
The patchset in #790323 was incomplete, in that the .sh suffix of some
init scripts was not always removed when deciding that the init script
is matched by a native systemd unit.
Please find attached a small patch that corrects the issue, with test.
-- System Information:
Debian Release: stretch/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.4.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages lintian depends on:
ii binutils 2.26-8
ii bzip2 1.0.6-8
ii diffstat 1.61-1
ii file 1:5.25-2
ii gettext 0.19.7-2
ii hardening-includes 2.8+nmu2
ii intltool-debian 0.35.0+20060710.4
ii libapt-pkg-perl 0.1.29+b5
ii libarchive-zip-perl 1.56-2
ii libclass-accessor-perl 0.34-1
ii libclone-perl 0.38-1+b1
ii libdata-alias-perl 1.20-1+b1
ii libdpkg-perl 1.18.4
ii libemail-valid-perl 1.198-1
ii libfile-basedir-perl 0.07-1
ii libipc-run-perl 0.94-1
ii liblist-moreutils-perl 0.413-1+b1
ii libparse-debianchangelog-perl 1.2.0-8
ii libperl5.22 [libdigest-sha-perl] 5.22.1-9
ii libtext-levenshtein-perl 0.13-1
ii libtimedate-perl 2.3000-2
ii liburi-perl 1.71-1
ii libyaml-libyaml-perl 0.41-6+b1
ii man-db 2.7.5-1
ii patchutils 0.3.4-1
ii perl 5.22.1-9
ii t1utils 1.39-2
ii xz-utils 5.1.1alpha+20120614-2.1
Versions of packages lintian recommends:
ii dpkg 1.18.4
ii libautodie-perl 2.29-2
ii libperlio-gzip-perl 0.19-1+b1
ii perl 5.22.1-9
ii perl-modules-5.22 [libautodie-perl] 5.22.1-9
Versions of packages lintian suggests:
ii binutils-multiarch 2.26-8
ii dpkg-dev 1.18.4
ii libhtml-parser-perl 3.72-1
ii libtext-template-perl 1.46-1
-- no debconf information
-- debsums errors found:
debsums: changed file /usr/share/lintian/checks/systemd.pm (from lintian package)
>From 2ecf75da8f41cbf9ad5813aefdf7c3a0054d3b9d Mon Sep 17 00:00:00 2001
From: Felipe Sateler <fsateler@debian.org>
Date: Wed, 23 Mar 2016 12:11:43 -0300
Subject: [PATCH] systemd.pm: Properly remove .sh suffix when checking
systemd-initscript matching
---
checks/systemd.pm | 16 +++++++++----
t/tests/systemd-general/debian/debian/install | 1 +
t/tests/systemd-general/debian/debian/rules | 1 +
.../systemd-general/debian/debian/sourced.service | 9 ++++++++
.../systemd-general/debian/debian/sourced.sh.init | 27 ++++++++++++++++++++++
5 files changed, 50 insertions(+), 4 deletions(-)
create mode 100644 t/tests/systemd-general/debian/debian/sourced.service
create mode 100644 t/tests/systemd-general/debian/debian/sourced.sh.init
diff --git a/checks/systemd.pm b/checks/systemd.pm
index 69092be..face504 100644
--- a/checks/systemd.pm
+++ b/checks/systemd.pm
@@ -66,14 +66,21 @@ sub run {
return;
}
+sub get_init_service_name {
+ my ($file) = @_;
+ my $basename = $file->basename;
+ # sysv generator drops the .sh suffix
+ $basename =~ s/\.sh$//;
+ return $basename;
+}
+
sub get_init_scripts {
my ($info) = @_;
my @scripts;
if (my $initd_path = $info->index_resolved_path('etc/init.d/')) {
for my $init_script ($initd_path->children) {
# sysv generator drops the .sh suffix
- my $basename = $init_script->basename;
- $basename =~ s/\.sh$//;
+ my $basename = get_init_service_name($init_script);
next if $INIT_WHITELIST->known($basename);
next
if $init_script->is_symlink
@@ -90,6 +97,7 @@ sub get_init_scripts {
sub check_init_script {
my ($info, $file, $services) = @_;
my $basename = $file->basename;
+ my $servicename = get_init_service_name($file);
my $lsb_source_seen;
my $is_rcs_script = 0;
@@ -121,12 +129,12 @@ sub check_init_script {
# Only tag if the maintainer of this package did any effort to
# make the package work with systemd.
tag 'systemd-no-service-for-init-script', $basename
- if (%{$services} and not $services->{$basename});
+ if (%{$services} and not $services->{$servicename});
# rcS scripts are particularly bad, warn even if there is
# no systemd integration
tag 'systemd-no-service-for-init-rcS-script', $basename
- if (not $services->{$basename} and $is_rcs_script);
+ if (not $services->{$servicename} and $is_rcs_script);
return;
}
diff --git a/t/tests/systemd-general/debian/debian/install b/t/tests/systemd-general/debian/debian/install
index 56cf085..3ed93ab 100644
--- a/t/tests/systemd-general/debian/debian/install
+++ b/t/tests/systemd-general/debian/debian/install
@@ -1,3 +1,4 @@
debian/test.service etc/systemd/system/
debian/test.service usr/lib/systemd/system/
+debian/sourced.service lib/systemd/system/
debian/test.conf etc/tmpfiles.d/
diff --git a/t/tests/systemd-general/debian/debian/rules b/t/tests/systemd-general/debian/debian/rules
index fade512..47cdf51 100644
--- a/t/tests/systemd-general/debian/debian/rules
+++ b/t/tests/systemd-general/debian/debian/rules
@@ -23,3 +23,4 @@ override_dh_fixperms:
override_dh_installinit:
dh_installinit
dh_installinit --name systemd-aliasd
+ dh_installinit --name sourced.sh
diff --git a/t/tests/systemd-general/debian/debian/sourced.service b/t/tests/systemd-general/debian/debian/sourced.service
new file mode 100644
index 0000000..3fdee38
--- /dev/null
+++ b/t/tests/systemd-general/debian/debian/sourced.service
@@ -0,0 +1,9 @@
+[Unit]
+After=network.target
+Documentation=man:sourced(1)
+
+[Service]
+ExecStart=/usr/bin/test
+
+[Install]
+WantedBy=multi-user.target
diff --git a/t/tests/systemd-general/debian/debian/sourced.sh.init b/t/tests/systemd-general/debian/debian/sourced.sh.init
new file mode 100644
index 0000000..c7fb722
--- /dev/null
+++ b/t/tests/systemd-general/debian/debian/sourced.sh.init
@@ -0,0 +1,27 @@
+#!/bin/sh
+# kFreeBSD do not accept scripts as interpreters, using #!/bin/sh and sourcing.
+if [ true != "$INIT_D_SCRIPT_SOURCED" ] ; then
+ set "$0" "$@"; INIT_D_SCRIPT_SOURCED=true . /lib/init/init-d-script
+fi
+### BEGIN INIT INFO
+# Provides: sourced
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Example initscript
+# Description: This file should be used to construct scripts to be
+# placed in /etc/init.d. This example start a
+# single forking daemon capable of writing a pid
+# file. To get other behavoirs, implemend
+# do_start(), do_stop() or other functions to
+# override the defaults in /lib/init/init-d-script.
+### END INIT INFO
+
+# Author: Foo Bar <foobar@baz.org>
+#
+# Please remove the "Author" lines above and replace them
+# with your own name if you copy and modify this script.
+
+DESC="Description of the service"
+DAEMON=/usr/sbin/daemonexecutablename
--
2.8.0.rc3
--- End Message ---
--- Begin Message ---
Source: lintian
Source-Version: 2.5.43
We believe that the bug you reported is fixed in the latest version of
lintian, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to 819087@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Niels Thykier <niels@thykier.net> (supplier of updated lintian package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Format: 1.8
Date: Sun, 03 Apr 2016 09:01:08 +0000
Source: lintian
Binary: lintian
Architecture: source
Version: 2.5.43
Distribution: unstable
Urgency: medium
Maintainer: Debian Lintian Maintainers <lintian-maint@debian.org>
Changed-By: Niels Thykier <niels@thykier.net>
Description:
lintian - Debian package checker
Closes: 818003 819087 819506 819551
Changes:
lintian (2.5.43) unstable; urgency=medium
.
* Summary of tag changes:
+ Added:
- maybe-not-arch-all-binnmuable
+ Removed:
- dh_desktop-is-deprecated
- dh_undocumented-is-obsolete
- restriction-formula-with-debhelper-with-conflicting-version
- restriction-formula-with-versioned-dpkg-dev-conflict
.
* checks/{control-file,fields}.{desc,pm}:
+ [JW] Remove confusing checks for build-conflicts related to build
profiles.
* checks/debhelper.{desc,pm}:
+ [NT] Remove check for dh_undocumented and dh_desktop as debhelper
has dropped the helper.
* checks/systemd.pm:
+ [JW] Apply patch from Felipe Sateler to properly remove .sh suffix
when checking systemd-initscript matching. (Closes: #819087)
* checks/version-substvars.{desc,pm}:
+ [NT] Add an experimental tag to check for arch:all
binNMUability. This is currently not supported at all
and there is no known fix for the tag. That said, it
is still useful for determining how many packages might
be affected by it in case Debian will support arch:all
binNMUs.
.
* commands/reporting-sync-state.pm:
+ [NT] Use the sha256 instead of the sha1 checksum field
for finding related files and checking which members
have changed.
+ [NT] Support reading Packages.xz and Sources.xz files.
.
* data/spelling/corrections:
+ [JW] Add more corrections.
Thanks to Mattia Rizzolo for suggesting one of them.
.
* frontend/dplint:
+ [NT] Put $LINTIAN_VERSION on its own line so the build
time substitution works again. Thanks to Stuart
Prescott for reporting the issue.
.
* helpers/coll/objdump-info-helper:
+ [JW] Apply patch from Dan Nicholson to keep TEXTREL entries from the
dynamic section. (Closes: #819506)
.
* lib/Lintian/Check.pm:
+ [JW,ADB] Don't ignore midword punctuation characters when
spell-checking. (Closes: #818003) Thanks to Andreas Beckmann for
the bug report.
.
* t/tests/binaries-missing-depends-on-libc/debian/debian/rules:
+ [JW] Apply patch from Dan Nicholson to pass --no-as-needed to the
linker. (Closes: #819551)
Checksums-Sha1:
1afe43be1ac24ed90a17aebeb39ae893a7a5ec4c 2809 lintian_2.5.43.dsc
f8820aed508a6fedd1cb659718040248ae285a62 1295136 lintian_2.5.43.tar.xz
Checksums-Sha256:
f528289c00c86fc345b3fdc987cf88e08367efb938491d78441a710dc1ab4962 2809 lintian_2.5.43.dsc
23442a67f9d6484f49c0b86050cd2c240eefe5417c1d29684b28ad39c1919c6f 1295136 lintian_2.5.43.tar.xz
Files:
58ac86c7e636534559dbcdac349b5efa 2809 devel optional lintian_2.5.43.dsc
f28dab606192f5748b3896d621a55881 1295136 devel optional lintian_2.5.43.tar.xz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBCAAGBQJXAON7AAoJEAVLu599gGRCih4QAKGerKkionuBIi9ci5C+IR3w
h6vanmKvhYe6jxNaYcWN6Xjp0b1hs/XFuxgE5tIlVk5qzVasnjKBL28GuEYVePea
YvmQvb7hzSeKKX2PZoVCzB6nM/k+UjnT1nhSz6IKuzon4lFOB7SjnXVp+CNAcp93
wTYrw+3DS5xUXiACiQVZuBHbjC4ZFBzdOxBe97+js5OEP4A+HJexKcXNp7qqXLJA
tI81xZGXomnhmH1ApsD1AYi9iO3tQQW4w5lu7VyoJllSIcBJXDcNAWVmB7Hxvcec
g5cuCG4t4a1K1xtxg3ZfcusUv7wxe1Hpf7NtdOSMh2iGdTLYERyxbWnEvogW/mZD
GklhUt+SqcsggbZOmiaOQmpztNdMZyuGsnTxQo0CkDYwl1hxgly1+HrgQsQze8wq
1o7MGUJcp69K/BbL1c3jSrdtthGIZKq+2jBxW6xpGHL5DQZr4BeJsmeCQp6wGnMn
bam/7+BxWKprAfeZmCh9UQL93vjlyhUX3HoU9d/AEB5Ypd5q/eF5BhbckH2/kR9X
47MR5pnXhPoZJcj3svWaMnyrOoTfEyfo+y/uYX3Ax/4S3gT1ilsaCxNC8prHE8xN
Lnh/UopPZ1duJF7TLZu3Zll43/PqGcERbnracFoHyskRSlshKAyM5q0Wo+1lIWYd
V8ZCYpJMg9ZT4C0As0oc
=I2hB
-----END PGP SIGNATURE-----
--- End Message ---