rust-lang / rust-lang/cargo

Building with a registry that hosts packages with mismatching names fails with an internal error

Open
#8,698 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-diagnostics C-bug S-needs-mentor
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Problem
I have published a registry that had a different name in the Cargo.toml of the downloaded package than what was used in the registry (the registry has a package ~github:1234|something which when downloaded contains a Cargo.toml with package.name = "bs58"). Trying to build with a dependency on this package results in a cargo internal error:

Steps

Create a new project and add a dependency:

[dependencies]
bs58.version = "0.3.1"
bs58.package = "~github:1234|something"
bs58.registry-index = "https://ipfs.io/ipfs/Qmeuz3m8QWdRahB8Vvgk9R5kvASEvrnNZGaFyy3WNJqSz7"

Try building it (using git-cli for the non-smart git protocol):

> CARGO_LOG=trace cargo build --config net.git-fetch-with-cli=true -Z unstable-options
[...]
  Downloaded ~github:1234|something v0.3.1 (registry `https://ipfs.io/ipfs/Qmeuz3m8QWdRahB8Vvgk9R5kvASEvrnNZGaFyy3WNJqSz7`)
[2020-09-11T13:19:26Z TRACE cargo::ops::cargo_read_manifest] read_package; path=/Users/nemo157/.cargo/registry/src/ipfs.io-8e9b5ce4ef400cdd/~github:1234|something-0.3.1/Cargo.toml; source-id=registry `https://ipfs.io/ipfs/Qmeuz3m8QWdRahB8Vvgk9R5kvASEvrnNZGaFyy3WNJqSz7`
[2020-09-11T13:19:26Z TRACE cargo::util::toml] read_manifest; path=/Users/nemo157/.cargo/registry/src/ipfs.io-8e9b5ce4ef400cdd/~github:1234|something-0.3.1/Cargo.toml; source-id=registry `https://ipfs.io/ipfs/Qmeuz3m8QWdRahB8Vvgk9R5kvASEvrnNZGaFyy3WNJqSz7`
[2020-09-11T13:19:26Z TRACE cargo::sources::path] getting packages; id=~github:1234|something v0.3.1 (registry `https://ipfs.io/ipfs/Qmeuz3m8QWdRahB8Vvgk9R5kvASEvrnNZGaFyy3WNJqSz7`)
[2020-09-11T13:19:26Z WARN  cargo::util::rustc] failed to update rustc info cache: failed to write `/private/var/folders/0p/5yvmrvhj5w3_vy1y8x7dvk7m0000gn/T/tmp.uY44qvVp/foo/target/.rustc_info.json`
[2020-09-11T13:19:26Z DEBUG cargo] exit_with_error; err=CliError { error: Some(failed to find ~github:1234|something v0.3.1 (registry `https://ipfs.io/ipfs/Qmeuz3m8QWdRahB8Vvgk9R5kvASEvrnNZGaFyy3WNJqSz7`) in path source), exit_code: 101 }
[2020-09-11T13:19:26Z DEBUG cargo] display_error; err=failed to find ~github:1234|something v0.3.1 (registry `https://ipfs.io/ipfs/Qmeuz3m8QWdRahB8Vvgk9R5kvASEvrnNZGaFyy3WNJqSz7`) in path source
error: failed to find ~github:1234|something v0.3.1 (registry `https://ipfs.io/ipfs/Qmeuz3m8QWdRahB8Vvgk9R5kvASEvrnNZGaFyy3WNJqSz7`) in path source
note: this is an unexpected cargo internal error
note: we would appreciate a bug report: https://github.com/rust-lang/cargo/issues/
note: cargo 1.48.0-nightly (875e01232 2020-09-08)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the mismatch with the shown Cargo.toml dependency and cargo build --config net.git-fetch-with-cli=true -Z unstable-options. Start by tracing the cargo_read_manifest and path-source handling shown in the log; done means the registry package is resolved without the internal error or incorrect path-source lookup.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.