-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
set PATH arg:with:colons
prints superfluous error
#8095
Comments
It does this with |
Interesting quirk: If I run the following: set PATH /usr/local/bin /usr/bin:/bin I get the warning
But it also sets the path variable correctly!
I think it's doing incorrect validation of That said, in Fish 3.2.2 I can't get it to show this warning at all. So perhaps the validation was broken before, and fixed in 3.3.0, without realizing that it broke the ability to actually write |
set PATH arg
no longer splits arg
on colonsset PATH arg:with:colons
errors instead of splitting on colons
Well, I say "fixed", but the validation looks like it's only detecting entries that "refer to invalid directories that contain a colon". Which means it's not actually detecting invalid directories in general, just when a colon is involved. Which also means it's completely ignoring the fact that the values will subsequently be split on colons once it gets to the env layer and therefore saying "the directory 'foo:bar' doesn't exist" is pointless as the variable will never actually contain the entry Which is to say, the following runs without error:
Note how the resulting PATH does not in fact include I'm guessing this validation is the vestigial leftovers of the old validation that warned if you added any entry to Also interesting is how |
set PATH arg:with:colons
errors instead of splitting on colonsset PATH arg:with:colons
prints superfluous error
Yeah, the validation is borken and should probably just be removed entirely. We used to print an error for invalid paths, this seems to be a remnant of that. Feel free to commit a fix, you still have the bit. |
I think I do, but personal circumstances mean I can’t contribute code at the moment. |
In Fish 3.2 and earlier, the following works just fine:
set PATH /usr/local/bin:/usr/bin
This splits the input on colons and sets
$PATH
to the result.In Fish 3.3.0, this is broken. The above code will result in a warning and not actually change the value of
$PATH
at all:The colon-splitting behavior still works just fine with other path variables (such as
$MANPATH
or variables defined usingset --path
), but it simply won't work withPATH
even if I pass the--path
flag.This is especially problematic for code that sets variables without knowing what they are. For example, this triggers on code of mine that looks like
The text was updated successfully, but these errors were encountered: