tramp-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tramp (2.0.35); two tramp buffers (nil/, ssh/) are created on startu


From: Kai Großjohann
Subject: Re: tramp (2.0.35); two tramp buffers (nil/, ssh/) are created on startup
Date: Tue, 24 Jun 2003 21:14:40 +0200
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

Hanak David <address@hidden> writes:

> The problem could be fixed with the following patch:

Thank you for the report.  I believe that's not the right solution;
it does not allow you to use more than one method to contact the same
host.  (For whatever reason there might be.)

I now changed things to always put the method into the buffer name,
even when the method is defaulted.

Please try the following patch (against 2.0.35) or the version from
CVS.

Index: lisp/tramp.el
===================================================================
RCS file: /cvsroot/tramp/tramp/lisp/tramp.el,v
retrieving revision 2.316
diff -u -r2.316 tramp.el
--- lisp/tramp.el       17 Jun 2003 09:25:25 -0000      2.316
+++ lisp/tramp.el       24 Jun 2003 19:13:56 -0000
@@ -1171,6 +1171,20 @@
   :group 'tramp
   :type '(repeat (list variable function)))
 
+(defcustom tramp-initial-commands
+  '("unset autocorrect")
+  "List of commands to send to the first remote shell that we see.
+These commands will be sent to any shell, and thus they should be
+designed to work in such circumstances.  Also, restrict the commands
+to the bare necessity for getting the remote shell into a state
+where it is possible to execute the Bourne-ish shell.
+
+At the moment, the command to execute the Bourne-ish shell uses strange
+quoting which `tcsh' tries to correct, so we send the command \"unset
+autocorrect\" to the remote host."
+  :group 'tramp
+  :type '(repeat string))
+
 ;; Chunked sending kluge.  We set this to 500 for black-listed constellations
 ;; known to have a bug in `process-send-string'; some ssh connections appear
 ;; to drop bytes when data is sent too quickly.
@@ -4115,12 +4129,12 @@
 
 (defun tramp-buffer-name (multi-method method user host)
   "A name for the connection buffer for USER at HOST using METHOD."
-  (cond (multi-method
-         (tramp-buffer-name-multi-method "tramp" multi-method method user 
host))
-        (user
-         (format "*tramp/%s address@hidden" method user host))
-        (t
-         (format "*tramp/%s %s*" method host))))
+  (if multi-method
+      (tramp-buffer-name-multi-method "tramp" multi-method method user host)
+    (let ((method (tramp-find-method multi-method method user host)))
+      (if user
+         (format "*tramp/%s address@hidden" method user host))
+      (format "*tramp/%s %s*" method host))))
 
 (defun tramp-buffer-name-multi-method (prefix multi-method method user host)
   "A name for the multi method connection buffer.
@@ -4150,13 +4164,13 @@
 
 (defun tramp-debug-buffer-name (multi-method method user host)
   "A name for the debug buffer for USER at HOST using METHOD."
-  (cond (multi-method
-         (tramp-buffer-name-multi-method "debug tramp"
-                                         multi-method method user host))
-        (user
-         (format "*debug tramp/%s address@hidden" method user host))
-        (t
-         (format "*debug tramp/%s %s*" method host))))
+  (if multi-method
+      (tramp-buffer-name-multi-method "debug tramp"
+                                     multi-method method user host)
+    (let ((method (tramp-find-method multi-method method user host)))
+      (if user
+         (format "*debug tramp/%s address@hidden" method user host)
+       (format "*debug tramp/%s %s*" method host)))))
 
 (defun tramp-get-debug-buffer (multi-method method user host)
   "Get the debug buffer for USER at HOST using METHOD."
@@ -4540,6 +4554,28 @@
     (unless (eq exit 'ok)
       (error "Login failed"))))
 
+;; Functions to execute when we have seen the remote shell prompt but
+;; before we exec the Bourne-ish shell.  Note that these commands
+;; might be sent to any shell, not just a Bourne-ish shell.  This
+;; means that the commands need to work in all shells.  (It is also
+;; okay for some commands to just fail with an error message, but
+;; please make sure that they at least don't crash the odd shell people
+;; might be running...)
+(defun tramp-process-initial-commands (p
+                                      multi-method method user host
+                                      commands)
+  "Send list of commands to remote host, in order."
+  (let (cmd)
+    (while commands
+      (setq cmd (pop commands))
+      (erase-buffer)
+      (tramp-message 10 "Sending command to remote shell: %s"
+                    cmd)
+      (tramp-send-command multi-method method user host cmd)
+      (tramp-barf-if-no-shell-prompt
+       p 60 "Remote shell command failed: %s" cmd))
+    (erase-buffer)))
+
 ;; The actual functions for opening connections.
 
 (defun tramp-open-connection-telnet (multi-method method user host)
@@ -4976,6 +5012,8 @@
   ;; a Kerberos login.
   (sit-for 1)
   (tramp-discard-garbage-erase-buffer p multi-method method user host)
+  (tramp-process-initial-commands p multi-method method user host
+                                 tramp-initial-commands)
   ;; It is useful to set the prompt in the following command because
   ;; some people have a setting for $PS1 which /bin/sh doesn't know
   ;; about and thus /bin/sh will display a strange prompt.  For

-- 
~/.signature





reply via email to

[Prev in Thread] Current Thread [Next in Thread]