From 8eb0145e1d4d61a4ca37c9af73590329eaec5435 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 15 Sep 2018 19:43:58 +0200 Subject: [PATCH] systemd: do not pass .wants fragment path to manager_load_unit When loading units, sometimes we'd first encounter a unit from .wants or .requires directory. A typical case would be when multi-user.target.wants/ contains a symlink to some unit. We would prepare to load this unit using /etc/systemd/system/multi-user.target.wants/foo.service as the fragment path. This is always wrong. Instead, let's use NULL as the path and let manager_load_unit() figure out the path on its own. Fixes #9921. path=0x5625ed9b01a0 "/usr/lib/systemd/system/local-fs.target.wants/systemd-remount-fs.service", e=0x0, _ret=0x7ffe64645000) at ../src/core/manager.c:1887 name=0x5625ed9b01ce "systemd-remount-fs.service", path=0x5625ed9b01a0 "/usr/lib/systemd/system/local-fs.target.wants/systemd-remount-fs.service", e=0x0, _ret=0x7ffe64645000) at ../src/core/manager.c:1961 name=0x5625ed9b01ce "systemd-remount-fs.service", path=0x5625ed9b01a0 "/usr/lib/systemd/system/local-fs.target.wants/systemd-remount-fs.service", add_reference=true, mask=UNIT_DEPENDENCY_FILE) at ../src/core/unit.c:2946 dir_suffix=0x5625ebb179ed ".wants") at ../src/core/load-dropin.c:95 path=0x0, e=0x0, _ret=0x7ffe646452c0) at ../src/core/manager.c:1965 name=0x5625ebb186f8 "local-fs.target", path=0x0, add_reference=true, mask=UNIT_DEPENDENCY_MOUNTINFO_IMPLICIT) at ../src/core/unit.c:2946 where=0x5625ed9b3cc0 "/tmp", options=0x5625ed947110 "rw,nosuid,nodev,seclabel", fstype=0x5625ed95be90 "tmpfs", flags=0x7ffe64645395) at ../src/core/mount.c:1439 where=0x5625ed9b3cc0 "/tmp", options=0x5625ed947110 "rw,nosuid,nodev,seclabel", fstype=0x5625ed95be90 "tmpfs", set_flags=false) at ../src/core/mount.c:1567 at ../src/core/mount.c:1635 ret_retval=0x7ffe64645660, ret_shutdown_verb=0x7ffe646456c0, ret_fds=0x7ffe646456d8, ret_switch_root_dir=0x7ffe646456b0, ret_switch_root_init=0x7ffe646456b8, ret_error_message=0x7ffe646456c8) at ../src/core/main.c:1669 (cherry picked from commit 0c062fd3eb3988822ffcf1f87c45f7c168fe92ef) Gbp-Pq: Name systemd-do-not-pass-.wants-fragment-path-to-manager_load_.patch --- src/core/load-dropin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/load-dropin.c b/src/core/load-dropin.c index 4b422cc5..83b3b7d7 100644 --- a/src/core/load-dropin.c +++ b/src/core/load-dropin.c @@ -92,7 +92,7 @@ static int process_deps(Unit *u, UnitDependency dependency, const char *dir_suff log_unit_warning(u, "%s dependency dropin %s target %s has different name", unit_dependency_to_string(dependency), *p, target); - r = unit_add_dependency_by_name(u, dependency, entry, *p, true, UNIT_DEPENDENCY_FILE); + r = unit_add_dependency_by_name(u, dependency, entry, NULL, true, UNIT_DEPENDENCY_FILE); if (r < 0) log_unit_warning_errno(u, r, "Cannot add %s dependency on %s, ignoring: %m", unit_dependency_to_string(dependency), entry); -- 2.30.2