summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2012-03-13 14:33:23 +0100
committerMichael Vogt <michael.vogt@ubuntu.com>2012-03-13 14:33:23 +0100
commit6d0527822b8c240c929687f68b5f171d3ef2af3c (patch)
tree374d9dd1ac88207a2e5001a8661537243a4b26bc
parent544cc111be38bd0a3dfc887da3a70610b3cabe9e (diff)
parentbce4caa3078503bc1bec5221c5251d9e418a0f2a (diff)
merged from lp:~mvo/apt/mvo
-rw-r--r--apt-pkg/packagemanager.cc14
-rw-r--r--debian/changelog3
2 files changed, 15 insertions, 2 deletions
diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc
index 698c8606f..dd8f306f2 100644
--- a/apt-pkg/packagemanager.cc
+++ b/apt-pkg/packagemanager.cc
@@ -337,7 +337,10 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
however if there is a loop (A depends on B, B depends on A) this will not
be the case, so check for dependencies before configuring. */
bool Bad = false, Changed = false;
- do {
+ const unsigned int max_loops = _config->FindI("APT::pkgPackageManager::MaxLoopCount", 100);
+ unsigned int i=0;
+ do
+ {
Changed = false;
for (DepIterator D = instVer.DependsList(); D.end() == false; )
{
@@ -460,6 +463,8 @@ bool pkgPackageManager::SmartConfigure(PkgIterator Pkg, int const Depth)
if (Bad == true && Changed == false && Debug == true)
std::clog << OutputInDepth(Depth) << "Could not satisfy " << Start << std::endl;
}
+ if (i++ > max_loops)
+ return _error->Error("Internal error: MaxLoopCount reached in SmartUnPack for %s, aborting", Pkg.FullName().c_str());
} while (Changed == true);
if (Bad) {
@@ -596,7 +601,10 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
This will be either dealt with if the package is configured as a dependency of Pkg (if and when Pkg is configured),
or by the ConfigureAll call at the end of the for loop in OrderInstall. */
bool Changed = false;
- do {
+ const unsigned int max_loops = _config->FindI("APT::pkgPackageManager::MaxLoopCount", 100);
+ unsigned int i;
+ do
+ {
Changed = false;
for (DepIterator D = instVer.DependsList(); D.end() == false; )
{
@@ -821,6 +829,8 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c
}
}
}
+ if (i++ > max_loops)
+ return _error->Error("Internal error: MaxLoopCount reached in SmartConfigure for %s, aborting", Pkg.FullName().c_str());
} while (Changed == true);
// Check for reverse conflicts.
diff --git a/debian/changelog b/debian/changelog
index 32b271668..2003da5c3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,9 @@ apt (0.8.16~exp14) UNRELEASED; urgency=low
[ Michael Vogt ]
* apt-pkg/packagemanager.cc:
- fix inconsistent clog/cout usage in the debug output
+ - add APT::pkgPackageManager::MaxLoopCount to ensure that the
+ ordering code does not get into a endless loop when it flip-flops
+ between two states
[ David Kalnischkies ]
* apt-pkg/packagemanager.cc: