aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2019-07-15 11:11:59 +0200
committerMichael Albinus2019-07-15 11:11:59 +0200
commit966c4d3ba8896c86764bc8664ca43e04eadf711d (patch)
tree0e4df4c2f2abdadd0b9ccc77329843913fb94899
parentdea9970bc0deaf320e78c46a2e7456cbb6e7a0ea (diff)
downloademacs-966c4d3ba8896c86764bc8664ca43e04eadf711d.tar.gz
emacs-966c4d3ba8896c86764bc8664ca43e04eadf711d.zip
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.
-rw-r--r--lisp/net/tramp-sh.el50
1 files changed, 26 insertions, 24 deletions
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index ee0754fee94..9a0ead47552 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -266,11 +266,13 @@ The string is used in `tramp-methods'.")
266 (add-to-list 'tramp-methods 266 (add-to-list 'tramp-methods
267 '("sudo" 267 '("sudo"
268 (tramp-login-program "sudo") 268 (tramp-login-program "sudo")
269 ;; The password template must be masked. Otherwise, it could be 269 ;; The password template must be masked. Otherwise,
270 ;; interpreted as password prompt if the remote host echoes the command. 270 ;; it could be interpreted as password prompt if the
271 ;; remote host echoes the command.
271 (tramp-login-args (("-u" "%u") ("-s") ("-H") 272 (tramp-login-args (("-u" "%u") ("-s") ("-H")
272 ("-p" "P\"\"a\"\"s\"\"s\"\"w\"\"o\"\"r\"\"d\"\":"))) 273 ("-p" "P\"\"a\"\"s\"\"s\"\"w\"\"o\"\"r\"\"d\"\":")))
273 ;; Local $SHELL could be a nasty one, like zsh or fish. Let's override it. 274 ;; Local $SHELL could be a nasty one, like zsh or
275 ;; fish. Let's override it.
274 (tramp-login-env (("SHELL") ("/bin/sh"))) 276 (tramp-login-env (("SHELL") ("/bin/sh")))
275 (tramp-remote-shell "/bin/sh") 277 (tramp-remote-shell "/bin/sh")
276 (tramp-remote-shell-login ("-l")) 278 (tramp-remote-shell-login ("-l"))
@@ -2304,7 +2306,8 @@ The method used must be an out-of-band method."
2304 2306
2305 ;; Check which ones of source and target are Tramp files. 2307 ;; Check which ones of source and target are Tramp files.
2306 (setq source (funcall 2308 (setq source (funcall
2307 (if (and (file-directory-p filename) 2309 (if (and (string-equal method "rsync")
2310 (file-directory-p filename)
2308 (not (file-exists-p newname))) 2311 (not (file-exists-p newname)))
2309 #'file-name-as-directory 2312 #'file-name-as-directory
2310 #'identity) 2313 #'identity)
@@ -4557,25 +4560,24 @@ Goes through the list `tramp-inline-compress-commands'."
4557 "Checking local compress commands `%s', `%s' for sanity" 4560 "Checking local compress commands `%s', `%s' for sanity"
4558 compress decompress) 4561 compress decompress)
4559 (with-temp-buffer 4562 (with-temp-buffer
4560 (unless 4563 (unless (zerop
4561 (and 4564 (tramp-call-local-coding-command
4562 (zerop 4565 (format
4563 (tramp-call-local-coding-command 4566 "echo %s | %s | %s" magic
4564 (format 4567 ;; Windows shells need the program file name
4565 "echo %s | %s | %s" magic 4568 ;; after the pipe symbol be quoted if they use
4566 ;; Windows shells need the program file name after 4569 ;; forward slashes as directory separators.
4567 ;; the pipe symbol be quoted if they use forward 4570 (mapconcat
4568 ;; slashes as directory separators. 4571 #'tramp-unquote-shell-quote-argument
4569 (mapconcat 4572 (split-string compress) " ")
4570 #'tramp-unquote-shell-quote-argument 4573 (mapconcat
4571 (split-string compress) " ") 4574 #'tramp-unquote-shell-quote-argument
4572 (mapconcat 4575 (split-string decompress) " "))
4573 #'tramp-unquote-shell-quote-argument 4576 nil t))
4574 (split-string decompress) " ")) 4577 (throw 'next nil))
4575 nil t)) 4578 (goto-char (point-min))
4576 (string-match 4579 (unless (looking-at-p (regexp-quote magic))
4577 (concat "^" (regexp-quote magic) "$") (buffer-string))) 4580 (throw 'next nil)))
4578 (throw 'next nil)))
4579 (tramp-message 4581 (tramp-message
4580 vec 5 4582 vec 5
4581 "Checking remote compress commands `%s', `%s' for sanity" 4583 "Checking remote compress commands `%s', `%s' for sanity"
@@ -4585,7 +4587,7 @@ Goes through the list `tramp-inline-compress-commands'."
4585 (throw 'next nil)) 4587 (throw 'next nil))
4586 (with-current-buffer (tramp-get-buffer vec) 4588 (with-current-buffer (tramp-get-buffer vec)
4587 (goto-char (point-min)) 4589 (goto-char (point-min))
4588 (unless (looking-at (regexp-quote magic)) 4590 (unless (looking-at-p (regexp-quote magic))
4589 (throw 'next nil))) 4591 (throw 'next nil)))
4590 (setq found t))) 4592 (setq found t)))
4591 4593