[systemd-devel] [PATCH] sysv-generator: Replace Provides: symlinks with real units

Martin Pitt martin.pitt at ubuntu.com
Wed Jan 21 01:46:03 PST 2015

Hello all,

while working on the sysv generator, some more cases came up where the
recently introduced "Provides:" symlink handling [1] causes trouble
[2]. As soon as you have backup files like /etc/init.d/foo.bak, you'll
get a "foo.service -> foo.bak.service" link which prevents the
creation of a real foo.service unit. A similar case can also happen if
one init.d script Provides: the name of another init.d script
(arguably this is at least questionable, but it might happen in
practice -- e. g. /etc/init.d/mariad might very well "Provides: mysql"
as it's kind of a drop-in replacement).

I wrote some more tests which reproduce these failures, and a proposed
patch. It's not exactly nice due to the TOCTOU (which shouldn't cause
any practical problem though, it's just a bit unclean), but I can't
think of a better solution which covers all corner cases.

Details are in the git commit message. Note that this currently adds
two log_debug() statements, so that you can better see what's going on
(and wrong) in the output for test failures. If you don't want to keep
them, I'm fine with dropping them again of course.

Opinions? (Especially from Thomas?)



[1] http://cgit.freedesktop.org/systemd/systemd/commit/?id=b7e7184634d5
[2] https://bugs.debian.org/775404

Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-sysv-generator-Replace-Provides-symlinks-with-real-u.patch
Type: text/x-diff
Size: 6204 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150121/f7a9b59e/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20150121/f7a9b59e/attachment.sig>

More information about the systemd-devel mailing list