Package: debhelper
Version: 13.5.1
Severity: normal
X-Debbugs-Cc: ni...@thykier.net

Dear Maintainer,

First let me give a bit of context:

I was putting some work on the docker.io package. Right now docker.io
depends on needrestart, so it's not affected by this bug. However I
was working on removing the needrestart dependency, hence making it a
"normal package", with regard to restarting the docker daemon when the
package is upgraded.

So I removed needrestart from the docker.io Depends, I rebuilt the
package, and installed it again and again, to check whether the daemon
was restarted during the package re-installation.

And I was surprised to see that yes, dockerd was restarted all the time.
However the debian/rules for docker.io explicitly states that it should
not:

  override_dh_installsystemd:
    dh_installsystemd -v --name=docker --no-stop-on-upgrade 
--no-restart-after-upgrade

The man page of dh_installsystemd says:

  --no-stop-on-upgrade
    Do not stop service on upgrade. This has the side-effect of not
    restarting the service as a part of the upgrade.

So if I understand properly, this is a bug.

We can see which postinst snippets are installed during the build of the
package in eg. [1], I'll reproduce it here for convenience:

    dh_installsystemd -v --name=docker --no-stop-on-upgrade 
--no-restart-after-upgrade
        install -d debian/docker.io/lib/systemd/system
        install -p -m0644 debian/docker.io.docker.service 
debian/docker.io/lib/systemd/system/docker.service
        install -p -m0644 debian/docker.io.docker.socket 
debian/docker.io/lib/systemd/system/docker.socket
        [META] Append autosnippet "postinst-systemd-enable" to postinst 
[debian/.debhelper/generated/docker.io/postinst.service]
        [META] Append autosnippet "postinst-systemd-enable" to postinst 
[debian/.debhelper/generated/docker.io/postinst.service]
        [META] Prepend autosnippet "postrm-systemd" to postrm 
[debian/docker.io.postrm.debhelper.new]
        mv debian/docker.io.postrm.debhelper.new 
debian/docker.io.postrm.debhelper
        [META] Append autosnippet "postinst-systemd-start" to postinst 
[debian/.debhelper/generated/docker.io/postinst.service]
        [META] Prepend autosnippet "prerm-systemd-restart" to prerm 
[debian/.debhelper/generated/docker.io/prerm.service.new]
        mv debian/.debhelper/generated/docker.io/prerm.service.new 
debian/.debhelper/generated/docker.io/prerm.service
        [META] Prepend autosnippet "postrm-systemd-reload-only" to postrm 
[debian/docker.io.postrm.debhelper.new]
        mv debian/docker.io.postrm.debhelper.new 
debian/docker.io.postrm.debhelper

Looking at the snippet postinst-systemd-start, we can see that what it
does is actually "deb-systemd-invoke restart". I believe this is the
problem, it should be "start" instead.

And indeed, it used to be start, and was changed to restart very
recently (Jul 11th), in this commit:
https://salsa.debian.org/debian/debhelper/-/commit/6067bc2

I don't really know what's the proper fix here, since this commit was
not trivial, and just changing it back to "start" might (or might not)
break something else.

Cheers,

  Arnaud


-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-8-amd64 (SMP w/8 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages debhelper depends on:
ii  autotools-dev            20180224.1+nmu1
ii  dh-autoreconf            20
ii  dh-strip-nondeterminism  1.12.0-1
ii  dpkg                     1.20.9
ii  dpkg-dev                 1.20.9
ii  dwz                      0.14-1
ii  file                     1:5.39-3
ii  libdebhelper-perl        13.5.1
ii  libdpkg-perl             1.20.9
ii  man-db                   2.9.4-2
ii  perl                     5.32.1-5
ii  po-debconf               1.0.21+nmu1

debhelper recommends no packages.

Versions of packages debhelper suggests:
ii  dh-make  2.202101

-- no debconf information

Reply via email to