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

Bug#1029586: apt: "apt-cache rdepends --installed" false positives



On Wed, Jan 25, 2023 at 12:05:06PM +0100, Vincent Lefevre wrote:
> On 2023-01-25 10:45:53 +0100, Julian Andres Klode wrote:
> > You want to use `apt list '?any-version(?installed?depends(?exact-name(libpcre3)))'`
> > instead (with apt >= 2.5.4). In earlier versions you may use:
> > apt list '?any-version(?archive(now)?depends(?exact-name(libpcre3)))'
> 
> Note that this is not documented. The apt(8) man page just says
> 
>   list
>     list is somewhat similar to dpkg-query --list in that it can
>     display a list of packages satisfying certain criteria. It supports
>     glob(7) patterns for matching package names as well as options to
>     list installed (--installed), upgradeable (--upgradeable) or all
>     available (--all-versions) versions.
> 
> but the glob(7) man page is just about globbing pathnames. And
> the dpkg-query(1) man page doesn't mention anything about the
> above syntax (in case it would be accepted).
> 
> > The behavior of patterns is better defined than that of the legacy
> > (r)depends tools. The behavior of rdepends here is not necessarily
> > useful, but it is the way it is. These commands are provided as-is
> > and will not receive drastic changes in behavior.
> > 
> > The --installed flag here behaves exactly as it is documented.
> 
> The documentation in apt-cache(8) is confusing, because "package"
> could either refer to a package name or to a particular version.
> However, the dependency relation makes sense only with a particular
> version.
> 
> And the (r)depends entries in apt-cache(8) should suggest to use
> patterns instead. Moreover, it should be clear for the user how to
> find the documentation.

Documentation for apt patterns only lives in apt-patterns(7) and
not referenced elsewhere. Patterns work in apt-cache show, apt show,
apt list, and apt install-like commands (including in apt-get).

Well the apt-get manual page states that install supports it in 
a confusing way:
> Fallback to regular expressions is deprecated in APT 2.0, has been
> removed in apt(8), except for anchored expressions, and will be removed
> from apt-get(8) in a future version. Use apt-patterns(5) instead

Other manual pages are not really touched. The entire documentation
is unorganized and barely readable, mangling all commands to apt-get
or apt-cache in a single manual page each, which is useless, hence
it needs to be rewritten entirely to have individual pages so you
can do man apt install and it gives you a description of install
and all options it accepts.

We can do this a step at a time, but it really needs to happen,
but that's all post-bookworm talk, for now I say keeping stuff
in this horrid state is better than ending with english manual
pages on non-English systems (I do not have the time anyhow).

> 
> > It filters the output list by packages that are installed; it
> > doesn't say anything about restricting matching to installed
> > versions only - matching always happens on all versions effectively.
> > 
> > The same behavior you can get with patterns by using
> > 
> > `apt list '?installed?depends(?exact-name(libpcre3))'`
> > 
> > For a machine readable output, pass the pattern to apt-cache show.
> 
> Apparently with the "?any-version" as mentioned above, otherwise the
> output is incorrect (and is even more confusing, because for instance,
> bti 034-6+b1 is output while this is actually only the older version
> bti 034-5+b1 that depends on libpcre3). But this is not documented in
> the man pages ("man -K any-version" finds no man pages).

It's documented in apt-patterns(7). And yes of course with any-version
the whole point is that without any-version it acts like rdepends
--installed.


-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer                              i speak de, en


Reply to: