Hi! I tried this:

```
(setq auth-sources '("secrets:Login"))
("secrets:Login")

(setq auth-source-debug t
      auth-source-save-behavior 'ask
      secrets-debug t)
t

(defun auth-info-password (auth-info)
  "Return the :secret password from the AUTH-INFO."
  (let ((secret (plist-get auth-info :secret)))
    (while (functionp secret)
      (setq secret (funcall secret)))
    secret))
auth-info-password
```

Then tried C-x C-f /sudo:: RET and got the previous error (with my actual
password in it). I assumed this was because `auth-info-password` had then
been loaded from source. I reloaded `auth-info-password` in the `*scratch*`
buffer, did M-x auth-source-forget-all-cached, then C-x C-f /sudo:: RET. I
was asked again for a label but not a password, as before.

In `*Messages*` I saw:

```
Tramp: Opening connection nil for root@black-diamond using sudo...
auth-source-search: found 0 results (max 1) matching (:max 1 :user "ethan"
:host "black-diamond" :port "sudo" :require (:secret :user) :create t)
auth-source-search: found 1 results (max 1) matching (:max 1 :host
"black-diamond" :port "sudo")
auth-source-search: CREATED 1 results (max 1) matching (:max 1 :user
"ethan" :host "black-diamond" :port "sudo" :require (:secret :user) :create
t)
Tramp: Opening connection nil for root@black-diamond using sudo...done
```

As before, I didn't see any new entries in my Login keyring.

I thought it might be worth it to try to remove autoloading as a possible
cause, so I restarted emacs and did this:

```
(require 'auth-source)
auth-source

(setq auth-sources '("secrets:Login"))
("secrets:Login")

(setq auth-source-debug t
      auth-source-save-behavior 'ask
      secrets-debug t)
t

(defun auth-info-password (auth-info)
  "Return the :secret password from the AUTH-INFO."
  (let ((secret (plist-get auth-info :secret)))
    (while (functionp secret)
      (setq secret (funcall secret)))
    secret))
auth-info-password

(auth-source-forget-all-cached)
nil
```

Then did C-x C-f /sudo:: RET. Again, I was asked for a label but not a
password, and no `ethan@black-diamond` entry was created in my Login
keyring. The contents of the `*Messages*` buffer were the same as before.

Ethan



On Mon, Jun 17, 2024 at 11:39 AM Michael Albinus <michael.albi...@gmx.de>
wrote:

> Ethan Glasser-Camp <ethan.glasser.c...@gmail.com> writes:
>
> > Hi!
>
> Hi Ethan,
>
> > In `emacs -Q`, I tried loading the new version of `auth-info-password
> > ` but I'm not sure I did it right. I did the following in `*scratch*`:
>
> In "emacs -Q", no password is created automagically, for a reason. Move
> your init file away, and call "emacs" instead.
>
> > (setq auth-sources (cons "secrets:Login" auth-sources))
> > ("secrets:Login" "~/.authinfo" "~/.authinfo.gpg" "~/.netrc")
>
> That's different from what I have recommended for test. Please use
> (setq auth-sources '("secrets:Login")) instead, we don't want to be
> intermixed with "~/.authinfo" actions.
>
> > (setq auth-source-debug t
> >       auth-source-save-behavior 'ask
> >       secrets-debug t)
> > t
> >
> > (defun auth-info-password (auth-info)
> >   "Return the :secret password from the AUTH-INFO."
> >   (let ((secret (plist-get auth-info :secret)))
> >     (while (functionp secret)
> >       (setq secret (funcall secret)))
> >     secret))
> > auth-info-password
>
> Fine. And to be *really* sure, call also "M-x
> auth-source-forget-all-cached",
> before you open "/sudo::".
>
> > Ethan
>
> Best regards, Michael.
>

Reply via email to