]> git.saurik.com Git - apt.git/commitdiff
parse arch-qualified Provides correctly
authorHelmut Grohne <helmut@subdivi.de>
Mon, 9 Mar 2015 17:11:10 +0000 (18:11 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Mon, 16 Mar 2015 17:01:47 +0000 (18:01 +0100)
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.

Closes: 777071
apt-pkg/deb/deblistparser.cc

index 462818a039d7c24d354ab2669f5a70b5a3e335cd..49bc3adfc57d0f9453907ca8c5fea57610888774 100644 (file)
@@ -853,10 +853,16 @@ bool debListParser::ParseProvides(pkgCache::VerIterator &Ver)
       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;