summaryrefslogtreecommitdiff
path: root/lisp/net/tramp-gvfs.el
diff options
context:
space:
mode:
authorMichael Albinus <michael.albinus@gmx.de>2020-11-28 12:31:43 +0100
committerMichael Albinus <michael.albinus@gmx.de>2020-11-28 12:31:43 +0100
commita72db8ab8bfe417d40707be6e791c084509f4abf (patch)
tree48e5876ce6a1ffac0c720d08d315bb542f4a60b3 /lisp/net/tramp-gvfs.el
parentf31cacd1ff4e020c0a10fa3da6598b21a6b04988 (diff)
downloademacs-a72db8ab8bfe417d40707be6e791c084509f4abf.tar.gz
emacs-a72db8ab8bfe417d40707be6e791c084509f4abf.tar.bz2
emacs-a72db8ab8bfe417d40707be6e791c084509f4abf.zip
Make file copying in tramp-gvfs more robust
* test/lisp/net/tramp-tests.el (tramp-test11-copy-file) (tramp-test12-rename-file): Do not skip for tramp-gvfs.el. * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): Add sanity checks.
Diffstat (limited to 'lisp/net/tramp-gvfs.el')
-rw-r--r--lisp/net/tramp-gvfs.el25
1 files changed, 17 insertions, 8 deletions
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index e369061664a..b457f54fd50 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -800,14 +800,23 @@ file names."
(with-tramp-progress-reporter
v 0 (format "%s %s to %s" msg-operation filename newname)
(unless
- (apply
- #'tramp-gvfs-send-command v gvfs-operation
- (append
- (and (eq op 'copy) (or keep-date preserve-uid-gid)
- '("--preserve"))
- (list
- (tramp-gvfs-url-file-name filename)
- (tramp-gvfs-url-file-name newname))))
+ (and (apply
+ #'tramp-gvfs-send-command v gvfs-operation
+ (append
+ (and (eq op 'copy) (or keep-date preserve-uid-gid)
+ '("--preserve"))
+ (list
+ (tramp-gvfs-url-file-name filename)
+ (tramp-gvfs-url-file-name newname))))
+ ;; Some backends do not return a proper error
+ ;; code in case of direct copy/move. Apply sanity checks.
+ (or (not equal-remote)
+ (tramp-gvfs-send-command
+ v "gvfs-info" (tramp-gvfs-url-file-name newname))
+ (eq op 'copy)
+ (not (tramp-gvfs-send-command
+ v "gvfs-info"
+ (tramp-gvfs-url-file-name filename)))))
(if (or (not equal-remote)
(and equal-remote