__fish_sysconf_dir points to /usr/etc/fish
fish, version 3.7.0 Fedora Silverblue 40.20240926.0
When installed by RPM on Fedora Silverblue, __fish_sysconf_dir points to /usr/etc/fish and not to /etc/fish.
Fedora Silverblue is an atomic distro where /usr/etc and /etc exists. /usr/etc contains the original files from the installed packages and is read-only, /etc contains the writeabe package config files.
When i install fish in a normal (non-atomic) Fedora container I get:
config: exec_path: '/usr/bin/fish', argv[0]: 'fish'
config: Using compiled in paths:
config: determine_config_directory_paths() results:
paths.data: /usr/share/fish
paths.sysconf: /etc/fish
paths.doc: /usr/share/doc/fish
paths.bin: /usr/bin
On Fedora Silverblue i get:
config: exec_path: '/usr/bin/fish', argv[0]: 'fish'
config: determine_config_directory_paths() results:
paths.data: /usr/share/fish
paths.sysconf: /usr/etc/fish
paths.doc: /usr/share/doc/fish
paths.bin: /usr/bin
I suspect this is wrong: https://github.com/fish-shell/fish-shell/blob/48a65506883a76aeea9f8268d039fb630ba82d8d/src/bin/fish.rs#L178
The parent of the parent of /usr/bin/fish is /usr and thus the sysconf path becomes /usr/etc/fish. On normal Fedora it is overwritten by the compiled-in path, because /usr/etc/fish does not exist, but on Fedora Silverblue /usr/etc/fish actually exists (because of the OS) so it is not overwritten.
I have to confess I have never needed the relocatable stuff, and I'm not sure if it is used in practice.
I believe @ridiculousfish put in a bunch of work there, maybe he can explain.
Otherwise my preference would be to remove it, because I don't see how else this would work.
This could be a quick fix: https://github.com/fish-shell/fish-shell/commit/9900d11b81fe08290ba7119d767644ec98de0673
With this it should derive the right sysconf_dir also when running from /usr/bin/ and then it also shouldn't have to fallback to compiled-in paths.
Alternatively, instead of specifically coding for yet more specific paths:
Is relocatable /etc a thing? We usually interpet /etc as "the administrator's config place", so I would just set the sysconfdir to the compiled-in path always. Just like we don't e.g. set ~/.config/fish differently when you move fish elsewhere.
Alternatively, instead of specifically coding for yet more specific paths:
Is relocatable /etc a thing? We usually interpet /etc as "the administrator's config place", so I would just set the sysconfdir to the compiled-in path always. Just like we don't e.g. set ~/.config/fish differently when you move fish elsewhere.
Not sure what you mean by relocatable /etc but on immutable distros it is definitely common to put config under /usr/etc (like rpm-ostree does), /usr/share/foobar or /usr/lib/foobar. Programs in general should then merge these configuration files with those under /etc. This makes it possible to have / be a tmpfs and only have /usr populated (and readonly). Other advantages are that it encourages people to create drop-in files under directories (conf.d/) instead of editing the main config (config.fish) which makes updates difficult
I got this issue too on fedora coreos 42 and i cannot find a workarround maybe its on the way to next fish version ?