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

Bug #315175 reported by Alon Swartz
8
Affects Status Importance Assigned to Milestone
apt (Debian)
New
Unknown
apt (Ubuntu)
Confirmed
Undecided
Unassigned

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
EOF

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

# apt-cache policy base-files
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:
  base-files

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

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

Revision history for this message
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
Revision history for this message
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*

Revision history for this message
Alon Swartz (alonswartz) wrote :

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

Revision history for this message
Alon Swartz (alonswartz) wrote :
Revision history for this message
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

Revision history for this message
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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