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

Bug#1015794: behaviour of ?archive pattern inconsistent with aptitude



Control: severity -1 minor

On Thu, Jul 21, 2022 at 02:36:06PM +0200, Sébastien Villemot wrote:
> Package: apt
> Version: 2.5.1
> Severity: normal
> 
> Dear Maintainer,
> 
> I noticed that the ?archive pattern does not behave the same in apt as in
> aptitude.

That is incorrect.

> 
> My system has both unstable and experimental suites enabled (see below
> debian.sources).
> 
> When I run:
> 
>   aptitude versions '~i~Aexperimental'
> 
> I get a list of those installed package versions that effectively come from
> experimental (8 in total on my system, in particular I use GCC 12 by default):
> 
> Package cpp:                                               
> i A 4:12-20211211-1                                                                             experimental                                                             100
> 
> Package g++:
> i   4:12-20211211-1                                                                             experimental                                                             100
> 
> …
> 
> However, when I run:
> 
>   apt list '~i~Aexperimental'
> 
> I get a list of 297 packages. It seems to include all the installed packages
> for which a more recent version exists in experimental, independently of
> whether I installed that more recent version or not. For example, the output
> contains:
> 
>  wfrench/unstable,now 1.2.6-1 all [installed,automatic]
> 
> wfrench 1.2.6-1 actually comes from unstable, but there is indeed a 1.2.7-1
> currently in experimental (which I did not install).

That is correct. What you fail to realize is that apt list lists
packages, not versions, so it matches like aptitude search, not aptitude
versions. You'll have to wrap the search in ?any-version if you want
operations to match against the same version, as in aptitude search.

To give an example on my weird Ubuntu install:

jak@jak-t480s:~:master$ apt policy apt
apt:
  Installed: 2.5.1+0~202206301128~ubuntu21.10.1
  Candidate: 2.5.1+0~202206301128~ubuntu21.10.1
  Version table:
 *** 2.5.1+0~202206301128~ubuntu21.10.1 500
        500 http://ppa.launchpad.net/deity/sid/ubuntu impish/main amd64 Packages
        100 /var/lib/dpkg/status
     2.5.1 500
        500 mirror+file:/etc/apt/mirrors.list kinetic/main amd64 Packages
jak@jak-t480s:~:master$ apt list '?installed?archive(kinetic)?name(^apt$)'
Listing... Done
apt/impish,now 2.5.1+0~202206301128~ubuntu21.10.1 amd64 [installed]
N: There is 1 additional version. Please use the '-a' switch to see it
jak@jak-t480s:~:master$ aptitude search '?installed?archive(kinetic)?name(^apt$)'
i   apt                                                                                                - commandline package manager                                                                                 
jak@jak-t480s:~:master$ aptitude versions '?installed?archive(kinetic)?name(^apt$)'
jak@jak-t480s:~:master$ aptitude search '?any-version(?installed?archive(kinetic)?name(^apt$))'
jak@jak-t480s:~:master$ aptitude install '?installed?archive(kinetic)?name(^apt$)' -s
apt is already installed at the requested version (2.5.1+0~202206301128~ubuntu21.10.1)
apt is already installed at the requested version  (2.5.1+0~202206301128~ubuntu21.10.1)

The aptitude versions command I believe is the only thing in aptitude that
actually matches versions and is very confusing. Because in your example, if
you used `aptitude install` with your pattern, it would have installed those same
297 packages that `apt list` lists.
-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en


Reply to: