This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 811992 - Comparison of NVRs with release containing some non-numeric characters works surprisingly
Comparison of NVRs with release containing some non-numeric characters works ...
Status: CLOSED WONTFIX
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
23
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: packaging-team-maint
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-12 09:26 EDT by Honza Horak
Modified: 2016-03-11 08:34 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-03-11 08:34:36 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Honza Horak 2012-04-12 09:26:01 EDT
Description of problem:
When we have a release number, that contains some non-numeric characters, then comparison of two NVRs works differently than I'd expect.

Version-Release number of selected component (if applicable):
$ rpm -q rpmdevtools
rpmdevtools-8.2-1.fc16.noarch

How reproducible:
every-time

Steps to Reproduce:
1. rpmdev-vercmp p-1-1.fc17-x86_64 p-1-1b.fc17-x86_64
2. rpmdev-vercmp p-1-1.fc17-x86_64 p-1-1p.fc17-x86_64
  
Actual results:
p-1-1.fc17-x86_64 > p-1-1b.fc17-x86_64
p-1-1.fc17-x86_64 < p-1-1p.fc17-x86_64

Expected results:
p-1-1.fc17-x86_64 < p-1-1b.fc17-x86_64
p-1-1.fc17-x86_64 < p-1-1p.fc17-x86_64

Additional info:
It seems characters a-f behaves differently than others. I really don't get this behaviour:

$ rpmdev-vercmp p-1-1.fc17-x86_64 p-1-1zz.fc17-x86_64
p-1-1.fc17-x86_64 < p-1-1zz.fc17-x86_64

$ rpmdev-vercmp p-1-1.fc17-x86_64 p-1-1az.fc17-x86_64
p-1-1.fc17-x86_64 > p-1-1az.fc17-x86_64

$ rpmdev-vercmp p-1-1.fc17-x86_64 p-1-1za.fc17-x86_64
p-1-1.fc17-x86_64 < p-1-1za.fc17-x86_64
Comment 1 Ville Skyttä 2012-04-12 15:32:24 EDT
First, strictly speaking your examples are not valid -- rpmdev-vercmp takes (Epoch:)Version-Release strings as arguments, you're feeding it Name-Version-Release-Arch strings.  It doesn't seem to affect the outcome of the test cases though.

$ rpmdev-vercmp 1-1.fc17 1-1b.fc17
1-1.fc17 > 1-1b.fc17
$ rpmdev-vercmp 1-1.fc17 1-1p.fc17
1-1.fc17 < 1-1p.fc17

Anyway, this comes directly from rpm-python, reassigning to rpm:

$ python
>>> import rpm
>>> rpm.labelCompare((None, "1", "1.fc17"), (None, "1", "1b.fc17"))
1
>>> rpm.labelCompare((None, "1", "1.fc17"), (None, "1", "1p.fc17"))
-1

Just a hunch, if it's a-f characters that are behaving differently than others, maybe they're being interpreted as hex digits somewhere?
Comment 2 Panu Matilainen 2012-04-13 03:11:00 EDT
Heh, interesting corner-case. It's not interpreting as hex though, what's mixing things up is the dist tag. Here's what happens (some debug output added):

[pmatilai@localhost rpm]$ ./rpm --eval '%{lua:print(rpm.vercmp("1.fc17","1a.fc17"))}'
rpmvercmp: 1 - 1, isnum 1
rpmvercmp: fc - a, isnum 0
1
[pmatilai@localhost rpm]$ ./rpm --eval '%{lua:print(rpm.vercmp("1.fc17","1g.fc17"))}'
rpmvercmp: 1 - 1, isnum 1
rpmvercmp: fc - g, isnum 0
-1

rpmvercmp() works by looping through the version strings, seeking for all-numeric or all-alphabetic "segments" and comparing those. Any alphabet <-> digit character class change in a version string is a segment break. While a dot also is a segment break, it doesn't have any special "grouping" effect in the sense that one might expect here.

I guess I'll take this up on rpm-maint to see what others think, it does look "obviously wrong" but changing rpmvercmp() is fairly risky business, this behavior is more than a decade old AFAICS.
Comment 3 Ondrej Vasik 2012-04-13 04:02:11 EDT
Yep, version compare is quite tricky, it's hard to get expected results for all cases, I remember all the issues when we were doing that for 'sort' and 'ls' utility version compare. At least 3 or 4 implementation (Debian has it's own, rpm it's own, gnulib has two (strverscmp(), filevercmp() ) - strverscmp() is close to the rpm one, filevercmp() is hopefully identical to the Debian one (and different from the output expected by reported btw.) )
Comment 4 Fedora End Of Life 2013-01-16 12:03:15 EST
This message is a reminder that Fedora 16 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 16. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '16'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 16's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 16 is end of life. If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora, you are encouraged to click on 
"Clone This Bug" and open it against that version of Fedora.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Comment 5 Ville Skyttä 2013-01-19 08:57:18 EST
rpm-4.11.0-0.beta1.1.fc19.x86_64 has the same results for tests in comment 2.
Comment 6 Fedora End Of Life 2013-04-03 13:06:21 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 19 development cycle.
Changing version to '19'.

(As we did not run this process for some time, it could affect also pre-Fedora 19 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 19 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora19
Comment 7 Fedora End Of Life 2015-01-09 12:06:45 EST
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.
Comment 8 Fedora End Of Life 2015-02-17 09:13:08 EST
Fedora 19 changed to end-of-life (EOL) status on 2015-01-06. Fedora 19 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.
Comment 9 Ville Skyttä 2015-03-23 11:22:21 EDT
rpm-4.12.0.1-8.fc23.x86_64 still behaves as in comment 2.
Comment 10 Jan Kurik 2015-07-15 11:10:05 EDT
This bug appears to have been reported against 'rawhide' during the Fedora 23 development cycle.
Changing version to '23'.

(As we did not run this process for some time, it could affect also pre-Fedora 23 development
cycle bugs. We are very sorry. It will help us with cleanup during Fedora 23 End Of Life. Thank you.)

More information and reason for this action is here:
https://fedoraproject.org/wiki/BugZappers/HouseKeeping/Fedora23
Comment 11 Florian Festi 2016-03-11 08:34:36 EST
OK, while this is confusing, we just can't change the way version compare is done. The way to solve this would be to introduce a new rpm tag as a new home of the dist tag. But this is another story for another time.

Note You need to log in before you can comment on or make changes to this bug.