warpdotdev / Warp

Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.
https://warp.dev
Other
20.23k stars 335 forks source link

remote fish shell initialization issues #2454

Open jhheider opened 1 year ago

jhheider commented 1 year ago

Discord username (optional)

No response

Local Shell and Version

5.8.1

Remote Shell and Version

3.3.1 (fish)

Operating System and Version

macOS 12

Warp Version

v0.2023.01.03.08.03.stable_01

I have tried commenting out my system & user rcfiles and warp still will not bootstrap

Screenshots

Similar to https://github.com/warpdotdev/Warp/issues/2201; fish attempts to send bash/zsh shell initializations, causing fish to error, preventing login.

ssh nuc.jacobsdomain.arpa
fish: Unsupported use of '='. In fish, please use 'set _user "$(whoami 2>/dev/null || echo $USER)"'.

Connection to nuc.jacobsdomain.arpa closed.
ssh nuc.jacobsdomain.arpa -vvvv
OpenSSH_9.0p1, LibreSSL 3.3.6
[...]
debug3: Ignored env NVM_DIR
debug3: Ignored env NVM_CD_FLAGS
debug3: Ignored env NVM_BIN
debug3: Ignored env NVM_INC
debug3: Ignored env PNPM_HOME
debug3: Ignored env CONDA_CHANGEPS1
debug3: Ignored env WARP_PS1
debug3: Ignored env _
debug1: Sending command:
                         export TERM_PROGRAM='WarpTerminal'

                                                           _user="$(whoami 2>/dev/null || echo $USER)"
                                                                                                      _hostname="$(hostname 2>/dev/null || uname -n)"
                                                                                                                                                     hook=$(printf "{\\"hook\\": \\"SSH\\", \\"value\\": {\\"socket_path\\": \\"~/.ssh/16730788505631\\", \\"user\\": \\"%s\\", \\"machine\\": \\"%s\\", \\"remote_shell\\": \\"%s\\"}}" "$_user" "$_hostname" "${SHELL##*/}" | command od -An -v -tx1 | command tr -d " \\n")
                                                                            printf '\033P$d%s\234' $hook

                                                                                                        if test "${SHELL##*/}" != "bash" -a "${SHELL##*/}" != "zsh"; then
                                                                                                                                                                           exec $SHELL
             fi

               case ${SHELL##*/} in
                                     bash) exec -a bash bash --rcfile <(echo 'set -o vi; set +o vi; HISTCONTROL=ignorespace; printf '\\''\033P$d7b22686f6f6b223a2022496e69745368656c6c222c202276616c7565223a207b227368656c6c223a202262617368227d7d\234'\\''')
                                                                                           ;;
                                                                                               zsh) WARP_TMP_DIR=$(mktemp -d warptmp.XXXXXX)
                                                                                                                                            local ZSH_ENV_SCRIPT='756e7365746f7074205a4c453b20756e736574205243533b20756e73657420474c4f42414c5f5243533b207072696e746620275c7831
[...]
fish: Unsupported use of '='. In fish, please use 'set _user "$(whoami 2>/dev/null || echo $USER)"'.
[...]
Connection to nuc.jacobsdomain.arpa closed.
Transferred: sent 5200, received 4720 bytes, in 0.3 seconds
Bytes per second: sent 16654.9, received 15117.5
debug1: Exit status 123

Can be worked around, ironically, by ssh nuc.jacobsdomain.arpa fish.

Include shell xtrace output

WARP_DEBUG_MODE=1 ssh nuc.jacobsdomain.arpa
fish: Unsupported use of '='. In fish, please use 'set _user "$(whoami 2>/dev/null || echo $USER)"'.

Connection to nuc.jacobsdomain.arpa closed.

Does this block you from using Warp daily?

No

Warp Internal (ignore) - linear-label:e7dfaa84-5fdb-4a00-b754-d8912da923fa

None

Warp Internal (ignore): linear-label:b8107fdf-ba31-488d-b103-d271c89cac3e

None

dannyneira commented 1 year ago

