-
-
Notifications
You must be signed in to change notification settings - Fork 15.5k
fish-foreign-env: hide warnings when setting PATH #27227
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
Conversation
Are there any other conditions under which fish |
Fair point. Probably not but it could happen at some point in the future. |
If we only want to suppress a specific error message, maybe we could find a fish-y way to do something like this and grep just for the error message we don't want. We could do this in NixOS without patching fish-foreign-env. |
Patching foreign-env to only hide the path warnings looks quite ugly:
|
This goes beyond my (rather limited) understanding of shell scripting but looks like the best way. |
I figured it out, and it's easier than I thought it would be! Instead of I'll submit a NixOS PR as soon as I get a chance to test it at home (I've tested a fake version using |
I would make it simple and just redirect exporting PATH to
It seems unlikely that future versions of fish would change the semantic of this simple expression. |
@Mic92 I implemented your suggestion. |
The set of PATH entries added by the Nix packaged version is finite. So, all that needs to be done is that we need to keep track of which entries were automatically generated by Nix and filter those out. Given that the initial PR suggests that this is a tiny, tiny set a solution appears trivial. (Iterate over all entries in the PATH and only display a warning when the directory does not exist and it is in the set.) Why do you come up with a solution which destroys the warning feature completely? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See #27227 for my comment.
I also have a meta comment about this PR, which is that there is no design. There is just code. The code should be the implementation of some design. What I have written down is a high level design. In a PR where the first solution wasn't accepted, you should get the hint to level up your game. That is, I would expect my high level design to be refined to a specific implementation design (e.g. that you want to implement it using code written in Look in the mess in which you are now. You only spent time implementing a wrong solution twice during which you wasted the time of every reviewer involved as well as your own. Please close this PR, open a new one taking into account that
|
It does not appear trivial to me. I don't know how I can match against a set of strings generated by nixos (which is entirely configurable and may change from user to user) in a shell script outside nixos.
It does not. It's hiding the warning when sourcing environment with fenv. The warning it's still there when you do
wow. Don't you think you are overstating things a bit here?
Sorry, I'm not closing this PR. This is a valid solution, it's not terribly slow and it's only a minor change in behavior.
I'm not a "fish expert" myself.
Are you saying I'm terrible at writing code or that I'm just altogether evil? |
@rnhmjoj I already had expected you would trip over the word "completely". Sure, in many cases it would work, but not in all. Regarding the readability, it's not a matter of being evil, but more that you likely don't care about writing something which is good, rather than something which merely works in many cases. I can assure you that the person who opened a pull request after you already has a better one, but I also rejected that one. |
If everything we have proposed is terrible and merely works I'd like to see your proposal. |
Motivation for this change
2° proposal for #27195
Things done