Re: [PATCH] gnome3: Redirect GLib logging messages to stderr

Daniel Kahn Gillmor <[email protected]>
Newsgroups gmane.comp.encryption.gpg.devel
Message-ID <[email protected]>
Thanks, kernc.

fwiw, i've applied this patch to pinentry in debian unstable.  I hope
upstream will consider it.

Regards,

         --dkg

On Tue 2026-08-18 04:22:52 +0200, Kernc wrote:
> By default, GLib/Gcr/libsecret outputs debug/info logging messages
> to stdout, but we use that as the Assuan channel, and outputting to
> it anything but the expected verbs breaks pinentry pipelines
> in confusing ways.
>
> It is unknown whether a similar patch is needed for gtk-2
> or other flavors via the 'CLEARPASSPHRASE' command,
> nor if G_MESSAGES_DEBUG needs unsetting from the environment.
>
> An old user reports Gtk-warnings even with pinentry-qt,
> but their issue needs more verification.
>
> https://web.archive.org/web/20260629091849/https://dev.gnupg.org/T4144.html
>
> Care must be placed in who inherits our Assuan fds
> and what they do with them.
>
> GnuPG-bug-id: 4144
> GnuPG-bug-id: 2243
> GnuPG-bug-id: 2397
> Signed-off-by: Kernc <[email protected]>
> ---
>  gnome3/pinentry-gnome3.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c
> index 7f21d6f..3692f49 100644
> --- a/gnome3/pinentry-gnome3.c
> +++ b/gnome3/pinentry-gnome3.c
> @@ -518,6 +518,13 @@ main (int argc, char *argv[])
>  {
>    pinentry_init (PGMNAME);
>
> +/* Prevent logging messages escaping to stdout (our Assuan channel). */
> +#if GLIB_CHECK_VERSION (2, 68, 0)
> +  g_log_writer_default_set_use_stderr (TRUE);
> +#else
> +  g_unsetenv ("G_MESSAGES_DEBUG");
> +#endif
> +
>  #ifdef FALLBACK_CURSES
>    if (!getenv ("DBUS_SESSION_BUS_ADDRESS"))
>      {
> -- 
> 2.47.3

_______________________________________________
Gnupg-devel mailing list
[email protected]
https://lists.gnupg.org/mailman/listinfo/gnupg-devel
signature.asc (application/pgp-signature, 324 B)
-----BEGIN PGP SIGNATURE-----

wr0EARYKAG8FgmqEnjQJEHgLhU7ZwrSWRxQAAAAAAB4AIHNhbHRAbm90YXRpb25z
LnNlcXVvaWEtcGdwLm9yZykuZmEtcWnwbhc5E62Ns8wtgD2Ldj5AVtNSk0UFX7Np
FiEEY6wRjlsuXWbIioWneAuFTtnCtJYAAKpHAQDVX1f7WQxmyuT6ApMRF14uIuCM
KPYp9yOnlIjrMsvW3AEArdhLSEZT+X/K1jd+NoxDRtarcU9aPVHuK9L+ZpGy5gU=
=9PKY
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.