[debhelper-devel] Bug#889635: debhelper: dh_installsystemd fails to set up templated sockets

Daniel Kahn Gillmor dkg at fifthhorseman.net
Mon Feb 5 08:22:57 UTC 2018


Package: debhelper
Version: 11.1.4
Severity: normal

i'm working on packaging knot-resolver 2.0.0.

Upstream has gone with a templated approach to take advantage of
multiple cores.

each daemon can consume a full core, and listens on its own control
socket, and on shared network-facing sockets:

   kresd at .service
   kresd at .socket        (port 53)
   kresd-tls at .socket    (port 853)
   kresd-control at socket (/run/knot-resolver/control@%i)

We ship all of these templates, but we *also* want to start with 1
daemon's sockets enabled (kresd{,-tls,-control}@1.socket, in particular).

i can ship those as symlinks in /lib/systemd/system/, like this:

  2387690      4 drwxr-xr-x   2 dkg      dkg          4096 Feb  5 03:00 lib/systemd/system/
  2384490      4 -rw-r--r--   1 dkg      dkg           281 Feb  5 03:00 lib/systemd/system/kresd-control at .socket
  2384493      0 lrwxrwxrwx   1 dkg      dkg            17 Feb  5 03:00 lib/systemd/system/kresd-tls at 1.socket -> kresd-tls at .socket
  2384488      4 -rw-r--r--   1 dkg      dkg           347 Feb  5 03:00 lib/systemd/system/kresd at .service
  2384489      4 -rw-r--r--   1 dkg      dkg           302 Feb  5 03:00 lib/systemd/system/kresd at .socket
  2384492      0 lrwxrwxrwx   1 dkg      dkg            13 Feb  5 03:00 lib/systemd/system/kresd at 1.socket -> kresd at .socket
  2384491      4 -rw-r--r--   1 dkg      dkg           303 Feb  5 03:00 lib/systemd/system/kresd-tls at .socket
  2384494      0 lrwxrwxrwx   1 dkg      dkg            21 Feb  5 03:00 lib/systemd/system/kresd-control at 1.socket -> kresd-control at .socket

however, dh_installsystemd doesn't recognize the linked files as units
worthy of managing in the maintscripts.

in particular, there's a line in dh_installsystemd that looks like it
ignores symlinks entirely:


		wanted => sub {
			my $name = $File::Find::name;
			return unless -f $name;
			return unless $name =~ m,^\Q${tmpdir}\E/lib/systemd/system/[^/]+$,;
			if (-l) {
				my $target = abs_path(readlink());
				$target =~ s,^\Q${oldcwd}\E/,,g;
				$aliases{$target} = [ $_ ];
			} else {
				push @installed_units, $name;
			}
		},


It's not clear to me what the "if (-l)" is doing there, since there's
a "return unless -f $fname" two lines above it.

could we have dh_installsystemd perform the same management for the
symlinked socket instantiations that it does for other units?

Note that if i list kresd{,-tls,-control}@1.socket on the command line
to dh_installsystemd, i get the following warnings:

dh_installsystemd: Could not find "kresd at 1.socket" in the /lib/systemd/system directory of knot-resolver. This could be a typo, or using Also= with a service file from another package. Please check carefully that this message is harmless.
dh_installsystemd: Could not find "kresd-tls at 1.socket" in the /lib/systemd/system directory of knot-resolver. This could be a typo, or using Also= with a service file from another package. Please check carefully that this message is harmless.
dh_installsystemd: Could not find "kresd-control at 1.socket" in the /lib/systemd/system directory of knot-resolver. This could be a typo, or using Also= with a service file from another package. Please check carefully that this message is harmless.

i do not believe these messages are harmless!

  --dkg


-- System Information:
Debian Release: buster/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing'), (500, 'oldstable'), (200, 'unstable-debug'), (200, 'unstable'), (1, 'experimental-debug'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.14.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages debhelper depends on:
ii  autotools-dev            20171216.1
ii  binutils                 2.29.1-13
ii  dh-autoreconf            16
ii  dh-strip-nondeterminism  0.040-1
ii  dpkg                     1.19.0.5
ii  dpkg-dev                 1.19.0.5
ii  file                     1:5.32-1
ii  libdpkg-perl             1.19.0.5
ii  man-db                   2.7.6.1-4
ii  perl                     5.26.1-4
ii  po-debconf               1.0.20

debhelper recommends no packages.

Versions of packages debhelper suggests:
pn  dh-make  <none>
pn  dwz      <none>

-- no debconf information



More information about the debhelper-devel mailing list