From e0a067a251e76c54df90612d8009c8436c9a1479 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Thu, 15 Jun 2023 18:54:56 +0100 Subject: [PATCH 1/2] portable: fix silly typo in D-Bus interface name D'oh. Nobody noticed in 3 years, I guess nobody calls these directly and instead the manager's methods are used. Still we'll have to keep this around, so just hide it. --- man/org.freedesktop.portable1.xml | 20 ++++++++++---------- src/portable/portabled-image-bus.c | 13 ++++++++++++- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/man/org.freedesktop.portable1.xml b/man/org.freedesktop.portable1.xml index 00db6f8f7a..3b28f1dbfa 100644 --- a/man/org.freedesktop.portable1.xml +++ b/man/org.freedesktop.portable1.xml @@ -380,13 +380,13 @@ node /org/freedesktop/portable1 { in s copy_mode, out a(sss) changes_removed, out a(sss) changes_updated); - ReattacheWithExtensions(in as extensions, - in as matches, - in s profile, - in s copy_mode, - in t flags, - out a(sss) changes_removed, - out a(sss) changes_updated); + ReattachWithExtensions(in as extensions, + in as matches, + in s profile, + in s copy_mode, + in t flags, + out a(sss) changes_removed, + out a(sss) changes_updated); Remove(); MarkReadOnly(in b read_only); SetLimit(in t limit); @@ -438,7 +438,7 @@ node /org/freedesktop/portable1 { - + @@ -472,7 +472,7 @@ node /org/freedesktop/portable1 { - + @@ -530,7 +530,7 @@ node /org/freedesktop/portable1 { Reattach() - ReattacheWithExtensions() + ReattachWithExtensions() Remove() diff --git a/src/portable/portabled-image-bus.c b/src/portable/portabled-image-bus.c index 5e46d86b08..f271d36db5 100644 --- a/src/portable/portabled-image-bus.c +++ b/src/portable/portabled-image-bus.c @@ -934,7 +934,7 @@ const sd_bus_vtable image_vtable[] = { "a(sss)", changes_updated), bus_image_method_reattach, SD_BUS_VTABLE_UNPRIVILEGED), - SD_BUS_METHOD_WITH_ARGS("ReattacheWithExtensions", + SD_BUS_METHOD_WITH_ARGS("ReattachWithExtensions", SD_BUS_ARGS("as", extensions, "as", matches, "s", profile, @@ -959,6 +959,17 @@ const sd_bus_vtable image_vtable[] = { SD_BUS_NO_RESULT, bus_image_method_set_limit, SD_BUS_VTABLE_UNPRIVILEGED), + /* Deprecated silly typo */ + SD_BUS_METHOD_WITH_ARGS("ReattacheWithExtensions", + SD_BUS_ARGS("as", extensions, + "as", matches, + "s", profile, + "s", copy_mode, + "t", flags), + SD_BUS_RESULT("a(sss)", changes_removed, + "a(sss)", changes_updated), + bus_image_method_reattach, + SD_BUS_VTABLE_UNPRIVILEGED|SD_BUS_VTABLE_HIDDEN), SD_BUS_VTABLE_END }; From c18f4eb9e96836a6a8285ec42fd8a34c8909f6d9 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Fri, 16 Jun 2023 12:31:37 +0100 Subject: [PATCH 2/2] portablectl: fix using --force when no --extension is passed The 'force' flag applies whether or not extensions are present --- src/portable/portablectl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index 39f17a8de7..8744ba75fe 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -264,7 +264,7 @@ static int get_image_metadata(sd_bus *bus, const char *image, char **matches, sd assert(bus); assert(reply); - method = strv_isempty(arg_extension_images) ? "GetImageMetadata" : "GetImageMetadataWithExtensions"; + method = strv_isempty(arg_extension_images) && !arg_force ? "GetImageMetadata" : "GetImageMetadataWithExtensions"; r = bus_message_new_method_call(bus, &m, bus_portable_mgr, method); if (r < 0) @@ -907,11 +907,11 @@ static int attach_reattach_image(int argc, char *argv[], const char *method) { } static int attach_image(int argc, char *argv[], void *userdata) { - return attach_reattach_image(argc, argv, strv_isempty(arg_extension_images) ? "AttachImage" : "AttachImageWithExtensions"); + return attach_reattach_image(argc, argv, strv_isempty(arg_extension_images) && !arg_force ? "AttachImage" : "AttachImageWithExtensions"); } static int reattach_image(int argc, char *argv[], void *userdata) { - return attach_reattach_image(argc, argv, strv_isempty(arg_extension_images) ? "ReattachImage" : "ReattachImageWithExtensions"); + return attach_reattach_image(argc, argv, strv_isempty(arg_extension_images) && !arg_force ? "ReattachImage" : "ReattachImageWithExtensions"); } static int detach_image(int argc, char *argv[], void *userdata) { @@ -934,7 +934,7 @@ static int detach_image(int argc, char *argv[], void *userdata) { (void) maybe_stop_disable(bus, image, argv); - method = strv_isempty(arg_extension_images) ? "DetachImage" : "DetachImageWithExtensions"; + method = strv_isempty(arg_extension_images) && !arg_force ? "DetachImage" : "DetachImageWithExtensions"; r = bus_message_new_method_call(bus, &m, bus_portable_mgr, method); if (r < 0)