-
-
Notifications
You must be signed in to change notification settings - Fork 345
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 comparison of 1.0.0 to 1.0 #2817
Conversation
Uhm, now netkan translates it to:
|
Yikes, that's not good... EDIT: That happens here: CKAN/Netkan/Transformers/AvcTransformer.cs Lines 161 to 166 in cfa2893
This says, if the min is (numerically/logically) equal to the max, then put the min in It's very tricky to try to represent both points and ranges with the same type. |
Luckily |
I need to do some software archaeology to figure out whether it's wise to update the failing tests... EDIT: Rather than changing the core of the game version comparison logic, now we'll try a more modest change using |
d67ef63
to
6a186f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's much easier to review, thanks :)
Works and looks good!
Problem
The bot says Protractor doesn't match any game versions:
Cause
This module has an interesting .version file:
That
-1
is supposed to mean unbounded, so all 1.0 versions are included.Netkan translates this into:
Internally, CKAN models an undefined value as
-1
, and then blindly compares it to defined values here:CKAN/Core/Versioning/KspVersion.cs
Lines 736 to 756 in cfa2893
Since -1 is less than 0, the range between 1.0.0 and 1.0 is incorrectly determined to be empty here:
CKAN/Core/Types/GameComparator/StrictGameComparator.cs
Lines 26 to 36 in cfa2893
And no game versions are permitted to match, even though some of them are greater or equal to 1.0.0 and less than or equal to 1.0.
Changes
Now the
min <= max
check usesKspVersionRange
to determine whether it's looking at a non-empty interval rather than simply comparing theKspVersion
objects, since the latter operation cannot return meaningful, unambiguous values for less-or-equal. This will allow such modules to match their game versions properly.Considered and not done
We could have changed how version comparisons work when one has an undefined patch, but this would break many many tests, so I looked for another way.