Subject: bug#39111: 27.0.60; Tramp offers to save password in ~/.authinfo instead of ~/.authinfo.gpg

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 31 Aug 2021 01:59:42 +0200

Michael Albinus <[email-masked]> writes:

>>> Same behaviour in all cases. Tramp is no longer asking to save the
>>> password.
>>
>> I'm not sure whether Tramp is supposed to (or not)?  I've added Michael
>> to the CCs.
>
> Tramp is involved indirectly only in this flow. If auth-source-search
> returns a password save-function, it calls it.

I tested this now with Emacs 28 (and without ssh-agent).  When saying:

C-x C-f /ssh:stories:

and filling in user name and passphrase to my ssh key, Emacs asked
whether to save the info to ~/.authinfo (which is correct behaviour in
my case, since I have .authinfo and not .authinfo.gpg).

But that doesn't happen with "emacs -Q".  Hm...  Oh, it also asks for a
user name in the non-Q case?  Is "-Q" inhibiting usage of ~/.authinfo?
Hm...  Backtrace in -Q case:

Debugger entered--Lisp error: (minibuffer-quit "")
  signal(minibuffer-quit (""))
  tramp-error((tramp-file-name "ssh" nil nil "stories" nil "" nil) minibuffer-q$
  tramp-signal-hook-function(minibuffer-quit nil)
  signal(minibuffer-quit nil)
  #f(compiled-function () #<bytecode 0x1f41089b8ac3>)()
  read-string("Passphrase for /ssh:stories: " nil t nil)
  read-passwd("Passphrase for /ssh:stories: ")
  password-read("Passphrase for /ssh:stories: " "/ssh:stories:")
  tramp-read-passwd(#<process *tramp/ssh stories*>)
  tramp-action-password(#<process *tramp/ssh stories*> (tramp-file-name "ssh" 
  tramp-process-one-action(#<process *tramp/ssh stories*> (tramp-file-name "ss
  tramp-process-actions(#<process *tramp/ssh stories*> (tramp-file-name "ssh" 
  tramp-maybe-open-connection((tramp-file-name "ssh" nil nil "stories" nil "" 
  tramp-send-command((tramp-file-name "ssh" nil nil "stories" nil "" nil) "cd 

Backtrace in -Q case:

Debugger entered--Lisp error: (minibuffer-quit "")
  signal(minibuffer-quit (""))
  tramp-error((tramp-file-name "ssh" nil nil "stories" nil "" nil) minibuffer-
  tramp-signal-hook-function(minibuffer-quit nil)
  signal(minibuffer-quit nil)
  #f(compiled-function () #<bytecode 0x1f41089b8ac3>)()
  read-string("ssh user name for stories (default larsi): " nil nil "larsi")
  auth-source-netrc-create(:backend #<auth-source-backend auth-source-backend-
  apply(auth-source-netrc-create (:backend #<auth-source-backend auth-source-b
  auth-source-netrc-search(:backend #<auth-source-backend auth-source-backend-
  apply(auth-source-netrc-search :backend #<auth-source-backend auth-source-ba
  auth-source-search-backends((#<auth-source-backend auth-source-backend-157a4
  auth-source-search(:max 1 nil nil :host "stories" :port "ssh" :require (:sec
  tramp-read-passwd(#<process *tramp/ssh stories*>)

So the prompting comes from 

(auth-source-search :max 1 nil nil :host "stories" :port "ssh" :require '(:secret) :create t)

in tramp-read-passwd, but that's apparently not called with -Q?  (I'm
having troubles edebugging that function, because it bugs out if I try
to do that.)

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no