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

src/nix/prefetch: fix prefetch containing current directory instead o… #11051

Merged
merged 2 commits into from
Jul 5, 2024

Conversation

Mic92
Copy link
Member

@Mic92 Mic92 commented Jul 5, 2024

…f tarball

When --unpack was used the nix would add the current directory to the nix store instead of the content of unpacked.
The reason for this is that std::distance already consumes the iterator. To fix this we re-instantiate the directory iterator in case the directory only contains a single entry.

Motivation

Context

Priorities and Process

Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@Mic92 Mic92 requested a review from edolstra as a code owner July 5, 2024 16:46
@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 labels Jul 5, 2024
tests/functional/tarball.sh Outdated Show resolved Hide resolved
@Mic92 Mic92 force-pushed the fix-prefetch branch 2 times, most recently from f901fe5 to b52e752 Compare July 5, 2024 17:10
@Mic92
Copy link
Member Author

Mic92 commented Jul 5, 2024

I think, this bug is serious enough that it should be part of a patch release. Please backport to 2.23.

…f tarball

When --unpack was used the nix would add the current directory to the
nix store instead of the content of unpacked.
The reason for this is that std::distance already consumes the iterator.
To fix this we re-instantiate the directory iterator in case the
directory only contains a single entry.
@roberth roberth added the backport 2.23-maintenance Automatically creates a PR against the branch label Jul 5, 2024
src/nix/prefetch.cc Outdated Show resolved Hide resolved
Co-authored-by: Eelco Dolstra <edolstra@gmail.com>
@edolstra edolstra enabled auto-merge July 5, 2024 17:46
@edolstra edolstra merged commit d5461b9 into NixOS:master Jul 5, 2024
11 checks passed
Copy link

github-actions bot commented Jul 5, 2024

@Ericson2314
Copy link
Member

@Mic92 Thank you for fixing it, and especially thank you for adding a test as you did so.

@Mic92 Mic92 deleted the fix-prefetch branch July 6, 2024 04:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport 2.23-maintenance Automatically creates a PR against the branch new-cli Relating to the "nix" command 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.

4 participants