From 413e8650b71d4404a7453403797f93d73d88c466 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 31 Aug 2022 16:39:03 -0400 Subject: [PATCH] tree-wide: Use "unmet" for condition checks, not "failed" Often I end up debugging a problem on a system, and I do e.g. `journalctl --grep=failed|error`. The use of the term "failed" for condition checks adds a *lot* of unnecessary noise into this. Now, I know this regexp search isn't precise, but it has proven to be useful to me. I think "failed" is too strong of a term as a baseline, and also just stands out to e.g. humans watching their servers boot or whatever. The term "met condition" is fairly widely used, e.g. https://stackoverflow.com/questions/63751794/what-does-the-condition-is-met-exactly-mean-in-programming-languages Use that instead. --- man/systemd.unit.xml | 4 ++-- src/core/job.c | 10 +++++----- src/core/job.h | 2 +- src/core/path.c | 2 +- src/core/unit.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/man/systemd.unit.xml b/man/systemd.unit.xml index a9114fb353f..7c1f7186e2f 100644 --- a/man/systemd.unit.xml +++ b/man/systemd.unit.xml @@ -705,7 +705,7 @@ When used in conjunction with After= on the same unit the behaviour of BindsTo= is even stronger. In this case, the unit bound to strictly has to be in active state for this unit to also be in active state. This not only means a unit bound to another unit that suddenly - enters inactive state, but also one that is bound to another unit that gets skipped due to a failed condition + enters inactive state, but also one that is bound to another unit that gets skipped due to an unmet condition check (such as ConditionPathExists=, ConditionPathIsSymbolicLink=, … — see below) will be stopped, should it be running. Hence, in many cases it is best to combine BindsTo= with After=. @@ -1170,7 +1170,7 @@ The AssertArchitecture=, AssertVirtualization=, … options are similar to conditions but cause the start job to fail (instead of being skipped). The failed check - is logged. Units with failed conditions are considered to be in a clean state and will be garbage + is logged. Units with unmet conditions are considered to be in a clean state and will be garbage collected if they are not referenced. This means that when queried, the condition failure may or may not show up in the state of the unit. diff --git a/src/core/job.c b/src/core/job.c index dd8d858bd2d..7905561cca4 100644 --- a/src/core/job.c +++ b/src/core/job.c @@ -610,7 +610,7 @@ static const char* job_done_message_format(Unit *u, JobType t, JobResult result) assert(t >= 0); assert(t < _JOB_TYPE_MAX); - /* Show condition check message if the job did not actually do anything due to failed condition. */ + /* Show condition check message if the job did not actually do anything due to unmet condition. */ if (t == JOB_START && result == JOB_DONE && !u->condition_result) return "Condition check resulted in %s being skipped."; @@ -702,7 +702,7 @@ static void job_emit_done_message(Unit *u, uint32_t job_id, JobType t, JobResult bool console_only = do_console && log_on_console(); if (t == JOB_START && result == JOB_DONE && !u->condition_result) { - /* No message on the console if the job did not actually do anything due to failed condition. */ + /* No message on the console if the job did not actually do anything due to unmet condition. */ if (console_only) return; else @@ -716,13 +716,13 @@ static void job_emit_done_message(Unit *u, uint32_t job_id, JobType t, JobResult c = t == JOB_START && result == JOB_DONE ? unit_find_failed_condition(u) : NULL; if (c) { - /* Special case units that were skipped because of a failed condition check so that + /* Special case units that were skipped because of a unmet condition check so that * we can add more information to the message. */ if (c->trigger) log_unit_struct( u, job_done_messages[result].log_level, - LOG_MESSAGE("%s was skipped because all trigger condition checks failed.", + LOG_MESSAGE("%s was skipped because no trigger condition checks were met.", ident), "JOB_ID=%" PRIu32, job_id, "JOB_TYPE=%s", job_type_to_string(t), @@ -733,7 +733,7 @@ static void job_emit_done_message(Unit *u, uint32_t job_id, JobType t, JobResult log_unit_struct( u, job_done_messages[result].log_level, - LOG_MESSAGE("%s was skipped because of a failed condition check (%s=%s%s).", + LOG_MESSAGE("%s was skipped because of an unmet condition check (%s=%s%s).", ident, condition_type_to_string(c->type), c->negate ? "!" : "", diff --git a/src/core/job.h b/src/core/job.h index 0305e0ea445..30a7903aa39 100644 --- a/src/core/job.h +++ b/src/core/job.h @@ -84,7 +84,7 @@ enum JobMode { }; enum JobResult { - JOB_DONE, /* Job completed successfully (or skipped due to a failed ConditionXYZ=) */ + JOB_DONE, /* Job completed successfully (or skipped due to an unmet ConditionXYZ=) */ JOB_CANCELED, /* Job canceled by a conflicting job installation or by explicit cancel request */ JOB_TIMEOUT, /* Job timeout elapsed */ JOB_FAILED, /* Job failed */ diff --git a/src/core/path.c b/src/core/path.c index 2810e30573d..3a46e449288 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -369,7 +369,7 @@ static int path_add_extras(Path *p) { assert(p); - /* To avoid getting pid1 in a busy-loop state (eg: failed condition on associated service), + /* To avoid getting pid1 in a busy-loop state (eg: unmet condition on associated service), * set a default trigger limit if the user didn't specify any. */ if (p->trigger_limit.interval == USEC_INFINITY) p->trigger_limit.interval = 2 * USEC_PER_SEC; diff --git a/src/core/unit.c b/src/core/unit.c index 82a1d81e04d..81e37641415 100644 --- a/src/core/unit.c +++ b/src/core/unit.c @@ -1916,7 +1916,7 @@ int unit_start(Unit *u, ActivationDetails *details) { /* Let's make sure that the deps really are in order before we start this. Normally the job engine * should have taken care of this already, but let's check this here again. After all, our - * dependencies might not be in effect anymore, due to a reload or due to a failed condition. */ + * dependencies might not be in effect anymore, due to a reload or due to an unmet condition. */ if (!unit_verify_deps(u)) return -ENOLINK;