From: dongshengyuan <545258830@qq.com> Date: Wed, 15 Jul 2026 08:30:15 +0000 (+0800) Subject: portablectl: keep inspect --force unit metadata X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=9773189e56341a2eb8fd97eefca7885a467e8e5c;p=thirdparty%2Fsystemd.git portablectl: keep inspect --force unit metadata Parse the WithExtensions metadata block whenever --force selects that bus method. This keeps the following unit-file array aligned with the reply layout. Reproducer: portablectl inspect --force /usr/share/minimal_0.raw \ minimal-app0.service Before: inspect printed the image metadata but dropped the matching unit list. Scripts could not see which unit files were selected when --force was used with the WithExtensions bus reply. Follow-up: bdfa3f3a5c6d16d56d432e7bc52be0c03a5ce6ad --- diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index c6eed7ae0f0..1c479f1134a 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -556,7 +556,7 @@ static int verb_inspect_image(int argc, char *argv[], uintptr_t _data, void *use strna(pretty_os)); } - if (!strv_isempty(arg_extension_images)) { + if (!strv_isempty(arg_extension_images) || arg_force) { /* If we specified any extensions, we'll first get back exactly the paths (and * extension-release content) for each one of the arguments. */ diff --git a/test/units/TEST-29-PORTABLE.image.sh b/test/units/TEST-29-PORTABLE.image.sh index 3018e86ecde..ba711e93b32 100755 --- a/test/units/TEST-29-PORTABLE.image.sh +++ b/test/units/TEST-29-PORTABLE.image.sh @@ -66,6 +66,7 @@ portablectl "${ARGS[@]}" attach --force --now --runtime /usr/share/minimal_0.raw portablectl is-attached --force minimal-app0 portablectl inspect --force /usr/share/minimal_0.raw minimal-app0.service +portablectl inspect --force /usr/share/minimal_0.raw minimal-app0.service | grep -F "minimal-app0.service" >/dev/null systemctl is-active minimal-app0.service systemctl is-active minimal-app0-foo.service systemctl is-active minimal-app0-bar.service && exit 1