ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
594167
From 2a11a51491d3113f8d198c7d30ead8b555e60a61 Mon Sep 17 00:00:00 2001
594167
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
594167
Date: Tue, 15 Mar 2022 17:45:34 +0100
594167
Subject: [PATCH] test-systemctl-enable: enhance the test for unit file linking
594167
594167
Current behaviour is wrong, but it cannot be shown in this test, because we
594167
don't have a running systemd instance here.
594167
594167
(cherry picked from commit 85516075a24fd2f1316575570d7d5f5a37f43dbd)
594167
594167
Related: #2082131
594167
---
594167
 test/test-systemctl-enable.sh | 39 ++++++++++++++++++++++++++++++++---
594167
 1 file changed, 36 insertions(+), 3 deletions(-)
594167
594167
diff --git a/test/test-systemctl-enable.sh b/test/test-systemctl-enable.sh
594167
index 0a0123b9d7..220ebfdab7 100644
594167
--- a/test/test-systemctl-enable.sh
594167
+++ b/test/test-systemctl-enable.sh
594167
@@ -401,7 +401,7 @@ test ! -h "$root/etc/systemd/system/link4.service"
594167
 test ! -h "$root/etc/systemd/system/link4alias.service"
594167
 test ! -h "$root/etc/systemd/system/link4alias2.service"
594167
 
594167
-: -------issue 661: link and enable on unit file--------------
594167
+: -------issue 661: enable on unit file--------------
594167
 test ! -e "$root/etc/systemd/system/link5.service"
594167
 cat >"$root/etc/systemd/system/link5.service" <
594167
 [Install]
594167
@@ -412,8 +412,6 @@ EOF
594167
 
594167
 "$systemctl" --root="$root" enable 'link5.service'
594167
 test ! -h "$root/etc/systemd/system/link5.service"  # this is our file
594167
-# FIXME/CLARIFYME: will systemd think that link5alias2, link5alias, link5 are all aliases?
594167
-# https://github.com/systemd/systemd/issues/661#issuecomment-1057931149
594167
 islink "$root/etc/systemd/system/link5alias.service" "/etc/systemd/system/link5.service"
594167
 islink "$root/etc/systemd/system/link5alias2.service" "/etc/systemd/system/link5.service"
594167
 
594167
@@ -421,6 +419,41 @@ islink "$root/etc/systemd/system/link5alias2.service" "/etc/systemd/system/link5
594167
 test ! -h "$root/etc/systemd/system/link5alias.service"
594167
 test ! -h "$root/etc/systemd/system/link5alias2.service"
594167
 
594167
+: -------issue 661: link and enable on unit file--------------
594167
+test ! -e "$root/etc/systemd/system/link5copy.service"
594167
+cat >"$root/link5copy.service" <
594167
+[Install]
594167
+Alias=link5copy.service
594167
+Alias=link5alias.service
594167
+Alias=link5alias2.service
594167
+EOF
594167
+
594167
+test ! -e "$root/etc/systemd/system/link5copy.service"
594167
+
594167
+"$systemctl" --root="$root" link '/link5copy.service'
594167
+islink "$root/etc/systemd/system/link5copy.service" '/link5copy.service'
594167
+test ! -h "$root/etc/systemd/system/link5alias.service"
594167
+test ! -h "$root/etc/systemd/system/link5alias2.service"
594167
+
594167
+# FIXME: we must create link5alias2 and link5alias as relative links to link5.service
594167
+# When they are independent links to /link5.service, systemd doesn't know that
594167
+# they are aliases, because we do not follow symlinks outside of the search paths.
594167
+
594167
+"$systemctl" --root="$root" disable 'link5copy.service'
594167
+test ! -h "$root/etc/systemd/system/link5copy.service"
594167
+test ! -h "$root/etc/systemd/system/link5alias.service"
594167
+test ! -h "$root/etc/systemd/system/link5alias2.service"
594167
+
594167
+"$systemctl" --root="$root" enable '/link5copy.service'
594167
+islink "$root/etc/systemd/system/link5copy.service" '/link5copy.service'
594167
+islink "$root/etc/systemd/system/link5alias.service" '/link5copy.service'
594167
+islink "$root/etc/systemd/system/link5alias2.service" '/link5copy.service'
594167
+
594167
+"$systemctl" --root="$root" disable 'link5copy.service'
594167
+test ! -h "$root/etc/systemd/system/link5copy.service"
594167
+test ! -h "$root/etc/systemd/system/link5alias.service"
594167
+test ! -h "$root/etc/systemd/system/link5alias2.service"
594167
+
594167
 : ----issue 19437: plain templates in .wants/ or .requires/---
594167
 test ! -e "$root/etc/systemd/system/link5@.path"
594167
 cat >"$root/etc/systemd/system/link5@.path" <