Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also .

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also .
Choose a base branch
1.2.y
1.3.y
1.4.y
1.5.y
attic/cmake
bugfix/acquire-error
bugfix/acquire-priority-queue
bugfix/apt-key-config-many-fd
bugfix/apt-key-config
bugfix/apt-key-config2
bugfix/big-lock
bugfix/clog
bugfix/cmake
bugfix/cross-arch-candidate
bugfix/fix-or-in-build-dep-parsing
bugfix/gcc
bugfix/gpg-versions
bugfix/happy-eyeballs
bugfix/https-proxy-environ
bugfix/internal-seek
bugfix/lp-1653094-https-quote
bugfix/portable-docbook
bugfix/proxy-popen
bugfix/run-update-scripts-if-not-all-failed
bugfix/sane-quoting
bugfix/sha1-deprecated
bugfix/sigint
bugfix/translate-common-manpage-stuff
bugfix/verify-trust-chain
bugfix/versionhash-overflow
bugfix/748936-correct-arch-patterns
cmake-no-globbing
cmake-prepare
coverty_scan
debian/experimental-no-abi-break
debian/experimental
debian/jessie
debian/sid-gcc5
debian/sid
debian/wheezy
feature/apt-cache-policy-show-current-state
feature/blake2b
feature/configurable-hash-trust
feature/extended-cache
feature/force-compressor
feature/freeze-config-optiom
feature/http-https
feature/https-http-part2
feature/https-proxy
feature/move-methods
feature/noinstall-notautomic
feature/rpm
feature/seccomp
for-1.2/apt-key
for-1.2/locale
for-1.2/1.4
for-1.6/gcov-error-file
jessie-backports
lp1615482
lp1686470
master-pu
master
misc/error-message-rework
misc/forward-string-view
misc/include-cleanup
misc/increase-manual-scores
misc/rework-filefd-lzma
misc/select-to-poll
misc/thread-local
misc/unused
misc/wait-online
performance/cachegen
performance/crc16-sliced
performance/hex2num
performance/no-packagetable
performance/no-useless-buffering
performance/perfect-hash
performance/perfect-hash2
performance/random
performance/store-string-size
performance/tagfile
performance/trie
portability/fink
portability/freebsd
portability/macos
pu/cmake-fixes
pu/compressed-indexes
pu/dpkg-1.19
pu/drop-store-symlinks
pu/happy-eyeballs
pu/happy-eyeballs2a
pu/happy-eyeballs2
pu/method-socket
pu/mmap-no-executable
pu/ninja
pu/proxy-auto-detect
pu/rules-requires-root-no
pu/seccomp-sigaction
pu/transient-error-fixes
pu/transitional-transport-https
refactor/gpgv
reformat-test
shippable
strip-zero-epochs-from-hash
travis-docker
travis-llvm
travis-test2
travis-test3
ubuntu/master
ubuntu/trusty
ubuntu/zesty
Nothing to show
...
Choose a head branch
1.2.y
1.3.y
1.4.y
1.5.y
attic/cmake
bugfix/acquire-error
bugfix/acquire-priority-queue
bugfix/apt-key-config-many-fd
bugfix/apt-key-config
bugfix/apt-key-config2
bugfix/big-lock
bugfix/clog
bugfix/cmake
bugfix/cross-arch-candidate
bugfix/fix-or-in-build-dep-parsing
bugfix/gcc
bugfix/gpg-versions
bugfix/happy-eyeballs
bugfix/https-proxy-environ
bugfix/internal-seek
bugfix/lp-1653094-https-quote
bugfix/portable-docbook
bugfix/proxy-popen
bugfix/run-update-scripts-if-not-all-failed
bugfix/sane-quoting
bugfix/sha1-deprecated
bugfix/sigint
bugfix/translate-common-manpage-stuff
bugfix/verify-trust-chain
bugfix/versionhash-overflow
bugfix/748936-correct-arch-patterns
cmake-no-globbing
cmake-prepare
coverty_scan
debian/experimental-no-abi-break
debian/experimental
debian/jessie
debian/sid-gcc5
debian/sid
debian/wheezy
feature/apt-cache-policy-show-current-state
feature/blake2b
feature/configurable-hash-trust
feature/extended-cache
feature/force-compressor
feature/freeze-config-optiom
feature/http-https
feature/https-http-part2
feature/https-proxy
feature/move-methods
feature/noinstall-notautomic
feature/rpm
feature/seccomp
for-1.2/apt-key
for-1.2/locale
for-1.2/1.4
for-1.6/gcov-error-file
jessie-backports
lp1615482
lp1686470
master-pu
master
misc/error-message-rework
misc/forward-string-view
misc/include-cleanup
misc/increase-manual-scores
misc/rework-filefd-lzma
misc/select-to-poll
misc/thread-local
misc/unused
misc/wait-online
performance/cachegen
performance/crc16-sliced
performance/hex2num
performance/no-packagetable
performance/no-useless-buffering
performance/perfect-hash
performance/perfect-hash2
performance/random
performance/store-string-size
performance/tagfile
performance/trie
portability/fink
portability/freebsd
portability/macos
pu/cmake-fixes
pu/compressed-indexes
pu/dpkg-1.19
pu/drop-store-symlinks
pu/happy-eyeballs
pu/happy-eyeballs2a
pu/happy-eyeballs2
pu/method-socket
pu/mmap-no-executable
pu/ninja
pu/proxy-auto-detect
pu/rules-requires-root-no
pu/seccomp-sigaction
pu/transient-error-fixes
pu/transitional-transport-https
refactor/gpgv
reformat-test
shippable
strip-zero-epochs-from-hash
travis-docker
travis-llvm
travis-test2
travis-test3
ubuntu/master
ubuntu/trusty
ubuntu/zesty
Nothing to show
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 2 files changed
  • 0 commit comments
  • 1 contributor
