#1001584 fish: login shell resets $PATH between user's conf.d/ config and user's config.fish

Package:
fish
Source:
fish
Description:
friendly interactive shell
Submitter:
Marc
Date:
2021-12-22 11:57:02 UTC
Severity:
important
#1001584#5
Date:
2021-12-12 14:43:57 UTC
From:
To:
Dear Maintainer,

It seems that something is not behaving correctly wrt login shell.
I have a very simple config:
 - ~/.config/fish/conf.d/arrakis.fish that add paths using fish_add_path
 - ~/.config/fish/config.fish that uses a command located in one of the path added before

In a login shell, the PATH is reset in between, leading to the command not being found and all children having an incorrect $PATH (in my case, sway can't find anything located in my custom paths).

Here's a comparison with upstream package using the same 3.3.1 version:

❯ fish -l
in conf.d, before PATH: /home/dkm/.fzf/bin /home/dkm/.cargo/bin /home/dkm/local/bin /usr/local/bin /usr/bin /bin /usr/local/games /usr/games
in conf.d, before fish_user_path: /home/dkm/.fzf/bin /home/dkm/.cargo/bin /home/dkm/local/bin
in conf.d, after PATH: /home/dkm/.fzf/bin /home/dkm/.cargo/bin /home/dkm/local/bin /usr/local/bin /usr/bin /bin /usr/local/games /usr/games
in conf.d, after fish_user_path: /home/dkm/.fzf/bin /home/dkm/.cargo/bin /home/dkm/local/bin
in config.fish PATH: /home/dkm/.fzf/bin /home/dkm/.cargo/bin /home/dkm/local/bin /usr/local/bin /usr/bin /bin /usr/local/games /usr/games
in config.fish fish_user_path: /home/dkm/.fzf/bin /home/dkm/.cargo/bin /home/dkm/local/bin

With current sid package:
❯ fish -l
in conf.d, before PATH: /home/dkm/.fzf/bin /home/dkm/.cargo/bin /home/dkm/local/bin /usr/local/bin /usr/bin /bin /usr/local/games /usr/games
in conf.d, before fish_user_path: /home/dkm/.fzf/bin /home/dkm/.cargo/bin /home/dkm/local/bin
in conf.d, after PATH: /home/dkm/.fzf/bin /home/dkm/.cargo/bin /home/dkm/local/bin /usr/local/bin /usr/bin /bin /usr/local/games /usr/games
in conf.d, after fish_user_path: /home/dkm/.fzf/bin /home/dkm/.cargo/bin /home/dkm/local/bin
in config.fish PATH: /usr/local/bin /usr/bin /bin /usr/local/games /usr/games
in config.fish fish_user_path: /home/dkm/.fzf/bin /home/dkm/.cargo/bin /home/dkm/local/bin
fish: Unknown command: starship

You can see that $PATH is changed after processing the file in conf.d and before processing config.fish.

Here are the 2 config file:

config.fish:
---
echo in config.fish PATH: $PATH
echo in config.fish fish_user_path: $fish_user_paths

starship init fish | source
---

arrakis.fish:
---
echo in conf.d, before PATH: $PATH
echo in conf.d, before fish_user_path: $fish_user_paths

fish_add_path $HOME/local/bin
fish_add_path $HOME/.cargo/bin
fish_add_path $HOME/.fzf/bin

echo in conf.d, after PATH: $PATH
echo in conf.d, after fish_user_path: $fish_user_paths
---

Current workaround:
 - move fish_add_path in config.fish
 - use fish_add_path -P (default is not enough and yields same result as original config)

The upstream packages fish=3.3.1-1 fish-common=3.3.1-1 work as expected with the original configuration.

Thank you,
Marc

#1001584#10
Date:
2021-12-22 11:55:47 UTC
From:
To:
Hi,

I've run into the same when creating a new window in tmux. This seems
to be caused by /usr/share/fish/vendor_conf.d/00debian-profile.fish.

Perhaps it's better to use fish_add_path (which should prevent
duplicates) instead of setting the whole PATH? Also, it might need
revisiting after https://github.com/fish-shell/fish-shell/issues/5394
is solved.

As a workaround, it's possible to touch
$HOME/.config/fish/00debian-profile.fish . This prevents  the
vendor_conf.d file from being sourced.

Best
René