]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sysupdate: Allow a partial version to be the candidate
authorPhilip Withnall <pwithnall@gnome.org>
Wed, 22 Apr 2026 16:25:44 +0000 (17:25 +0100)
committerPhilip Withnall <pwithnall@gnome.org>
Fri, 24 Apr 2026 14:29:28 +0000 (15:29 +0100)
Previously we allowed a pending version to be the candidate — but if
there are no better choices, then we might as well allow a partial
version to be candidate as well.

The alternative is having no update candidate when a new version is
partially installed (i.e. downloaded but not moved into place). This
would mean that an update which is interrupted then needs to be re-run
with an explicit version number to progress, rather than being able to
be re-run without a version number (as it was in the first place).

Signed-off-by: Philip Withnall <pwithnall@gnome.org>
Helps: https://github.com/systemd/systemd/issues/41502

src/sysupdate/sysupdate.c

index 89efe36c857f044b2b9376a0ec925c9cc4bb5b01..cba7960f0be675c434e658d23b412465079d8e0e 100644 (file)
@@ -505,8 +505,9 @@ static int context_discover_update_sets_by_flag(Context *c, UpdateSetFlags flags
             c->candidate && strverscmp_improved(c->newest_installed->version, c->candidate->version) >= 0)
                 c->candidate = NULL;
 
-        /* Newest installed is still pending and no candidate is set? Then it becomes the candidate. */
-        if (c->newest_installed && FLAGS_SET(c->newest_installed->flags, UPDATE_PENDING) &&
+        /* Newest installed is still pending or partial and no candidate is set? Then it becomes the candidate. */
+        if (c->newest_installed &&
+            (c->newest_installed->flags & (UPDATE_PENDING|UPDATE_PARTIAL)) &&
             !c->candidate)
                 c->candidate = c->newest_installed;