bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]


From: Spencer Baugh
Subject: bug#63539: 29.0.90; TRAMP fails to detect shell prompts containing ]
Date: Mon, 22 May 2023 15:45:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13)

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)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]