Subject: 26.0.60; (copy-file) over TRAMP FTP mistakes file for directory
From: Christian Johansson <[email-masked]>
To: [email-masked]
Date: Mon, 19 Feb 2018 09:18:33 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

I have a case where Emacs have trouble understanding whether a remote
file is a file or a directory, I run this code where PATH-LOCAL is on
localhost and PATH-REMOTE is on a remote FTP via TRAMP

(let ((file-or-directory (not (file-directory-p path-remote))))
    (if file-or-directory
        (progn
          (message "Downloading file '%s' to '%s'.. (synchronously)" path-remote path-local)
          (copy-file path-remote path-local t t t t)
          (message "Download of file '%s' finished. (synchronously)" path-local))
      (progn
        (message "Downloading directory '%s' to '%s'.. (synchronously)" path-remote path-local)
        (copy-directory path-remote path-local t t t)
        (message "Download of directory '%s' finished. (synchronously)"
    path-local))))

The file .error-log will be transferred locally to .error-log/.error-log
instead of .error-log. The filename does not matter.

It seems (file-regular-p) mistakes remote files over TRAMP FTP more
often than (file-directory-p). Maybe that is the cause of this problem.

In GNU Emacs 26.0.60 (build 13, x86_64-apple-darwin17.3.0, NS appkit-1561.20 Version 10.13.2 (Build 17C205))
 of 2018-02-19 built on Christians-iMac
Repository revision: 020734c0e1a7ed8534df29992ffc4228d3663d89
Windowing system distributor 'Apple', version 10.3.1561
Recent messages:
Getting /ftp:ftpuser@ftphost:/remotepath/style.css...done
Getting /ftp:ftpuser@ftphost:/remotepath/travel-tips.php...done
Differences calculated between directory ’/localpath/’ and ’/ftp:ftpuser@ftphost:/remotepath/’ -> 0 only in A, 2 only in B, 0 differs. (synchronously)
previous-line: Beginning of buffer [6 times]
Downloading file ’/ftp:ftpuser@ftphost:/remotepath/.error-log’ to ’/localpath/.error-log’.. (synchronously)
> ftp:ftpuser@ftphost:/remotepath/.error-log to /localpath/.error-log/...
> p:ftpuser@ftphost:/remotepath/.error-log to /localpath/.error-log/...5k
> :ftpuser@ftphost:/remotepath/.error-log to /localpath/.error-log/...21k
> ftpuser@ftphost:/remotepath/.error-log to /localpath/.error-log/...done
Download of file ’/localpath/.error-log’ finished. (synchronously)
Quit [2 times]
Configured features:
JPEG RSVG NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS LCMS2

Important settings:
  value of $LANG: sv_SE.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Messages

Minor modes in effect:
  show-paren-mode: t
  save-place-mode: t
  helm-mode: t
  helm-autoresize-mode: t
  global-flycheck-mode: t
  global-hl-todo-mode: t
  global-diff-hl-mode: t
  diff-auto-refine-mode: t
  global-auto-complete-mode: t
  dired-async-mode: t
  editorconfig-mode: t
  yas-global-mode: t
  yas-minor-mode: t
  override-global-mode: t
  ido-everywhere: t
  display-time-mode: t
  winner-mode: t
  electric-pair-mode: t
  desktop-save-mode: t
  global-semantic-mru-bookmark-mode: t
  global-semanticdb-minor-mode: t
  global-semantic-idle-completions-mode: t
  global-semantic-idle-scheduler-mode: t
  global-semantic-idle-local-symbol-highlight-mode: t
  global-semantic-idle-summary-mode: t
  global-semantic-decoration-mode: t
  global-semantic-highlight-func-mode: t
  global-semantic-stickyfunc-mode: t
  semantic-mode: t
  global-ede-mode: t
  delete-selection-mode: t
  global-whitespace-mode: t
  which-function-mode: t
  shell-dirtrack-mode: t
  cl-old-struct-compat-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
/Users/christianjohansson/.emacs.d/ssh-deploy/ssh-deploy hides /Users/christianjohansson/.emacs.d/elpa/ssh-deploy-20180218.704/ssh-deploy
/Users/christianjohansson/.emacs.d/ssh-deploy/ssh-deploy-diff-mode hides /Users/christianjohansson/.emacs.d/elpa/ssh-deploy-20180218.704/ssh-deploy-diff-mode
/Users/christianjohansson/.emacs.d/elpa/less-css-mode-20160930.2153/less-css-mode hides /Users/christianjohansson/Documents/remacs/lisp/textmodes/less-css-mode

Features:
(shadow sort mail-extr ediff-merg ediff-wind ediff-diff ediff-mult
ediff-help ediff-init ediff-util tramp-cache conf-mode ange-ftp
tramp-ftp ede/dired helm-semantic helm-imenu vc-git emacsbug message
puny rfc822 mml mml-sec epa derived epg gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils helm-command helm-elisp helm-eval edebug helm-info
display-line-numbers rainbow-mode color flycheck-rust
flycheck-color-mode-line face-remap auto-package-update ts-comint tss
log4e json-mode json-reformat json-snatcher smartparens-javascript js
smartparens-html sgml-mode dom tide tide-lv typescript-mode smarty-mode
paren saveplace restclient helm-mode helm-files helm-buffers helm-tags
helm-locate helm-grep helm-regexp helm-utils helm-help helm-types helm
helm-source helm-multi-match helm-lib flycheck-pos-tip pos-tip flycheck
subr-x hl-todo diff-hl vc-dir ewoc vc vc-dispatcher diff-mode
exec-path-from-shell ssh-deploy ssh-deploy-diff-mode ac-html
ac-html-core ztree ztree-diff ztree-diff-model ztree-dir ztree-view
ztree-util grunt hlinum linum ac-php auto-complete-config auto-complete
ac-php-core popup phpcbf php-auto-yasnippets php-mode etags xref project
add-log cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs web-beautify imenu-list reveal-in-osx-finder
auto-dictionary flyspell ispell dired-async dired-aux dired
dired-loaddefs async editorconfig server ansible-doc ecb ecb-symboldef
ecb-analyse ecb-compatibility ecb-winman-support ecb-autogen autoload
radix-tree lisp-mnt ecb-tod ecb-cycle ecb-eshell ecb-help ecb-jde
ecb-method-browser hideshow ecb-semantic-wrapper ecb-semantic
ecb-file-browser ecb-speedbar ecb-layout ecb-create-layout
ecb-compilation ecb-common-browser ecb-navigate eieio-compat
ecb-mode-line ecb-face tree-buffer ecb-upgrade ecb-cedet-wrapper
semantic/db-find semantic/db-ref semantic/analyze semantic/sort
semantic/scope semantic/analyze/fcn ecb-util flymake-rust flymake-easy
flymake rust-playground time-stamp cargo cargo-process smartparens-rust
rust-mode compile google-translate google-translate-default-ui
google-translate-core-ui google-translate-core google-translate-tk url
url-proxy url-privacy url-expand url-methods url-history url-cookie
url-domsuf url-util mailcap json map lorem-ipsum company
smartparens-config smartparens-text smartparens thingatpt paredit
ansible f yasnippet yaxception ht dash know-your-http-well
http-status-codes http-relations http-methods http-headers s hydra lv
cl-extra help-mode use-package up-delight up-diminish up-ensure up-core
pcase cl bind-key easy-mmode ido time winner edmacro kmacro elec-pair
desktop frameset semantic/mru-bookmark semantic/db-mode semantic/db
semantic/idle semantic/format semantic/ctxt semantic/decorate/mode
semantic/tag-ls semantic/find semantic/decorate pulse
semantic/util-modes semantic/util semantic semantic/tag semantic/lex
semantic/fw mode-local find-func ede/speedbar ede/files ede ede/detect
ede/base ede/auto ede/source eieio-base eieio-speedbar speedbar sb-image
ezimage dframe eieio-custom wid-edit cedet delsel disp-table whitespace
which-func imenu windmove base16-dracula-theme base16-theme tramp
tramp-compat tramp-loaddefs trampver shell pcomplete comint ansi-color
ring parse-time format-spec advice cus-start cus-load finder-inf rx info
package easymenu epg-config url-handlers url-parse auth-source cl-seq
eieio eieio-core cl-macs eieio-loaddefs password-cache url-vars seq
byte-opt gv bytecomp byte-compile cconv cl-loaddefs cl-lib time-date
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode elisp-mode lisp-mode prog-mode register page
menu-bar rfn-eshadow isearch timer select scroll-bar mouse jit-lock
font-lock syntax facemenu font-core term/tty-colors frame cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray minibuffer
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote kqueue cocoa ns lcms2
multi-tty make-network-process emacs)

Memory information:
((conses 16 601023 38540)
 (symbols 48 54999 49)
 (miscs 40 1120 809)
 (strings 32 146615 15732)
 (string-bytes 1 4761875)
 (vectors 16 82947)
 (vector-slots 8 1371207 5634)
 (floats 8 426 907)
 (intervals 56 1355 232)
 (buffers 992 24))