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

kitten ssh doesn't work with fish shell #3405

Closed
mattgodbolt opened this issue Mar 18, 2021 · 14 comments
Closed

kitten ssh doesn't work with fish shell #3405

mattgodbolt opened this issue Mar 18, 2021 · 14 comments
Labels

Comments

@mattgodbolt
Copy link

Describe the bug
I'm trying out kitty, and hit the #713. The FAQ confused me but I found the "just use kitty +kitten ssh" comment, and so tried that.

I'm using fish shell on both ends of the connection, and I get:

$ kitty +kitten ssh cy2-desktop-37 
fish: Unsupported use of '='. In fish, please use 'set tmp $(mktemp /tmp/terminfo.XXXXXX)'.

Connection to cy2-desktop-37 closed.

To Reproduce
Steps to reproduce the behavior:

  1. Configure fish shell as the default
  2. kitty + kitten ssh <machine>
  3. See error

Expected behavior
ssh to work

Environment details
OS: Ubuntu 20.04.2 LTS

Output of kitty --debug-config
kitty 0.15.0 created by Kovid Goyal
Linux godbolt 5.8.0-44-generic #50~20.04.1-Ubuntu SMP Wed Feb 10 21:07:30 UTC 2021 x86_64
Ubuntu 20.04.2 LTS \n \l
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=20.04
DISTRIB_CODENAME=focal
DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
Loaded config files: /etc/xdg/kitty/kitty.conf
Running under: X11

Config options different from defaults:
update_check_interval 0.0

Additional context
Reproduces with kitty --config NONE

@kovidgoyal
Copy link
Owner

This is addressed in the FAQ::

infocmp xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin

@kovidgoyal
Copy link
Owner

Oh and if you run kitty from master yu can also use th enew python mde for the ssh kitten

kitty +kitten ssh use-python myserver

@mattgodbolt
Copy link
Author

@kovidgoyal
Copy link
Owner

Oh and PRs to improve the wording in the FAQ are most welcome, https://sw.kovidgoyal.net/kitty/faq.html#i-get-errors-about-the-terminal-being-unknown-or-opening-the-terminal-failing-when-sshing-into-a-different-computer

relevant file is docs/faq.rst

@mattgodbolt
Copy link
Author

mattgodbolt commented Mar 18, 2021

Oh and if you run kitty from master yu can also use th enew python mde for the ssh kitten

infocmp xterm-kitty | ssh myserver tic -x -o \~/.terminfo /dev/stdin

It seems I need to do this to every server? I have a fleet of many hundreds of machines, and I don't want to force this step on to them. I'm not sure I understand why this is needed, I'll read the FAQ some more.

@kovidgoyal
Copy link
Owner

many terminal programs require the terminfo database of the terminal you are using to function. Those terminfo files need to get on your servers somehow. Servers come with pre-installed terminfo files for older terminals. Newer ones need their terminfo installed separately. You can use the ssh kitten aliased as ssh to avoid having to do this manually, unless it doesnt work because you have set your shell on the servers to be a non-POSIX compliant shell like fish. In that case use the python variant assuming you have python on your servers (the python variant is currntly not in released kitty version so you have to run kitty form master).

@mattgodbolt
Copy link
Author

Thanks for the note. I do have python on my servers. This all seems confusing for "just" wanting to try out a new xterm, but I appreciate the effort you put in to this and in replying to my issues here.

@kovidgoyal
Copy link
Owner

You're welcome, I've gotten a lot of use out of compiler explorer over the years :)

@mattgodbolt
Copy link
Author

Thanks 😊 :)

@aadibajpai
Copy link

aadibajpai commented Jun 21, 2021

I tried the python variant but that gave me an error as well so I manually copied over the terminfo files which worked. However I was digging through the source and I observed that the script gets the shell dynamically. If kitty doesn't support fish, is it possible to simply execute the bash script with /bin/sh instead of fish so it won't complain about the syntax error.

i.e.

try:
shell_path = pwd.getpwuid(os.geteuid()).pw_shell or '/bin/sh'

has something like

if shell_path.endswith('fish'):
    shell_path = '/bin/sh'

edit: nvm I tried to compile from source with that change and it didn't work

@kovidgoyal
Copy link
Owner

What bash script? The line you are pointing to executes the login shell
for whatever account you have logged into on the remote machine using
python. And it would help if you posted the error you got from the
python version.

@aadibajpai
Copy link

What bash script? The line you are pointing to executes the login shell
for whatever account you have logged into on the remote machine using
python. And it would help if you posted the error you got from the
python version.

the error is about python not being available to the shell, I assume this happens because I have python3 and not python:

fish: Unknown command: python
fish: 
python -c "#!/usr/bin/env python
from __future__ import print_function
from tempfile import NamedTemporaryFile
import subprocess, os, sys, pwd, binascii, json

# macOS ships with an ancient version of tic that cannot read from stdin, so we
# create a temp file for it
with NamedTemporaryFile() as tmp:
    tmp.write(binascii.unhexlify('23095265636f6e73747275637465642076696120696e666f636d702066726f6d2066696c653a202f686f6d652f636c6173682f2e6c6f63616c2f6b697474792e6170702f6c69622f6b697474792f7465726d696e666f2f782f787465726d2d6b697474790a787465726d2d6b697474797c4b6f7649645454592c0a09616d2c206363632c2068732c206b6d2c206d6335692c206d69722c206d7367722c206e70632c2078656e6c2c2053752c2054632c2066756c6c6b62642c0a09636f6c6f72732330783130302c20636f6c732338302c20697423382c206c696e65732332342c207061697273233078376666662c0a09616373633d2b2b5c2c5c2c2d2d2e2e30306060616166666767686869696a6a6b6b6c6c6d6d6e6e6f6f70707171727273737474757576767777787879797a7a7b7b7c7c7d7d7e7e2c0a0962656c3d5e472c20626f6c643d5c455b316d2c206362743d5c455b5a2c2063697669733d5c455b3f32356c2c0a09636c6561723d5c455b485c455b324a2c20636e6f726d3d5c455b3f31326c5c455b3f3235682c2063723d5c722c0a096373723d5c455b256925703125643b2570322564722c206375623d5c455b2570312564442c20637562313d5e482c0a096375643d5c455b2570312564422c20637564313d5c6e2c206375663d5c455b2570312564432c20637566313d5c455b432c0a096375703d5c455b256925703125643b2570322564482c206375753d5c455b2570312564412c20637575313d5c455b412c0a0963767669733d5c455b3f31323b3235682c206463683d5c455b2570312564502c20646368313d5c455b502c2064696d3d5c455b326d2c0a09646c3d5c455b25703125644d2c20646c313d5c455b4d2c2064736c3d5c455d323b5c3030372c206563683d5c455b2570312564582c0a0965643d5c455b4a2c20656c3d5c455b4b2c20656c313d5c455b314b2c20666c6173683d5c455b3f3568243c3130302f3e5c455b3f356c2c0a0966736c3d5e472c20686f6d653d5c455b482c206870613d5c455b25692570312564472c2068743d5e492c206874733d5c45482c0a096963683d5c455b2570312564402c20696c3d5c455b25703125644c2c20696c313d5c455b4c2c20696e643d5c6e2c0a09696e646e3d5c455b2570312564532c0a09696e6974633d5c455d343b25703125643b7267625c3a257032257b3235357d252a257b313030307d252f25322e32582f257033257b3235357d252a257b313030307d252f25322e32582f257034257b3235357d252a257b313030307d252f25322e32585c455c5c2c0a096b44433d5c455b333b327e2c206b454e443d5c455b313b32462c206b484f4d3d5c455b313b32482c206b49433d5c455b323b327e2c0a096b4c46543d5c455b313b32442c206b4e58543d5c455b363b327e2c206b5052563d5c455b353b327e2c206b5249543d5c455b313b32432c0a096b61313d2c206b61333d2c206b62733d5e3f2c206b63313d2c206b63333d2c206b6362743d5c455b5a2c206b637562313d5c454f442c0a096b637564313d5c454f422c206b637566313d5c454f432c206b637575313d5c454f412c206b646368313d5c455b337e2c206b656e643d5c454f462c0a096b66313d5c454f502c206b6631303d5c455b32317e2c206b6631313d5c455b32337e2c206b6631323d5c455b32347e2c0a096b6631333d5c455b313b32502c206b6631343d5c455b313b32512c206b6631353d5c455b313b32522c206b6631363d5c455b313b32532c0a096b6631373d5c455b31353b327e2c206b6631383d5c455b31373b327e2c206b6631393d5c455b31383b327e2c206b66323d5c454f512c0a096b6632303d5c455b31393b327e2c206b6632313d5c455b32303b327e2c206b6632323d5c455b32313b327e2c0a096b6632333d5c455b32333b327e2c206b6632343d5c455b32343b327e2c206b6632353d5c455b313b35502c206b6632363d5c455b313b35512c0a096b6632373d5c455b313b35522c206b6632383d5c455b313b35532c206b6632393d5c455b31353b357e2c206b66333d5c454f522c0a096b6633303d5c455b31373b357e2c206b6633313d5c455b31383b357e2c206b6633323d5c455b31393b357e2c0a096b6633333d5c455b32303b357e2c206b6633343d5c455b32313b357e2c206b6633353d5c455b32333b357e2c0a096b6633363d5c455b32343b357e2c206b6633373d5c455b313b36502c206b6633383d5c455b313b36512c206b6633393d5c455b313b36522c0a096b66343d5c454f532c206b6634303d5c455b313b36532c206b6634313d5c455b31353b367e2c206b6634323d5c455b31373b367e2c0a096b6634333d5c455b31383b367e2c206b6634343d5c455b31393b367e2c206b6634353d5c455b32303b367e2c0a096b6634363d5c455b32313b367e2c206b6634373d5c455b32333b367e2c206b6634383d5c455b32343b367e2c0a096b6634393d5c455b313b33502c206b66353d5c455b31357e2c206b6635303d5c455b313b33512c206b6635313d5c455b313b33522c0a096b6635323d5c455b313b33532c206b6635333d5c455b31353b337e2c206b6635343d5c455b31373b337e2c0a096b6635353d5c455b31383b337e2c206b6635363d5c455b31393b337e2c206b6635373d5c455b32303b337e2c0a096b6635383d5c455b32313b337e2c206b6635393d5c455b32333b337e2c206b66363d5c455b31377e2c206b6636303d5c455b32343b337e2c0a096b6636313d5c455b313b34502c206b6636323d5c455b313b34512c206b6636333d5c455b313b34522c206b66373d5c455b31387e2c0a096b66383d5c455b31397e2c206b66393d5c455b32307e2c206b686c703d2c206b686f6d653d5c454f482c206b696368313d5c455b327e2c0a096b696e643d5c455b313b32422c206b6d6f75733d5c455b4d2c206b6e703d5c455b367e2c206b70703d5c455b357e2c0a096b72693d5c455b313b32412c206b756e643d2c206f633d5c455d3130345c3030372c206f703d5c455b33393b34396d2c2072633d5c45382c0a097265703d25703125635c455b257032257b317d252d2564622c207265763d5c455b376d2c2072693d5c454d2c0a0972696e3d5c455b2570312564542c207269746d3d5c455b32336d2c20726d6163733d5c4528422c20726d616d3d5c455b3f376c2c0a09726d6375703d5c455b3f313034396c2c20726d69723d5c455b346c2c20726d6b783d5c455b3f316c2c20726d736f3d5c455b32376d2c0a09726d756c3d5c455b32346d2c207273313d5c455d5c455c5c5c45632c2073633d5c45372c0a0973657461623d5c455b253f257031257b387d253c25743425703125642565257031257b31367d253c25743130257031257b387d252d2564256534383b353b2570312564253b6d2c0a0973657461663d5c455b253f257031257b387d253c25743325703125642565257031257b31367d253c257439257031257b387d252d2564256533383b353b2570312564253b6d2c0a097367723d253f25703925745c45283025655c452842253b5c455b30253f25703625743b31253b253f25703225743b34253b253f257031257033257c25743b37253b253f25703425743b35253b253f25703725743b38253b6d2c0a09736772303d5c4528425c455b6d2c207369746d3d5c455b336d2c20736d6163733d5c4528302c20736d616d3d5c455b3f37682c0a09736d6375703d5c455b3f31303439682c20736d69723d5c455b34682c20736d6b783d5c455b3f31682c20736d736f3d5c455b376d2c0a09736d756c3d5c455b346d2c207462633d5c455b33672c2074736c3d5c455d323b2c2075363d5c455b256925643b2564522c2075373d5c455b366e2c0a0975383d5c455b3f255b3b303132333435363738395d632c2075393d5c455b632c207670613d5c455b25692570312564642c0a096b4443333d5c455b333b337e2c206b4443343d5c455b333b347e2c206b4443353d5c455b333b357e2c206b4443363d5c455b333b367e2c0a096b4443373d5c455b333b377e2c206b444e3d5c455b313b32422c206b444e333d5c455b313b33422c206b444e343d5c455b313b34422c0a096b444e353d5c455b313b35422c206b444e363d5c455b313b36422c206b444e373d5c455b313b37422c206b454e44333d5c455b313b33462c0a096b454e44343d5c455b313b34462c206b454e44353d5c455b313b35462c206b454e44363d5c455b313b36462c0a096b454e44373d5c455b313b37462c206b484f4d333d5c455b313b33482c206b484f4d343d5c455b313b34482c0a096b484f4d353d5c455b313b35482c206b484f4d363d5c455b313b36482c206b484f4d373d5c455b313b37482c0a096b4943333d5c455b323b337e2c206b4943343d5c455b323b347e2c206b4943353d5c455b323b357e2c206b4943363d5c455b323b367e2c0a096b4943373d5c455b323b377e2c206b4c4654333d5c455b313b33442c206b4c4654343d5c455b313b34442c0a096b4c4654353d5c455b313b35442c206b4c4654363d5c455b313b36442c206b4c4654373d5c455b313b37442c0a096b4e5854333d5c455b363b337e2c206b4e5854343d5c455b363b347e2c206b4e5854353d5c455b363b357e2c0a096b4e5854363d5c455b363b367e2c206b4e5854373d5c455b363b377e2c206b505256333d5c455b353b337e2c0a096b505256343d5c455b353b347e2c206b505256353d5c455b353b357e2c206b505256363d5c455b353b367e2c0a096b505256373d5c455b353b377e2c206b524954333d5c455b313b33432c206b524954343d5c455b313b34432c0a096b524954353d5c455b313b35432c206b524954363d5c455b313b36432c206b524954373d5c455b313b37432c206b55503d5c455b313b32412c0a096b5550333d5c455b313b33412c206b5550343d5c455b313b34412c206b5550353d5c455b313b35412c206b5550363d5c455b313b36412c0a096b5550373d5c455b313b37412c20726d78783d5c455b32396d2c0a09736574726762623d5c455b34385c3a325c3a25703125645c3a25703225645c3a25703325646d2c0a09736574726762663d5c455b33385c3a325c3a25703125645c3a25703225645c3a25703325646d2c20736d78783d5c455b396d2c0a'))
    p = subprocess.Popen(['tic', '-x', '-o', os.path.expanduser('~/.terminfo'), tmp.name], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    stdout, stderr = p.communicate()
    if p.wait() != 0:
        getattr(sys.stderr, 'buffer', sys.stderr).write(stdout + stderr)
        raise SystemExit('Failed to compile terminfo using tic')
command_to_execute = json.loads(binascii.unhexlify('2222'))
try:
    shell_path = pwd.getpwuid(os.geteuid()).pw_shell or '/bin/sh'
except KeyError:
    shell_path = '/bin/sh'
shell_name = '-' + os.path.basename(shell_path)
if command_to_execute:
    os.execlp(shell_path, shell_path, '-c', command_to_execute)
os.execlp(shell_path, shell_name)
"
^

@kovidgoyal
Copy link
Owner

Yup, that is because you are missing python.

@aadibajpai
Copy link

Yup, that is because you are missing python.

yup, I tried aliasing python to python3 in the remote server and then running it, the command kitty +kitten ssh use-python myserver works but doesn't help as I still get the same issue (#713)

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

3 participants