diff options
Diffstat (limited to 'apt-private')
-rw-r--r-- | apt-private/private-cacheset.cc | 8 | ||||
-rw-r--r-- | apt-private/private-output.cc | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/apt-private/private-cacheset.cc b/apt-private/private-cacheset.cc index 4a63c7e81..e37e7b227 100644 --- a/apt-private/private-cacheset.cc +++ b/apt-private/private-cacheset.cc @@ -73,7 +73,13 @@ bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile, else { pkgPolicy *policy = CacheFile.GetPolicy(); - output_set.insert(policy->GetCandidateVer(P)); + if (policy->GetCandidateVer(P).IsGood()) + output_set.insert(policy->GetCandidateVer(P)); + else + // no candidate, this may happen for packages in + // dpkg "deinstall ok config-file" state - we pick the first ver + // (which should be the only one) + output_set.insert(P.VersionList()); } } progress.Done(); diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index bbd8545ad..757999167 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -146,6 +146,10 @@ static std::string GetArchitecture(pkgCacheFile &CacheFile, pkgCache::PkgIterato pkgCache::VerIterator inst = P.CurrentVer(); pkgCache::VerIterator cand = policy->GetCandidateVer(P); + // this may happen for packages in dpkg "deinstall ok config-file" state + if (inst.IsGood() == false && cand.IsGood() == false) + return P.VersionList().Arch(); + return inst ? inst.Arch() : cand.Arch(); } /*}}}*/ |