kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
22.13k stars 907 forks source link

KITTY_DATA_START dump after second ssh onto server #7391

Closed imwints closed 2 weeks ago

imwints commented 2 weeks ago

Similar to https://github.com/kovidgoyal/kitty/issues/6254 I have a dump of KITTY_DATA_START in the terminal after a second login in a session. This started to occur when I set my shell on the remote system to start fish in the ~/.bashrc, it looks the following:

[[ -x /bin/fish ]] && SHELL=/bin/fish exec fish

To Reproduce

  1. kitty +kitten ssh <remote>
  2. Ctrl-D
  3. kitty +kitten ssh <remote>
  4. The dump starts after the second login

Environment details

kitty 0.34.1 created by Kovid Goyal
Linux *** 6.8.7-gentoo #1 SMP Thu Apr 18 14:26:55 CEST 2024 x86_64

This is *** (Linux x86_64 6.8.7-gentoo) 16:38:25

DISTRIB_ID="Gentoo"
Running under: Wayland (kwin 6.0.4) missing: single_pixel_buffer
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib64/kitty
  extensions dir: /usr/lib64/kitty/kitty
  system shell: /bin/bash
Loaded config files:
  ~/.config/kitty/kitty.conf

Config options different from defaults:
confirm_os_window_close 0
cursor_text_color       None
enable_audio_bell       False
font_family             JetBrainsMono Nerd Font
font_features:
{'+cv02': ('+cv05',
           '+cv09',
           '+cv14',
           '+ss04',
           '+cv16',
           '+cv31',
           '+cv25',
           '+cv26',
           '+cv32',
           '+cv28',
           '+ss10',
           '+zero',
           '+onum')}
scrollback_lines        10000
shell                   fish
tab_bar_min_tabs        1
tab_bar_style           powerline
tab_powerline_style     slanted
tab_title_template      {title}{' :{}:'.format(num_windows) if num_windows > 1 else ''}
undercurl_style         thin-dense
wheel_scroll_multiplier 10.0
window_padding_width    FloatEdges(left=3.0, top=3.0, right=3.0, bottom=3.0)
Colors:
    background              #32302f   
    color0                  #665c54   
    color1                  #ea6962   
    color10                 #a9b665   
    color11                 #d8a657   
    color12                 #7daea3   
    color13                 #d3869b   
    color14                 #89b482   
    color15                 #d4be98   
    color2                  #a9b665   
    color3                  #e78a4e   
    color4                  #7daea3   
    color5                  #d3869b   
    color6                  #89b482   
    color7                  #d4be98   
    color8                  #928374   
    color9                  #ea6962   
    cursor                  #a89984   
    foreground              #d4be98   
    selection_background    #d4be98   
    selection_foreground    #32302f   

Important environment variables seen by the kitty process:
    PATH                                /usr/local/sbin:/usr/local/bin:/usr/bin:/opt/bin:/usr/lib/llvm/18/bin:/usr/lib/llvm/17/bin
    LANG                                en_US.utf8
    EDITOR                              /bin/nano
    SHELL                               /bin/bash
    DISPLAY                             :0
    WAYLAND_DISPLAY                     wayland-0
    USER                                user
    XDG_CONFIG_DIRS                     ~/.config/kdedefaults:/etc/xdg
    XDG_CURRENT_DESKTOP                 KDE
    XDG_DATA_DIRS                       /usr/local/share:/usr/share
    XDG_MENU_PREFIX                     plasma-
    XDG_RUNTIME_DIR                     /run/user/1000
    XDG_SEAT                            seat0
    XDG_SEAT_PATH                       /org/freedesktop/DisplayManager/Seat0
    XDG_SESSION_CLASS                   user
    XDG_SESSION_DESKTOP                 KDE
    XDG_SESSION_ID                      c2
    XDG_SESSION_PATH                    /org/freedesktop/DisplayManager/Session1
    XDG_SESSION_TYPE                    wayland
    XDG_VTNR                            2

Additional context I have the same bash to fish setup on my local machine.

I launched kitty from the terminal like kitty --config NONE and can reproduce the issue, however the following pops up a couple hundred times on the first console, maybe it's interesting:

[PARSE ERROR] The application is trying to use xterm's modifyOtherKeys. This is superseded by the kitty keyboard protocol: https://sw.kovidgoyal.net/kitty/keyboard-protocol/ the application should be updated to use that
kovidgoyal commented 2 weeks ago

I'm afraid that's not a scenario I am interested in trying to support. Running exec replaces the process at which point there is nothing the kitten can do anymore since it has been replaced. You can try using python as the kitten interpreter, that might workaround it.

imwints commented 2 weeks ago

Thanks for the quick reply. I have troubles understanding why this occurs in the first place and how I might force python as the kitten interpreter :)

kovidgoyal commented 2 weeks ago

The documentation of the kitten tells you how to set its options and as to why it happens, its because on the remote side something ran your shell instead of the kittens remote script, which reads all that data. So that data was left pending and ended up on your screen.

kovidgoyal commented 2 weeks ago

And incidentally if you want to run some non login shell on the server like fish the correct way to do it is to set the login_shell option for the ssh kitten, then it will do it for you.