9

We have a web app we package into an RPM. We have a problem with the version field of the RPM.

Let's say we have installed our rpm: foo-2.1.0.007

007 is our build number.

Now when we try to install a newer rpm, foo-2.1.0.010, yum says "There's nothing to update".

When I've remade the RPMs, but removed the leading zeroes, the problem was solved:

foo-2.1.0.7

foo-2.1.0.10

According to this link each segment of the version is compared as an integer, but practice shows otherwise.

So my question is: What is the version comparison algorithm for RPM and why leading zeroes interfere?

Asaf Mesika
  • 1,643
  • 4
  • 20
  • 33

1 Answers1

18

Yum just asks rpm to compare them. You can install rpmdevtools, and you then use:

% rpmdev-vercmp foo-2.1.0.010 foo-2.1.0.007
0:foo-2.1.0.010 is newer

...which is what you'd expect. Unless you have an epoch in the 007 package, I'm not sure why you are getting a different answer. What version of rpm do you have? What does vercmp say for you?

James Antill
  • 2,825
  • 18
  • 16
  • I have no idea how, but now everything works as expected, meaning 010 is installed on top of 007. Weird – Asaf Mesika Jun 24 '10 at 12:14
  • 1
    Thanks, allowed me to figure out that RPM really does think that 0.901 is newer than 0.92 but not 0.920. Obviously compares dotted integers rather than decimal numbers. – theory Aug 29 '12 at 18:00
  • The architecture (`noarch`, `x86_64`, etc.) seems to play some role in Yum's decision as to whether a version is newer or not, but not RPM's. – kbolino Feb 13 '20 at 18:46