intrigeri <intrig...@debian.org> wrote:
> Can you please take a look, and maybe attach an updated patch?

OK.

Attached is updated patch for gcr to fix this issue, by simply supplying
parent's environ untouched, intended to be put under debian/patches/.
While this patch fixes the particular issue, I think that more clean up
will be needed, perhaps.

The function g_spawn_async_with_pipes let inherit child process parent's
environ when envp=NULL.  By the change, _gcr_gnupg_process_run_async
does so for its envp, when GCR_GNUPG_PROCESS_RESPECT_LOCALE is
specified.

I put the patch in public domain, or it may be distributed
under the licence of LGPL-2.1+.

It is tested by seahorse and pinentry-gtk-2.
-- 
Index: gcr-3.20.0/gcr/gcr-gnupg-importer.c
===================================================================
--- gcr-3.20.0.orig/gcr/gcr-gnupg-importer.c
+++ gcr-3.20.0/gcr/gcr-gnupg-importer.c
@@ -330,7 +330,7 @@ _gcr_gnupg_importer_import_async (GcrImp
 	                                 _gcr_gnupg_importer_import_async);
 
 	_gcr_gnupg_process_run_async (self->pv->process, argv, NULL,
-	                              GCR_GNUPG_PROCESS_WITH_STATUS,
+	                              GCR_GNUPG_PROCESS_RESPECT_LOCALE|GCR_GNUPG_PROCESS_WITH_STATUS,
 	                              cancellable, on_process_run_complete,
 	                              g_object_ref (res));
 
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
@@ -1027,12 +1027,13 @@ _gcr_gnupg_process_run_async (GcrGnupgPr
 		    !g_str_has_prefix (envp[i], "LOCALE="))
 			g_ptr_array_add (envs, (gpointer)envp[i]);
 	}
-	if (!(flags & GCR_GNUPG_PROCESS_RESPECT_LOCALE))
-		g_ptr_array_add (envs, (gpointer)"LOCALE=C");
-	g_ptr_array_add (envs, NULL);
-
+	if (i || !(flags & GCR_GNUPG_PROCESS_RESPECT_LOCALE)) {
+		if (!(flags & GCR_GNUPG_PROCESS_RESPECT_LOCALE))
+			g_ptr_array_add (envs, (gpointer)"LOCALE=C");
+		g_ptr_array_add (envs, NULL);
+	}
 	gchar *command = g_strjoinv (" ", (gchar**)args->pdata);
-	gchar *environ = g_strjoinv (", ", (gchar**)envs->pdata);
+	gchar *environ = envs->pdata?g_strjoinv (", ", (gchar**)envs->pdata):NULL;
 	g_debug ("running command: %s", command);
 	g_debug ("process environment: %s", environ);
 	g_free (command);

Reply via email to