From a005475ea62b65e08f67bf462ace6eb44289df07 Mon Sep 17 00:00:00 2001 From: Arch Librarian Date: Mon, 20 Sep 2004 16:54:24 +0000 Subject: Fixed the infinite loop problem Author: jgg Date: 1999-07-30 02:54:25 GMT Fixed the infinite loop problem --- apt-pkg/algorithms.cc | 14 ++++++++++---- apt-pkg/deb/deblistparser.cc | 5 ++--- apt-pkg/pkgcache.cc | 5 ++--- apt-pkg/pkgcache.h | 4 ++-- 4 files changed, 16 insertions(+), 12 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index fed9b0be7..d84ce2e21 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -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"); diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 86cd526fb..59d15f7d0 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -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}, diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc index b07c02a3b..9e7b0f392 100644 --- a/apt-pkg/pkgcache.cc +++ b/apt-pkg/pkgcache.cc @@ -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; diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index a1e17a878..4d2401570 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -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 -- cgit v1.2.3