-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Adding a dependency from a github repository with features seems to be failing/disambiguation command is not properly parsed #13121
Comments
ok looks like Cargo is not interpreting the tfhe in the cargo add call as the workspace member to add but it was what the help suggested 🤔 |
cargo add --git https://github.com/zama-ai/tfhe-rs.git
Updating git repository `https://github.com/zama-ai/tfhe-rs.git`
error: multiple packages found at `https://github.com/zama-ai/tfhe-rs.git`:
concrete-csprng, tasks, tfhe, tfhe-trivium
To disambiguate, run `cargo add --git https://github.com/zama-ai/tfhe-rs.git <package>` |
I can take a look at this if it's not already claimed. I'm starting with digging around here - https://github.com/rust-lang/cargo/blob/master/src/cargo/ops/cargo_add/mod.rs#L280, please suggest if you think the issue might be in a different source. |
Hi @epage, need some input on how to proceed here. I've found an easy fix for this, but I reckon it might cause regressions, I can't be sure since I am not sure what exactly the existing code does. In the If we change the After this change I am able to add the dependency stated in the original issue, as well as from a repo without any workspaces. Both of these work:
Is there some case for which we need the |
We use cargo/src/cargo/ops/cargo_add/mod.rs Line 587 in 4e792c2
However, we shouldn't need to be doing that by the time we do If you can, I'd recommend having a commit that has a test that shows the bug and then a follow up commit switches to |
Sure, thanks. Will make these changes. |
…ures" This reverts commit 91ce3ee.
…epage `cargo add` - fix for adding features from repository with multiple packages. Fixes #13121 As discussed in the issue, when using `cargo add` to add a package with features from a git repository from one of it's members, the command might fail due to improper target for querying for said features. This PR adds a test for this edge-case where we expect it to fail with current code. It also adds a fix for this, and updates the test to expect success. While populating available features, the current code does a `Fuzzy` search which might lead to searching for features in a wrong member package. If we change it to an `Exact` query, we get back the proper member to search within.
Problem
Adding a workspace member from a github repository as a dependency via
cargo add
specifying existing features triggers an issueSteps
output:
As one can see here the feature does exist in the tfhe workspace member Cargo.toml:
https://github.com/zama-ai/tfhe-rs/blob/ad41fdf5a5060c0a981cd0c35bf998feafe68e02/tfhe/Cargo.toml#L138
Possible Solution(s)
Unsure, I don't know the cargo code base, but my guess would be to parse the workspace member Cargo.toml to get some metadata/information about the crate
Notes
this is probably an edge case but can prove interesting for automated workflows that may be doing some automatic api breaks/checks by adding a work in progress version of a project to a test/regression project and run tests from that project
Version
The text was updated successfully, but these errors were encountered: