]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
portablectl: keep inspect --force unit metadata
authordongshengyuan <545258830@qq.com>
Wed, 15 Jul 2026 08:30:15 +0000 (16:30 +0800)
committerdongshengyuan <545258830@qq.com>
Wed, 15 Jul 2026 08:30:15 +0000 (16:30 +0800)
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

src/portable/portablectl.c
test/units/TEST-29-PORTABLE.image.sh

index c6eed7ae0f0448faa2f99fe82bdcf3265201a023..1c479f1134a403dbbedac15c38b7b5233770969b 100644 (file)
@@ -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. */
 
index 3018e86ecdee10792c14dd4bbd2287f93f34d3e0..ba711e93b32ecb0cdcf1dec50fd4f74367e8fdde 100755 (executable)
@@ -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