GNU bug report logs - #63539
29.0.90; TRAMP fails to detect shell prompts containing ]

Previous Next

Package: emacs;

Reported by: Spencer Baugh <sbaugh <at> janestreet.com>

Date: Tue, 16 May 2023 16:41:02 UTC

Severity: normal

Found in version 29.0.90

Fixed in version 29.2

Done: Michael Albinus <michael.albinus <at> gmx.de>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 63539 in the body.
You can then email your comments to 63539 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Tue, 16 May 2023 16:41:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Spencer Baugh <sbaugh <at> janestreet.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Tue, 16 May 2023 16:41:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.90; TRAMP fails to detect shell prompts containing ]
Date: Tue, 16 May 2023 12:40:07 -0400
Attempting to ssh to a machine with a prompt like:

[user <at> 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)



In GNU Emacs 29.0.90 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.15.12, Xaw scroll bars) of 2023-05-09 built on
 igm-qws-u22796a
Repository revision: 65c4a24aa0fc672bbf11e0c5187c6a29931b4363
Repository branch: emacs-29
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: CentOS Linux 7 (Core)

Configured using:
 'configure --with-x-toolkit=lucid --with-gif=ifavailable'

Configured features:
CAIRO DBUS FREETYPE GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON
LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND
SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XINPUT2 XPM LUCID
ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Shell-script

Minor modes in effect:
  jane-fe-minor-mode: t
  editorconfig-mode: t
  which-function-mode: t
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  windmove-mode: t
  savehist-mode: t
  save-place-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/project hides /home/sbaugh/.emacs.d/elpa/project-0.9.8/project
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/xref hides /home/sbaugh/.emacs.d/elpa/xref-1.6.3/xref
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/csharp-mode hides /home/sbaugh/src/emacs/emacs-29/lisp/progmodes/csharp-mode
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/xref hides /home/sbaugh/src/emacs/emacs-29/lisp/progmodes/xref
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/project hides /home/sbaugh/src/emacs/emacs-29/lisp/progmodes/project
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/eldoc hides /home/sbaugh/src/emacs/emacs-29/lisp/emacs-lisp/eldoc
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/auctex/lpath hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/dictionary/lpath
/home/sbaugh/src/emacs/emacs-29/lisp/net/dictionary hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/dictionary/dictionary
/usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/caml-font hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/ocaml/caml-font
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-version hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-version
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-loaddefs hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-loaddefs
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-keys hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-keys
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-perl hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-perl
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-core hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-core
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-rmail hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-rmail
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-octave hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-octave
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-comint hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-comint
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-w3m hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-w3m
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-org hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-org
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-texinfo hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-texinfo
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-inlinetask hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-inlinetask
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-mhe hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-mhe
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-ocaml hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-ocaml
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-clojure hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-clojure
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-publish hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-publish
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-irc hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-irc
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-calc hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-calc
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-odt hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-odt
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-id hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-id
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-gnus hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-gnus
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-matlab hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-matlab
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-icalendar hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-icalendar
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-footnote hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-footnote
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-bibtex hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-bibtex
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-lisp hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-lisp
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-C hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-C
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-org hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-org
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-indent hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-indent
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-info hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-info
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-maxima hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-maxima
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-awk hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-awk
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-man hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-man
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-goto hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-goto
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-md hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-md
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-eshell hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-eshell
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-lua hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-lua
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-habit hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-habit
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-R hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-R
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-eww hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-eww
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-makefile hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-makefile
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-latex hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-latex
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-docview hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-docview
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-lob hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-lob
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-beamer hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-beamer
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-faces hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-faces
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-html hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-html
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-feed hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-feed
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-bbdb hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ol-bbdb
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-lilypond hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-lilypond
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-ascii hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ox-ascii
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-latex hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-latex
/home/sbaugh/src/emacs/emacs-29/lisp/org/org hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-tangle hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-tangle
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-tempo hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-tempo
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-duration hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-duration
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-sqlite hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-sqlite
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-entities hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-entities
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-table hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-table
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-js hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-js
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-table hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-table
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-sql hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-sql
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-timer hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-timer
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-element hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-element
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-java hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-java
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-ctags hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-ctags
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-shell hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-shell
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-groovy hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-groovy
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-src hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-src
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-datetree hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-datetree
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-haskell hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-haskell
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-plot hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-plot
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-compat hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-compat
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-screen hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-screen
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-fortran hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-fortran
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-protocol hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-protocol
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-crypt hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-crypt
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-sed hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-sed
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-gnuplot hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-gnuplot
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-pcomplete hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-pcomplete
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-colview hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-colview
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-scheme hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-scheme
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-forth hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-forth
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-num hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-num
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-clock hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-clock
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-exp hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-exp
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-mouse hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-mouse
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-capture hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-capture
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-sass hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-sass
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-eval hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-eval
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-ref hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-ref
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-emacs-lisp hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-emacs-lisp
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-mobile hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-mobile
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-ruby hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-ruby
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-eshell hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-eshell
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-lint hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-lint
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-agenda hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-agenda
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-macro hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-macro
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-attach-git hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-attach-git
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-processing hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-processing
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-css hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-css
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-dot hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-dot
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-list hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-list
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-macs hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-macs
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-attach hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-attach
/home/sbaugh/src/emacs/emacs-29/lisp/org/org-archive hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/org-archive
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-python hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-python
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-plantuml hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-plantuml
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-ditaa hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/lisp/ob-ditaa
/home/sbaugh/src/emacs/emacs-29/lisp/org/ob-julia hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/contrib/lisp/ob-julia
/home/sbaugh/src/emacs/emacs-29/lisp/org/ol-man hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/contrib/lisp/ol-man
/home/sbaugh/src/emacs/emacs-29/lisp/org/ox-koma-letter hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/org/contrib/lisp/ox-koma-letter
/home/sbaugh/.emacs.d/elpa/dash-2.19.1/dash hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/dash/dash
/home/sbaugh/.emacs.d/elpa/dash-2.19.1/dash-functional hides /usr/local/home/sbaugh/workspaces/fe-47828/+share+/app/emacs/elisp/contrib/dash/dash-functional

