emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 966c4d3: Fix edge cases in Tramp's copy


From: Michael Albinus
Subject: [Emacs-diffs] master 966c4d3: Fix edge cases in Tramp's copy
Date: Mon, 15 Jul 2019 05:12:09 -0400 (EDT)

branch: master
commit 966c4d3ba8896c86764bc8664ca43e04eadf711d
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>

    Fix edge cases in Tramp's copy
    
    * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band):
    Special handling for "rsync".
    (tramp-find-inline-compress): Make check more robust on MS Windows.
---
 lisp/net/tramp-sh.el | 50 ++++++++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index ee0754f..9a0ead4 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -266,11 +266,13 @@ The string is used in `tramp-methods'.")
  (add-to-list 'tramp-methods
               '("sudo"
                 (tramp-login-program        "sudo")
-                ;; The password template must be masked.  Otherwise, it could 
be
-                ;; interpreted as password prompt if the remote host echoes 
the command.
+                ;; The password template must be masked.  Otherwise,
+                ;; it could be interpreted as password prompt if the
+                ;; remote host echoes the command.
                 (tramp-login-args           (("-u" "%u") ("-s") ("-H")
                                             ("-p" 
"P\"\"a\"\"s\"\"s\"\"w\"\"o\"\"r\"\"d\"\":")))
-                ;; Local $SHELL could be a nasty one, like zsh or fish.  Let's 
override it.
+                ;; Local $SHELL could be a nasty one, like zsh or
+                ;; fish.  Let's override it.
                 (tramp-login-env            (("SHELL") ("/bin/sh")))
                 (tramp-remote-shell         "/bin/sh")
                 (tramp-remote-shell-login   ("-l"))
@@ -2304,7 +2306,8 @@ The method used must be an out-of-band method."
 
        ;; Check which ones of source and target are Tramp files.
        (setq source (funcall
-                     (if (and (file-directory-p filename)
+                     (if (and (string-equal method "rsync")
+                              (file-directory-p filename)
                               (not (file-exists-p newname)))
                          #'file-name-as-directory
                        #'identity)
@@ -4557,25 +4560,24 @@ Goes through the list `tramp-inline-compress-commands'."
           "Checking local compress commands `%s', `%s' for sanity"
           compress decompress)
           (with-temp-buffer
-            (unless
-                (and
-                (zerop
-                 (tramp-call-local-coding-command
-                  (format
-                   "echo %s | %s | %s" magic
-                   ;; Windows shells need the program file name after
-                   ;; the pipe symbol be quoted if they use forward
-                   ;; slashes as directory separators.
-                   (mapconcat
-                    #'tramp-unquote-shell-quote-argument
-                     (split-string compress) " ")
-                   (mapconcat
-                    #'tramp-unquote-shell-quote-argument
-                     (split-string decompress) " "))
-                  nil t))
-                (string-match
-                 (concat "^" (regexp-quote magic) "$") (buffer-string)))
-              (throw 'next nil)))
+            (unless (zerop
+                    (tramp-call-local-coding-command
+                     (format
+                      "echo %s | %s | %s" magic
+                      ;; Windows shells need the program file name
+                      ;; after the pipe symbol be quoted if they use
+                      ;; forward slashes as directory separators.
+                      (mapconcat
+                       #'tramp-unquote-shell-quote-argument
+                       (split-string compress) " ")
+                      (mapconcat
+                       #'tramp-unquote-shell-quote-argument
+                       (split-string decompress) " "))
+                     nil t))
+              (throw 'next nil))
+           (goto-char (point-min))
+           (unless (looking-at-p (regexp-quote magic))
+             (throw 'next nil)))
           (tramp-message
           vec 5
           "Checking remote compress commands `%s', `%s' for sanity"
@@ -4585,7 +4587,7 @@ Goes through the list `tramp-inline-compress-commands'."
            (throw 'next nil))
          (with-current-buffer (tramp-get-buffer vec)
            (goto-char (point-min))
-           (unless (looking-at (regexp-quote magic))
+           (unless (looking-at-p (regexp-quote magic))
              (throw 'next nil)))
          (setq found t)))
 



reply via email to

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