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

Regression 1.33.0: Cargo doesn't resolve yanked crates when using local registry #6741

Closed
hugwijst opened this issue Mar 13, 2019 · 2 comments · Fixed by #6742
Closed

Regression 1.33.0: Cargo doesn't resolve yanked crates when using local registry #6741

hugwijst opened this issue Mar 13, 2019 · 2 comments · Fixed by #6742
Labels
C-bug Category: bug

Comments

@hugwijst
Copy link
Contributor

Problem

When using a local registry, building a crate that depends on a yanked crate will fail with error message: error: failed to select a version for the requirement.

The crate builds correctly when using the crates.io remote registry.

Steps

On 1.33.0 or nightly:

  1. cargo init test-lib
  2. cd test-lib
  3. echo 'libc = "0.1.11"' >> Cargo.toml
  4. Populate Cargo.lock:
cat << EOF > Cargo.lock
[[package]]
name = "libc"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"

[[package]]
name = "test-bin"
version = "0.1.0"
dependencies = [
 "libc 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
]

[metadata]
"checksum libc 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0f005973c230985173e16b763cc28801eb4367d500ebdb85b79f790e9a5c1f7e"
EOF
  1. cargo local-registry -s Cargo.lock registry
  2. mkdir .cargo
  3. Populate .cargo/config:
cat << EOF > .cargo/config
[source.crates-io]
registry = 'https://github.com/rust-lang/crates.io-index'
replace-with = 'local-registry'

[source.local-registry]
local-registry = '`pwd`/registry'
EOF
  1. cargo check
  2. Observe the following error: error: failed to select a version for the requirement `libc = "= 0.1.11"` .

Possible Solution(s)

Possibly introduced by #6655, as a local registry isn't provided the yanked_whitelist when constructed (RegistrySource::local in src/cargo/sources/registry/mod.rs).

Notes

  • Introduced in Cargo 1.33.0, not observed on 1.25.0 up to and including 1.32.0.
  • This issue is quite severe, as updating the local registry will break compilation of crates that compiled on the same compiler version.

Output of cargo version:
cargo 1.33.0 (f099fe94b 2019-02-12).

@hugwijst hugwijst added the C-bug Category: bug label Mar 13, 2019
hugwijst added a commit to hugwijst/cargo that referenced this issue Mar 13, 2019
bors added a commit that referenced this issue Mar 13, 2019
Fix resolving yanked crates when using a local registry.

Fixes #6741.
@hugwijst
Copy link
Contributor Author

Can we backport this into beta? Getting a 1.33.1 is probably a long shot.

We'll need to skip 1.33.0 internally, as having commits that cannot be successfully build anymore due to an update to the local registry is unacceptable.

@alexcrichton
Copy link
Member

Backporting seems reasonable to me! @hugwijst would you be up for sending a PR to the rust-1.34.0 branch of this repository?

hugwijst added a commit to hugwijst/cargo that referenced this issue Mar 15, 2019
bors added a commit that referenced this issue Mar 15, 2019
…ehuss

[backport] Fix resolving yanked crates when using a local registry.

This is a backport #6742 to fix #6741.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants