[2019-07-14 17:59] Niels Thykier <ni...@thykier.net>
> > debhelper 12.2 fixes #462389 and makes dh_installinit fail when the
> > --name'd init script does not exist. This behaviour change makes at
> > least openssh and util-linux FTBFS. These are two high popcon example
> > packages. I expect more.
> > [...]
> > 
> > It is unclear to me whether it can be fixed in debhelper at all. Yet I
> > am filing the bug to have something recorded. If you determine that this
> > should be fixed in the individual packages, please clone and reassign.
> > 
> > Helmut
> > 
>
> Hi Dmitry,
>
> This report seems to be a regression related to your patch from #462389.

Definitely regression.

From a7288f30a003759b186389b93d336bef90491062 Mon Sep 17 00:00:00 2001
From: Dmitry Bogatov <kact...@debian.org>
Date: Mon, 15 Jul 2019 16:08:01 +0000
Subject: [PATCH] Fix logic error in --name sanity check

Commit [e5fc959e], resolving #462389 changed behaviour of `--name' option of
dh_installinit. Before this change, if `debian/{package}.{name}.init' is 
missing,
this option was silently ignored. This change made it error.

This change was incorrect, since it demanded presence of 
`debian/{package}.{name}.init'
file for /every/ binary package.

This commit instead throws error only if `debian/{package}.{name}.init' does
not exist for /all/ binary {package} names. Regression test is added.

Closes: #932073
---
 dh_installinit                         | 10 ++++++----
 t/dh_installinit/debian/bar.other.init |  4 ++++
 t/dh_installinit/dh_installinit.t      |  2 ++
 3 files changed, 12 insertions(+), 4 deletions(-)
 create mode 100644 t/dh_installinit/debian/bar.other.init

diff --git a/dh_installinit b/dh_installinit
index 6a490370..cd038af1 100755
--- a/dh_installinit
+++ b/dh_installinit
@@ -232,6 +232,12 @@ init(options => {
 
 my %snippet_options = ('snippet-order' => 'service');
 
+if (my $name = $dh{NAME}) {
+       if (!grep { -f "debian/$_.${name}.init" } @{$dh{DOPACKAGES}}) {
+               error("--name=$dh{NAME} option specified, but init script not 
found");
+       }
+}
+
 foreach my $package (@{$dh{DOPACKAGES}}) {
        my $tmp=tmpdir($package);
 
@@ -311,10 +317,6 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
        my $init=pkgfile($package,$scriptsrc) || pkgfile($package,"init") ||
                pkgfile($package,"init.d");
 
-       if (!$init && defined $dh{NAME}) {
-               error("--name=$dh{NAME} option specified, but init script not 
found");
-       }
-
        if ($init ne '' && ! $dh{ONLYSCRIPTS}) {
                install_dir("$tmp/etc/init.d");
                install_prog($init,"$tmp/etc/init.d/$script");
diff --git a/t/dh_installinit/debian/bar.other.init 
b/t/dh_installinit/debian/bar.other.init
new file mode 100644
index 00000000..ea948c58
--- /dev/null
+++ b/t/dh_installinit/debian/bar.other.init
@@ -0,0 +1,4 @@
+#!/bin/sh
+cat << 'EOF'
+I am init script to be installed into package "bar" into /etc/init.d/other 
path.
+EOF
\ No newline at end of file
diff --git a/t/dh_installinit/dh_installinit.t 
b/t/dh_installinit/dh_installinit.t
index afe3821f..3b6bc038 100755
--- a/t/dh_installinit/dh_installinit.t
+++ b/t/dh_installinit/dh_installinit.t
@@ -12,6 +12,7 @@ our @TEST_DH_EXTRA_TEMPLATE_FILES = (qw(
     debian/changelog
     debian/control
     debian/foo.service
+    debian/bar.other.init
 ));
 
 plan(tests => 2);
@@ -30,6 +31,7 @@ each_compat_from_and_above_subtest(11, sub {
 
        ok(run_dh_tool('dh_installinit'));
        ok(! run_dh_tool({'quiet' => 1}, 'dh_installinit', '--name=missing'));
+       ok(  run_dh_tool({'queit' => 1}, 'dh_installinit', '--name=other'));
        ok(! -e "debian/foo/lib/systemd/system/foo.service");
        ok(!find_script('foo', 'postinst'));
        ok(run_dh_tool('dh_clean'));


-- 
Note, that I send and fetch email in batch, once in a few days.
Please, mention in body of your reply when you add or remove recepients.

Reply via email to