49 lines
2.3 KiB
Diff
49 lines
2.3 KiB
Diff
From 6973805b33c02c9613ca71003489c428fe1e894e Mon Sep 17 00:00:00 2001
|
|
From: Lennart Poettering <lennart@poettering.net>
|
|
Date: Wed, 18 Jun 2025 11:47:06 +0200
|
|
Subject: [PATCH] core: output log cycle path in one log message, not many
|
|
|
|
Fixes: #35642
|
|
(cherry picked from commit 201647e3f2ff04fbaebc1901431b7ff610f995fb)
|
|
|
|
Related: RHEL-100353
|
|
---
|
|
src/core/transaction.c | 23 ++++++++++++++++-------
|
|
1 file changed, 16 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/src/core/transaction.c b/src/core/transaction.c
|
|
index bb51f51318..747c9101e3 100644
|
|
--- a/src/core/transaction.c
|
|
+++ b/src/core/transaction.c
|
|
@@ -393,14 +393,23 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
|
|
|
|
unit_ids = merge_unit_ids(j->manager->unit_log_field, array); /* ignore error */
|
|
|
|
- STRV_FOREACH_PAIR(unit_id, job_type, array)
|
|
- /* logging for j not k here to provide a consistent narrative */
|
|
+ size_t m = strv_length(array);
|
|
+
|
|
+ _cleanup_free_ char *cycle_path_text = strdup("Found ordering cycle");
|
|
+ if (m > 0) {
|
|
+ (void) strextendf(&cycle_path_text, " on %s/%s", array[0], array[1]);
|
|
+ if (m > 2)
|
|
+ (void) strextendf(&cycle_path_text, "; has dependency on %s/%s", array[2], array[3]);
|
|
+ }
|
|
+
|
|
+ STRV_FOREACH_PAIR(unit_id, job_type, strv_skip(array, 4))
|
|
+ (void) strextendf(&cycle_path_text, ", %s/%s", *unit_id, *job_type);
|
|
+
|
|
+ /* logging for j not k here to provide a consistent narrative */
|
|
+ if (cycle_path_text)
|
|
log_struct(LOG_WARNING,
|
|
- LOG_UNIT_MESSAGE(j->unit,
|
|
- "Found %s on %s/%s",
|
|
- unit_id == array ? "ordering cycle" : "dependency",
|
|
- *unit_id, *job_type),
|
|
- "%s", strna(unit_ids));
|
|
+ LOG_UNIT_MESSAGE(j->unit, "%s", cycle_path_text),
|
|
+ LOG_ITEM("%s", strna(unit_ids)));
|
|
|
|
if (delete) {
|
|
const char *status;
|