unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Herbert Euler <herberteuler@hotmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Recent changes on tramp introduce a bug
Date: Tue, 22 Jan 2008 15:22:24 +0100	[thread overview]
Message-ID: <nqtzl6x7mn.fsf@alcatel-lucent.de> (raw)
In-Reply-To: <BAY143-W30DD89A5EAC5DDEF7710F2DA3E0@phx.gbl> (Herbert Euler's message of "Tue, 22 Jan 2008 13:57:30 +0800")

[-- Attachment #1: Type: text/plain, Size: 572 bytes --]

Herbert Euler <herberteuler@hotmail.com> writes:

> Hello,

Hi,

> The following changes to `tramp-wait-for-output' on net/tramp.el
> introduce a bug:
>
> The old code uses (forward-line -2), the new code uses
> (re-search-backward regexp nil t).

IIRC, (forward-line -2) results in an error if a command on the remote
host returns a result without a trailing newline. That's why Tramp
tries to remove now exactly the trailing prompt, and nothing else.

Could you, please, check whether the appended patch works for you?

> Regards,
> Guanpeng Xu

Best regards, Michael.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 4611 bytes --]

***************
*** 1433,1441 ****
  ;;; Internal Variables:
  
  (defvar tramp-end-of-output
!   (concat
!    "///" (md5 (concat
! 	       (prin1-to-string process-environment) (current-time-string))))
    "String used to recognize end of output.")
  
  (defvar tramp-current-method nil
--- 1433,1443 ----
  ;;; Internal Variables:
  
  (defvar tramp-end-of-output
!   (format
!    "%s///%s%s"
!    tramp-rsh-end-of-line
!    (md5 (concat (prin1-to-string process-environment) (current-time-string)))
!    tramp-rsh-end-of-line)
    "String used to recognize end of output.")
  
  (defvar tramp-current-method nil
***************
*** 5360,5381 ****
  	     vec
  	     (format "PROMPT_COMMAND='' PS1='$ ' PS2='' PS3='' exec %s" shell)
  	     t))
  	  (tramp-message vec 5 "Setting remote shell prompt...")
! 	  ;; Douglas Gray Stephens <DGrayStephens@slb.com> says that we
! 	  ;; must use "\n" here, not tramp-rsh-end-of-line.  Kai left the
! 	  ;; last tramp-rsh-end-of-line, Douglas wanted to replace that,
! 	  ;; as well.
! 	  (tramp-send-command
! 	   vec
! 	   (format "PS1='%s%s%s'"
! 		   tramp-rsh-end-of-line
! 		   tramp-end-of-output
! 		   tramp-rsh-end-of-line)
! 	   t)
  	  (tramp-send-command vec "PS2=''" t)
  	  (tramp-send-command vec "PS3=''" t)
  	  (tramp-send-command vec "PROMPT_COMMAND=''" t)
  	  (tramp-message vec 5 "Setting remote shell prompt...done"))
  	 (t (tramp-message
  	     vec 5 "Remote `%s' groks tilde expansion, good"
  	     (tramp-get-method-parameter
--- 5362,5375 ----
  	     vec
  	     (format "PROMPT_COMMAND='' PS1='$ ' PS2='' PS3='' exec %s" shell)
  	     t))
+ 	  ;; Setting prompts.
  	  (tramp-message vec 5 "Setting remote shell prompt...")
! 	  (tramp-send-command vec (format "PS1='%s'" tramp-end-of-output) t)
  	  (tramp-send-command vec "PS2=''" t)
  	  (tramp-send-command vec "PS3=''" t)
  	  (tramp-send-command vec "PROMPT_COMMAND=''" t)
  	  (tramp-message vec 5 "Setting remote shell prompt...done"))
+ 
  	 (t (tramp-message
  	     vec 5 "Remote `%s' groks tilde expansion, good"
  	     (tramp-get-method-parameter
***************
*** 5668,5680 ****
    ;; We can set $PS1 to `tramp-end-of-output' only when the echo has
    ;; been disabled.  Otherwise, the echo of the command would be
    ;; regarded as prompt already.
!   (tramp-send-command
!    vec
!    (format "PS1='%s%s%s'"
! 	   tramp-rsh-end-of-line
!            tramp-end-of-output
! 	   tramp-rsh-end-of-line)
!    t)
    (tramp-send-command vec "PS2=''" t)
    (tramp-send-command vec "PS3=''" t)
    (tramp-send-command vec "PROMPT_COMMAND=''" t)
--- 5662,5668 ----
    ;; We can set $PS1 to `tramp-end-of-output' only when the echo has
    ;; been disabled.  Otherwise, the echo of the command would be
    ;; regarded as prompt already.
!   (tramp-send-command vec (format "PS1='%s'" tramp-end-of-output) t)
    (tramp-send-command vec "PS2=''" t)
    (tramp-send-command vec "PS3=''" t)
    (tramp-send-command vec "PROMPT_COMMAND=''" t)
***************
*** 6249,6255 ****
    (with-current-buffer (process-buffer proc)
      ;; Initially, `tramp-end-of-output' is "$ ".  There might be
      ;; leading escape sequences, which must be ignored.
!     (let* ((regexp (format "^[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output)))
  	   (found (tramp-wait-for-regexp proc timeout regexp)))
        (if found
  	  (let (buffer-read-only)
--- 6237,6247 ----
    (with-current-buffer (process-buffer proc)
      ;; Initially, `tramp-end-of-output' is "$ ".  There might be
      ;; leading escape sequences, which must be ignored.
!     (let* ((regexp
! 	    (if (string-match (regexp-quote "\n") tramp-end-of-output)
! 		(mapconcat
! 		 'identity (split-string tramp-end-of-output "\n") "\r?\n")
! 	      (format "^[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output))))
  	   (found (tramp-wait-for-regexp proc timeout regexp)))
        (if found
  	  (let (buffer-read-only)
***************
*** 6833,6840 ****
  	vec (format "( %s / -nt / )" (tramp-get-test-command vec)))
         (with-current-buffer (tramp-get-buffer vec)
  	 (goto-char (point-min))
! 	 (when (looking-at
! 		(format "\n%s\r?\n" (regexp-quote tramp-end-of-output)))
  	   (format "%s %%s -nt %%s" (tramp-get-test-command vec)))))
       (progn
         (tramp-send-command
--- 6825,6831 ----
  	vec (format "( %s / -nt / )" (tramp-get-test-command vec)))
         (with-current-buffer (tramp-get-buffer vec)
  	 (goto-char (point-min))
! 	 (when (looking-at (regexp-quote tramp-end-of-output))
  	   (format "%s %%s -nt %%s" (tramp-get-test-command vec)))))
       (progn
         (tramp-send-command

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

  reply	other threads:[~2008-01-22 14:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-22  5:57 Recent changes on tramp introduce a bug Herbert Euler
2008-01-22 14:22 ` Michael Albinus [this message]
2008-01-23  3:07   ` Herbert Euler
2008-01-23 20:56     ` Michael Albinus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nqtzl6x7mn.fsf@alcatel-lucent.de \
    --to=michael.albinus@gmx.de \
    --cc=emacs-devel@gnu.org \
    --cc=herberteuler@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).