sdkman / sdkman-cli

The SDKMAN! Command Line Interface
https://sdkman.io
Apache License 2.0
5.97k stars 629 forks source link

Bug: SDKMAN sorts patch versions in wrong order #1246

Closed Farbfetzen closed 8 months ago

Farbfetzen commented 8 months ago

Bug report

SDKMAN displays patch versions in the wrong order. Example with some Temurin versions where x.y.z.1 is listed below x.y.z:

21 20.0.2 20.0.1 17.0.8 17.0.8.1 17.0.7 17.0.6 17.0.5 17.0.4 17.0.4.1 17.0.3 17.0.2 11.0.20 11.0.20.1 11.0.19 11.0.16 11.0.16.1

I highlighted the affected versions. "17.0.8.1" is a patch for "17.0.8" and should therefore be listed before the other.

To reproduce

sdk list java

System info

mvitz commented 8 months ago

Same is true for most patch releases after the initial major version:

Available Java Versions for macOS 64bit
================================================================================
 Vendor        | Use | Version      | Dist    | Status     | Identifier
--------------------------------------------------------------------------------
 Corretto      |     | 21           | amzn    |            | 21-amzn
               |     | 21.0.1       | amzn    |            | 21.0.1-amzn
               |     | 20.0.2       | amzn    |            | 20.0.2-amzn
               |     | 20.0.1       | amzn    |            | 20.0.1-amzn

21.0.1 should be above 21.

I tried to find the server side repository of SDKMAN! to see how ordering is done and if I could provide a PR for fixing it but I couldn't find any repository that seems to include the API.

mvitz commented 8 months ago

Found the repository and there is already an open issue for this problem: https://github.com/sdkman/sdkman-candidates/issues/24

Farbfetzen commented 8 months ago

Thank you for the link to the other issue. I'm closing this one as it is a duplicate.