|
|
ac3a84 |
From 48455fa876129bf33df06d2e758fb0fbda510d5b Mon Sep 17 00:00:00 2001
|
|
|
ac3a84 |
From: Yu Watanabe <watanabe.yu+github@gmail.com>
|
|
|
ac3a84 |
Date: Wed, 16 Nov 2022 03:18:30 +0900
|
|
|
ac3a84 |
Subject: [PATCH] core/unit: merge unit names after merging deps
|
|
|
ac3a84 |
|
|
|
ac3a84 |
Before:
|
|
|
ac3a84 |
systemd[1]: issue-24990.service: Dependency Before=n/a dropped, merged into issue-24990.service
|
|
|
ac3a84 |
After:
|
|
|
ac3a84 |
systemd[1]: issue-24990.service: Dependency Before=test1.service dropped, merged into issue-24990.service
|
|
|
ac3a84 |
|
|
|
ac3a84 |
(cherry picked from commit 1d0c81a05b1605a5fc3db44d5a157a1d6876eda9)
|
|
|
ac3a84 |
|
|
|
ac3a84 |
Related: #2160477
|
|
|
ac3a84 |
---
|
|
|
ac3a84 |
src/core/unit.c | 10 +++++-----
|
|
|
ac3a84 |
1 file changed, 5 insertions(+), 5 deletions(-)
|
|
|
ac3a84 |
|
|
|
ac3a84 |
diff --git a/src/core/unit.c b/src/core/unit.c
|
|
|
ac3a84 |
index 6b49edc2de..d1929bbf69 100644
|
|
|
ac3a84 |
--- a/src/core/unit.c
|
|
|
ac3a84 |
+++ b/src/core/unit.c
|
|
|
ac3a84 |
@@ -1164,11 +1164,6 @@ int unit_merge(Unit *u, Unit *other) {
|
|
|
ac3a84 |
if (r < 0)
|
|
|
ac3a84 |
return r;
|
|
|
ac3a84 |
|
|
|
ac3a84 |
- /* Merge names */
|
|
|
ac3a84 |
- r = unit_merge_names(u, other);
|
|
|
ac3a84 |
- if (r < 0)
|
|
|
ac3a84 |
- return r;
|
|
|
ac3a84 |
-
|
|
|
ac3a84 |
/* Redirect all references */
|
|
|
ac3a84 |
while (other->refs_by_target)
|
|
|
ac3a84 |
unit_ref_set(other->refs_by_target, other->refs_by_target->source, u);
|
|
|
ac3a84 |
@@ -1176,6 +1171,11 @@ int unit_merge(Unit *u, Unit *other) {
|
|
|
ac3a84 |
/* Merge dependencies */
|
|
|
ac3a84 |
unit_merge_dependencies(u, other);
|
|
|
ac3a84 |
|
|
|
ac3a84 |
+ /* Merge names. It is better to do that after merging deps, otherwise the log message contains n/a. */
|
|
|
ac3a84 |
+ r = unit_merge_names(u, other);
|
|
|
ac3a84 |
+ if (r < 0)
|
|
|
ac3a84 |
+ return r;
|
|
|
ac3a84 |
+
|
|
|
ac3a84 |
other->load_state = UNIT_MERGED;
|
|
|
ac3a84 |
other->merged_into = u;
|
|
|
ac3a84 |
|