Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot debug_config without calling kitty from a tty #4424

Closed
thanhph111 opened this issue Jan 4, 2022 · 3 comments
Closed

Cannot debug_config without calling kitty from a tty #4424

thanhph111 opened this issue Jan 4, 2022 · 3 comments
Labels

Comments

@thanhph111
Copy link

Describe the bug

I've had this problem for quite some time but I think that was because of my build system. Until 0.24 was released today, I gave a try to the prebuilt binary and found that it still hit me. I've searched around but seems no one has had a similar problem, maybe it's something specific on my machine that beyonds my knowledge. Hope anyone with experience on this can give me some advices. Thank you.

Action debug_config throws me a wrapped message:

Key action failed

debug_config
(25, 'Inappropriate ioctl for device')

I didn't think it was related to the environment variable issue in the FAQ as I tried in default settings with an empty rc or profile, so I dug a little deeper into the code and discovered it comes from termios.tcgetattr. I think there's something holding the pipe that's preventing Python from finding the tty we're working with. If I call kitty from a tty the error goes away because kitty will refer to the parent tty and we get its unwanted IssueData but not our current kitty tty.

It's also raised from os.ttyname, although we've already catched that, we get the wrong tty_name = '(none)'.

kitty/kitty/debug_config.py

Lines 169 to 174 in a45d6c8

try:
self.tty_name = format_tty_name(os.ttyname(sys.stdin.fileno()))
except OSError:
self.tty_name = '(none)'
self.l = self.tty_name # noqa
self.baud_rate = termios.tcgetattr(sys.stdin.fileno())[5]

To Reproduce

Steps to reproduce the behavior:

  1. Empty kitty config.
  2. Empty shell config.
  3. Call kitty from a keyboard shortcut set by window manager.
  4. ctrl+shift+f6 and the error message appears.

Additional context

Kernel: Linux x64 5.11.0-43-generic
OS: Ubuntu 20.04.3 LTS

@thanhph111
Copy link
Author

So do I understand that we still accept exploiting the parent tty info, don't we? Even the braud_rate and tty_name cannot actually reflect kitty.

@kovidgoyal
Copy link
Owner

The parent tty is the tty kitty is connected to and is the correct tty
to use for /etc/issue. The children kitty runs
each have their own tty, debug config does not expose information about
them, since they are more than one in general.

@thanhph111
Copy link
Author

So I'm sure the fix is "robust" enough, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants