emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 574904b: Fix some oddities in Tramp's rsync and smb


From: Michael Albinus
Subject: [Emacs-diffs] master 574904b: Fix some oddities in Tramp's rsync and smb methods
Date: Sun, 26 Jun 2016 10:30:38 +0000 (UTC)

branch: master
commit 574904bbb305c0cda4ee6bda38076f7829a9a253
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Fix some oddities in Tramp's rsync and smb methods
    
    * lisp/net/tramp-sh.el (tramp-methods) <rsync>: Add "-p" and
    "-s" arguments.
    (tramp-do-copy-or-rename-file-out-of-band):
    Call `file-name-directory' also for remote NEWNAME.
    
    * test/lisp/net/tramp-tests.el (tramp-test15-copy-directory):
    Do not skip for tramp-smb.el.  Test als COPY-CONTENTS case.
    (tramp-test24-file-name-completion): Improve check for
    hostname completion.
    (tramp--test-rsync-p): New defun.
    (tramp-test31-special-characters)
    (tramp-test31-special-characters-with-stat)
    (tramp-test31-special-characters-with-perl)
    (tramp-test31-special-characters-with-ls, tramp-test32-utf8)
    (tramp-test32-utf8-with-stat, tramp-test32-utf8-with-perl)
    (tramp-test32-utf8-with-ls): Skip for "rsync".
    
    * lisp/net/tramp-smb.el (tramp-smb-handle-copy-directory):
    Check also for CIFS capabilities.
---
 lisp/net/tramp-sh.el         |   11 ++++----
 lisp/net/tramp-smb.el        |    5 ++--
 test/lisp/net/tramp-tests.el |   58 ++++++++++++++++++++++++++++++++++--------
 3 files changed, 55 insertions(+), 19 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index 19f687c..606572b 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -203,7 +203,7 @@ The string is used in `tramp-methods'.")
     (tramp-remote-shell-login   ("-l"))
     (tramp-remote-shell-args    ("-c"))
     (tramp-copy-program         "rsync")
-    (tramp-copy-args            (("-t" "%k") ("-r")))
+    (tramp-copy-args            (("-t" "%k") ("-p") ("-r") ("-s")))
     (tramp-copy-env             (("RSYNC_RSH") ("ssh" "%c")))
     (tramp-copy-keep-date       t)
     (tramp-copy-keep-tmpfile    t)
@@ -2378,17 +2378,16 @@ The method used must be an out-of-band method."
        (setq source (if t1
                         (tramp-make-copy-program-file-name v)
                       (shell-quote-argument filename))
-          target (if t2
-                     (tramp-make-copy-program-file-name v)
-                   (shell-quote-argument
-                    (funcall
+             target (funcall
                      (if (and (file-directory-p filename)
                               (string-equal
                                (file-name-nondirectory filename)
                                (file-name-nondirectory newname)))
                          'file-name-directory
                        'identity)
-                     newname))))
+                     (if t2
+                         (tramp-make-copy-program-file-name v)
+                       (shell-quote-argument newname))))
 
        ;; Check for host and port number.  We cannot use
        ;; `tramp-file-name-port', because this returns also
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index fbd7cd3..a526fd9 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -129,7 +129,8 @@ call, letting the SMB client use the default one."
         "ERRnosuchshare"
         ;; Windows 4.0 (Windows NT), Windows 5.0 (Windows 2000),
         ;; Windows 5.1 (Windows XP), Windows 5.2 (Windows Server 2003),
-        ;; Windows 6.0 (Windows Vista), Windows 6.1 (Windows 7).
+        ;; Windows 6.0 (Windows Vista), Windows 6.1 (Windows 7),
+        ;; Windows 6.3 (Windows 10).
         "NT_STATUS_ACCESS_DENIED"
         "NT_STATUS_ACCOUNT_LOCKED_OUT"
         "NT_STATUS_BAD_NETWORK_NAME"
@@ -425,7 +426,7 @@ pass to the OPERATION."
                (delete-directory tmpdir 'recursive))))
 
           ;; We can copy recursively.
-          ((or t1 t2)
+          ((and (or t1 t2) (tramp-smb-get-cifs-capabilities v))
            (when (and (file-directory-p newname)
                       (not (string-equal (file-name-nondirectory dirname)
                                          (file-name-nondirectory newname))))
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index a8d89e8..b9562c1 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -960,11 +960,6 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
 (ert-deftest tramp-test15-copy-directory ()
   "Check `copy-directory'."
   (skip-unless (tramp--test-enabled))
