Subject: bug#31846: 26.1; secrets.el can't create gnome keyring items/smtpmail.el can't get credentials from gnome keyring

From: Michael Albinus <[email-masked]>
Date: Sat, 16 Jun 2018 12:31:55 +0200

lebitso <[email-masked]> writes:

> Hello List,

Hi,

> my initial problem was that I can't send mails from mu4e anymore, when I
> try to it fails and gives the message
>
> I then found out that I can send mails if I enter the the credentials
> manually instead of getting them from gnome keyring as I usually do.
> So I looked into it and found there's another problem with secrets.el
> that i think is related.
>
> I'm on Arch Linux. Other Applications can create new items in the
> keyring without a problem. The only thing that I can think of that has
> changed since the last time I kno this worked is the upgrade to emacs26.
> The Problem does occur in the same way with emacs -Q as it does with my
> full configuration.
>
> I have no idea what could've caused it so I'd appreciate any feedback on
> whether you can reproduce this issue.

Confirmed, I can reproduce it with Emacs 26.

In Emacs 27.0.50, this is fixed already, by commit b3956d85c7 related to
bug#29575. Since this is part of a larger rewrite of secrets.el due to a
new feature, I cannot simply cherry-pick that commit from Emacs' master
branch to the emacs-26 branch. IIRC, the bug was uncovered while working
on the new feature, and it was fixed silently.

The appended patch seems to fix the problem in the emacs-26
branch. Could you, pls, check whether it works for you?

> Thanks,
> L.

Best regards, Michael.

diff --git a/lisp/net/secrets.el b/lisp/net/secrets.el
index fbb0a74978..c468548316 100644
--- a/lisp/net/secrets.el
+++ b/lisp/net/secrets.el
@@ -612,9 +612,9 @@ secrets-search-items
           (error 'wrong-type-argument (cadr attributes)))
 	(setq props (append
 		     props
-		     (list :dict-entry
-			   (substring (symbol-name (car attributes)) 1)
-			   (cadr attributes)))
+		     `((:dict-entry
+			,(substring (symbol-name (car attributes)) 1)
+			,(cadr attributes))))
 	      attributes (cddr attributes)))
       ;; Search.  The result is a list of object paths.
       (setq result
@@ -650,9 +650,9 @@ secrets-create-item
             (error 'wrong-type-argument (cadr attributes)))
 	  (setq props (append
 		       props
-		       (list :dict-entry
-			     (substring (symbol-name (car attributes)) 1)
-			     (cadr attributes)))
+		       `((:dict-entry
+			  ,(substring (symbol-name (car attributes)) 1)
+			  ,(cadr attributes))))
 		attributes (cddr attributes)))
 	;; Create the item.
 	(setq result