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

Use proper version comparisions for querys #1065

Closed
wants to merge 0 commits into from

Conversation

russelltg
Copy link
Contributor

@russelltg russelltg commented Apr 22, 2022

Fixes package queries using string comparion instead of version comparaision

Requirements

All new code should be covered with tests, documentation should be updated. CI should pass.

Description of the Change

String comparision is not proper for version comparision!

Checklist

  • unit-test added (if change is algorithm)
  • functional test added/updated (if change is functional) -- if this is needed, it would be great to get some instructions
  • man page updated (if applicable) N/A I beleive, bugfix
  • bash completion updated (if applicable) N/A
  • documentation updated N/A
  • author name in AUTHORS

@randombenj randombenj self-requested a review April 25, 2022 08:10
@randombenj
Copy link
Contributor

Thanks for the changes! I would agree that string version comparison is not the right way to go. However, the code (ae3c98c) has been in aptly for 8 years like this! I am a bit hesitant to merge this as it might break some random things ... Did you encounter any specific issues with the string version comparison?

@russelltg
Copy link
Contributor Author

russelltg commented Apr 26, 2022

Yes, I was trying to write a script to remove all versions less than the most recent version minus some number, and the subtracted number had less digits so it ended up removing many versions higher than expected (for example, with that string compassion, versions 2 > 10). That test I included fails before my changes

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.

2 participants