From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Herbert Euler Newsgroups: gmane.emacs.devel Subject: Recent changes on tramp introduce a bug Date: Tue, 22 Jan 2008 13:57:30 +0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1200981474 23394 80.91.229.12 (22 Jan 2008 05:57:54 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Jan 2008 05:57:54 +0000 (UTC) Cc: emacs-devel@gnu.org To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 22 06:58:11 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JHC99-0000qr-CX for ged-emacs-devel@m.gmane.org; Tue, 22 Jan 2008 06:58:07 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHC8j-0001Ah-Dv for ged-emacs-devel@m.gmane.org; Tue, 22 Jan 2008 00:57:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHC8d-00019Q-Es for emacs-devel@gnu.org; Tue, 22 Jan 2008 00:57:35 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHC8b-00017M-01 for emacs-devel@gnu.org; Tue, 22 Jan 2008 00:57:34 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHC8a-00017C-PE for emacs-devel@gnu.org; Tue, 22 Jan 2008 00:57:32 -0500 Original-Received: from bay0-omc2-s15.bay0.hotmail.com ([65.54.246.151]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JHC8a-0006UJ-MV for emacs-devel@gnu.org; Tue, 22 Jan 2008 00:57:32 -0500 Original-Received: from BAY143-W30 ([65.55.154.65]) by bay0-omc2-s15.bay0.hotmail.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 21 Jan 2008 21:57:30 -0800 X-Originating-IP: [216.145.54.158] Importance: Normal X-OriginalArrivalTime: 22 Jan 2008 05:57:30.0959 (UTC) FILETIME=[ACE815F0:01C85CBB] X-detected-kernel: by monty-python.gnu.org: Windows 2000 SP4, XP SP1+ X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:87275 Archived-At: 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/