handle elided name in git package ID specs#253
Open
pushrax wants to merge 2 commits into
Open
Conversation
Per the package ID grammar, the suffix after `#` is `( pkgname | semver )`, so a bare semver with no `name@` prefix is valid for any source, not just `path`. Cargo emits this form for git deps whose crate name matches the repo's last URL path segment (e.g. `git+https://.../rayon#1.11.0`), which previously panicked on the missing `@`. Grammar reference: https://doc.rust-lang.org/cargo/reference/pkgid-spec.html#package-id-specifications-1
Member
|
Thanks for the PR! Could you provide a command to reproduce the panic? |
pushrax
commented
May 12, 2026
| return Ok(reader.data()); | ||
| } | ||
| Payload::CustomSection(reader) if reader.name() == ".dep-v0" => { | ||
| return Ok(reader.data()); |
Author
There was a problem hiding this comment.
unrelated to this PR, but clippy was failing in CI
Author
Here's an example repro: # Cargo.toml
[package]
name = "demo"
version = "0.1.0"
edition = "2021"
[dependencies]
rayon = { git = "https://github.com/rayon-rs/rayon" }
# add trivial main.rs$ cargo +nightly auditable build --release # CARGO_BUILD_SBOM not set: works
$ CARGO_BUILD_SBOM=true cargo +nightly auditable build --release -Z sbom
27.70 thread 'main' panicked at cargo-auditable/src/sbom_precursor.rs:195:18:
27.70 Package ID to have a name and version |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per the package ID grammar, the suffix after
#is( pkgname | semver ), so a bare semver with noname@prefix is valid for any source, not justpath.Cargo emits this form for git deps whose crate name matches the repo's last URL path segment (e.g.
git+https://.../rayon#1.11.0), which previously panicked on the missing@.Grammar reference:
https://doc.rust-lang.org/cargo/reference/pkgid-spec.html#package-id-specifications-1