File 0009-dir-Dont-overzealously-rewrite-an-error.patch of Package flatpak.14328
From 11070054b4e056b1bc98e528f95005790793e99a Mon Sep 17 00:00:00 2001
From: Matthew Leeds <matthew.leeds@endlessm.com>
Date: Thu, 25 Jul 2019 09:15:50 -0700
Subject: [PATCH] dir: Don't overzealously rewrite an error
It's an error to call g_set_error() on an error that's already set, and
flatpak_dir_get_deploy_data() already sets FLATPAK_ERROR_NOT_INSTALLED
for us when necessary, so just pass on any errors to the caller of
flatpak_dir_get_origin(). In the case that the error is something else,
that should be treated as an error, because we never expect the deploy
directory to exist but not have a deploy file (see the implementations
of flatpak_dir_deploy() and flatpak_dir_undeploy()).
Closes: #3032
Approved by: alexlarsson
(cherry picked from commit b44c1a57993905da0a99e5b1f8f1bffd5bb25eee)
(cherry picked from commit 8ed03ef61edfa876745cf15f9c5f3e4d69e31751)
Closes: #3115
Approved by: alexlarsson
---
common/flatpak-dir.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c
index 3dcfd6e4c..e32af9cfa 100644
--- a/common/flatpak-dir.c
+++ b/common/flatpak-dir.c
@@ -2422,11 +2422,7 @@ flatpak_dir_get_origin (FlatpakDir *self,
deploy_data = flatpak_dir_get_deploy_data (self, ref, FLATPAK_DEPLOY_VERSION_ANY,
cancellable, error);
if (deploy_data == NULL)
- {
- g_set_error (error, FLATPAK_ERROR, FLATPAK_ERROR_NOT_INSTALLED,
- _("%s not installed"), ref);
- return NULL;
- }
+ return NULL;
return g_strdup (flatpak_deploy_data_get_origin (deploy_data));
}