summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2015-08-26 23:55:13 +0200
committerJulian Andres Klode <jak@debian.org>2015-08-27 11:05:28 +0200
commita6deb7a0ea70e945dfd750d1bdc1b783b187873e (patch)
tree2441f8304593db34a1b184c2bd8370033719f075
parent05c001c8dbcf327a77f1e4183900cad9b321d3f9 (diff)
Fix more instances of missing remapping handling
After fixing Bug#796999, we noticed that there were some more instances of iterators which had no associated Dynamic object, causing them to not be updated when the cache was remapped. This happened in two places: In NewPackage() and in NewProvidesAllArch(). Gbp-Dch: ignore
-rw-r--r--apt-pkg/pkgcachegen.cc29
1 files changed, 22 insertions, 7 deletions
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 3cbb96a6b..76c2f0074 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -572,21 +572,31 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name
if (APT::Configuration::checkArchitecture(Pkg.Arch()) == true)
{
pkgCache::PkgIterator const M = Grp.FindPreferredPkg(false); // native or any foreign pkg will do
- if (M.end() == false)
- for (pkgCache::PrvIterator Prv = M.ProvidesList(); Prv.end() == false; ++Prv)
+ if (M.end() == false) {
+ pkgCache::PrvIterator Prv;
+ Dynamic<pkgCache::PrvIterator> DynPrv(Prv);
+ for (Prv = M.ProvidesList(); Prv.end() == false; ++Prv)
{
if ((Prv->Flags & pkgCache::Flag::ArchSpecific) != 0)
continue;
pkgCache::VerIterator Ver = Prv.OwnerVer();
+ Dynamic<pkgCache::VerIterator> DynVer(Ver);
if ((Ver->MultiArch & pkgCache::Version::Allowed) == pkgCache::Version::Allowed ||
((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign &&
(Prv->Flags & pkgCache::Flag::MultiArchImplicit) == 0))
if (NewProvides(Ver, Pkg, Prv->ProvideVersion, Prv->Flags) == false)
return false;
}
+ }
+
+
+ pkgCache::PkgIterator P;
+ pkgCache::VerIterator Ver;
+ Dynamic<pkgCache::PkgIterator> DynP(P);
+ Dynamic<pkgCache::VerIterator> DynVer(Ver);
- for (pkgCache::PkgIterator P = Grp.PackageList(); P.end() == false; P = Grp.NextPkg(P))
- for (pkgCache::VerIterator Ver = P.VersionList(); Ver.end() == false; ++Ver)
+ for (P = Grp.PackageList(); P.end() == false; P = Grp.NextPkg(P))
+ for (Ver = P.VersionList(); Ver.end() == false; ++Ver)
if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign)
if (NewProvides(Ver, Pkg, Ver->VerStr, pkgCache::Flag::MultiArchImplicit) == false)
return false;
@@ -1075,7 +1085,9 @@ bool pkgCacheGenerator::NewProvides(pkgCache::VerIterator &Ver,
bool pkgCacheListParser::NewProvidesAllArch(pkgCache::VerIterator &Ver, string const &Package,
string const &Version, uint8_t const Flags) {
pkgCache &Cache = Owner->Cache;
- pkgCache::GrpIterator const Grp = Cache.FindGrp(Package);
+ pkgCache::GrpIterator Grp = Cache.FindGrp(Package);
+ Dynamic<pkgCache::GrpIterator> DynGrp(Grp);
+
if (Grp.end() == true)
return NewProvides(Ver, Package, Cache.NativeArch(), Version, Flags);
else
@@ -1089,8 +1101,11 @@ bool pkgCacheListParser::NewProvidesAllArch(pkgCache::VerIterator &Ver, string c
bool const isImplicit = (Flags & pkgCache::Flag::MultiArchImplicit) == pkgCache::Flag::MultiArchImplicit;
bool const isArchSpecific = (Flags & pkgCache::Flag::ArchSpecific) == pkgCache::Flag::ArchSpecific;
- pkgCache::PkgIterator const OwnerPkg = Ver.ParentPkg();
- for (pkgCache::PkgIterator Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
+ pkgCache::PkgIterator OwnerPkg = Ver.ParentPkg();
+ Dynamic<pkgCache::PkgIterator> DynOwnerPkg(OwnerPkg);
+ pkgCache::PkgIterator Pkg;
+ Dynamic<pkgCache::PkgIterator> DynPkg(Pkg);
+ for (Pkg = Grp.PackageList(); Pkg.end() == false; Pkg = Grp.NextPkg(Pkg))
{
if (isImplicit && OwnerPkg == Pkg)
continue;