Commit 966c4d3b authored by Michael Albinus's avatar Michael Albinus

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.
parent dea9970b
Pipeline #2443 failed with stage
in 0 seconds
......@@ -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)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment