flatpak / freedesktop-sdk-images

Flatpak freedesktop 1.6 runtime. Note: New development is at https://gitlab.com/freedesktop-sdk/freedesktop-sdk
29 stars 33 forks source link

appstream-util doesn't compare versions correctly #128

Closed scx closed 5 years ago

scx commented 5 years ago

It seems that appstream-util doesn't compare versions correctly, which leads to incorrect validation of AppData files.

$ appstream-util --version
Version:    0.7.13
$ appstream-util vercmp "Build 9half" "Build 10"
Build 9half > Build 10
$ appstream-util vercmp "Build 9.5" "Build 10"
Build 9.5 > Build 10
$ appstream-util vercmp "Build 9+" "Build 10"
Build 9+ > Build 10
$ appstream-util vercmp "Build 9a" "Build 10"
Build 9a > Build 10
$ appstream-util vercmp "Build 9" "Build 10"
Build 9 > Build 10
$ appstream-util vercmp "9half" "10"
9half > 10
$ appstream-util vercmp "9.5" "10"
9.5 > 10
$ appstream-util vercmp "9+" "10"
9+ > 10
$ appstream-util vercmp "9a" "10"
9a > 10
$ appstream-util vercmp "9" "10"
9 < 10

As you can see, only the last result is correct. The problem occurs in both Freedesktop 1.6 and 18.08.

Please compare this with the rpmdev-vercmp on RHEL 7:

$ rpm -q --qf "%{VERSION}\n" rpmdevtools
8.3
$ rpmdev-vercmp "Build 9half" "Build 10"
Build 9half < Build 10
$ rpmdev-vercmp "Build 9.5" "Build 10"
Build 9.5 < Build 10
$ rpmdev-vercmp "Build 9+" "Build 10"
Build 9+ < Build 10
$ rpmdev-vercmp "Build 9a" "Build 10"
Build 9a < Build 10
$ rpmdev-vercmp "Build 9" "Build 10"
Build 9 < Build 10
$ rpmdev-vercmp "9half" "10"
9half < 10
$ rpmdev-vercmp "9.5" "10"
9.5 < 10
$ rpmdev-vercmp "9+" "10"
9+ < 10
$ rpmdev-vercmp "9a" "10"
9a < 10
$ rpmdev-vercmp "9" "10"
9 < 10
TingPing commented 5 years ago

I see you already reported it in the correct place: https://github.com/hughsie/appstream-glib/issues/270

scx commented 5 years ago

I think you should consider temporarily disabling AppData validation, because currently the build will fail even if the data is correct.