unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Recent changes on tramp introduce a bug
@ 2008-01-22  5:57 Herbert Euler
  2008-01-22 14:22 ` Michael Albinus
  0 siblings, 1 reply; 4+ messages in thread
From: Herbert Euler @ 2008-01-22  5:57 UTC (permalink / raw)
  To: michael.albinus; +Cc: emacs-devel


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/

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-01-23 20:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-22  5:57 Recent changes on tramp introduce a bug Herbert Euler
2008-01-22 14:22 ` Michael Albinus
2008-01-23  3:07   ` Herbert Euler
2008-01-23 20:56     ` Michael Albinus

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).