summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2017-05-30 22:24:14 +0200
committerJulian Andres Klode <jak@debian.org>2017-06-19 13:52:57 +0200
commitaefd6603008fdc304bf41215fe724ac056d80a30 (patch)
tree6453a7d876497faa0849a3f6bda3ce0a20027882 /apt-pkg
parent36c2f157ab8f44283da66752730565fdd7259b08 (diff)
Fix parsing of or groups in build-deps with ignored packages
If the last alternative(s) of an Or group is ignored, because it does not match an architecture list, we would end up keeping the or flag, effectively making the next AND an OR. For example, when parsing (on amd64): debhelper (>= 9), libnacl-dev [amd64] | libnacl-dev [i386] => debhelper (>= 9), libnacl-dev | Which can cause python-apt to crash. Even worse: debhelper (>= 9), libnacl-dev [amd64] | libnacl-dev [i386], foobar => debhelper (>= 9), libnacl-dev [amd64] | foobar By setting the previous alternatives Or flag to the current Or flag if the current alternative is ignored, we solve the issue. LP: #1694697 (cherry picked from commit 7ddf958e370d13f93edc6923bee289b2f6444b41) (cherry picked from commit 423ba4a958b9da02926e586bf59995817cafc32a)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/debsrcrecords.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index 14a67cec1..638a6e1ac 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -119,8 +119,18 @@ bool debSrcRecordParser::BuildDepends(std::vector<pkgSrcRecords::Parser::BuildDe
return _error->Error("Problem parsing dependency: %s", fields[I]);
rec.Type = I;
- if (rec.Package != "")
+ // We parsed a package that was ignored (wrong architecture restriction
+ // or something).
+ if (rec.Package == "") {
+ // If we are in an OR group, we need to set the "Or" flag of the
+ // previous entry to our value.
+ if (BuildDeps.size() > 0 && (BuildDeps[BuildDeps.size() - 1].Op & pkgCache::Dep::Or) == pkgCache::Dep::Or) {
+ BuildDeps[BuildDeps.size() - 1].Op &= ~pkgCache::Dep::Or;
+ BuildDeps[BuildDeps.size() - 1].Op |= (rec.Op & pkgCache::Dep::Or);
+ }
+ } else {
BuildDeps.push_back(rec);
+ }
if (Start == Stop)
break;