#880499 apt-cache rdepends outputs too many dependencies

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Tom
Date:
2022-01-22 13:09:06 UTC
Severity:
minor
Tags:
#880499#5
Date:
2017-11-01 13:18:24 UTC
From:
To:
Dear Maintainer,

I try to find all reverse dependencies of a certain package. I'm only interested in "Depends" relations, no Recommends, Suggests, etc. So, for instance, for the aptitude package, I do:

$ apt-cache rdepends "aptitude" --installed --no-pre-depends --no-suggests --no-recommends --no-conflicts --no-breaks --no-replaces --no-enhances
aptitude
Reverse Depends:
    aptitude:i386
    aptitude:i386
    aptitude:i386
    aptitude:i386
    aptitude:i386

But there are no reverse dependencies on aptitude, as reported be aptitude:
i     aptitude

[... some lines skipped ...]

#880499#10
Date:
2022-01-22 12:50:53 UTC
From:
To:
Control: tags -1 moreinfo
Control: severity -1 minor
	I try to reserve my inbox for private communication only.]

 > I try to find all reverse dependencies of a certain package.  I’m
 > only interested in “Depends” relations, no Recommends, Suggests, etc.
 > So, for instance, for the aptitude package, I do:

 >  $ apt-cache rdepends "aptitude" --installed \
 >        --no-pre-depends \

	As an aside, I’m going to question whether omitting Pre-Depends:
	is really what you’re looking for, as Pre-Depends: is essentially
	a stronger / specialized form of Depends:.  For instance, Debian
	Policy Manual states [1]:

  Pre-Depends

    This field is like Depends, except that it also forces dpkg to
    complete installation of the packages named before even starting the
    installation of the package which declares the pre-dependency […]

  [1] http://debian.org/doc/debian-policy/ch-relationships.html

 >        --no-suggests --no-recommends --no-conflicts --no-breaks \
 >        --no-replaces --no-enhances

	Also note that at some point apt-cache acquired the --important
	option, which seems effectively the same as the above [2]
	(though the man page somehow does not mention rdepends here):

  -i, --important

    Print only important dependencies; for use with unmet and depends.
    Causes only Depends and Pre-Depends relations to be printed.
    Configuration Item: APT::Cache::Important.

  [2] http://manpages.debian.org/unstable/apt/apt-cache.8.en.html

 > aptitude
 > Reverse Depends:
 >     aptitude:i386
 >     aptitude:i386
 >     aptitude:i386
 >     aptitude:i386
 >     aptitude:i386

 > But there are no reverse dependencies on aptitude, as reported be
 > aptitude:

 > i     aptitude

 > [… some lines skipped …]

 > --\ Packages which depend on aptitude (23)
 >     --\ Depends (5)
 > p     aptitude-robot 1.5.1-1

[…]

	What I see above is actually exactly the opposite: the apt-cache
	call reports the aptitude:i386 package several times over, but
	/no/ (installed, due to the --install option) packages dependent
	on it, while aptitude reports a number of (non-installed,
	presumably) dependencies, such as aptitude-robot.

	Were there dependent packages satisfying the criteria given,
	the output would contain something like:

Reverse Depends:
  aptitude-robot
    aptitude:amd64

	The output may be a tad confusing (and likely worth fixing),
	but that’s pretty much the only issue I can discern here.