[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: MarkInstall, Auto-Installed, and programs that misuse FromUser



Hi,

First of all: Thanks for the summary!

On Wed, Nov 7, 2012 at 8:28 AM, Daniel Hartwig <mandyke@gmail.com> wrote:
> (3) when a previously auto-installed package is marked
>     manually-installed (FromUser=true and some other bits that
>     should be removed [1]).
>
> The later behaviour is relatively new, introduced in apt/0.8.11.2:
>
>   * apt-pkg/depcache.cc:
>     - mark a package which was requested to be installed on commandline
>       always as manual regardless if it is already marked or not as the
>       marker could be lost later by the removal of rdepends (Closes: #612557)
>
> It is easy to see that (2) is ok.  Also, (3) is a fine idea when dealing
> with a lot of situations.

As the changelog hints (3) was actually already in action sometimes:

     if(FromUser)
       {
-        // Set it to manual if it's a new install or cancelling the
-        // removal of a garbage package.
-        if(P.Status == 2 || (!Pkg.CurrentVer().end() && !P.Marked))
+        // Set it to manual if it's a new install or already installed
+        if(P.Status == 2 || Pkg->CurrentVer != 0)
           P.Flags &= ~Flag::Auto;
       }
     else

P.Marked is a flag used by the AutoRemover which basically means that
the package wasn't visited (which isn't the same as P.Garbage which
means that the package can be autoremoved) -- both are usually updated
only after the last active action-group is destructed.

I found this pretty unintuitive for emit this side-effect as in various
situations the "future" marking state will differ from the one we see
while MarkInstall is executed and is not what we want even if we assume
it is a good idea to only mark packages as manual if they weren't
useful before to satisfy dependencies as it doesn't cope well with
changed dependencies.


> - restoring previously saved selections (dselect, aptitude do this
>   on load; synaptic --set-selections);

Unrelated intermezzo-comment:
apt-get has a dselect-upgrade, too. The idea was/is that a user marks
specific packages for install/removal here; therefore it is like
giving all these packages on the commandline.
If we think about it, the alternative to this would be to mark all
packages as manual, that can't be what we want either.

For system transitions it's better to copy the extended_states over as well.
Everything else will be pretty strange either way.


> Moving forward, I see three options:
> - move (3) to each frontend which desires that behaviour,
>   i.e. apt-get.cc (duplicates work, maybe problems);
> - allow to temporarily disable (3) (avoids the hacks for preserving
>   auto-installed); or
> - at least update any program that misuses FromUser, changing it to
>   the save-and-restore hack instead.

After wading though code (and fixing some more or less esoteric issues in
 apt-get itself related to this) I think the first one is the simplest and
most expected option. The obvious alternative is to revert to the P.Marked
dependency as before, but this still feels like a pretty strange logic and
is after all just a (3)-sometimes instead of (3)-always as it is now.
It's just that this (3)-sometimes is the original implementation proposed
by Daniel and committed in 2005 so I still wonder what the intend is/was …

For apt-get at least this isn't additional work as it already ensures that
packages given on the commandline are marked as manually installed, in fact
it is even better as it makes this a bit more predictable (as some options
disable this and a message is shown to notify the user about this MarkManual).


Best regards

David Kalnischkies


Reply to: