From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.bugs Subject: bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ] Date: Wed, 17 May 2023 19:28:46 +0200 Message-ID: <877ct6vpdd.fsf@gmx.de> References: <877ct8w4bs.fsf@gmx.de> <87sfbvuk4r.fsf@gmx.de> <87h6sbufv3.fsf@gmx.de> <87bkiivqvu.fsf@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14953"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 63539@debbugs.gnu.org To: Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed May 17 19:30:20 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pzKyi-0003jv-Cm for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 May 2023 19:30:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzKyT-00015v-Dy; Wed, 17 May 2023 13:30:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pzKyS-00015k-3c for bug-gnu-emacs@gnu.org; Wed, 17 May 2023 13:30:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pzKyR-0000dP-S2 for bug-gnu-emacs@gnu.org; Wed, 17 May 2023 13:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pzKyQ-0002jo-C7 for bug-gnu-emacs@gnu.org; Wed, 17 May 2023 13:30:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Michael Albinus Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 May 2023 17:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63539 X-GNU-PR-Package: emacs Original-Received: via spool by 63539-submit@debbugs.gnu.org id=B63539.168434454310418 (code B ref 63539); Wed, 17 May 2023 17:30:02 +0000 Original-Received: (at 63539) by debbugs.gnu.org; 17 May 2023 17:29:03 +0000 Original-Received: from localhost ([127.0.0.1]:50898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzKxT-0002hy-1H for submit@debbugs.gnu.org; Wed, 17 May 2023 13:29:03 -0400 Original-Received: from mout.gmx.net ([212.227.15.19]:53515) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzKxK-0002hF-DS for 63539@debbugs.gnu.org; Wed, 17 May 2023 13:29:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1684344527; i=michael.albinus@gmx.de; bh=rU6f/cCCEVIrBiSElvb4GneLM6MnVHzgelZyAw9ARMs=; h=X-UI-Sender-Class:From:To:Cc:Subject:In-Reply-To:References:Date; b=V+lqiTShriZniSldw+X4N6pP/y8PDfEdFNuMeilPyjWPOZwEleuQs+xUiN2gJCUdS np8z5HPfHUD6JSHsnBVGC12vHOGB8LrrIFj5YvfdTnTMkrMaL507EwWT8UZYUM9Sjl xsf6vfdOuJOJ8rO0d6Dj8qXC20EJz5AOI6QJZVGgnZ96xTHPK7zyeQqxbBHLBquyE8 0oZksA8BtgrV4Pvkj2GgAN0j+C+D3T4kkwznRCqpWlDOSuaObmS+GbniepjZWo/WPY /mMNlBPtGrgoehhe3VGh1k3WnfCtFu1DUN1c57IETyabVh++3uZXSw5TLWqVT239VY 5y1+gnYG1oHWg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Original-Received: from gandalf.gmx.de ([185.89.39.13]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MatRZ-1qb8Xl45Ep-00cUVH; Wed, 17 May 2023 19:28:47 +0200 In-Reply-To: <87bkiivqvu.fsf@gmx.de> (Michael Albinus's message of "Wed, 17 May 2023 18:56:05 +0200") X-Provags-ID: V03:K1:UfIRTTIlQdv7mpgsbpNnTP82wInjg7ONzqJUy6YVWIIEe/GyY4b 5Lz4OnbSDXu22H5VqU85FwjlkUVfncPFqKR5hCmETi6F93RCfyNhVdmSYhXiF4IARwo4bll SSdtpP1MdG3ssZaskbJxCdN3HoHn3GK8P7oa/psef96Vxra8Ckj65URc3BfKUPTIc1TKTCi agZX4Bq3fyrsEggD/pmgg== UI-OutboundReport: notjunk:1;M01:P0:ymZ9jbY4wkk=;6UTfxgvrfNT8tNtF1GAgPp+hXit 8MYS6oZOSfF0YmBcccIl0Y47e/GasDyJKhNi4jNFh0xRGQ0v2YU2IPq5G4tPaNiNrAOZnsXMC vo/ybxtzwQkwjHlBq6dtvkOEEUYNoS6qiVvwW+DEQCrbDRm02NhC7G2ppDhwLv772w1ux/Or0 JHM2yEWZEFl/UFnIRyjRtOvjtgMnIjKL0uwlXsfPHpJYr4TAl/2w/cQiv3HkVjYYi/aK330mS 7RVaOLp/M9IEbAA3ZRa4VHLSPSQ/tD8pgX1SlYPKkdbzNqbBO5TQ82Ax4Rp2q1YFELuSfwObk x3aSFSlr1Wbq1biq+L0AbfDZTup8Sh9f5xBrASw5qKdAdhunwn22Aty7AD/BZWvX0GaQT9SQG 8cfDsvyheGESQZ7OVbfxJiHYrTLmgVZ2uXlqvWVdqOwfEV79AM1pWRwUtQO0nR6DKwHJP546j fEAGNzSF7SZ6+R6lcXKtMZfXZ5Fqt5HyfoNSYLEJfCvyh6VIiHmZES3rohVp2qkRL2MgL4zRm nW4fxucLPvFBTcs+jwNEJP5lJhySEzP7zNRaWgK+Wo83JP3CTogwnLejaYd23af5YMuFKEef1 9L8JoIOnXxv4n2wevsRObrn38CDnMgwzUNzIrSQNiwV2Qe16IuInXTNiIkgyHv1vw5dktQ+yn msyt8ovfQLuXSG2BMB5p96IrQIQd0DtbGtxwfxyEx0f3FYZ5rAlbuZYaU1Kb+vpY8aHdIBoan va+DJlx8SaXJzdm3jd0TfH3cqBWErb5myaZ+0Z5FbkU17qFJN6Gldw6QGtA67JB+Kf/q74C7 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:261877 Archived-At: --=-=-= Content-Type: text/plain Michael Albinus writes: Hi Spencer, >> That's why I've proposed the alternative, filtering out escape >> sequences. Using existing functions from specialized packages. > > Hmm, perhaps the appended simplistic patch would do the job already? > Could you, pls, test? Hmm, likely this one is better. Best regards, Michael. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Transfer-Encoding: quoted-printable diff --git a/lisp/tramp.el b/lisp/tramp.el index 910d5343..a44f8d1b 100644 =2D-- a/lisp/tramp.el +++ b/lisp/tramp.el @@ -624,9 +624,7 @@ Sometimes the prompt is reported to look like \"login = as:\"." ;; connection initialization; Tramp redefines the prompt afterwards. (rx (| bol "\r") (* (not (any "\n#$%>]"))) - (? "#") (any "#$%>]") (* blank) - ;; Escape characters. - (* "=1B[" (* (any ";" digit)) alpha (* blank))) + (? "#") (any "#$%>]") (* blank)) "Regexp to match prompts from remote shell. Normally, Tramp expects you to configure `shell-prompt-pattern' correctly, but sometimes it happens that you are connecting to a @@ -5883,11 +5881,14 @@ Otherwise, return nil." "Check, whether REGEXP is contained in process buffer of PROC. Erase echoed commands if exists." (with-current-buffer (process-buffer proc) - (goto-char (point-min)) + ;; Remove color escape sequences from shell prompt. + (while (tramp-search-regexp tramp-display-escape-sequence-regexp) + (replace-match "")) ;; Check whether we need to remove echo output. The max length of ;; the echo mark regexp is taken for search. We restrict the ;; search for the second echo mark to PIPE_BUF characters. + (goto-char (point-min)) (when (and (tramp-get-connection-property proc "check-remote-echo") (re-search-forward tramp-echoed-echo-mark-regexp --=-=-=--