jwiegley / emacs-async

Simple library for asynchronous processing in Emacs
GNU General Public License v3.0
838 stars 68 forks source link

dired-async does not over TRAMP when host requires a password #38

Closed Silex closed 10 years ago

Silex commented 10 years ago

I tried the following:

(setq dired-async-env-variables-regexp 
      "\\`\\(tramp-\\(default\\|connection\\|remote\\)\\|ange-ftp\\|password\\|auth-source\\)-.*")

So it would reuse the cached password, but it does not work.

thierryvolpiatto commented 10 years ago

Philippe Vaucher notifications@github.com writes:

I tried the following:

(setq dired-async-env-variables-regexp "`(tramp-(default|connection|remote)|ange-ftp|password|auth-source)-.*")

But it still doesn't work.

It is a limitation of async. Your remote emacs (child) will ask for a passwd at each time and it will wait forever for the passwd.

To be able to copy your files async (to/from remote or with sudo) you have to be sure you will NOT be prompted for passwd on the remote emacs. To achieve this you have to use a ".authinfo.gpg" file with your passwords in it (sudo). For ssh methods and similars you have in addition to use a key exchange method to be sure you will not be prompted for a passwd.

Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Silex commented 10 years ago

But it still doesn't work.

It is a limitation of async. Your remote emacs (child) will ask for a passwd at each time and it will wait forever for the passwd.

Can you explain why this happens? And why can't we copy the data from password-cache?

thierryvolpiatto commented 10 years ago

Philippe Vaucher notifications@github.com writes:

    But it still doesn't work.

It is a limitation of async.
Your remote emacs (child) will ask for a passwd at each time and it will
wait forever for the passwd.

Can you explain why this happens?

Well, when you start a new emacs and you are prompted for a password, then the same would happen when you use async.

And why can't we copy the data from password-cache?

I think you mean password-data, which may have expired at any time, so I think this is not reliable. Thus this mechanism have been buggy across emacs versions, sometimes working sometimes not, also it is not always used depending on password-cache value, which may be modified if you use another configuration mode (i.e using gpg agent or not), but I am not expert on this and can't tell you more.

What is the problem using a .authinfo file ?

I use that always to copy files with sudo method and ssh for small files (text files), for larger files (e.g videos) I use sshfs.

Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Silex commented 10 years ago

Can you explain why this happens?

Well, when you start a new emacs and you are prompted for a password, then the same would happen when you use async.

I guess the answer I was looking for was "because async works by spawning a new emacs instance". Ok I see why it happens.

My new question is "why can't it ask for the connection password?"

And why can't we copy the data from password-cache?

I think you mean password-data, which may have expired at any time, so I think this is not reliable. Thus this mechanism have been buggy across emacs versions, sometimes working sometimes not, also it is not always used depending on password-cache value, which may be modified if you use another configuration mode (i.e using gpg agent or not), but I am not expert on this and can't tell you more.

Hum, just to be clear it was never working. Adding password-* to the regex was an attempt to make it work, but it then failed because of auth-source variables.

What is the problem using a .authinfo file ?

It breaks the workflow. You edit some file over TRAMP, realise you want to copy a large file, say "hey let's copy it with TRAMP" and then fail to do so with dired-async, so in the end you just spawn a new shell and use scp.

thierryvolpiatto commented 10 years ago

Philippe Vaucher notifications@github.com writes:

    Can you explain why this happens?

Well, when you start a new emacs and you are prompted for a password,
then the same would happen when you use async.

I guess the answer I was looking for was "because async works by spawning a new emacs instance". Ok I see why it happens.

My new question is "why can't it ask for the connection password?"

This is the nature of all async stuff i.e emacs --daemon, etc...

It breaks the workflow. You edit some file over TRAMP, realise you want to copy a large file, say "hey let's copy it with TRAMP" and then fail to do so with dired-async,

No, it is working in such cases, you have to use a gpg agent though.

Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997

Silex commented 10 years ago

Alright. Thanks for the information.