From: Spencer Baugh <sbaugh@janestreet.com>
To: Michael Albinus <michael.albinus@gmx.de>
Cc: 63539@debbugs.gnu.org
Subject: bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
Date: Tue, 16 May 2023 16:06:42 -0400 [thread overview]
Message-ID: <ieredngoxbh.fsf@janestreet.com> (raw)
In-Reply-To: <ierjzx8oz3a.fsf@janestreet.com> (Spencer Baugh's message of "Tue, 16 May 2023 15:28:25 -0400")
Spencer Baugh <sbaugh@janestreet.com> writes:
> Michael Albinus <michael.albinus@gmx.de> writes:
>
>> Spencer Baugh <sbaugh@janestreet.com> 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))))
next prev parent reply other threads:[~2023-05-16 20:06 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 16:40 bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ] Spencer Baugh
2023-05-16 17:53 ` Michael Albinus
2023-05-16 19:28 ` Spencer Baugh
2023-05-16 20:06 ` Spencer Baugh [this message]
2023-05-17 14:07 ` Michael Albinus
2023-05-17 14:59 ` Spencer Baugh
2023-05-17 15:39 ` Michael Albinus
2023-05-17 16:56 ` Michael Albinus
2023-05-17 17:28 ` Michael Albinus
2023-05-17 18:08 ` Spencer Baugh
2023-05-17 18:41 ` Michael Albinus
2023-05-18 15:49 ` Michael Albinus
2023-05-20 10:18 ` Michael Albinus
2023-05-22 17:30 ` Spencer Baugh
2023-05-22 19:17 ` Michael Albinus
2023-05-22 19:45 ` Spencer Baugh
2023-05-23 13:49 ` Michael Albinus
2023-05-23 14:34 ` Spencer Baugh
2023-05-23 16:31 ` Michael Albinus
2023-05-25 7:36 ` Michael Albinus
2023-05-17 13:53 ` Michael Albinus
2023-05-17 14:04 ` Spencer Baugh
2023-05-17 14:12 ` 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=ieredngoxbh.fsf@janestreet.com \
--to=sbaugh@janestreet.com \
--cc=63539@debbugs.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).