Repository navigation
fix: a component of emit sbom states the package, not the lock's spelling of it - #894
Open
NopeCharon wants to merge 1 commit into
Open
NopeCharon wants to merge 1 commit into
NopeCharon wants to merge 1 commit into
Conversation
…elling of it The bill of materials copied a lock entry's name into the component's name, bom-ref and purl, and that name is a spelling: the map key of the declaring manifest, or a qualified name for a package no manifest in view declares. `mcpplibs.cmdline` became pkg:mcpp/mcpplibs/mcpplibs.cmdline@0.0.1 while `cmdline` gave pkg:mcpp/mcpplibs/cmdline@0.0.1 for the same package, and compat.zlib became pkg:mcpp/compat/compat.zlib@1.3.2. A purl is what correlates a component with an advisory feed, so one package needs one. records.cpp already knew the identity through lock_short_name. It moves to mcpp.pm.lock_io as short_name so the two readers share it; the lock's text and the comparisons records.cpp makes do not change. A purl also percent-encodes its segments now, so `+` in a version's build metadata or in a variant's `+p<digest>` is written %2B. The `version` field stays as recorded. A variant keeps its digest in the name, since a patched library is another library. A lock written by 2026.9.29.1 to .5 can hold one identity under two spellings. Those would now share a bom-ref, which is unique in a document, so they give one component. Tests: tests/e2e/1016 writes the lock by hand and needs no toolchain or network. PmLockIo.TheShortNameIsTheSameWhicheverWayTheManifestSpelledIt covers the function. docs/51 states the rule in both languages. Closes mcpp-community#892
This branch has not been deployed
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.
Summary
mcpp emit sbomcopied a lock entry's name into the component'sname,bom-refandpurl, and that name is a spelling: the map key of the declaring manifest, or a qualified name for a package no manifest in view declares. Somcpplibs.cmdlinebecamepkg:mcpp/mcpplibs/mcpplibs.cmdline@0.0.1whilecmdlinegavepkg:mcpp/mcpplibs/cmdline@0.0.1for the same package, andcompat.zlibbecamepkg:mcpp/compat/compat.zlib@1.3.2. A purl is what correlates a component with an advisory feed, so one package needs one.nameandpurlnow use the short name.lock_short_namemoves fromrecords.cpptomcpp.pm.lock_ioasshort_name, so the two readers share it;records.cppbehaves as before.+in build metadata or in a variant's+p<digest>is%2B. Theversionfield stays as recorded.bom-ref, which is unique in a document, so they give one component.docs/51-supported-versions.mdstates the rule in both languages.Closes #892.
Criteria
tests/e2e/1016_the_bill_of_materials_states_a_packages_identity.sh(new) writes the lock by hand, so it needs no toolchain, index or network. It fails on the released 2026.11.5.1 macOS arm64 binary, at('mcpplibs', 'mcpplibs.cmdline'). No build of the whole engine was possible on the host I had, so the passing run was on macOS arm64 against the realsrc/cli/cmd_sbom.cppm,src/pm/lock_io.cppmandmodules/libs/src/toml.cppmcompiled together, with stubs for the manifest loader and the CLI around them. That setup fails the script before the change and passes it after. On a real build it passed on this PR'slinux-e2ejob (linux x86_64, self-host), as did333_named_runners_locked_and_sbom.shand1001_a_dependency_carries_its_patches.sh.PmLockIo.TheShortNameIsTheSameWhicheverWayTheManifestSpelledIt(tests/unit/test_pm_lock_io.cpp) covers the moved function. Its assertions ran against the reallock_ioon the same setup, 0 failures, and the unit jobs in CI pass.src/build/prepare/records.cppdid not compile locally against the moved function. Thebuild-*jobs compile it on every host and pass.linux-e2e / e2e 2/6, on1013_optional_action_progress_preserves_outputs.shalone. That test drives terminal progress output through a pty duringmcpp build, and this change touches no code it exercises. The same test passed in the same shard on fix: a missing mcpp.lock is named byemit sbomand--locked#893, which branches from the same commit. It looks timing-dependent, though I have not shown that; I cannot re-run the job from a fork, so a maintainer's re-run would settle it.check_docs_style.sh,check_docs_structure.sh,check_version_pins.sh,check_file_lengths.sh,check_reason_tokens.sh,check_workflow_assertions.pypass locally.Intersections
nameandpurluse the short namezlibrows of e2e 1016acme.toolrow of e2e 1016, the last-but-one case of the unit testversionfield reads as the lock recorded it11.0.0+7and root0.1.0+7assertions of e2e 1016short_namemoves tolock_io--locked's comparison--lockeddrift in e2e 333Compatibility
A project whose lock spells a package with its namespace, or whose versions carry
+, sees differentname,bom-refandpurlvalues in its bill of materials. A consumer that stored the old doubled purls will not match the new ones.mcpp.lockitself, cache keys and every other command are unchanged.Checks before merging
bash .github/tools/check_docs_style.sh,check_docs_structure.shandcheck_version_pins.shpass.python3 .github/tools/check_workflow_assertions.pypasses (a step asserts what its name says).git log origin/main..HEAD -i --grep='Co-Authored-By'prints nothing.compose one from the branch's commits. Suggested subject:
fix: a component ofemit sbomstates the package, not the lock's spelling of it.