Subject: Re: bug#64089: 30.0.50; `ldap-search' errors out with `wrong-type-argument listp' when called WITHDN == t

From: Jens Schmidt <[email-masked]>
Date: Sun, 18 Jun 2023 10:51:25 +0200

On 2023-06-18  09:43, Jens Schmidt wrote:

> Or whatever.  In any case, I'll open a new bug for that to continue 
> this discussion.

And of course, Filipp is right w.r.t. to API consistency.  TBH, I simply
haven't payed attention to `ldap-ignore-attribute-codings' until
recently.  So for emacs-29, I can provide a patch that backs out my
previous patch and fixes the bug such that the *original/Gerd's* string

   "dn: cn=JENS_SCHMIDT,L=REGION,DC=COMPANY,DC=COM"

gets appended to the result w/o triggering the

   wrong-type-argument listp

for both `ldap-ignore-attribute-codings' equaling nil and non-nil.

Basicaly the upper half of Filipp's patch, but redone such that even I
understand it without too much eye-balling :-).  Like this probably (not
tested yet!):

     (cond
      (ldap-ignore-attribute-codings
       result)
      (withdn
       ;; Do not process first elements of the records
       ;; with `ldap-decode-attribute' (Bug#64089).
       (mapcar (lambda (record)
                 (cons (car record)
		      (mapcar #'ldap-decode-attribute
                               (cdr record)))
	        result)))
      (t
       (mapcar (lambda (record)
		(mapcar #'ldap-decode-attribute record))
                 result))))

WDYT?