Bug#548858: apt fails to upgrade
Hi, Maemo here again!
We ran into a problem with the ordering algorithm as well. We bootstrap
all our istallations with just a long "apt-get install" invocation, and
any change to the handling of the base system affects us immediatly,
especially so since we do not really maintain the priorities of our
packages to any useful degree.
Anyway, after some analysis, I found these things:
- The ordering algorithm sometimes does not unpack a package that it
wants to to configure, and then fails.
Please review and possibly apply the attached patch.
- I don't think we need to propagate the Immediate flag at all. The
normal ordering algorithm should take care that all depends and
pre-depends of any package are correctly satisfied, including those
that are immediately configured.
Adding the immediate flag to more packages should not break anything,
and once the bug above is fixed, ordering does indeed succeed
regardless of whether the Immediate flag is propagated or not.
Progagating just isn't necessary and complicates matters. (Maybe it
was added as a workaround for the bug above?)
So, I think you should consider removing ImmediateAdd and all its
invokations.
- I made a small test where every package gets the immediate flag set
to see whether ordering still works in this stressy situation. (It
does.)
But configuring everything immediately is interesting in its own
right, I think. Packages are then left unconfigured for a shorter
time and thus chances are lower that they are left behind
unconfigured when the operation is interrupted. This might give more
robust interrupt/retry behavior since the system is in 'more
configured' state after the interruption.
Anyway, this is just food for thought.
Index: apt/apt-pkg/packagemanager.cc
===================================================================
--- apt.orig/apt-pkg/packagemanager.cc 2009-11-10 17:27:12.000000000 +0200
+++ apt/apt-pkg/packagemanager.cc 2009-11-10 17:27:55.000000000 +0200
@@ -299,6 +299,14 @@
if (OList.OrderConfigure() == false)
return false;
+ if (List->IsFlag(Pkg,pkgOrderList::Configured) == true)
+ {
+ // Pkg got configured during DepAdd. That happens when DepAdd
+ // causes SmartUnpack to be called for a package that has a
+ // pre-dependency on us.
+ return true;
+ }
+
// Perform the configuring
for (pkgOrderList::iterator I = OList.begin(); I != OList.end(); I++)
{
@@ -370,12 +378,21 @@
// Not the install version
if (Cache[Pkg].InstallVer != *I ||
(Cache[Pkg].Keep() == true && Pkg.State() == PkgIterator::NeedsNothing))
- continue;
-
- if (List->IsFlag(Pkg,pkgOrderList::UnPacked) == true)
- Bad = !DepAdd(OList,Pkg,Depth);
+ continue;
+
if (List->IsFlag(Pkg,pkgOrderList::Configured) == true)
- Bad = false;
+ {
+ Bad = false;
+ }
+ else if (List->IsFlag(Pkg,pkgOrderList::UnPacked) == true)
+ {
+ Bad = !DepAdd(OList,Pkg,Depth);
+ }
+ else
+ {
+ // Not even unpacked
+ Bad = !SmartUnPack (Pkg) || !DepAdd(OList,Pkg,Depth);
+ }
}
}
Reply to: