unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
@ 2023-05-16 16:40 Spencer Baugh
  2023-05-16 17:53 ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Spencer Baugh @ 2023-05-16 16:40 UTC (permalink / raw)
  To: 63539


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)



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





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  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
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-16 17:53 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

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:

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





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-16 17:53 ` Michael Albinus
@ 2023-05-16 19:28   ` Spencer Baugh
  2023-05-16 20:06     ` Spencer Baugh
  2023-05-17 13:53     ` Michael Albinus
  0 siblings, 2 replies; 23+ messages in thread
From: Spencer Baugh @ 2023-05-16 19:28 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 63539

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.

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





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-16 19:28   ` Spencer Baugh
@ 2023-05-16 20:06     ` Spencer Baugh
  2023-05-17 14:07       ` Michael Albinus
  2023-05-17 13:53     ` Michael Albinus
  1 sibling, 1 reply; 23+ messages in thread
From: Spencer Baugh @ 2023-05-16 20:06 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 63539

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





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-16 19:28   ` Spencer Baugh
  2023-05-16 20:06     ` Spencer Baugh
@ 2023-05-17 13:53     ` Michael Albinus
  2023-05-17 14:04       ` Spencer Baugh
  1 sibling, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-17 13:53 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

Spencer Baugh <sbaugh@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@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-17 13:53     ` Michael Albinus
@ 2023-05-17 14:04       ` Spencer Baugh
  2023-05-17 14:12         ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Spencer Baugh @ 2023-05-17 14:04 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 63539

[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]

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

> Spencer Baugh <sbaugh@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@hostname] foo/bar/path $".

Again I want to note that "[user@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Support-color-in-shell-prompt-pattern.patch --]
[-- Type: text/x-patch, Size: 1310 bytes --]

From 0f1c35e4c05e021198d75d94ad2dc6b987cc72a2 Mon Sep 17 00:00:00 2001
From: Spencer Baugh <sbaugh@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


^ permalink raw reply related	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-16 20:06     ` Spencer Baugh
@ 2023-05-17 14:07       ` Michael Albinus
  2023-05-17 14:59         ` Spencer Baugh
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-17 14:07 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

Spencer Baugh <sbaugh@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@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-17 14:04       ` Spencer Baugh
@ 2023-05-17 14:12         ` Michael Albinus
  0 siblings, 0 replies; 23+ messages in thread
From: Michael Albinus @ 2023-05-17 14:12 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

Spencer Baugh <sbaugh@janestreet.com> writes:

Hi Spencer,

>> "[whatever]" is covered in Tramp. What isn't covered is your use case
>> "[user@hostname] foo/bar/path $".
>
> Again I want to note that "[user@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@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-17 14:07       ` Michael Albinus
@ 2023-05-17 14:59         ` Spencer Baugh
  2023-05-17 15:39           ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Spencer Baugh @ 2023-05-17 14:59 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 63539

Michael Albinus <michael.albinus@gmx.de> writes:
> Spencer Baugh <sbaugh@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-17 14:59         ` Spencer Baugh
@ 2023-05-17 15:39           ` Michael Albinus
  2023-05-17 16:56             ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-17 15:39 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

Spencer Baugh <sbaugh@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-17 15:39           ` Michael Albinus
@ 2023-05-17 16:56             ` Michael Albinus
  2023-05-17 17:28               ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-17 16:56 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

[-- Attachment #1: Type: text/plain, Size: 310 bytes --]

Michael Albinus <michael.albinus@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1419 bytes --]

diff --git a/lisp/tramp.el b/lisp/tramp.el
index 910d5343..1fd5e0aa 100644
--- 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.
-      (* "^[[" (* (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.
+    (when (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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-17 16:56             ` Michael Albinus
@ 2023-05-17 17:28               ` Michael Albinus
  2023-05-17 18:08                 ` Spencer Baugh
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-17 17:28 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

[-- Attachment #1: Type: text/plain, Size: 350 bytes --]

Michael Albinus <michael.albinus@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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Type: text/x-patch, Size: 1438 bytes --]

