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

Bug#807523: apt: enum of VerPriority and results from pkgCache::Priority() are inconsistent



Package: apt
Version: 1.1.4
Severity: normal
Control: affects -1 + aptitude

Hi,

(Sorry to add to the counter of open bugs... but there's a bug in aptitude as a
result of this).


In pkgcache.h and .cc:

- pkgCache::Priority():

	const char *Mapping[] = {0,_("important"),_("required"),_("standard"),
                                     _("optional"),_("extra")};

- struct State {
  ...
	enum VerPriority {Required=1,Important=2,Standard=3,Optional=4,Extra=5};


Note that the order of Required and Important is swapped, so it's not possible
to convert/cast between them, and e.g. printing
pkgCache::Priority(VerIterator->Priority) yields the wrong result with
Required/Important.

As a result of this:

  $ aptitude -F '%P %R %p#' search ~n^apt$
  required  Imp apt
  required  Imp apt:i386


And the following is obviously a very minor problem, but I found about it while
grepping so I thought that I would include this in the case that you want to
change it: a comment in apt-pkg/orderlist.cc is also "inconsistent" with the
order of the enum:

  apt-pkg/algorithms.cc:   //    Required Important Standard Optional Extra
  apt-pkg/orderlist.cc:   // Important Required Standard Optional Extra


Cheers.
--
Manuel A. Fernandez Montecelo <mafm@debian.org>


Reply to: