You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
systemd/SOURCES/0188-shared-install-when-we...

42 lines
1.9 KiB

From 144887f20bb2dc9f46060091db03d4f517f1d518 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Wed, 2 Mar 2022 16:53:54 +0100
Subject: [PATCH] shared/install: when we fail to chase a symlink, show some
logs
When chase_symlinks() fails, we'd get the generic error:
Failed to disable: Permission denied.
Let's at least add the failure to changes list, so the user gets
a slightly better message. Ideally, we'd say where exactly the permission
failure occured, but chase_symlinks() is a library level function and I don't
think we should add logging there. The output looks like this now:
Failed to resolve symlink "/tmp/systemctl-test.1r7Roj/etc/systemd/system/link5alias2.service": Permission denied
Failed to resolve symlink "/tmp/systemctl-test.1r7Roj/etc/systemd/system/link5alias.service": Permission denied
Failed to disable unit, file /tmp/systemctl-test.1r7Roj/etc/systemd/system/link5alias2.service: Permission denied.
Failed to disable unit, file /tmp/systemctl-test.1r7Roj/etc/systemd/system/link5alias.service: Permission denied.
(cherry picked from commit 212a24f0bbe4c54183d3b0ad9579a995007e29a8)
Related: #2082131
---
src/shared/install.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/shared/install.c b/src/shared/install.c
index bf11e5bdce..ce045d02be 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -616,6 +616,9 @@ static int remove_marked_symlinks_fd(
if (q == -ENOENT)
continue;
if (q < 0) {
+ log_debug_errno(q, "Failed to resolve symlink \"%s\": %m", p);
+ unit_file_changes_add(changes, n_changes, q, p, NULL);
+
if (r == 0)
r = q;
continue;