]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shared/install: when we fail to chase a symlink, show some logs
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 2 Mar 2022 15:53:54 +0000 (16:53 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 29 Mar 2022 14:17:56 +0000 (16:17 +0200)
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.

src/shared/install.c

index a4c4be16b37f39deb025797b001db1b907fbcc5e..d20372cfd9c6a1661b262e83f8ba67e14b6e4c20 100644 (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;