Features:
(shadow emacsbug semantic/symref/grep texinfo texinfo-loaddefs
semantic/symref/project semantic/symref semantic/util-modes
semantic/util semantic semantic/tag semantic/lex semantic/fw cedet man
rect em-unix em-term term em-script em-prompt em-ls em-hist em-pred
em-glob em-extpipe em-cmpl em-dirs esh-var em-basic em-banner em-alias
esh-mode eshell esh-cmd esh-ext esh-opt esh-proc esh-io esh-arg
esh-module esh-groups esh-util tramp-adb tramp-container tramp-ftp
timezone tramp-cmds tramp-cache time-stamp tramp-sh rust-ts-mode
c-ts-common eglot external-completion array jsonrpc rust-utils rust-mode
rust-rustfmt rust-playpen rust-compile rust-cargo package-x url-misc
time vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs emoji-labels emoji
multisession sqlite org-agenda tabify cal-iso org-datetree org-capture
org-element org-persist org-id org-refile avl-tree oc-basic completion
log-view tramp-archive tramp-gvfs qp magit-patch magit-imenu git-rebase
face-remap ibuffer ibuffer-loaddefs etags fileloop generator flow-fill
sort smiley gnus-cite mail-extr textsec uni-scripts idna-mapping
ucs-normalize uni-confusable textsec-check gnus-async gnus-bcklg
gnus-agent gnus-srvr gnus-score score-mode nnvirtual nntp gnus-ml
gnus-msg disp-table nndoc gnus-cache gnus-dup debbugs-gnu debbugs-compat
debbugs soap-client rng-xsd rng-dt rng-util xsd-regexp ol-eww eww xdg
url-queue mm-url ol-rmail ol-mhe ol-irc ol-info ol-gnus nnselect
gnus-art mm-uu mml2015 mm-view mml-smime smime dig gnus-sum shr
pixel-fill kinsoku url-file svg dom gnus-group gnus-undo gnus-start
gnus-dbus dbus xml gnus-cloud nnimap nnmail mail-source utf7 nnoo
gnus-spec gnus-int gnus-range gnus-win gnus nnheader range ol-docview
doc-view jka-compr image-mode exif ol-bibtex bibtex ol-bbdb ol-w3m
ol-doi org-link-doi mm-archive gnutls url-http-ntlm ntlm hmac-md5
hex-util md4 network-stream url-cache url-http url-gw nsm cus-edit
cus-start cus-load wid-edit mode-local finder lisp-mnt autoinsert
sml-mode sml-move sml-defs sml-util sml-compat mule-util vc-git
bug-reference shortdoc ebuff-menu echistory chistory ehelp misc dabbrev
pulse sh-script treesit cl-print hl-line display-line-numbers help-fns
radix-tree executable misearch multi-isearch grep find-dired dired-aux
vc-fe goto-addr vc-hg vc-dir vc vc-dispatcher tramp tramp-loaddefs
trampver tramp-integration tramp-compat parse-time iso8601 ls-lisp
jane-merlin merlin-imenu merlin-xref merlin-cap merlin jane-async-merlin
jane-completion jane-common jane-project xref files-x jane-fe-menu
ecaml_plugin linum view gopcaml magit-bookmark bookmark image+ advice
image-file image-converter editorconfig editorconfig-core
editorconfig-core-handle editorconfig-fnmatch whitespace jane-auto-modes
vba-mode markdown-mode color jane jane-micro-features jane-diff
unified-test-mode shell-file core core-buffer core-error core-util ert
pp ewoc debug backtrace jane-sexp jane-ocaml jane-tuareg-theme tuareg
tuareg-compat tuareg-opam skeleton flymake-proc flymake warnings smie
caml-types caml-help caml-emacs find-file compile jane-cr jane-align
jane-deprecated jane-smerge gnu-elpa-keyring-update jane-ocp-indent
ocp-indent cl jane-util page-ext dired-x magit-extras project
magit-submodule magit-obsolete magit-blame magit-stash magit-reflog
magit-bisect magit-push magit-pull magit-fetch magit-clone magit-remote
magit-commit magit-sequence magit-notes magit-worktree magit-tag
magit-merge magit-branch magit-reset magit-files magit-refs magit-status
magit magit-repos magit-apply magit-wip magit-log which-func imenu
magit-diff smerge-mode diff diff-mode git-commit log-edit message
sendmail yank-media puny dired dired-loaddefs rfc822 mml mml-sec epa
derived epg rfc6068 epg-config gnus-util text-property-search mm-decode
mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 mm-util
ietf-drums mail-prsvr mailabbrev mail-utils gmm-utils mailheader
pcvs-util add-log magit-core magit-autorevert autorevert filenotify
magit-margin magit-transient magit-process with-editor shell server
magit-mode transient edmacro kmacro magit-git magit-section magit-utils
crm dash cl-extra help-mode windmove org ob ob-tangle ob-ref ob-lob
ob-table ob-exp org-macro org-src ob-comint org-pcomplete pcomplete
org-list org-footnote org-faces org-entities time-date noutline outline
icons ob-emacs-lisp ob-core ob-eval org-cycle org-table ol rx org-fold
org-fold-core org-keys oc org-loaddefs find-func cal-menu calendar
cal-loaddefs org-version org-compat org-macs format-spec gdb-mi bindat
gud easy-mmode comint ansi-osc ansi-color ring ffap thingatpt vundo
pcase cyberpunk-theme savehist saveplace project-autoloads
vundo-autoloads magit-autoloads xref-autoloads csv-mode-autoloads
magit-section-autoloads cyberpunk-theme-autoloads
url-http-ntlm-autoloads url-auth git-commit-autoloads
with-editor-autoloads finder-inf info dash-autoloads vc-hgcmd-autoloads
package browse-url url url-proxy url-privacy url-expand url-methods
url-history url-cookie generate-lisp-file url-domsuf url-util mailcap
url-handlers url-parse auth-source cl-seq eieio eieio-core cl-macs
password-cache json subr-x map byte-opt gv bytecomp byte-compile
url-vars cl-loaddefs cl-lib rmc iso-transl tooltip cconv eldoc paren
electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode
prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu
timer select scroll-bar mouse jit-lock font-lock syntax font-core
term/tty-colors frame minibuffer nadvice seq simple cl-generic
indonesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romanian slovak czech european ethiopic indian cyrillic chinese
composite emoji-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-face macroexp files window text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify
dynamic-setting system-font-setting font-render-setting cairo x-toolkit
xinput2 x multi-tty make-network-process emacs)

Memory information:
((conses 16 1548862 161873)
 (symbols 48 57690 0)
 (strings 32 259394 34269)
 (string-bytes 1 8734500)
 (vectors 16 143982)
 (vector-slots 8 2740541 203945)
 (floats 8 773 626)
 (intervals 56 115860 532)
 (buffers 976 211)
 (heap 1024 770206 142991))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Tue, 16 May 2023 17:54:01 GMT) Full text and rfc822 format available.

Message #8 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Tue, 16 May 2023 19:53:27 +0200
Spencer Baugh <sbaugh <at> janestreet.com> writes:

Hi Spencer,

> Attempting to ssh to a machine with a prompt like:
>
> [user <at> 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:

--8<---------------cut here---------------start------------->8---
[[ $TERM == "dumb" ]] && PS1='$ ' && return
--8<---------------cut here---------------end--------------->8---

The Tramp manual gives an extended version of the recipe, which handles
also the zsh line editing problem, but you see the idea.

And there is also the user option `tramp-shell-prompt-pattern' which you
can customize as you like.

Note, that Tramp cannot handle any case a user would prefer for
detecting the prompt.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Tue, 16 May 2023 19:29:02 GMT) Full text and rfc822 format available.

Message #11 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Tue, 16 May 2023 15:28:25 -0400
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Spencer Baugh <sbaugh <at> janestreet.com> writes:
>
> Hi Spencer,
>
>> Attempting to ssh to a machine with a prompt like:
>>
>> [user <at> 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.

> And there is also the user option `tramp-shell-prompt-pattern' which you
> can customize as you like.

Yes, I'm setting this to remove the ] as a possible prompt character as
a workaround.

> Note, that Tramp cannot handle any case a user would prefer for
> detecting the prompt.

If it can cheaply handle more cases, why not?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Tue, 16 May 2023 20:07:01 GMT) Full text and rfc822 format available.

Message #14 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Tue, 16 May 2023 16:06:42 -0400
Spencer Baugh <sbaugh <at> janestreet.com> writes:
> Michael Albinus <michael.albinus <at> gmx.de> writes:
>
>> Spencer Baugh <sbaugh <at> janestreet.com> writes:
>>
>> Hi Spencer,
>>
>>> Attempting to ssh to a machine with a prompt like:
>>>
>>> [user <at> 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 <at> 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))))




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Wed, 17 May 2023 13:54:02 GMT) Full text and rfc822 format available.

Message #17 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Wed, 17 May 2023 15:53:29 +0200
Spencer Baugh <sbaugh <at> janestreet.com> writes:

Hi Spencer,

>>> 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.

"[whatever]" is covered in Tramp. What isn't covered is your use case
"[user <at> hostname] foo/bar/path $".

> Just as an additional point, I'm not always connecting to hosts that I
> can trivially change the .profile for.

That's why you can customize shell-prompt-pattern or tramp-shell-prompt-pattern.

