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

Bug#1017060: marked as done (python3-apt: Candidate version returned does not respect policy)



Your message dated Fri, 12 Aug 2022 21:11:46 +0200
with message-id <20220812210605.GA1074583@debian.org>
and subject line Re: Bug#1017060: python3-apt: Candidate version returned does not respect policy
has caused the Debian Bug report #1017060,
regarding python3-apt: Candidate version returned does not respect policy
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.)


-- 
1017060: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1017060
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: python3-apt
Version: 2.2.1
Severity: normal
X-Debbugs-Cc: nicolas@karolak.fr

Dear Maintainer,

I have an internal APT repository proxy/cache (Nexus) that is configured
with a high priority. When i try to install packages with Ansible, that
leverage this library, it tries to install the latest package found
overall my repos instead of the one with the highest priority.

Here are the steps to reproduce.

Add MariaDB repository:

```
# apt-get install apt-transport-https curl ; curl -o /etc/apt/trusted.gpg.d/mariadb_release_signing_key.asc 'https://mariadb.org/mariadb_release_signing_key.asc' ; sh -c "echo 'deb https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye main' >>/etc/apt/sources.list.d/mariadb.list"
```

Policy without pinning:

```
# apt policy mariadb-server
mariadb-server:
  Installed: (none)
  Candidate: 1:10.5.16+maria~bullseye
  Version table:
     1:10.5.16+maria~bullseye 500
        500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
     1:10.5.15+maria~bullseye 500
        500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
     1:10.5.15-0+deb11u1 500
        500 http://deb.debian.org/debian bullseye/main arm64 Packages
     1:10.5.13+maria~bullseye 500
        500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
```

Setup pinning to priorize another origin than MariaDB one:

```
# cat /etc/apt/preferences.d/90pin
Package: *
Pin: origin deb.debian.org
Pin-Priority: 1000
```

Updated policy:

```
# apt policy mariadb-server                                                                          
mariadb-server:
  Installed: (none)
  Candidate: 1:10.5.15-0+deb11u1
  Version table:
     1:10.5.16+maria~bullseye 500
        500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
     1:10.5.15+maria~bullseye 500
        500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
     1:10.5.15-0+deb11u1 1000
       1000 http://deb.debian.org/debian bullseye/main arm64 Packages
     1:10.5.13+maria~bullseye 500
        500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
```

Installing pin-compliant package through `apt` works fine:

```
# apt install mariadb-common --dry-run
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  mysql-common
The following NEW packages will be installed:
  mariadb-common mysql-common
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Inst mysql-common (5.8+1.0.7 Debian:11.4/stable [all])
Inst mariadb-common (1:10.5.15-0+deb11u1 Debian:11.4/stable [all])
Conf mysql-common (5.8+1.0.7 Debian:11.4/stable [all])
Conf mariadb-common (1:10.5.15-0+deb11u1 Debian:11.4/stable [all])
```

However `apt_pkg` Python lib return wrong candidate version:

```
# python3
>>> import apt, apt_pkg
>>> cache = apt_pkg.Cache()
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
>>> policy = apt_pkg.Policy(cache)
>>> policy.get_candidate_ver(cache['mariadb-common'])
<apt_pkg.Version object: Pkg:'mariadb-common' Ver:'1:10.5.16+maria~bullseye' Section:'database'  Arch:'all' Size:4452 ISize:19456 Hash:2194990488 ID:58302 Priority:4>
```


-- System Information:
Debian Release: 11.4
  APT prefers stable-updates
  APT policy: (1000, 'stable-updates'), (1000, 'stable-security'), (1000, 'stable')
Architecture: arm64 (aarch64)

Kernel: Linux 5.10.104-linuxkit (SMP w/2 CPU threads; PREEMPT)
Kernel taint flags: TAINT_WARN, TAINT_OOT_MODULE, TAINT_RANDSTRUCT
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: unable to detect

Versions of packages python3-apt depends on:
ii  distro-info-data   0.51+deb11u2
ii  libapt-pkg6.0      2.2.4
ii  libc6              2.31-13+deb11u3
ii  libgcc-s1          10.2.1-6
ii  libstdc++6         10.2.1-6
ii  python-apt-common  2.2.1
ii  python3            3.9.2-3

Versions of packages python3-apt recommends:
ii  iso-codes    4.6.0-1
ii  lsb-release  11.1.0

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

-- no debconf information

--- End Message ---
--- Begin Message ---
On Fri, Aug 12, 2022 at 02:25:48PM +0000, Nicolas Karolak wrote:
> Package: python3-apt
> Version: 2.2.1
> Severity: normal
> X-Debbugs-Cc: nicolas@karolak.fr
> 
> Dear Maintainer,
> 
> I have an internal APT repository proxy/cache (Nexus) that is configured
> with a high priority. When i try to install packages with Ansible, that
> leverage this library, it tries to install the latest package found
> overall my repos instead of the one with the highest priority.
> 
> Here are the steps to reproduce.
> 
> Add MariaDB repository:
> 
> ```
> # apt-get install apt-transport-https curl ; curl -o /etc/apt/trusted.gpg.d/mariadb_release_signing_key.asc 'https://mariadb.org/mariadb_release_signing_key.asc' ; sh -c "echo 'deb https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye main' >>/etc/apt/sources.list.d/mariadb.list"
> ```
> 
> Policy without pinning:
> 
> ```
> # apt policy mariadb-server
> mariadb-server:
>   Installed: (none)
>   Candidate: 1:10.5.16+maria~bullseye
>   Version table:
>      1:10.5.16+maria~bullseye 500
>         500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
>      1:10.5.15+maria~bullseye 500
>         500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
>      1:10.5.15-0+deb11u1 500
>         500 http://deb.debian.org/debian bullseye/main arm64 Packages
>      1:10.5.13+maria~bullseye 500
>         500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
> ```
> 
> Setup pinning to priorize another origin than MariaDB one:
> 
> ```
> # cat /etc/apt/preferences.d/90pin
> Package: *
> Pin: origin deb.debian.org
> Pin-Priority: 1000
> ```
> 
> Updated policy:
> 
> ```
> # apt policy mariadb-server                                                                          
> mariadb-server:
>   Installed: (none)
>   Candidate: 1:10.5.15-0+deb11u1
>   Version table:
>      1:10.5.16+maria~bullseye 500
>         500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
>      1:10.5.15+maria~bullseye 500
>         500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
>      1:10.5.15-0+deb11u1 1000
>        1000 http://deb.debian.org/debian bullseye/main arm64 Packages
>      1:10.5.13+maria~bullseye 500
>         500 https://mirror.netweaver.uk/mariadb/repo/10.5/debian bullseye/main arm64 Packages
> ```
> 
> Installing pin-compliant package through `apt` works fine:
> 
> ```
> # apt install mariadb-common --dry-run
> Reading package lists... Done
> Building dependency tree... Done
> Reading state information... Done
> The following additional packages will be installed:
>   mysql-common
> The following NEW packages will be installed:
>   mariadb-common mysql-common
> 0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
> Inst mysql-common (5.8+1.0.7 Debian:11.4/stable [all])
> Inst mariadb-common (1:10.5.15-0+deb11u1 Debian:11.4/stable [all])
> Conf mysql-common (5.8+1.0.7 Debian:11.4/stable [all])
> Conf mariadb-common (1:10.5.15-0+deb11u1 Debian:11.4/stable [all])
> ```
> 
> However `apt_pkg` Python lib return wrong candidate version:
> 
> ```
> # python3
> >>> import apt, apt_pkg
> >>> cache = apt_pkg.Cache()
> Reading package lists... Done
> Building dependency tree... Done
> Reading state information... Done
> >>> policy = apt_pkg.Policy(cache)
> >>> policy.get_candidate_ver(cache['mariadb-common'])
> <apt_pkg.Version object: Pkg:'mariadb-common' Ver:'1:10.5.16+maria~bullseye' Section:'database'  Arch:'all' Size:4452 ISize:19456 Hash:2194990488 ID:58302 Priority:4>


You have not read the policy preferences files so that's hardly
surprising, you want to use cache.policy instead of creating
a fresh one to get an initialized policy.

The bindings don't do anything different here.

So I'm going to close this bug, I suggest you open a fresh one
after ansible if it does the wrong thing. Or better perhaps, contact
a user support list.

Perhaps try a pin of 1001 instead, 1000 has unspecified behavior. It
should work as a downgrade but the docs say > 1000.

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

--- End Message ---

Reply to: