summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-09-27 20:17:12 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2024-09-27 20:19:58 +0200
commit69c751c61cb2b386afe51f03b58f8f7ceeeb643e (patch)
tree844ca682ba344eaa4f2fa977a86ed1724a9af05a
parentTODO: add one more systemctl rfe (diff)
downloadsystemd-69c751c61cb2b386afe51f03b58f8f7ceeeb643e.tar.xz
systemd-69c751c61cb2b386afe51f03b58f8f7ceeeb643e.zip
systemctl: fix printing of RootImageOptions
The type is a(ss), so a custom printer is required. Fixes https://github.com/systemd/systemd/issues/33967.
-rw-r--r--src/systemctl/systemctl-show.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c
index 2f39bc2b12..67a72bdc94 100644
--- a/src/systemctl/systemctl-show.c
+++ b/src/systemctl/systemctl-show.c
@@ -1769,6 +1769,29 @@ static int print_property(const char *name, const char *expected_value, sd_bus_m
return bus_log_parse_error(r);
return 1;
+
+ } else if (streq(name, "RootImageOptions")) {
+ const char *a, *p;
+
+ /* In config files, the syntax allows the partition name to be omitted. Here, we
+ * always print the partition name, also because we have no way of knowing if it was
+ * originally omitted or not. We also print the partitions on separate lines. */
+
+ r = sd_bus_message_enter_container(m, SD_BUS_TYPE_ARRAY, "(ss)");
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ while ((r = sd_bus_message_read(m, "(ss)", &a, &p)) > 0)
+ bus_print_property_valuef(name, expected_value, flags, "%s:%s", a, p);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ r = sd_bus_message_exit_container(m);
+ if (r < 0)
+ return bus_log_parse_error(r);
+
+ return 1;
+
} else if (streq(name, "MountImages")) {
_cleanup_free_ char *paths = NULL;