From: Zbigniew Jędrzejewski-Szmek Date: Wed, 2 Mar 2022 15:53:54 +0000 (+0100) Subject: shared/install: when we fail to chase a symlink, show some logs X-Git-Tag: v251-rc1~3^2~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=212a24f0bbe4c54183d3b0ad9579a995007e29a8;p=thirdparty%2Fsystemd.git 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. --- diff --git a/src/shared/install.c b/src/shared/install.c index a4c4be16b37..d20372cfd9c 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -615,6 +615,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;