Package: dpkg
Version: 1.13.11
Tags: patch
If you have a situation where some packages A, B, C
A -depends-> B' <-provides B
B -depends-> C' <-provides C
C -depends-> A' <-provides A
then dpkg doesn't break the cycle correctly. This breaks for any
length of cycle, not just 3 packages. In particular it breaks if A
depends on something that it itself provides (this seems to be a
fairly common packaging mistake).
While investigating a case of this bug I found that there was a line
of code which was quite wrong but which looked like an attempt to fix
this problem; it presumably caused whatever test case that developer
was using to pass:
if (foundcyclebroken(&thislink,sofar,possi->ed,
provider->installed.depended))
return 1;
from the deepest point in findbreakcyclerecursive (wrapped by me for
this email). This line is quite wrong. provider->installed.depended
is the head of a linked list and may have nothing to do with the
questions at hand; if you're lucky it is and then something useful
might happen I suppose (I haven't analysed this in detail). But I
assume that this must have been an attempt to fix the bug I have now
fixed properly, since it might make the inner `provides-breaking' loop
in findbreakcyclerecursive actually do something sometimes, which it
otherwise would never do.
The correct fix is attached.
I was investigating this problem due to a report from an Ubuntu user
about 1.13.11ubuntu6, at bugs.launchpad.net/46530. But this problem
is probably related to Debian #143307.
The patch provided by Frank Lichtenfeld in #349442 is also wrong and
might lead to infinite recursion. findbreakcyclerecursive is not
allowed to recurse except via foundcyclebroken because
foundcyclebroken is the thing which detects the cycle and breaks it.
Ian.
diff -Nru /tmp/LqKFunIQBz/dpkg-1.13.11ubuntu6/debian/changelog
/tmp/Nt4poBbeb8/dpkg-1.13.11ubuntu7/debian/changelog
--- /tmp/LqKFunIQBz/dpkg-1.13.11ubuntu6/debian/changelog 2006-05-05
16:24:31.000000000 +0100
+++ /tmp/Nt4poBbeb8/dpkg-1.13.11ubuntu7/debian/changelog 2006-06-02
18:49:34.000000000 +0100
@@ -1,3 +1,11 @@
+dpkg (1.13.11ubuntu7) who-knows; urgency=low
+
+ * Fix dependency cycle breaking in the case when every link involves a
+ Provides. Malone 46530 and no doubt many other similar reports.
+ Also remove someone else's absurd attempt to solve the same problem.
+
+ -- Ian Jackson <[EMAIL PROTECTED]> Fri, 2 Jun 2006 18:48:49 +0100
+
dpkg (1.13.11ubuntu6) dapper; urgency=low
* Completely remove md5sum diversion madness. Instead, we Pre-Depend
diff -Nru /tmp/LqKFunIQBz/dpkg-1.13.11ubuntu6/src/depcon.c
/tmp/Nt4poBbeb8/dpkg-1.13.11ubuntu7/src/depcon.c
--- /tmp/LqKFunIQBz/dpkg-1.13.11ubuntu6/src/depcon.c 2005-06-06
05:07:12.000000000 +0100
+++ /tmp/Nt4poBbeb8/dpkg-1.13.11ubuntu7/src/depcon.c 2006-06-02
18:54:28.000000000 +0100
@@ -56,7 +56,7 @@
for (sol=sofar; sol && sol->pkg != dependedon; sol=sol->back);
/* If not, we do a recursive search on it to see what we find. */
- if (!sol) return findbreakcyclerecursive(possi->ed,thislink);
+ if (!sol) return findbreakcyclerecursive(dependedon,thislink);
debug(dbg_depcon,"found cycle");
/* Right, we now break one of the links. We prefer to break
@@ -126,7 +126,6 @@
* still the one we use.
*/
if (foundcyclebroken(&thislink,sofar,provider,possi)) return 1;
- if
(foundcyclebroken(&thislink,sofar,possi->ed,provider->installed.depended))
return 1;
}
}
}