summaryrefslogtreecommitdiff
path: root/apt-pkg/algorithms.cc
diff options
context:
space:
mode:
authorArch Librarian <arch@canonical.com>2004-09-20 16:53:39 +0000
committerArch Librarian <arch@canonical.com>2004-09-20 16:53:39 +0000
commit813c8eea956b2dee1e7a4a8018a1e94880a2cfbf (patch)
tree133673154804728ea55fb8c2245d01e9dd429536 /apt-pkg/algorithms.cc
parenteec898ad83d383f27b94f747245fe82fe11949b0 (diff)
Fixed segfault in re-install/upgrade condition
Author: jgg Date: 1999-04-28 22:48:44 GMT Fixed segfault in re-install/upgrade condition
Diffstat (limited to 'apt-pkg/algorithms.cc')
-rw-r--r--apt-pkg/algorithms.cc29
1 files changed, 25 insertions, 4 deletions
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 967aba180..991a61228 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.16 1999/02/05 02:26:00 jgg Exp $
+// $Id: algorithms.cc,v 1.17 1999/04/28 22:48:45 jgg Exp $
/* ######################################################################
Algorithms - A set of misc algorithms
@@ -169,16 +169,37 @@ bool pkgApplyStatus(pkgDepCache &Cache)
if (I->InstState == pkgCache::State::ReInstReq ||
I->InstState == pkgCache::State::HoldReInstReq)
{
- Cache.MarkKeep(I);
+ if (I.CurrentVer().Downloadable() == true)
+ Cache.MarkKeep(I);
+ else
+ {
+ // Is this right? Will dpkg choke on an upgrade?
+ if (Cache[I].CandidateVerIter(Cache).Downloadable() == true)
+ Cache.MarkInstall(I);
+ else
+ return _error->Error("The package %s needs to be reinstalled, "
+ "but I can't find an archive for it.",I.Name());
+ }
+
continue;
}
switch (I->CurrentState)
{
- // This means installation failed somehow
+ /* This means installation failed somehow - it does not need to be
+ re-unpacked (probably) */
case pkgCache::State::UnPacked:
case pkgCache::State::HalfConfigured:
- Cache.MarkKeep(I);
+ if (I.CurrentVer().Downloadable() == true ||
+ I.State() != pkgCache::PkgIterator::NeedsUnpack)
+ Cache.MarkKeep(I);
+ else
+ {
+ if (Cache[I].CandidateVerIter(Cache).Downloadable() == true)
+ Cache.MarkInstall(I);
+ else
+ Cache.MarkDelete(I);
+ }
break;
// This means removal failed