]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
core/transaction: be explicit about cyclic ordering relationship 38014/head
authorMike Yuan <me@yhndnzj.com>
Mon, 30 Jun 2025 15:37:58 +0000 (17:37 +0200)
committerMike Yuan <me@yhndnzj.com>
Mon, 30 Jun 2025 15:58:05 +0000 (17:58 +0200)
Inspired by https://github.com/systemd/systemd/pull/35417#discussion_r1867868221

src/core/transaction.c

index 23933936a5516166ee90be88de3b948a81d0f0de..e57907766a919b883dd6a3f9305faf6eede0f138 100644 (file)
@@ -373,17 +373,15 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi
                 STRV_FOREACH_PAIR(unit_id, job_type, array)
                         (void) strextendf_with_separator(&unit_ids, "\n", "%s%s", unit_log_field(j->unit), *unit_id);
 
-                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]);
-                }
+                if (!strv_isempty(array)) {
+                        (void) strextendf(&cycle_path_text, ": %s/%s", array[0], array[1]);
 
-                STRV_FOREACH_PAIR(unit_id, job_type, strv_skip(array, 4))
-                        (void) strextendf(&cycle_path_text, ", %s/%s", *unit_id, *job_type);
+                        STRV_FOREACH_PAIR(unit_id, job_type, strv_skip(array, 2))
+                                (void) strextendf(&cycle_path_text, " after %s/%s", *unit_id, *job_type);
+
+                        (void) strextendf(&cycle_path_text, " - after %s", array[0]);
+                }
 
                 /* logging for j not k here to provide a consistent narrative */
                 if (cycle_path_text)