-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Fix #8838, pathExists: isDir when ends with /
#8869
Fix #8838, pathExists: isDir when ends with /
#8869
Conversation
This seems very hacky since it only works for strings. My preference would be to not "fix" this unless it causes a lot of issues in real code, since this is really something that only happened to work by accident (i.e. because we didn't canonicalize paths early enough). IMHO path values should be canonical, and Alternatively, path values could carry an extra bit to store that they have a trailing slash. |
Just UNIX heritage in my view.
I like the simple and to the point data model of path values. By adding the extra bit, this form of needless entropy will propagate through our expressions; an extra thing we have to keep in mind when reading code. Either suggestion would be a breaking change to the language, so I propose to just fix the regression and move on to something more useful. |
@edolstra It's an accidental regression, so it should be fixed, it's as simple as that. If Nix starts randomly changing behaviour any time it seems convenient then we cannot trust it's purity anymore. If the test suite was better this should've never happened in the first place. |
Hitting this on master when I try to use nixpkgs (because my overlays.nix is a symlink)
|
A problem with this fix is that it's kind of ad hoc in that it changes the behaviour of paths for |
I agree the first order of business is fixing unintentional regressions. We may also decide we want to change the semantics, but then there should be a graceful deprecation, like #8738 proposes (for something else). Bugs shouldn't allow us to fast-track deprecations. |
That's a good point. We may have more regressions, although the change in
We don't know the scope of the effect of the regression, and I don't like the suggestion that Nix exists for the purpose of Nixpkgs. Nixpkgs is important, but Nix should be a reliable tool on its own. |
Absolutely, but with enough users, there will always be somebody depending on buggy or undocumented behaviour. (Obligatory xkcd.) 100% backwards compatibility is not a realistic goal. So the main consideration is how many people are affected by a change in behaviour. |
Successfully created backport PR for |
Successfully created backport PR for |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-09-01-nix-team-meeting-minutes-84/32466/1 |
Despite discussion above about making this change to unbreak Nixpkgs overlays, they are still broken after this PR because of this line: https://github.com/NixOS/nixpkgs/blob/9ace7896297b51fee5ad34c1977bec1e6541c089/pkgs/top-level/impure.nix#L40 Note that it uses At this point it's probably better to focus on NixOS/nixpkgs#249165, but I thought it worth commenting here because Nix is the cause of the regression, not Nixpkgs. |
Motivation
Fix a regression.
Context
SourcePath
from the lazy-trees branch #8172builtins.pathExists
#8838Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.sh
src/*/tests
tests/nixos/*
Priorities
Add 👍 to pull requests you find important.