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

cargo add spurious failure #14914

Open
xd009642 opened this issue Dec 10, 2024 · 7 comments
Open

cargo add spurious failure #14914

xd009642 opened this issue Dec 10, 2024 · 7 comments
Labels
C-bug Category: bug Command-add S-triage Status: This issue is waiting on initial triage.

Comments

@xd009642
Copy link

xd009642 commented Dec 10, 2024

Problem

Looking at the packages on crates.io I can't see a good reason for this so there's a chance it should be an issue cargo side.

$ cargo add --dev fake --features "uuid derive"
    Updating crates.io index
      Adding fake v3.0.1 to dev-dependencies
             Features:
             + derive
             + dummy
             + uuid
             - always-true-rng
             - bigdecimal
             - bigdecimal-rs
             - bson
             - bson_oid
             - chrono
             - chrono-tz
             - geo
             - geo-types
             - glam
             - http
             - indexmap
             - maybe-non-empty-collections
             - num-traits
             - rand_core
             - random_color
             - rust_decimal
             - semver
             - serde_json
             - time
             - ulid
             - url
             - url-escape
             - zerocopy
error: failed to select a version for the requirement `dummy = "^0.9"`
candidate versions found which didn't match: 0.7.0, 0.6.0, 0.5.0, ...
location searched: crates.io index
required by package `fake v3.0.1`
    ... which satisfies dependency `fake = "^3.0.1"` (locked to 3.0.1) of package `rs v0.1.0 (project-rs)`

Hmm just tried cargo add on a clean project and it works so it's definitely a cargo issue. I also removed fake from the manifest where it didn't work and manually wrote the entry and did a cargo check and it grabbed dummy 0.9 as expected. So maybe this is some temporary registry failure?

I've been trying to reproduce this in a clean project and I haven't managed to yet... So hopefully it's something someone here can instantly see what's up or I'll have to keep trying.

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.83.0 (5ffbef321 2024-10-29)
release: 1.83.0
commit-hash: 5ffbef3211a8c378857905775a15c5b32a174d3b
commit-date: 2024-10-29
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w  11 Sep 2023
os: Ubuntu 18.4.0 (bionic) [64-bit]
@xd009642 xd009642 added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Dec 10, 2024
@epage
Copy link
Contributor

epage commented Dec 10, 2024

Normally I'd expect this from something like #10623 but I'm not seeing anything in the manifest that would suggest an old cargo wouldn't understand the Index entry and it would require somehow using an older cargo than intended.

@xd009642
Copy link
Author

Attaching the lockfile just in case something jumps out, but given dummy is written by the fake author and isn't used by something else it's a bit weird... I have used fake on an older project so maybe an older version cached? I'm really not sure and I've been unable to recreate it though 😓

lockfile.zip

@epage
Copy link
Contributor

epage commented Dec 10, 2024

Not seeing anything in that lockfile that would give me pause.

Is this open source where you can point us to a specific commit to reproduce this on? Or could you capture a log, redact that, and post it?

e.g.

$ CARGO_LOG=cargo::core::resolver=trace cargo add --dev fake --features "uuid derive"

If there isn't a message in that log saying why a version was ignored, maybe try blowing away your ~/.cargo/registry and trying again. This might affect reproducibility, so maybe back it up first. I've not dug into this but #14894 makes it sound like one of our caches causes errors to be silenced even when tracing and deleting it might cause it to show.

@xd009642
Copy link
Author

It's not open source unfortunately!

So I've tried it on past commits, also nuked registry and nuked registry added fake 2.7.0 and then removed it from the project and added fake 3.0 and none of them have managed to reproduce it.

Once I had the issue all the cargo add calls for fake failed potentially because I tried to tweak some other deps and rerun cargo add without changing the cargo.toml or lockfile myself. But after my dummy project, removing it from current project and readding it it worked and I can't recreate it.

I'll happily try any other ideas you have but I'm at a loss on recreating it after all these tries

@epage
Copy link
Contributor

epage commented Dec 10, 2024

Were you able to get a log?

Could you post ~/.cargo/registry/index/index.crates.io-6f17d22bba15001f/.cache/du/mm/dummy?

@xd009642
Copy link
Author

The log had:

   0.917473350s TRACE resolve: cargo::core::resolver: fake[89]>dummy 2 candidates
   0.917477832s TRACE resolve: cargo::core::resolver: fake[89]>dummy trying 0.9.1
   0.917490838s TRACE resolve: cargo::core::resolver: activating dummy v0.9.1

which just seems correct. And the registry contents is:

etag: W/"7b4e7a7348333654fb916fcb1102e8f2"0.1.0{"name":"dummy","vers":"0.1.0","deps":[{"name":"rand","req":"^0.6.5","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"e81bf42e7ebb579e04ae0ec6bebda43389e4bc7025fee986407383eee0fcd7a8","features":{},"yanked":false}0.2.0{"name":"dummy","vers":"0.2.0","deps":[{"name":"rand","req":"^0.6.5","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"25cf574957a1b332bd07ca2cb3946eaa10f7e3bf6ae28f1a45d002e94321b54d","features":{},"yanked":false}0.2.1{"name":"dummy","vers":"0.2.1","deps":[{"name":"rand","req":"^0.6.5","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"89868c84e0f2705b77762be2860001f968059328d5987ad0565cfc4ccb090b51","features":{},"yanked":false}0.3.0{"name":"dummy","vers":"0.3.0","deps":[{"name":"darling","req":"^0.9.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"quote","req":"^0.6","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"syn","req":"^0.15.26","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"35a6f966ad9b21bc85e635e18f0f9df6c4644f1d81a5b844fc1604995588639f","features":{},"yanked":false}0.3.1{"name":"dummy","vers":"0.3.1","deps":[{"name":"darling","req":"^0.10","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"syn","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"843302539acbb37224e46833146663aa4889279f9643ae34ddddcaa48ed3ae01","features":{},"yanked":false}0.3.2{"name":"dummy","vers":"0.3.2","deps":[{"name":"darling","req":"^0.10","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"syn","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"5402053b2627620af1f77367da02ddf08bc397aaf35c3866d6d2eb125b51a622","features":{},"yanked":false}0.3.3{"name":"dummy","vers":"0.3.3","deps":[{"name":"darling","req":"^0.10","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"syn","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"09e6c397d4775a916085e9da36f228cef1fc9a58210096aacfc9ca858bb59c14","features":{},"yanked":false}0.3.4{"name":"dummy","vers":"0.3.4","deps":[{"name":"darling","req":"^0.10","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"syn","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"38cb326dc5f0ae591a8d43d6558ff18ab65b548e0d124eed008f8bc657bb0923","features":{},"yanked":false}0.4.0{"name":"dummy","vers":"0.4.0","deps":[{"name":"darling","req":"^0.10","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"syn","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"0444a1bba051be9becd18b5c1b66945c95fb84fe72048e43dcd5ac9366443990","features":{},"yanked":false}0.4.1{"name":"dummy","vers":"0.4.1","deps":[{"name":"darling","req":"^0.13","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"syn","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"5bf5ff6f74150b0bbb6e6057718a903b3d8f3fc7096c9190fc162ca99d3b2273","features":{},"yanked":false}0.5.0{"name":"dummy","vers":"0.5.0","deps":[{"name":"darling","req":"^0.20","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"proc-macro2","req":"^1","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"syn","req":"^2.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"8da904daa6ce71bb51e03fd0529b08bad4b18bae89e176873c7bae9eb91a19ce","features":{},"yanked":false}0.6.0{"name":"dummy","vers":"0.6.0","deps":[{"name":"darling","req":"^0.20","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"proc-macro2","req":"^1","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"syn","req":"^2.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"2ba338a15d93c01c2f117a2b0bd1bfa3c780fe771e7db7c69fc70bda265e2115","features":{},"yanked":false}0.7.0{"name":"dummy","vers":"0.7.0","deps":[{"name":"darling","req":"^0.20","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"proc-macro2","req":"^1","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"},{"name":"syn","req":"^2.0","features":[],"optional":false,"default_features":true,"target":null,"kind":"normal"}],"cksum":"7e57e12b69e57fad516e01e2b3960f122696fdb13420e1a88ed8e210316f2876","features":{},"yanked":false}0.8.0{"name":"dummy","vers":"0.8.0","deps":[{"name":"darling","req":"^0.20","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"proc-macro2","req":"^1","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"syn","req":"^2.0","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"}],"cksum":"1cac124e13ae9aa56acc4241f8c8207501d93afdd8d8e62f0c1f2e12f6508c65","features":{},"yanked":false,"rust_version":"1.63"}0.9.0{"name":"dummy","vers":"0.9.0","deps":[{"name":"darling","req":"^0.20","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"proc-macro2","req":"^1","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"syn","req":"^2.0","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"}],"cksum":"07f39256702ef25dc3381a19aece91eb5c803506de0f79b01b6aa0fea64b32c2","features":{},"yanked":false,"rust_version":"1.63"}0.9.1{"name":"dummy","vers":"0.9.1","deps":[{"name":"darling","req":"^0.20","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"proc-macro2","req":"^1","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"quote","req":"^1.0","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"},{"name":"syn","req":"^2.0","features":[],"optional":false,"default_features":false,"target":null,"kind":"normal"}],"cksum":"b3ee4e39146145f7dd28e6c85ffdce489d93c0d9c88121063b8aacabbd9858d2","features":{},"yanked":false,"rust_version":"1.63"}

@epage
Copy link
Contributor

epage commented Dec 10, 2024

Hmm, the cache has the new entries

{
  "name": "dummy",
  "vers": "0.9.0",
  "deps": [
    {
      "name": "darling",
      "req": "^0.20",
      "features": [],
      "optional": false,
      "default_features": false,
      "target": null,
      "kind": "normal"
    },
    {
      "name": "proc-macro2",
      "req": "^1",
      "features": [],
      "optional": false,
      "default_features": false,
      "target": null,
      "kind": "normal"
    },
    {
      "name": "quote",
      "req": "^1.0",
      "features": [],
      "optional": false,
      "default_features": false,
      "target": null,
      "kind": "normal"
    },
    {
      "name": "syn",
      "req": "^2.0",
      "features": [],
      "optional": false,
      "default_features": false,
      "target": null,
      "kind": "normal"
    }
  ],
  "cksum": "07f39256702ef25dc3381a19aece91eb5c803506de0f79b01b6aa0fea64b32c2",
  "features": {},
  "yanked": false,
  "rust_version": "1.63"
}

which matches mine

{
  "name": "dummy",
  "vers": "0.9.0",
  "deps": [
    {
      "name": "darling",
      "req": "^0.20",
      "features": [],
      "optional": false,
      "default_features": false,
      "target": null,
      "kind": "normal"
    },
    {
      "name": "proc-macro2",
      "req": "^1",
      "features": [],
      "optional": false,
      "default_features": false,
      "target": null,
      "kind": "normal"
    },
    {
      "name": "quote",
      "req": "^1.0",
      "features": [],
      "optional": false,
      "default_features": false,
      "target": null,
      "kind": "normal"
    },
    {
      "name": "syn",
      "req": "^2.0",
      "features": [],
      "optional": false,
      "default_features": false,
      "target": null,
      "kind": "normal"
    }
  ],
  "cksum": "07f39256702ef25dc3381a19aece91eb5c803506de0f79b01b6aa0fea64b32c2",
  "features": {},
  "yanked": false,
  "rust_version": "1.63"
}

and I see nothing suspicous

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug Command-add S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants