mirror of
https://github.com/asciinema/asciinema.git
synced 2026-04-26 00:15:56 +03:00
[GH-ISSUE #549] Using kitty terminal the kitty +kitten ssh machine@ip causes the shell to freeze during an asciinema rec session when asking for password input #913
Labels
No labels
bug
compatibility
feature request
fit for beginners
help wanted
hosting
idea
improvement
packaging
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/asciinema#913
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @AkechiShiro on GitHub (May 14, 2023).
Original GitHub issue: https://github.com/asciinema/asciinema/issues/549
Describe the bug

Using https://github.com/kovidgoyal/kitty as a terminal, running
asciinema rec test.castand thenkitty +kitten ssh, if a password prompt (see the custom password prompt) :is asked by the remote ssh server, the shell freezes up.
To be clear, what we see during an asciinema record session is that :
kitty +kitten ssh root@server.ssh, the shell freezes up.kill -9on the asciinema process allows getting back a working shell, CTRL+C does not work, nor any other signal for that matter.To Reproduce
Steps to reproduce the behavior:
kittyterminalasciinema rec test.castkitty +kitten ssh root@test.machine4a. If a password input is asked, the shell will freeze, this happens probably because kitty uses a custom way to handle password input for ssh (read additional context).
4b. If no password prompt is asked, the ssh access works all fine, and there is no freeze, the recording is all good as well.
Expected behavior
In case a password is asked, the shell should not freeze, but the password input should be asked by kitty and then ssh login should be made, so the user can record their session.
Versions:
Additional context
This issue seems very specific to kitty terminal emulator, and more specifically to the use of https://sw.kovidgoyal.net/kitty/kittens/ssh/
I suppose the issue is due to a conflict between how the kitty native ssh password input, askpass handles the terminal.
According to this documentation part about askpass
Setting
SSH_ASKPASS=sshand trying to reproduce the bug fails, which further shows that the bug is due to a specific interaction betweenasciinemaand kitty's nativeaskpass.Here is the process tree (when the shell is frozen :


On the long line beginning by
ssh -t, we can see a script beingevalthat contains the copyright from the maintainer of Kitty.This piece of code may or may not contain the call to
askpass, I suppose.@AkechiShiro commented on GitHub (May 14, 2023):
Additional context 2, here is the code from Kitty that is called for askpass I believe :
github.com/kovidgoyal/kitty@9a0068e318/kittens/ssh/askpass.go (L37)@ku1ik commented on GitHub (May 15, 2023):
Thanks for comprehensive description of the problem 👌
I wonder if other terminal recording tools have similar issue when running under kitty/ssh. Are you able to check with
scriptcommand or termrec?@AkechiShiro commented on GitHub (May 15, 2023):
Let me give it a try soon and report on it as soon as possible !
@AkechiShiro commented on GitHub (May 15, 2023):
termrec
There is the same issue, but timing seems of essence indeed, waiting only a few seconds and then sending signals CTLR+C/CTRL+D/CTRL+Z seems to have crashed termrec somehow, there has been a lot of base64 (probably from kitty's custom way of sending the terminfo to the ssh machine) that was spit out inside the terminal ending with
KITTY_DATA_END, trying to wait 30 sec to 1 min before sending out any signals, it seems the shell is frozen and unresponsive to any signals just like withasciinemaonly usingkill -9 termrecunfreezes the shell and provokes the spit out of lots of base64 lines in the terminal input.process tree :

trying to replay the recording with

termplayshows this :The
termrecplay never ends by itself, it seems that playing it, unless I press CTRL+C.I'm not sure if the base64 is sensible or not, I've hidden most of it just in case.
The terminal seems to have some borked some tty settings I suppose after playing that recording, a
resetis needed so thatls's output isn't usual, it's not using 4 spaced tabs/spaces, fonts are all good, it's just spacing/formatting of output of usual commands that seems broken.script
termrec, it freezes the shell indefinitely just likeasciinema, killing the it spits out base64 lines in the terminal ending withKITTY_DATA_END.termrecas well,asciinema
The same behavior is exhibited, tty settings are somewhat modified, killing is obligatory and shell is frozen until asciinema is killed.
I wonder about what if I kill instead the kitten process, what would happen in that case 🤔
EDIT 2:
asciinemaleaves processes that hang the shell exit,termrecandscriptdo not.@AkechiShiro commented on GitHub (May 15, 2023):
Just noticed one thing, killing
asciinemausingSIGTERMshowsaskpass's prompt !EDIT: Actually, I killed all the
kittenprocess before doing that, then send aSIGTERMto one of theasciinemaprocess, the more in depth in the process tree, this showedaskpassprompt.Trying to do the same without killing the
kittenprocesses doesn't show the same behavior, the mainasciinemadoes not budge with aSIGTERM, only aSIGKILL(=> spits back base64 into the terminal)@AkechiShiro commented on GitHub (May 15, 2023):
So finally, what would you recommend in order to try and dive deeper at the root of this issue, is it worth going that far ?
Or should I just settle for a workaround such as setting
SSH_ASKPASS=sshas an env variable, or establishing the connection with a kitty shell, not running any recording, entering the password (then kitty should remember it for as long as it's running, I believe?), so I could open an ssh connection in the shell with the recording of the session.@ku1ik commented on GitHub (May 16, 2023):
Given this problem is not specific to asciinema (as you found similar thing happens with termrec, script) I'd say the problem lies more on the kitty side. I'm not quite sure what's happening so I don't have a workaround idea at the moment.
I'm not saying asciinema is bug free in this case. In fact it's not impossible that script and termrec have the same bug. However, I find it rather unlikely that 3 separate codebases would have the same problem. Especially that for example script has been out there for over 40 years - if it had a bug like that it would most likely surface already in other terminal emulators.
@ku1ik commented on GitHub (May 16, 2023):
For completeness you can also test with ttyrec, which records in the same way as asciinema, termrec, script.
@ku1ik commented on GitHub (May 16, 2023):
From the other issue:
I'll reply here since it's not related to kitty:
There's main process where copying of data between recorded process and TTY happens (the code linked above).
There's another process dedicated for file writing, in order to not block process->TTY data copying on disk I/O.
And another one for notifier (which handles triggering desktop notification in certain situations), also to not block data copying by notifications.
@ku1ik commented on GitHub (Jul 5, 2023):
This should be fixed in 2.3.0.
@AkechiShiro commented on GitHub (Jul 5, 2023):
I'll test and then close the issue once I tested it, thanks !