Add a failing test for sibling copyright lookup - #253
Draft
hakandilek wants to merge 1 commit into
Draft
Conversation
Urist-McGit
self-requested a review
August 4, 2026 07:05
Contributor
Author
|
@Urist-McGit I'm not really sure about this one yet. I just need to make a through analysis to figure out if there are valid examples of that. I'll create an issue once I've some data. |
Collaborator
|
If a binary package does not distribute its copyright files this seems like a packaging bug. Does this actually occur? |
hakandilek
force-pushed
the
fix/sibling-copyright-lookup
branch
from
August 13, 2026 07:14
1f6c5e5 to
9c970b7
Compare
Copyright lookup marks a source as processed before checking whether the first binary's copyright path resolves. A broken --link-doc symlink therefore prevents fallback to a sibling with an available copyright file. Use a dangling documentation link for the failing SPDX regression and add passing coverage for the normal resolvable-link case. Signed-off-by: Hakan Dilek <hakandilek@gmail.com>
hakandilek
force-pushed
the
fix/sibling-copyright-lookup
branch
from
August 13, 2026 08:08
9c970b7 to
3c03228
Compare
Contributor
Author
You're right and this doesn't occur in Debian, at least I could not identify it in Trixie, so I've dropped that overall claim and adapted the PR description to the actual latent defect. I'm not sure if it should be addressed as bug, if then I'd file an issue as well. |
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.
Debsbom._add_copyright()marks a source package as processed before checking whether the selected binary's copyright path resolves, so only one binary is ever tried per source. If that binary's/usr/share/doc/<package>/copyrightdoes not resolve, the source loses its license information even when a sibling binary still provides one.src/debsbom/generate/generate.py:311:filter_binaries()preserves insertion order, which is the dpkg status order, so which binary claims the source is deterministic but unrelated to whether its copyright path resolves.Debian Policy §12.5 permits a binary's documentation directory to be a symbolic link to a same-source sibling it depends on, and debsbom resolves that correctly today because
Path.is_file()follows symbolic links. The defect surfaces when such a link no longer resolves in the scanned root filesystem, for example after documentation pruning or an independent rootfs extraction.Two SPDX fixtures cover this:
- tests/root/copyright-sibling: the first binary's doc link target was stripped; a sibling still ships the copyright file. This test currently fails (NOASSERTION instead of MIT) and demonstrates the defect.- tests/root/copyright-linked-doc: a normal, resolvable--link-docdirectory. This test passes and pins the Policy-compliant behaviour.The fix is to mark the source as processed only after the lookup succeeds, letting the loop try the remaining binaries:
The fix commit is intentionally left out of this PR, due to the ongoing discussion.