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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

downloadFile(): Remove the "locked" (aka "immutable") flag #10414

Merged
merged 1 commit into from
Apr 12, 2024

Conversation

edolstra
Copy link
Member

@edolstra edolstra commented Apr 5, 2024

Motivation

This was used in only one place anymore, namely builtins.fetchurl with an expected hash. Since this can cause similar issues as described in #9814 and #9905 with the "locked" flag for fetchTarball and fetchTree, let's just remove it.

Note that if an expected hash is given and the hash algorithm is SHA-256, then we will never do a download anyway if the resulting store path already exists. So removing the "locked" flag will only cause potentially unnecessary HTTP requests (subject to the tarball TTL) for non-SHA-256 hashes.

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.

@github-actions github-actions bot added the fetching Networking with the outside (non-Nix) world label Apr 5, 2024
@edolstra edolstra force-pushed the remove-downloadFile-locked branch 3 times, most recently from 2bb6a2d to 59185a6 Compare April 5, 2024 15:03
This was used in only one place, namely builtins.fetchurl with an
expected hash. Since this can cause similar issues as described
in NixOS#9814 and NixOS#9905 with the "locked" flag for fetchTarball and fetchTree,
let's just remove it.

Note that if an expected hash is given and the hash algorithm is
SHA-256, then we will never do a download anyway if the resulting
store path already exists. So removing the "locked" flag will only
cause potentially unnecessary HTTP requests (subject to the tarball
TTL) for non-SHA-256 hashes.
@Ericson2314
Copy link
Member

CC @yshui you might have an opinion on this?

@@ -101,7 +100,7 @@ DownloadFileResult downloadFile(
inAttrs,
infoAttrs,
*storePath,
locked);
false);
Copy link
Member

Choose a reason for hiding this comment

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

Could we also just remove this? Or does something else call it with true?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's still used by the Mercurial fetcher, but it's removed in this followup PR: https://github.com/NixOS/nix/pull/10465/files

@Ericson2314
Copy link
Member

We need tests for this, but I am OK until waiting for the follow-up PR that continues overhauling things to get into that.

@Ericson2314 Ericson2314 merged commit aa438b8 into NixOS:master Apr 12, 2024
9 checks passed
@edolstra edolstra deleted the remove-downloadFile-locked branch April 15, 2024 10:40
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
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants