-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Treat empty $PATH component as equivalent to "." #3914
Comments
FWIW, I think fish should treat empty path components as equivalent to |
One benefit is that empty components make it harder to iterate over these lists. E.g. for command in $PATH/*
test -x $command -a ! -d $command; and echo $command
end would list all executable commands iff there was no empty $PATH component that is treated specially. And if we allow those, it's hard to miss. (This was obviously found in #3912 - see how I complicated the implementation for empty $PATH components) Now, the problem is that we pretty much can't get by just ignoring empty $PATH components because we can inherit them from the outside. It might be possible to convert them (to ".") when importing instead. However, whatever we do, it should be consistent between $PATH, $CDPATH (which currently allows empty components) and $MANPATH. |
My vote is to magically munge all three vars when set/imported to translate empty elements to |
I feel compelled to expand on my earlier I would love to eliminate the empty path element is equivalent to |
There are at least three env vars describing a sequence of paths to be searched where an empty path element is implicitly equivalent to ".". This change converts the implicit "." to explicit whenever the variable is imported or set. This makes the variable much easier to use in fish scripts. Fixes fish-shell#3914
As recently discovered in #3912:
As far as I can see, fish just effectively ignores the empty component. The compatible behavior is to treat it like it was ".", i.e. the current directory. This is important because fish inherits these variables from the outside and exports them, so interoperability with POSIX is useful here.
This possibly also applies to $MANPATH, and was recently fixed for $CDPATH (#3901, #2106).
The text was updated successfully, but these errors were encountered: