From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Spencer Baugh Newsgroups: gmane.emacs.bugs Subject: bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ] Date: Mon, 22 May 2023 15:45:44 -0400 Message-ID: References: <877ct8w4bs.fsf@gmx.de> <87sfbvuk4r.fsf@gmx.de> <87h6sbufv3.fsf@gmx.de> <87bkiivqvu.fsf@gmx.de> <877ct6vpdd.fsf@gmx.de> <871qjevlzc.fsf@gmx.de> <87r0rdtzax.fsf@gmx.de> <877ct3tife.fsf@gmx.de> <87mt1wdvlk.fsf@gmx.de> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13239"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 63539@debbugs.gnu.org To: Michael Albinus Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 22 21:46:31 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q1BUF-0003Co-NC for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 22 May 2023 21:46:31 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1q1BTx-000443-Dc; Mon, 22 May 2023 15:46:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1q1BTm-00043p-1i for bug-gnu-emacs@gnu.org; Mon, 22 May 2023 15:46:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1q1BTl-0004o8-Pe for bug-gnu-emacs@gnu.org; Mon, 22 May 2023 15:46:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1q1BTl-0006cW-L9 for bug-gnu-emacs@gnu.org; Mon, 22 May 2023 15:46:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Spencer Baugh Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 22 May 2023 19:46:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63539 X-GNU-PR-Package: emacs Original-Received: via spool by 63539-submit@debbugs.gnu.org id=B63539.168478475625430 (code B ref 63539); Mon, 22 May 2023 19:46:01 +0000 Original-Received: (at 63539) by debbugs.gnu.org; 22 May 2023 19:45:56 +0000 Original-Received: from localhost ([127.0.0.1]:36791 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q1BTf-0006c6-8f for submit@debbugs.gnu.org; Mon, 22 May 2023 15:45:55 -0400 Original-Received: from mxout5.mail.janestreet.com ([64.215.233.18]:60243) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1q1BTZ-0006bn-LP for 63539@debbugs.gnu.org; Mon, 22 May 2023 15:45:53 -0400 In-Reply-To: <87mt1wdvlk.fsf@gmx.de> (Michael Albinus's message of "Mon, 22 May 2023 21:17:27 +0200") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:262187 Archived-At: Michael Albinus writes: > Spencer Baugh 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 () #)() funcall(#f(compiled-function () #)) (let ((eshell-this-command-hook '(ignore))) (funcall '#f(compiled-function () #))) eval((let ((eshell-this-command-hook '(ignore))) (funcall '#f(compiled-function () #)))) 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 () #)() funcall(#f(compiled-function () #)) (let ((eshell-current-handles '[nil (((t) . 2) t) (((t) . 2) t)])) (funcall '#f(compiled-function () #))) eval((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)])) (funcall '#f(compiled-function () #)))) 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 () #)() funcall(#f(compiled-function () #)) (let ((eshell-current-handles '[nil (((t) . 2) t) (((t) . 2) t)]) (eshell-current-subjob-p 'nil)) (funcall '#f(compiled-function () #))) eval((let ((eshell-current-handles '[nil ((... . 2) t) ((... . 2) t)]) (eshell-current-subjob-p 'nil)) (funcall '#f(compiled-function () #)))) 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)