[Aptitude-devel] Bug#613775: MarkInstall calls with FromUser set to false

Daniel Hartwig mandyke at gmail.com
Wed Sep 5 05:51:10 BST 2012


TL;DR:
1. clearing auto-installed is a side-effect of FromUser=true, not it's
main purpose;
2. FromUser=true is mostly correct in aptitude;
3. since aptitude 0.6.4-1 we are calling MarkAuto after MarkInstall
and the original problem of safe-upgrade clearing auto-installed on
all packages is fixed [1];
4. David's work-around in apt 0.8.11.5 can *probably* be removed, but
I will need to investigate that further and follow up.

Quoting David, who quotes Sven, who is quoting David:
>>> In that case it would be an aptitude bug as it would call MarkInstall
>>> with FromUser == true for requests which are not directly from the user
>>> and should therefore not be marked as manual.

I have just completed a review of aptitude's use of MarkInstall, which
is called in response to the user:

a. requesting to install a package;
b. requesting to upgrade a package;
c. requesting to install a dependency, rather than a specific package
   satisfying that dependency;
d. applying a solution from the problem resolver;
e. requesting to upgrade all packages; and
f. scheduling changes in one session and those changes being
   restored at the start of the next.

a, b are directly from the user, ok.

e is not directly from the user, and should be FromUser=false.

I will mention the rest after a short diversion..

>>> As the changelog entry tries to describe in a request like
>>> apt-get install A
>>> A is now always marked as manual installed.
>>> […]
>> This may make sense for apt-get, but I would like to be able to upgrade
>> some selected packages _without_ changing their manual/automatic state.
>> Especially in interactive situations (like aptitude's TUI/GUI or in
>> synaptic) this seems better.  Especially since there are dedicated
>> commands for changing the manual/auto status.
>
> Which is fine, the software just shouldn't request to alter the autobit if
> it doesn't want it to be changed - the FromUser bit is exactly responsible
> for that and nothing else, so why setting it if you don't want it?

FromUser is also used in ::IsModeChangeOk() to determine whether a
request should override a dpkg hold, etc..  It is a side-effect that
this also causes MarkInstall to alter auto-installed in some cases.
Maybe that side-effect is better suited to apt-get.cc (maybe not, for
the reasons the change was introduced in the first place) but that is
another discussion ;-)

With that in mind, the rest of the list:

d, f are not strictly direct, but the user has approved the changes
and they should be applied, regardless of holds -- this makes
FromUser=true *required* here.  The problem resolver gives
consideration to package holds already anyway.  In both d and f,
aptitude also tries to correctly keep track of auto-installed by
itself, calling MarkAuto as needed.  This is not perfect but appears
to work most of the time at the moment.

This leaves only c, when the user requests to satisfy a particular
dependency but does not specify which package to use.  At the moment
we just install DepIterator::SmartTargetPkg(), but perhaps this should
be more intelligent and give consideration to package holds.  I think
this being FromUser=true is ok for the time being.

[Refer back to summary at top.]

There is still some cases where auto-installed is cleared on some *but
not all* packages involved in an action.  This affects packages to be
purged when the install run is aborted [2], and also some times when
selecting “Keep at current version” in the problem resolver [3,4] (I
suspect this is only when a package was going to be removed and
keeping it cancels that).

Regards

[1] http://bugs.debian.org/622719
[2] http://bugs.debian.org/686573
[3] http://bugs.debian.org/638049
[4] http://bugs.debian.org/508428



More information about the Aptitude-devel mailing list