>> And there is also the user option `tramp-shell-prompt-pattern' which you
>> can customize as you like.
>
> Yes, I'm setting this to remove the ] as a possible prompt character as
> a workaround.

It isn't a workaround. It is the (documented way.

>> Note, that Tramp cannot handle any case a user would prefer for
>> detecting the prompt.
>
> If it can cheaply handle more cases, why not?

Because there are further subtle problems. It isn't only about detecting
the prompt. It is also about avoiding false positives. Think about text
which is printed my motd. Or think about shell script fragments, which
could appear here and there prior the prompt, like

--8<---------------cut here---------------start------------->8---
if [ -n "$FOO" ]; then ...
--8<---------------cut here---------------end--------------->8---

Tramp shouldn't trap into this, and there were reports in the past
about. That's why I dislike to change the current state of affairs.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Wed, 17 May 2023 14:05:03 GMT) Full text and rfc822 format available.

Message #20 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Wed, 17 May 2023 10:04:28 -0400
[Message part 1 (text/plain, inline)]
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Spencer Baugh <sbaugh <at> janestreet.com> writes:
>
> Hi Spencer,
>
>>>> 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.
>
> "[whatever]" is covered in Tramp. What isn't covered is your use case
> "[user <at> hostname] foo/bar/path $".

Again I want to note that "[user <at> hostname] $" is the default on
RHEL/Fedora machines, which surely are common enough that TRAMP to them
needs to be supported out of the box in Emacs.  And indeed they work
today in Emacs, they only break when the prompt is colored.

How about this patch, which is a separate enhancement to
shell-prompt-pattern to allow it to match colored prompts?  Which is a
useful feature for shell-mode, and as a side-effect fixes this bug.

[0001-Support-color-in-shell-prompt-pattern.patch (text/x-patch, inline)]
From 0f1c35e4c05e021198d75d94ad2dc6b987cc72a2 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh <at> janestreet.com>
Date: Wed, 17 May 2023 09:59:48 -0400
Subject: [PATCH] Support color in shell-prompt-pattern

shell-prompt-pattern works well, but it doesn't support escape
characters coming after the prompt like tramp-shell-prompt-pattern.
This change adds matching for escape characters, and also switches it
to be defined with rx for clarity.  As a side-effect, this fixes
Bug#63539

* lisp/shell.el (shell-prompt-pattern): Switch to rx and allow color
codes after the prompt.
---
 lisp/shell.el | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/lisp/shell.el b/lisp/shell.el
index 5cf108bfa3b..16cd5d42998 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -122,9 +122,12 @@ shell-dumb-shell-regexp
   :type 'regexp
   :group 'shell)
 
-(defcustom shell-prompt-pattern "^[^#$%>\n]*[#$%>] *"
+(defcustom shell-prompt-pattern (rx (* (not (any "#$%>\n")))
+      (any "#$%>")
+      (* blank)
+      ;; Escape characters.
+      (* "[" (* (any ";" digit)) alpha (* blank)))
   "Regexp to match prompts in the inferior shell.
-Defaults to \"^[^#$%>\\n]*[#$%>] *\", which works pretty well.
 This variable is used to initialize `comint-prompt-regexp' in the
 shell buffer.
 
-- 
2.30.2


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Wed, 17 May 2023 14:08:02 GMT) Full text and rfc822 format available.

Message #23 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Wed, 17 May 2023 16:07:16 +0200
Spencer Baugh <sbaugh <at> janestreet.com> writes:

Hi Spencer,

>> 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 <at> 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.

This kind of shell prompt is supported. I'm running Fedora myself, so I
know it.

> 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))))

Oh no! There are much more escape sequences but for coloring. We would
open a can of worms if we start to handle them in Tramp regexps.

What we could try is to remove such escape sequences by a function like
`ansi-color-filter-region' and/or `ansi-osc-filter-region', before
checking for a shell prompt.

Patches to Tramp welcome!

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Wed, 17 May 2023 14:13:02 GMT) Full text and rfc822 format available.

Message #26 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Wed, 17 May 2023 16:12:22 +0200
Spencer Baugh <sbaugh <at> janestreet.com> writes:

Hi Spencer,

>> "[whatever]" is covered in Tramp. What isn't covered is your use case
>> "[user <at> hostname] foo/bar/path $".
>
> Again I want to note that "[user <at> hostname] $" is the default on
> RHEL/Fedora machines, which surely are common enough that TRAMP to them
> needs to be supported out of the box in Emacs.  And indeed they work
> today in Emacs, they only break when the prompt is colored.

No, it isn't. The default (at least on my Fedora) is "[user <at> hostname]$ ".
Details do matter!

> How about this patch, which is a separate enhancement to
> shell-prompt-pattern to allow it to match colored prompts?  Which is a
> useful feature for shell-mode, and as a side-effect fixes this bug.

I cannot speak for shell-prompt-pattern in general, because I cannot say
where it is used.

For the Tramp case, see my other message about filtering the escape
sequences out.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Wed, 17 May 2023 15:00:02 GMT) Full text and rfc822 format available.

Message #29 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Wed, 17 May 2023 10:59:52 -0400
Michael Albinus <michael.albinus <at> gmx.de> writes:
> Spencer Baugh <sbaugh <at> janestreet.com> writes:
>> 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))))
>
> Oh no! There are much more escape sequences but for coloring. We would
> open a can of worms if we start to handle them in Tramp regexps.

