Bug#780522: init-system-helpers: deb-systemd-helper doesn't handle drop-ins and is inconsistent w/ systemd w.r.t. lists

Christian Seiler christian at iwakd.de
Sun Mar 15 14:23:38 GMT 2015


Package: init-system-helpers
Version: 1.22
Severity: important
Tags: patch

Dear Maintainers,

deb-systemd-helper doesn't handle drop-ins at all (only the main
service file is parsed) and it doesn't treat lists properly: when
creating links for Alias=, it doesn't properly treat multiple entries
in the same line ($1 instead of $_ used), when removing links for
Also=, it assumes that there's only ever one entry per line, and it
doesn't support systemd's syntax to reset a list to empty (which native
systemd supports for the [Install] section entries).

Thus, a lot of possibilities for the administrator to customize unit
files are lost on Debian. Also, if there are units in Debian that
contain Alias=a.service b.service or Also=a.service b.service in one
line (instead of two separate entries), those also won't work properly.
(I haven't checked.)

I've attached a patch that fixes these issues: a new function to parse
the unit file + all drop-ins is added (parse_install_sections), which
handles list resets and multiple entries properly. This function is
then used everywhere where this information is needed.

Note that the patch follows systemd's logic completely by also looking
at the output directory of generators. This obviously will produce
different results if things in those directories contain these types of
settings and you compare executing this on a true system vs. a chroot
vs. the same systemd w/ sysvinit running, so it may be debatable as to
whether you'd want to include this or not. But upstream systemd
enable/disable will read that and will have the same issue. (i.e.
behaving differently in chroots if a drop-in in /run has an [Install]
section.) I don't mind much either way - if you don't like looking at
/run, remove the lines from @unit_paths.

Also, while I've tested this to some extent, I haven't done extensive
stress testing of these changes. I'm fairly certain it's correct the
way it is, but I have to admit I'm not a Perl guy, so you should
double-check this. I HAVE diverted deb-systemd-helper on my system
now and replaced it with this, so I'll hopefully notice mistakes.

Christian

-- System Information:
Debian Release: 8.0
   APT prefers testing
   APT policy: (500, 'testing'), (100, 'experimental'), (100, 
'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-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/bash
Init: systemd (via /run/systemd/system)

Versions of packages init-system-helpers depends on:
ii  perl-base  5.20.2-2

init-system-helpers recommends no packages.

init-system-helpers suggests no packages.

-- no debconf information
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: properly-handle-dropins-and-lists.patch
URL: <http://lists.alioth.debian.org/pipermail/pkg-systemd-maintainers/attachments/20150315/79fc46ea/attachment.ksh>


More information about the Pkg-systemd-maintainers mailing list