Przeglądaj źródła

Merge remote-tracking branch 'mvo/bugfix/apt-list-rc-pkgs' into debian/sid

Michael Vogt 12 lat temu
rodzic
commit
473ccfb945

+ 7 - 1
apt-private/private-cacheset.cc

@@ -73,7 +73,13 @@ bool GetLocalitySortedVersionSet(pkgCacheFile &CacheFile,
       else 
       else 
       {
       {
          pkgPolicy *policy = CacheFile.GetPolicy();
          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();
    progress.Done();

+ 4 - 0
apt-private/private-output.cc

@@ -146,6 +146,10 @@ static std::string GetArchitecture(pkgCacheFile &CacheFile, pkgCache::PkgIterato
    pkgCache::VerIterator inst = P.CurrentVer();
    pkgCache::VerIterator inst = P.CurrentVer();
    pkgCache::VerIterator cand = policy->GetCandidateVer(P);
    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();
    return inst ? inst.Arch() : cand.Arch();
 }
 }
 									/*}}}*/
 									/*}}}*/

+ 5 - 0
test/integration/test-apt-cli-list

@@ -51,3 +51,8 @@ bar/now 1.0 i386 [installed,local]
   an autogenerated dummy bar=1.0/installed
   an autogenerated dummy bar=1.0/installed
 " apt list bar --verbose
 " apt list bar --verbose
 
 
+# test for dpkg ^rc state
+insertinstalledpackage 'conf-only' 'i386' '1.0' '' '' 'deinstall ok config-files'
+testequal "Listing...
+conf-only/now 1.0 i386 [residual-config]" apt list conf-only
+