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 list does not de-duplicate entries #6088

Closed
jonhoo opened this issue Sep 24, 2018 · 8 comments · Fixed by #9773
Closed

cargo list does not de-duplicate entries #6088

jonhoo opened this issue Sep 24, 2018 · 8 comments · Fixed by #9773
Assignees
Labels
Command-list E-easy Experience: Easy

Comments

@jonhoo
Copy link
Contributor

jonhoo commented Sep 24, 2018

On Arch Linux, among other distros, /bin is a symlink to /usr/bin. This makes cargo list show many components twice:

$ which -a cargo-clippy
/usr/bin/cargo-clippy
/bin/cargo-clippy
$ cargo list | grep clippy
    clippy
    clippy

It's a little unclear how to fix this though, since cargo would have to know that those two binaries are indeed the same. Resolving symlinks with readlink before de-duplicating here might be the way to go? Alternatively, maybe the list should be de-duplicated based only on the command name, and not on the full path as well. That is, make that BTreeSet a BTreeMap with name as the key. We'd still then have to resolve conflicts, but have to do that today anyway!

As an aside to this, it'd be great if cargo list showed the path of the command it'll use to execute a given component by default. This happens if --verbose is passed currently, but I'm not sure I see the reason to hide it in non-verbose output, given that the command descriptions for built-ins are always shown?

@jonhoo
Copy link
Contributor Author

jonhoo commented Sep 24, 2018

cc @akshayknarayan

@ehuss
Copy link
Contributor

ehuss commented Aug 2, 2021

Note: This often happens on Windows, where rustup adds the toolchain bin directory to PATH (for DLL loading).

This should be a relatively simple fix, to use a BTreeMap instead of a BTreeSet here.

@Rustin170506
Copy link
Member

@rustbot claim

@nipunn1313
Copy link
Contributor

@rustbot claim

Sorry @hi-rustin - I think I just raced with you - I had just coded this one up. Perhaps you can review #9773 ?

@rustbot rustbot assigned nipunn1313 and unassigned Rustin170506 Aug 7, 2021
@Rustin170506
Copy link
Member

@rustbot claim

Sorry @hi-rustin - I think I just raced with you - I had just coded this one up. Perhaps you can review #9773 ?

Maybe you should get my permission instead of just submitting a PR and unassigning me right away. But it's okay you can submit it. But hopefully next time you can claim early and get someone else's permission to do it after they claim. Thanks! 🤝

@rustbot rustbot assigned Rustin170506 and unassigned nipunn1313 Aug 7, 2021
@Rustin170506
Copy link
Member

Sorry, the bot seems to have recognized the quote in my reply, please cliam again. Thanks!

@Rustin170506 Rustin170506 removed their assignment Aug 7, 2021
@nipunn1313
Copy link
Contributor

Yes I am sorry. I should have assigned it to myself when I started looking at - instead of as I was completing it.
I had completed it literally 45 seconds after you claimed. It was bad etiquette on my part.

@nipunn1313
Copy link
Contributor

@rustbot claim

bors added a commit that referenced this issue Aug 9, 2021
Deduplicate entries in cargo --list

Fixes #6088
@bors bors closed this as completed in 0ab79d7 Aug 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-list E-easy Experience: Easy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants