From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ] Date: Tue, 16 May 2023 16:06:42 -0400 Message-ID: References: <877ct8w4bs.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20008"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 63539@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 16 22:07:19 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 1pz0x5-0004zd-40 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 16 May 2023 22:07:19 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pz0wr-0000Az-MU; Tue, 16 May 2023 16:07: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 1pz0wo-0000AA-Gk for bug-gnu-emacs@gnu.org; Tue, 16 May 2023 16:07: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 1pz0wo-0008QY-5J for bug-gnu-emacs@gnu.org; Tue, 16 May 2023 16:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pz0wn-00071Z-Tz for bug-gnu-emacs@gnu.org; Tue, 16 May 2023 16:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 16 May 2023 20:07:01 +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.168426761126983 (code B ref 63539); Tue, 16 May 2023 20:07:01 +0000 Original-Received: (at 63539) by debbugs.gnu.org; 16 May 2023 20:06:51 +0000 Original-Received: from localhost ([127.0.0.1]:48146 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pz0wd-000719-GP for submit@debbugs.gnu.org; Tue, 16 May 2023 16:06:51 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:44137) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pz0wa-00070t-3t for 63539@debbugs.gnu.org; Tue, 16 May 2023 16:06:50 -0400 In-Reply-To: (Spencer Baugh's message of "Tue, 16 May 2023 15:28:25 -0400") 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:261813 Archived-At: Spencer Baugh writes: > Michael Albinus writes: > >> Spencer Baugh writes: >> >> Hi Spencer, >> >>> Attempting to ssh to a machine with a prompt like: >>> >>> [user@hostname] foo/bar/path $ >>> >>> will hang, because TRAMP thinks that the prompt ends at the "]", not the >>> "$". >>> >>> I guess this is because TRAMP supports prompts like "[foo bar baz]" with >>> no trailing $. And it isn't greedy when reading the prompt, so it stops >>> at the first "]". >>> >>> One can work around this by configuring the machine's prompt, but [] >>> seem relatively common in prompts (in my personal experience), and it >>> would be nice if this worked by default. (So far I've only seen [] in >>> custom prompts but there are probably some OSs/distributions with [] in >>> their prompt by default) >> >> What's wrong with the recipe for your remote .profile: >> >> [[ $TERM == "dumb" ]] && PS1='$ ' && return >> >> The Tramp manual gives an extended version of the recipe, which handles >> also the zsh line editing problem, but you see the idea. > > [] seem relatively common in prompts (in my personal experience), and it > would be nice if this worked by default. > > Just as an additional point, I'm not always connecting to hosts that I > can trivially change the .profile for. The RHEL (and Fedora maybe?) prompt by default contains []. It looks like: [sbaugh@hostname ~]$ TRAMP connections to RHEL seems *pretty* important to support by default. TRAMP is only working on such hosts today because of the fallback to shell-prompt-pattern, which doesn't treat [] as a prompt character. But such machines' prompts stop working if they add color, which shell-prompt-pattern also doesn't support (namely that regex doesn't support escape sequences appearing after the prompt, which are necessary to clear the coloring). So actually, how about setting shell-prompt-pattern to the following? All it does is add support for escape characters after the prompt in shell-prompt-pattern. That would make my use case work. (setopt shell-prompt-pattern (rx (* (not (any "#$%>\n"))) (any "#$%>") (* blank) ;; Escape characters. (* "^[[" (* (any ";" digit)) alpha (* blank))))