summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2016-04-27 19:39:02 +0200
committerJulian Andres Klode <jak@debian.org>2016-05-11 10:46:11 +0200
commitcde24ec5f51681233a2c6f2f5b6c7d0432160681 (patch)
tree7a38cce9ca844ebc2fdda63121dc20b23b493bbe
parent9d70773a207af6f7c4439ef14aae16cd20e88eca (diff)
respect user pinning in M-A:same version (un)screwing
Using Pkg.CandVersion() here is wrong as its implementation will return a candidate based just on the default policy settings ignoring user preferences and otherwise set candidates (aka: it sidesteps the pkgDepCache). This causes M-A:same libraries to be detected as screwed even through they aren't, so that they end up being kept back. Reported-By: Felipe Sateler on IRC
-rw-r--r--apt-pkg/depcache.cc4
-rwxr-xr-xtest/integration/test-prevent-markinstall-multiarch-same-versionscrew32
2 files changed, 34 insertions, 2 deletions
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index b2173d2e4..aa434e99c 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -1360,7 +1360,7 @@ bool pkgDepCache::IsInstallOkMultiArchSameVersionSynced(PkgIterator const &Pkg,
// not having a candidate or being in sync
// (simple string-compare as stuff like '1' == '0:1-0' can't happen here)
VerIterator CV = PkgState[P->ID].CandidateVerIter(*this);
- if (CV.end() == true || strcmp(Pkg.CandVersion(), CV.VerStr()) == 0)
+ if (CV.end() == true || strcmp(CandVer.VerStr(), CV.VerStr()) == 0)
continue;
// packages losing M-A:same can be out-of-sync
@@ -1375,7 +1375,7 @@ bool pkgDepCache::IsInstallOkMultiArchSameVersionSynced(PkgIterator const &Pkg,
if (unlikely(DebugMarker == true))
std::clog << OutputInDepth(Depth) << "Ignore MarkInstall of " << Pkg
<< " as it is not in sync with its M-A:same sibling " << P
- << " (" << Pkg.CandVersion() << " != " << CV.VerStr() << ")" << std::endl;
+ << " (" << CandVer.VerStr() << " != " << CV.VerStr() << ")" << std::endl;
return false;
}
diff --git a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew
index a362c881a..a46f2292a 100755
--- a/test/integration/test-prevent-markinstall-multiarch-same-versionscrew
+++ b/test/integration/test-prevent-markinstall-multiarch-same-versionscrew
@@ -11,10 +11,12 @@ insertpackage 'unstable' 'allarchs' 'all' '2'
insertpackage 'stable,installed' 'fine' 'i386,amd64' '1' 'Multi-Arch: same'
insertpackage 'unstable' 'fine' 'amd64,i386' '2' 'Multi-Arch: same'
+insertpackage 'experimental' 'fine' 'amd64,i386' '3' 'Multi-Arch: same'
insertinstalledpackage 'fine-installed' 'i386,amd64' '1' 'Multi-Arch: same'
insertpackage 'stable' 'fine-installed' 'i386,amd64,armel' '1' 'Multi-Arch: same'
insertpackage 'unstable' 'fine-installed' 'i386,amd64' '2' 'Multi-Arch: same'
+insertpackage 'experimental' 'fine-installed' 'i386,amd64' '3' 'Multi-Arch: same'
insertpackage 'stable,installed' 'out-of-sync-native' 'i386,amd64' '1' 'Multi-Arch: same'
insertpackage 'unstable' 'out-of-sync-native' 'amd64' '2' 'Multi-Arch: same'
@@ -64,6 +66,36 @@ Conf fine-installed (2 unstable [amd64])
Conf out-of-sync-gone-foreign (2 unstable [amd64])
Conf out-of-sync-gone-native:i386 (2 unstable [i386])' aptget dist-upgrade -s #-o Debug::pkgDepCache::Marker=1
+echo 'Package: fine:* fine-installed:*
+Pin: release a=experimental
+Pin-Priority: 500' > rootdir/etc/apt/preferences.d/experimental.pref
+
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be REMOVED:
+ out-of-sync-gone-foreign:i386 out-of-sync-gone-native
+The following packages have been kept back:
+ out-of-sync-foreign:i386 out-of-sync-native
+The following packages will be upgraded:
+ fine fine:i386 fine-installed fine-installed:i386 out-of-sync-gone-foreign
+ out-of-sync-gone-native:i386
+6 upgraded, 0 newly installed, 2 to remove and 2 not upgraded.
+Remv out-of-sync-gone-foreign:i386 [1]
+Remv out-of-sync-gone-native [1]
+Inst fine [1] (3 experimental [amd64]) [fine:amd64 on fine:i386] [fine:i386 on fine:amd64] [fine:i386 ]
+Inst fine:i386 [1] (3 experimental [i386])
+Inst fine-installed [1] (3 experimental [amd64]) [fine-installed:amd64 on fine-installed:i386] [fine-installed:i386 on fine-installed:amd64] [fine-installed:i386 ]
+Inst fine-installed:i386 [1] (3 experimental [i386])
+Inst out-of-sync-gone-foreign [1] (2 unstable [amd64])
+Inst out-of-sync-gone-native:i386 [1] (2 unstable [i386])
+Conf fine:i386 (3 experimental [i386])
+Conf fine (3 experimental [amd64])
+Conf fine-installed:i386 (3 experimental [i386])
+Conf fine-installed (3 experimental [amd64])
+Conf out-of-sync-gone-foreign (2 unstable [amd64])
+Conf out-of-sync-gone-native:i386 (2 unstable [i386])' aptget dist-upgrade -s #-o Debug::pkgDepCache::Marker=1
+
rm rootdir/var/lib/dpkg/status
insertinstalledpackage 'libsame2' 'i386' '1' 'Multi-Arch: same'
insertinstalledpackage 'libsame3' 'i386' '1' 'Multi-Arch: same'