diff --git a/src/portable/portablectl.c b/src/portable/portablectl.c index 641fc1365f..27cc440437 100644 --- a/src/portable/portablectl.c +++ b/src/portable/portablectl.c @@ -1440,12 +1440,17 @@ static int verb_remove_image(int argc, char *argv[], uintptr_t _data, void *user for (i = 1; i < argc; i++) { _cleanup_(sd_bus_error_free) sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_(sd_bus_message_unrefp) sd_bus_message *m = NULL; + _cleanup_free_ char *image = NULL; + + r = determine_image(argv[i], false, &image); + if (r < 0) + return r; r = bus_message_new_method_call(bus, &m, bus_portable_mgr, "RemoveImage"); if (r < 0) return bus_log_create_error(r); - r = sd_bus_message_append(m, "s", argv[i]); + r = sd_bus_message_append(m, "s", image); if (r < 0) return bus_log_create_error(r); diff --git a/test/units/TEST-29-PORTABLE.directory.sh b/test/units/TEST-29-PORTABLE.directory.sh index 1cedeea72b..a1951ee6e1 100755 --- a/test/units/TEST-29-PORTABLE.directory.sh +++ b/test/units/TEST-29-PORTABLE.directory.sh @@ -24,6 +24,11 @@ rm -rf /tmp/mismatched-name cp -a /tmp/minimal_0 /tmp/mismatched-name portablectl inspect /tmp/mismatched-name | grep -F "minimal-app0.service" >/dev/null +rm -rf /tmp/remove-relative +cp -a /tmp/minimal_0 /tmp/remove-relative +(cd /tmp && portablectl remove ./remove-relative) +test ! -e /tmp/remove-relative + rm -rf /tmp/symlink-unit cp -a /tmp/minimal_0 /tmp/symlink-unit printf '[Service]\nExecStart=/bin/true\n' >/tmp/portable-host-unit