Bug#932073: dh_installinit fails with "--name=foo option specified, but init script not found"

2019-07-16 Thread Dmitry Bogatov


[2019-07-14 17:59] Niels Thykier 
> > 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 
Date: Mon, 15 Jul 2019 16:08:01 +
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 ..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.



Bug#932073: dh_installinit fails with "--name=foo option specified, but init script not found"

2019-07-15 Thread Christoph Berg
Re: To Helmut Grohne 2019-07-15 <20190715122334.ga27...@msg.df7cb.de>
> postgresql-common is also affected, and afaict the package is playing
> by the rules:
> 
> override_dh_installinit:
> dh_installinit --name=postgresql -u'defaults 19 21' -r

I just realized I can fix it by adding "-ppostgresql-common" (there
are other binaries built from the source, but this is the only init
script).

But it seems pretty silly to practically always require "-p" with
"--name". I could just use "-p" only in that case. Please rethink the
logic not to fail if there is at least one debian/package.name.init
file.

Christoph



Bug#932073: dh_installinit fails with "--name=foo option specified, but init script not found"

2019-07-15 Thread Christoph Berg
Control: affects 932073 src:postgresql-common

postgresql-common is also affected, and afaict the package is playing
by the rules:

override_dh_installinit:
dh_installinit --name=postgresql -u'defaults 19 21' -r

-rw-rw-r-- 1 cbe cbe 1490 Jan 12  2018 debian/postgresql-common.postgresql.init

   debian/rules override_dh_installinit
make[1]: Verzeichnis „/home/cbe/projects/postgresql/common/postgresql-common“ 
wird betreten
dh_installinit --name=postgresql -u'defaults 19 21' -r
dh_installinit: --name=postgresql option specified, but init script not found
make[1]: *** [debian/rules:33: override_dh_installinit] Fehler 255

Christoph



Processed: Re: Bug#932073: dh_installinit fails with "--name=foo option specified, but init script not found"

2019-07-15 Thread Debian Bug Tracking System
Processing control commands:

> affects 932073 src:postgresql-common
Bug #932073 [debhelper] dh_installinit fails with "--name=foo option specified, 
but init script not found"
Added indication that 932073 affects src:postgresql-common

-- 
462389: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=462389
932073: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=932073
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Processed: Re: Bug#932073: dh_installinit fails with "--name=foo option specified, but init script not found"

2019-07-15 Thread Debian Bug Tracking System
Processing control commands:

> affects 932073 src:postgresql-common
Bug #932073 [debhelper] dh_installinit fails with "--name=foo option specified, 
but init script not found"
Ignoring request to set affects of bug 932073 to the same value previously set

-- 
932073: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=932073
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#932073: dh_installinit fails with "--name=foo option specified, but init script not found"

2019-07-14 Thread Helmut Grohne
Control: affects -1 + src:policycoreutils

On Sun, Jul 14, 2019 at 05:59:00PM +, Niels Thykier wrote:
> Of the two issues spotted:

Please also look into policycoreutils.

Helmut



Processed: Re: Bug#932073: dh_installinit fails with "--name=foo option specified, but init script not found"

2019-07-14 Thread Debian Bug Tracking System
Processing control commands:

> affects -1 + src:policycoreutils
Bug #932073 [debhelper] dh_installinit fails with "--name=foo option specified, 
but init script not found"
Added indication that 932073 affects src:policycoreutils

-- 
932073: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=932073
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#932073: dh_installinit fails with "--name=foo option specified, but init script not found"

2019-07-14 Thread Niels Thykier
Helmut Grohne:
> Package: debhelper
> Version: 12.2
> Severity: serious
> Tags: ftbfs
> Control: affects -1 + src:openssh src:util-linux
> User: helm...@debian.org
> Usertags: rebootstrap
> 
> 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.

Of the two issues spotted:

 * openssh: Could be fixed by having openssh pass -p openssh-server to
   dh_installinit AFAICT (not tested)

 * util-linux: It does something "funky" where I am not really sure what
   the best solution is[1]

Could you please have a look at it?  If you do not have time to look at
it in a short timeframe, then please let me know.  In that case, I will
prefer to revert the patch for now to avoid having breakage for too long.

Thanks,
~Niels

[1]:

from d/rules:
"""
# install /etc/init.d/hwclock.sh
dh_installinit --name=hwclock.sh --no-start
# install /etc/default/hwclock
dh_installinit --name=hwclock
"""

It contains the following related packaging files AFAICT:

debian/util-linux.hwclock.default
debian/util-linux.hwclock.sh.init

Source:
 * https://salsa.debian.org/debian/util-linux/blob/master/debian/rules
 * https://salsa.debian.org/debian/util-linux/tree/master/debian



Bug#932073: dh_installinit fails with "--name=foo option specified, but init script not found"

2019-07-14 Thread Helmut Grohne
Package: debhelper
Version: 12.2
Severity: serious
Tags: ftbfs
Control: affects -1 + src:openssh src:util-linux
User: helm...@debian.org
Usertags: rebootstrap

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