Wait, but we already have exactly this kind of regexp for escape
characters in tramp-shell-prompt-regexp.  That's where I copied
this regexp from.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Wed, 17 May 2023 15:40:02 GMT) Full text and rfc822 format available.

Message #32 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Wed, 17 May 2023 17:39:28 +0200
Spencer Baugh <sbaugh <at> janestreet.com> writes:

Hi Spence,

>> Oh no! There are much more escape sequences but for coloring. We would
>> open a can of worms if we start to handle them in Tramp regexps.
>
> Wait, but we already have exactly this kind of regexp for escape
> characters in tramp-shell-prompt-regexp.  That's where I copied
> this regexp from.

I know. But there are problems with it:

- It isn't sufficient. We have at least the zle Problem with a remote
  zsh, which is also an escape sequence (I believe). So the regexp would
  need to be extended, which isn't the way we should go, I believe.

- We cannot change shell-prompt-pattern just for Tramp. As said, it is
  used also at other places in Emacs and in external packages, and I
  don't know whether there would be collateral damages.

That's why I've proposed the alternative, filtering out escape
sequences. Using existing functions from specialized packages.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Wed, 17 May 2023 16:57:01 GMT) Full text and rfc822 format available.

Message #35 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Wed, 17 May 2023 18:56:05 +0200
[Message part 1 (text/plain, inline)]
Michael Albinus <michael.albinus <at> gmx.de> 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?

Best regards, Michael.

[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Wed, 17 May 2023 17:30:02 GMT) Full text and rfc822 format available.

Message #38 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Wed, 17 May 2023 19:28:46 +0200
[Message part 1 (text/plain, inline)]
Michael Albinus <michael.albinus <at> gmx.de> 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.

[Message part 2 (text/x-patch, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Wed, 17 May 2023 18:09:02 GMT) Full text and rfc822 format available.

Message #41 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Wed, 17 May 2023 14:08:04 -0400
Michael Albinus <michael.albinus <at> gmx.de> writes:
> Michael Albinus <michael.albinus <at> gmx.de> 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.

Yes, this fixes my bug!  Thanks!




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Wed, 17 May 2023 18:43:01 GMT) Full text and rfc822 format available.

Message #44 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Wed, 17 May 2023 20:41:59 +0200
Spencer Baugh <sbaugh <at> janestreet.com> writes:

Hi Spencer,

>>> Hmm, perhaps the appended simplistic patch would do the job already?
>>> Could you, pls, test?
>>
>> Hmm, likely this one is better.
>
> Yes, this fixes my bug!  Thanks!

Great! I'll let run my test suite, and if everything goes well, I'll
push the patch to master.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Thu, 18 May 2023 15:50:02 GMT) Full text and rfc822 format available.

Message #47 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Thu, 18 May 2023 17:49:26 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

Hi Spencer,

> I'll let run my test suite, and if everything goes well, I'll push the
> patch to master.

Well, some of the regression tests fail. I'm analyzing what's up,
likely I'll try it with another approach.

I'll let you know when there is something to test.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Sat, 20 May 2023 10:19:01 GMT) Full text and rfc822 format available.

Message #50 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Sat, 20 May 2023 12:18:29 +0200
Michael Albinus <michael.albinus <at> gmx.de> writes:

Hi Spencer,

> Well, some of the regression tests fail. I'm analyzing what's up,
> likely I'll try it with another approach.
>
> I'll let you know when there is something to test.

This time the regression tests have (almost) succeeded. Remaining fails
are not related to this change.

I've pushed everything to master, could you pls test? The change is a
variation of your proposal to extend shell prompt regexps with the
comtroö sequences. However, I haven't done this as part of the regexps
themselves. Rather, I've appended the control sequences regexp on the
fly, where needed. This minimizes the hassle for people who want to
customize the user options.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Mon, 22 May 2023 17:31:02 GMT) Full text and rfc822 format available.

Message #53 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Mon, 22 May 2023 13:30:42 -0400
Michael Albinus <michael.albinus <at> gmx.de> writes:
> Michael Albinus <michael.albinus <at> gmx.de> writes:
>
> Hi Spencer,
>
>> Well, some of the regression tests fail. I'm analyzing what's up,
>> likely I'll try it with another approach.
>>
>> I'll let you know when there is something to test.
>
> This time the regression tests have (almost) succeeded. Remaining fails
> are not related to this change.
>
> I've pushed everything to master, could you pls test? The change is a
> variation of your proposal to extend shell prompt regexps with the
> comtroö sequences. However, I haven't done this as part of the regexps
> themselves. Rather, I've appended the control sequences regexp on the
> fly, where needed. This minimizes the hassle for people who want to
> customize the user options.
>
> Best regards, Michael.

Hmm, this change doesn't seem to fix my issue.  In fact, this change
introduces a regression for me: I'm no longer able to use TRAMP ssh on
my other machines which have color codes at the end of their prompt,
which did work out of the box on Emacs 29!

I'm guessing the reason is because this version of the regexp doesn't
support multiple escape codes, or blanks in between/at the end of the
escape codes?

