Subject: bug#33146: .authinfo.gpg not automatically loaded when using (dired) on macOS

From: Christian Johansson <[email-masked]>
Date: Mon, 19 Nov 2018 17:50:52 +0100

Hi again

I stumbled on this alternative solution from the user-guide to John 
Wiegley async.el:
https://github.com/jwiegley/emacs-async

They instead suggest using:
(setq auth-sources '("~/.authinfo.gpg" "~/.netrc"))

instead of:
(setq ange-ftp-netrc-filename "~/.authinfo.gpg")

to avoid the problem of unnecessary user-interaction, especially in the 
case of async.el since it's spawned process doesn't support 
user-interaction.

Maybe both solutions are equivalent in solving the problem that authinfo 
doesn't automatically work with .netrc files and ange-ftp doesn't work 
with .authinfo files?

I think most people just use the tokens: machine, default, port, login, 
password and they seem to work already after setting either 
ange-ftp-netrc-filename or auth-sources variable.

Can you make one of those solution a default configuration and then 
perhaps add a override for people that want to use tokens that have 
special meaning the context of ange-ftp or authinfo it they are not 
fully compatible? Maybe there could be warnings occuring when authinfo 
stumbles upon a token it doesn't support and vice versa for ange-ftp?

Regards
Christian

On 2018-11-18 22:53, Ted Zlatanov wrote:
> On Fri, 09 Nov 2018 10:45:17 +0100 Michael Albinus <[email-masked]> wrote:
>
> MA> Requirements from ange-ftp.el would be at least
>
> MA> - Support of the "account" token.
> MA> - Support of the "default" token.
> MA> - Check of proper file permissions of "~/.netrc" or whatever file is
> MA>   specified (see ange-ftp-disable-netrc-security-check).
>
> MA> The "account" token is already parsed in auth-source.el, but it is not
> MA> divided from the "login" token. Both are handled via the common keyword
> MA> :user.
>
> MA> The "default" token is already parsed in auth-source.el, but I'm not
> MA> sure it is used in the sense ange-ftp.el expects it. In auth-source.el
> MA> this token is expanded to an entry of its own, with an unspecified
> MA> "machine". In ange-ftp.el, the tokens of "default" are used for all
> MA> other entries, replacing missing tokens. AFAIU.
>
> MA> Once this is prepared in auth-source.el, I would be able to integrate it
> MA> in ange-ftp.el. That is a more simple task; I've done this already for Tramp.
>
> Hi Michael,
>
> if you or a user could define the desired behavior as tests against
> auth-source.el (we already have that set up in the core), I'd be happy
> to implement them. Something like "for this call, with this
> authinfo/netrc content, I expect to get back this data."
>
> I wasn't able to deduce the desired behavior on my own, unfortunately.
>
> Checking the permissions of the netrc file sounds like a good feature.
> For a GPG file it's not so important.
>
> MA> - Everything I have forgotten to tell here ...
>
> There's always a few of those... :)
>
> Ted