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

Bug#777071: does not parce architecture qualified Provides correctly, disagrees with dpkg



Package: apt
Version: 1.0.9.6
Tags: patch
User: helmutg@debian.org
Usertags: rebootstrap

Consider a system with native architecture amd64 and foreign
architecture i386. Then consider the following empty packages
(generateable with equivs):

Package: foo
Architecture: all
Provides: bar:i386

Package: baz
Architecture: i386
Depends: bar

With dpkg, baz can be installed without complaint. Then, apt-get check
loudly complains that baz' dependency on bar is not satisfied.

The underlying problem is that libapt-pkg does not correctly parse these
provides. Internally, it creates a version named "baz:i386" with
architecture amd64. Of course, such a package name is invalid and thus
this version is completely inaccessible. Thus, this bug should not cause
apt to accept a broken situation as valid. Nevertheless, it prevents
using architecture qualified depends.

The attached patch fixes the parsing problem. After upgrading to a
patched apt and running apt-get --no-download update, apt-get check no
longer complains.

If the patch looks good, it would be useful (for rebootstrap) to have
this fixed in some suite (presumably experimental) soon.

Helmut
diff -Nru apt-1.0.9.6/apt-pkg/deb/deblistparser.cc apt-1.0.9.6+nmu1/apt-pkg/deb/deblistparser.cc
--- apt-1.0.9.6/apt-pkg/deb/deblistparser.cc
+++ apt-1.0.9.6+nmu1/apt-pkg/deb/deblistparser.cc
@@ -817,10 +817,16 @@
       while (1)
       {
 	 Start = ParseDepends(Start,Stop,Package,Version,Op);
+	 const size_t archfound = Package.rfind(':');
 	 if (Start == 0)
 	    return _error->Error("Problem parsing Provides line");
 	 if (Op != pkgCache::Dep::NoOp && Op != pkgCache::Dep::Equals) {
 	    _error->Warning("Ignoring Provides line with non-equal DepCompareOp for package %s", Package.c_str());
+	 } else if (archfound != string::npos) {
+	    string OtherArch = Package.substr(archfound+1, string::npos);
+	    Package = Package.substr(0, archfound);
+	    if (NewProvides(Ver, Package, OtherArch, Version) == false)
+	       return false;
 	 } else if ((Ver->MultiArch & pkgCache::Version::Foreign) == pkgCache::Version::Foreign) {
 	    if (NewProvidesAllArch(Ver, Package, Version) == false)
 	       return false;
diff -Nru apt-1.0.9.6/debian/changelog apt-1.0.9.6+nmu1/debian/changelog
--- apt-1.0.9.6/debian/changelog
+++ apt-1.0.9.6+nmu1/debian/changelog
@@ -1,3 +1,10 @@
+apt (1.0.9.6+nmu1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Parse architecture qualified Provides (Closes: #-1)
+
+ -- Helmut Grohne <helmut@subdivi.de>  Tue, 03 Feb 2015 20:37:34 +0100
+
 apt (1.0.9.6) unstable; urgency=medium
 
   [ Michael Vogt ]

Reply to: