kovidgoyal / kitty

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

Kitty new_tab_with_cwd over ssh hangs if using `-p` option (non default port) #6449

Closed Minebomber closed 1 year ago

Minebomber commented 1 year ago

Describe the bug When using the ssh kitten, I can open a new tab with new_tab_with_cwd and it will open a new tab logged into the current ssh session if I open the session with kitty +kitten ssh user@host. However, when I use a custom port (ie 1234), and try this, the new tab will hang indefinitely.

To Reproduce Steps to reproduce the behavior:

  1. Set a keybind to open a new tab in the current working directory: map kitty_mod+t new_tab_with_cwd
  2. Launch an ssh session using a port other than 22: kitty +kitten ssh user@host -p 1234
  3. Attempt to open a new tab after logging in (pressing kitty_mod + t)
  4. The new tab will hang forever, preventing me from opening more than one ssh tab per workspace (I can open other windows and ssh, but it would be nice to use tabs to get full screen real estate on one workspace)
  5. This works perfectly fine when I port forward port 22 instead of a custom port and omit the -p flag.

Screenshots https://imgur.com/a/8Xf2TW9

Environment details

kitty 0.28.1 created by Kovid Goyal
Linux **** 6.4.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 06 Jul 2023 18:35:54 +0000 x86_64
Arch Linux 6.4.2-arch1-1 (/dev/tty)

Running under: X11
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib/kitty
  extensions dir: /usr/lib/kitty/kitty
  system shell: /bin/bash
Loaded config files:
  /home/mark/.config/kitty/kitty.conf

Config options different from defaults:
background_opacity   0.6
editor               nvim
font_family          JetBrainsMono Nerd Font
shell                /bin/zsh
tab_bar_edge         1
tab_bar_style        powerline
Added shortcuts:
    alt+1 →  goto_tab 1
    alt+2 →  goto_tab 2
    alt+3 →  goto_tab 3
    alt+4 →  goto_tab 4
    alt+5 →  goto_tab 5
    alt+6 →  goto_tab 6
    alt+7 →  goto_tab 7
    alt+8 →  goto_tab 8
    alt+9 →  goto_tab 9
Changed shortcuts:
    kitty_mod+t →  new_tab_with_cwd
Colors:
    background           #131313   
    color0               #1f1f1f   
    color1               #f71118   
    color10              #1dd260   
    color11              #f2bd09   
    color12              #0f80d5   
    color13              #524fb9   
    color14              #0f7cda   
    color2               #2cc55d   
    color3               #ecb90f   
    color4               #2a84d2   
    color5               #4e59b7   
    color6               #0f80d5   
    color7               #d6dae4   
    color8               #d6dae4   
    color9               #de342e   
    cursor               #b9b9b9   
    foreground           #d6dae4   
    selection_background #1f1f1f   
    selection_foreground #131313   

Important environment variables seen by the kitty process:
    PATH                                /usr/local/sbin:/usr/local/bin:/usr/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/usr/lib/rustup/bin:/home/mark/.rvm/bin
    LANG                                en_US.UTF-8
    VISUAL                              nvim
    EDITOR                              nvim
    SHELL                               /bin/zsh
    DISPLAY                             :0
    USER                                ****
    XDG_SEAT                            seat0
    XDG_SESSION_TYPE                    tty
    XDG_SESSION_CLASS                   user
    XDG_VTNR                            1
    XDG_SESSION_ID                      1
    XDG_RUNTIME_DIR                     /run/user/1000

Additional context Try to reproduce the problem with kitty --config NONE if you cannot then post a minimal kitty.conf that reproduces the problem. If the problem involves interaction with some other terminal program post a minimal config for that program to reproduce the problem as well.

This problem only occurs with the new_tab_with_cwd binding for new tab that I have, with --config NONE it works since the new tab opens in the home directory.

This issue isn't major, but an annoyance when I'm remoting into my desktop and trying to open multiple tabs when port forwarding something other than port 22.

kovidgoyal commented 1 year ago

Put -p 1234 after ssh not after user@host

This is the canonical syntax for the ssh command CLI

ssh [-46AaCfGgKkMNnqsTtVvXxYy] [-B bind_interface] [-b bind_address] [-c cipher_spec] [-D [bind_address:]port] [-E log_file] [-e escape_char] [-F configfile] [-I pkcs11] [-i identity_file] [-J [user@]host[:port]] [-L address] [-l login_name] [-m mac_spec] [-O ctl_cmd] [-o option] [-p port] [-Q query_option] [-R address] [-S ctl_path] [-W host:port] [-w local_tun[:remote_tun]] destination [command [argument ...]]