summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-12 12:32:39 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-20 14:45:02 +0200
commitee0cf3ef6f522ee084ed987593f55c6c32097619 (patch)
tree4229cbace1a0f712675f670f8a9c6a1961311bf4
parent86fa9614b55cf891d019996632530250cd61add4 (diff)
downloadsystemd-ee0cf3ef6f522ee084ed987593f55c6c32097619.tar.gz
systemctl: show error when help for unknown unit is requested
Fixes #20189. We would only log at debug level and return failure, which looks like a noop for the user. ('help' accepts multiple arguments and will show multiple concatenated man pages in that case. Actually, it will also show multiple concatenated man pages if the Documentation= setting lists multiple pages. I don't think it's very terribly useful, but, meh, I don't think we can do much better. If a user requests a help for a two services, one known and one unknown, there'll now be a line in the output. It's not very user friendly, but not exactly wrong too.) (cherry picked from commit 75312ada5324d8adae3f3a0ed97f0acfc8b8bde5) (cherry picked from commit 486412ad3bba4f1306597302cf66cc4858126243)
-rw-r--r--src/systemctl/systemctl-show.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c
index 376f1e5f28..364f741f1d 100644
--- a/src/systemctl/systemctl-show.c
+++ b/src/systemctl/systemctl-show.c
@@ -1859,7 +1859,7 @@ static int show_one(
return log_error_errno(r, "Failed to get properties: %s", bus_error_message(&error, r));
if (unit && streq_ptr(info.load_state, "not-found") && streq_ptr(info.active_state, "inactive")) {
- log_full(show_mode == SYSTEMCTL_SHOW_STATUS ? LOG_ERR : LOG_DEBUG,
+ log_full(show_mode == SYSTEMCTL_SHOW_PROPERTIES ? LOG_DEBUG : LOG_ERR,
"Unit %s could not be found.", unit);
if (show_mode == SYSTEMCTL_SHOW_STATUS)