cjohansson / emacs-ssh-deploy

A deployment plugin via Tramp for Emacs.
GNU General Public License v3.0
152 stars 6 forks source link

Workaround for TRAMP FTP issue (file-regular-p) or (file-directory-p) #34

Closed cjohansson closed 6 years ago

cjohansson commented 6 years ago

It seems that TRAMP FTP has an issue regarding detecting if a file is a regular file or directory. I have posted an issue for this on the Emacs bug mailing list. But meanwhile it would be good to have a workaround.

So the issue is about the functions (copy-file), (copy-directory), (file-regular-p) and (file-directory-p) over TRAMP FTP. (file-regular-p) will return nil for some regular files on TRAMP FTP and same for (file-directory-p). (copy-file) will sometimes try to directory-copy a regular file and (copy-directory) will try to file-copy a directory.

cjohansson commented 6 years ago

I found a work-around, if you face this issue just open the remote path in (dired-mode) and the issue will go away. It seems TRAMP caches information about remote-system when you open it in dired-mode.

cjohansson commented 6 years ago

It's better to use (not (file-directory-p)) instead of (file-regular-p) because support for (file-regular-p) over TRAMP ftp will probably be added in next version while (file-directory-p) has been supported since 2009.

There is one issue remaining still and that is copying files from remote-hosts to local-hosts over FTP when remote host has not been opened in dired-mode first.

cjohansson commented 6 years ago

Replaced (file-regular-p) with (not (file-directory-p)) in c07b006416daeebf12fdc9e62aaeceda4fd20ca7

cjohansson commented 6 years ago

This seems to be resolved now when using the method described above