diff --git a/lisp/tramp.el b/lisp/tramp.el
index 910d5343..a44f8d1b 100644
--- 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.
-      (* "^[[" (* (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

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-17 17:28               ` Michael Albinus
@ 2023-05-17 18:08                 ` Spencer Baugh
  2023-05-17 18:41                   ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Spencer Baugh @ 2023-05-17 18:08 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 63539

Michael Albinus <michael.albinus@gmx.de> writes:
> Michael Albinus <michael.albinus@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!





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-17 18:08                 ` Spencer Baugh
@ 2023-05-17 18:41                   ` Michael Albinus
  2023-05-18 15:49                     ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-17 18:41 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

Spencer Baugh <sbaugh@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-17 18:41                   ` Michael Albinus
@ 2023-05-18 15:49                     ` Michael Albinus
  2023-05-20 10:18                       ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-18 15:49 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

Michael Albinus <michael.albinus@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-18 15:49                     ` Michael Albinus
@ 2023-05-20 10:18                       ` Michael Albinus
  2023-05-22 17:30                         ` Spencer Baugh
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-20 10:18 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

Michael Albinus <michael.albinus@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-20 10:18                       ` Michael Albinus
@ 2023-05-22 17:30                         ` Spencer Baugh
  2023-05-22 19:17                           ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Spencer Baugh @ 2023-05-22 17:30 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 63539

Michael Albinus <michael.albinus@gmx.de> writes:
> Michael Albinus <michael.albinus@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)





^ permalink raw reply related	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-22 17:30                         ` Spencer Baugh
@ 2023-05-22 19:17                           ` Michael Albinus
  2023-05-22 19:45                             ` Spencer Baugh
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-22 19:17 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

Spencer Baugh <sbaugh@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-22 19:17                           ` Michael Albinus
@ 2023-05-22 19:45                             ` Spencer Baugh
  2023-05-23 13:49                               ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Spencer Baugh @ 2023-05-22 19:45 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 63539

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

> Spencer Baugh <sbaugh@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@test-host:/home/sbaugh")
  apply(tramp-sh-handle-file-directory-p "/ssh:sbaugh@test-host:/home/sbaugh")
  tramp-sh-file-name-handler(file-directory-p "/ssh:sbaugh@test-host:/home/sbaugh")
  apply(tramp-sh-file-name-handler file-directory-p "/ssh:sbaugh@test-host:/home/sbaugh")
  tramp-file-name-handler(file-directory-p "/ssh:sbaugh@test-host:/home/sbaugh")
  file-directory-p("/ssh:sbaugh@test-host:/home/sbaugh/")
  tramp-handle-file-accessible-directory-p("/ssh:sbaugh@test-host:/home/sbaugh/")
  apply(tramp-handle-file-accessible-directory-p "/ssh:sbaugh@test-host:/home/sbaugh/")
  tramp-sh-file-name-handler(file-accessible-directory-p "/ssh:sbaugh@test-host:/home/sbaugh/")
  apply(tramp-sh-file-name-handler file-accessible-directory-p "/ssh:sbaugh@test-host:/home/sbaugh/")
  tramp-file-name-handler(file-accessible-directory-p "/ssh:sbaugh@test-host:/home/sbaugh/")
  file-accessible-directory-p("/ssh:sbaugh@test-host:/home/sbaugh/")
  cd("/ssh:sbaugh@test-host:")
  eshell/cd("/ssh:sbaugh@test-host:")
  apply(eshell/cd "/ssh:sbaugh@test-host:")
  eshell-exec-lisp(eshell-print eshell-error eshell/cd ("/ssh:sbaugh@test-host:") nil)
  eshell-lisp-command(eshell/cd ("/ssh:sbaugh@test-host:"))
  eshell-plain-command("cd" ("/ssh:sbaugh@test-host:"))
  eshell-named-command("cd" ("/ssh:sbaugh@test-host:"))
  eval((eshell-named-command '"cd" '("/ssh:sbaugh@test-host:")))
  eshell-do-eval((eshell-named-command '"cd" '("/ssh:sbaugh@test-host:")) nil)
  eshell-do-eval((prog1 (eshell-named-command '"cd" '("/ssh:sbaugh@test-host:")) (mapc #'funcall eshell-this-command-hook)) nil)
  (condition-case err (eshell-do-eval '(prog1 (eshell-named-command '"cd" '("/ssh:sbaugh@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@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@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@test-host:")
  eshell-send-input(nil)
  funcall-interactively(eshell-send-input nil)
  call-interactively(eshell-send-input nil nil)
  command-execute(eshell-send-input)






^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-22 19:45                             ` Spencer Baugh
@ 2023-05-23 13:49                               ` Michael Albinus
  2023-05-23 14:34                                 ` Spencer Baugh
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-23 13:49 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

Spencer Baugh <sbaugh@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-23 13:49                               ` Michael Albinus
@ 2023-05-23 14:34                                 ` Spencer Baugh
  2023-05-23 16:31                                   ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Spencer Baugh @ 2023-05-23 14:34 UTC (permalink / raw)
  To: Michael Albinus; +Cc: 63539

Michael Albinus <michael.albinus@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)





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-23 14:34                                 ` Spencer Baugh
@ 2023-05-23 16:31                                   ` Michael Albinus
  2023-05-25  7:36                                     ` Michael Albinus
  0 siblings, 1 reply; 23+ messages in thread
From: Michael Albinus @ 2023-05-23 16:31 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539

Spencer Baugh <sbaugh@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

* bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
  2023-05-23 16:31                                   ` Michael Albinus
@ 2023-05-25  7:36                                     ` Michael Albinus
  0 siblings, 0 replies; 23+ messages in thread
From: Michael Albinus @ 2023-05-25  7:36 UTC (permalink / raw)
  To: Spencer Baugh; +Cc: 63539-done

Version: 29.2

Michael Albinus <michael.albinus@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.





^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2023-05-25  7:36 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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