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

Support fully-qualified --package arguments #3563

Closed
joshlf opened this issue Oct 2, 2024 · 3 comments · Fixed by #3593
Closed

Support fully-qualified --package arguments #3563

joshlf opened this issue Oct 2, 2024 · 3 comments · Fixed by #3593
Labels
[C] Bug This is a bug. Something isn't working. T-User Tag user issues / requests

Comments

@joshlf
Copy link

joshlf commented Oct 2, 2024

We use Kani in zerocopy, and pass --package zerocopy in CI. However, on our 0.7 branch, we are encountering this failure:

error: There are multiple `zerocopy` packages in your project, and the specification `zerocopy` is ambiguous.
Please re-run this command with one of the following specifications:
  path+file:///home/runner/work/zerocopy/zerocopy#0.7.35
  registry+https://github.com/rust-lang/crates.io-index#zerocopy@0.7.35
error: Failed to execute cargo (exit status: 101). Found 0 compilation errors.

This seems to be due to Kani having a transitive dependency on zerocopy 0.7. However, Kani does not support passing either suggested syntax as an argument to the --package flag. If Kani supported --package path+file:///home/runner/work/zerocopy/zerocopy#0.7.35, it would allow us to fix this failure.

@feliperodri feliperodri added T-User Tag user issues / requests [C] Bug This is a bug. Something isn't working. labels Oct 3, 2024
@feliperodri
Copy link
Contributor

Thank you for reporting this bug. We are trying to reproduce and investigate on our side.

@celinval
Copy link
Contributor

Hi @joshlf, I was able to reproduce the issue by cloning the version of the PR above, and this is indeed an issue with how we are handling the package argument.

FYI, the ambiguity seems to be coming from the rand package that is one of your dev-dependencies:

$ cargo tree | head -n 15
zerocopy v0.7.35 (/tmp/zerocopy)
└── byteorder v1.5.0
[dev-dependencies]
├── assert_matches v1.5.0
├── elain v0.3.0
├── itertools v0.11.0
│   └── either v1.13.0
├── rand v0.8.5
│   ├── libc v0.2.159
│   ├── rand_chacha v0.3.1
│   │   ├── ppv-lite86 v0.2.20
│   │   │   └── zerocopy v0.7.35  <------------------- Here!!

Running cargo build fails with the same issue:

$ cargo build --package zerocopy --features __internal_use_only_features_that_work_on_stable
error: There are multiple `zerocopy` packages in your project, and the specification `zerocopy` is ambiguous.
Please re-run this command with one of the following specifications:
  path+file:///tmp/zerocopy#0.7.35
  registry+https://github.com/rust-lang/crates.io-index#zerocopy@0.7.35

@joshlf
Copy link
Author

joshlf commented Oct 11, 2024

Ah yeah I suppose it's not actually Kani itself that has the zerocopy dep, but it's just that we need to be able to pass an unambiguous package spec via Kani.

Thanks for looking into this!

github-merge-queue bot pushed a commit that referenced this issue Oct 12, 2024
We were previously matching the name of the package, which would limit
users if the name is ambiguous.

Instead, use `cargo pkgid` to validate the `--package` argument and to
retrieve the package id.

Resolves #3563 

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 and MIT licenses.

---------

Co-authored-by: Zyad Hassan <88045115+zhassan-aws@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C] Bug This is a bug. Something isn't working. T-User Tag user issues / requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants