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

Bug#611729: marked as done (apt: apt-get does not always mark a package as manually installed)



Your message dated Thu, 3 Feb 2011 23:47:06 +0100
with message-id <AANLkTiniGz0PsP6i+9qjidgvw0+F-byvUmp6bGa_3qoP@mail.gmail.com>
and subject line Re: Bug#611729: apt: apt-get does not always mark a package as manually installed
has caused the Debian Bug report #611729,
regarding apt: apt-get does not always mark a package as manually installed
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
611729: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=611729
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: apt
Version: 0.8.10
Severity: normal
Tags: patch

[ This bug has been found in Maemo's version of apt, absed on 0.7.25.3,
  and has only confirmed to be present in Debian's version of apt by
  reading the code.  Thus, I don't include any information about my
  Debian installation.
]

Apt-get does not always mark a package as manually installed when it
should.  I only have a Gedanken Test Case for reproduction, sorry, but
it should be simple.

Consider this scenario:

  Package: a
  Depends: b

  Package: b

Neither a nor b are installed.  Then

  $ apt-get install a b

will not mark b as manually installed.

The culprit is this code in cmd-line/apt-get.cc, function TryToInstall:

    // see if we need to fix the auto-mark flag
    // e.g. apt-get install foo
    // where foo is marked automatic
    if (State.Install() == false &&
        (State.Flags & pkgCache::Flag::Auto) &&
        _config->FindB("APT::Get::ReInstall",false) == false &&
        _config->FindB("APT::Get::Only-Upgrade",false) == false &&
        _config->FindB("APT::Get::Download-Only",false) == false)
    {
       ioprintf(c1out,_("%s set to manually installed.\n"),
      	  Pkg.FullName(true).c_str());
       Cache->GetDepCache()->MarkAuto(Pkg,false);
       AutoMarkChanged++;
    }

This code will not "fix the auto-mark flag" when State.Install() is
false.  However, planning to install a will produce the state where
State.Install() is true for b, and State.Flags for b will include Auto.

The following variant of the code should make this work:

    // see if we need to fix the auto-mark flag 
    // e.g. apt-get install foo 
    // where foo is marked automatic
    if((State.Flags & pkgCache::Flag::Auto) &&
       _config->FindB("APT::Get::ReInstall",false) == false &&
       _config->FindB("APT::Get::Only-Upgrade",false) == false &&
       _config->FindB("APT::Get::Download-Only",false) == false)
    {
       Cache->GetDepCache()->MarkAuto(Pkg,false);
       AutoMarkChanged++;

       // If we are not actually installing the package right
       // now because it is already installed, at least
       // mention that we are changing its auto flag.
       if (State.Install() == false)
          ioprintf(c1out,_("%s set to manually installed.\n"),
          	  Pkg.FullName(true).c_str());
    }

[ No patch since I didn't even compile this. ]

The logic behind this change is that it shouldn't matter whether or not
State.Install() is true when deciding whether to fix the auto-mark.  All
we really want is to supress the message in the normal case where a
package is about to be installed.



--- End Message ---
--- Begin Message ---
notfound 611729 apt/0.8.10
found 611729 0.7.25.3
fixed 611729 0.7.26~exp8
thanks

On Tue, Feb 1, 2011 at 14:28, Marius Vollmer <marius.vollmer@nokia.com> wrote:
> [ This bug has been found in Maemo's version of apt, absed on 0.7.25.3,
>  and has only confirmed to be present in Debian's version of apt by
>  reading the code.  Thus, I don't include any information about my
>  Debian installation.

APT until 0.7.26~exp8 had the problem to depend on the order in which packages
are given on the commandline, so your 'install a b' really triggered this bug.

Now APT marks the packages given on the commandline first for installation
and only after that does the dependency resolution on the packages - it is
therefore now impossible to mark a new package as autoinstalled before
it can be marked manual so the code you refer to works finally as intended
and because of that i will leave it as is and mark this as fixed and close it.
I hope you can agree on this.


Best regards

David Kalnischkies

P.S.: Beside this fix, the 0.7.26 aka 0.8 series includes also a small
framework to build testcases which can come quiet handy to replace these
mental exercises with a few lines of shellscript. Attached the one i used
to validate that at least i can't trick APT into marking a package
accidentally as auto/manual installed.

Attachment: test-bug-611729-mark-as-manual
Description: Binary data


--- End Message ---

Reply to: