[pacman-dev] vercmp discussion (was: String freeze for 3.2 release)

Xavier shiningxc at gmail.com
Fri Jul 18 07:54:41 EDT 2008

On Fri, Jul 18, 2008 at 3:14 AM, Dan McGee <dpmcgee at gmail.com> wrote:
> I'll admit defeat, I tried. :)
> Can someone put together a single revert patch to take care of this? I
> know it took us at least two commits to get the vercmp code updated,
> so we will probably need to do some manual work to get this reverted.
> Obviously the vercmptest script should stay, and perhaps we should add
> the proposed tests from Nagy to the mix.
> If people do see any improvements that can be "backported" to the
> previous code, that would be good to have.

I just looked a bit at the history of rpmvercmp function, in the git repo :

So the rpmvercmp in 4.0.4 (which I finally found here :
) is the same as the version from 2002 in that git repo :

And then very little changed between 2002 and now :

There were some slight behavior changes, but not much, and our code
diverted enough that they don't seem to be relevant.
Anyway, again, our usage is different, so we should only care about
problems we have with our version schemes, not their. Otherwise we are
going to fix irrelevant cases, and risk breaking the relevant ones.

Though I found one fix which is interesting :
        /* if they are equal because there might be more segments to */
        /* compare */
        rc = strcmp(one, two);
-       if (rc) return rc;
+       if (rc) return (rc < 1 ? -1 : 1);

Anyway my proposal is to just copy/paste the good old working vercmp
code we had, with only the above fix.

More information about the pacman-dev mailing list