-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 NAR tests on Linux+ZFS+normalize #11609
Conversation
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.
works on my machine with normalization set to formD
lgtm
There's a bit of an issue with this actually; UTF-8 normalisation means that nix builds done on this system may inherently end up with a different NAR hash than those done on a system without normalisation. This may also present as nar files from |
Is that an issue with this test? or with NAR deserialization? |
The thing is, the test as it was originally added (before this PR) precludes the installation and usage of Nix on a Linux system with ZFS+normalize (excluding work-arounds like disabling checks). This didn't use to be the case. What is the consequence the NAR hashes mismatch? Unless the answer is that the mismatch can lead to correctness issues and is severe enough to imply that Nix shouldn't be used on such a configuration, at first sight this is a separate issue from this PR that just tries to restore a previously working combination. Out of curiosity, why isn't this a problem for Darwin? I suppose because all Darwin have the same behavior with respect to unicode normalization while Linux can have both? |
Search for the |
To summarize the underlying issue:
For now, let's make the tests pass. We could gather related ideas in |
tests/functional/nars.sh
Outdated
# `utf8only` enabled and `normalization` set to anything else than `none`). | ||
# The deserialization should succeed on most Linux. | ||
# | ||
# We test that it either succeeds or fails with "already exists" error. |
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.
Could we determine the properties of the $TEST_ROOT
's file system by creating these semi-duplicate files using other means? That way can at least still test that the Nix behavior matches another program's behavior, and for example catch a bad change that causes Nix to normalize on its own accord on a file system where it shouldn't.
Something like
touch $TEST_ROOT/poll-unicode-â
touch $TEST_ROOT/poll-unicode-â
n=$(wc -l $(ls $TEST_ROOT | grep poll-unicode-))
normalizing=$((n == 1))
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.
I imagine the second touch
would error out, in the same way as nix-store --restore
. But we can still test that touch
and nix-store --restore
have the same result, at least 👍
10c8ea8
to
43bafd9
Compare
A test added recently checks that when trying to deserialize a NAR with two files that Unicode-normalize to the same result either succeeds on Linux, or fails with an "already exists" error on Darwin. However, failing with an "already exists" error can in fact also happen on Linux, when using ZFS with the proper utf8 and Unicode normalization options set. This commit fixes the issue by not assuming the behavior from the current system, but just by blindly checking that either one of the two aforementioned possibilities happen, whether on Darwin or on Linux. Additionally, we check that the Unicode normalization behaviour of nix-store is the same as the host file system.
43bafd9
to
f8268cb
Compare
I implemented @roberth 's suggestion in the latest force push, tested again on a Linux+ZFS+utf8 normalization runner. I also changed the tests of the return code in the |
Dear maintainers, is there anything else to be done here? It's probably not a very important change but I fear that if it doesn't move forward it's going to be forgotten for ever 😅 pinging @roberth once again (sorry if inappropriate) |
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.
Works on my system with formD
Co-authored-by: Jörg Thalheim <Mic92@users.noreply.github.com>
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.
I might have written the conditional on touchFilesCount
instead, but it'd be equivalent. 👍
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-10-07-nix-team-meeting-minutes-184/54046/1 |
Closes #11595.
Motivation & context
A test added recently checks that when trying to deserialize a NAR with two files that Unicode-normalize to the same result either succeeds on Linux, or fails with an "already exists" error on Darwin. However, failing with an "already exists" error can in fact also happen on Linux, when using ZFS with the proper utf8 and Unicode normalization options set.
This commit fixes the issue by not assuming the behavior from the current system, but just by blindly checking that either one of the two aforementioned possibilities happen, whether on Darwin or on Linux.
This has been tested on a Linux+ZFS+normalize runner here: https://github.com/tweag/nickel/actions/runs/11073351502/job/30769680803?pr=2037
Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.