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

Dan McGee dpmcgee at gmail.com
Fri Jul 18 08:03:23 EDT 2008


On Fri, Jul 18, 2008 at 6:54 AM, Xavier <shiningxc at gmail.com> wrote:
> 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 :
> http://devel.linux.duke.edu/gitweb/?p=rpm.git;a=history;f=lib/rpmvercmp.c;h=0cdcc686608abc9de6115e7d4a6f7d8c0f2d8cad;hb=HEAD
>
> So the rpmvercmp in 4.0.4 (which I finally found here :
> http://ftp-stud.hs-esslingen.de/Mirrors/ftp.rpm.org/rpm/dist/rpm-4.0.x/rpm-4.0.4.tar.gz
> ) is the same as the version from 2002 in that git repo :
> http://devel.linux.duke.edu/gitweb/?p=rpm.git;a=blob;f=lib/rpmvercmp.c;hb=076a6e29c5c8a35a5f78ae2a15339d030cfe2fdf
>
> And then very little changed between 2002 and now :
> http://devel.linux.duke.edu/gitweb/?p=rpm.git;a=blobdiff;f=lib/rpmvercmp.c;h=0cdcc686608abc9de6115e7d4a6f7d8c0f2d8cad;hp=27969d47ead9576e091e0f8ba99d2e692a47c747;hb=HEAD;hpb=076a6e29c5c8a35a5f78ae2a15339d030cfe2fdf
>
> 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.

Ahh, yes. We do want vercmp to return -1, 1, or 0, and not negative,
positive, or 0. The old one didn't always do this.

-Dan




More information about the pacman-dev mailing list