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

Bug#543966: apt wants to downgrade packages with pin-priority less than 1000



Package: apt
Version: 0.7.22
Severity: normal

== 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 ==

Tested and confirmed on:
    Debian Testing (Squeeze) | apt 0.7.22
    Ubuntu 9.10 (Karmic)     | apt 0.7.21ubuntu1
    Ubuntu 8.04 (Hardy LTS)  | apt 0.7.9ubuntu17.1

I originally submitted this issue to Ubuntu on Launchpad, and it was
suggested to be filed upstream:
https://bugs.launchpad.net/ubuntu/+source/apt/+bug/315175


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: 5.0.0

# grep deb-src /etc/apt/sources.list
deb-src http://http.us.debian.org/debian squeeze main

# apt-get source base-files
dpkg-source: info: extracting base-files in base-files-5.0.0
dpkg-source: info: unpacking base-files_5.0.0.tar.gz

# head debian/changelog
base-files (5.0.0-1) unstable; urgency=low

  * testing pinning issue

 -- Alon Swartz <alon@turnkeylinux.org> Thu, 27 Aug 2009 21:04:00 +0200

# dpkg-buildpackage -b -tc

# dpkg -i base-files_5.0.0-1_amd64.deb
Setting up base-files (5.0.0-1) ...

# cat > /etc/apt/preferences <<EOF
Package: base-files
Pin: release o=Debian
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: 5.0.0-1
  Candidate: 5.0.0
  Package pin: 5.0.0
  Version table:
 *** 5.0.0-1 999
        100 /var/lib/dpkg/status
     5.0.0 999
        500 http://http.us.debian.org squeeze/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.


== Interesting find ==

Max Bowsher made an interesting find that if an asterisk is included in
the package name, the bug is not reproduced.

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

# apt-cache policy base-files
base-files:
  Installed: 5.0.0-1
  Candidate: 5.0.0-1
  Version table:
 *** 5.0.0-1 0
        100 /var/lib/dpkg/status
     5.0.0 0
        500 http://http.us.debian.org squeeze/main Packages

# apt-get install base-files
base-files is already the newest version.


Cheers,
Alon Swartz






Reply to: