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: improve version_compare to drop hashes #3566

Merged
merged 2 commits into from
Dec 11, 2023
Merged

Conversation

terriko
Copy link
Contributor

@terriko terriko commented Dec 6, 2023

Currently version_compare rasies an error when it gets a hash, since we can't really compare those without more knowledge of the product. This changes the code to silently drop hashes and similar distro markers from the end of versions, which should make our code more robust to real-life cases. We may also want to put in an error handler to log the versions we can't handle without halting the program, but this doesn't do that yet.

Fixes #3556

Currently version_compare rasies an error when it gets a hash, since we
can't really compare those without more knowledge of the product. This
changes the code to silently drop hashes and similar distro markers from
the end of versions, which should make our code more robust to real-life
cases.  We may also want to put in an error handler to log the versions
we can't handle without halting the program, but this doesn't do that
yet.

Signed-off-by: Terri Oda <terri@toybox.ca>
Signed-off-by: Terri Oda <terri@toybox.ca>
@codecov-commenter
Copy link

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (489a849) 78.00% compared to head (c1ead57) 78.29%.
Report is 2 commits behind head on main.

Files Patch % Lines
cve_bin_tool/version_compare.py 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3566      +/-   ##
==========================================
+ Coverage   78.00%   78.29%   +0.28%     
==========================================
  Files         761      763       +2     
  Lines       11572    11587      +15     
  Branches     1359     1360       +1     
==========================================
+ Hits         9027     9072      +45     
+ Misses       2123     2098      -25     
+ Partials      422      417       -5     
Flag Coverage Δ
win-longtests 78.29% <88.88%> (+0.28%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@terriko terriko merged commit 46c6819 into intel:main Dec 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

fix: CannotParseVersionException: version string = 0.0.0.20190813141303.74dc4d7220e7
3 participants