Skip to content

Include SBOM outputs in fingerprints#17216

Merged
weihanglo merged 2 commits into
rust-lang:masterfrom
TorinAsakura:fix/sbom-fingerprint
Jul 16, 2026
Merged

Include SBOM outputs in fingerprints#17216
weihanglo merged 2 commits into
rust-lang:masterfrom
TorinAsakura:fix/sbom-fingerprint

Conversation

@TorinAsakura

@TorinAsakura TorinAsakura commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What does this PR try to resolve?

Cargo currently excludes SBOM outputs when calculating a unit fingerprint. After a build without SBOM, rebuilding the same unit with CARGO_BUILD_SBOM=true and -Zsbom can reuse the cached unit and leave the expected SBOM precursor missing.

This keeps the existing unit output and uplift path, but includes SBOM in the output set used for fingerprints so enabling SBOM invalidates the earlier build.

Close #15695

How to test and review this PR?

The regression test builds once without SBOM, enables it for the next build, and checks that the precursor appears in the top-level target output. The complete SBOM test module passes.

@rustbot rustbot added A-rebuild-detection Area: rebuild detection and fingerprinting S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 14, 2026
@rustbot

rustbot commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @ehuss (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue
Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ehuss, @epage, @weihanglo
  • @ehuss, @epage, @weihanglo expanded to ehuss, epage, weihanglo
  • Random selection from ehuss, epage, weihanglo

Comment thread tests/testsuite/sbom.rs

@weihanglo weihanglo Jul 14, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, we normally follow the pattern C-TEST described in this doc. The basic idea is that your first commit becomes a reproduction of the buggy behavior, and your second commit contains the diff that shows the behavior change. With that we can make sure we are not fixing a non-existing issue. Mind tweaking your git commits a bit?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this? 9beeb7b

@TorinAsakura
TorinAsakura force-pushed the fix/sbom-fingerprint branch from f44c0e6 to 9beeb7b Compare July 14, 2026 22:13
Comment thread tests/testsuite/sbom.rs
Comment on lines +109 to +112
p.cargo("build -Zsbom")
.env("CARGO_BUILD_SBOM", "true")
.masquerade_as_nightly_cargo(&["sbom"])
.run();

@weihanglo weihanglo Jul 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add .with_stderr_data(…) to assert something was actually recompiled?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you again follow the C-TEST pattern? Feel free to rebase and clean up history

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, sorry — I’m still getting used to the C-TEST convention. bd1b857

Comment thread tests/testsuite/sbom.rs Outdated
.masquerade_as_nightly_cargo(&["sbom"])
.run();

assert!(file.is_file());

@weihanglo weihanglo Jul 16, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we fire another CARGO_BUILD_SBOM=true cargo build to make sure the fingerprint working correctly and no surprising rebuild?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TorinAsakura
TorinAsakura force-pushed the fix/sbom-fingerprint branch from 54241b9 to bd1b857 Compare July 16, 2026 17:05

@weihanglo weihanglo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@weihanglo
weihanglo added this pull request to the merge queue Jul 16, 2026
Merged via the queue into rust-lang:master with commit bb20526 Jul 16, 2026
29 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 16, 2026
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jul 18, 2026
Update cargo submodule

29 commits in 59800466c5c41c444d264b1010b4d57e85a7117f..3efb1f477e99b42974b982d939fd100303cdf7db
2026-07-07 15:52:22 +0000 to 2026-07-17 23:53:19 +0000
- refactor(context): normalize in `homedir` instead (rust-lang/cargo#17222)
- chore(ci): reflect doc folder move in book deployment (rust-lang/cargo#17235)
- refactor(ops): Have cargo-metadata's ops match the command name (rust-lang/cargo#17233)
- chore: Flatten src (rust-lang/cargo#17231)
- chore: Flatten `src` (rust-lang/cargo#17230)
- chore(ci): remove stale libsecret packages (rust-lang/cargo#17229)
- perf: Lazily initialize git2 fetch transports  (rust-lang/cargo#17226)
- test(trim-paths): re-enable lldb debugger tests  (rust-lang/cargo#17223)
- Include SBOM outputs in fingerprints (rust-lang/cargo#17216)
- Update cfg_aliases to 0.2.2 (rust-lang/cargo#17225)
- test(trim-paths): exercise GDB on windows-gnu (rust-lang/cargo#17221)
- feat(profile): Disable incremental compilation under CI by default (rust-lang/cargo#17220)
- Remove myself from review rotation (rust-lang/cargo#17219)
- Fix typo in comment in sync (rust-lang/cargo#17217)
- docs(ref): Improve handing of built-in profiles (rust-lang/cargo#17213)
- fix: dont apply host-config gating to stable behavior (rust-lang/cargo#17198)
- chore(deps): update msrv (rust-lang/cargo#17192)
- test: fix race in cargo_compile_with_invalid_code_in_deps (rust-lang/cargo#17203)
- Rename `-Zno-embed-metadata` to `-Zembed-metadata=no` (rust-lang/cargo#17149)
- fix(source): incorrect duplicate package warning (rust-lang/cargo#17204)
- Fix manifest schema generation: `TomlDebugInfo` enum-variants doesn't renamed (rust-lang/cargo#17202)
- Reduce library search path length in new build dir layout (rust-lang/cargo#17191)
- fix(install): Move --debug to Compilation options (rust-lang/cargo#17199)
- chore(ci): dogfood `build.warnings` (rust-lang/cargo#17195)
- docs(lints): Better match clippy in lint section titles (rust-lang/cargo#17190)
- chore: bump to 0.100.0; update changelog (rust-lang/cargo#17189)
- docs(ref): Clarify MSRV for lints (rust-lang/cargo#17184)
- docs(report): add missing entry for `cargo report future-incompatibilities` (rust-lang/cargo#17188)
- Reduce rustc `-L` args used in the new `build-dir` layout (rust-lang/cargo#17168)
rust-bors Bot pushed a commit to rust-lang/rust that referenced this pull request Jul 18, 2026
Update cargo submodule

29 commits in 59800466c5c41c444d264b1010b4d57e85a7117f..3efb1f477e99b42974b982d939fd100303cdf7db
2026-07-07 15:52:22 +0000 to 2026-07-17 23:53:19 +0000
- refactor(context): normalize in `homedir` instead (rust-lang/cargo#17222)
- chore(ci): reflect doc folder move in book deployment (rust-lang/cargo#17235)
- refactor(ops): Have cargo-metadata's ops match the command name (rust-lang/cargo#17233)
- chore: Flatten src (rust-lang/cargo#17231)
- chore: Flatten `src` (rust-lang/cargo#17230)
- chore(ci): remove stale libsecret packages (rust-lang/cargo#17229)
- perf: Lazily initialize git2 fetch transports  (rust-lang/cargo#17226)
- test(trim-paths): re-enable lldb debugger tests  (rust-lang/cargo#17223)
- Include SBOM outputs in fingerprints (rust-lang/cargo#17216)
- Update cfg_aliases to 0.2.2 (rust-lang/cargo#17225)
- test(trim-paths): exercise GDB on windows-gnu (rust-lang/cargo#17221)
- feat(profile): Disable incremental compilation under CI by default (rust-lang/cargo#17220)
- Remove myself from review rotation (rust-lang/cargo#17219)
- Fix typo in comment in sync (rust-lang/cargo#17217)
- docs(ref): Improve handing of built-in profiles (rust-lang/cargo#17213)
- fix: dont apply host-config gating to stable behavior (rust-lang/cargo#17198)
- chore(deps): update msrv (rust-lang/cargo#17192)
- test: fix race in cargo_compile_with_invalid_code_in_deps (rust-lang/cargo#17203)
- Rename `-Zno-embed-metadata` to `-Zembed-metadata=no` (rust-lang/cargo#17149)
- fix(source): incorrect duplicate package warning (rust-lang/cargo#17204)
- Fix manifest schema generation: `TomlDebugInfo` enum-variants doesn't renamed (rust-lang/cargo#17202)
- Reduce library search path length in new build dir layout (rust-lang/cargo#17191)
- fix(install): Move --debug to Compilation options (rust-lang/cargo#17199)
- chore(ci): dogfood `build.warnings` (rust-lang/cargo#17195)
- docs(lints): Better match clippy in lint section titles (rust-lang/cargo#17190)
- chore: bump to 0.100.0; update changelog (rust-lang/cargo#17189)
- docs(ref): Clarify MSRV for lints (rust-lang/cargo#17184)
- docs(report): add missing entry for `cargo report future-incompatibilities` (rust-lang/cargo#17188)
- Reduce rustc `-L` args used in the new `build-dir` layout (rust-lang/cargo#17168)
@rustbot rustbot added this to the 1.99.0 milestone Jul 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-rebuild-detection Area: rebuild detection and fingerprinting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cargo fingerprint doesn't include SBOM

4 participants