Refresh GDesktopAppInfo patchset

Resolves: #1951126

(cherry picked from Fedora commit a1b323b04a3442cfe9762e684505bfa4446d0fac)
This commit is contained in:
Michael Catanzaro 2021-04-28 10:02:04 -05:00 committed by Kalev Lember
parent 7f0a2ae49a
commit 64b41c01a2
5 changed files with 39 additions and 46 deletions

View File

@ -1,4 +1,4 @@
From 156ddbc49bc432262fd022efd9831f789fa32e64 Mon Sep 17 00:00:00 2001
From 5e42384cc4499293259a8a37a737014a56de34df Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Fri, 23 Oct 2020 18:20:01 +0200
Subject: [PATCH 1/4] tests: Iterate mainloop during launch test
@ -14,7 +14,7 @@ session bus.
1 file changed, 1 insertion(+)
diff --git a/gio/tests/desktop-app-info.c b/gio/tests/desktop-app-info.c
index 98601de4f..fb87bf2c2 100644
index fcc29c579..743230cbb 100644
--- a/gio/tests/desktop-app-info.c
+++ b/gio/tests/desktop-app-info.c
@@ -334,6 +334,7 @@ wait_for_file (const gchar *want_this,
@ -26,5 +26,5 @@ index 98601de4f..fb87bf2c2 100644
g_assert_cmpuint (retries, >, 0);
retries--;
--
2.29.2
2.31.1

View File

@ -1,4 +1,4 @@
From 1e4e58a73f12cded2d67f58571ea42906f3c3f94 Mon Sep 17 00:00:00 2001
From ba3b85a8fea0151e74de50e841a7f16f9b077a56 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Mon, 27 Jul 2020 22:22:32 +0200
Subject: [PATCH 2/4] gdesktopappinfo: Move launched applications into
@ -25,11 +25,11 @@ forget" manner, which is fine in most cases, but means that "gio open"
will fail to move the child into the new scope as gio quits before the
DBus call finishes.
---
gio/gdesktopappinfo.c | 263 ++++++++++++++++++++++++++++++++++++------
1 file changed, 228 insertions(+), 35 deletions(-)
gio/gdesktopappinfo.c | 264 ++++++++++++++++++++++++++++++++++++------
1 file changed, 227 insertions(+), 37 deletions(-)
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 1a4b97918..2f1e6828b 100644
index 1a4b97918..afdcd42ac 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -2730,6 +2730,148 @@ notify_desktop_launch (GDBusConnection *session_bus,
@ -250,7 +250,7 @@ index 1a4b97918..2f1e6828b 100644
if (launch_context)
{
GList *launched_files = create_files_for_uris (launched_uris);
@@ -2837,38 +2971,96 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
@@ -2837,38 +2971,93 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
* with a wrapper program (grep the GLib git history for
* `gio-launch-desktop` for an example of this which could be
* resurrected). */
@ -269,10 +269,7 @@ index 1a4b97918..2f1e6828b 100644
for (i = 0; i < argc; i++)
- wrapped_argv[i + G_N_ELEMENTS (wrapper_argv)] = g_steal_pointer (&argv[i]);
+ wrapped_argv[i + 6] = g_steal_pointer (&argv[i]);
- wrapped_argv[i + G_N_ELEMENTS (wrapper_argv)] = NULL;
- g_free (argv);
- argv = NULL;
+
+ wrapped_argv[i + 6] = NULL;
+ g_clear_pointer (&argv, g_free);
+
@ -288,7 +285,10 @@ index 1a4b97918..2f1e6828b 100644
+
+ /* Set CLOEXEC on the write pipe, so we don't need to deal with it in the child. */
+ fcntl (wrapper_data.pipe[1], F_SETFD, FD_CLOEXEC);
+
- wrapped_argv[i + G_N_ELEMENTS (wrapper_argv)] = NULL;
- g_free (argv);
- argv = NULL;
+ if (!(spawn_flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN))
+ {
+ /* In this case, we use a setup function (which could probably also
@ -332,11 +332,10 @@ index 1a4b97918..2f1e6828b 100644
if (sn_id)
g_app_launch_context_launch_failed (launch_context, sn_id);
g_free (sn_id);
g_list_free (launched_uris);
- goto out;
+ goto err;
- g_free (sn_id);
- g_list_free (launched_uris);
-
goto out;
}
+#if defined(__linux__) && !defined(__BIONIC__)
@ -357,7 +356,7 @@ index 1a4b97918..2f1e6828b 100644
if (pid_callback != NULL)
pid_callback (info, pid, pid_callback_data);
@@ -2893,19 +3085,20 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
@@ -2893,19 +3082,20 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
sn_id,
launched_uris);
@ -385,5 +384,5 @@ index 1a4b97918..2f1e6828b 100644
return completed;
}
--
2.29.2
2.31.1

View File

@ -1,4 +1,4 @@
From d13a15a0c569348cfd5aa207ee219b73117e938c Mon Sep 17 00:00:00 2001
From cd67a1b0256d2397dac0836e154f3449b63a6b19 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Tue, 28 Jul 2020 12:11:13 +0200
Subject: [PATCH 3/4] gdesktopappinfo: Handle task completion from spawn
@ -11,11 +11,11 @@ This fixes the behaviour of the previous commit which would not
correctly move the process into the scope if the application exited
right after the task returned.
---
gio/gdesktopappinfo.c | 214 +++++++++++++++++++++++++++++-------------
1 file changed, 147 insertions(+), 67 deletions(-)
gio/gdesktopappinfo.c | 212 +++++++++++++++++++++++++++++-------------
1 file changed, 146 insertions(+), 66 deletions(-)
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 2f1e6828b..743027422 100644
index afdcd42ac..8d0f1688e 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -2849,11 +2849,17 @@ create_systemd_scope (GDBusConnection *session_bus,
@ -160,16 +160,7 @@ index 2f1e6828b..743027422 100644
{
#if defined(__linux__) && !defined(__BIONIC__)
close (wrapper_data.pipe[0]);
@@ -3043,7 +3091,7 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
g_free (sn_id);
g_list_free (launched_uris);
- goto err;
+ goto out;
}
#if defined(__linux__) && !defined(__BIONIC__)
@@ -3052,11 +3100,29 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
@@ -3049,11 +3097,29 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
close (wrapper_data.pipe[0]);
if (session_bus)
@ -204,7 +195,7 @@ index 2f1e6828b..743027422 100644
else
close (wrapper_data.pipe[1]);
#endif
@@ -3091,8 +3157,6 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
@@ -3088,8 +3154,6 @@ g_desktop_app_info_launch_uris_with_spawn (GDesktopAppInfo *info,
}
while (dup_uris != NULL);
@ -213,7 +204,7 @@ index 2f1e6828b..743027422 100644
out:
g_strfreev (argv);
g_strfreev (envp);
@@ -3100,7 +3164,52 @@ out:
@@ -3097,7 +3161,52 @@ out:
g_list_free (launched_uris);
g_free (sn_id);
@ -267,7 +258,7 @@ index 2f1e6828b..743027422 100644
}
static gchar *
@@ -3249,17 +3358,9 @@ g_desktop_app_info_launch_uris_internal (GAppInfo *appinfo,
@@ -3246,17 +3355,9 @@ g_desktop_app_info_launch_uris_internal (GAppInfo *appinfo,
success = g_desktop_app_info_launch_uris_with_spawn (info, session_bus, info->exec, uris, launch_context,
spawn_flags, user_setup, user_setup_data,
pid_callback, pid_callback_data,
@ -287,7 +278,7 @@ index 2f1e6828b..743027422 100644
return success;
}
@@ -3313,18 +3414,6 @@ launch_uris_with_dbus_cb (GObject *object,
@@ -3310,18 +3411,6 @@ launch_uris_with_dbus_cb (GObject *object,
g_object_unref (task);
}
@ -306,7 +297,7 @@ index 2f1e6828b..743027422 100644
static void
launch_uris_bus_get_cb (GObject *object,
GAsyncResult *result,
@@ -3333,12 +3422,20 @@ launch_uris_bus_get_cb (GObject *object,
@@ -3330,12 +3419,20 @@ launch_uris_bus_get_cb (GObject *object,
GTask *task = G_TASK (user_data);
GDesktopAppInfo *info = G_DESKTOP_APP_INFO (g_task_get_source_object (task));
LaunchUrisData *data = g_task_get_task_data (task);
@ -328,7 +319,7 @@ index 2f1e6828b..743027422 100644
if (session_bus && info->app_id)
{
/* FIXME: The g_document_portal_add_documents() function, which is called
@@ -3346,34 +3443,21 @@ launch_uris_bus_get_cb (GObject *object,
@@ -3343,34 +3440,21 @@ launch_uris_bus_get_cb (GObject *object,
* uses blocking calls.
*/
g_desktop_app_info_launch_uris_with_dbus (info, session_bus,
@ -367,7 +358,7 @@ index 2f1e6828b..743027422 100644
g_clear_object (&session_bus);
}
@@ -5189,16 +5273,12 @@ g_desktop_app_info_launch_action (GDesktopAppInfo *info,
@@ -5186,16 +5270,12 @@ g_desktop_app_info_launch_action (GDesktopAppInfo *info,
if (exec_line)
g_desktop_app_info_launch_uris_with_spawn (info, session_bus, exec_line, NULL, launch_context,
_SPAWN_FLAGS_DEFAULT, NULL, NULL, NULL, NULL,
@ -387,5 +378,5 @@ index 2f1e6828b..743027422 100644
/* Epilogue {{{1 */
--
2.29.2
2.31.1

View File

@ -1,4 +1,4 @@
From 67d764ecd52b4f7e972eb355a41cd90b8dcca10c Mon Sep 17 00:00:00 2001
From 8da8a3ef6df8af6de8bd388192bebe8b51b3e782 Mon Sep 17 00:00:00 2001
From: Benjamin Berg <bberg@redhat.com>
Date: Thu, 17 Sep 2020 17:35:58 +0200
Subject: [PATCH 4/4] gdesktopappinfo: Add SourcePath= to transient systemd
@ -14,7 +14,7 @@ See https://invent.kde.org/frameworks/kio/-/merge_requests/124
1 file changed, 13 insertions(+)
diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c
index 743027422..1b763b76c 100644
index 8d0f1688e..a833de4e6 100644
--- a/gio/gdesktopappinfo.c
+++ b/gio/gdesktopappinfo.c
@@ -2777,6 +2777,7 @@ create_systemd_scope (GDBusConnection *session_bus,
@ -52,5 +52,5 @@ index 743027422..1b763b76c 100644
"(sv)",
"PIDs",
--
2.29.2
2.31.1

View File

@ -1,6 +1,6 @@
Name: glib2
Version: 2.68.1
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A library of handy utility functions
License: LGPLv2+
@ -241,6 +241,9 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &> /dev/null || :
%{_datadir}/installed-tests
%changelog
* Wed Apr 28 2021 Michael Catanzaro <mcatanzaro@redhat.com> - 2.68.1-2
- Refresh GDesktopAppInfo patchset
* Thu Apr 08 2021 Kalev Lember <klember@redhat.com> - 2.68.1-1
- Update to 2.68.1