upstream patch to fix running apps with pkexec [release 1.2.3-2mamba;Thu Feb 04 2016]

This commit is contained in:
Silvan Calarco 2024-01-06 04:16:18 +01:00
parent ab04aeecc4
commit f3a3108306
2 changed files with 75 additions and 1 deletions

View File

@ -0,0 +1,69 @@
From fad5a9a3e3a3148d1275b7ba048614aa4c7c0414 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lu=C3=ADs=20Pereira?= <luis.artur.pereira@gmail.com>
Date: Thu, 7 May 2015 21:57:42 +0300
Subject: [PATCH] Use G_SPAWN_DO_NOT_REAP_CHILD on application launch, that
should fix a problem with pkexec.
---
NEWS | 3 +++
src/base/fm-app-info.c | 19 ++++++++++++++++---
2 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/NEWS b/NEWS
index 60d70a1..964fd67 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,9 @@
* Fixed missing folder info update on folder attributes change.
+* Use G_SPAWN_DO_NOT_REAP_CHILD on application launch, that should fix
+ a problem with pkexec.
+
Changes on 1.2.3 since 1.2.2:
diff --git a/src/base/fm-app-info.c b/src/base/fm-app-info.c
index c374982..5bd4433 100644
--- a/src/base/fm-app-info.c
+++ b/src/base/fm-app-info.c
@@ -204,6 +204,15 @@ static void child_setup(gpointer user_data)
setpgid(0, data->pgid);
}
+static void child_watch(GPid pid, gint status, gpointer user_data)
+{
+ /*
+ * Ensure that we don't double fork and break pkexec
+ */
+ g_spawn_close_pid(pid);
+}
+
+
static char* expand_terminal(char* cmd, gboolean keep_open, GError** error)
{
FmTerminal* term;
@@ -246,6 +255,7 @@ static gboolean do_launch(GAppInfo* appinfo, const char* full_desktop_path,
int argc;
gboolean use_terminal;
GAppInfoCreateFlags flags;
+ GPid pid;
cmd = expand_exec_macros(appinfo, full_desktop_path, kf, inp, &gfiles);
if(G_LIKELY(kf))
@@ -315,9 +325,12 @@ static gboolean do_launch(GAppInfo* appinfo, const char* full_desktop_path,
data.pgid = getpgid(getppid());
ret = g_spawn_async(path, argv, NULL,
- G_SPAWN_SEARCH_PATH,
- child_setup, &data, NULL, err);
- if (!ret && data.sn_id)
+ G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
+ child_setup, &data, &pid, err);
+ if (ret)
+ /* Ensure that we don't double fork and break pkexec */
+ g_child_watch_add(pid, child_watch, NULL);
+ else if (data.sn_id)
/* Notify launch context about failure */
g_app_launch_context_launch_failed(ctx, data.sn_id);

View File

@ -1,6 +1,6 @@
Name: libfm
Version: 1.2.3
Release: 1mamba
Release: 2mamba
Summary: A library used by the PCMan File Manager
Group: System/Libraries
Vendor: openmamba
@ -13,6 +13,7 @@ URL: http://sourceforge.net/projects/pcmanfm
# make
# make dist
Source: http://downloads.sourceforge.net/project/pcmanfm/PCManFM%20%2B%20Libfm%20%28tarball%20release%29/LibFM/libfm-%{version}.tar.xz
Patch0: libfm-1.2.3-upstream-fix-pkexec.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
@ -60,6 +61,7 @@ This package contains static libraries and header files need for development.
%prep
%setup -q
%patch0 -p1
%build
%configure \
@ -132,6 +134,9 @@ fi
%doc README TODO
%changelog
* Thu Feb 04 2016 Silvan Calarco <silvan.calarco@mambasoft.it> 1.2.3-2mamba
- upstream patch to fix running apps with pkexec
* Sun Oct 26 2014 Silvan Calarco <silvan.calarco@mambasoft.it> 1.2.3-1mamba
- update to 1.2.3