dryang / rpms / systemd

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