You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a request from some other Fedora folks to allow fish configuration snippets (e.g. ccache configuration) in /etc/profile.d/*.fish. Would this make sense as default behavior in upstream fish (via /usr/share/fish/config.fish perhaps)?
LSB section 16.2 requires the use of /etc/profile.d/*.sh, although the behaviour is not specified for *.fish scripts. Does this directory exist on OS X at all?
There was a similar intention behind /usr/share/fish/vendor-completions.d, and I think it's better done in the /usr/share hierarchy, but profile.d might be a special case.
I would argue for something in /usr/share and /etc/profile.d/*.fish. The
former is a much better place for distro scripts, sh tradition
notwithstanding. The latter is good for admins to drop snippets.
Fish isn't sh, so I think LSB barely applies.
On Feb 23, 2015 7:26 PM, "David Adam" [email protected] wrote:
There was a similar intention behind /usr/share/fish/vendor-completions.d,
and I think it's better done in the /usr/share hierarchy, but profile.d
might be a special case.
—
Reply to this email directly or view it on GitHub #1956 (comment)
.
Thinking about it, completions are a bit different to configuration snippets that are run for all users, and I think /etc/profile.d/*.fish would be a reasonable compromise as they may need to be overridden and thus treated as conffiles.
Local administrators should drop snippets in /etc/fish/config.fish.
Additionally - should profile.d/*.fish only be evaluated for interactive login shells, in line with the standard /etc/profile conventions? Or should all snippets call if status --is-login?
I am the reporter of the original downstream (Fedora) bug.
From the LSB specification linked above:
The sh utility shall read and execute commands in its current execution environment from all the shell scripts in this directory that have the suffix .sh when invoked as an interactive login shell, or if the -l (the letter ell) is specified (see Shell Invocation).
So the answer is "yes" to "interactive login shell" only.
I'm still not convinced about using profile.d. Could it mislead people into thinking fish reads /etc/profile or any of the other Bourne initialisation files? Do we want to go down the road of having some files that get read sometimes and not others? I found that enormously confusing when starting out with bash and zsh:
Commands are then read from $ZDOTDIR/.zshenv. If the shell is a login shell, commands are read from /etc/zsh/zprofile and then $ZDOTDIR/.zprofile. Then, if the shell is interactive, commands are read from /etc/zsh/zshrc and then $ZDOTDIR/.zshrc. Finally, if the shell is a login shell, /etc/zsh/zlogin and $ZDOTDIR/.zlogin are read.
Before the advent of autoloading, fish used /etc/fish.d for this sort of thing - see the discussion from 2006. In keeping with the current pattern, that would now probably become $__fish_sysconfdir/config.d/ or something similar.
I would appreciate perspectives from other packagers - @tianon@mithrandi ?
I'd like to step back from "profile.d" a bit here.
As far as I can see, there are three groups of people we should satisfy with our configuration options:
In particular, admins might wish to override upstream, and users might wish to override both admins and upstream. The admin should not need to touch the upstream directory because package managers (and the user should not have to touch the admin directory because... well, UNIX, privilege separation and all that). Every one of these groups should have their own directory.
Apart from the three groups of people, we have three types of code they might want to add:
Functions
Completions
Event handlers and other code that can't be autoloaded (this is unless we can come up with a better solution to the autoloading problem - calling it "config" as a catch-all for configuration that doesn't fit into the other two is also possible)
We already have the first two for users and fish itself, and I have proposed the third somewhere else already, but I can't come up with a good name for it.
I don't consider /etc/profile.d a good solution because of the undefined behavior - we should not break other shells.
So, now, with all that in mind, I propose the following solution:
Users get ~/.config/fish (replace with appropriate variable)
Every one of those gets subdirectories "completions", "functions" and "event" (final name TBD) (i.e. vendors/upstream get "/usr/share/fish/vendor_functions.d" and such)
The preference is User > Admin > Upstream > fish (not too sure about the latter two)
Completions and functions are autoloaded and named after the program they complete or function they provide, respectively, plus a ".fish" extension
"Event" files are all sourced at startup in lexical order (unless we find a different solution - naming after the event plus a suffix is also possible to allow for multiple upstreams hooking into the same event)
I like this. I think that, if this happens, that fish should follow the
sysctl / systemd model in which a file in ~/.config/fish/* that has the
same name as a file in /usr/share/fish/* overrides it and that a symlink
from ~/.config/fish/* to /dev/null suppresses a similarly named file in
/usr/share/fish/*, etc.
On Mon, Sep 14, 2015 at 1:01 PM, Fabian Homborg [email protected]
wrote:
My 2 cents:
I'd like to step back from "profile.d" a bit here.
As far as I can see, there are three groups of people we should satisfy
with our configuration options:
Upstream software developers or distributions wishing to hook into
fish (like the pantheon people, see #1382 #1382)
Admins wishing to add configuration for all users
Users wishing to add configuration
In particular, admins might wish to override upstream, and users might
wish to override both admins and upstream. The admin should not need to
touch the upstream directory because package managers (and the user should
not have to touch the admin directory because... well, UNIX, privilege
separation and all that). Every one of these groups should have their own
directory.
Apart from the three groups of people, we have three types of code they
might want to add:
Functions
Completions
Event handlers and other code that can't be autoloaded (this is unless
we can come up with a better solution to the autoloading problem - calling
it "config" as a catch-all for configuration that doesn't fit into the
other two is also possible)
We already have the first two for users and fish itself, and I have
proposed the third somewhere else already, but I can't come up with a good
name for it.
I don't consider /etc/profile.d a good solution because of the undefined
behavior - we should not break other shells.
So, now, with all that in mind, I propose the following solution:
Users get ~/.config/fish (replace with appropriate variable)
Every one of those gets subdirectories "completions", "functions" and
"event" (final name TBD) (i.e. vendors/upstream get
"/usr/share/fish/vendor_functions.d" and such)
The preference is User > Admin > Upstream > fish (not too sure about
the latter two)
Completions and functions are autoloaded and named after the program
they complete or function they provide, respectively, plus a ".fish"
extension
"Event" files are all sourced at startup in lexical order (unless we
find a different solution - naming after the event plus a suffix is also
possible to allow for multiple upstreams hooking into the same event)
What does everyone think of this idea?
—
Reply to this email directly or view it on GitHub #1956 (comment)
.
I like the suggestion by @faho, but there is one thing I think might be missing:
You mentioned the subdirectories "completions", "functions" and "event". One thing /etc/profile.d is used for on Arch Linux (at least for the perl package) is adding directories to $PATH, and I don't see a subdirectory that this kind of behavior would fit into.
Activity
zanchey commentedon Feb 24, 2015
LSB section 16.2 requires the use of
/etc/profile.d/*.sh, although the behaviour is not specified for*.fishscripts. Does this directory exist on OS X at all?There was a similar intention behind
/usr/share/fish/vendor-completions.d, and I think it's better done in the/usr/sharehierarchy, butprofile.dmight be a special case.amluto commentedon Feb 24, 2015
I would argue for something in /usr/share and /etc/profile.d/*.fish. The
former is a much better place for distro scripts, sh tradition
notwithstanding. The latter is good for admins to drop snippets.
Fish isn't sh, so I think LSB barely applies.
On Feb 23, 2015 7:26 PM, "David Adam" [email protected] wrote:
zanchey commentedon Feb 24, 2015
Thinking about it, completions are a bit different to configuration snippets that are run for all users, and I think
/etc/profile.d/*.fishwould be a reasonable compromise as they may need to be overridden and thus treated as conffiles.Local administrators should drop snippets in
/etc/fish/config.fish.rapgro commentedon Feb 24, 2015
👍
ridiculousfish commentedon Mar 24, 2015
Simple. Tested with Ubuntu Precise.
ridiculousfish commentedon Mar 24, 2015
Thanks for reporting this.
zanchey commentedon Mar 25, 2015
Probably should use
__fish_sysconfdir?zanchey commentedon Mar 25, 2015
Actually, possibly not.
Additionally - should
profile.d/*.fishonly be evaluated for interactive login shells, in line with the standard/etc/profileconventions? Or should all snippets callif status --is-login?ridiculousfish commentedon Mar 25, 2015
Good question - what do you think @amluto regarding zanchey's question about whether these should be run in non-interactive shells?
rapgro commentedon Mar 25, 2015
I am the reporter of the original downstream (Fedora) bug.
From the LSB specification linked above:
The sh utility shall read and execute commands in its current execution environment from all the shell scripts in this directory that have the suffix .sh when invoked as an interactive login shell, or if the -l (the letter ell) is specified (see Shell Invocation).
So the answer is "yes" to "interactive login shell" only.
zanchey commentedon Mar 26, 2015
The downstream bug for those playing at home
I'm still not convinced about using
profile.d. Could it mislead people into thinking fish reads/etc/profileor any of the other Bourne initialisation files? Do we want to go down the road of having some files that get read sometimes and not others? I found that enormously confusing when starting out with bash and zsh:Before the advent of autoloading, fish used
/etc/fish.dfor this sort of thing - see the discussion from 2006. In keeping with the current pattern, that would now probably become$__fish_sysconfdir/config.d/or something similar.I would appreciate perspectives from other packagers - @tianon @mithrandi ?
10 remaining items
Darkshadow2 commentedon Apr 14, 2015
How about a directory in $__fish_sysconfdir that would work like profiles.d?
zanchey commentedon Sep 4, 2015
/etc/environmentis another potential target.despairblue commentedon Sep 13, 2015
What about vendor functions? Where would those go? Arch's autojump (this file) package puts it into
/etc/profile.d/, which, of course, does not work.faho commentedon Sep 14, 2015
My 2 cents:
I'd like to step back from "profile.d" a bit here.
As far as I can see, there are three groups of people we should satisfy with our configuration options:
In particular, admins might wish to override upstream, and users might wish to override both admins and upstream. The admin should not need to touch the upstream directory because package managers (and the user should not have to touch the admin directory because... well, UNIX, privilege separation and all that). Every one of these groups should have their own directory.
Apart from the three groups of people, we have three types of code they might want to add:
We already have the first two for users and fish itself, and I have proposed the third somewhere else already, but I can't come up with a good name for it.
I don't consider /etc/profile.d a good solution because of the undefined behavior - we should not break other shells.
So, now, with all that in mind, I propose the following solution:
What does everyone think of this idea?
pickfire commentedon Sep 15, 2015
Good idea, I didn't even thought about that.
Profpatsch commentedon Sep 15, 2015
For NixOS I thought about sourcing everything in a environment variable on startup.
Stumbled over #2391 though.
amluto commentedon Sep 15, 2015
I like this. I think that, if this happens, that fish should follow the
sysctl / systemd model in which a file in ~/.config/fish/* that has the
same name as a file in /usr/share/fish/* overrides it and that a symlink
from ~/.config/fish/* to /dev/null suppresses a similarly named file in
/usr/share/fish/*, etc.
On Mon, Sep 14, 2015 at 1:01 PM, Fabian Homborg [email protected]
wrote:
faho commentedon Sep 16, 2015
@amluto:
That's basically what happens for autoloaded files already (probably not 100% the same, but close enough).
For the eager-loading stuff this should be implemented as well, I agree.
Add functions and "snippets" hierarchy
ahti commentedon Jan 11, 2016
I like the suggestion by @faho, but there is one thing I think might be missing:
You mentioned the subdirectories "completions", "functions" and "event". One thing
/etc/profile.dis used for on Arch Linux (at least for the perl package) is adding directories to$PATH, and I don't see a subdirectory that this kind of behavior would fit into.faho commentedon Jan 11, 2016
@ahti: Check #2498 - after my proposal, I noticed that the "event" directory can be used much more generally, so it's now called "conf.d".
In essence that proposal includes three kinds of directories:
extending $PATH would fall under the third category.
ahti commentedon Jan 11, 2016
👍