unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: William Xu <william.xwl@gmail.com>
To: 54270@debbugs.gnu.org
Subject: bug#54270: 29.0.50; tramp doesn't work for zsh with trailing zle_bracketed_paste "2004h"
Date: Sun, 06 Mar 2022 11:08:18 +0100	[thread overview]
Message-ID: <87bkyjcs19.fsf@gmail.com> (raw)

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






             reply	other threads:[~2022-03-06 10:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-06 10:08 William Xu [this message]
2022-03-06 13:00 ` bug#54270: 29.0.50; tramp doesn't work for zsh with trailing zle_bracketed_paste "2004h" Michael Albinus
2022-03-06 18:41   ` William Xu
2022-03-06 19:11     ` Michael Albinus
2022-03-06 20:13       ` William Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87bkyjcs19.fsf@gmail.com \
    --to=william.xwl@gmail.com \
    --cc=54270@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).