From: Zbigniew Jędrzejewski-Szmek Date: Thu, 16 Apr 2026 08:07:32 +0000 (+0200) Subject: cgls: fix/update/restore the handling of --xattr and --cgroup-id X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a60f12202f78530a531752da715737d031fa9b3a;p=thirdparty%2Fsystemd.git cgls: fix/update/restore the handling of --xattr and --cgroup-id This is a bit tricky. Previously, the --help string said "-x --xattr=BOOL", which normally means that '-x BOOL' and '--xattr BOOL' and '--xattr=BOOL' are all accepted and equivalent. But actually only the third form was accepted. '-x' should have been and is now documented as "Same as --xattr=true". The man page tried to explain this, but not very strongly. So update the man page to have more emphasis and restore the special behaviour for -x and -c. This is a on old program, so I think in this case, maintaining compatiblity in behaviour is important. --- diff --git a/man/systemd-cgls.xml b/man/systemd-cgls.xml index 5280992c8c6..60cf6fa41aa 100644 --- a/man/systemd-cgls.xml +++ b/man/systemd-cgls.xml @@ -114,22 +114,23 @@ + - Controls whether to include information about extended attributes of the listed - control groups in the output. With the long option, expects a boolean value. Defaults to no. + control groups in the output. With the long option only, optionally accepts a boolean value. Defaults + to no. + - Controls whether to include the numeric ID of the listed control groups in the - output. With the long option, expects a boolean value. Defaults to no. + output. With the long option only, optionally accepts a boolean value. Defaults to no. diff --git a/src/cgls/cgls.c b/src/cgls/cgls.c index 1c43543a901..60d8e770123 100644 --- a/src/cgls/cgls.c +++ b/src/cgls/cgls.c @@ -112,8 +112,9 @@ static int parse_argv(int argc, char *argv[]) { return log_oom(); break; - OPTION_FULL(OPTION_OPTIONAL_ARG, 'x', "xattr", "BOOL", - "Show cgroup extended attributes"): + OPTION_LONG_FLAGS(OPTION_OPTIONAL_ARG, "xattr", "BOOL", + "Show cgroup extended attributes"): {} + OPTION_SHORT('x', NULL, "Same as --xattr=true"): if (arg) { r = parse_boolean(arg); if (r < 0) @@ -124,8 +125,9 @@ static int parse_argv(int argc, char *argv[]) { SET_FLAG(arg_output_flags, OUTPUT_CGROUP_XATTRS, r); break; - OPTION_FULL(OPTION_OPTIONAL_ARG, 'c', "cgroup-id", "BOOL", - "Show cgroup ID"): + OPTION_LONG_FLAGS(OPTION_OPTIONAL_ARG, "cgroup-id", "BOOL", + "Show cgroup ID"): {} + OPTION_SHORT('c', NULL, "Same as --cgroup-id=true"): if (arg) { r = parse_boolean(arg); if (r < 0)