Blame SOURCES/3849.patch

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