From 84ba8721de9d70340747758f9d028a3f9c4e302e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 19 Sep 2025 10:12:13 +0200 Subject: [PATCH 1/3] job: shorten code --- src/core/job.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/job.c b/src/core/job.c index 4291d36648..42bca3a253 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -772,8 +772,8 @@ static void job_emit_done_message(Unit *u, uint32_t job_id, JobType t, JobResult /* No message on the console if the job did not actually do anything due to unmet condition. */ if (console_only) return; - else - do_console = false; + + do_console = false; } if (!console_only) { /* Skip printing if output goes to the console, and job_print_status_message() From 8e9b722b4ad94d1739810ff2792b9c03ba5c850e Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 19 Sep 2025 10:12:52 +0200 Subject: [PATCH 2/3] unit: line-break overly long parameter list + add assert() --- src/core/unit.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/core/unit.c b/src/core/unit.c index 3990ad1679..e99f8f2b3e 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -1825,7 +1825,15 @@ static bool unit_test_assert(Unit *u) { return u->assert_result; } -void unit_status_printf(Unit *u, StatusType status_type, const char *status, const char *format, const char *ident) { +void unit_status_printf( + Unit *u, + StatusType status_type, + const char *status, + const char *format, + const char *ident) { + + assert(u); + if (log_get_show_color()) { if (u->manager->status_unit_format == STATUS_UNIT_FORMAT_COMBINED && strchr(ident, ' ')) ident = strjoina(ANSI_HIGHLIGHT, u->id, ANSI_NORMAL, " - ", u->description); From 9ecc969855ce7d8e587ea2ea0b6c3120877a7887 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 19 Sep 2025 10:13:45 +0200 Subject: [PATCH 3/3] core: fix status output suppression This fixes two things: first of all it ensures we take the override status output field properly into account, instead of going directly to the regular one. Moreover, it ensures that we bypass auto for both notice + emergency, since both have the same "impact", and, don't limit this for notice only. --- src/core/manager.c | 4 ++-- src/core/unit.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/core/manager.c b/src/core/manager.c index 2529a7c3f1..c7cf59082c 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -4525,10 +4525,10 @@ static bool manager_should_show_status(Manager *m, StatusType type) { return false; /* If we cannot find out the status properly, just proceed. */ - if (type != STATUS_TYPE_EMERGENCY && manager_check_ask_password(m) > 0) + if (type < STATUS_TYPE_EMERGENCY && manager_check_ask_password(m) > 0) return false; - if (type == STATUS_TYPE_NOTICE && m->show_status != SHOW_STATUS_NO) + if (type >= STATUS_TYPE_NOTICE && manager_get_show_status(m) != SHOW_STATUS_NO) return true; return manager_get_show_status_on(m); diff --git a/src/core/unit.h b/src/core/unit.h index 62652540bc..9b7d00da10 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -52,10 +52,12 @@ typedef enum OOMPolicy { } OOMPolicy; typedef enum StatusType { - STATUS_TYPE_EPHEMERAL, + STATUS_TYPE_EPHEMERAL, /* ordered by severity! Do not break order */ STATUS_TYPE_NORMAL, STATUS_TYPE_NOTICE, STATUS_TYPE_EMERGENCY, + _STATUS_TYPE_MAX, + _STATUS_TYPE_INVALID = -EINVAL, } StatusType; static inline bool UNIT_IS_ACTIVE_OR_RELOADING(UnitActiveState t) {