rpm: Refine prefix matching for sub RPMs to reduce fragility#879
Merged
aiuto merged 3 commits intobazelbuild:mainfrom Sep 2, 2024
Merged
rpm: Refine prefix matching for sub RPMs to reduce fragility#879aiuto merged 3 commits intobazelbuild:mainfrom
aiuto merged 3 commits intobazelbuild:mainfrom
Conversation
The current prefix matching for sub RPMs can potentially fail in two ways: - if we have two overlapping prefixes we may match the shorter prefix against the wrong RPM - the shorter prefix will match repeatedly even after finding its target This change keeps track of which sub RPMs have already match so avoid double matching a shorter prefix. Additionally, we sort the sub RPM list by name length in reverse order. This ensures that we prefer to match the longest prefixes first and avoid double matching with the same prefix.
a17bf3d to
6ff64d5
Compare
Contributor
Author
|
This fixes #875 |
Collaborator
|
Can we add a test that verifies the behavior being fixed is fixed? |
aiuto
reviewed
Aug 13, 2024
Collaborator
aiuto
left a comment
There was a problem hiding this comment.
Looks good, but it could use a test.
Contributor
Author
Yes. I'll try to get back to that this week. |
This change expands the basic subrpm test to account for multiple subrpms that have matching prefixes.
Contributor
Author
Done |
cgrindel
approved these changes
Sep 1, 2024
Collaborator
|
LGTM. I will let @aiuto merge it after he has had a final look. |
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.
The current prefix matching for sub RPMs can potentially fail in two ways:
This change keeps track of which sub RPMs have already match so avoid
double matching a shorter prefix. Additionally, we sort the sub RPM
list by name length in reverse order. This ensures that we prefer to
match the longest prefixes first and avoid double matching with the
same prefix.
fixes: #875