aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2009-11-23 15:59:07 +0000
committerMichael Albinus2009-11-23 15:59:07 +0000
commitb593f1055a64feec5ee98d6c850c705435136840 (patch)
tree85b973b4a50ba8522ed330b1de8f66945cdb4f49
parentcfc86c7a8657e1e027cfdf6f0b73998d90fa195c (diff)
downloademacs-b593f1055a64feec5ee98d6c850c705435136840.tar.gz
emacs-b593f1055a64feec5ee98d6c850c705435136840.zip
* net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
return. (tramp-handle-make-symbolic-link) (tramp-handle-dired-compress-file, tramp-handle-expand-file-name): Quote file names. (tramp-send-command-and-check): New argument DONT-SUPPRESS-ERR. (tramp-handle-process-file): Use it.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/net/tramp.el47
2 files changed, 41 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index e4b109fc650..70748be6673 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,13 @@
12009-11-23 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
4 return.
5 (tramp-handle-make-symbolic-link)
6 (tramp-handle-dired-compress-file, tramp-handle-expand-file-name):
7 Quote file names.
8 (tramp-send-command-and-check): New argument DONT-SUPPRESS-ERR.
9 (tramp-handle-process-file): Use it.
10
12009-11-23 Stefan Monnier <monnier@iro.umontreal.ca> 112009-11-23 Stefan Monnier <monnier@iro.umontreal.ca>
2 12
3 * window.el (move-to-window-line-last-op): Remove. 13 * window.el (move-to-window-line-last-op): Remove.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 89dca1eed28..d6b59341772 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1030,7 +1030,7 @@ Sometimes the prompt is reported to look like \"login as:\"."
1030(defcustom tramp-shell-prompt-pattern 1030(defcustom tramp-shell-prompt-pattern
1031 ;; Allow a prompt to start right after a ^M since it indeed would be 1031 ;; Allow a prompt to start right after a ^M since it indeed would be
1032 ;; displayed at the beginning of the line (and Zsh uses it). 1032 ;; displayed at the beginning of the line (and Zsh uses it).
1033 "\\(?:^\\| \\)[^#$%>\n]*[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*" 1033 "\\(?:^\\|\r\\)[^#$%>\n]*[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*"
1034 "Regexp to match prompts from remote shell. 1034 "Regexp to match prompts from remote shell.
1035Normally, Tramp expects you to configure `shell-prompt-pattern' 1035Normally, Tramp expects you to configure `shell-prompt-pattern'
1036correctly, but sometimes it happens that you are connecting to a 1036correctly, but sometimes it happens that you are connecting to a
@@ -2429,7 +2429,14 @@ target of the symlink differ."
2429 ;; that FILENAME belongs to. 2429 ;; that FILENAME belongs to.
2430 (zerop 2430 (zerop
2431 (tramp-send-command-and-check 2431 (tramp-send-command-and-check
2432 l (format "cd %s && %s -sf %s %s" cwd ln filename l-localname) t))))) 2432 l
2433 (format
2434 "cd %s && %s -sf %s %s"
2435 (tramp-shell-quote-argument cwd)
2436 ln
2437 (tramp-shell-quote-argument filename)
2438 (tramp-shell-quote-argument l-localname))
2439 t)))))
2433 2440
2434(defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix) 2441(defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
2435 "Like `load' for Tramp files." 2442 "Like `load' for Tramp files."
@@ -3957,7 +3964,8 @@ This is like `dired-recursive-delete-directory' for Tramp files."
3957 ;; We found an uncompression rule. 3964 ;; We found an uncompression rule.
3958 (tramp-message v 0 "Uncompressing %s..." file) 3965 (tramp-message v 0 "Uncompressing %s..." file)
3959 (when (zerop (tramp-send-command-and-check 3966 (when (zerop (tramp-send-command-and-check
3960 v (concat (nth 2 suffix) " " localname))) 3967 v (concat (nth 2 suffix) " "
3968 (tramp-shell-quote-argument localname))))
3961 (tramp-message v 0 "Uncompressing %s...done" file) 3969 (tramp-message v 0 "Uncompressing %s...done" file)
3962 ;; `dired-remove-file' is not defined in XEmacs 3970 ;; `dired-remove-file' is not defined in XEmacs
3963 (funcall (symbol-function 'dired-remove-file) file) 3971 (funcall (symbol-function 'dired-remove-file) file)
@@ -3968,7 +3976,8 @@ This is like `dired-recursive-delete-directory' for Tramp files."
3968 ;; Try gzip. 3976 ;; Try gzip.
3969 (tramp-message v 0 "Compressing %s..." file) 3977 (tramp-message v 0 "Compressing %s..." file)
3970 (when (zerop (tramp-send-command-and-check 3978 (when (zerop (tramp-send-command-and-check
3971 v (concat "gzip -f " localname))) 3979 v (concat "gzip -f "
3980 (tramp-shell-quote-argument localname))))
3972 (tramp-message v 0 "Compressing %s...done" file) 3981 (tramp-message v 0 "Compressing %s...done" file)
3973 ;; `dired-remove-file' is not defined in XEmacs 3982 ;; `dired-remove-file' is not defined in XEmacs
3974 (funcall (symbol-function 'dired-remove-file) file) 3983 (funcall (symbol-function 'dired-remove-file) file)
@@ -4126,11 +4135,13 @@ the result will be a local, non-Tramp, filename."
4126 (string-match "\\`su\\(do\\)?\\'" method)) 4135 (string-match "\\`su\\(do\\)?\\'" method))
4127 (setq uname (concat uname user))) 4136 (setq uname (concat uname user)))
4128 (setq uname 4137 (setq uname
4129 (with-connection-property v uname 4138 (with-connection-property v uname
4130 (tramp-send-command v (format "cd %s; pwd" uname)) 4139 (tramp-send-command
4131 (with-current-buffer (tramp-get-buffer v) 4140 v (format "cd %s; pwd" (tramp-shell-quote-argument uname)))
4132 (goto-char (point-min)) 4141 (with-current-buffer (tramp-get-buffer v)
4133 (buffer-substring (point) (tramp-compat-line-end-position))))) 4142 (goto-char (point-min))
4143 (buffer-substring
4144 (point) (tramp-compat-line-end-position)))))
4134 (setq localname (concat uname fname)))) 4145 (setq localname (concat uname fname))))
4135 ;; There might be a double slash, for example when "~/" 4146 ;; There might be a double slash, for example when "~/"
4136 ;; expands to "/". Remove this. 4147 ;; expands to "/". Remove this.
@@ -4357,7 +4368,8 @@ beginning of local filename are not substituted."
4357 (tramp-send-command-and-check 4368 (tramp-send-command-and-check
4358 v (format "\\cd %s; %s" 4369 v (format "\\cd %s; %s"
4359 (tramp-shell-quote-argument localname) 4370 (tramp-shell-quote-argument localname)
4360 command))) 4371 command)
4372 nil t))
4361 ;; We should show the output anyway. 4373 ;; We should show the output anyway.
4362 (when outbuf 4374 (when outbuf
4363 (with-current-buffer outbuf 4375 (with-current-buffer outbuf
@@ -6892,7 +6904,8 @@ Goes through the list `tramp-local-coding-commands' and
6892 (unless (zerop (tramp-send-command-and-check 6904 (unless (zerop (tramp-send-command-and-check
6893 vec 6905 vec
6894 (format "echo %s | %s | %s" 6906 (format "echo %s | %s | %s"
6895 magic rem-enc rem-dec) t)) 6907 magic rem-enc rem-dec)
6908 t))
6896 (throw 'wont-work-remote nil)) 6909 (throw 'wont-work-remote nil))
6897 6910
6898 (with-current-buffer (tramp-get-buffer vec) 6911 (with-current-buffer (tramp-get-buffer vec)
@@ -7250,20 +7263,22 @@ function waits for output unless NOOUTPUT is set."
7250 ;; Return value is whether end-of-output sentinel was found. 7263 ;; Return value is whether end-of-output sentinel was found.
7251 found))) 7264 found)))
7252 7265
7253(defun tramp-send-command-and-check (vec command &optional subshell) 7266(defun tramp-send-command-and-check
7267 (vec command &optional subshell dont-suppress-err)
7254 "Run COMMAND and check its exit status. 7268 "Run COMMAND and check its exit status.
7255Sends `echo $?' along with the COMMAND for checking the exit status. If 7269Sends `echo $?' along with the COMMAND for checking the exit status. If
7256COMMAND is nil, just sends `echo $?'. Returns the exit status found. 7270COMMAND is nil, just sends `echo $?'. Returns the exit status found.
7257 7271
7258If the optional argument SUBSHELL is non-nil, the command is executed in 7272If the optional argument SUBSHELL is non-nil, the command is
7259a subshell, ie surrounded by parentheses." 7273executed in a subshell, ie surrounded by parentheses. If
7274DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to /dev/null."
7260 (tramp-send-command 7275 (tramp-send-command
7261 vec 7276 vec
7262 (concat (if subshell "( " "") 7277 (concat (if subshell "( " "")
7263 command 7278 command
7264 (if command " 2>/dev/null; " "") 7279 (if command (if dont-suppress-err "; " " 2>/dev/null; ") "")
7265 "echo tramp_exit_status $?" 7280 "echo tramp_exit_status $?"
7266 (if subshell " )" " "))) 7281 (if subshell " )" "")))
7267 (with-current-buffer (tramp-get-connection-buffer vec) 7282 (with-current-buffer (tramp-get-connection-buffer vec)
7268 (goto-char (point-max)) 7283 (goto-char (point-max))
7269 (unless (re-search-backward "tramp_exit_status [0-9]+" nil t) 7284 (unless (re-search-backward "tramp_exit_status [0-9]+" nil t)