[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#991512: unblock: flatpak/1.10.2-3 (pre-approval)



Package: release.debian.org
Severity: normal
User: release.debian.org@packages.debian.org
Usertags: unblock

[ Reason ]
Apply the same bug fixes that are likely to be in upstream stable release
1.10.3.

[ Impact ]
Maintenance: If we have these changes, it'll be more straightforward to
review a potential future stable update to the final 1.10.3 release.

d/p/system-helper-Fix-deploys-of-local-remotes.patch:
If missing, flatpak and GNOME Software might fail to upgrade some Flatpak
apps. It isn't 100% clear whether this can affect pure bullseye systems, or
only systems with an upgraded (experimental or bookworm) version of GLib.

d/p/create-usb-Skip-copying-extra-data-flatpaks.patch:
If missing, `flatpak create-usb` will create USB media on which not
everything can be installed while offline, which slightly defeats the
purpose of copying Flatpak apps to USB media.

[ Tests ]
Smoke-tested manually, and tested in autopkgtest on qemu. Most of the
autopkgtest coverage is skipped on ci.debian.net because bubblewrap and
lxc are incompatible, but it runs in qemu.

d/p/system-helper-Fix-deploys-of-local-remotes.patch is also in Ubuntu
(to fix the tests with an upgraded GLib), and Fedora developers reported
that applying this patch solves a similar upgrade failure in GNOME Software.

Both patches are backported from the development release 1.11.1, which is
getitng more real-world testing than most development releases because it's
required for some Steam use-cases (I intend to make that version available
in bullseye-backports as soon as that suite is open).

[ Risks ]
It's a key package, but I think these changes have low regression risk.

d/p/system-helper-Fix-deploys-of-local-remotes.patch is quite
straightforward. c8b9069a-ignore-space-change.diff is an easier-to-review
version, from `git show --ignore-space-change c8b9069a`.

d/p/create-usb-Skip-copying-extra-data-flatpaks.patch changes the
implementation of a rarely-used command, so even if it breaks completely,
few Debian users will notice. The change came from endlessOS, which is
one of the few environments where `flatpak create-usb` is actively used.

[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing

[ Other info ]
We should have a 1.10.3 release soon, but the primary upstream maintainer
is currently on vacation, so it might miss the deadline for bullseye.
I would like to track the 1.10.x branch in bullseye stable/security updates.

unblock flatpak/1.10.2-3
diffstat for flatpak-1.10.2 flatpak-1.10.2

 changelog                                                          |   26 +
 patches/create-usb-Skip-copying-extra-data-flatpaks.patch          |  112 ++++++++
 patches/portal-Don-t-leak-fd-used-for-serialized-environment.patch |    1 
 patches/portal-Remap-env-fd-into-child-process-s-fd-space.patch    |    1 
 patches/portal-Use-a-GArray-to-store-fds.patch                     |    1 
 patches/series                                                     |    4 
 patches/system-helper-Fix-deploys-of-local-remotes.patch           |  132 ++++++++++
 patches/tests-Remove-hard-coded-references-to-x86_64.patch         |    1 
 8 files changed, 277 insertions(+), 1 deletion(-)

diff -Nru flatpak-1.10.2/debian/changelog flatpak-1.10.2/debian/changelog
--- flatpak-1.10.2/debian/changelog	2021-06-22 10:10:38.000000000 +0100
+++ flatpak-1.10.2/debian/changelog	2021-07-25 20:44:58.000000000 +0100
@@ -1,3 +1,29 @@
+flatpak (1.10.2-3) unstable; urgency=medium
+
+  * d/patches: Align with upstream flatpak-1.10.x branch, making this
+    effectively a release candidate for upstream stable release 1.10.3
+    - d/patches: Update metadata to reflect upstream flatpak-1.10.x branch.
+      All the patches we apply in Debian are expected to be released in
+      1.10.3 upstream, but not all were annotated to reflect this.
+    - d/p/system-helper-Fix-deploys-of-local-remotes.patch:
+      Fix some failures to update in GNOME Software and the unit tests.
+      This change was previously applied in Ubuntu's flatpak_1.10.2-1ubuntu1
+      to fix a unit test failure, possibly triggered by a newer version of
+      GLib. It has also been reported to fix a failure to upgrade Flatpak
+      apps using GNOME Software, this time in Fedora.
+    - d/p/create-usb-Skip-copying-extra-data-flatpaks.patch:
+      Skip flatpaks with "extra-data" when using `flatpak create-usb`.
+      This command is intended to create USB drives that can be
+      used to install Flatpak apps and/or runtimes while offline,
+      but the "extra-data" feature downloads extra content for an app
+      or runtime at install time, as a way to automate installation of
+      data that can be re-downloaded by end users but is not licensed
+      for redistribution by Flatpak repositories. Such apps and runtimes
+      would fail to install while offline.
+    - d/p/series: Re-order patches to match upstream flatpak-1.10.x branch
+
+ -- Simon McVittie <smcv@debian.org>  Sun, 25 Jul 2021 20:44:58 +0100
+
 flatpak (1.10.2-2) unstable; urgency=medium
 
   * Backport changes from upstream git to fix regressions when apps invoke
diff -Nru flatpak-1.10.2/debian/patches/create-usb-Skip-copying-extra-data-flatpaks.patch flatpak-1.10.2/debian/patches/create-usb-Skip-copying-extra-data-flatpaks.patch
--- flatpak-1.10.2/debian/patches/create-usb-Skip-copying-extra-data-flatpaks.patch	1970-01-01 01:00:00.000000000 +0100
+++ flatpak-1.10.2/debian/patches/create-usb-Skip-copying-extra-data-flatpaks.patch	2021-07-25 20:44:58.000000000 +0100
@@ -0,0 +1,112 @@
+From: Phaedrus Leeds <mwleeds@endlessos.org>
+Date: Tue, 23 Mar 2021 15:16:17 -0700
+Subject: create-usb: Skip copying extra-data flatpaks
+
+Currently the create-usb command copies extra-data flatpaks such as the
+org.freedesktop.Platform.openh264 runtime extension along with normal
+non-extra-data content. This is an issue because on the computer
+installing from the USB it will attempt to get the extra-data content
+from the URI specified in the commit metadata, which will fail if the
+URI is a resource on the Internet and the computer is offline.
+
+Instead, have create-usb omit such refs. If it was specified explicitly
+this is treated as a hard error and if it's a dependency it's treated as
+a warning, so that e.g. org.freedesktop.Platform can still be copied to
+a USB and installed/updated offline. On the receiving end the absence of
+org.freedesktop.Platform.openh264 will correctly not be treated as fatal
+to the installation of org.freedesktop.Platform.
+
+This issue was affecting offline updates of Endless OS, since such OS
+updates include flatpaks along with the OS content.
+
+For the (legally questionable) topic of properly supporting extra-data
+distribution offline, see https://github.com/flatpak/flatpak/issues/969
+
+Applied-upstream: 1.11.1, commit:0bf8cf9a08c8a7c6af3fc90100185051a76cd410
+Applied-upstream: 1.10.3, commit:a539691dcacd5172a3e51c1785cb191040bf49a5
+---
+ app/flatpak-builtins-create-usb.c | 36 +++++++++++++++++++++++++++++++++++-
+ 1 file changed, 35 insertions(+), 1 deletion(-)
+
+diff --git a/app/flatpak-builtins-create-usb.c b/app/flatpak-builtins-create-usb.c
+index a06bdc4..45f9a2e 100644
+--- a/app/flatpak-builtins-create-usb.c
++++ b/app/flatpak-builtins-create-usb.c
+@@ -144,6 +144,7 @@ add_related (GHashTable        *all_refs,
+       const char *ext_remote;
+       const char *ext_commit = NULL;
+       CommitAndSubpaths *c_s;
++      g_autoptr(GVariant) extra_data_sources = NULL;
+ 
+       if (ext->is_unmaintained)
+         continue;
+@@ -176,6 +177,17 @@ add_related (GHashTable        *all_refs,
+         }
+ 
+       ext_commit = flatpak_deploy_data_get_commit (ext_deploy_data);
++
++      /* Emit a warning and omit it if it's extra-data
++       * https://github.com/flatpak/flatpak/issues/969 */
++      extra_data_sources = flatpak_repo_get_extra_data_sources (flatpak_dir_get_repo (dir), ext_commit, NULL, NULL);
++      if (extra_data_sources != NULL && g_variant_n_children (extra_data_sources) > 0)
++        {
++           g_printerr (_("Warning: Omitting related ref ‘%s’ because it's extra-data.\n"),
++                       flatpak_decomposed_get_ref (ext->ref));
++           continue;
++        }
++
+       ext_subpaths = flatpak_deploy_data_get_subpaths (ext_deploy_data);
+       resolved_ext_subpaths = get_flatpak_subpaths_from_deploy_subpaths (ext_subpaths);
+       c_s = commit_and_subpaths_new (ext_commit, (const char * const *) resolved_ext_subpaths);
+@@ -214,7 +226,7 @@ add_runtime (GHashTable        *all_refs,
+   const char *commit = NULL;
+   const char *runtime_commit = NULL;
+   CommitAndSubpaths *c_s;
+-
++  g_autoptr(GVariant) extra_data_sources = NULL;
+ 
+   g_debug ("Finding the runtime for ‘%s’", flatpak_decomposed_get_ref (ref));
+ 
+@@ -250,6 +262,17 @@ add_runtime (GHashTable        *all_refs,
+                          runtime_remote, flatpak_decomposed_get_ref (runtime_ref));
+ 
+   runtime_commit = flatpak_deploy_data_get_commit (runtime_deploy_data);
++
++  /* Emit a warning and omit it if it's extra-data
++   * https://github.com/flatpak/flatpak/issues/969 */
++  extra_data_sources = flatpak_repo_get_extra_data_sources (flatpak_dir_get_repo (dir), runtime_commit, NULL, NULL);
++  if (extra_data_sources != NULL && g_variant_n_children (extra_data_sources) > 0)
++    {
++       g_printerr (_("Warning: Omitting ref ‘%s’ (runtime of ‘%s’) because it's extra-data.\n"),
++                   flatpak_decomposed_get_ref (runtime_ref), flatpak_decomposed_get_ref (ref));
++       return TRUE;
++    }
++
+   runtime_subpaths = flatpak_deploy_data_get_subpaths (runtime_deploy_data);
+   resolved_runtime_subpaths = get_flatpak_subpaths_from_deploy_subpaths (runtime_subpaths);
+   c_s = commit_and_subpaths_new (runtime_commit, (const char * const *) resolved_runtime_subpaths);
+@@ -633,6 +656,7 @@ flatpak_builtin_create_usb (int argc, char **argv, GCancellable *cancellable, GE
+       /* Add the main ref */
+       {
+         g_autoptr(GBytes) deploy_data = NULL;
++        g_autoptr(GVariant) extra_data_sources = NULL;
+         const char *commit;
+         CommitAndSubpaths *c_s;
+ 
+@@ -645,6 +669,16 @@ flatpak_builtin_create_usb (int argc, char **argv, GCancellable *cancellable, GE
+                       flatpak_decomposed_get_ref (installed_ref));
+ 
+         commit = flatpak_deploy_data_get_commit (deploy_data);
++
++        /* Extra-data flatpaks can't be copied to a USB (the installation will
++         * fail on the receiving end if they're offline) so error out if one
++         * was specified. https://github.com/flatpak/flatpak/issues/969 */
++        extra_data_sources = flatpak_repo_get_extra_data_sources (flatpak_dir_get_repo (dir), commit, NULL, NULL);
++        if (extra_data_sources != NULL && g_variant_n_children (extra_data_sources) > 0)
++          return flatpak_fail (error,
++                               _("Installed ref ‘%s’ is extra-data, and cannot be distributed offline"),
++                               flatpak_decomposed_get_ref (installed_ref));
++
+         c_s = commit_and_subpaths_new (commit, NULL);
+ 
+         g_hash_table_insert (all_collection_ids, g_strdup (ref_collection_id), g_strdup (remote));
diff -Nru flatpak-1.10.2/debian/patches/portal-Don-t-leak-fd-used-for-serialized-environment.patch flatpak-1.10.2/debian/patches/portal-Don-t-leak-fd-used-for-serialized-environment.patch
--- flatpak-1.10.2/debian/patches/portal-Don-t-leak-fd-used-for-serialized-environment.patch	2021-06-22 10:10:38.000000000 +0100
+++ flatpak-1.10.2/debian/patches/portal-Don-t-leak-fd-used-for-serialized-environment.patch	2021-07-25 20:44:58.000000000 +0100
@@ -9,6 +9,7 @@
 Fixes: aeb6a7ab "portal: Convert --env in extra-args into --env-fd"
 Signed-off-by: Simon McVittie <smcv@collabora.com>
 Origin: upstream, 1.11.2, commit:f2fbc75827a58cc6b4cba48a0c895c3313274020
+Applied-upstream: 1.10.3, commit:b4c6aa1cc88625db8b5a26313b34bad3e7c2ed56
 Forwarded: https://github.com/flatpak/flatpak/pull/4322
 ---
  portal/flatpak-portal.c | 7 ++++---
diff -Nru flatpak-1.10.2/debian/patches/portal-Remap-env-fd-into-child-process-s-fd-space.patch flatpak-1.10.2/debian/patches/portal-Remap-env-fd-into-child-process-s-fd-space.patch
--- flatpak-1.10.2/debian/patches/portal-Remap-env-fd-into-child-process-s-fd-space.patch	2021-06-22 10:10:38.000000000 +0100
+++ flatpak-1.10.2/debian/patches/portal-Remap-env-fd-into-child-process-s-fd-space.patch	2021-07-25 20:44:58.000000000 +0100
@@ -10,6 +10,7 @@
 Fixes: aeb6a7ab "portal: Convert --env in extra-args into --env-fd"
 Signed-off-by: Simon McVittie <smcv@collabora.com>
 Origin: upstream, 1.11.2, commit:526dae92418616c71517945e810227416f160ce6
+Applied-upstream: 1.10.3, commit:101a3c5515ccf79d156a1b5272a2e8d7cc90c86a
 Forwarded: https://github.com/flatpak/flatpak/pull/4322
 ---
  portal/flatpak-portal.c | 12 ++++++++++--
diff -Nru flatpak-1.10.2/debian/patches/portal-Use-a-GArray-to-store-fds.patch flatpak-1.10.2/debian/patches/portal-Use-a-GArray-to-store-fds.patch
--- flatpak-1.10.2/debian/patches/portal-Use-a-GArray-to-store-fds.patch	2021-06-22 10:10:38.000000000 +0100
+++ flatpak-1.10.2/debian/patches/portal-Use-a-GArray-to-store-fds.patch	2021-07-25 20:44:58.000000000 +0100
@@ -12,6 +12,7 @@
 Helps: flatpak/flatpak#4286
 Signed-off-by: Simon McVittie <smcv@collabora.com>
 Origin: upstream, 1.11.2, commit:a09d07f085d85efdf34934ecc864a6a5ce9af761
+Applied-upstream: 1.10.3, commit:77b484cb2e4d7c8ce5937f6c7f3055755980de06
 Forwarded: https://github.com/flatpak/flatpak/pull/4322
 ---
  portal/flatpak-portal.c | 81 +++++++++++++++++++++++++------------------------
diff -Nru flatpak-1.10.2/debian/patches/series flatpak-1.10.2/debian/patches/series
--- flatpak-1.10.2/debian/patches/series	2021-06-22 10:10:38.000000000 +0100
+++ flatpak-1.10.2/debian/patches/series	2021-07-25 20:44:58.000000000 +0100
@@ -1,5 +1,7 @@
-tests-Remove-hard-coded-references-to-x86_64.patch
+create-usb-Skip-copying-extra-data-flatpaks.patch
 Fix-several-memory-leaks.patch
 portal-Don-t-leak-fd-used-for-serialized-environment.patch
 portal-Use-a-GArray-to-store-fds.patch
 portal-Remap-env-fd-into-child-process-s-fd-space.patch
+tests-Remove-hard-coded-references-to-x86_64.patch
+system-helper-Fix-deploys-of-local-remotes.patch
diff -Nru flatpak-1.10.2/debian/patches/system-helper-Fix-deploys-of-local-remotes.patch flatpak-1.10.2/debian/patches/system-helper-Fix-deploys-of-local-remotes.patch
--- flatpak-1.10.2/debian/patches/system-helper-Fix-deploys-of-local-remotes.patch	1970-01-01 01:00:00.000000000 +0100
+++ flatpak-1.10.2/debian/patches/system-helper-Fix-deploys-of-local-remotes.patch	2021-07-25 20:44:58.000000000 +0100
@@ -0,0 +1,132 @@
+From: Alexander Larsson <alexl@redhat.com>
+Date: Wed, 17 Mar 2021 17:12:32 +0100
+Subject: system-helper: Fix deploys of local remotes
+
+For updates in remotes with a local (file:) uri we just do a deploy
+with a LOCAL_PULL flag set and an empty arg_repo_path. However, our
+arg_repo_path checking at some point seemed to stop properly handling
+the case where it is empty. I got it to report "No such file" wich
+broke the tests.
+
+(cherry picked from commit 49e8bfcea516e96eb950109d0fa45811a352a517)
+
+Bug: https://github.com/flatpak/flatpak/issues/4339
+Bug: https://gitlab.gnome.org/GNOME/gnome-software/-/issues/1204
+Origin: upstream, 1.11.1, commit:49e8bfcea516e96eb950109d0fa45811a352a517
+Applied-upstream: 1.10.3, commit:c8b9069ab1d894f0f3a30e34f0865ee0287ec7a1
+---
+ system-helper/flatpak-system-helper.c | 89 ++++++++++++++++++-----------------
+ 1 file changed, 46 insertions(+), 43 deletions(-)
+
+diff --git a/system-helper/flatpak-system-helper.c b/system-helper/flatpak-system-helper.c
+index b202c94..adcfe61 100644
+--- a/system-helper/flatpak-system-helper.c
++++ b/system-helper/flatpak-system-helper.c
+@@ -410,61 +410,64 @@ handle_deploy (FlatpakSystemHelper   *object,
+       return G_DBUS_METHOD_INVOCATION_HANDLED;
+     }
+ 
+-  src_dir = g_path_get_dirname (arg_repo_path);
+-  ongoing_pull = take_ongoing_pull_by_dir (src_dir);
+-  if (ongoing_pull != NULL)
++  if ((arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL) != 0)
+     {
+-      g_autoptr(GError) local_error = NULL;
+-      uid_t uid;
++      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
++                                             "Unsupported flags enabled: 0x%x", (arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL));
++      return G_DBUS_METHOD_INVOCATION_HANDLED;
++    }
+ 
+-      /* Ensure that pull's uid is same as the caller's uid */
+-      if (!get_connection_uid (invocation, &uid, &local_error))
++  if (strlen (arg_repo_path) > 0)
++    {
++      if (!g_file_query_exists (repo_file, NULL))
+         {
+-          g_dbus_method_invocation_return_gerror (invocation, local_error);
++          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
++                                                 "Path does not exist");
+           return G_DBUS_METHOD_INVOCATION_HANDLED;
+         }
+-      else
++
++      src_dir = g_path_get_dirname (arg_repo_path);
++      ongoing_pull = take_ongoing_pull_by_dir (src_dir);
++      if (ongoing_pull != NULL)
+         {
+-          if (ongoing_pull->uid != uid)
++          g_autoptr(GError) local_error = NULL;
++          uid_t uid;
++
++          /* Ensure that pull's uid is same as the caller's uid */
++          if (!get_connection_uid (invocation, &uid, &local_error))
+             {
+-              g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+-                                                     "Ongoing pull's uid(%d) does not match with peer uid(%d)",
+-                                                     ongoing_pull->uid, uid);
++              g_dbus_method_invocation_return_gerror (invocation, local_error);
+               return G_DBUS_METHOD_INVOCATION_HANDLED;
+             }
+-        }
+-
+-      terminate_revokefs_backend (ongoing_pull);
+-
+-      if (!flatpak_canonicalize_permissions (AT_FDCWD,
+-                                             arg_repo_path,
+-                                             getuid() == 0 ? 0 : -1,
+-                                             getuid() == 0 ? 0 : -1,
+-                                             &local_error))
+-        {
+-          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
+-                                                 "Failed to canonicalize permissions of repo %s: %s",
+-                                                 arg_repo_path, local_error->message);
+-          return G_DBUS_METHOD_INVOCATION_HANDLED;
+-        }
++          else
++            {
++              if (ongoing_pull->uid != uid)
++                {
++                  g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
++                                                         "Ongoing pull's uid(%d) does not match with peer uid(%d)",
++                                                         ongoing_pull->uid, uid);
++                  return G_DBUS_METHOD_INVOCATION_HANDLED;
++                }
++            }
+ 
+-      /* At this point, the cache-dir's repo is owned by root. Hence, any failure
+-       * from here on, should always cleanup the cache-dir and not preserve it to be re-used. */
+-      ongoing_pull->preserve_pull = FALSE;
+-    }
++          terminate_revokefs_backend (ongoing_pull);
+ 
+-  if ((arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL) != 0)
+-    {
+-      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+-                                             "Unsupported flags enabled: 0x%x", (arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL));
+-      return G_DBUS_METHOD_INVOCATION_HANDLED;
+-    }
++          if (!flatpak_canonicalize_permissions (AT_FDCWD,
++                                                 arg_repo_path,
++                                                 getuid() == 0 ? 0 : -1,
++                                                 getuid() == 0 ? 0 : -1,
++                                                 &local_error))
++            {
++              g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_FAILED,
++                                                     "Failed to canonicalize permissions of repo %s: %s",
++                                                     arg_repo_path, local_error->message);
++              return G_DBUS_METHOD_INVOCATION_HANDLED;
++            }
+ 
+-  if (!g_file_query_exists (repo_file, NULL))
+-    {
+-      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+-                                             "Path does not exist");
+-      return G_DBUS_METHOD_INVOCATION_HANDLED;
++          /* At this point, the cache-dir's repo is owned by root. Hence, any failure
++           * from here on, should always cleanup the cache-dir and not preserve it to be re-used. */
++          ongoing_pull->preserve_pull = FALSE;
++        }
+     }
+ 
+   ref = flatpak_decomposed_new_from_ref (arg_ref, &error);
diff -Nru flatpak-1.10.2/debian/patches/tests-Remove-hard-coded-references-to-x86_64.patch flatpak-1.10.2/debian/patches/tests-Remove-hard-coded-references-to-x86_64.patch
--- flatpak-1.10.2/debian/patches/tests-Remove-hard-coded-references-to-x86_64.patch	2021-06-22 10:10:38.000000000 +0100
+++ flatpak-1.10.2/debian/patches/tests-Remove-hard-coded-references-to-x86_64.patch	2021-07-25 20:44:58.000000000 +0100
@@ -8,6 +8,7 @@
 Signed-off-by: Simon McVittie <smcv@collabora.com>
 Forwarded: https://github.com/flatpak/flatpak/pull/4142
 Applied-upstream: 1.11.0, commit:ba381ae9368c0e6e233c52254e698f5f64903036
