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
This commit is contained in:
Matthew Leeds
2018-08-15 14:09:07 -07:00
committed by Atomic Bot
parent 1fcffc8950
commit cbc0046554

View File

@@ -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 */