Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix regex for matching RPM packages with unorthodox vendor name #4726

Merged
merged 4 commits into from
Oct 29, 2024

Conversation

VasilSirakov
Copy link
Contributor

@VasilSirakov VasilSirakov commented Oct 8, 2024

Fixes #4714

SuSE's vendor name changed for some reason from SUSE LLC to SUSE LLC <https://www.suse.com/> which no longer matched the regex pattern.

In this PR:

  • Added /, :, < and > as allowed characters in the vendor regex pattern.
  • Cleaned up vendor name after the fact and removed this tag at the earliest opportunity. It is not particularly useful and was causing trouble with CPEs generation.
    • Used regex to remove any string of characters from the vendor name between a closed pair of angle brackets <...>. That way, we are agnostic as to what the contents of this tag are and we do not hardcode some arbitrary string which may change in the future. This assumes that angle brackets are not used in some other way in the vendor name which I think is a fair assumption given that this is an edge case.
  • Added unit tests to verify that the packages are correctly parsed and the regex trims out the tag correctly.

Manually tested this on a VM running SuSE 15.6 and packages.list produces a correct output:
image

@chris-rock Let me know in case any of my assumptions are invalid and you'd like to handle this differently.

@VasilSirakov VasilSirakov marked this pull request as ready for review October 8, 2024 12:20
@VasilSirakov VasilSirakov force-pushed the vasil/fix-suse-vendor-regex branch from 8073fde to a36a9d6 Compare October 25, 2024 12:41
Copy link
Contributor

github-actions bot commented Oct 25, 2024

Test Results

3 137 tests  +2   3 136 ✅ +2   1m 20s ⏱️ -15s
  371 suites ±0       1 💤 ±0 
   28 files   ±0       0 ❌ ±0 

Results for commit ade8719. ± Comparison against base commit 4e1406a.

♻️ This comment has been updated with latest results.

@VasilSirakov
Copy link
Contributor Author

@chris-rock Let me know in case I should review this with someone else.

@chris-rock
Copy link
Member

@VasilSirakov work with @czunker on this PR

@chris-rock chris-rock requested a review from czunker October 29, 2024 07:58
@VasilSirakov VasilSirakov force-pushed the vasil/fix-suse-vendor-regex branch from 7038b1d to ade8719 Compare October 29, 2024 10:28
Copy link
Contributor

@czunker czunker left a comment

Choose a reason for hiding this comment

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

Thanks @VasilSirakov

@VasilSirakov VasilSirakov merged commit d6d1f67 into main Oct 29, 2024
15 checks passed
@VasilSirakov VasilSirakov deleted the vasil/fix-suse-vendor-regex branch October 29, 2024 11:01
@github-actions github-actions bot locked and limited conversation to collaborators Oct 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Linux: os.packages resource doesn't return any data on SUSE 15 OS
3 participants