[pacman-dev] vercmp discussion (was: String freeze for 3.2 release)
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 :
> 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.
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.
More information about the pacman-dev