Commits on Mar 27, 2016
Consider different architectures in the no-downgrade rule
Prevent cross-architecture downgrades (A:amd64=2 to A:i386=1)
by default, as they are somewhat surprising and can also
cause issues.

We should special case that for foreign/allowed, but doing
this more generically should not hurt either, as 'same' has
implicit same-version dependencies and 'no' only allows a
single installed version in a group anyway.
Showing with 47 additions and 10 deletions.
  1. +16 −4 apt-pkg/policy.cc
  2. +31 −6 test/integration/test-bug-612099-multiarch-conflicts
View
@@ -30,6 +30,7 @@
#include <ctype.h>
#include <stddef.h>
#include <string.h>
+#include <algorithm>
#include <string>
#include <vector>
#include <iostream>
@@ -230,20 +231,31 @@ pkgCache::VerIterator pkgPolicy::GetCandidateVer(pkgCache::PkgIterator const &Pk
pkgCache::VerIterator pkgPolicy::GetCandidateVerNew(pkgCache::PkgIterator const &Pkg)
{
// TODO: Replace GetCandidateVer()
+ pkgCache::GrpIterator group;
pkgCache::VerIterator cand;
- pkgCache::VerIterator cur = Pkg.CurrentVer();
+ std::vector<pkgCache::VerIterator> curs;
int candPriority = -1;
pkgVersioningSystem *vs = Cache->VS;
+ // Find all installed versions, across all architectures
+ group = Pkg.Group();
+ for (auto p = group.PackageList(); p.end() == false; p = group.NextPkg(p)) {
+ auto cur = p.CurrentVer();
+ if (cur.end() == false)
+ curs.push_back(cur);
+ }
+
for (pkgCache::VerIterator ver = Pkg.VersionList(); ver.end() == false; ++ver) {
int priority = GetPriority(ver, true);
if (priority == 0 || priority <= candPriority)
continue;
- // TODO: Maybe optimize to not compare versions
- if (!cur.end() && priority < 1000
- && (vs->CmpVersion(ver.VerStr(), cur.VerStr()) < 0))
+ // Check that we do not downgrade, even across architectures, unless
+ // priority is >= 1000.
+ if (!curs.empty() && priority < 1000 &&
+ std::any_of(curs.begin(), curs.end(), [&vs, &ver](pkgCache::VerIterator const &cur) {
+ return vs->CmpVersion(ver.VerStr(), cur.VerStr()) < 0; }))
continue;
candPriority = priority;
@@ -95,12 +95,24 @@ The following NEW packages will be installed:
Inst foobar (1.0 stable [i386])
Conf foobar (1.0 stable [i386])" aptget install foobar/stable -st testing
+testfailureequal "Reading package lists...
+Building dependency tree...
+Reading state information...
+Selected version '1.0' (stable [amd64]) for 'foobar:amd64'
+Some packages could not be installed. This may mean that you have
+requested an impossible situation or if you are using the unstable
+distribution that some required packages have not yet been created
+or been moved out of Incoming.
+The following information may help to resolve the situation:
+
+The following packages have unmet dependencies:
+ foobar:amd64 : Depends: libc6:amd64 but it is not installable
+E: Unable to correct problems, you have held broken packages." aptget install foobar:amd64/stable -st testing
testsuccessequal "Reading package lists...
Building dependency tree...
Reading state information...
Selected version '1.0' (stable [amd64]) for 'foobar:amd64'
-The following additional packages will be installed:
- libc6:amd64
+Selected version '1.0' (stable [amd64]) for 'libc6:amd64'
The following packages will be REMOVED:
libc6
The following NEW packages will be installed:
@@ -110,7 +122,7 @@ Remv libc6 [2.0]
Inst libc6:amd64 (1.0 stable [amd64])
Inst foobar:amd64 (1.0 stable [amd64])
Conf libc6:amd64 (1.0 stable [amd64])
-Conf foobar:amd64 (1.0 stable [amd64])" aptget install foobar:amd64/stable -st testing
+Conf foobar:amd64 (1.0 stable [amd64])" aptget install foobar:amd64/stable libc6:amd64/stable -st testing
testsuccessequal "Reading package lists...
@@ -207,12 +219,25 @@ The following NEW packages will be installed:
Inst foobar-same (1.0 stable [i386])
Conf foobar-same (1.0 stable [i386])" aptget install foobar-same/stable -st testing
+testfailureequal "Reading package lists...
+Building dependency tree...
+Reading state information...
+Selected version '1.0' (stable [amd64]) for 'foobar-same:amd64'
+Some packages could not be installed. This may mean that you have
+requested an impossible situation or if you are using the unstable
+distribution that some required packages have not yet been created
+or been moved out of Incoming.
+The following information may help to resolve the situation:
+
+The following packages have unmet dependencies:
+ foobar-same:amd64 : Depends: libc6-same:amd64 but it is not installable
+E: Unable to correct problems, you have held broken packages." aptget install foobar-same:amd64/stable -st testing
+
testsuccessequal "Reading package lists...
Building dependency tree...
Reading state information...
Selected version '1.0' (stable [amd64]) for 'foobar-same:amd64'
-The following additional packages will be installed:
- libc6-same:amd64
+Selected version '1.0' (stable [amd64]) for 'libc6-same:amd64'
The following packages will be REMOVED:
libc6-same
The following NEW packages will be installed:
@@ -222,4 +247,4 @@ Remv libc6-same [2.0]
Inst libc6-same:amd64 (1.0 stable [amd64])
Inst foobar-same:amd64 (1.0 stable [amd64])
Conf libc6-same:amd64 (1.0 stable [amd64])
-Conf foobar-same:amd64 (1.0 stable [amd64])" aptget install foobar-same:amd64/stable -st testing
+Conf foobar-same:amd64 (1.0 stable [amd64])" aptget install foobar-same:amd64/stable libc6-same:amd64/stable -st testing

No commit comments for this range