-  (skip-unless
-   (not
-    (eq
-     (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
-     'tramp-smb-file-name-handler)))
 
   (let* ((tmp-name1 (tramp--test-make-temp-name))
         (tmp-name2 (tramp--test-make-temp-name))
@@ -973,6 +968,8 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
         (tmp-name4 (expand-file-name "foo" tmp-name1))
         (tmp-name5 (expand-file-name "foo" tmp-name2))
         (tmp-name6 (expand-file-name "foo" tmp-name3)))
+
+    ;; Copy complete directory.
     (unwind-protect
        (progn
          ;; Copy empty directory.
@@ -991,6 +988,31 @@ This tests also `file-directory-p' and 
`file-accessible-directory-p'."
       ;; Cleanup.
       (ignore-errors
        (delete-directory tmp-name1 'recursive)
+       (delete-directory tmp-name2 'recursive)))
+
+    ;; Copy directory contents.
+    (unwind-protect
+       (progn
+         ;; Copy empty directory.
+         (make-directory tmp-name1)
+         (write-region "foo" nil tmp-name4)
+         (should (file-directory-p tmp-name1))
+         (should (file-exists-p tmp-name4))
+         (copy-directory tmp-name1 tmp-name2 nil 'parents 'contents)
+         (should (file-directory-p tmp-name2))
+         (should (file-exists-p tmp-name5))
+         ;; Target directory does exist already.
+         (delete-file tmp-name5)
+         (should-not (file-exists-p tmp-name5))
+         (copy-directory tmp-name1 tmp-name2 nil 'parents 'contents)
+         (should (file-directory-p tmp-name2))
+         (should (file-exists-p tmp-name5))
+         (should-not (file-directory-p tmp-name3))
+         (should-not (file-exists-p tmp-name6)))
+
+      ;; Cleanup.
+      (ignore-errors
+       (delete-directory tmp-name1 'recursive)
        (delete-directory tmp-name2 'recursive)))))
 
 (ert-deftest tramp-test16-directory-files ()
@@ -1390,10 +1412,11 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
                  (format "%s:" method)
                  (file-name-all-completions (substring method 0 1) "/"))))
              (unless (zerop (length host))
-               (should
-                (member
-                 (format "%s:" host)
-                 (file-name-all-completions (substring host 0 1) "/"))))
+               (let ((tramp-default-method (or method tramp-default-method)))
+                 (should
+                  (member
+                   (format "%s:" host)
+                   (file-name-all-completions (substring host 0 1) "/")))))
              (unless (or (zerop (length method)) (zerop (length host)))
                (should
                 (member
@@ -1846,6 +1869,12 @@ This does not support globbing characters in file names 
(yet)."
        (string-match
        "ftp$" (file-remote-p tramp-test-temporary-file-directory 'method))))
 
+(defun tramp--test-rsync-p ()
+  "Check, whether the rsync method is used.
+This does not support special file names."
+  (string-equal
+   "rsync" (file-remote-p tramp-test-temporary-file-directory 'method)))
+
 (defun tramp--test-gvfs-p ()
   "Check, whether the remote host runs a GVFS based method.
 This requires restrictions of file name syntax."
@@ -2045,6 +2074,7 @@ Several special characters do not work properly there."
 (ert-deftest tramp-test31-special-characters ()
   "Check special characters in file names."
   (skip-unless (tramp--test-enabled))
+  (skip-unless (not (tramp--test-rsync-p)))
 
   (tramp--test-special-characters))
 
@@ -2053,6 +2083,7 @@ Several special characters do not work properly there."
 Use the `stat' command."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
+  (skip-unless (not (tramp--test-rsync-p)))
   (skip-unless
    (eq
     (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2072,6 +2103,7 @@ Use the `stat' command."
 Use the `perl' command."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
+  (skip-unless (not (tramp--test-rsync-p)))
   (skip-unless
    (eq
     (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2094,6 +2126,7 @@ Use the `perl' command."
 Use the `ls' command."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
+  (skip-unless (not (tramp--test-rsync-p)))
   (skip-unless
    (eq
     (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2129,6 +2162,7 @@ Use the `ls' command."
 (ert-deftest tramp-test32-utf8 ()
   "Check UTF8 encoding in file names and file contents."
   (skip-unless (tramp--test-enabled))
+  (skip-unless (not (tramp--test-rsync-p)))
 
   (tramp--test-utf8))
 
@@ -2137,6 +2171,7 @@ Use the `ls' command."
 Use the `stat' command."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
+  (skip-unless (not (tramp--test-rsync-p)))
   (skip-unless
    (eq
     (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2156,6 +2191,7 @@ Use the `stat' command."
 Use the `perl' command."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
+  (skip-unless (not (tramp--test-rsync-p)))
   (skip-unless
    (eq
     (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2178,6 +2214,7 @@ Use the `perl' command."
 Use the `ls' command."
   :tags '(:expensive-test)
   (skip-unless (tramp--test-enabled))
+  (skip-unless (not (tramp--test-rsync-p)))
   (skip-unless
    (eq
     (tramp-find-foreign-file-name-handler tramp-test-temporary-file-directory)
@@ -2355,8 +2392,7 @@ Since it unloads Tramp, it shall be the last test to run."
 
 ;; * Work on skipped tests.  Make a comment, when it is impossible.
 ;; * Fix `tramp-test06-directory-file-name' for `ftp'.
-;; * Fix `tramp-test15-copy-directory' for `smb'.  Using tar in a pipe
-;;   doesn't work well when an interactive password must be provided.
+;; * Fix `tramp-test15-copy-directory' for `rsync'.
 ;; * Fix `tramp-test27-start-file-process' on MS Windows (`process-send-eof'?).
 ;; * Fix Bug#16928.  Set expected error of 
`tramp-test33-asynchronous-requests'.
 ;; * Fix `tramp-test35-unload' (Not all symbols are unbound).  Set



reply via email to

[Prev in Thread] Current Thread [Next in Thread]