aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2009-07-16 10:24:07 +0000
committerMichael Albinus2009-07-16 10:24:07 +0000
commitbede3e9f87bd10b0fb0f3f516353667c63082dd4 (patch)
tree66d2dc482067589e735012815cf06d3a827e201b
parent7653ca1dfb92b95764536957c7341e79c4efa898 (diff)
downloademacs-bede3e9f87bd10b0fb0f3f516353667c63082dd4.tar.gz
emacs-bede3e9f87bd10b0fb0f3f516353667c63082dd4.zip
* net/tramp.el (tramp-wait-for-output): Handle the case when
commands do not return a newline but a null byte before the shell prompt. (Bug#3858)
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/net/tramp.el22
2 files changed, 19 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 785daed8197..a3591f99e49 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12009-07-16 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-wait-for-output): Handle the case when
4 commands do not return a newline but a null byte before the shell
5 prompt. (Bug#3858)
6
12009-07-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 72009-07-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 8
3 * term/ns-win.el (ns-set-alpha): Don't declare. 9 * term/ns-win.el (ns-set-alpha): Don't declare.
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 444f55ac5d2..6de2346b766 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3898,15 +3898,15 @@ beginning of local filename are not substituted."
3898 3898
3899 ;; Determine output. 3899 ;; Determine output.
3900 (cond 3900 (cond
3901 ;; Just a buffer 3901 ;; Just a buffer.
3902 ((bufferp destination) 3902 ((bufferp destination)
3903 (setq outbuf destination)) 3903 (setq outbuf destination))
3904 ;; A buffer name 3904 ;; A buffer name.
3905 ((stringp destination) 3905 ((stringp destination)
3906 (setq outbuf (get-buffer-create destination))) 3906 (setq outbuf (get-buffer-create destination)))
3907 ;; (REAL-DESTINATION ERROR-DESTINATION) 3907 ;; (REAL-DESTINATION ERROR-DESTINATION)
3908 ((consp destination) 3908 ((consp destination)
3909 ;; output 3909 ;; output.
3910 (cond 3910 (cond
3911 ((bufferp (car destination)) 3911 ((bufferp (car destination))
3912 (setq outbuf (car destination))) 3912 (setq outbuf (car destination)))
@@ -3914,7 +3914,7 @@ beginning of local filename are not substituted."
3914 (setq outbuf (get-buffer-create (car destination)))) 3914 (setq outbuf (get-buffer-create (car destination))))
3915 ((car destination) 3915 ((car destination)
3916 (setq outbuf (current-buffer)))) 3916 (setq outbuf (current-buffer))))
3917 ;; stderr 3917 ;; stderr.
3918 (cond 3918 (cond
3919 ((stringp (cadr destination)) 3919 ((stringp (cadr destination))
3920 (setcar (cdr destination) (expand-file-name (cadr destination))) 3920 (setcar (cdr destination) (expand-file-name (cadr destination)))
@@ -3927,7 +3927,7 @@ beginning of local filename are not substituted."
3927 (setq stderr (tramp-make-tramp-temp-file v) 3927 (setq stderr (tramp-make-tramp-temp-file v)
3928 tmpstderr (tramp-make-tramp-file-name 3928 tmpstderr (tramp-make-tramp-file-name
3929 method user host stderr)))) 3929 method user host stderr))))
3930 ;; stderr to be discarded 3930 ;; stderr to be discarded.
3931 ((null (cadr destination)) 3931 ((null (cadr destination))
3932 (setq stderr "/dev/null")))) 3932 (setq stderr "/dev/null"))))
3933 ;; 't 3933 ;; 't
@@ -6660,10 +6660,14 @@ function waits for output unless NOOUTPUT is set."
6660(defun tramp-wait-for-output (proc &optional timeout) 6660(defun tramp-wait-for-output (proc &optional timeout)
6661 "Wait for output from remote rsh command." 6661 "Wait for output from remote rsh command."
6662 (with-current-buffer (process-buffer proc) 6662 (with-current-buffer (process-buffer proc)
6663 ;; Initially, `tramp-end-of-output' is "$ ". There might be 6663 (let* (;; Initially, `tramp-end-of-output' is "$ ". There might
6664 ;; leading escape sequences, which must be ignored. 6664 ;; be leading escape sequences, which must be ignored.
6665 (let* ((regexp (format "^[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output))) 6665 (regexp (format "[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output)))
6666 (found (tramp-wait-for-regexp proc timeout regexp))) 6666 ;; Sometimes, the commands do not return a newline but a
6667 ;; null byte before the shell prompt, for example "git
6668 ;; ls-files -c -z ...".
6669 (regexp1 (format "\\(^\\|\000\\)%s" regexp))
6670 (found (tramp-wait-for-regexp proc timeout regexp1)))
6667 (if found 6671 (if found
6668 (let (buffer-read-only) 6672 (let (buffer-read-only)
6669 (goto-char (point-max)) 6673 (goto-char (point-max))