Bug#128868: debian-policy: Depends semantics unclear re circular depends
Package: debian-policy
Version: 3.5.6.0
Severity: wishlist
From section 7.2 `Binary Dependencies' of debian-policy:
# `Depends'
# This declares an absolute dependency. A package will not be
# configured unless all of the packages listed in its `Depends'
# field have been correctly configured.
Suppose that package A Depends on B, and package B Depends on A.
My reading of the above policy excerpt is that is that circular
dependencies are not allowed, since it would be impossible to configure
either A or B without first configuring the other.[*1]
Whereas, in fact, a number of dependency cycles do occur in Debian; a
quick-and-dirty script (appended to this message) lists 65 cycles, of
which I've manually verified 4 (cpp <> cpp-2.95; perl <> perl-modules;
python <> python2.1; kdelibs3 <> kdelibs3-bin).
Given that the most natural reading of current policy forbids this
practice that occurs within some fairly high-profile packages, the
current wording of policy should be reworded: either it should make clear
that packages may be configured before their dependencies are configured,
or else explicitly state that dependency cycles are not allowed.
pjm.
[*1]: A notational shortcut is used in the A <-> B example, in that with
`x Depends: y', x is a "package instance", whereas y is a package
specification that can potentially be met by any of several package
instances, e.g. different version numbers. Where the above says "A
Depends on B" above, assume that B is the only package instance that
meets A's actual dependency specification. This is the usual case when
installing for the first time.
Quick-and-dirty cycle-finding script (results require manual
verification, see the above comments):
Shell part:
cat /var/lib/apt/lists/*_dists_unstable_main_*Packages |
egrep '^(Package|(Pre-)?Depends):' |
sed 's,([^)]*),,g' |
tr -s ',| ' ' ' |
perl to-tsort-in.pl |
tsort 2>&1 > /dev/null |
grep -v '^tsort: input contains a loop:$' |
sed 's,^tsort: ,,' > cycles
Perl part (to-tsort-in.pl):
#! /usr/bin/perl -w
use strict;
my $pkg;
while(<>) {
chomp;
if(s/^Package: //) {
$pkg = $_;
next;
}
if(s/^(?:Pre-)?Depends: //) {
my @deps = split(' ', $_);
for my $i (@deps) {
print "$pkg $i\n";
}
next;
}
die("unrecognized line");
}
Reply to: