From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.devel Subject: Re: Recent changes on tramp introduce a bug Date: Tue, 22 Jan 2008 15:22:24 +0100 Message-ID: References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1201011731 29262 80.91.229.12 (22 Jan 2008 14:22:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 22 Jan 2008 14:22:11 +0000 (UTC) Cc: emacs-devel@gnu.org To: Herbert Euler Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 22 15:22:29 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 1JHK0z-0005OI-4E for ged-emacs-devel@m.gmane.org; Tue, 22 Jan 2008 15:22:13 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHK0Z-0000y8-Dc for ged-emacs-devel@m.gmane.org; Tue, 22 Jan 2008 09:21:47 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JHK0V-0000xW-1B for emacs-devel@gnu.org; Tue, 22 Jan 2008 09:21:43 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JHK0S-0000wd-IQ for emacs-devel@gnu.org; Tue, 22 Jan 2008 09:21:42 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JHK0S-0000wa-Cx for emacs-devel@gnu.org; Tue, 22 Jan 2008 09:21:40 -0500 Original-Received: from mailrelay2.alcatel.de ([194.113.59.96]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JHK0S-0005Wp-47 for emacs-devel@gnu.org; Tue, 22 Jan 2008 09:21:40 -0500 Original-Received: from slbhab.alcatel.de (slbhab.bln.sel.alcatel.de [149.204.63.218]) by mailrelay2.alcatel.de (8.13.4/8.13.4/ICT) with ESMTP id m0MELXSW021812; Tue, 22 Jan 2008 15:21:33 +0100 In-Reply-To: (Herbert Euler's message of "Tue, 22 Jan 2008 13:57:30 +0800") User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (hpux) X-Scanned-By: MIMEDefang 2.51 on 149.204.45.73 X-detected-kernel: by monty-python.gnu.org: Linux 2.4-2.6 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:87302 Archived-At: --=-=-= Herbert Euler 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. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment *************** *** 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 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 --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--