aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Albinus2007-11-12 20:04:13 +0000
committerMichael Albinus2007-11-12 20:04:13 +0000
commite42c6bbc41016ea8a669aeb60a74c8ae97560755 (patch)
tree1bd204385aaa571e58d43c09a8555c844e74fa16
parentbc5300d37d7fc1ef4a21f3b22f2b5457f48fa206 (diff)
downloademacs-e42c6bbc41016ea8a669aeb60a74c8ae97560755.tar.gz
emacs-e42c6bbc41016ea8a669aeb60a74c8ae97560755.zip
* net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
whether the output of "uname -sr" has been changed.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/net/tramp.el40
2 files changed, 37 insertions, 8 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7e5adc3fdd3..bcb93e8a19c 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12007-11-12 Michael Albinus <michael.albinus@gmx.de>
2
3 * net/tramp.el (tramp-open-connection-setup-interactive-shell): Check
4 whether the output of "uname -sr" has been changed.
5
12007-11-12 Vinicius Jose Latorre <viniciusjl@ig.com.br> 62007-11-12 Vinicius Jose Latorre <viniciusjl@ig.com.br>
2 7
3 * progmodes/compile.el (compilation-error-regexp-alist-alist): Insert 8 * progmodes/compile.el (compilation-error-regexp-alist-alist): Insert
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 93fdea9ab27..a1b4bec1f5f 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5624,6 +5624,7 @@ process to set up. VEC specifies the connection."
5624 (tramp-get-method-parameter 5624 (tramp-get-method-parameter
5625 (tramp-file-name-method vec) 'tramp-remote-sh)) 5625 (tramp-file-name-method vec) 'tramp-remote-sh))
5626 t)) 5626 t))
5627
5627 (tramp-message vec 5 "Setting shell prompt") 5628 (tramp-message vec 5 "Setting shell prompt")
5628 ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we must 5629 ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we must
5629 ;; use "\n" here, not tramp-rsh-end-of-line. 5630 ;; use "\n" here, not tramp-rsh-end-of-line.
@@ -5639,6 +5640,7 @@ process to set up. VEC specifies the connection."
5639 ;; command. We must reread for the real prompt. 5640 ;; command. We must reread for the real prompt.
5640 (with-current-buffer (process-buffer proc) 5641 (with-current-buffer (process-buffer proc)
5641 (when (> (point-max) (point-min)) (tramp-wait-for-output proc))) 5642 (when (> (point-max) (point-min)) (tramp-wait-for-output proc)))
5643
5642 ;; Disable echo. 5644 ;; Disable echo.
5643 (tramp-message vec 5 "Setting up remote shell environment") 5645 (tramp-message vec 5 "Setting up remote shell environment")
5644 (tramp-send-command vec "stty -inlcr -echo kill '^U' erase '^H'" t) 5646 (tramp-send-command vec "stty -inlcr -echo kill '^U' erase '^H'" t)
@@ -5654,6 +5656,7 @@ process to set up. VEC specifies the connection."
5654 ;; Make sure backspaces and their echo are enabled and no line 5656 ;; Make sure backspaces and their echo are enabled and no line
5655 ;; width magic interferes with them. 5657 ;; width magic interferes with them.
5656 (tramp-send-command vec "stty icanon erase ^H cols 32767" t))) 5658 (tramp-send-command vec "stty icanon erase ^H cols 32767" t)))
5659
5657 ;; Try to set up the coding system correctly. 5660 ;; Try to set up the coding system correctly.
5658 ;; CCC this can't be the right way to do it. Hm. 5661 ;; CCC this can't be the right way to do it. Hm.
5659 (tramp-message vec 5 "Determining coding system") 5662 (tramp-message vec 5 "Determining coding system")
@@ -5685,11 +5688,30 @@ process to set up. VEC specifies the connection."
5685 ;; stty, instead. 5688 ;; stty, instead.
5686 (tramp-send-command vec "stty -onlcr" t)))) 5689 (tramp-send-command vec "stty -onlcr" t))))
5687 (tramp-send-command vec "set +o vi +o emacs" t) 5690 (tramp-send-command vec "set +o vi +o emacs" t)
5688 ;; Check whether the remote host suffers from buggy `send-process-string'. 5691
5689 ;; This is known for FreeBSD (see comment in `send_process', file process.c). 5692 ;; Check whether the output of "uname -sr" has been changed. If
5690 ;; I've tested sending 624 bytes successfully, sending 625 bytes failed. 5693 ;; yes, this is a strong indication that we must expire all
5691 ;; Emacs makes a hack when this host type is detected locally. It cannot 5694 ;; connection properties.
5692 ;; handle remote hosts, though. 5695 (tramp-message vec 5 "Checking system information")
5696 (let ((old-uname (tramp-get-connection-property vec "uname" nil))
5697 (new-uname
5698 (tramp-set-connection-property
5699 vec "uname"
5700 (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\""))))
5701 (when (and (stringp old-uname) (not (string-equal old-uname new-uname)))
5702 (tramp-cleanup-connection vec)
5703 (signal
5704 'quit
5705 (list (format
5706 "Connection reset, because remote host changed from `%s' to `%s'"
5707 old-uname new-uname)))))
5708
5709 ;; Check whether the remote host suffers from buggy
5710 ;; `send-process-string'. This is known for FreeBSD (see comment in
5711 ;; `send_process', file process.c). I've tested sending 624 bytes
5712 ;; successfully, sending 625 bytes failed. Emacs makes a hack when
5713 ;; this host type is detected locally. It cannot handle remote
5714 ;; hosts, though.
5693 (with-connection-property proc "chunksize" 5715 (with-connection-property proc "chunksize"
5694 (cond 5716 (cond
5695 ((and (integerp tramp-chunksize) (> tramp-chunksize 0)) 5717 ((and (integerp tramp-chunksize) (> tramp-chunksize 0))
@@ -5698,12 +5720,12 @@ process to set up. VEC specifies the connection."
5698 (tramp-message 5720 (tramp-message
5699 vec 5 "Checking remote host type for `send-process-string' bug") 5721 vec 5 "Checking remote host type for `send-process-string' bug")
5700 (if (string-match 5722 (if (string-match
5701 "^FreeBSD" 5723 "^FreeBSD" (tramp-get-connection-property vec "uname" ""))
5702 (with-connection-property vec "uname"
5703 (tramp-send-command-and-read vec "echo \\\"`uname -sr`\\\"")))
5704 500 0)))) 5724 500 0))))
5725
5705 ;; Set remote PATH variable. 5726 ;; Set remote PATH variable.
5706 (tramp-set-remote-path vec) 5727 (tramp-set-remote-path vec)
5728
5707 ;; Search for a good shell before searching for a command which 5729 ;; Search for a good shell before searching for a command which
5708 ;; checks if a file exists. This is done because Tramp wants to use 5730 ;; checks if a file exists. This is done because Tramp wants to use
5709 ;; "test foo; echo $?" to check if various conditions hold, and 5731 ;; "test foo; echo $?" to check if various conditions hold, and
@@ -5713,8 +5735,10 @@ process to set up. VEC specifies the connection."
5713 ;; with buggy /bin/sh implementations will have a working bash or 5735 ;; with buggy /bin/sh implementations will have a working bash or
5714 ;; ksh. Whee... 5736 ;; ksh. Whee...
5715 (tramp-find-shell vec) 5737 (tramp-find-shell vec)
5738
5716 ;; Disable unexpected output. 5739 ;; Disable unexpected output.
5717 (tramp-send-command vec "mesg n; biff n" t) 5740 (tramp-send-command vec "mesg n; biff n" t)
5741
5718 ;; Set the environment. 5742 ;; Set the environment.
5719 (tramp-message vec 5 "Setting default environment") 5743 (tramp-message vec 5 "Setting default environment")
5720 (let ((env (copy-sequence tramp-remote-process-environment)) 5744 (let ((env (copy-sequence tramp-remote-process-environment))