tags 351056 + patch thanks This patch should fix the bug. Previously, pkgCacheGenerator::MergeList() would stop when it found a Version less than or equal to the one being added, but if the hashes didn't match at first, it would always add a new Version, even if there was a Version with a matching Hash. My patch loops until a matching Version and Hash is found *or* the new version is greater than the remaining old ones, which makes the second loop unnecessary.
-- Magnus Holmgren [EMAIL PROTECTED]
--- apt-0.7.6/apt-pkg/pkgcachegen.cc.orig 2007-08-03 19:45:20.851846032 +0200 +++ apt-0.7.6/apt-pkg/pkgcachegen.cc 2007-08-03 21:03:13.866123155 +0200 @@ -161,17 +161,17 @@ pkgCache::VerIterator Ver = Pkg.VersionList(); map_ptrloc *LastVer = &Pkg->VersionList; + unsigned long Hash = List.VersionHash(); int Res = 1; for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++) { Res = Cache.VS->CmpVersion(Version,Ver.VerStr()); - if (Res >= 0) + if (Res > 0 || (Res == 0 && Ver->Hash == Hash)) break; } /* We already have a version for this item, record that we saw it */ - unsigned long Hash = List.VersionHash(); if (Res == 0 && Ver->Hash == Hash) { if (List.UsePackage(Pkg,Ver) == false) @@ -193,17 +193,6 @@ continue; } - // Skip to the end of the same version set. - if (Res == 0) - { - for (; Ver.end() == false; LastVer = &Ver->NextVer, Ver++) - { - Res = Cache.VS->CmpVersion(Version,Ver.VerStr()); - if (Res != 0) - break; - } - } - // Add a new version *LastVer = NewVersion(Ver,Version,*LastVer); Ver->ParentPkg = Pkg.Index();
pgpjhfk3fjFSF.pgp
Description: PGP signature