+Applied-upstream: 1.10.3, commit:4089b6976938b43de6f165e89a3850222505df33
 ---
  tests/test-oci.sh    | 2 +-
  tests/test-unused.sh | 2 +-
commit c8b9069ab1d894f0f3a30e34f0865ee0287ec7a1
Author: Alexander Larsson <alexl@redhat.com>
Date:   2021-03-17 17:12:32 +0100

    system-helper: Fix deploys of local remotes
    
    For updates in remotes with a local (file:) uri we just do a deploy
    with a LOCAL_PULL flag set and an empty arg_repo_path. However, our
    arg_repo_path checking at some point seemed to stop properly handling
    the case where it is empty. I got it to report "No such file" wich
    broke the tests.
    
    (cherry picked from commit 49e8bfcea516e96eb950109d0fa45811a352a517)
    
    Fixes: #4339

diff --git a/system-helper/flatpak-system-helper.c b/system-helper/flatpak-system-helper.c
index b202c9410..adcfe61a8 100644
--- a/system-helper/flatpak-system-helper.c
+++ b/system-helper/flatpak-system-helper.c
@@ -410,6 +410,22 @@ handle_deploy (FlatpakSystemHelper   *object,
       return G_DBUS_METHOD_INVOCATION_HANDLED;
     }
 
