-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
warning: skipping duplicate package case
found at ~\.cargo\git\checkouts\cargo-..
#10752
Comments
Thanks for the report. Those warnings won't affect any build, though flooding with warnings is definitely not good. This situation happens when you
I am not sure whether this is rare or not. One simple way to solve it is reverting #10701. |
Interesting. cargo is searching recursively through cargo's git repo and finding all of the test cases we have in the repo and reporting a warning for those as we duplicate the manifest names. These should not even be given as options for install for the warning to be activated. Besides telling the user to run |
We discussed this in the cargo team meeting and came up with a short term and long-term idea Short term is to see if we can make the warning only appear when the package is There is still the wider problem if packages being looked up that are internal. Ideas
|
@danilhendrasr since you worked on the warnings in #10701, I thought I'd first check if you would be interested in seeing if the warning could be restricted to packages with |
Sure, I'll take a stab at it. |
Hmm, thinking about this, i suspect #10767 only gave people the tool to reduce the warnings but cargo still needs to opt-in to that tool, so going ahead and re-opening for now. |
Would it be possible to restrict the warning to situations where the package is actually used? That is, when doing I would also expect this to actually be an error in the long-run. In the original issue (#10669), this leads to non-deterministic behavior. A warning just says "something's broken" and then proceeds doing something random, which doesn't seem good. Also, the current warning does not seem to be very helpful (particularly for an end-user who may have no idea where this is coming from, or is not well-versed in cargo). There is no actionable advice given to the user, or any context as to how cargo got into this bind. I would expect in the situation with a git dependency that has a duplicate, it would say something like:
With similar errors for (Without the ability to restrict a git repo to a specific path, the solution of being unique isn't great, but should be fine in most situations.) |
The big issue with the case in question is that the user is doing $ cargo install --git https://github.com/rust-lang/cargo and not $ cargo install --git https://github.com/rust-lang/cargo -p cargo The most we can filter it down is by whether the package has an installable artifact which I think would be an additional useful thing to do. Overall, this still leaves the big hole of |
I believe the former command only works if there is a single package with a binary (see here). With cargo's repo, it errors with:
|
Add `ui_cargo_toml_metadata` test This PR adds a test to check the metadata of packages in the `ui_cargo` directory. A recent change to Cargo causes it to warn when it finds multiple packages with the same name in a git dependency (the issue is described [here](rust-lang/cargo#10752)). Many (if not all) Dylint libraries depend upon `clippy_utils`. As a result of the change, one now sees the following when building a Dylint library: ``` warning: skipping duplicate package `fail` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/module_style/pass_mod` warning: skipping duplicate package `fail` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/module_style/fail_no_mod` warning: skipping duplicate package `cargo_common_metadata` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_common_metadata/fail_publish_true` warning: skipping duplicate package `fail-cargo` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/pass_cargo` warning: skipping duplicate package `fail-clippy` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/fail_clippy` warning: skipping duplicate package `fail-both-same` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/fail_both_same` warning: skipping duplicate package `fail-file-attr` found at `/home/smoelius/.cargo/git/checkouts/rust-clippy-4b72815e96774b3d/0cb0f76/tests/ui-cargo/cargo_rust_version/fail_file_attr` ``` There appear to be two contributing factors: - Some packages in `ui_cargo` could have a `publish = false` added to them. - Some packages in `ui_cargo` seem to be inconsistently named. The new test checks that each package in the `ui_cargo` directory has a name matching one of its parent directories, and `publish = false` in its metadata (with a few exceptions). Note that the packages in `cargo_common_metadata` require special care because `publish` is the subject of some of the `cargo_common_metadata` tests. Also note that this PR adds `walkdir` as a dev dependency to the `clippy` package. However, it was already a dependency of `clippy_dev` and `lintcheck`. So hopefully this is acceptable. Our continued thanks for making `clippy_utils` available, BTW. :) r? `@flip1995` changelog: none
When specifying `cbindgen` as a dependency via git, several 'skipping duplicate package' warnings pop up regarding some of the test crates. The warning seems to be spurious given that the test packages aren't needed when depending on `cbindgen` (see rust-lang/cargo#10752), but while a fix is being considered for Cargo, this commit disambiguates the duplicated package names by referring to their relative paths.
When specifying `cbindgen` as a dependency via git, several 'skipping duplicate package' warnings pop up regarding some of the test crates. The warning seems to be spurious given that the test packages aren't needed when depending on `cbindgen` (see rust-lang/cargo#10752), but while a fix is being considered for Cargo, this commit disambiguates the duplicated package names by referring to their relative paths.
I'm hitting this, as an end-user, with
Technically speaking, the only reason I need it as a dependency is because they don't publish to crates.io and their tool adds it at runtime, but that doesnt play nice with Rust Analyzer, hence adding the dependency. Is there any way to silence these warnings? I'm not installing a binary so I can't just use |
Should we reconsider redirecting error to a log file? Or at minimal, Cargo can log some parts of the error that is not meaingful to end users. We then can provide a way to retrieve a verbose error report. The workflow might look like this,
|
This comment was marked as resolved.
This comment was marked as resolved.
These are dramatically different and the shared implementation is getting in the way of rust-lang#10752.
These are dramatically different and the shared implementation is getting in the way of rust-lang#10752.
These are dramatically different and the shared implementation is getting in the way of rust-lang#10752.
These are dramatically different and the shared implementation is getting in the way of rust-lang#10752.
fix(overrides): Don't warn on duplicate packages from using '..' ### What does this PR try to resolve? As part of #10752, I was changing the "duplicate package" warning to be like: ``` [WARNING] skipping duplicate package `a2 v0.5.0 ([ROOT]/foo/b/../a)`: [ROOT]/foo/b/../a/a2/Cargo.toml in favor of [ROOT]/foo/a/a2/Cargo.toml ``` and it showed that we were considering two paths to the same package to be duplicates. This suppresses that warning. ### How should we test and review this PR? ### Additional information
fix(source): Don't warn about unreferenced duplicate packages ### What does this PR try to resolve? This also improves the message, consolidating multiple duplicates and saying which was loaded instead, as it naturally fell out of the design Fixes #10752 ### How should we test and review this PR? ### Additional information We're still subject to #13724 and fully load every manifest, even if we don't use it. I'm exploring that topic at https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/Redundant.20code.20in.20.60GitSouce.60.3F/near/450783427 This change builds on - #13993 - #14169 - #14231 - #14234
Problem
When using
cargo install --git
to install a package like cargo itself, a lot of warnings are emitted about duplicated packages. It seems that these packages are only used for the tests, and not sure if the warnings affect the final build.It seems that this is caused by this commit:
e903f7d
Steps
Try to build cargo with itself:
Possible Solution(s)
No response
Notes
No response
Version
The text was updated successfully, but these errors were encountered: