Skip to content

fetchurl: mitigate the change of pname/version special value#458150

Open
ShamrockLee wants to merge 1 commit intoNixOS:masterfrom
ShamrockLee:fetchurl-pname-version-mitigation
Open

fetchurl: mitigate the change of pname/version special value#458150
ShamrockLee wants to merge 1 commit intoNixOS:masterfrom
ShamrockLee:fetchurl-pname-version-mitigation

Conversation

@ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented Nov 3, 2025

Mitigate the out-of-tree breakage caused by backward incompatible commit 1ec0227 ("fetchurl: don't treat empty-string name special") from PR #455994 by nullifying empty pname and version for Nixpkgs 25.11.

This PR depends on:

Things done

  • Built on platform:
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • Tested, as applicable:
  • Ran nixpkgs-review on this PR. See nixpkgs-review usage.
  • Tested basic functionality of all binary files, usually in ./result/bin/.
  • Nixpkgs Release Notes
    • Package update: when the change is major or breaking.
  • NixOS Release Notes
    • Module addition: when adding a new NixOS module.
    • Module update: when the change is significant.
  • Fits CONTRIBUTING.md, pkgs/README.md, maintainers/README.md and other READMEs.

Add a 👍 reaction to pull requests you find important.

@ShamrockLee ShamrockLee force-pushed the fetchurl-pname-version-mitigation branch from c584dd7 to 6af7fd5 Compare November 3, 2025 17:31
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. 6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) labels Nov 3, 2025
@ShamrockLee ShamrockLee force-pushed the fetchurl-pname-version-mitigation branch from 6af7fd5 to bcb9403 Compare November 3, 2025 18:58
@nixpkgs-ci nixpkgs-ci bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. and removed 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-darwin: 501-1000 This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels Nov 3, 2025
Mitigate the out-of-tree breakage caused by backward incompatible commit
1ec0227 ("fetchurl: don't treat empty-string name special")
with a compatibility layer that nullify empty pname or version
for Nixpkgs 25.11.
@ShamrockLee ShamrockLee force-pushed the fetchurl-pname-version-mitigation branch from bcb9403 to 29153c2 Compare November 5, 2025 17:01
@ShamrockLee ShamrockLee marked this pull request as ready for review November 5, 2025 17:34
@nix-owners nix-owners bot requested a review from philiptaron November 5, 2025 17:35
@ShamrockLee
Copy link
Contributor Author

nixpkgs-review result

Generated using nixpkgs-review.

Command: nixpkgs-review pr 458150
Commit: 29153c27e4726166ef6a6ef6e2fd5a2147b2f32a

@philiptaron
Copy link
Contributor

Can you cite an out-of-tree user that was broken?

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Nov 5, 2025

Can you cite an out-of-tree user that was broken?

Issue oxalica/rust-overlay#239 reports the breakage, and PR oxalica/rust-overlay#241 fixes/works around it.

Comment on lines +241 to +244
// lib.optionalAttrs (!(lib.oldestSupportedReleaseIsAtLeast 2511)) (
lib.optionalAttrs (pname == "") { pname = null; }
// lib.optionalAttrs (version == "") { version = null; }
)
Copy link
Contributor

Choose a reason for hiding this comment

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

What this is saying is that:

  • if lib.trivial.release is 25.05 or older, then add no attrs
  • if lib.trivial.release is 25.11 or newer, then:
    • if pname is the empty string, set pname to null
    • if version is the empty string, set version to null

As I read it, this becomes a permanent addition, rather than something that disappears once we're past 2505.

Copy link
Contributor Author

@ShamrockLee ShamrockLee Nov 5, 2025

Choose a reason for hiding this comment

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

Isn't !(lib.oldestSupportedReleaseIsAtLeast 2511) false on 26.05 and true on 25.11 and 25.05?

Copy link
Contributor

Choose a reason for hiding this comment

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

nix-repl> lib = import ./lib

nix-repl> lib2511 = lib.extend (self: super: { trivial = super.trivial // { oldestSupportedRelease = 2511; }; })

nix-repl> lib2605 = lib.extend (self: super: { trivial = super.trivial // { oldestSupportedRelease = 2605; }; })

nix-repl> !(lib.oldestSupportedReleaseIsAtLeast 2511)
true

nix-repl> !(lib2511.oldestSupportedReleaseIsAtLeast 2511)
false

nix-repl> !(lib2605.oldestSupportedReleaseIsAtLeast 2511)
false

Copy link
Contributor Author

Choose a reason for hiding this comment

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

IIUC, the current lib will go to the release-25.11 release branch, lib2511 will be what is on release-26.05, and lib2605 on release-26.11. Is that right?

Copy link
Contributor

Choose a reason for hiding this comment

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

My understanding:

  • lib will be in master until ~Jan 2026, and will be in release-25.11 for its lifetime
  • lib2511 is what will be on master starting ~Jan 2026 through til ~July 2026, and will be in release-26.05 for its lifetime.
  • lib2605 is what will be on master starting ~Jul 2026, and will be in release-26.11 for its lifetime.

So yes, but also consider the master branch as well.

@ShamrockLee
Copy link
Contributor Author

Can you cite an out-of-tree user that was broken?

Issue oxalica/rust-overlay#239 reports the breakage, and PR oxalica/rust-overlay#241 fixes/works around it.

In this case, an if-else or lib.optionalAttrs would be enough or even more elegant. Still, if the condition is from finalAttrs, dynamically decide whether to pass name would result in infinite recursion, and it would be important to know the default value.

Oh wait, fetchurl didn't support finalAttrs before #455994, so every such cases should be able to work around with conditional pass of name-related attributes if we don't backport commit 1ec0227 in PR #455994. On the other hand, having this compatibility layer will allow us to backport finalAttrs support with at least one consistent default name (null).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: fetch Fetchers (e.g. fetchgit, fetchsvn, ...) 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants