Gustavo Barros <[email protected]> writes:

Hi Gustavo,

> Anyway, then we have an `emacs -Q' reproduction recipe:
>
> #+begin_src emacs-lisp
> (load-library "tramp")
> (setq tramp-cache-read-persistent-data t)
> (setq auth-source-save-behavior nil)
> (setq auth-sources
>      '(default
>         "secrets:session"
>         "secrets:Login"
>         "~/.authinfo.gpg"))
> #+end_src
>
> Now find file "/sudo::/tmp/test.txt", enter password, and meet the
> infamous "label prompt".

The appended patch fixes this for me, could you pls check? I've applied
it on top of Emacs 28.0.50, but it shall also apply for Emacs 27.

> Best regards,
> Gustavo.

Best regards, Michael.

*** /tmp/ediffxgQG8f	2021-01-26 19:56:25.215637839 +0100
--- /usr/local/src/emacs/lisp/auth-source.el	2021-01-26 17:30:38.844175268 +0100
***************
*** 1654,1659 ****
--- 1654,1660 ----
  (cl-defun auth-source-secrets-create (&rest spec
                                        &key backend host port create
                                        &allow-other-keys)
+   (when auth-source-save-behavior
    (let* ((base-required '(host user port secret label))
           ;; we know (because of an assertion in auth-source-search) that the
           ;; :create parameter is either t or a list (which includes nil)
***************
*** 1795,1801 ****
         (lambda ()
  	 (auth-source-secrets-saver collection item secret args))))

!     (list artificial)))

  (defun auth-source-secrets-saver (collection item secret args)
    "Wrapper around `secrets-create-item', prompting along the way.
--- 1796,1802 ----
         (lambda ()
  	 (auth-source-secrets-saver collection item secret args))))

!     (list artificial))))

  (defun auth-source-secrets-saver (collection item secret args)
    "Wrapper around `secrets-create-item', prompting along the way.

Reply via email to