From: Clayton Craft Date: Thu, 2 Apr 2026 17:06:51 +0000 (-0700) Subject: updatectl: fix unexpected polkit prompt on update X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d3d142e5fdeeb2a0f425358090be45c68bfd847d;p=thirdparty%2Fsystemd.git updatectl: fix unexpected polkit prompt on update When running `updatectl update` since f0b2ea63, Install() was called with the version resolved by Acquire() rather than the originally requested (empty) version, causing the stricter update-to-version polkit action to be used instead of the update polkit action. --- diff --git a/src/sysupdate/updatectl.c b/src/sysupdate/updatectl.c index 86561cf1c73..636a3f064b9 100644 --- a/src/sysupdate/updatectl.c +++ b/src/sysupdate/updatectl.c @@ -75,6 +75,8 @@ typedef struct Operation { /* Only used for Acquire()/Install() operations: */ char *acquired_version; + /* The version the user requested, possibly empty */ + char *requested_version; } Operation; static Operation* operation_free(Operation *p) { @@ -90,6 +92,7 @@ static Operation* operation_free(Operation *p) { free(p->job_path); free(p->acquired_version); + free(p->requested_version); sd_event_source_disable_unref(p->job_interrupt_source); sd_bus_slot_unref(p->job_properties_slot); @@ -1068,7 +1071,7 @@ static int update_acquire_finished(sd_bus_message *m, void *userdata, sd_bus_err update_install_started, op, "st", - op->acquired_version, + op->requested_version, 0LU); if (r < 0) return log_bus_error(r, NULL, op->target_id, "call Install"); @@ -1246,6 +1249,11 @@ static int do_update(sd_bus *bus, char **targets) { 0LU); if (r < 0) return log_bus_error(r, NULL, targets[i], "call Acquire"); + + op->requested_version = strdup(versions[i]); + if (!op->requested_version) + return log_oom(); + TAKE_PTR(op); remaining++;