changeset 51968:e4c4c45ea013

Tramp 2.0.36 released. * net/tramp.el (tramp-default-password-end-of-line): Renamed from tramp-password-end-of-line. (tramp-password-end-of-line): New method parameter. (tramp-get-password-end-of-line): Function to access method parameter `tramp-password-end-of-line', or variable `tramp-default-password-end-of-line' (default value). (tramp-methods): Add entries for new parameter tramp-password-end-of-line. (tramp-enter-password): Use new function `tramp-get-password-end-of-line'. (tramp-handle-insert-file-contents): Do not unconditionally inhibit the file operation file-local-copy, only do that when the inhibit-file-name-operation is currently insert-file-contents. This fixes finding remote CVS-controlled files. (It would barf on inserting the CVS/Entries file literally, because the file-local-copy handler wasn't called.) (tramp-handle-shell-command): Support optional third arg ERROR-BUFFER. (tramp-sh-extra-args): Adapt defcustom type to XEmacs. (tramp-initial-commands): New variable. (tramp-process-initial-commands): New function, using the variable. (tramp-open-connection-setup-interactive-shell): Call the new function. (tramp-buffer-name, tramp-debug-buffer-name): Always put the method into the buffer name, never use nil. Reported by Hanak David <dhanak@inf.bme.hu>. (tramp-open-connection-setup-interactive-shell): Erase buffer before sending "stty -onlcr". * net/tramp-vc.el (vc-workfile-unchanged-p): Add comment.
author Kai Großjohann <kgrossjo@eu.uu.net>
date Sun, 20 Jul 2003 19:04:48 +0000
parents 2693b0669cc1
children 89677b4e4446
files lisp/ChangeLog lisp/net/tramp-vc.el lisp/net/tramp.el lisp/net/trampver.el
diffstat 4 files changed, 213 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Jul 20 19:00:56 2003 +0000
+++ b/lisp/ChangeLog	Sun Jul 20 19:04:48 2003 +0000
@@ -1,3 +1,37 @@
+2003-07-20  Kai Gro,A_(Bjohann  <kai.grossjohann@gmx.net>
+	Version 2.0.36 of Tramp released.
+
+	* net/tramp.el (tramp-default-password-end-of-line): Renamed from
+	tramp-password-end-of-line.
+	(tramp-password-end-of-line): New method parameter.
+	(tramp-get-password-end-of-line): Function to access method
+	parameter `tramp-password-end-of-line', or variable
+	`tramp-default-password-end-of-line' (default value).
+	(tramp-methods): Add entries for new parameter
+	tramp-password-end-of-line.
+	(tramp-enter-password): Use new function
+	`tramp-get-password-end-of-line'.
+	(tramp-handle-insert-file-contents): Do not
+	unconditionally inhibit the file operation file-local-copy, only
+	do that when the inhibit-file-name-operation is currently
+	insert-file-contents.  This fixes finding remote CVS-controlled
+	files.  (It would barf on inserting the CVS/Entries file
+	literally, because the file-local-copy handler wasn't called.)
+	(tramp-handle-shell-command): Support optional third arg
+	ERROR-BUFFER.
+	(tramp-sh-extra-args): Adapt defcustom type to XEmacs.
+	(tramp-initial-commands): New variable.
+	(tramp-process-initial-commands): New function, using the variable.
+	(tramp-open-connection-setup-interactive-shell): Call the new
+	function.
+	(tramp-buffer-name, tramp-debug-buffer-name): Always put the
+	method into the buffer name, never use nil.  Reported by Hanak
+	David <dhanak@inf.bme.hu>.
+	(tramp-open-connection-setup-interactive-shell): Erase buffer
+	before sending "stty -onlcr".
+
+	* net/tramp-vc.el (vc-workfile-unchanged-p): Add comment.
+
 2003-07-19  Markus Rost  <rost@math.ohio-state.edu>
 
 	* textmodes/artist.el (artist-erase-char): Fix default value using
--- a/lisp/net/tramp-vc.el	Sun Jul 20 19:00:56 2003 +0000
+++ b/lisp/net/tramp-vc.el	Sun Jul 20 19:04:48 2003 +0000
@@ -336,6 +336,9 @@
 	   (tramp-tramp-file-p filename)
 	   (not
 	    (let ((v	(tramp-dissect-file-name filename)))
+	      ;; The following check is probably to test whether
+	      ;; file-attributes returns correct last modification
+	      ;; times.  This check needs to be changed.
 	      (tramp-get-remote-perl (tramp-file-name-multi-method v)
 				   (tramp-file-name-method v)
 				   (tramp-file-name-user v)
--- a/lisp/net/tramp.el	Sun Jul 20 19:00:56 2003 +0000
+++ b/lisp/net/tramp.el	Sun Jul 20 19:04:48 2003 +0000
@@ -238,28 +238,32 @@
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           nil)
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   "-p"))
+              (tramp-copy-keep-date-arg   "-p")
+	      (tramp-password-end-of-line nil))
      ("scp"   (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh")
               (tramp-copy-program         "scp")
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-e" "none"))
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   "-p"))
+              (tramp-copy-keep-date-arg   "-p")
+	      (tramp-password-end-of-line nil))
      ("scp1"  (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh")
               (tramp-copy-program         "scp")
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-1" "-e" "none"))
               (tramp-copy-args            ("-1"))
-              (tramp-copy-keep-date-arg   "-p"))
+              (tramp-copy-keep-date-arg   "-p")
+	      (tramp-password-end-of-line nil))
      ("scp2"  (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh")
               (tramp-copy-program         "scp")
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-2" "-e" "none"))
               (tramp-copy-args            ("-2"))
-              (tramp-copy-keep-date-arg   "-p"))
+              (tramp-copy-keep-date-arg   "-p")
+	      (tramp-password-end-of-line nil))
      ("scp1_old"
               (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh1")
@@ -267,7 +271,8 @@
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-e" "none"))
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   "-p"))
+              (tramp-copy-keep-date-arg   "-p")
+	      (tramp-password-end-of-line nil))
      ("scp2_old"
               (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh2")
@@ -275,49 +280,56 @@
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-e" "none"))
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   "-p"))
+              (tramp-copy-keep-date-arg   "-p")
+	      (tramp-password-end-of-line nil))
      ("rsync" (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh")
               (tramp-copy-program         "rsync")
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-e" "none"))
               (tramp-copy-args            ("-e" "ssh"))
-              (tramp-copy-keep-date-arg   "-t"))
+              (tramp-copy-keep-date-arg   "-t")
+	      (tramp-password-end-of-line nil))
      ("remcp" (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "remsh")
               (tramp-copy-program         "rcp")
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           nil)
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   "-p"))
+              (tramp-copy-keep-date-arg   "-p")
+	      (tramp-password-end-of-line nil))
      ("rsh"   (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "rsh")
               (tramp-copy-program         nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           nil)
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("ssh"   (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh")
               (tramp-copy-program         nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-e" "none"))
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("ssh1"  (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh")
               (tramp-copy-program         nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-1" "-e" "none"))
               (tramp-copy-args            ("-1"))
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("ssh2"  (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh")
               (tramp-copy-program         nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-2" "-e" "none"))
               (tramp-copy-args            ("-2"))
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("ssh1_old"
               (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh1")
@@ -325,7 +337,8 @@
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-e" "none"))
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("ssh2_old"
               (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh2")
@@ -333,14 +346,16 @@
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-e" "none"))
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("remsh" (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "remsh")
               (tramp-copy-program         nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           nil)
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("telnet"
               (tramp-connection-function  tramp-open-connection-telnet)
               (tramp-login-program        "telnet")
@@ -348,14 +363,16 @@
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           nil)
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("su"    (tramp-connection-function  tramp-open-connection-su)
               (tramp-login-program        "su")
               (tramp-copy-program         nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-" "%u"))
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("sudo"  (tramp-connection-function  tramp-open-connection-su)
               (tramp-login-program        "sudo")
               (tramp-copy-program         nil)
@@ -363,28 +380,32 @@
               (tramp-login-args           ("-u" "%u" "-s"
 					   "-p" "Password:"))
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("multi" (tramp-connection-function  tramp-open-connection-multi)
               (tramp-login-program        nil)
               (tramp-copy-program         nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           nil)
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("scpx"  (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh")
               (tramp-copy-program         "scp")
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-e" "none" "-t" "-t" "/bin/sh"))
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   "-p"))
+              (tramp-copy-keep-date-arg   "-p")
+	      (tramp-password-end-of-line nil))
      ("sshx"  (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "ssh")
               (tramp-copy-program         nil)
               (tramp-remote-sh            "/bin/sh")
               (tramp-login-args           ("-e" "none" "-t" "-t" "/bin/sh"))
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   nil))
+              (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("krlogin"
               (tramp-connection-function  tramp-open-connection-rsh)
 	      (tramp-login-program        "krlogin")
@@ -392,7 +413,8 @@
 	      (tramp-remote-sh            "/bin/sh")
 	      (tramp-login-args           ("-x"))
 	      (tramp-copy-args            nil)
-	      (tramp-copy-keep-date-arg   nil))
+	      (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line nil))
      ("plink"
               (tramp-connection-function  tramp-open-connection-rsh)
 	      (tramp-login-program        "plink")
@@ -400,7 +422,8 @@
 	      (tramp-remote-sh            "/bin/sh")
 	      (tramp-login-args           ("-ssh")) ;optionally add "-v"
 	      (tramp-copy-args            nil)
-	      (tramp-copy-keep-date-arg   nil))
+	      (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line "xy")) ;see docstring for "xy"
      ("plink1"
               (tramp-connection-function  tramp-open-connection-rsh)
 	      (tramp-login-program        "plink")
@@ -408,7 +431,8 @@
 	      (tramp-remote-sh            "/bin/sh")
 	      (tramp-login-args           ("-1" "-ssh")) ;optionally add "-v"
 	      (tramp-copy-args            nil)
-	      (tramp-copy-keep-date-arg   nil))
+	      (tramp-copy-keep-date-arg   nil)
+	      (tramp-password-end-of-line "xy")) ;see docstring for "xy"
      ("pscp"
               (tramp-connection-function  tramp-open-connection-rsh)
 	      (tramp-login-program        "plink")
@@ -416,7 +440,8 @@
 	      (tramp-remote-sh            "/bin/sh")
 	      (tramp-login-args           ("-ssh"))
 	      (tramp-copy-args            nil)
-	      (tramp-copy-keep-date-arg   "-p"))
+	      (tramp-copy-keep-date-arg   "-p")
+	      (tramp-password-end-of-line "xy")) ;see docstring for "xy"
      ("fcp"   
 	      (tramp-connection-function  tramp-open-connection-rsh)
               (tramp-login-program        "fsh")
@@ -424,7 +449,8 @@
               (tramp-remote-sh            "/bin/sh -i")
               (tramp-login-args           ("sh" "-i"))
               (tramp-copy-args            nil)
-              (tramp-copy-keep-date-arg   "-p"))
+              (tramp-copy-keep-date-arg   "-p")
+	      (tramp-password-end-of-line nil))
      )
   "*Alist of methods for remote files.
 This is a list of entries of the form (NAME PARAM1 PARAM2 ...).
@@ -469,6 +495,15 @@
     This specifies the parameter to use for the copying program when the
     timestamp of the original file should be kept.  For `rcp', use `-p', for
     `rsync', use `-t'.
+  * `tramp-password-end-of-line'
+    This specifies the string to use for terminating the line after
+    submitting the password.  If this method parameter is nil, then the
+    value of the normal variable `tramp-default-password-end-of-line'
+    is used.  This parameter is necessary because the \"plink\" program
+    requires any two characters after sending the password.  These do
+    not have to be newline or carriage return characters.  Other login
+    programs are happy with just one character, the newline character.
+    We use \"xy\" as the value for methods using \"plink\".
 
 What does all this mean?  Well, you should specify `tramp-login-program'
 for all methods; this program is used to log in to the remote site.  Then,
@@ -518,7 +553,9 @@
                      (list (const tramp-encoding-function)
 			   (choice (const nil) function))
                      (list (const tramp-decoding-function)
-			   (choice (const nil) function))))))
+			   (choice (const nil) function))
+		     (list (const tramp-password-end-of-line)
+			   (choice (const nil) string))))))
 
 (defcustom tramp-multi-methods '("multi" "multiu")
   "*List of multi-hop methods.
@@ -664,17 +701,17 @@
   "*String used for end of line in rsh connections.
 I don't think this ever needs to be changed, so please tell me about it
 if you need to change this.
-Also see `tramp-password-end-of-line'."
+Also see the method parameter `tramp-password-end-of-line' and the normal
+variable `tramp-default-password-end-of-line'."
   :group 'tramp
   :type 'string)
 
-(defcustom tramp-password-end-of-line
-  (if (string-match "plink" tramp-default-method)
-      ;; Any two characters will do for plink!  Doesn't have to be
-      ;; newline characters.
-      "xy"
-    tramp-rsh-end-of-line)
+(defcustom tramp-default-password-end-of-line
+  tramp-rsh-end-of-line
   "*String used for end of line after sending a password.
+This variable provides the default value for the method parameter
+`tramp-password-end-of-line', see `tramp-methods' for more details.
+
 It seems that people using plink under Windows need to send
 \"\\r\\n\" (carriage-return, then newline) after a password, but just
 \"\\n\" after all other lines.  This variable can be used for the
@@ -806,7 +843,11 @@
 for tilde expansion.  The extra arguments should typically prevent the
 shell from reading its init file."
   :group 'tramp
-  :type '(alist :key-type string :value-type string))
+  ;; This might be the wrong way to test whether the widget type
+  ;; `alist' is available.  Who knows the right way to test it?
+  :type (if (get 'alist 'widget-type)
+	    '(alist :key-type string :value-type string)
+	  '(repeat (cons string string))))
 
 (defcustom tramp-prefix-format
   (if tramp-unified-filenames "/" "/[")
@@ -1171,6 +1212,21 @@
   :group 'tramp
   :type '(repeat (list variable function)))
 
+(defcustom tramp-initial-commands
+  '("unset correct"
+    "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.
@@ -1290,6 +1346,11 @@
 In the connection buffer, this variable has the value of the like-named
 method parameter, as specified in `tramp-methods' (which see).")
 
+(defvar tramp-password-end-of-line nil
+  "This internal variable holds a parameter for `tramp-methods'.
+In the connection buffer, this variable has the value of the like-named
+method parameter, as specified in `tramp-methods' (which see).")
+
 ;; CCC `local in each buffer'?
 (defvar tramp-ls-command nil
   "This command is used to get a long listing with numeric user and group ids.
@@ -2896,8 +2957,8 @@
 	(let (status)
 	  (when (string-match "&[ \t]*\\'" command)
 	    (error "Tramp doesn't grok asynchronous shell commands, yet"))
-	  (when error-buffer
-	    (error "Tramp doesn't grok optional third arg ERROR-BUFFER, yet"))
+;; 	  (when error-buffer
+;; 	    (error "Tramp doesn't grok optional third arg ERROR-BUFFER, yet"))
 	  (save-excursion
 	    (tramp-barf-unless-okay
 	     multi-method method user host
@@ -2905,8 +2966,12 @@
 	     nil 'file-error
 	     "tramp-handle-shell-command: Couldn't `cd %s'"
 	     (tramp-shell-quote-argument localname))
-	    (tramp-send-command multi-method method user host
-				(concat command "; tramp_old_status=$?"))
+	    (tramp-send-command
+	     multi-method method user host
+	     (if error-buffer
+		 (format "( %s ) 2>/tmp/tramp.$$.err; tramp_old_status=$?"
+			 command)
+	       (format "%s ;tramp_old_status=$?" command)))
 	    ;; This will break if the shell command prints "/////"
 	    ;; somewhere.  Let's just hope for the best...
 	    (tramp-wait-for-output))
@@ -2918,6 +2983,18 @@
 	    (setq output-buffer (current-buffer)))
 	  (set-buffer output-buffer)
 	  (insert-buffer (tramp-get-buffer multi-method method user host))
+	  (when error-buffer
+	    (save-excursion
+	      (unless (bufferp error-buffer)
+		(setq error-buffer (get-buffer-create error-buffer)))
+	      (tramp-send-command
+	       multi-method method user host
+	       "cat /tmp/tramp.$$.err")
+	      (tramp-wait-for-output)
+	      (set-buffer error-buffer)
+	      (insert-buffer (tramp-get-buffer multi-method method user host))
+	      (tramp-send-command-and-check
+	       multi-method method user host "rm -f /tmp/tramp.$$.err")))
 	  (save-excursion
 	    (tramp-send-command multi-method method user host "cd")
 	    (tramp-wait-for-output)
@@ -3084,7 +3161,10 @@
       ;; jka-compr.  By let-binding inhibit-file-name-operation, we
       ;; propagate that care to the file-local-copy operation.
       (let ((local-copy
-	     (let ((inhibit-file-name-operation 'file-local-copy))
+	     (let ((inhibit-file-name-operation
+		    (when (eq inhibit-file-name-operation
+			      'insert-file-contents)
+		      'file-local-copy)))
 	       (file-local-copy filename)))
 	    (coding-system-used nil)
 	    (result nil))
@@ -4115,12 +4195,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 %s@%s*" 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 %s@%s*" 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 +4230,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 %s@%s*" 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 %s@%s*" 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 +4620,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)
@@ -4950,7 +5052,13 @@
 Uses PROMPT as a prompt and sends the password to process P."
   (let ((pw (tramp-read-passwd prompt)))
     (erase-buffer)
-    (process-send-string p (concat pw tramp-password-end-of-line))))
+    (process-send-string
+     p (concat pw
+	       (tramp-get-password-end-of-line
+		tramp-current-multi-method
+		tramp-current-method
+		tramp-current-user
+		tramp-current-host)))))
 
 ;; HHH: Not Changed.  This might handle the case where USER is not
 ;;      given in the "File name" very poorly.  Then, the local
@@ -4976,6 +5084,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
@@ -5035,6 +5145,7 @@
         ;; We have found a ^M but cannot frob the process coding system
         ;; because we're running on a non-MULE Emacs.  Let's try
         ;; stty, instead.
+	(erase-buffer)
         (tramp-message 9 "Trying `stty -onlcr'")
 	(tramp-send-command-internal multi-method method user host
 				     "stty -onlcr"))))
@@ -6057,6 +6168,15 @@
               (error "Method `%s' didn't specify `keep-date' arg for tramp"
                      (or multi-method method)))))
 
+(defun tramp-get-password-end-of-line (multi-method method user host)
+  (let ((entry (assoc 'tramp-password-end-of-line
+		      (assoc (tramp-find-method multi-method method user host)
+			     tramp-methods))))
+    (unless entry
+      (error "Method `%s' didn't specify `password-end-of-line' arg for tramp"
+	     (or multi-method method)))
+    (or (second entry) tramp-default-password-end-of-line)))
+
 ;; Auto saving to a special directory.
 
 (defun tramp-make-auto-save-file-name (fn)
@@ -6322,7 +6442,7 @@
        tramp-auto-save-directory        ; vars to dump
        tramp-default-method
        tramp-rsh-end-of-line
-       tramp-password-end-of-line
+       tramp-default-password-end-of-line
        tramp-remote-path
        tramp-login-prompt-regexp
        tramp-password-prompt-regexp
--- a/lisp/net/trampver.el	Sun Jul 20 19:00:56 2003 +0000
+++ b/lisp/net/trampver.el	Sun Jul 20 19:04:48 2003 +0000
@@ -30,7 +30,7 @@
 ;; are auto-frobbed from configure.ac, so you should edit that file and run
 ;; "autoconf && ./configure" to change them.
 
-(defconst tramp-version "2.0.35"
+(defconst tramp-version "2.0.36"
   "This version of Tramp.")
 
 (defconst tramp-bug-report-address "tramp-devel@mail.freesoftware.fsf.org"