]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test-systemctl-enable: enhance the test for unit file linking
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 15 Mar 2022 16:45:34 +0000 (17:45 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 29 Mar 2022 14:17:56 +0000 (16:17 +0200)
Current behaviour is wrong, but it cannot be shown in this test, because we
don't have a running systemd instance here.

test/test-systemctl-enable.sh

index 0a0123b9d77c932edf7b64ad9b093d27e825c4ce..220ebfdab75abfb8f7e95547741aed87ab6beee9 100644 (file)
@@ -401,7 +401,7 @@ test ! -h "$root/etc/systemd/system/link4.service"
 test ! -h "$root/etc/systemd/system/link4alias.service"
 test ! -h "$root/etc/systemd/system/link4alias2.service"
 
-: -------issue 661: link and enable on unit file--------------
+: -------issue 661: enable on unit file--------------
 test ! -e "$root/etc/systemd/system/link5.service"
 cat >"$root/etc/systemd/system/link5.service" <<EOF
 [Install]
@@ -412,8 +412,6 @@ EOF
 
 "$systemctl" --root="$root" enable 'link5.service'
 test ! -h "$root/etc/systemd/system/link5.service"  # this is our file
-# FIXME/CLARIFYME: will systemd think that link5alias2, link5alias, link5 are all aliases?
-# https://github.com/systemd/systemd/issues/661#issuecomment-1057931149
 islink "$root/etc/systemd/system/link5alias.service" "/etc/systemd/system/link5.service"
 islink "$root/etc/systemd/system/link5alias2.service" "/etc/systemd/system/link5.service"
 
@@ -421,6 +419,41 @@ islink "$root/etc/systemd/system/link5alias2.service" "/etc/systemd/system/link5
 test ! -h "$root/etc/systemd/system/link5alias.service"
 test ! -h "$root/etc/systemd/system/link5alias2.service"
 
+: -------issue 661: link and enable on unit file--------------
+test ! -e "$root/etc/systemd/system/link5copy.service"
+cat >"$root/link5copy.service" <<EOF
+[Install]
+Alias=link5copy.service
+Alias=link5alias.service
+Alias=link5alias2.service
+EOF
+
+test ! -e "$root/etc/systemd/system/link5copy.service"
+
+"$systemctl" --root="$root" link '/link5copy.service'
+islink "$root/etc/systemd/system/link5copy.service" '/link5copy.service'
+test ! -h "$root/etc/systemd/system/link5alias.service"
+test ! -h "$root/etc/systemd/system/link5alias2.service"
+
+# FIXME: we must create link5alias2 and link5alias as relative links to link5.service
+# When they are independent links to /link5.service, systemd doesn't know that
+# they are aliases, because we do not follow symlinks outside of the search paths.
+
+"$systemctl" --root="$root" disable 'link5copy.service'
+test ! -h "$root/etc/systemd/system/link5copy.service"
+test ! -h "$root/etc/systemd/system/link5alias.service"
+test ! -h "$root/etc/systemd/system/link5alias2.service"
+
+"$systemctl" --root="$root" enable '/link5copy.service'
+islink "$root/etc/systemd/system/link5copy.service" '/link5copy.service'
+islink "$root/etc/systemd/system/link5alias.service" '/link5copy.service'
+islink "$root/etc/systemd/system/link5alias2.service" '/link5copy.service'
+
+"$systemctl" --root="$root" disable 'link5copy.service'
+test ! -h "$root/etc/systemd/system/link5copy.service"
+test ! -h "$root/etc/systemd/system/link5alias.service"
+test ! -h "$root/etc/systemd/system/link5alias2.service"
+
 : ----issue 19437: plain templates in .wants/ or .requires/---
 test ! -e "$root/etc/systemd/system/link5@.path"
 cat >"$root/etc/systemd/system/link5@.path" <<EOF