flatpak/3849.patch
2020-09-11 16:54:54 +02:00

44 lines
1.9 KiB
Diff

From 834c8d4524062349e36920ebefbd1c50b14a6c25 Mon Sep 17 00:00:00 2001
From: Alexander Larsson <alexl@redhat.com>
Date: Fri, 11 Sep 2020 16:24:23 +0200
Subject: [PATCH] Don't loop authentincating if updating to the current version
In case we need to authenticate for updates (in my test case i was
doing an OCI downgrade) we might need to download a commit object (or
in the OCI case a manifest json), so it did a request_required_tokens(),
but that noticed during the flatpak_transaction_normalize_ops() call
that the partial resolve to a particular commit actually was the
same as the local installed commit and marked op->skip = TRUE.
However, when we got back to resolving the op again we didn't actually
look at the skip, so it kept looping wanting (but never doing) auth.
The fix is to just directly resolve ops marked as skipped.
---
common/flatpak-transaction.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/common/flatpak-transaction.c b/common/flatpak-transaction.c
index 410df8e54..9f9da23bd 100644
--- a/common/flatpak-transaction.c
+++ b/common/flatpak-transaction.c
@@ -2765,6 +2765,18 @@ resolve_ops (FlatpakTransaction *self,
if (op->resolved)
continue;
+ if (op->skip)
+ {
+ /* We're not yet resolved, but marked skip anyway, this can happen if during
+ * request_required_tokens() we were normalized away even though not fully resolved.
+ * For example we got the checksum but need to auth to get the commit, but the
+ * checksum we got was the version already installed.
+ */
+ g_assert (op->resolved_commit != NULL);
+ mark_op_resolved (op, op->resolved_commit, NULL, NULL, NULL);
+ continue;
+ }
+
if (op->kind == FLATPAK_TRANSACTION_OPERATION_UNINSTALL)
{
/* We resolve to the deployed metadata, because we need it to uninstall related ops */