]> git.saurik.com Git - apt.git/blobdiff - apt-private/private-output.cc
Fix incorrect upgradable listing in "apt list" (thanks to Michael Musenbrock)
[apt.git] / apt-private / private-output.cc
index 158bd5c71a37fa22eb118d7d96f4395e94250771..2120b7a83674ddfb6db28a013565f4368f2daa5a 100644 (file)
@@ -118,7 +118,7 @@ static std::string GetFlagsStr(pkgCacheFile &CacheFile, pkgCache::PkgIterator P)
    std::string flags_str;
    if (state.NowBroken())
       flags_str = "B";
-   if (P.CurrentVer() && state.Upgradable())
+   if (P.CurrentVer() && state.Upgradable() && state.CandidateVer != NULL)
       flags_str = "g";
    else if (P.CurrentVer() != NULL)
       flags_str = "i";
@@ -220,7 +220,7 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records,        /*{{{*/
       output = SubstVar(output, "${Version}", GetVersion(CacheFile, V));
       output = SubstVar(output, "${Description}", GetShortDescription(CacheFile, records, P));
       output = SubstVar(output, "${Origin}", GetArchiveSuite(CacheFile, V));
-      out << output << std::endl;
+      out << output;
    } else {
       // raring/linux-kernel version [upradable: new-version]
       //    description
@@ -229,7 +229,11 @@ void ListSingleVersion(pkgCacheFile &CacheFile, pkgRecords &records,       /*{{{*/
       std::string CandidateVerStr = GetCandidateVersion(CacheFile, P);
       std::string InstalledVerStr = GetInstalledVersion(CacheFile, P);
       std::string StatusStr;
-      if(P.CurrentVer() == V && state.Upgradable()) {
+      if(P.CurrentVer() == V && 
+         state.Upgradable() &&
+         state.CandidateVer != NULL &&
+         policy->GetCandidateVer(P) != P.CurrentVer())
+      {
          strprintf(StatusStr, _("[installed,upgradable to: %s]"),
                    CandidateVerStr.c_str());
       } else if (P.CurrentVer() == V) {