On Fri, Jul 18, 2008 at 6:54 AM, Xavier <shiningxc@gmail.com> wrote:
On Fri, Jul 18, 2008 at 3:14 AM, Dan McGee <dpmcgee@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=...
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... ) 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=07...
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...
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