From 5bcf34ebf3033352cbfcad1a954cb8c11526e401 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 29 Feb 2020 17:19:46 +0100 Subject: [PATCH] pid1: when showing error status, do not switch to status=temporary We would flip to status=temporary mode on the first error, and then switch back to status=auto after the initial transaction was done. This isn't very useful, because usually all the messages about successfully started units and not related to the original failure. In fact, all those messages most likely cause the information about the prime error to scroll off screen. And if the user requested quiet boot, there's no reason to think that they care about those success messages. Also, when logging about dependency cycles, treat this similarly to a unit error and show the message even if the status is "soft disabled" (before we wouldn't show it in that case). --- man/systemd.xml | 6 +++--- src/core/job.c | 9 ++++----- src/core/manager.c | 3 +++ src/core/manager.h | 1 + src/core/transaction.c | 4 +++- src/core/unit.c | 4 ++-- src/core/unit.h | 3 ++- 7 files changed, 18 insertions(+), 12 deletions(-) diff --git a/man/systemd.xml b/man/systemd.xml index 3cad8141db..bbe0834e23 100644 --- a/man/systemd.xml +++ b/man/systemd.xml @@ -800,10 +800,10 @@ Takes a boolean argument or the constant auto. Can be also specified without an argument, with - the same effect as a positive boolean. If enabled, the systemd manager (PID + the same effect as a positive boolean. If enabled, the systemd manager (PID 1) shows terse service status updates on the console during bootup. - auto behaves like until a unit - fails or there is a significant delay in boot. Defaults to enabled, unless + auto behaves like until + there is a significant delay in boot. Defaults to enabled, unless is passed as kernel command line option, in which case it defaults to auto. If specified overrides the system manager configuration file option , see diff --git a/src/core/job.c b/src/core/job.c index 741c79fdae..c45171cea7 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -572,7 +572,7 @@ static void job_print_begin_status_message(Unit *u, JobType t) { format = job_get_begin_status_message_format(u, t); DISABLE_WARNING_FORMAT_NONLITERAL; - unit_status_printf(u, "", format); + unit_status_printf(u, STATUS_TYPE_NORMAL, "", format); REENABLE_WARNING; } @@ -861,11 +861,10 @@ static void job_print_done_status_message(Unit *u, JobType t, JobResult result) else status = job_print_done_status_messages[result].word; - if (result != JOB_DONE) - manager_flip_auto_status(u->manager, true, "job failed"); - DISABLE_WARNING_FORMAT_NONLITERAL; - unit_status_printf(u, status, format); + unit_status_printf(u, + result == JOB_DONE ? STATUS_TYPE_NORMAL : STATUS_TYPE_NOTICE, + status, format); REENABLE_WARNING; if (t == JOB_START && result == JOB_FAILED) { diff --git a/src/core/manager.c b/src/core/manager.c index 8e7dde634c..e6739e28ab 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -4122,6 +4122,9 @@ static bool manager_get_show_status(Manager *m, StatusType type) { if (type != STATUS_TYPE_EMERGENCY && manager_check_ask_password(m) > 0) return false; + if (type == STATUS_TYPE_NOTICE && m->show_status != SHOW_STATUS_NO) + return true; + return show_status_on(m->show_status); } diff --git a/src/core/manager.h b/src/core/manager.h index 78d2cb5d3f..10c34f9543 100644 --- a/src/core/manager.h +++ b/src/core/manager.h @@ -56,6 +56,7 @@ typedef enum ManagerObjective { typedef enum StatusType { STATUS_TYPE_EPHEMERAL, STATUS_TYPE_NORMAL, + STATUS_TYPE_NOTICE, STATUS_TYPE_EMERGENCY, } StatusType; diff --git a/src/core/transaction.c b/src/core/transaction.c index 8d67f9ce1a..49f43e0327 100644 --- a/src/core/transaction.c +++ b/src/core/transaction.c @@ -425,7 +425,9 @@ static int transaction_verify_order_one(Transaction *tr, Job *j, Job *from, unsi else status = " SKIP "; - unit_status_printf(delete->unit, status, + unit_status_printf(delete->unit, + STATUS_TYPE_NOTICE, + status, "Ordering cycle found, skipping %s"); transaction_delete_unit(tr, delete->unit); return -EAGAIN; diff --git a/src/core/unit.c b/src/core/unit.c index 35627b3511..2816bcef55 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -1659,7 +1659,7 @@ static bool unit_test_assert(Unit *u) { return u->assert_result; } -void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) { +void unit_status_printf(Unit *u, StatusType status_type, const char *status, const char *unit_status_msg_format) { const char *d; d = unit_status_string(u); @@ -1667,7 +1667,7 @@ void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg d = strjoina(ANSI_HIGHLIGHT, d, ANSI_NORMAL); DISABLE_WARNING_FORMAT_NONLITERAL; - manager_status_printf(u->manager, STATUS_TYPE_NORMAL, status, unit_status_msg_format, d); + manager_status_printf(u->manager, status_type, status, unit_status_msg_format, d); REENABLE_WARNING; } diff --git a/src/core/unit.h b/src/core/unit.h index 999c7a7d83..20d78971df 100644 --- a/src/core/unit.h +++ b/src/core/unit.h @@ -9,6 +9,7 @@ #include "condition.h" #include "emergency-action.h" #include "list.h" +#include "show-status.h" #include "set.h" #include "unit-file.h" #include "cgroup.h" @@ -748,7 +749,7 @@ int unit_add_blockdev_dependency(Unit *u, const char *what, UnitDependencyMask m int unit_coldplug(Unit *u); void unit_catchup(Unit *u); -void unit_status_printf(Unit *u, const char *status, const char *unit_status_msg_format) _printf_(3, 0); +void unit_status_printf(Unit *u, StatusType status_type, const char *status, const char *unit_status_msg_format) _printf_(4, 0); bool unit_need_daemon_reload(Unit *u);