On 14.02.2016 18:05, Stef Walter wrote:
> On 14.02.2016 17:00, Neal H. Walfield wrote:
>> Hi,
>>
>> In pinentry, we have the problem that libsecret sometimes writes error
>> messages to stdout rather than stderr (specifically, we observe this
>> when libsecret can't reach the secret service), which confuses the
>> program using pinentry (it expects Assuan IPC on stdout).
> 
> Yup, that's a bug we should fix.
> 
> For reference, in Cockpit (which also uses GLib) we had issues with
> g_debug [or g_log(...G_LOG_LEVEL_DEBUG...)] messages hitting stdout. We
> had to work around that.
> 
>> The following bug report contains more details:
>>
>>   https://bugs.gnupg.org/gnupg/issue2243
>>
>> The relevant part is:
>>
>>   $ DBUS_SESSION_BUS_ADDRESS=awefwef pinentry
>>   OK Pleased to meet you
>>   OPTION allow-external-password-cache
>>   OK
>>   SETKEYINFO monkeyman
>>   OK
>>   GETPIN
>>   Failed to lookup password for key monkeyman with secret service: The name
>>   org.freedesktop.secrets was not provided by any .service files
> 
> Unless I'm misunderstanding, this bug is in pinentry:
> 
> pinentry$ git grep 'Failed to lookup password'
> pinentry/password-cache.c:      printf("Failed to lookup password for
> key %s with secret service: %s\n",

I couldn't figure out how to attach a patch to the issue listed above
(even though I registered), so here it is, attached.

Stef

>From 8f903815d28aebdfdad5637c059a49fd17b8cdcc Mon Sep 17 00:00:00 2001
From: Stef Walter <st...@redhat.com>
Date: Sun, 14 Feb 2016 18:06:52 +0100
Subject: [PATCH] pinentry: Use stderr to print failures in password-cache.c

Otherwise this interferes with the assuan protocol expected
on stdout.

https://bugs.gnupg.org/gnupg/issue2243
---
 pinentry/password-cache.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/pinentry/password-cache.c b/pinentry/password-cache.c
index 70b33f4..c98c4c5 100644
--- a/pinentry/password-cache.c
+++ b/pinentry/password-cache.c
@@ -83,7 +83,7 @@ password_cache_save (const char *keygrip, const char *password)
 				    "stored-by", "GnuPG Pinentry",
 				    "keygrip", keygrip, NULL))
     {
-      printf("Failed to cache password for key %s with secret service: %s\n",
+      fprintf (stderr, "Failed to cache password for key %s with secret service: %s\n",
 	     keygrip, error->message);
 
       g_error_free (error);
@@ -112,7 +112,7 @@ password_cache_lookup (const char *keygrip)
 
   if (error != NULL)
     {
-      printf("Failed to lookup password for key %s with secret service: %s\n",
+      fprintf (stderr, "Failed to lookup password for key %s with secret service: %s\n",
 	     keygrip, error->message);
       g_error_free (error);
       return NULL;
@@ -126,7 +126,7 @@ password_cache_lookup (const char *keygrip)
   if (password2)
     strcpy(password2, password);
   else
-    printf("secmem_malloc failed: can't copy password!\n");
+    fprintf (stderr, "secmem_malloc failed: can't copy password!\n");
 
   secret_password_free (password);
 
@@ -148,7 +148,7 @@ password_cache_clear (const char *keygrip)
 					    "keygrip", keygrip, NULL);
   if (error != NULL)
     {
-      printf("Failed to clear password for key %s with secret service: %s\n",
+      fprintf (stderr, "Failed to clear password for key %s with secret service: %s\n",
 	     keygrip, error->message);
       g_debug("%s", error->message);
       g_error_free (error);
-- 
2.5.0

_______________________________________________
gnome-keyring-list mailing list
gnome-keyring-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gnome-keyring-list

Reply via email to