GNU bug report logs - #54270
29.0.50; tramp doesn't work for zsh with trailing zle_bracketed_paste "2004h"

Previous Next

Package: emacs;

Reported by: William Xu <william.xwl <at> gmail.com>

Date: Sun, 6 Mar 2022 10:09:01 UTC

Severity: normal

Tags: moreinfo, notabug

Found in version 29.0.50

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

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: William Xu <william.xwl <at> gmail.com>
To: 54270 <at> 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
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





This bug report was last modified 3 years and 75 days ago.

Previous Next


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