shared/install: when creating symlinks, accept different but equivalent symlinks
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 25 Mar 2022 14:43:27 +0000 (15:43 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 29 Mar 2022 14:17:57 +0000 (16:17 +0200)
commit3fc53351dc8f37355f5a4ee8f922d3e13a5182c2
treea0014aa12ea5b21aced961dbe196039302232594
parent84fdced62c740a3b07656e84747dd721ad6a30c5
shared/install: when creating symlinks, accept different but equivalent symlinks

We would only accept "identical" links, but having e.g. a symlink
/usr/lib/systemd/system/foo-alias.service → /usr/lib/systemd/system/foo.service
when we're trying to create /usr/lib/systemd/system/foo-alias.service →
./foo.service is OK. This fixes an issue found in ubuntuautopkg package
installation, where we'd fail when enabling systemd-resolved.service, because
the existing alias was absolute, and (with the recent patches) we were trying
to create a relative one.

A test is added.
(For .wants/.requires symlinks we were already doing OK. A test is also
added, to verify.)
src/shared/install.c
test/test-systemctl-enable.sh