summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Leeds <matthew.leeds@endlessm.com>2018-08-15 14:09:07 -0700
committerAtomic Bot <atomic-devel@projectatomic.io>2018-08-17 09:14:26 +0000
commitcbc004655404bfb024f9af910362698f36d11202 (patch)
tree0300c296e68bf4c5354f9c3fe89dde059943b784
parent1fcffc8950ef81f2d0204eb35ebdade21e97f6d4 (diff)
downloadflatpak-cbc004655404bfb024f9af910362698f36d11202.tar.gz
transaction: Fix a regression in installing bundles
This commit fixes a regression that causes installing from a bundle to fail if the bundled app's runtime was itself installed from a bundle, or otherwise has a non-working remote (such as when the user is offline). The fix is to treat a failure of flatpak_dir_find_latest_rev() as non-fatal in resolve_ops() if the ref in question is already installed. In other words, if we don't need to fetch a ref for the transaction to succeed, errors in fetching remote info about the ref shouldn't be fatal. Closes: #1973 Approved by: alexlarsson
-rw-r--r--common/flatpak-transaction.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/common/flatpak-transaction.c b/common/flatpak-transaction.c
index 3bb7698a..c3a93d70 100644
--- a/common/flatpak-transaction.c
+++ b/common/flatpak-transaction.c
@@ -1717,8 +1717,22 @@ resolve_ops (FlatpakTransaction *self,
if (op->commit != NULL)
checksum = g_strdup (op->commit);
else if (!flatpak_dir_find_latest_rev (priv->dir, state, op->ref, op->commit, &checksum,
- NULL, cancellable, error))
- return FALSE;
+ NULL, cancellable, &local_error))
+ {
+ /* An unavailable remote summary shouldn't be fatal if we already have the ref */
+ commit_data = flatpak_dir_read_latest_commit (priv->dir, op->remote, op->ref, &checksum, NULL, NULL);
+ if (commit_data == NULL)
+ {
+ g_propagate_error (error, g_steal_pointer (&local_error));
+ return FALSE;
+ }
+ else
+ {
+ g_message (_("Warning: Treating remote fetch error as non-fatal since %s is already installed: %s"),
+ op->ref, local_error->message);
+ g_clear_error (&local_error);
+ }
+ }
/* TODO: This only gets the metadata for the latest only, we need to handle the case
where the user specified a commit, or p2p doesn't have the latest commit available */