emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] emacs/lisp ChangeLog net/tramp-fish.el net/tram...


From: Michael Albinus
Subject: [Emacs-diffs] emacs/lisp ChangeLog net/tramp-fish.el net/tram...
Date: Mon, 07 Dec 2009 06:38:11 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Michael Albinus <albinus>       09/12/07 06:38:10

Modified files:
        lisp           : ChangeLog 
        lisp/net       : tramp-fish.el tramp.el 

Log message:
        Handle prompt rules of ksh in OpenBSD 4.5.  Reported by Raphaël
        Berbain <address@hidden>.
        
        * net/tramp.el (tramp-end-of-output): Move up.  Use `#' and `$'
        characters.
        (tramp-initial-end-of-output): New defconst.
        (tramp-methods, tramp-find-shell)
        (tramp-open-connection-setup-interactive-shell)
        (tramp-maybe-open-connection): Use it.
        (tramp-shell-prompt-pattern, tramp-wait-for-output): Handle
        existence of `#' and `$'.
        
        * net/tramp-fish.el (tramp-fish-maybe-open-connection): Use
        `tramp-initial-end-of-output'.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16852&r2=1.16853
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp-fish.el?cvsroot=emacs&r1=1.23&r2=1.24
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/net/tramp.el?cvsroot=emacs&r1=1.273&r2=1.274

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16852
retrieving revision 1.16853
diff -u -b -r1.16852 -r1.16853
--- ChangeLog   7 Dec 2009 06:31:35 -0000       1.16852
+++ ChangeLog   7 Dec 2009 06:38:06 -0000       1.16853
@@ -1,3 +1,20 @@
+2009-12-07  Michael Albinus  <address@hidden>
+
+       Handle prompt rules of ksh in OpenBSD 4.5.  Reported by Raphaël
+       Berbain <address@hidden>.
+
+       * net/tramp.el (tramp-end-of-output): Move up.  Use `#' and `$'
+       characters.
+       (tramp-initial-end-of-output): New defconst.
+       (tramp-methods, tramp-find-shell)
+       (tramp-open-connection-setup-interactive-shell)
+       (tramp-maybe-open-connection): Use it.
+       (tramp-shell-prompt-pattern, tramp-wait-for-output): Handle
+       existence of `#' and `$'.
+
+       * net/tramp-fish.el (tramp-fish-maybe-open-connection): Use
+       `tramp-initial-end-of-output'.
+
 2009-12-07  Dan Nicolaescu  <address@hidden>
 
        Get the background mode from the terminal for xterm, and set

Index: net/tramp-fish.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp-fish.el,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- net/tramp-fish.el   7 Nov 2009 23:53:29 -0000       1.23
+++ net/tramp-fish.el   7 Dec 2009 06:38:09 -0000       1.24
@@ -1111,7 +1111,7 @@
       (when (and p (processp p))
        (delete-process p))
       (setenv "TERM" tramp-terminal-type)
-      (setenv "PS1" "$ ")
+      (setenv "PS1" tramp-initial-end-of-output)
       (tramp-message
        vec 3 "Opening connection for address@hidden using %s..."
        tramp-current-user tramp-current-host tramp-current-method)

Index: net/tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.273
retrieving revision 1.274
diff -u -b -r1.273 -r1.274
--- net/tramp.el        3 Dec 2009 11:34:15 -0000       1.273
+++ net/tramp.el        7 Dec 2009 06:38:09 -0000       1.274
@@ -297,6 +297,21 @@
   :group 'tramp
   :type 'string)
 
+;; ksh on OpenBSD 4.5 requires, that PS1 contains a `#' character for
+;; root users.  It uses the `$' character for other users.  In order
+;; to guarantee a proper prompt, we use "#$" for the prompt.
+
+(defvar tramp-end-of-output
+  (format
+   "///%s#$"
+   (md5 (concat (prin1-to-string process-environment) (current-time-string))))
+  "String used to recognize end of output.
+The '$' character at the end is quoted; the string cannot be
+detected as prompt when being sent on echoing hosts, therefore.")
+
+(defconst tramp-initial-end-of-output "#$ "
+  "Prompt when establishing a connection.")
+
 (defvar tramp-methods
   `(("rcp"   (tramp-login-program        "rsh")
              (tramp-login-args           (("%h") ("-l" "%u")))
@@ -585,8 +600,9 @@
             ;; `tramp-compute-multi-hops'.
             (tramp-login-args           (("-load") ("%h") ("-t")
                                          (,(format
-                                            "env 'TERM=%s' 'PROMPT_COMMAND=' 
'PS1=$ '"
-                                            tramp-terminal-type))
+                                            "env 'TERM=%s' 'PROMPT_COMMAND=' 
'PS1=%s'"
+                                            tramp-terminal-type
+                                            tramp-initial-end-of-output))
                                          ("/bin/sh")))
             (tramp-remote-sh            "/bin/sh")
             (tramp-copy-program         nil)
@@ -1030,7 +1046,7 @@
 (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
@@ -1038,7 +1054,10 @@
 Tramp recognizes things matched by `shell-prompt-pattern' as prompt,
 and also things matched by this variable.  The default value of this
 variable is similar to the default value of `shell-prompt-pattern',
-which should work well in many cases."
+which should work well in many cases.
+
+This regexp must match both `tramp-initial-end-of-output' and
+`tramp-end-of-output'."
   :group 'tramp
   :type 'regexp)
 
@@ -1587,14 +1606,6 @@
 
 ;;; Internal Variables:
 
-(defvar tramp-end-of-output
-  (format
-   "///%s$"
-   (md5 (concat (prin1-to-string process-environment) (current-time-string))))
-  "String used to recognize end of output.
-The '$' character at the end is quoted; the string cannot be
-detected as prompt when being sent on echoing hosts, therefore.")
-
 (defvar tramp-current-method nil
   "Connection method for this *tramp* buffer.")
 
@@ -6350,7 +6361,7 @@
            (when extra-args (setq shell (concat shell " " extra-args))))
          (tramp-message
           vec 5 "Starting remote shell `%s' for tilde expansion..." shell)
-         (let ((tramp-end-of-output "$ "))
+         (let ((tramp-end-of-output tramp-initial-end-of-output))
            (tramp-send-command
             vec
             (format "PROMPT_COMMAND='' PS1=%s PS2='' PS3='' exec %s"
@@ -6621,7 +6632,7 @@
   "Set up an interactive shell.
 Mainly sets the prompt and the echo correctly.  PROC is the shell
 process to set up.  VEC specifies the connection."
-  (let ((tramp-end-of-output "$ "))
+  (let ((tramp-end-of-output tramp-initial-end-of-output))
     ;; 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
@@ -7147,7 +7158,7 @@
        (setenv "TERM" tramp-terminal-type)
        (setenv "LC_ALL" "C")
        (setenv "PROMPT_COMMAND")
-       (setenv "PS1" "$ ")
+       (setenv "PS1" tramp-initial-end-of-output)
        (let* ((target-alist (tramp-compute-multi-hops vec))
               (process-connection-type tramp-process-connection-type)
               (process-adaptive-read-buffering nil)
@@ -7271,9 +7282,9 @@
 (defun tramp-wait-for-output (proc &optional timeout)
   "Wait for output from remote rsh command."
   (with-current-buffer (process-buffer proc)
-    (let* (;; Initially, `tramp-end-of-output' is "$ ".  There might
+    (let* (;; Initially, `tramp-end-of-output' is "#$ ".  There might
           ;; be leading escape sequences, which must be ignored.
-          (regexp (format "[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output)))
+          (regexp (format "[^#$\n]*%s\r?$" (regexp-quote tramp-end-of-output)))
           ;; Sometimes, the commands do not return a newline but a
           ;; null byte before the shell prompt, for example "git
           ;; ls-files -c -z ...".




reply via email to

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