build-depends keeps OR flag if end of or group is ignored
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
apt (Ubuntu) |
Fix Released
|
High
|
Unassigned | ||
Trusty |
New
|
Undecided
|
Unassigned | ||
Xenial |
Fix Released
|
Undecided
|
Unassigned | ||
Yakkety |
Won't Fix
|
Undecided
|
Unassigned | ||
Zesty |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
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 and apt-get build-dep to crash.
Even worse:
debhelper (>= 9), libnacl-dev [amd64] | libnacl-dev [i386], foobar
=> debhelper (>= 9), libnacl-dev [amd64] | foobar
[Test case]
On amd64:
cat > segv.dsc << EOF
Format: 3.0 (native)
Source: foobar
Binary: foobar
Architecture: all
Version: 1
Maintainer: Joe Sixpack <email address hidden>
Build-Depends: build-essential [amd64] | build-essential [fancy]
Standards-Version: 3.9.8
EOF
cat > failure.dsc << EOF
Format: 3.0 (native)
Source: foobar
Binary: foobar
Architecture: all
Version: 1
Maintainer: Joe Sixpack <email address hidden>
Build-Depends: build-essential [amd64] | build-essential [fancy], a-non-existing-
Standards-Version: 3.9.8
EOF
(1) apt-get build-dep -s ./segv.dsc should succeed instead of crash
(2) apt-get build-dep -s ./failure.dsc should complain about "Depends: a-non-existing-
This is the same test as run by CI and autopkgtests, so if they pass the tests passed. You can also run apt-get build-dep -s dq for a real life example that should not segfault.
[Regression Potential]
apt-get build-dep and friends can now fail where they succeeded previously for packages that employ architecture-
[Other info]
By setting the previous alternatives Or flag to the current Or flag
if the current alternative is ignored, we solve the issue.
Changed in apt (Ubuntu): | |
status: | New → In Progress |
importance: | Undecided → High |
Changed in apt (Ubuntu): | |
status: | In Progress → Fix Committed |
Changed in apt (Ubuntu Zesty): | |
status: | New → In Progress |
Changed in apt (Ubuntu Yakkety): | |
status: | New → In Progress |
Changed in apt (Ubuntu Xenial): | |
status: | New → In Progress |
This also causes crashes in python-apt due to a off-by-one error in size checking there, see 1694702