From: Franck Bui Date: Thu, 2 Feb 2017 18:29:44 +0000 (+0100) Subject: systemctl: 'show' don't exit with a failure status if the requested property does... X-Git-Tag: v234~580 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1669917f583279ac7348283206612462b178597;p=platform%2Fupstream%2Fsystemd.git systemctl: 'show' don't exit with a failure status if the requested property does not exist (#5201) "systemctl show -pUnknown " used to exit with '0' even if the property passed by '-p' doesn't exist. But since commit 3dced37b7c2c9a5c733817 (v231+), it exits with a failure status. "systemctl show" is supposed to be scriptable and therefore its behavior is supposed to be stable. This patch restores the old behavior on which a couple of scripts already rely now. Also when the requested property doesn't exist, it always logs it at the debug level since this part of the code is only used by the show command. Fixes: #5118 --- diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 8f80559..c28da50 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -5029,13 +5029,10 @@ static int show_one( r = 0; if (show_properties) { char **pp; - int not_found_level = streq(verb, "show") ? LOG_DEBUG : LOG_WARNING; STRV_FOREACH(pp, arg_properties) - if (!set_contains(found_properties, *pp)) { - log_full(not_found_level, "Property %s does not exist.", *pp); - r = -ENXIO; - } + if (!set_contains(found_properties, *pp)) + log_debug("Property %s does not exist.", *pp); } else if (streq(verb, "help")) show_unit_help(&info);