emacs-devel
[Top][All Lists]
Advanced

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

Recent changes on tramp introduce a bug


From: Herbert Euler
Subject: Recent changes on tramp introduce a bug
Date: Tue, 22 Jan 2008 13:57:30 +0800

Hello,

The following changes to `tramp-wait-for-output' on net/tramp.el
introduce a bug:




cvs diff: I know nothing about 1.166
Index: net/tramp.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/net/tramp.el,v
retrieving revision 1.165
retrieving revision 1.39.2.52
diff -F '^(defun [_a-zA-Z0-9$-]+ *(' -c -r1.165 -r1.39.2.52
*** net/tramp.el        23 Dec 2007 13:25:26 -0000      1.165
--- net/tramp.el        18 Mar 2007 14:11:07 -0000      1.39.2.52
*************** (defun tramp-send-command (vec command &
*** 6245,6260 ****
  (defun tramp-wait-for-output (proc &optional timeout)
    "Wait for output from remote rsh command."
    (with-current-buffer (process-buffer proc)
!     (let ((found
!          (tramp-wait-for-regexp
!           proc timeout
!           ;; Initially, `tramp-end-of-output' is "$ ".  There might
!           ;; be leading escape sequences, which must be ignored.
!           (format "^[^$\n]*%s\r?$" (regexp-quote tramp-end-of-output)))))
        (if found
          (let (buffer-read-only)
            (goto-char (point-max))
!           (forward-line -2)
            (delete-region (point) (point-max)))
        (if timeout
            (tramp-error
--- 6247,6260 ----
  (defun tramp-wait-for-output (proc &optional timeout)
    "Wait for output from remote rsh command."
    (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)
            (goto-char (point-max))
!           (re-search-backward regexp nil t)
            (delete-region (point) (point-max)))
        (if timeout
            (tramp-error




I found this bug when I tried to open a remote file with tramp, while
ido-mode is turned on.

The old code uses (forward-line -2), the new code uses
(re-search-backward regexp nil t).  When listing remote file names,
the different movements cause different result.  Here is what such a
listing would look like before the two different pieces of code are
evaluated:

tmp/
tpop/
ypa/

///c8f0a82e28ac811d30acfc16c3610166
-!-

Where the symbol "-!-" indicates the point position.  In the case of
the old code, point will be moved to just after "ypa/":

tmp/
tpop/
ypa/
-!-
///c8f0a82e28ac811d30acfc16c3610166

So the entire content after the newline character will be deleted.
However, in the case of the new code, point will be moved to the
beginning of the signature line:

tmp/
tpop/
ypa/

-!-///c8f0a82e28ac811d30acfc16c3610166

So there will be one more newline character after (delete-region
(point) (point-max)) is evaluated, compared to the old case.  This one
more newline character will add an empty string "" to the completions
of file names, which will cause an error in ido-mode.

Regards,
Guanpeng Xu
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/




reply via email to

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