The following patch on top both fixes the regression and also fixes my
issue:

diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index f986d65d944..1a067c8f9d9 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5711,10 +5711,10 @@ tramp-process-one-action
   (let ((case-fold-search t)
 	(shell-prompt-pattern
 	 (rx (regexp shell-prompt-pattern)
-	     (? (regexp ansi-color-control-seq-regexp))))
+	     (* (seq (regexp ansi-color-control-seq-regexp) (* blank)))))
 	(tramp-shell-prompt-pattern
 	 (rx (regexp tramp-shell-prompt-pattern)
-	     (? (regexp ansi-color-control-seq-regexp))))
+             (* (seq (regexp ansi-color-control-seq-regexp) (* blank)))))
 	tramp-process-action-regexp
 	found todo item pattern action)
     (while (not found)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Mon, 22 May 2023 19:18:02 GMT) Full text and rfc822 format available.

Message #56 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Mon, 22 May 2023 21:17:27 +0200
Spencer Baugh <sbaugh <at> janestreet.com> writes:

Hi Spencer,

> Hmm, this change doesn't seem to fix my issue.  In fact, this change
> introduces a regression for me: I'm no longer able to use TRAMP ssh on
> my other machines which have color codes at the end of their prompt,
> which did work out of the box on Emacs 29!
>
> I'm guessing the reason is because this version of the regexp doesn't
> support multiple escape codes, or blanks in between/at the end of the
> escape codes?

Blanks as parts of escape codes are unlikely.

Multiple escape codes are not regarded indeed, my patch did expect that
there is not more as one escape code at the end of the shell prompt.

Your example is an indication of escape codes, mixed inside the shell
prompt. My first attempt (removing all escape codes from the buffer
region) did handle that. But as said, there were other regressions with
that attemot.

Hmm. Could you please send me a tramp-verbose 10 trace of your failing test?

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Mon, 22 May 2023 19:46:01 GMT) Full text and rfc822 format available.

Message #59 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Mon, 22 May 2023 15:45:44 -0400
Michael Albinus <michael.albinus <at> gmx.de> writes:

> Spencer Baugh <sbaugh <at> janestreet.com> writes:
>
> Hi Spencer,
>
>> Hmm, this change doesn't seem to fix my issue.  In fact, this change
>> introduces a regression for me: I'm no longer able to use TRAMP ssh on
>> my other machines which have color codes at the end of their prompt,
>> which did work out of the box on Emacs 29!
>>
>> I'm guessing the reason is because this version of the regexp doesn't
>> support multiple escape codes, or blanks in between/at the end of the
>> escape codes?
>
> Blanks as parts of escape codes are unlikely.

In the middle, perhaps, but after the escape codes seems quite likely to
me.  At the very least, my prompt (which worked on Emacs 29 and no
longer works with your change) has blanks after the escape codes.

For reference, my now-broken prompt is:
PS1='\[\033[01;32m\]\u@\[\e[${hostnamecolor}m\]\h\[\033[01;34m\] \w \$\[\033[00m\] '

> Multiple escape codes are not regarded indeed, my patch did expect that
> there is not more as one escape code at the end of the shell prompt.
>
> Your example is an indication of escape codes, mixed inside the shell
> prompt. My first attempt (removing all escape codes from the buffer
> region) did handle that. But as said, there were other regressions with
> that attemot.

What's wrong with my diff, though?  It produces behavior which is much
closer to how TRAMP behaved before your change, while still fixing my
issue.

> Hmm. Could you please send me a tramp-verbose 10 trace of your failing test?

I'm not sure how useful this is, but:

  backtrace()
  tramp-error(nil quit "")
  tramp-signal-hook-function(quit nil)
  signal(quit nil)
  tramp-maybe-open-connection((tramp-file-name "ssh" "sbaugh" nil "test-host" nil "/home/sbaugh" nil))
  tramp-send-command((tramp-file-name "ssh" "sbaugh" nil "test-host" nil "/home/sbaugh" nil) "test -d /home/sbaugh 2>/dev/null; echo tramp_exit_...")
  tramp-send-command-and-check((tramp-file-name "ssh" "sbaugh" nil "test-host" nil "/home/sbaugh" nil) "test -d /home/sbaugh")
  tramp-run-test((tramp-file-name "ssh" "sbaugh" nil "test-host" nil "/home/sbaugh" nil) "-d" "/home/sbaugh")
  tramp-sh-handle-file-directory-p("/ssh:sbaugh <at> test-host:/home/sbaugh")
  apply(tramp-sh-handle-file-directory-p "/ssh:sbaugh <at> test-host:/home/sbaugh")
  tramp-sh-file-name-handler(file-directory-p "/ssh:sbaugh <at> test-host:/home/sbaugh")
  apply(tramp-sh-file-name-handler file-directory-p "/ssh:sbaugh <at> test-host:/home/sbaugh")
  tramp-file-name-handler(file-directory-p "/ssh:sbaugh <at> test-host:/home/sbaugh")
  file-directory-p("/ssh:sbaugh <at> test-host:/home/sbaugh/")
  tramp-handle-file-accessible-directory-p("/ssh:sbaugh <at> test-host:/home/sbaugh/")
  apply(tramp-handle-file-accessible-directory-p "/ssh:sbaugh <at> test-host:/home/sbaugh/")
  tramp-sh-file-name-handler(file-accessible-directory-p "/ssh:sbaugh <at> test-host:/home/sbaugh/")
  apply(tramp-sh-file-name-handler file-accessible-directory-p "/ssh:sbaugh <at> test-host:/home/sbaugh/")
  tramp-file-name-handler(file-accessible-directory-p "/ssh:sbaugh <at> test-host:/home/sbaugh/")
  file-accessible-directory-p("/ssh:sbaugh <at> test-host:/home/sbaugh/")
  cd("/ssh:sbaugh <at> test-host:")
  eshell/cd("/ssh:sbaugh <at> test-host:")
  apply(eshell/cd "/ssh:sbaugh <at> test-host:")
  eshell-exec-lisp(eshell-print eshell-error eshell/cd ("/ssh:sbaugh <at> test-host:") nil)
  eshell-lisp-command(eshell/cd ("/ssh:sbaugh <at> test-host:"))
  eshell-plain-command("cd" ("/ssh:sbaugh <at> test-host:"))
  eshell-named-command("cd" ("/ssh:sbaugh <at> test-host:"))
  eval((eshell-named-command '"cd" '("/ssh:sbaugh <at> test-host:")))
  eshell-do-eval((eshell-named-command '"cd" '("/ssh:sbaugh <at> test-host:")) nil)
  eshell-do-eval((prog1 (eshell-named-command '"cd" '("/ssh:sbaugh <at> test-host:")) (mapc #'funcall eshell-this-command-hook)) nil)
  (condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"cd" '("/ssh:sbaugh <at> test-host:")) (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1)))
  eval((condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"cd" '("/ssh:sbaugh <at> test-host:")) (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1))))
  eshell-do-eval((condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"cd" '("/ssh:sbaugh <at> test-host:")) (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1))) nil)
  #f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>)()
  funcall(#f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>))
  (let ((eshell-this-command-hook '(ignore))) (funcall '#f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>)))
  eval((let ((eshell-this-command-hook '(ignore))) (funcall '#f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>))))
  eshell-do-eval((let ((eshell-this-command-hook '(ignore))) (condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"cd" '...) (mapc #'funcall eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1)))) nil)
  #f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>)()
  funcall(#f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>))
  (let ((eshell-current-handles '[nil (((t) . 2) t) (((t) . 2) t)])) (funcall '#f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>)))
  eval((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)])) (funcall '#f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>))))
  eshell-do-eval((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)])) (let ((eshell-this-command-hook '(ignore))) (condition-case err (eshell-do-eval '(prog1 (eshell-named-command ... ...) (mapc ... eshell-this-command-hook)) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1))))) nil)
  eshell-do-eval((progn (let ((eshell-current-handles '[nil (... t) (... t)])) (let ((eshell-this-command-hook '(ignore))) (condition-case err (eshell-do-eval '(prog1 ... ...) nil) ((debug error) (mapc #'funcall eshell-this-command-hook) (eshell-errorn (error-message-string err)) (eshell-close-handles 1)))))) nil)
  (catch 'top-level (eshell-do-eval '(progn (let ((eshell-current-handles '...)) (let ((eshell-this-command-hook ...)) (condition-case err (eshell-do-eval ... nil) (... ... ... ...))))) nil))
  eval((catch 'top-level (eshell-do-eval '(progn (let ((eshell-current-handles ...)) (let (...) (condition-case err ... ...)))) nil)))
  eshell-do-eval((catch 'top-level (eshell-do-eval '(progn (let ((eshell-current-handles ...)) (let (...) (condition-case err ... ...)))) nil)) nil)
  eshell-do-eval((progn 'nil (catch 'top-level (eshell-do-eval '(progn (let (...) (let ... ...))) nil)) (run-hooks 'eshell-post-command-hook)) nil)
  #f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>)()
  funcall(#f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>))
  (let ((eshell-current-handles '[nil (((t) . 2) t) (((t) . 2) t)]) (eshell-current-subjob-p 'nil)) (funcall '#f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>)))
  eval((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)]) (eshell-current-subjob-p 'nil)) (funcall '#f(compiled-function () #<bytecode 0x1c62bf30a40bebd1>))))
  eshell-do-eval((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)]) eshell-current-subjob-p) (progn 'nil (catch 'top-level (eshell-do-eval '(progn (let ... ...)) nil)) (run-hooks 'eshell-post-command-hook))))
  eshell-resume-eval()
  eshell-eval-command((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)]) eshell-current-subjob-p) (progn 'nil (catch 'top-level (eshell-do-eval '(progn (let ... ...)) nil)) (run-hooks 'eshell-post-command-hook))) "cd /ssh:sbaugh <at> test-host:")
  eshell-send-input(nil)
  funcall-interactively(eshell-send-input nil)
  call-interactively(eshell-send-input nil nil)
  command-execute(eshell-send-input)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Tue, 23 May 2023 13:50:02 GMT) Full text and rfc822 format available.

Message #62 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Tue, 23 May 2023 15:49:07 +0200
Spencer Baugh <sbaugh <at> janestreet.com> writes:

Hi Spencer,

>>> I'm guessing the reason is because this version of the regexp doesn't
>>> support multiple escape codes, or blanks in between/at the end of the
>>> escape codes?
>>
>> Blanks as parts of escape codes are unlikely.
>
> In the middle, perhaps, but after the escape codes seems quite likely to
> me.  At the very least, my prompt (which worked on Emacs 29 and no
> longer works with your change) has blanks after the escape codes.
>
> For reference, my now-broken prompt is:
> PS1='\[\033[01;32m\]\u@\[\e[${hostnamecolor}m\]\h\[\033[01;34m\] \w \$\[\033[00m\] '

Thanks. But nobody forbids that you use "_" (underscore) instead of
blanks in your prompt, for example. Not very likely, I know. But I want
a solution now and forever.

>> Multiple escape codes are not regarded indeed, my patch did expect that
>> there is not more as one escape code at the end of the shell prompt.
>>
>> Your example is an indication of escape codes, mixed inside the shell
>> prompt. My first attempt (removing all escape codes from the buffer
>> region) did handle that. But as said, there were other regressions with
>> that attemot.
>
> What's wrong with my diff, though?  It produces behavior which is much
> closer to how TRAMP behaved before your change, while still fixing my
> issue.

I've pushed another change to master which goes back to my first
approach: Remove escape sequences in the buffer, before you look for the
prompt.

The difference is now, that this happens *only* in the initial
connection phase with a remote host, and not later. After that phase we
have a PS1 setting applied by Tramp, which is escape sequences free.

This approach should avoid the problems I've seen when I've applied a
similar change some days ago. I still need to run all regression test
cases, but a check for crucial tests tell me that we could be optimistic
now :-)

Could you pls check this change?

>> Hmm. Could you please send me a tramp-verbose 10 trace of your failing test?
>
> I'm not sure how useful this is, but:

I meant the Tramp debug buffer, producesd by setting tramp-verbose to
10. But since you have shown me your PS1 setting above, this isn't
needed anymore, thanks.

Best regards, Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Tue, 23 May 2023 14:35:01 GMT) Full text and rfc822 format available.

Message #65 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Michael Albinus <michael.albinus <at> gmx.de>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Tue, 23 May 2023 10:34:47 -0400
Michael Albinus <michael.albinus <at> gmx.de> writes:
>>> Multiple escape codes are not regarded indeed, my patch did expect that
>>> there is not more as one escape code at the end of the shell prompt.
>>>
>>> Your example is an indication of escape codes, mixed inside the shell
>>> prompt. My first attempt (removing all escape codes from the buffer
>>> region) did handle that. But as said, there were other regressions with
>>> that attemot.
>>
>> What's wrong with my diff, though?  It produces behavior which is much
>> closer to how TRAMP behaved before your change, while still fixing my
>> issue.
>
> I've pushed another change to master which goes back to my first
> approach: Remove escape sequences in the buffer, before you look for the
> prompt.
>
> The difference is now, that this happens *only* in the initial
> connection phase with a remote host, and not later. After that phase we
> have a PS1 setting applied by Tramp, which is escape sequences free.
>
> This approach should avoid the problems I've seen when I've applied a
> similar change some days ago. I still need to run all regression test
> cases, but a check for crucial tests tell me that we could be optimistic
> now :-)
>
> Could you pls check this change?

Thanks, this works with both my prompts.  (Fixing both the regression
and the original bug)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#63539; Package emacs. (Tue, 23 May 2023 16:32:01 GMT) Full text and rfc822 format available.

Message #68 received at 63539 <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539 <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Tue, 23 May 2023 18:31:16 +0200
Spencer Baugh <sbaugh <at> janestreet.com> writes:

Hi Spencer,

> Thanks, this works with both my prompts.  (Fixing both the regression
> and the original bug)

Thanks for the feedback. Let's wait for the result of the test campaign
(usually, it takes about 2 days).

Best regards, Michael.




Reply sent to Michael Albinus <michael.albinus <at> gmx.de>:
You have taken responsibility. (Thu, 25 May 2023 07:38:01 GMT) Full text and rfc822 format available.

Notification sent to Spencer Baugh <sbaugh <at> janestreet.com>:
bug acknowledged by developer. (Thu, 25 May 2023 07:38:01 GMT) Full text and rfc822 format available.

Message #73 received at 63539-done <at> debbugs.gnu.org (full text, mbox):

From: Michael Albinus <michael.albinus <at> gmx.de>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 63539-done <at> debbugs.gnu.org
Subject: Re: bug#63539: 29.0.90; TRAMP fails to detect shell prompts
 containing ]
Date: Thu, 25 May 2023 09:36:47 +0200
Version: 29.2

Michael Albinus <michael.albinus <at> gmx.de> writes:

Hi Spencer,

>> Thanks, this works with both my prompts.  (Fixing both the regression
>> and the original bug)
>
> Thanks for the feedback. Let's wait for the result of the test campaign
> (usually, it takes about 2 days).

The regression tests haven't shown serious problems, so I'm closing this
bug. The fix is in master. It will also be in the upcoming Tramp 2.6.0.5
on GNU ELPA.

Best regards, Michael.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 22 Jun 2023 11:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 280 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.