!744 [sync] PR-740: 修复systemctl显示service服务字段参数RootImageOptions问题

From: @openeuler-sync-bot 
Reviewed-by: @xujing99 
Signed-off-by: @xujing99
This commit is contained in:
openeuler-ci-bot 2024-11-07 11:33:11 +00:00 committed by Gitee
commit 63739f235a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,49 @@
From 64d833dfa6bcac6d4c991447bfd63d6bcda1ba6b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Fri, 27 Sep 2024 20:17:12 +0200
Subject: [PATCH] systemctl: fix printing of RootImageOptions
The type is a(ss), so a custom printer is required.
Fixes https://github.com/systemd/systemd/issues/33967.
(cherry picked from commit 69c751c61cb2b386afe51f03b58f8f7ceeeb643e)
(cherry picked from commit 28ced52894cf6921d1fe9831f2def29de164e189)
---
src/systemctl/systemctl-show.c | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/systemctl/systemctl-show.c b/src/systemctl/systemctl-show.c
index 5d1eb492e1..7fe7f423f6 100644
--- a/src/systemctl/systemctl-show.c
+++ b/src/systemctl/systemctl-show.c
@@ -1742,6 +1742,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;

View File

@ -25,7 +25,7 @@
Name: systemd
Url: https://systemd.io/
Version: 255
Release: 23
Release: 24
License: MIT and LGPLv2+ and GPLv2+
Summary: System and Service Manager
@ -70,6 +70,7 @@ Patch6016: backport-main-pass-the-right-error-variable.patch
Patch6017: backport-sd-event-fix-fd-leak-when-fd-is-owned-by-IO-event-source.patch
Patch6018: backport-fix-cgtop-sscanf-return-code-checks.patch
Patch6019: backport-mount-optimize-mountinfo-traversal-by-decoupling-dev.patch
Patch6020: backport-systemctl-fix-printing-of-RootImageOptions.patch
Patch9008: update-rtc-with-system-clock-when-shutdown.patch
Patch9009: udev-add-actions-while-rename-netif-failed.patch
@ -1659,6 +1660,9 @@ fi
%{_unitdir}/veritysetup.target
%changelog
* Wed Nov 6 2024 Han Jinpeng <hanjinpeng@kylinos.cn> - 255-24
- backport: fix systemctl printing of RootImageOptions issue
* Tue Nov 05 2024 xujing <xujing125@huawei.com> - 255-23
- DESC:optimize mountinfo traversal by decoupling device discovery