[dnb114@psu.edu: MarkInstall and AutoInst]
An update on this bug: I just sent this mail to debian-deity. It
looks like this is either a bug or a deficiency in libapt; I am
currently awaiting feedback on which one it is.
Daniel
----- Forwarded message from Daniel Burrows <dnb114@psu.edu> -----
From: Daniel Burrows <dnb114@psu.edu>
Subject: MarkInstall and AutoInst
To: debian-deity@lists.debian.org
Date: Thu, 4 Mar 2004 13:13:09 -0500
This is something that came up in an aptitude bug report recently.
The behavior of MarkInstall in one corner case seems odd to me, and I
thought I should bring it up here.
Say you have packages A, B, C, dependencies A->B and B->C. All three
are installed, but have been marked for removal (MarkDelete).
Now, call MarkInstall on A with AutoInst=true. I would expect that B
and C would automatically be kept to satisfy the dependencies, but this
does not occur: A is installed, and B *is* kept, but C is left in the
Delete state, resulting in B being InstBroken.
Calling MarkInstall on B (again with AutoInst=true) installs its
immediate dependencies (C in this case). For longer dependency chains,
the pattern continues: the dependencies of C, for instance, remain in
the Delete state until C is marked for installation.
It looks to me like the culprit is lines 612-614 of depcache.cc: after
calling MarkKeep, the routine immediately returns rather than
recursively checking the dependencies of the package. There are a
number of plausible ways to approach this, assuming my diagnosis is
correct and that the current behavior is not intentional; I have
attached an entirely untested patch that demonstrates one approach.
Daniel
--
/-------------------- Daniel Burrows <dburrows@debian.org> -------------------\
| "Witches and pickles went together like...she hesitated at |
| the stomach-curdling addition of peaches and cream, and |
| mentally substituted 'things that went together very well'" |
| -- Terry Pratchett |
\----------------- The Turtle Moves! -- http://www.lspace.org ----------------/
--- apt-pkg/depcache.cc.old 2004-03-04 13:08:36.000000000 -0500
+++ apt-pkg/depcache.cc 2004-03-04 13:09:43.000000000 -0500
@@ -608,35 +608,37 @@
P.iFlags &= ~AutoKept;
if (P.InstBroken() == false && (P.Mode == ModeInstall ||
P.CandidateVer == (Version *)Pkg.CurrentVer()))
- {
- if (P.CandidateVer == (Version *)Pkg.CurrentVer() && P.InstallVer == 0)
+ {
+ if (P.CandidateVer == (Version *)Pkg.CurrentVer() && P.InstallVer == 0)
MarkKeep(Pkg);
- return;
- }
-
- // See if there is even any possible instalation candidate
- if (P.CandidateVer == 0)
- return;
-
- // We dont even try to install virtual packages..
- if (Pkg->VersionList == 0)
- return;
-
- /* Target the candidate version and remove the autoflag. We reset the
- autoflag below if this was called recursively. Otherwise the user
- should have the ability to de-auto a package by changing its state */
- RemoveSizes(Pkg);
- RemoveStates(Pkg);
-
- P.Mode = ModeInstall;
- P.InstallVer = P.CandidateVer;
- P.Flags &= ~Flag::Auto;
- if (P.CandidateVer == (Version *)Pkg.CurrentVer())
- P.Mode = ModeKeep;
+ // return;
+ }
+ else
+ {
+ // See if there is even any possible instalation candidate
+ if (P.CandidateVer == 0)
+ return;
+
+ // We dont even try to install virtual packages..
+ if (Pkg->VersionList == 0)
+ return;
+
+ /* Target the candidate version and remove the autoflag. We reset the
+ autoflag below if this was called recursively. Otherwise the user
+ should have the ability to de-auto a package by changing its state */
+ RemoveSizes(Pkg);
+ RemoveStates(Pkg);
- AddStates(Pkg);
- Update(Pkg);
- AddSizes(Pkg);
+ P.Mode = ModeInstall;
+ P.InstallVer = P.CandidateVer;
+ P.Flags &= ~Flag::Auto;
+ if (P.CandidateVer == (Version *)Pkg.CurrentVer())
+ P.Mode = ModeKeep;
+
+ AddStates(Pkg);
+ Update(Pkg);
+ AddSizes(Pkg);
+ }
if (AutoInst == false)
return;
----- End forwarded message -----
--
/-------------------- Daniel Burrows <dburrows@debian.org> -------------------\
| Put no trust in cryptic comments. |
\------------- Got APT? -- Debian GNU/Linux http://www.debian.org ------------/
Reply to: