-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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 confuses checksums of crate versions with + in them #7180
Comments
cc @sgrif @pietroalbini @rust-lang/crates-io |
I think this may be a dupe and/or boil down to rust-lang/crates.io#1059 |
On July 26, 2019 7:56:40 AM PDT, Alex Crichton ***@***.***> wrote:
I think this may be a dupe and/or boil down to
rust-lang/crates.io#1059
While it's entirely possible that crates.io should prohibit new uploads of such versions, meanwhile real crates exist on crates.io with such versions, and cargo breaks when trying to use them. (And cargo also issues no warning, despite it being discussed and apparently implemented in one of those issues.)
This has shown up in crater runs.
I think this needs fixing in cargo, whether crates.io policy changes or not.
|
This is just a bug with |
`cargo fetch`: Display workspace warnings. Warnings were previously hidden with `cargo fetch`. It may be a little confusing, so go ahead and display them. cc #7180 (comment) I thought about other commands that don't display warnings, but I couldn't think of any others where it would be useful. The only edge case is `publish`/`package`, which won't display unused key warnings because the manifest is rewritten and they are stripped. But displaying warnings there is awkward because some warnings will be displayed twice.
I do think this is a bug in cargo and/or semver. Build metadata is ignored for precedence, but that does not mean it should be ignored for equality. I laid out some more reasoning on this in dtolnay/semver#107 (comment), but it sounds like Cargo is just picking the wrong row given a version in |
Another interesting error message I noticed, if you manually update the lockfile to have the correct checksum you get an error before cargo attempts to download the archive:
|
This causes the build to fail randomly for anything that has ndk-sys in its dependency tree (eg, projects that depends on winit)
|
Maintainer of I have since published $ cargo build --target aarch64-linux-android
Downloaded ndk-sys v0.4.0
error: failed to verify the checksum of `ndk-sys v0.4.0` on a Timeline
EDIT: This issue (also for |
Add a small note about indexes ignoring SemVer build metadata. This adds some clarification to the documentation on how registries need to handle SemVer build metadata, and the uniqueness constraint around version entries. IIRC, some issues in cargo have been fixed, but some still linger (like #7180). crates.io just fixed it so that new duplicates will be rejected.
rust-lang/crates.io#6518 is merged so new metadata-different versions can't be published anymore.
Cargo warns if the version requirement has build metadata. I did $ cargo new foo
$ cd foo
$ cargo add lz4-sys@=1.0.1+1.7.3
$ cargo check and it worked. Sounds like this is resolved and closing this. If there is anything I missed, let us know! |
Steps to reproduce:
cargo new foo
Cargo.toml
to addlz4-sys = "=1.0.1+1.7.3"
cargo fetch
Cargo.lock
:00db259f5d4cd53491fc74379b3a68faaae357b64b61e2b1bdbb785b3e3301ee
lz/4-/lz4-sys
in the crates.io-index repository:Cargo downloaded the .crate file for 1.0.1+1.7.3, and compared it to the checksum for 1.0.1+1.7.5 (which it put in
Cargo.lock
), resulting in a checksum mismatch.Reproduced with
cargo 1.36.0
andcargo 1.38.0-nightly (677a180f4 2019-07-08)
.This seems related to #6504 , but that bug was closed with no fix. crates.io allows publishing multiple crates whose version numbers differ in metadata, such crates have been published, and cargo breaks when using them.
Also, despite #6806 , I didn't in practice get any warning messages when using such version numbers.
This bug led to a fair bit of consternation among the crates.io admin team, in which we were trying to figure out if we had some index/crate corruption or some other critical issue, before realizing that the issue was in cargo rather than crates.io.
Regardless of any future policy changes to crates.io, I don't think it makes sense for cargo to completely ignore build metadata like this.
The text was updated successfully, but these errors were encountered: