Subject: 26.1; secrets-search-items broken on type error

From: Allen Li <[email-masked]>
Date: Mon, 9 Jul 2018 02:41:12 -0700

I think there is a regression in secrets-search-items.  I have
encountered it multiple times, and I am filing a bug now that I'm
convinced it is not a transitory problem.

Most recently, I encountered this error through smtpmail:

Debugger entered--Lisp error: (wrong-type-argument consp "host")
  dbus-message-internal(1 :session "org.freedesktop.secrets"
"/org/freedesktop/secrets/collection/login"
"org.freedesktop.Secret.Collection" "SearchItems"
dbus-call-method-handler (:array :dict-entry "host" "smtp.gmail.com"
:dict-entry "port" "587"))
  apply(dbus-message-internal 1 :session "org.freedesktop.secrets"
"/org/freedesktop/secrets/collection/login"
"org.freedesktop.Secret.Collection" "SearchItems"
dbus-call-method-handler (:array :dict-entry "host" "smtp.gmail.com"
:dict-entry "port" "587"))
  dbus-call-method(:session "org.freedesktop.secrets"
"/org/freedesktop/secrets/collection/login"
"org.freedesktop.Secret.Collection" "SearchItems" (:array :dict-entry
"host" "smtp.gmail.com" :dict-entry "port" "587"))
  secrets-search-items("login" :host "smtp.gmail.com" :port "587")
  apply(secrets-search-items "login" (:host "smtp.gmail.com" :port "587"))
  auth-source-secrets-search(:backend #<auth-source-backend
auth-source-backend> :type secrets :max 1 :require nil :create nil
:delete nil :host "smtp.gmail.com" :port "587" :user nil :max 1
:require nil :create nil)
  apply(auth-source-secrets-search :backend #<auth-source-backend
auth-source-backend> :type secrets :max 1 :require nil :create nil
:delete nil (:host "smtp.gmail.com" :port "587" :user nil :max 1
:require nil :create nil))
  auth-source-search-backends((#<auth-source-backend
auth-source-backend>) (:host "smtp.gmail.com" :port "587" :user nil
:max 1 :require nil :create nil) 1 nil nil nil)
  auth-source-search(:host "smtp.gmail.com" :port "587" :user nil :max
1 :require nil :create nil)
  smtpmail-try-auth-methods(#<process smtpmail> (enhancedstatuscodes
(auth login plain xoauth2 plain-clienttoken oauthbearer xoauth)
8bitmime (size \35882577)) "smtp.gmail.com" 587 nil)
  smtpmail-via-smtp(("[email-masked]") #<buffer  smtpmail temp>)
  smtpmail-send-it()
  sendmail-query-once()
  message-multi-smtp-send-mail()
  message-send-mail(nil)
  message-send-via-mail(nil)
  message-send(nil)
  message-send-and-exit(nil)
  funcall-interactively(message-send-and-exit nil)
  call-interactively(message-send-and-exit nil nil)
  command-execute(message-send-and-exit)

It seems like the dbus-call-method call either changed or regressed.
Evaluating the following (referring to the Emacs D-Bus info manual) does
not return an error:

(dbus-call-method :session "org.freedesktop.secrets"
"/org/freedesktop/secrets/collection/login"
"org.freedesktop.Secret.Collection" "SearchItems" '(:array
(:dict-entry "host" "smtp.gmail.com") (:dict-entry "port" "587")))

Note that the :dict-entry are wrapped in lists.  This is what the info
manual says is correct.

In GNU Emacs 26.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
 of 2018-07-05 built on juergen
Windowing system distributor 'The X.Org Foundation', version 11.0.12000000
Configured using:
 'configure --prefix=/usr --sysconfdir=/etc --libexecdir=/usr/lib
 --localstatedir=/var --with-x-toolkit=gtk3 --with-xft --with-modules
 'CFLAGS=-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong
 -fno-plt' CPPFLAGS=-D_FORTIFY_SOURCE=2
 LDFLAGS=-Wl,-O1,--sort-common,--as-needed,-z,relro,-z,now'

Configured features:
XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND GPM DBUS GSETTINGS NOTIFY
ACL GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS
GTK3 X11 MODULES THREADS LIBSYSTEMD LCMS2

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix