* bug#54270: 29.0.50; tramp doesn't work for zsh with trailing zle_bracketed_paste "2004h"
@ 2022-03-06 10:08 William Xu
2022-03-06 13:00 ` Michael Albinus
0 siblings, 1 reply; 5+ messages in thread
From: William Xu @ 2022-03-06 10:08 UTC (permalink / raw)
To: 54270
When using tramp to ssh into a remote with zsh, it never finishes, but
trapped in below `while':
---------------------------------8<-------------------------------------
(defun tramp-process-one-action (proc vec actions)
"Wait for output from the shell and perform one action.
See `tramp-process-actions' for the format of ACTIONS."
(let ((case-fold-search t)
tramp-process-action-regexp
found todo item pattern action)
(while (not found)
---------------------------------8<-------------------------------------
After some debugging, it turns out that zsh is adding some special
zle_bracketed_paste at the end of the prompt: "~ % [?2004h", which
makes the regexp matching fail. I have to make below change to fix it.
Later I found various issues of zsh are actually already discussed on
emacswiki: https://www.emacswiki.org/emacs/TrampMode#toc8 Alternative
solution discussed there is to change .zshrc file.
However, considering zsh has become the default shell in some OSes, like
macOS, would it be possible to resolve this at tramp? Using changes like
below? Or make regexp "\\'" be part of user configurable option, like
tramp-shell-prompt-pattern?
---------------------------------8<-------------------------------------
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 932dfb3691..7225c9ed3a 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -4932,7 +4932,7 @@ tramp-process-one-action
(while todo
(setq item (pop todo)
tramp-process-action-regexp (symbol-value (nth 0 item))
- pattern (format "\\(%s\\)\\'" tramp-process-action-regexp)
+ pattern (format "\\(%s\\)" tramp-process-action-regexp)
action (nth 1 item))
(tramp-message
vec 5 "Looking for regexp \"%s\" from remote shell" pattern)
---------------------------------8<-------------------------------------
In GNU Emacs 29.0.50 (build 3, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)
of 2022-02-23 built on 8e6ade8fe188
Repository revision: 304c373c98ffdba8f946072f15fd109c4cef533f
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Ubuntu 20.04.3 LTS
--
William
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#54270: 29.0.50; tramp doesn't work for zsh with trailing zle_bracketed_paste "2004h"
2022-03-06 10:08 bug#54270: 29.0.50; tramp doesn't work for zsh with trailing zle_bracketed_paste "2004h" William Xu
@ 2022-03-06 13:00 ` Michael Albinus
2022-03-06 18:41 ` William Xu
0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2022-03-06 13:00 UTC (permalink / raw)
To: William Xu; +Cc: 54270
William Xu <william.xwl@gmail.com> writes:
Hi William,
> After some debugging, it turns out that zsh is adding some special
> zle_bracketed_paste at the end of the prompt: "~ % [?2004h", which
> makes the regexp matching fail. I have to make below change to fix it.
Indeed. The Tramp manual discusses the issue, and recommends to set on
the remote ~/.zshrc:
--8<---------------cut here---------------start------------->8---
[[ $TERM == "dumb" ]] && unsetopt zle && PS1='$ ' && return
--8<---------------cut here---------------end--------------->8---
> However, considering zsh has become the default shell in some OSes, like
> macOS, would it be possible to resolve this at tramp? Using changes like
> below? Or make regexp "\\'" be part of user configurable option, like
> tramp-shell-prompt-pattern?
I don't want to change this, due to possible damages for other
configurations. However, the Tramp manual recommends to tell Tramp, that
the remote shell is zsh, see (info "(tramp) Remote shell setup")
Tramp will behave correctly then.
Best regards, Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#54270: 29.0.50; tramp doesn't work for zsh with trailing zle_bracketed_paste "2004h"
2022-03-06 13:00 ` Michael Albinus
@ 2022-03-06 18:41 ` William Xu
2022-03-06 19:11 ` Michael Albinus
0 siblings, 1 reply; 5+ messages in thread
From: William Xu @ 2022-03-06 18:41 UTC (permalink / raw)
To: 54270
Michael Albinus <michael.albinus@gmx.de> writes:
> I don't want to change this, due to possible damages for other
> configurations.
OK. So with default setup, "ssh + zsh" simply won't work out of box..
> However, the Tramp manual recommends to tell Tramp, that
> the remote shell is zsh, see (info "(tramp) Remote shell setup")
> Tramp will behave correctly then.
Following the info, the issue can be indeed also fixed by using
sshx. (though I have to install sshx first)
Thanks.
--
William
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#54270: 29.0.50; tramp doesn't work for zsh with trailing zle_bracketed_paste "2004h"
2022-03-06 18:41 ` William Xu
@ 2022-03-06 19:11 ` Michael Albinus
2022-03-06 20:13 ` William Xu
0 siblings, 1 reply; 5+ messages in thread
From: Michael Albinus @ 2022-03-06 19:11 UTC (permalink / raw)
To: William Xu; +Cc: 54270
William Xu <william.xwl@gmail.com> writes:
Hi William,
>> However, the Tramp manual recommends to tell Tramp, that
>> the remote shell is zsh, see (info "(tramp) Remote shell setup")
>> Tramp will behave correctly then.
>
> Following the info, the issue can be indeed also fixed by using
> sshx. (though I have to install sshx first)
You don't need to install "sshx". It is just the name of a Tramp method,
which still uses ssh internally.
> Thanks.
Best regards, Michael.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#54270: 29.0.50; tramp doesn't work for zsh with trailing zle_bracketed_paste "2004h"
2022-03-06 19:11 ` Michael Albinus
@ 2022-03-06 20:13 ` William Xu
0 siblings, 0 replies; 5+ messages in thread
From: William Xu @ 2022-03-06 20:13 UTC (permalink / raw)
To: 54270
Michael Albinus <michael.albinus@gmx.de> writes:
> You don't need to install "sshx". It is just the name of a Tramp method,
> which still uses ssh internally.
Ah, you are right... :) Now I can remove the sshx command line installed
via python pip.
--
William
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-03-06 20:13 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-06 10:08 bug#54270: 29.0.50; tramp doesn't work for zsh with trailing zle_bracketed_paste "2004h" William Xu
2022-03-06 13:00 ` Michael Albinus
2022-03-06 18:41 ` William Xu
2022-03-06 19:11 ` Michael Albinus
2022-03-06 20:13 ` William Xu
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.