]> git.eshelyaron.com Git - emacs.git/commitdiff
* net/tramp.el (tramp-shell-prompt-pattern): Use \r for carriage
authorMichael Albinus <michael.albinus@gmx.de>
Mon, 23 Nov 2009 15:59:07 +0000 (15:59 +0000)
committerMichael Albinus <michael.albinus@gmx.de>
Mon, 23 Nov 2009 15:59:07 +0000 (15:59 +0000)
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.

lisp/ChangeLog
lisp/net/tramp.el

index e4b109fc650091fa2d665cf956fd2252634de5bf..70748be66733e4485cdf2d34a64cc69c64a71ca0 100644 (file)
@@ -1,3 +1,13 @@
+2009-11-23  Michael Albinus  <michael.albinus@gmx.de>
+
+       * 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.
+
 2009-11-23  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * window.el (move-to-window-line-last-op): Remove.
index 89dca1eed285d9337ffb9a5f7e50d86af0eed13b..d6b593417728de837bc1239443fe34716fb39416 100644 (file)
@@ -1030,7 +1030,7 @@ Sometimes the prompt is reported to look like \"login as:\"."
 (defcustom tramp-shell-prompt-pattern
   ;; Allow a prompt to start right after a ^M since it indeed would be
   ;; displayed at the beginning of the line (and Zsh uses it).
-  "\\(?:^\\|\r\\)[^#$%>\n]*[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*"
+  "\\(?:^\\|\r\\)[^#$%>\n]*[#$%>] *\\(\e\\[[0-9;]*[a-zA-Z] *\\)*"
   "Regexp to match prompts from remote shell.
 Normally, Tramp expects you to configure `shell-prompt-pattern'
 correctly, but sometimes it happens that you are connecting to a
@@ -2429,7 +2429,14 @@ target of the symlink differ."
       ;; that FILENAME belongs to.
       (zerop
        (tramp-send-command-and-check
-       l (format "cd %s && %s -sf %s %s" cwd ln filename l-localname) t)))))
+       l
+       (format
+        "cd %s && %s -sf %s %s"
+        (tramp-shell-quote-argument cwd)
+        ln
+        (tramp-shell-quote-argument filename)
+        (tramp-shell-quote-argument l-localname))
+       t)))))
 
 (defun tramp-handle-load (file &optional noerror nomessage nosuffix must-suffix)
   "Like `load' for Tramp files."
@@ -3957,7 +3964,8 @@ This is like `dired-recursive-delete-directory' for Tramp files."
               ;; We found an uncompression rule.
               (tramp-message v 0 "Uncompressing %s..." file)
               (when (zerop (tramp-send-command-and-check
-                            v (concat (nth 2 suffix) " " localname)))
+                            v (concat (nth 2 suffix) " "
+                                      (tramp-shell-quote-argument localname))))
                 (tramp-message v 0 "Uncompressing %s...done" file)
                 ;; `dired-remove-file' is not defined in XEmacs
                 (funcall (symbol-function 'dired-remove-file) file)
@@ -3968,7 +3976,8 @@ This is like `dired-recursive-delete-directory' for Tramp files."
               ;; Try gzip.
               (tramp-message v 0 "Compressing %s..." file)
               (when (zerop (tramp-send-command-and-check
-                            v (concat "gzip -f " localname)))
+                            v (concat "gzip -f "
+                                      (tramp-shell-quote-argument localname))))
                 (tramp-message v 0 "Compressing %s...done" file)
                 ;; `dired-remove-file' is not defined in XEmacs
                 (funcall (symbol-function 'dired-remove-file) file)
@@ -4126,11 +4135,13 @@ the result will be a local, non-Tramp, filename."
                     (string-match "\\`su\\(do\\)?\\'" method))
            (setq uname (concat uname user)))
          (setq uname
-           (with-connection-property v uname
-             (tramp-send-command v (format "cd %s; pwd" uname))
-             (with-current-buffer (tramp-get-buffer v)
-               (goto-char (point-min))
-               (buffer-substring (point) (tramp-compat-line-end-position)))))
+               (with-connection-property v uname
+                 (tramp-send-command
+                  v (format "cd %s; pwd" (tramp-shell-quote-argument uname)))
+                 (with-current-buffer (tramp-get-buffer v)
+                   (goto-char (point-min))
+                   (buffer-substring
+                    (point) (tramp-compat-line-end-position)))))
          (setq localname (concat uname fname))))
       ;; There might be a double slash, for example when "~/"
       ;; expands to "/".  Remove this.
@@ -4357,7 +4368,8 @@ beginning of local filename are not substituted."
                     (tramp-send-command-and-check
                      v (format "\\cd %s; %s"
                                (tramp-shell-quote-argument localname)
-                               command)))
+                               command)
+                    nil t))
            ;; We should show the output anyway.
            (when outbuf
              (with-current-buffer outbuf
@@ -6892,7 +6904,8 @@ Goes through the list `tramp-local-coding-commands' and
                  (unless (zerop (tramp-send-command-and-check
                                  vec
                                  (format "echo %s | %s | %s"
-                                         magic rem-enc rem-dec) t))
+                                         magic rem-enc rem-dec)
+                                 t))
                    (throw 'wont-work-remote nil))
 
                  (with-current-buffer (tramp-get-buffer vec)
@@ -7250,20 +7263,22 @@ function waits for output unless NOOUTPUT is set."
       ;; Return value is whether end-of-output sentinel was found.
       found)))
 
-(defun tramp-send-command-and-check (vec command &optional subshell)
+(defun tramp-send-command-and-check
+  (vec command &optional subshell dont-suppress-err)
   "Run COMMAND and check its exit status.
 Sends `echo $?' along with the COMMAND for checking the exit status.  If
 COMMAND is nil, just sends `echo $?'.  Returns the exit status found.
 
-If the optional argument SUBSHELL is non-nil, the command is executed in
-a subshell, ie surrounded by parentheses."
+If the optional argument SUBSHELL is non-nil, the command is
+executed in a subshell, ie surrounded by parentheses.  If
+DONT-SUPPRESS-ERR is non-nil, stderr won't be sent to /dev/null."
   (tramp-send-command
    vec
    (concat (if subshell "( " "")
           command
-          (if command " 2>/dev/null; " "")
+          (if command (if dont-suppress-err "; " " 2>/dev/null; ") "")
           "echo tramp_exit_status $?"
-          (if subshell " )" " ")))
+          (if subshell " )" "")))
   (with-current-buffer (tramp-get-connection-buffer vec)
     (goto-char (point-max))
     (unless (re-search-backward "tramp_exit_status [0-9]+" nil t)