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

Current implementation cannot handle multiple crates with the same lib name #22

Closed
baumanj opened this issue Sep 13, 2019 · 6 comments · Fixed by #25
Closed

Current implementation cannot handle multiple crates with the same lib name #22

baumanj opened this issue Sep 13, 2019 · 6 comments · Fixed by #25
Labels
bug Something isn't working

Comments

@baumanj
Copy link

baumanj commented Sep 13, 2019

When running cargo +nightly udeps against https://github.com/habitat-sh/habitat:

➤ cargo +nightly udeps
  Downloaded arc-swap v0.4.2
  Downloaded chrono v0.4.9
…
  Downloaded 34 crates (4.0 MB) in 8.13s (largest was `encoding_rs` at 1.4 MB)
Error: StrErr("current implementation cannot handle multiple crates with the same `lib` name:
`habitat_core v0.0.0 (/home/jbauman/habitat/components/core)`
├── "base64" → "base64"
├── "base64" → "base64"
└── ..")

I know

Crates are currently only handled on a per name basis. Two crates with the same name but different versions would be a problem.

is listed as a known bug in https://github.com/est31/cargo-udeps/blob/master/README.md#known-bugs, but I couldn't find an issue that's tracking it. Since the project I work on won't be able to make use of udeps until this is resolved, having an issue I can subscribe to will help ensure that I can use it when that bug is fixed.

@est31 est31 added the bug Something isn't working label Sep 13, 2019
@est31
Copy link
Owner

est31 commented Sep 13, 2019

Yes, in this instance the crate is used both as build dependency and normal dependency. I've ran into this multiple times myself. Thanks for filing the bug.

@baumanj
Copy link
Author

baumanj commented Sep 13, 2019

Thanks for the tool! It promises to be really helpful

@metajack
Copy link

I'm attempting to use this on https://github.com/libra/libra and it's failing with a similar error:

❯ cargo udeps
Error: StrErr("current implementation cannot handle multiple crates with the same `lib` name:
`admission_control_service v0.1.0 (/Users/metajack/src/libra/admission_control/admission_control_service)`
├── "admission_control_proto" → "admission_control_proto"
├── "admission_control_proto" → "admission_control_proto"
└── ..")

But admission_control_proto is not listed twice anywhere that I can see. Looks like the error message might be incorrect?

@est31
Copy link
Owner

est31 commented Sep 19, 2019

PRs to fix it are welcome!

@qryxip
Copy link
Collaborator

qryxip commented Sep 23, 2019

@metajack The problem can be fixed by this. (I don't know why)

   for (to_pkg, deps) in resolve.deps(from) {
+     // `Resolve::deps` rarely returns multiple same `Dependenc`ies.
+     let deps = deps.iter().collect::<BTreeSet<_>>();

But unfortunately cargo-udeps still does not work for libra because admission_control_service depends on both futures v0.1 and futures v0.3.

Error: StrErr("current implementation cannot handle multiple crates with the same `lib` name:
`admission_control_service v0.1.0 (/home/ryo/src/libra/admission_control/admission_control_service)`
└── (dev-)dependencies
    ├── "futures03" → "futures"
    ├── "futures" → "futures"
    └── ..")
[dependencies]
futures = "0.1.28"
futures03 = { version = "=0.3.0-alpha.17", package = "futures-preview" }

@qryxip
Copy link
Collaborator

qryxip commented Sep 23, 2019

Still not working even though replacing futures v0.1 with futures01.
Though I wrote the error, The error should be probably a warning.

Error: StrErr("current implementation cannot handle multiple crates with the same `lib` name:
`libra_wallet v0.1.0 (/home/ryo/src/libra/client/libra_wallet)`
└── (dev-)dependencies
    ├── "rust-crypto" → "crypto"
    ├── "libra_crypto" → "crypto"
    └── ..")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants