[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#832771: lintian: c/systemd: Warn about .service files with a missing WantedBy target



On Thu, 28 Jul 2016 20:48:40 +0200 Chris Lamb <lamby@debian.org> wrote:
> Hi,
>
> > lintian: c/systemd: Warn about .service files with a missing WantedBy target
>
> Updated patch attached, dropping "Certainty: certain".
>
> (This was a mistake. The idea is that 99% of the time its a mistake to
> omit a WantedBy target. ie. if you don't want such a target, then you
> explicitly document that in your package by adding a Lintian override.)

Unfortunately, this is not quite true. Units can also be started by:

- paths
- timers
- sockets
- dbus
- udev

Moreover, a bunch of units are enabled statically. This means the
wants/requires symlink is shipped directly in the package (because it
makes no sense to disable), and thus the Install key is not useful.

Looking at the list of generated results[1], the large majority look
like false positives :(. There are even the static enabled symlinks
listed.

At the very least, the following should be filtered:

1. Skip where not a regular file
2. Skip if there is a link pointing to this file
3. Skip all the services referenced by a socket (the same name, or the
value of the Service= key)
4. Same for timers (there is no Service= key here)
5. Same for paths (the same name, or the value specified by the Unit= key)
6. Skip if there is a dbus service that matches the BusName of a unit
(ie, /usr/share/dbus-1/system-services/${name}.service), and it
contains a SystemdService= key

Unfortunately udev-activated files are the hardest to detect. grepping
the rules for SYSTEMD_WANTS.*="${servicename}.service" seems a bit
error prone...

Maybe this check should have a lower certainty.

[1] https://lintian.debian.org/tags/systemd-service-file-missing-install-key.html

Saludos


Reply to: