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 install suggests an unrelated package #9422

Closed
bronson opened this issue Apr 27, 2021 · 2 comments · Fixed by #9582
Closed

cargo install suggests an unrelated package #9422

bronson opened this issue Apr 27, 2021 · 2 comments · Fixed by #9582
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug Command-install E-easy Experience: Easy

Comments

@bronson
Copy link

bronson commented Apr 27, 2021

Problem

When I ask Cargo to install cargo-edit from git, it says that I'm being ambiguous and suggests the two crate as an alternative.

$ cargo install --git=https://github.com/killercup/cargo-edit --features vendored-openssl
    Updating git repository `https://github.com/killercup/cargo-edit`
error: multiple packages with binaries found: cargo-edit, two

I downloaded the two crate and glanced through it... I don't see any reason for Cargo to suggest it.

Steps

  1. cargo install --git=https://github.com/killercup/cargo-edit --features vendored-openssl
  2. Notice Cargo's suggestions. On my computer: cargo-edit, two

It's true that explicitly stating cargo-edit succeeds: cargo install cargo-edit --git=https://github.com/killercup/cargo-edit --features vendored-openssl

But, why did Cargo suggest the two crate?

Notes

Output of cargo version: cargo 1.51.0 (43b129a 2021-03-16)

@bronson bronson added the C-bug Category: bug label Apr 27, 2021
@ehuss
Copy link
Contributor

ehuss commented Apr 27, 2021

When installing a git repository, cargo will always search the entire repo for any Cargo.toml. In this case, it is finding https://github.com/killercup/cargo-edit/blob/master/tests/fixtures/workspace/two/Cargo.toml.

The error message could definitely be better (which I think is #9011).

@bronson
Copy link
Author

bronson commented Apr 27, 2021

Ah! Yes, that's it. I wondered why Cargo was being sloppy with the words package and crate.

If it had said something like this then I would have understood immediately:

cargo-edit provides multiple binaries:
  - cargo-edit
  - tests/fixtures/workspace/two/two
Please specify which to install.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Error and warning messages generated by Cargo itself. C-bug Category: bug Command-install E-easy Experience: Easy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants