]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
updatectl: fix unexpected polkit prompt on update
authorClayton Craft <clayton@craftyguy.net>
Thu, 2 Apr 2026 17:06:51 +0000 (10:06 -0700)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 3 Apr 2026 12:26:17 +0000 (14:26 +0200)
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.

src/sysupdate/updatectl.c

index 86561cf1c734daedb92cca01fc76d21dbad5df3d..636a3f064b94ff0da5deff9ebf8b43798fb61af4 100644 (file)
@@ -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++;