+  if ((arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL) != 0)
+    {
+      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                             "Unsupported flags enabled: 0x%x", (arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL));
+      return G_DBUS_METHOD_INVOCATION_HANDLED;
+    }
+
+  if (strlen (arg_repo_path) > 0)
+    {
+      if (!g_file_query_exists (repo_file, NULL))
+        {
+          g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
+                                                 "Path does not exist");
+          return G_DBUS_METHOD_INVOCATION_HANDLED;
+        }
+
       src_dir = g_path_get_dirname (arg_repo_path);
       ongoing_pull = take_ongoing_pull_by_dir (src_dir);
       if (ongoing_pull != NULL)
@@ -452,19 +468,6 @@ handle_deploy (FlatpakSystemHelper   *object,
            * from here on, should always cleanup the cache-dir and not preserve it to be re-used. */
           ongoing_pull->preserve_pull = FALSE;
         }
-
-  if ((arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL) != 0)
-    {
-      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
-                                             "Unsupported flags enabled: 0x%x", (arg_flags & ~FLATPAK_HELPER_DEPLOY_FLAGS_ALL));
-      return G_DBUS_METHOD_INVOCATION_HANDLED;
-    }
-
-  if (!g_file_query_exists (repo_file, NULL))
-    {
-      g_dbus_method_invocation_return_error (invocation, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS,
-                                             "Path does not exist");
-      return G_DBUS_METHOD_INVOCATION_HANDLED;
     }
 
   ref = flatpak_decomposed_new_from_ref (arg_ref, &error);

Reply to: