Closed nalzok closed 2 months ago
After I messed around a little bit, kitten ssh
updates PATH
now, but in the wrong way. For example, here is the PATH
when I SSH with /usr/bin/ssh
~ $ command ssh sentinel
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
qys@sentinel ~> echo $PATH
/home/qys/.local/bin /usr/bin /bin /usr/sbin /sbin /usr/X11R6/bin /usr/local/bin /usr/local/sbin
qys@sentinel ~> doas pkg_add -u
doas (qys@sentinel.lan) password:
quirks-7.14 signed on 2024-07-03T17:56:08Z
However, if I use kitten ssh
, stuff like /usr/sbin
is no longer present in PATH
~ $ kitty +kitten ssh sentinel
Welcome to fish, the friendly interactive shell
Type help for instructions on how to use fish
qys@sentinel ~> echo $PATH
/home/qys/.local/bin /usr/local/bin /usr/bin /bin /home/qys/.local/share/kitty-ssh-kitten/kitty/bin
qys@sentinel ~> doas pkg_add -u
doas (qys@sentinel.lan) password:
doas: pkg_add: command not found
Of course, I can manually add /usr/sbin
back to PATH
as a workaround, but this seems like a bug in kitty's shell integration: it's probably not intentional to have kitty remove directories in PATH
.
The ssh kitten does not update PATH that will be done presumably by your shell's rc files. And you have setup your shell's rc files to not update path on non-interactive invocations. Fix that and you will be fine.
Sorry, I'm not sure what is the fix. Here is the ~/.config/fish/config.fish
on the remote OpenBSD host,
set -px PATH $HOME/.local/bin
if status is-interactive
# Commands to run in interactive sessions can go here
alias vi='/usr/local/bin/nvim'
set -gx EDITOR /usr/local/bin/nvim
end
if test $TERM = "xterm-kitty";
alias ssh="kitty +kitten ssh"
end
As you can see, I did not set up my shell's rc files to not update path on non-interactive invocations. In fact, the problem persists even with an empty ~/.config/fish/config.fish
.
What should I put into ~/.config/fish/config.fish
?
This will likely be the system wide rc files not the user ones. Whatever on your system is responsible for adding /usr/sbin and friends to path.
Thanks. For posterity's sake, I fixed the issue by executing the following command:
fish_add_path /usr/bin /bin /usr/sbin /sbin /usr/X11R6/bin /usr/local/bin /usr/local/sbin
It's still unclear to me who added /usr/sbin
and friends to PATH
, but everything works fine now:
$ set --show fish_user_paths
$fish_user_paths: set in universal scope, unexported, with 7 elements
$fish_user_paths[1]: |/usr/bin|
$fish_user_paths[2]: |/bin|
$fish_user_paths[3]: |/usr/sbin|
$fish_user_paths[4]: |/sbin|
$fish_user_paths[5]: |/usr/X11R6/bin|
$fish_user_paths[6]: |/usr/local/bin|
$fish_user_paths[7]: |/usr/local/sbin|
$ set --show PATH
$PATH: set in global scope, exported, a path variable with 8 elements
$PATH[1]: |/usr/bin|
$PATH[2]: |/bin|
$PATH[3]: |/usr/sbin|
$PATH[4]: |/sbin|
$PATH[5]: |/usr/X11R6/bin|
$PATH[6]: |/usr/local/bin|
$PATH[7]: |/usr/local/sbin|
$PATH[8]: |/home/qys/.local/share/kitty-ssh-kitten/kitty/bin|
$PATH: originally inherited as |/usr/local/bin:/usr/bin:/bin:/home/qys/.local/share/kitty-ssh-kitten/kitty/bin|
Describe the bug
kitten ssh
does not updatePATH
for fish shell on OpenBSD hostTo Reproduce
Screenshots
Environment details
Additional context
I'm attaching my config file below, but this bug can be reproduced by
kitty --config NONE
. I'm usingfish, version 3.7.1
on the macOS client andfish, version 3.7.0
on the OpenBSD host.