]> git.eshelyaron.com Git - emacs.git/commitdiff
Make file copying in tramp-gvfs more robust
authorMichael Albinus <michael.albinus@gmx.de>
Sat, 28 Nov 2020 11:31:43 +0000 (12:31 +0100)
committerMichael Albinus <michael.albinus@gmx.de>
Sat, 28 Nov 2020 11:31:43 +0000 (12:31 +0100)
* 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.

lisp/net/tramp-gvfs.el
test/lisp/net/tramp-tests.el

index e369061664aead8a465c8a0a59f6113f711268b9..b457f54fd501386bd19e05c339e858ac79499468 100644 (file)
@@ -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
index e42765ba0885838d37adebdd597e868548a7b1a0..26889c9a25bd9d8ff6f334a24b4af75506d5f160 100644 (file)
@@ -2494,9 +2494,8 @@ This checks also `file-name-as-directory', `file-name-directory',
 
          ;; Copy file to directory.
          (unwind-protect
-             ;; FIXME: This fails on my QNAP server, see
-             ;; /share/Web/owncloud/data/owncloud.log
-             (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p))
+             ;; This doesn't work on FTP.
+             (unless (tramp--test-ange-ftp-p)
                (write-region "foo" nil source)
                (should (file-exists-p source))
                (make-directory target)
@@ -2520,9 +2519,8 @@ This checks also `file-name-as-directory', `file-name-directory',
 
          ;; Copy directory to existing directory.
          (unwind-protect
-             ;; FIXME: This fails on my QNAP server, see
-             ;; /share/Web/owncloud/data/owncloud.log
-             (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p))
+             ;; This doesn't work on FTP.
+             (unless (tramp--test-ange-ftp-p)
                (make-directory source)
                (should (file-directory-p source))
                (write-region "foo" nil (expand-file-name "foo" source))
@@ -2543,9 +2541,8 @@ This checks also `file-name-as-directory', `file-name-directory',
 
          ;; Copy directory/file to non-existing directory.
          (unwind-protect
-             ;; FIXME: This fails on my QNAP server, see
-             ;; /share/Web/owncloud/data/owncloud.log
-             (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p))
+             ;; This doesn't work on FTP.
+             (unless (tramp--test-ange-ftp-p)
                (make-directory source)
                (should (file-directory-p source))
                (write-region "foo" nil (expand-file-name "foo" source))
@@ -2638,9 +2635,8 @@ This checks also `file-name-as-directory', `file-name-directory',
 
          ;; Rename directory to existing directory.
          (unwind-protect
-             ;; FIXME: This fails on my QNAP server, see
-             ;; /share/Web/owncloud/data/owncloud.log
-             (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p))
+             ;; This doesn't work on FTP.
+             (unless (tramp--test-ange-ftp-p)
                (make-directory source)
                (should (file-directory-p source))
                (write-region "foo" nil (expand-file-name "foo" source))
@@ -2662,9 +2658,8 @@ This checks also `file-name-as-directory', `file-name-directory',
 
          ;; Rename directory/file to non-existing directory.
          (unwind-protect
-             ;; FIXME: This fails on my QNAP server, see
-             ;; /share/Web/owncloud/data/owncloud.log
-             (unless (or (tramp--test-ange-ftp-p) (tramp--test-nextcloud-p))
+             ;; This doesn't work on FTP.
+             (unless (tramp--test-ange-ftp-p)
                (make-directory source)
                (should (file-directory-p source))
                (write-region "foo" nil (expand-file-name "foo" source))