]> git.saurik.com Git - apt.git/commitdiff
Do not mark packages for keep that we want to remove
authorJulian Andres Klode <jak@debian.org>
Sat, 26 Mar 2016 23:20:05 +0000 (00:20 +0100)
committerJulian Andres Klode <jak@debian.org>
Sun, 27 Mar 2016 00:09:14 +0000 (01:09 +0100)
If the package is marked for removal, keep it marked for
removal and do not mark it for keep. If we mark it for keep,
we some how later get to a different stage where it is marked
for unpack instead of removal.

In the example in the bug report, we would get a:

 SmartUnPack maas-region-controller-min:amd64 (replace version 2.0.0~alpha3+bzr4810-0ubuntu1 with Segmentation fault

maas-region-controller-min:amd64 was marked for removal, but
we changed it to keep and somehow it thinks that this is to
be replaced now instead of removed (probably because the
InstallVer != CandidateVer [with InstallVer = 0]).

This fixes a regression introduced in release 1.2.7, commit:
  0390edd5452b081f8efcf412f96d535a1d959457

Reported-by: LaMont Jones on IRC
LP: #1562402

apt-pkg/depcache.cc
test/integration/test-bug-lp1562402-nomark-removals-as-keep [new file with mode: 0755]

index 4940387a6b09b541007c137b501809048d525302..b2173d2e4b02ffd1c20224dc2f06fe17e751d2af 100644 (file)
@@ -1424,8 +1424,11 @@ bool pkgDepCache::IsInstallOkDependenciesSatisfiableByCandidates(PkgIterator con
          {
            SetCandidateVersion(Pkg.CurrentVer());
             StateCache &State = PkgState[Pkg->ID];
-            State.Mode = ModeKeep;
-            State.Update(Pkg, *this);
+           if (State.Mode != ModeDelete)
+           {
+              State.Mode = ModeKeep;
+              State.Update(Pkg, *this);
+           }
          }
         return false;
       }
diff --git a/test/integration/test-bug-lp1562402-nomark-removals-as-keep b/test/integration/test-bug-lp1562402-nomark-removals-as-keep
new file mode 100755 (executable)
index 0000000..05f4370
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'unstable' 'maas-common' 'all' '2.0.0~alpha4+bzr4843-0ubuntu1~xenial2'
+insertpackage 'unstable' 'maas-region-controller-min' 'amd64' '2.0.0~alpha4+bzr4837-0ubuntu1~xenial1'  'Depends: maas-common (= 2.0.0~alpha4+bzr4837-0ubuntu1~xenial1)'
+insertpackage 'unstable' 'maas-region-api' 'amd64' '2.0.0~alpha4+bzr4843-0ubuntu1~xenial2' 'Depends: maas-common (= 2.0.0~alpha4+bzr4843-0ubuntu1~xenial2)\nConflicts: maas-region-controller-min\nProvides: maas-region-controller-min'
+insertpackage 'unstable' 'maas-region-controller' 'all' '2.0.0~alpha4+bzr4843-0ubuntu1~xenial2' 'Depends: maas-region-api (= 2.0.0~alpha4+bzr4843-0ubuntu1~xenial2)'
+
+insertinstalledpackage 'maas-common' 'all' '2.0.0~alpha3+bzr4810-0ubuntu1'
+insertinstalledpackage 'maas-region-controller-min' 'amd64' '2.0.0~alpha3+bzr4810-0ubuntu1' 'Depends: maas-common (= 2.0.0~alpha3+bzr4810-0ubuntu1)'
+insertinstalledpackage 'maas-region-controller' 'all' '2.0.0~alpha3+bzr4810-0ubuntu1' 'Depends: maas-region-controller-min (= 2.0.0~alpha3+bzr4810-0ubuntu1)'
+
+setupaptarchive
+
+testsuccess aptget dist-upgrade -s -o Debug::pkgDepCache::AutoInstall=true  -o Debug::pkgPackageManager=yes  -o Debug::pkgProblemResolver=yes
+testsuccessequal 'Reading package lists...
+Building dependency tree...
+Calculating upgrade...
+The following packages will be REMOVED:
+  maas-region-controller-min
+The following NEW packages will be installed:
+  maas-region-api
+The following packages will be upgraded:
+  maas-common maas-region-controller
+2 upgraded, 1 newly installed, 1 to remove and 0 not upgraded.
+Inst maas-region-controller [2.0.0~alpha3+bzr4810-0ubuntu1] (2.0.0~alpha4+bzr4843-0ubuntu1~xenial2 unstable [all]) []
+Remv maas-region-controller-min [2.0.0~alpha3+bzr4810-0ubuntu1] []
+Inst maas-common [2.0.0~alpha3+bzr4810-0ubuntu1] (2.0.0~alpha4+bzr4843-0ubuntu1~xenial2 unstable [all]) []
+Inst maas-region-api (2.0.0~alpha4+bzr4843-0ubuntu1~xenial2 unstable [amd64])
+Conf maas-common (2.0.0~alpha4+bzr4843-0ubuntu1~xenial2 unstable [all])
+Conf maas-region-api (2.0.0~alpha4+bzr4843-0ubuntu1~xenial2 unstable [amd64])
+Conf maas-region-controller (2.0.0~alpha4+bzr4843-0ubuntu1~xenial2 unstable [all])' \
+aptget dist-upgrade -s