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

rust: Write config.toml not config #321095

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

mmlb
Copy link
Contributor

@mmlb mmlb commented Jun 19, 2024

Description of changes

Changes the rust infra to write cargo config to .cargo/config.toml insted of .cargo/config since the latter is deprecated (since 1.38?) and is now warning on stderr.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.11 Release Notes (or backporting 23.11 and 24.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

Seeing the following new warnings pop up on stderr when cargo was bumped
to 1.78:

```
warning: `/build/.cargo/config` is deprecated in favor of `config.toml`
note: if you need to support cargo 1.38 or earlier, you can symlink `config` to `config.toml`
```

which happens to break commitmsgfmt builds in nix (NixOS#320294).

closes NixOS#320294
@mmlb
Copy link
Contributor Author

mmlb commented Jun 19, 2024

Tried running nixpkgs-review but that failed with merge conflicts :/

Copy link
Contributor

@drupol drupol left a comment

Choose a reason for hiding this comment

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

LGTM at first sight.

@drupol drupol merged commit a2b5266 into NixOS:staging Jun 21, 2024
25 checks passed
@mweinelt
Copy link
Member

It feels like this change caused cargoDeps hashes to be invalidated. Why was this merged without a review from a codeowner?

@drupol
Copy link
Contributor

drupol commented Jun 23, 2024

My bad, should I provide a revert ?

@mweinelt
Copy link
Member

For codeowners to decide.

@winterqt
Copy link
Member

Yes, this was irresponsible to merge in its current state, and I'm sorry I didn't see it in my inbox.

For now, let's just revert the whole thing to avoid any breakages making it to master.

@drupol
Copy link
Contributor

drupol commented Jun 23, 2024

My apologies for the extra work.

@winterqt
Copy link
Member

We should be able to pick all the changes except the one to fetchCargoTarball.

@mweinelt
Copy link
Member

mweinelt commented Jun 23, 2024

We can provide a jobset on hydra.nixos.org for the fetchCargoTarball change, if breaking changes to it are okay, given potential out of tree usage. But that also means, someone who have to carry that change further and update all hashes treewide.

@chuangzhu
Copy link
Contributor

Maybe moving it (config -> config.toml) in cargo-setup-hook.sh, so we don't need to change the hashes

@winterqt
Copy link
Member

Any change to the output of the FODs will require hash changes, which is why I said we should first just change everything but the FODs.

@@ -22,17 +22,17 @@ cargoSetupPostUnpackHook() {
mkdir .cargo
fi

config="$cargoDepsCopy/.cargo/config";
config="$cargoDepsCopy/.cargo/config.toml";
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
config="$cargoDepsCopy/.cargo/config.toml";
mv "$cargoDepsCopy/.cargo/config" "$cargoDepsCopy/.cargo/config.toml"
config="$cargoDepsCopy/.cargo/config.toml";

I actually mean something like this, i.e. not moving it in the FOD output, but moving it after the FOD is unpacked and copied and made writable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll give this a try.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually this wasn't the problem, the patch that caused FOD changes was the fetch-cargo-tarball one!

@mmlb
Copy link
Contributor Author

mmlb commented Jun 23, 2024

Bummer, I would have expected ofborg or something to catch this. I would actually prefer dealing with the hash change instead of layering fixes/hacks. Especially if upstream rust is doing this then it would be easier to avoid papering over things like this.

@alyssais
Copy link
Member

Nix FODs aren't really designed for hashes to ever change — even if we fix all the hashes in Nixpkgs, we silently break all out of tree FODs, which means most out of tree Cargo hashes. Justifying a FOD hash change is an extremely high bar — there's a reason we have fetchpatch2. (Generally introducing a new API with new hashes like that has fewer negative consequences.)

@mmlb
Copy link
Contributor Author

mmlb commented Jun 23, 2024

Hmm I'm confused about the revert though, I didn't have any need to update the cargo hash in commitmsgmft and had successfull build/test there.

@winterqt
Copy link
Member

Did you try busting the hash with lib.fakeHash to ensure the hashes were the same before and after?

@alyssais
Copy link
Member

Hmm I'm confused about the revert though, I didn't have any need to update the cargo hash in commitmsgmft and had successfull build/test there.

This is exactly why FOD hash changes are so problematic — Nix won't ever rebuild a FOD it's built before, so you don't get to find out your FODs are broken for other people unless they tell you.

@mmlb
Copy link
Contributor Author

mmlb commented Jun 23, 2024

Did you try busting the hash with lib.fakeHash to ensure the hashes were the same before and after?

Ah nope.

Hmm I'm confused about the revert though, I didn't have any need to update the cargo hash in commitmsgmft and had successfull build/test there.

This is exactly why FOD hash changes are so problematic — Nix won't ever rebuild a FOD it's built before, so you don't get to find out your FODs are broken for other people unless they tell you.

Yep it makes sense now. I was only having issues with commitmsgmft tests.

I did end up rebuilding icedtea-web iirc and that ended up rebuilding Firefox and a bunch of other stuff, but I suppose that is the same situation...

@mmlb
Copy link
Contributor Author

mmlb commented Jun 23, 2024

I'll give this another go withess disruptive changes then :D

@AndersonTorres
Copy link
Member

there's a reason we have fetchpatch2

Does it apply here? A "fetchCargo2"?

@alyssais
Copy link
Member

We could, although I'm not sure it's worth it just for this…

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

Successfully merging this pull request may close these issues.

8 participants