apt wants to downgrade packages with pin-priority less than 1000

Bug #315175 reported by Alon Swartz on 2009-01-08
Affects Status Importance Assigned to Milestone
apt (Debian)
apt (Ubuntu)

Bug Description

Binary package hint: apt

== Summary ==

apt will attempt to downgrade an installed package if the pin-priority of the package is greater than 99.

apt will not downgrade when pin-priorty is 99 or below because the already installed package automatically gets a priority of 100.

According to the apt_preferences manpage (mentioned several times), apt will *never* downgrade a package unless the priority of an available version exceeds 1000.

== Details ==

My testing system:
    Ubuntu 8.04.1 (Hardy)
    apt 0.7.9ubuntu17.1 for i386 compiled on Oct 27 2008 18:11:08

Reproducing the issue is simple, as described below (I have chosen base-files as its a small package without any build-deps, but any package will do).

# dpkg -s base-files |grep Version
Version: 4.0.1ubuntu5.8.04.3

# grep deb-src /etc/apt/sources.list.d/sources.list
deb-src http://archive.ubuntu.com/ubuntu hardy-updates main

# apt-get source base-files
dpkg-source: extracting base-files in base-files-4.0.1ubuntu5.8.04.3
dpkg-source: unpacking base-files_4.0.1ubuntu5.8.04.3.tar.gz

# head debian/changelog
base-files (4.0.1ubuntu5.8.04.3-1) hardy-proposed; urgency=low

  * testing pinning issue

 -- Alon Swartz <email address hidden> Tue, 06 Jan 2009 00:00:00 +0000

# dpkg-buildpackage -b -tc

# dpkg -i base-files_4.0.1ubuntu5.8.04.3-1_i386.deb
Setting up base-files (4.0.1ubuntu5.8.04.3-1) ...

# dpkg -s base-files |grep Version
Version: 4.0.1ubuntu5.8.04.3-1

# cat > /etc/apt/preferences <<EOF
Package: base-files
Pin: release o=Ubuntu
Pin-Priority: 999

Note: the pin-priority can be anything larger than 99 to reproduce this

# apt-cache policy base-files
  Installed: 4.0.1ubuntu5.8.04.3-1
  Candidate: 4.0.1ubuntu5.8.04.3
  Package pin: 4.0.1ubuntu5.8.04.3
  Version table:
 *** 4.0.1ubuntu5.8.04.3-1 999
        100 /var/lib/dpkg/status
     4.0.1ubuntu5.8.04.3 999
        500 http://archive.ubuntu.com hardy-updates/main Packages
     4.0.1ubuntu5 999
        500 http://archive.ubuntu.com hardy/main Packages

# apt-get install base-files
The following packages will be DOWNGRADED:

In other words, apt wants to downgrade a package even though the pin-priority is less than 1000, which goes against all the

Is this a bug in apt, a bug in the documentation, or am I mis-understanding something?

Max Bowsher (maxb) wrote :

That's an interestingly weird bug. Confirmed on karmic (apt 0.7.21ubuntu1).

It is specific to using a "Package: name" pin. A "Package: *" pin does not reproduce the bug.

Changed in apt (Ubuntu):
status: New → Confirmed
Alon Swartz (alonswartz) wrote :

"Package: name*" also does not reproduce the bug, but ofcourse will have the side effect of
pinning any package that matches name*

Alon Swartz (alonswartz) wrote :

I have just reproduced this issue on squeeze, and will be submitting a bug report to debian.

Rolf Leggewie (r0lf) wrote :

"Package: name*" will not work as expected. It is either an all-out wildcard * or the complete package name: http://bugs.debian.org/121132

Rolf Leggewie (r0lf) wrote :

actually, as confirmed in comment 1 and 2, what you guys are seeing is better described in bug 565364

Changed in apt (Debian):
status: Unknown → New
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.