Control: reassign -1 gcr
NIIBE Yutaka <[email protected]> wrote:
> Now, I guess that the problem is in the implementaiton of libgcr library.
>
> While I'm reading gcr-3.20.0/gcr/gcr-gnupg-process.c, getting the source
> by apt source libgcr-base-3-1, I suspect the function
> _gcr_gnupg_process_run_async, which doesn't provide GPG_TTY and/or
> DISPLAY to "gpg" process.
Attached is a patch for gcr to fix this issue. When I apply this patch
to build libgcr-base-3-1 package (and install), the problem of seahorse
has gone.
I also created a ticket for GnuPG upstream to improve its documentation:
https://dev.gnupg.org/T3353
I put the patch in public domain, or it may be distributed
under the licence of LGPL-2.1+.
--
Index: gcr-3.20.0/gcr/Makefile.am
===================================================================
--- gcr-3.20.0.orig/gcr/Makefile.am
+++ gcr-3.20.0/gcr/Makefile.am
@@ -118,6 +118,7 @@ nodist_libgcr_base_@GCR_MAJOR@_la_SOURCE
libgcr_base_@GCR_MAJOR@_la_CFLAGS = \
$(LIBGCRYPT_CFLAGS) \
$(P11_KIT_CFLAGS) \
+ $(GTK_CFLAGS) \
-DGCK_API_SUBJECT_TO_CHANGE \
-DP11_KIT_API_SUBJECT_TO_CHANGE \
-DGCR_COMPILATION \
@@ -133,7 +134,8 @@ libgcr_base_@GCR_MAJOR@_la_LIBADD = \
libgck-@[email protected] \
$(GLIB_LIBS) \
$(LIBGCRYPT_LIBS) \
- $(P11_KIT_LIBS)
+ $(P11_KIT_LIBS) \
+ $(GTK_LIBS)
gcr/gcr-marshal.h: gcr/gcr-marshal.list $(GLIB_GENMARSHAL)
$(AM_V_GEN) $(GLIB_GENMARSHAL) $< --header --prefix=_gcr_marshal > $@
Index: gcr-3.20.0/gcr/gcr-gnupg-process.c
===================================================================
--- gcr-3.20.0.orig/gcr/gcr-gnupg-process.c
+++ gcr-3.20.0/gcr/gcr-gnupg-process.c
@@ -27,6 +27,7 @@
#include "gcr/gcr-marshal.h"
#include <glib/gi18n-lib.h>
+#include <gdk/gdk.h>
#include <sys/wait.h>
#include <fcntl.h>
@@ -971,6 +972,8 @@ _gcr_gnupg_process_run_async (GcrGnupgPr
GSource *source;
GPid pid;
guint i;
+ GdkDisplay *display;
+ const gchar *display_name;
g_return_if_fail (GCR_IS_GNUPG_PROCESS (self));
g_return_if_fail (argv);
@@ -996,6 +999,13 @@ _gcr_gnupg_process_run_async (GcrGnupgPr
child_fds[FD_OUTPUT] = 1;
child_fds[FD_ERROR] = 2;
+ if ((display = gdk_display_get_default ())
+ && (display_name = gdk_display_get_name (display)))
+ {
+ g_ptr_array_add (args, g_strdup ("--display"));
+ g_ptr_array_add (args, g_strdup (display_name));
+ }
+
if (flags & GCR_GNUPG_PROCESS_WITH_STATUS) {
if (pipe (status_fds) < 0)
g_return_if_reached ();