From: Yu Watanabe Date: Tue, 9 Dec 2025 18:59:12 +0000 (+0900) Subject: bus-wait-for-jobs: do not say "Unexpected job result" when job is simply failed X-Git-Tag: v259-rc3~5^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=286527a1c19fb9f04ce956672757fbcfea2fbba3;p=thirdparty%2Fsystemd.git bus-wait-for-jobs: do not say "Unexpected job result" when job is simply failed --- diff --git a/src/shared/bus-wait-for-jobs.c b/src/shared/bus-wait-for-jobs.c index dcbe7eaf0f7..d9c5c2131e0 100644 --- a/src/shared/bus-wait-for-jobs.c +++ b/src/shared/bus-wait-for-jobs.c @@ -266,25 +266,27 @@ static int check_wait_response(BusWaitForJobs *d, WaitJobsFlags flags, const cha return log_full_errno(priority, SYNTHETIC_ERRNO(EDEADLK), "Cannot perform operation on frozen unit %s.", d->name); if (streq(d->result, "concurrency")) return log_full_errno(priority, SYNTHETIC_ERRNO(ETOOMANYREFS), "Concurrency limit of a slice unit %s is contained in has been reached.", d->name); - if (endswith(d->name, ".service")) { - /* Job result is unknown. For services, let's also try Result property. */ - _cleanup_free_ char *result = NULL; - r = bus_job_get_service_result(d, &result); - if (r < 0) - log_debug_errno(r, "Failed to get Result property of unit %s, ignoring: %m", - d->name); - - log_job_error_with_service_result( - d->name, result, - /* quiet= */ !FLAGS_SET(flags, BUS_WAIT_JOBS_LOG_ERROR), - extra_args); - } else /* Otherwise we just show a generic message. */ - log_full(priority, "Job failed. See \"journalctl -xe\" for details."); - - return log_debug_errno(SYNTHETIC_ERRNO(ENOMEDIUM), - "Unexpected job result '%s' for unit '%s', assuming server side newer than us.", - d->result, d->name); + if (!streq(d->result, "failed")) + log_debug("Unexpected job result '%s' for unit '%s', assuming server side newer than us.", + d->result, d->name); + + /* Job is failed, or result is unknown. For non-service units, just show a generic message. */ + if (!endswith(d->name, ".service")) + return log_full_errno(priority, SYNTHETIC_ERRNO(ENOMEDIUM), "Job failed. See \"journalctl -xe\" for details."); + + /* For services, let's also try Result property. */ + _cleanup_free_ char *result = NULL; + r = bus_job_get_service_result(d, &result); + if (r < 0) + log_debug_errno(r, "Failed to get Result property of unit %s, ignoring: %m", d->name); + + log_job_error_with_service_result( + d->name, result, + /* quiet= */ !FLAGS_SET(flags, BUS_WAIT_JOBS_LOG_ERROR), + extra_args); + + return -ENOMEDIUM; } int bus_wait_for_jobs(BusWaitForJobs *d, WaitJobsFlags flags, const char* const* extra_args) {