Package: aptitude
Version: 0.6.3-3.2
Severity: important
Tags: patch

Hello,

while documentation [1] says the following:

priority  Level   A value that increases as the apt pin priority of a version
                  decreases. Specifically, this is computed by negating the pin
                  priority (so, e.g., if the pin priority is 500, this
                  component will compute -500).

code does not reflect this. In particular, priority is NOT negated and included
as is in the cost calculation. This bug basically makes priority cost level a
no-op and useless. The one-line patch against 0.6.3 is attached.

I'm marking this bug as important because "priority" cost level is part of
default SolutionCost. What's more, "priority" level is quite useful for some
buildd (sbuild AptitudeResolver based) configurations.

-- Package-specific info:
aptitude 0.6.3 compiled at Oct 16 2010 18:18:04
Compiler: g++ 4.4.5
Compiled against:
  apt version 4.10.1
  NCurses version 5.7
  libsigc++ version: 2.2.4.2
  Ept support enabled.
  Gtk+ support disabled.

Current library versions:
  NCurses version: ncurses 5.7.20100313
  cwidget version: 0.5.16
  Apt version: 4.10.1
        linux-vdso.so.1 =>  (0x00007fffac3ff000)
        libapt-pkg.so.4.10 => /usr/lib/libapt-pkg.so.4.10 (0x00007f4c957fa000)
        libncursesw.so.5 => /lib/libncursesw.so.5 (0x00007f4c955a7000)
        libsigc-2.0.so.0 => /usr/lib/libsigc-2.0.so.0 (0x00007f4c953a1000)
        libcwidget.so.3 => /usr/lib/libcwidget.so.3 (0x00007f4c950d5000)
        libept.so.1 => /usr/lib/libept.so.1 (0x00007f4c94e81000)
        libxapian.so.22 => /usr/lib/libxapian.so.22 (0x00007f4c94a7c000)
        libz.so.1 => /usr/lib/libz.so.1 (0x00007f4c94865000)
        libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x00007f4c945ca000)
        libboost_iostreams.so.1.42.0 => /usr/lib/libboost_iostreams.so.1.42.0 
(0x00007f4c943ae000)
        libpthread.so.0 => /lib/libpthread.so.0 (0x00007f4c94192000)
        libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007f4c93e7e000)
        libm.so.6 => /lib/libm.so.6 (0x00007f4c93bfb000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x00007f4c939e5000)
        libc.so.6 => /lib/libc.so.6 (0x00007f4c93684000)
        libutil.so.1 => /lib/libutil.so.1 (0x00007f4c93480000)
        libdl.so.2 => /lib/libdl.so.2 (0x00007f4c9327c000)
        libuuid.so.1 => /lib/libuuid.so.1 (0x00007f4c93077000)
        libbz2.so.1.0 => /lib/libbz2.so.1.0 (0x00007f4c92e67000)
        librt.so.1 => /lib/librt.so.1 (0x00007f4c92c5f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f4c95b1d000)
Terminal: xterm
$DISPLAY is set.
`which aptitude`: /usr/bin/aptitude
aptitude version information:

aptitude linkage:

-- System Information:
Debian Release: 6.0
  APT prefers unstable
  APT policy: (500, 'unstable'), (100, 'experimental')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.36-trunk-amd64 (SMP w/4 CPU cores)
Locale: LANG=lt_LT.UTF-8, LC_CTYPE=lt_LT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages aptitude depends on:
ii  apt [libapt-pkg4.10]    0.8.10           Advanced front-end for dpkg
ii  libboost-iostreams1.42. 1.42.0-4         Boost.Iostreams Library
ii  libc6                   2.11.2-7         Embedded GNU C Library: Shared lib
ii  libcwidget3             0.5.16-3         high-level terminal interface libr
ii  libept1                 1.0.4            High-level library for managing De
ii  libgcc1                 1:4.4.5-10       GCC support library
ii  libncursesw5            5.7+20100313-4   shared libraries for terminal hand
ii  libsigc++-2.0-0c2a      2.2.4.2-1        type-safe Signal Framework for C++
ii  libsqlite3-0            3.7.4-2          SQLite 3 shared library
ii  libstdc++6              4.4.5-10         The GNU Standard C++ Library v3
ii  libxapian22             1.2.4-1          Search engine library
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

Versions of packages aptitude recommends:
pn  apt-xapian-index              <none>     (no description available)
ii  aptitude-doc-en [aptitude-doc 0.6.3-3.2  English manual for aptitude, a ter
ii  libparse-debianchangelog-perl 1.1.1-2.1  parse Debian changelogs and output
ii  sensible-utils                0.0.6      Utilities for sensible alternative

Versions of packages aptitude suggests:
ii  debtags                       1.7.11     Enables support for package tags
ii  tasksel                       2.88       Tool for selecting tasks for insta

-- no debconf information
>From 27b9d3c26558fb7af846fb6aca24542430027fdb Mon Sep 17 00:00:00 2001
From: Modestas Vainius <mo...@debian.org>
Date: Mon, 3 Jan 2011 14:55:56 +0200
Subject: [PATCH 1/2] Negate priority when including it in the cost computation.

This is intended behaviour according to documentation. Current situation
basically makes priority cost level a no-op and useless.
---
 src/generic/apt/aptitude_resolver.cc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/generic/apt/aptitude_resolver.cc 
b/src/generic/apt/aptitude_resolver.cc
index 6331fb3..9c4e3d7 100644
--- a/src/generic/apt/aptitude_resolver.cc
+++ b/src/generic/apt/aptitude_resolver.cc
@@ -76,7 +76,7 @@ namespace
 
         if(apt_priority > INT_MIN)
           return settings.raise_cost(priority_component,
-                                     apt_priority);
+                                     -apt_priority);
         else
           return cost_limits::minimum_cost;
       }
-- 
1.7.2.3

Reply via email to