From: Michael Albinus Date: Mon, 3 Nov 2014 14:29:51 +0000 (+0100) Subject: * net/tramp-sh.el (tramp-do-copy-or-rename-file-via-buffer): Use a X-Git-Tag: emacs-24.4.90~277 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=6c5a32ddbc3b3442918ea6ad1af53aced2b6f7f5;p=emacs.git * net/tramp-sh.el (tramp-do-copy-or-rename-file-via-buffer): Use a local copy of FILENAME, when it is remote. Fixes: debbugs:18751 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 07231507bae..41e1039347c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-11-03 Michael Albinus + + * net/tramp-sh.el (tramp-do-copy-or-rename-file-via-buffer): Use a + local copy of FILENAME, when it is remote. (Bug#18751) + 2014-11-02 Michael Albinus * net/tramp-adb.el (tramp-adb-handle-process-file): Do not raise diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index e120aedfc01..a72a79a7797 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2061,11 +2061,15 @@ FILENAME is the source file, NEWNAME the target file. KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME." (with-temp-buffer ;; We must disable multibyte, because binary data shall not be - ;; converted. + ;; converted. `insert-file-contents-literally' does not support + ;; file name handlers for GNU Emacs; we must create a local copy + ;; therefore. (set-buffer-multibyte nil) (let ((coding-system-for-read 'binary) - (jka-compr-inhibit t)) - (insert-file-contents-literally filename)) + (jka-compr-inhibit t) + (tmpfile (file-local-copy filename))) + (insert-file-contents-literally (or tmpfile filename)) + (when tmpfile (delete-file tmpfile))) ;; We don't want the target file to be compressed, so we let-bind ;; `jka-compr-inhibit' to t. (let ((coding-system-for-write 'binary)