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

Bug#1085880: marked as done (python3-apt: Package.marked_keep not working)



Your message dated Wed, 23 Oct 2024 11:57:52 +0200
with message-id <20241023113540.GA171400@debian.org>
and subject line Re: Bug#1085880: python3-apt: Package.marked_keep not working
has caused the Debian Bug report #1085880,
regarding python3-apt: Package.marked_keep not working
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.)


-- 
1085880: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1085880
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: python3-apt
Version: 2.6.0
Severity: normal

Dear Maintainer,

The Package.marked_keep seem not working properly: all packages are marked to
keep even if it's not the case.

Ex (on Debian Bookworm, v2.6.0):
$ apt-mark showhold
terraform
$ python3
Python 3.11.2 (main, May  2 2024, 11:59:08) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from apt.cache import Cache
>>> cache = Cache()
>>> pkg = cache["apache2"]
>>> pkg.marked_keep
True

I also reproduced this bug on bullseye (v2.2.1) & trixie (v2.9.0+b1).


-- System Information:
Debian Release: 12.7
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-security')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 6.1.0-9-amd64 (SMP w/8 CPU threads; PREEMPT)
Kernel taint flags: TAINT_USER, TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages python3-apt depends on:
ii  distro-info-data   0.58+deb12u2
ii  libapt-pkg6.0      2.6.1
ii  libc6              2.36-9+deb12u8
ii  libgcc-s1          12.2.0-14
ii  libstdc++6         12.2.0-14
ii  python-apt-common  2.6.0
ii  python3            3.11.2-1+b1

Versions of packages python3-apt recommends:
ii  iso-codes    4.15.0-1
ii  lsb-release  12.0-1

Versions of packages python3-apt suggests:
ii  apt             2.6.1
pn  python-apt-doc  <none>

-- debconf-show failed

--- End Message ---
--- Begin Message ---
On Wed, Oct 23, 2024 at 11:19:58AM GMT, Benjamin Renard wrote:
> Package: python3-apt
> Version: 2.6.0
> Severity: normal
> 
> Dear Maintainer,
> 
> The Package.marked_keep seem not working properly: all packages are marked to
> keep even if it's not the case.
> 
> Ex (on Debian Bookworm, v2.6.0):
> $ apt-mark showhold
> terraform

Hold packages are not relevant for kept packages.

> $ python3
> Python 3.11.2 (main, May  2 2024, 11:59:08) [GCC 12.2.0] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from apt.cache import Cache
> >>> cache = Cache()
> >>> pkg = cache["apache2"]
> >>> pkg.marked_keep
> True
> 
> I also reproduced this bug on bullseye (v2.2.1) & trixie (v2.9.0+b1).

If you did not make any changes, all packages are kept at their previous
state. Each package will be one of

    marked_keep
    marked_install
        marked_downgrade
        marked_upgrade
        marked_reinstall
    marked_delete

Where arguably marked_install and the items indented below it apply
at the same time IIRC.

Held packages are not exposed through the apt API, only through the
apt_pkg API. It's generally advisable not to use the apt API as it
generally leads to wrong code.

The apt_pkg API is much easier to not get wrong in that sense
because it doesn't do wrong stuff automagically for you; but
it's non-trivial to figure out the correct operations to install
a set of packages: You need to

    # Mark the manual packages to be installed without their deps
    for pkg in to_install:
        depcache.mark_install(pkg, auto_inst = False)
    # Mark the dependencies for installation
    for pkg in to_install:
        depcache.mark_install(pkg, auto_inst = True)
    # Solve any conflicts between dependencies
    if depcache.broken_count > 0:
        pr = apt_pkg.ProblemResolver(depcache)
        pr.resolve()

This is kind of crucial to get a similar set of installed packages
as the APT CLI. Both APIs default to auto_inst=True, but the apt.Package
API also by default automatically calls the problem resolver after
marking each package, yielding different and potentially highly
unexpected results.



-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en

--- End Message ---

Reply to: