From b067fa1f7d2b24b8fdb7f178924eb4e296559738 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Fri, 8 Dec 2017 16:37:53 +0100 Subject: [PATCH] Minor Tramp fixes * lisp/net/tramp-gvfs.el (tramp-gvfs-do-copy-or-rename-file): Fix a bug when renaming. * test/lisp/net/tramp-tests.el (tramp-test21-file-links): Extend test. (tramp-test42-delay-load, tramp-test42-remote-load-path): Skip unless Emacs >= 26. --- lisp/net/tramp-gvfs.el | 9 +++++---- test/lisp/net/tramp-tests.el | 20 +++++++++++++++++--- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index fe5a98909e0..1d1b04b44f8 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -683,7 +683,6 @@ file names." (let ((t1 (tramp-tramp-file-p filename)) (t2 (tramp-tramp-file-p newname)) (equal-remote (tramp-equal-remote filename newname)) - (file-operation (intern (format "%s-file" op))) (gvfs-operation (if (eq op 'copy) "gvfs-copy" "gvfs-move")) (msg-operation (if (eq op 'copy) "Copying" "Renaming"))) @@ -698,9 +697,11 @@ file names." ;; We cannot copy or rename directly. (let ((tmpfile (tramp-compat-make-temp-file filename))) - (funcall - file-operation filename tmpfile t keep-date preserve-uid-gid - preserve-extended-attributes) + (if (eq op 'copy) + (copy-file + filename tmpfile t keep-date preserve-uid-gid + preserve-extended-attributes) + (rename-file filename tmpfile t)) (rename-file tmpfile newname ok-if-already-exists)) ;; Direct action. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 0d1e7d18d9b..a9d6e74ce26 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -2810,7 +2810,11 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." ;; Symbolic links could look like a remote file name. ;; They must be quoted then. (delete-file tmp-name2) - (make-symbolic-link "/penguin:motd:" tmp-name2) + (make-symbolic-link + (funcall + (if quoted 'tramp-compat-file-name-unquote 'identity) + "/penguin:motd:") + tmp-name2) (should (file-symlink-p tmp-name2)) (should (string-equal @@ -4642,6 +4646,10 @@ process sentinels. They shall not disturb each other." (ert-deftest tramp-test42-delay-load () "Check that Tramp is loaded lazily, only when needed." + ;; The autoloaded Tramp objects are different since Emacs 26.1. We + ;; cannot test older Emacsen, therefore. + (skip-unless (tramp--test-emacs26-p)) + ;; Tramp is neither loaded at Emacs startup, nor when completing a ;; non-Tramp file name like "/foo". Completing a Tramp-alike file ;; name like "/foo:" autoloads Tramp, when `tramp-mode' is t. @@ -4654,8 +4662,8 @@ process sentinels. They shall not disturb each other." (message \"Tramp loaded: %%s\" (featurep 'tramp)) \ (file-name-all-completions \"/foo:\" \"/\") \ (message \"Tramp loaded: %%s\" (featurep 'tramp)))")) - ;; Tramp doesn't load when `tramp-mode' is nil since Emacs 26.1. - (dolist (tm (if (tramp--test-emacs26-p) '(t nil) '(nil))) + ;; Tramp doesn't load when `tramp-mode' is nil. + (dolist (tm '(t nil)) (should (string-match (format @@ -4693,6 +4701,10 @@ process sentinels. They shall not disturb each other." (ert-deftest tramp-test42-remote-load-path () "Check that Tramp autoloads its packages with remote `load-path'." + ;; The autoloaded Tramp objects are different since Emacs 26.1. We + ;; cannot test older Emacsen, therefore. + (skip-unless (tramp--test-emacs26-p)) + ;; `tramp-cleanup-all-connections' is autoloaded from tramp-cmds.el. ;; It shall still work, when a remote file name is in the ;; `load-path'. @@ -4770,6 +4782,8 @@ Since it unloads Tramp, it shall be the last test to run." ;; * dired-compress-file ;; * dired-uncache +;; * file-equal-p (partly done in `tramp-test21-file-links') +;; * file-in-directory-p ;; * file-name-case-insensitive-p ;; * Work on skipped tests. Make a comment, when it is impossible. -- 2.39.5