Repository navigation
Conversation
gen-sbom printed a warning and recorded no build configuration when it could not read --options-h, so a typo in the path produced an SBOM with an empty configuration and a zero exit status. It now exits with the path and the OS error. The driver already rejects --lib together with --srcs-file. The CMake helper and sbom.mk now reject TARGETS with LIB (SBOM_SRCS with SBOM_LIB) themselves, so the mistake shows at configure time or before the driver runs instead of as a driver error from inside the sbom target. The helper also stops at configure time on a LIB left as <VAR>-NOTFOUND by a failed find_library(); next to TARGETS such a value used to be dropped silently. The driver's message for a missing checksum source now names all three options, and share/README.md says "pick one" where it said "at least one".
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused validation changes match the driver contract and include regression coverage, with no blocking issues identified in static review; tests were not executed.
No open issues 🎉
What changed in this PR
This PR tightens SBOM input validation so unreadable configuration files and conflicting checksum sources fail explicitly rather than produce misleading output.
Changes:
- Fail with the path and OS error when
--options-hcannot be read. - Reject conflicting composition inputs in CMake and Make, and reject unresolved CMake library paths.
- Clarify checksum-source guidance and add regression coverage.
| File | Description |
|---|---|
tests/test_sbom.py |
Tests missing-source diagnostics and conflicting Make inputs. |
tests/test_sbom_cmake_install.py |
Tests configure failures for conflicting inputs and unresolved libraries. |
tests/test_gen_sbom.py |
Tests failure when the options header is missing. |
share/sbom-driver.py |
Names all three checksum-source options in the diagnostic. |
share/README.md |
Clarifies that composition inputs are mutually exclusive. |
share/gen-sbom |
Exits with an error when the options header is unreadable. |
share/build/sbom.mk |
Rejects simultaneous source and library inputs. |
share/build/sbom.cmake |
Rejects conflicting inputs and unresolved library paths. |
Review effort: Balanced
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.
What
Two input mistakes that produced a misleading result now fail early.
--options-h: gen-sbom warned and wrote an SBOM with an empty build configuration and exit status 0. It now exits with the path and the OS error.TARGETSwithLIB: the driver already rejects--libwith--srcs-file. The CMake helper now rejectsTARGETSwithLIBat configure time, andsbom.mkrejectsSBOM_SRCSwithSBOM_LIBbefore calling the driver. ALIBleft as<VAR>-NOTFOUNDby a failedfind_library()now stops configure with "LIB was not found"; next toTARGETSit used to be dropped silently.share/README.mdsays "pick one" instead of "at least one" (the leftover nit from sbom: record a traced library, zlib, and explicit dependency versions #37).Tests
test_missing_file_exitsintest_gen_sbom.py, a configure-failure test intest_sbom_cmake_install.py(both set, and-NOTFOUNDwith and withoutTARGETS), and intest_sbom.pythe missing-source message plus thesbom.mkcheck throughmake.