Skip to content
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

Unify FSAccessor and SourceAccessor #9269

Merged
merged 11 commits into from
Nov 2, 2023
Merged

Conversation

edolstra
Copy link
Member

@edolstra edolstra commented Nov 1, 2023

Motivation

This removes FSAccessor, moving all its functionality into SourceAccessor.

Context

Priorities

Add 👍 to pull requests you find important.

@edolstra edolstra requested a review from thufschmitt as a code owner November 1, 2023 16:12
@edolstra edolstra requested a review from Ericson2314 November 1, 2023 16:12
@github-actions github-actions bot added new-cli Relating to the "nix" command with-tests Issues related to testing. PRs with tests have some priority store Issues and pull requests concerning the Nix store fetching Networking with the outside (non-Nix) world, input locking labels Nov 1, 2023
@Ericson2314 Ericson2314 changed the title Unify FSAccessor and SourceAccessor Unify FSAccessor and SourceAccessor Nov 1, 2023
@@ -1 +1 @@
error: getting status of '/pwd/lang/fnord': No such file or directory
error: path '/pwd/lang/fnord' does not exist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't a sign we lost a potentially useful perror() via SysError is it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it's because SourceAccessor::lstat() now handles the file-not-found case. SourceAccessor::maybeLstat() returns std::nullopt if the file doesn't exist, but throws a SysError for everything else.

@Ericson2314
Copy link
Member

@infinisil might you know what is going on with this Nixpkgs test that is failing? We should probably create a new tests/functional/lang.sh test to reproduce it more minimally.

@infinisil
Copy link
Member

Looks like the error message when calling builtins.readFileType on a non-existent path changed from

error: getting status of '/build/tmp.VlCmNBe2eU/non-existent': No such file or directory

to

error: path '/build/tmp.VlCmNBe2eU/non-existent' does not exist

And that's being tested in Nixpkgs.

Doesn't seem like a serious problem, there's no requirement for Nix to stay backwards compatibly with error messages. I guess it would be best to not check Nix-specific error messages in the Nixpkgs tests.

@Ericson2314
Copy link
Member

Thanks, yeah we should update the Nixpkgs test to not over-test. (In this specific case I think we might want the SysError info back, but yeah in general the tests should pass with other stores / file accessors which may have different errors)

@infinisil
Copy link
Member

Done in NixOS/nixpkgs#264860

Copy link
Member

@Ericson2314 Ericson2314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for doing this, @edolstra. This really is a massive improvement to me, and I very much appreciate both it being done and not having to do it myself. Happy to approve it now regardless of how it might change before it's merged.

Co-authored-by: John Ericson <git@JohnEricson.me>
edolstra pushed a commit to NixOS/nixpkgs that referenced this pull request Nov 1, 2023
In NixOS/nix#9269 the error messages change
which would've broken this test.
github-actions bot pushed a commit to NixOS/nixpkgs that referenced this pull request Nov 1, 2023
In NixOS/nix#9269 the error messages change
which would've broken this test.

(cherry picked from commit add2546)
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/31ed632c692e6a36cfc18083b88ece892f863ed4' (2023-09-21)
  → 'github:NixOS/nixpkgs/9eb24edd6a0027fed010ccfe300a9734d029983c' (2023-11-01)
Co-authored-by: John Ericson <git@JohnEricson.me>
@edolstra edolstra enabled auto-merge November 2, 2023 12:41
@edolstra edolstra merged commit 5223114 into NixOS:master Nov 2, 2023
6 of 7 checks passed
@9999years
Copy link
Contributor

This broke the test suite on macOS.

@edolstra edolstra deleted the unify-accessor branch November 3, 2023 11:15
github-actions bot pushed a commit to nix-community/nixpkgs.lib that referenced this pull request Nov 5, 2023
In NixOS/nix#9269 the error messages change
which would've broken this test.
@trofi
Copy link
Contributor

trofi commented Jan 11, 2024

The change also broke user-facing API. It broke dwarffs which might need porting: edolstra/dwarffs#26

@Ericson2314
Copy link
Member

Note the C++ API was never supposed to be stable, at least between releases. But yes, dwarffs should be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fetching Networking with the outside (non-Nix) world, input locking new-cli Relating to the "nix" command store Issues and pull requests concerning the Nix store with-tests Issues related to testing. PRs with tests have some priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants