1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-19 22:50:17 +03:00

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-03-02 16:53:54 +01:00
parent 0c003e8305
commit 212a24f0bb

View File

@ -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;