Thanks for taking the time to submit it. This is less than ideal but as another possible workaround, you can just disable the SSH Wrapper in Settings > Features. We're working on some improvements to ssh and fish and will post any updates here.

jhheider commented 1 year ago

Good short-term solution. Life isn't friendly to running fish in general. Might be time to go back to zsh. I suspect, but haven't tested, that other non-bourne shells will probably have similar issues (as Cisco's CLI does). I'm thinking of things like nu, but Mikrotik's command-line would be on the list as well.

I wonder if there's any way to test your remote shell before executing the integrations. Unless ssh will give you a hint, there's probably no reliable way (though I've seen some tools (RANCID, maybe?) which try to make guesses based on the prompt, for various routers).

vorporeal commented 1 year ago

Hey @jhheider, thanks for the report! I have a (not-production-ready) fix that gets fish working as a fully-featured remote shell (as long as you're running fish >=2.7.0, which is 5 years old). I'm hoping to get it in a launchable state within the next month.

In terms of your workaround - it works because we bypass the SSH wrapper when you specify a command to run on the remote (we assume you're not starting an interactive session, so there's no reason to set up the shell with Warp's full functionality). You can also explicitly invoke /usr/bin/ssh to bypass the wrapper, which is implemented by defining a function in the shell called ssh (to handle the typical method by which users invoke the binary).

I'm working more broadly on figuring out ways to have our SSH wrapper be more robust to things like non-Bourne shells, but that'll take longer (as it requires more thought and design). It might look something like "aggressively try to use the wrapper, and if things fail, suggest to the user that they try again but without using the wrapper", as a way to have the wrapper in use by default, but with a fallback (including a "never use the SSH wrapper for this host" button) when things fail.

beejiujitsu commented 1 year ago

Another workaround: run fish in the terminal prior to running ssh to the remote fish-shelled host. I assume this also bypasses the ssh wrapper.

vorporeal commented 1 year ago

Update here - I submitted a change that will get fish working as a remote shell, but without any of the fancy Warp-ification that you get with bash and zsh as remote shells. I also have written code that adds full support for fish as a remote shell, but need to do a bit more testing and improve performance a bit before landing that functionality.

tl;dr: things should get much better within the next 2-3 weeks. :)

dannyneira commented 1 year ago

EDIT: Sorry folks, this appears to be an issue with fish and SSH sessions in Warp. As a workaround, please disable the SSH Wrapper in Settings > Features > Sessions, you'll lose Warp features like Blocks, etc. but the fish ssh session should function as normal.

kdrag0n commented 1 year ago

@dannyneira I'm still getting this fatal error (not slow startup) with fish 3.6.1 on the remote host.

fish: Unsupported use of '='. In fish, please use 'set _user "$(command -v whoami >/dev/null 2>&1 && command whoami 2>/dev/null || echo $USER)"'.
_user="$(command -v whoami >/dev/null 2>&1 && command whoami 2>/dev/null || echo $USER)"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Connection to 127.0.0.1 closed.
olly-writes-code commented 1 year ago

Also getting this error

sponge1220 commented 1 year ago

Are there any updates? Also getting this error.

eth0net commented 10 months ago

I'm seeing similar issues with remote fish, I did find that if I run ssh through a fish subshell without warpifying it works.

https://app.warp.dev/block/9KFKKUjSadgktOTH1Q1VJc

https://app.warp.dev/block/b4JvWrs9HsS3hTmFuVQG1N

hansstimer commented 9 months ago

Looking forward to getting this fixed. For now I'm switching to zsh, but I would definitely like to be back fish.

eth0net commented 9 months ago

I ended up running into a bunch of similar issues and had to give it up

Not sure if it's related, but I suspect it's along the same lines, JetBrains running on Windows fails to load git from inside WSL due to a whole bunch of characters returned ahead of stdout. I reported it to them to see if they could fix it, but I suspect it may be a larger compatibility issue between fish and other systems calling into it.

For now at least, I have to stick with zsh...

alexclst commented 7 months ago

I see the same issue. For now I've just turned off the Warp SSH wrapper, but looking forward to being able to turn it back on once fish is supported as a remote shell.