[Rpm-maint] [rpm-software-management/rpm] bad version comparison in all rpm (#896)

Alexander Stefanov notifications at github.com
Mon Oct 14 14:13:13 UTC 2019


example

#include <iostream>
#include <stdint.h>
#include <rpm/rpmlib.h>

```
int main() {
  const char * version1 = "0.13-5";
  const char * version2 = "0.13.1-5";

  int result = rpmvercmp(version1, version2);
  if (result == -1)
    std::cout << version1 << " < " << version2 << std::endl;;
  if (result == 0)
    std::cout << version1 << " = " << version2 << std::endl;;
  if (result == 1)
    std::cout << version1 << " > " << version2 << std::endl;;
}
```
```
# g++ shit.cc -lrpm
# ./a.out
```
result: **0.13-5** > 0.13.1-5
What is definetly wrong.
Same in RPM5.


but
```
# rpmdev-vercmp 0.13-5 0.13.1-5
# 0.13-5 < 0.13.1-5
```
works fine


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/896
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20191014/71864833/attachment.html>


More information about the Rpm-maint mailing list