Subject: bug#67937: 30.0.50; auth-source-pass relies on epa-file being enabled

From: "J.P." <[email-masked]>
Date: Sat, 23 Dec 2023 16:43:28 -0800

Arsen Arsenović <[email-masked]> writes:

> This patch/bug report addresses a real problem that exists independently
> of what triggered it in my case.
>
>> My gut feeling tells me that this could be the real problem, and we
>> need to solve this instead of bypassing the problem with another
>> patch, which could introduce further problems.
>
> Your gut's nearly certainly right here :-)  I am still hunting for the
> cause of that issue.

Perhaps it couldn't hurt to get that somewhat sorted before modifying
`auth-source-pass--read-entry'.

> Regardless, what I said initially holds true ultimately: either epa-file
> should not be relied on, or a-s-p should ensure it is present.  I
> gravitate towards the former, as it reduces the complexity of getting a
> password-store entry.
>
>> Hunting for this problem I recommend to use
>> (debug-on-variable-change 'file-name-handler-alist)
>
> That is too verbose.  The following appears to work well, though:
>
> (add-variable-watcher
>  'file-name-handler-alist
>  (lambda (symbol newval operation where)
>    (cl-flet ((hefh (val)
> 	       (seq-some (lambda (x) (equal (cdr x) 'epa-file-handler))
> 			 val)))
>      (let ((hb (hefh file-name-handler-alist))
> 	   (ha (hefh newval)))
>        (cond
> 	((and hb (not ha))
> 	 (debug--implement-debug-watch symbol newval operation where))
> 	((and (not hb) ha)
> 	 (message "epa-file added")))))))

I can't imagine

  (rassq 'epa-file-handler val)

differing from

  (car (memq epa-file-handler val)) ; w/o the quote

But if it somehow does, that could provide an insight into the cause as
well. Just a thought.