Fixed the infinite loop problem
authorArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:54:24 +0000 (16:54 +0000)
committerArch Librarian <arch@canonical.com>
Mon, 20 Sep 2004 16:54:24 +0000 (16:54 +0000)
Author: jgg
Date: 1999-07-30 02:54:25 GMT
Fixed the infinite loop problem

apt-pkg/algorithms.cc
apt-pkg/deb/deblistparser.cc
apt-pkg/pkgcache.cc
apt-pkg/pkgcache.h

index fed9b0b..d84ce2e 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: algorithms.cc,v 1.22 1999/07/20 05:53:33 jgg Exp $
+// $Id: algorithms.cc,v 1.23 1999/07/30 02:54:25 jgg Exp $
 /* ######################################################################
 
    Algorithms - A set of misc algorithms
@@ -340,6 +340,7 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache)
    
    // We loop indefinately to get the minimal set size.
    bool Change = false;
+   unsigned int Count = 0;
    do
    {
       Change = false;
@@ -348,16 +349,21 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache)
         // Not interesting
         if (Cache[I].Upgrade() == false || Cache[I].NewInstall() == true)
            continue;
-        
+
         // Keep it and see if that is OK
         Cache.MarkKeep(I);
         if (Cache.BrokenCount() != 0)
            Cache.MarkInstall(I,false);
         else
-           Change = true;
+        {
+           // If keep didnt actually do anything then there was no change..
+           if (Cache[I].Upgrade() == false)
+              Change = true;
+        }       
       }      
+      Count++;
    }
-   while (Change == true);
+   while (Change == true && Count < 10);
 
    if (Cache.BrokenCount() != 0)
       return _error->Error("Internal Error in pkgMinimizeUpgrade");
index 86cd526..59d15f7 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: deblistparser.cc,v 1.21 1999/07/26 17:46:08 jgg Exp $
+// $Id: deblistparser.cc,v 1.22 1999/07/30 02:54:25 jgg Exp $
 /* ######################################################################
    
    Package Cache Generator - Generator for the cache structure.
@@ -172,7 +172,7 @@ unsigned short debListParser::VersionHash()
      Status: want flag status
    want = unknown, install, hold, deinstall, purge
    flag = ok, reinstreq, hold, hold-reinstreq
-   status = not-installed, unpacked, half-configured, uninstalled,
+   status = not-installed, unpacked, half-configured,
             half-installed, config-files, post-inst-failed, 
             removal-failed, installed
    
@@ -231,7 +231,6 @@ bool debListParser::ParseStatus(pkgCache::PkgIterator Pkg,
                             {"unpacked",pkgCache::State::UnPacked},
                             {"half-configured",pkgCache::State::HalfConfigured},
                             {"installed",pkgCache::State::Installed},
-                            {"uninstalled",pkgCache::State::UnInstalled},
                             {"half-installed",pkgCache::State::HalfInstalled},
                             {"config-files",pkgCache::State::ConfigFiles},
                             {"post-inst-failed",pkgCache::State::HalfConfigured},
index b07c02a..9e7b0f3 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcache.cc,v 1.27 1999/07/26 17:46:07 jgg Exp $
+// $Id: pkgcache.cc,v 1.28 1999/07/30 02:54:25 jgg Exp $
 /* ######################################################################
    
    Package Cache - Accessor code for the cache
@@ -250,8 +250,7 @@ pkgCache::PkgIterator::OkState pkgCache::PkgIterator::State() const
        Pkg->CurrentState == pkgCache::State::HalfConfigured)
       return NeedsConfigure;
    
-   if (Pkg->CurrentState == pkgCache::State::UnInstalled ||
-       Pkg->CurrentState == pkgCache::State::HalfInstalled ||
+   if (Pkg->CurrentState == pkgCache::State::HalfInstalled ||
        Pkg->InstState != pkgCache::State::Ok)
       return NeedsUnpack;
       
index a1e17a8..4d24015 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: pkgcache.h,v 1.21 1999/07/15 03:15:48 jgg Exp $
+// $Id: pkgcache.h,v 1.22 1999/07/30 02:54:25 jgg Exp $
 /* ######################################################################
    
    Cache - Structure definitions for the cache file
@@ -70,7 +70,7 @@ class pkgCache
       enum PkgSelectedState {Unknown=0,Install=1,Hold=2,DeInstall=3,Purge=4};
       enum PkgInstState {Ok=0,ReInstReq=1,HoldInst=2,HoldReInstReq=3};
       enum PkgCurrentState {NotInstalled=0,UnPacked=1,HalfConfigured=2,
-        UnInstalled=3,HalfInstalled=4,ConfigFiles=5,Installed=6};
+          HalfInstalled=4,ConfigFiles=5,Installed=6};
    };
    
    struct Flag