From: Herbert Euler <herberteuler@hotmail.com>
To: <michael.albinus@gmx.de>
Cc: emacs-devel@gnu.org
Subject: Recent changes on tramp introduce a bug
Date: Tue, 22 Jan 2008 13:57:30 +0800 [thread overview]
Message-ID: <BAY143-W30DD89A5EAC5DDEF7710F2DA3E0@phx.gbl> (raw)
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/
next reply other threads:[~2008-01-22 5:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-22 5:57 Herbert Euler [this message]
2008-01-22 14:22 ` Recent changes on tramp introduce a bug Michael Albinus
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=BAY143-W30DD89A5EAC5DDEF7710F2DA3E0@phx.gbl \
--to=herberteuler@hotmail.com \
--cc=emacs-devel@gnu.org \
--cc=michael.albinus@gmx.de \
/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).