From 4c48b5618ba15d4e33625cec81843891910e81a2 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Feb 2025 12:11:20 +0100 Subject: solver3: Defer 3.0 'deep' autoremoval to 3.1, fix autoremove Restore the depcache's MarkRequired logic for 3.0 solver; and change the MarkInstall() call to pass a more correct value for FromUser, to not override an existing automatic status. --- test/integration/solver3.broken | 5 ----- 1 file changed, 5 deletions(-) (limited to 'test/integration/solver3.broken') diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken index 2212c34ae..540bfbca1 100644 --- a/test/integration/solver3.broken +++ b/test/integration/solver3.broken @@ -1,23 +1,18 @@ test-allow-scores-for-all-dependency-types -test-apt-get-autoremove -test-apt-get-autoremove-kernel-module-providers test-apt-get-upgrade-by-source test-apt-install-file-reltag test-apt-install-order-matters-a-bit test-apt-move-and-forget-manual-sections -test-apt-patterns test-bug-470115-new-and-tighten-recommends test-bug-602412-dequote-redirect test-bug-611729-mark-as-manual test-bug-675449-essential-are-protected test-bug-745046-candidate-propagation-fails -test-bug-753297-upgradable test-bug-767891-force-essential-important test-bug-961266-hold-means-hold test-dont-forget-conflicts-via-unknown-architectures test-explore-or-groups-in-markinstall test-external-dependency-solver-protocol -test-method-mirror test-parse-all-archs-into-cache test-phased-updates-new-depends test-phased-updates-upgrade -- cgit v1.2.3-70-g09d2 From 4a98dcf274123190a0ebff2bd223cbc9d11e35f9 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Feb 2025 15:54:46 +0100 Subject: solver3: Install Essential on dist-upgrade This is a bit gnarly, but dist-upgrade is mapped to is an upgrade + removals allowed + installs allowed :D --- apt-pkg/solver3.cc | 14 ++++++++++++++ test/integration/solver3.broken | 2 -- test/integration/test-bug-675449-essential-are-protected | 15 ++++++++++++++- 3 files changed, 28 insertions(+), 3 deletions(-) (limited to 'test/integration/solver3.broken') diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc index 44a5075da..f6ee1d243 100644 --- a/apt-pkg/solver3.cc +++ b/apt-pkg/solver3.cc @@ -950,6 +950,20 @@ bool APT::Solver::FromDepCache(pkgDepCache &depcache) Discover(Var(P)); } } + else if (IsUpgrade && AllowRemove && AllowInstall && (P->Flags & pkgCache::Flag::Essential)) + { + Clause w{Var(), Group::InstallManual, false}; + auto G = P.Group(); + for (auto P = G.PackageList(); not P.end(); P = G.NextPkg(P)) + if (P->Flags & pkgCache::Flag::Essential) + w.solutions.push_back(Var(P)); + std::stable_sort(w.solutions.begin(), w.solutions.end(), CompareProviders3{cache, policy, P, *this}); + if (unlikely(debug >= 1)) + std::cerr << "Install essential package " << P << std::endl; + RegisterClause(std::move(w)); + if (not AddWork(Work{rootState->clauses.back().get(), depth()})) + return false; + } } return Propagate(); diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken index 540bfbca1..74507b25f 100644 --- a/test/integration/solver3.broken +++ b/test/integration/solver3.broken @@ -6,9 +6,7 @@ test-apt-move-and-forget-manual-sections test-bug-470115-new-and-tighten-recommends test-bug-602412-dequote-redirect test-bug-611729-mark-as-manual -test-bug-675449-essential-are-protected test-bug-745046-candidate-propagation-fails -test-bug-767891-force-essential-important test-bug-961266-hold-means-hold test-dont-forget-conflicts-via-unknown-architectures test-explore-or-groups-in-markinstall diff --git a/test/integration/test-bug-675449-essential-are-protected b/test/integration/test-bug-675449-essential-are-protected index e7460aeb7..36e7b645e 100755 --- a/test/integration/test-bug-675449-essential-are-protected +++ b/test/integration/test-bug-675449-essential-are-protected @@ -112,4 +112,17 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: foo : Depends: libfoo but it is not going to be installed -E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.' aptget purge libfoo -s +E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.' aptget purge libfoo -s --solver internal + +testequal 'Reading package lists... +Building dependency tree... +Solving dependencies... +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: + foo : Depends: libfoo but it is not going to be installed +E: Conflict: foo:amd64 -> libfoo:amd64 but not libfoo:amd64' aptget purge libfoo -s --solver 3.0 -- cgit v1.2.3-70-g09d2 From e86f3d875a48987a026f79aa4e19eeda4ad01b3b Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Feb 2025 17:02:00 +0100 Subject: test: Fix 7 test cases for 3.0 solver, annotate others Fix the test cases we can fix directly; add annotations where we know what work is needed, next we'll look at the other bugs. --- test/integration/solver3.broken | 27 +++++-------- test/integration/test-apt-install-file-reltag | 29 +++++++------ test/integration/test-bug-611729-mark-as-manual | 1 + .../test-bug-745046-candidate-propagation-fails | 16 +++++++- test/integration/test-bug-961266-hold-means-hold | 47 ++++++++++++++++++++-- .../test-external-dependency-solver-protocol | 1 + test/integration/test-parse-all-archs-into-cache | 1 + test/integration/test-release-candidate-switching | 24 +++++++++-- ...t-ubuntu-bug-1304403-obsolete-priority-standard | 1 + test/integration/test-ubuntu-bug-614993 | 1 + 10 files changed, 112 insertions(+), 36 deletions(-) (limited to 'test/integration/solver3.broken') diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken index 74507b25f..adddeb9d2 100644 --- a/test/integration/solver3.broken +++ b/test/integration/solver3.broken @@ -1,24 +1,17 @@ -test-allow-scores-for-all-dependency-types -test-apt-get-upgrade-by-source -test-apt-install-file-reltag -test-apt-install-order-matters-a-bit -test-apt-move-and-forget-manual-sections +test-allow-scores-for-all-dependency-types # TBD: We are lacking single-sided conflicts preferences +test-apt-get-upgrade-by-source # TBD: Upgrading by source is not supported yet, mostly same issue as above +test-apt-install-order-matters-a-bit # Wontfix: Cannot fix, the order is not recorded in the depcache +test-apt-move-and-forget-manual-sections # TBD: Moving the auto bit is not implemented test-bug-470115-new-and-tighten-recommends test-bug-602412-dequote-redirect -test-bug-611729-mark-as-manual -test-bug-745046-candidate-propagation-fails -test-bug-961266-hold-means-hold -test-dont-forget-conflicts-via-unknown-architectures +test-dont-forget-conflicts-via-unknown-architectures # TBD: `apt upgrade` is not allowed to remove packages at all with 3.0 test-explore-or-groups-in-markinstall -test-external-dependency-solver-protocol -test-parse-all-archs-into-cache -test-phased-updates-new-depends -test-phased-updates-upgrade +test-phased-updates-new-depends # TBD: Phasing is not implemented +test-phased-updates-upgrade # TBD: Phasing is not implemented test-prevent-markinstall-multiarch-same-versionscrew -test-release-candidate-switching test-resolve-by-keep-new-recommends test-resolve-by-keep-obsolete-removals -test-ubuntu-bug-1304403-obsolete-priority-standard -test-ubuntu-bug-1990586 -test-ubuntu-bug-2025462-phased-dist-upgrade +test-ubuntu-bug-1304403-obsolete-priority-standard # TBD: Solver3 here happily removes 10 deps to upgrade a package +test-ubuntu-bug-1990586 # TBD: Phasing is not implemented +test-ubuntu-bug-2025462-phased-dist-upgrade # TBD: Phasing is not implemented test-ubuntu-bug-614993 diff --git a/test/integration/test-apt-install-file-reltag b/test/integration/test-apt-install-file-reltag index afbf9bef9..0637c5472 100755 --- a/test/integration/test-apt-install-file-reltag +++ b/test/integration/test-apt-install-file-reltag @@ -29,15 +29,20 @@ Standards-Version: 4.1.3 EOF buildsimplenativepackage 'foobar2' 'all' '1' 'unstable' 'Depends: foo (= 5), baz' +testunsat() { + testfailure "$@" + testsuccess grep -E "^E: (Unable to correct problems,|Conflict:)" "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" +} + ln -s "$(readlink -f ./incoming/foobar2_1_all.deb)" foobar.deb mkdir -p foobar -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt build-dep "$(readlink -f ./foobar.dsc)" -s -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt install "$(readlink -f ./foobar.deb)" -s -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt build-dep ./foobar.dsc -s -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt install ./foobar.deb -s +testunsat apt build-dep "$(readlink -f ./foobar.dsc)" -s +testunsat apt install "$(readlink -f ./foobar.deb)" -s +testunsat apt build-dep ./foobar.dsc -s +testunsat apt install ./foobar.deb -s cd foobar -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt build-dep ../foobar.dsc -s -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt install ../foobar.deb -s +testunsat apt build-dep ../foobar.dsc -s +testunsat apt install ../foobar.deb -s cd .. SUCCESSDSC='The following NEW packages will be installed: @@ -84,11 +89,11 @@ $SUCCESSDEB" apt install "../foobar.deb/experimental" -s cd .. msgmsg 'fail with' 'incorrect release' -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt build-dep "$(readlink -f ./foobar.dsc)/stable" -s -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt install "$(readlink -f ./foobar.deb)/stable" -s -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt build-dep ./foobar.dsc/stable -s -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt install ./foobar.deb/stable -s +testunsat apt build-dep "$(readlink -f ./foobar.dsc)/stable" -s +testunsat apt install "$(readlink -f ./foobar.deb)/stable" -s +testunsat apt build-dep ./foobar.dsc/stable -s +testunsat apt install ./foobar.deb/stable -s cd foobar -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt build-dep ../foobar.dsc/stable -s -testfailuremsg 'E: Unable to correct problems, you have held broken packages.' apt install ../foobar.deb/stable -s +testunsat apt build-dep ../foobar.dsc/stable -s +testunsat apt install ../foobar.deb/stable -s cd .. diff --git a/test/integration/test-bug-611729-mark-as-manual b/test/integration/test-bug-611729-mark-as-manual index bd9af32b6..026ede385 100755 --- a/test/integration/test-bug-611729-mark-as-manual +++ b/test/integration/test-bug-611729-mark-as-manual @@ -5,6 +5,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" . "$TESTDIR/framework" setupenvironment configarchitecture "i386" +allowremovemanual buildsimplenativepackage "peace-dpkg" "all" "1.0" "stable" diff --git a/test/integration/test-bug-745046-candidate-propagation-fails b/test/integration/test-bug-745046-candidate-propagation-fails index 64aaa6ac8..a8ee50124 100755 --- a/test/integration/test-bug-745046-candidate-propagation-fails +++ b/test/integration/test-bug-745046-candidate-propagation-fails @@ -25,7 +25,21 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: gedit : Depends: common (>= 2) but it is not installable -E: Unable to correct problems, you have held broken packages." aptget install gedit/experimental -sq=0 +E: Unable to correct problems, you have held broken packages." aptget install gedit/experimental -sq=0 --solver internal + +testfailureequal "Reading package lists... +Building dependency tree... +Selected version '2' (experimental [amd64]) for 'gedit' +Solving dependencies... +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: + gedit : Depends: common (>= 2) but it is not installable +E: Unsatisfiable dependency group gedit:amd64=2 -> common:amd64" aptget install gedit/experimental -sq=0 --solver 3.0 insertinstalledpackage 'common' 'amd64' '2' diff --git a/test/integration/test-bug-961266-hold-means-hold b/test/integration/test-bug-961266-hold-means-hold index 89c18ba85..7713760d6 100755 --- a/test/integration/test-bug-961266-hold-means-hold +++ b/test/integration/test-bug-961266-hold-means-hold @@ -75,7 +75,21 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: git-ng : Depends: git (> 1:2.26.2) -E: Unable to correct problems, you have held broken packages.' apt install git-ng -s +E: Unable to correct problems, you have held broken packages.' apt install git-ng -s --solver internal + + +testfailureequal 'Reading package lists... +Building dependency tree... +Solving dependencies... +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: + git-ng : Depends: git (> 1:2.26.2) +E: Conflict: git:amd64=1:2.25.1-1 -> not git:amd64=1:2.26.2-1 -> not git-ng:amd64=1:2.26.2-1 but git-ng:amd64=1:2.26.2-1' apt install git-ng -s --solver 3.0 msgmsg 'Now mix it up by' 'holding git-cvs' @@ -98,7 +112,21 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: git-cvs : Depends: git (< 1:2.25.1-.) -E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.' apt install git-ng -s +E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.' apt install git-ng -s --solver internal + + +testfailureequal 'Reading package lists... +Building dependency tree... +Solving dependencies... +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: + git-ng : Depends: git (> 1:2.26.2) +E: Conflict: git-cvs:amd64=1:2.25.1-1 -> git:amd64=1:2.25.1-1 -> not git:amd64=1:2.26.2-1 -> not git-ng:amd64=1:2.26.2-1 but git-ng:amd64=1:2.26.2-1' apt install git-ng -s --solver 3.0 msgmsg 'Now mix it up by' 'holding both' @@ -121,4 +149,17 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: git-ng : Depends: git (> 1:2.26.2) -E: Unable to correct problems, you have held broken packages.' apt install git-ng -s +E: Unable to correct problems, you have held broken packages.' apt install git-ng -s --solver internal + +testfailureequal 'Reading package lists... +Building dependency tree... +Solving dependencies... +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: + git-ng : Depends: git (> 1:2.26.2) +E: Conflict: git:amd64=1:2.25.1-1 -> not git:amd64=1:2.26.2-1 -> not git-ng:amd64=1:2.26.2-1 but git-ng:amd64=1:2.26.2-1' apt install git-ng -s --solver 3.0 diff --git a/test/integration/test-external-dependency-solver-protocol b/test/integration/test-external-dependency-solver-protocol index 75fc75b92..81204fc19 100755 --- a/test/integration/test-external-dependency-solver-protocol +++ b/test/integration/test-external-dependency-solver-protocol @@ -5,6 +5,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" . "$TESTDIR/framework" setupenvironment configarchitecture 'amd64' 'i386' +allowremovemanual insertinstalledpackage 'cool' 'all' '1' insertinstalledpackage 'stuff' 'all' '1' diff --git a/test/integration/test-parse-all-archs-into-cache b/test/integration/test-parse-all-archs-into-cache index 7485431db..b1992e726 100755 --- a/test/integration/test-parse-all-archs-into-cache +++ b/test/integration/test-parse-all-archs-into-cache @@ -5,6 +5,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" . "$TESTDIR/framework" setupenvironment configarchitecture 'i386' +allowremovemanual insertpackage 'unstable' 'bar' 'i386' '1' 'Depends: foo' insertpackage 'unstable' 'foo' 'i386' '1' 'Multi-Arch: foreign diff --git a/test/integration/test-release-candidate-switching b/test/integration/test-release-candidate-switching index 5233dec06..dfd59584f 100755 --- a/test/integration/test-release-candidate-switching +++ b/test/integration/test-release-candidate-switching @@ -117,6 +117,8 @@ Need to get 0 B/252 B of archives. After this operation, 258 kB of additional disk space will be used. E: Trivial Only specified but this is not a trivial operation." aptget install amarok/experimental --trivial-only -V +phonon_backend_default="phonon-backend-null (4:4.20.0+sid)" +[ "$APT_SOLVER" != "3.0" ] || phonon_backend_default="phonon-backend-xine (4:4.6.0really4.4.2-1+sid)" testfailureequal "Reading package lists... Building dependency tree... Selected version '2.3.2-2+exp' (experimental [i386]) for 'amarok-null' @@ -127,14 +129,14 @@ The following additional packages will be installed: amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) libmtp8 (0.3.1+sid) - phonon-backend-null (4:4.20.0+sid) + $phonon_backend_default The following NEW packages will be installed: amarok-common (2.3.2-2+exp) amarok-null (2.3.2-2+exp) amarok-utils (2.3.2-2+exp) libc6 (2.11.2-7+sid) libmtp8 (0.3.1+sid) - phonon-backend-null (4:4.20.0+sid) + $phonon_backend_default 0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/252 B of archives. After this operation, 258 kB of additional disk space will be used. @@ -431,7 +433,23 @@ The following information may help to resolve the situation: The following packages have unmet dependencies: uninstallablepkg : Depends: libmtp8 (>= 10:0.20.1) but it is not going to be installed Depends: amarok-utils (= 2.3.2-2+exp) but 2.3.1-1+sid is to be installed -E: Unable to correct problems, you have held broken packages." aptget install uninstallablepkg/experimental --trivial-only -V +E: Unable to correct problems, you have held broken packages." aptget install uninstallablepkg/experimental --trivial-only -V --solver internal + +# if one depends doesn't work, we don't need to look deeper… (solver3 version) +testfailureequal "Reading package lists... +Building dependency tree... +Selected version '1.0' (experimental [all]) for 'uninstallablepkg' +Solving dependencies... +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: + uninstallablepkg : Depends: libmtp8 (>= 10:0.20.1) but it is not going to be installed + Depends: amarok-utils (= 2.3.2-2+exp) but it is not going to be installed +E: Unsatisfiable dependency group uninstallablepkg:i386=1.0 -> libmtp8:i386" aptget install uninstallablepkg/experimental --trivial-only -V --solver 3.0 insertinstalledpackage 'libmtp8' 'i386' '1' insertinstalledpackage 'amarok' 'i386' '3' 'Depends: amarok-common (= 3), libmtp8 (>= 1)' diff --git a/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard b/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard index 82e1d61e8..20d4d0c29 100755 --- a/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard +++ b/test/integration/test-ubuntu-bug-1304403-obsolete-priority-standard @@ -6,6 +6,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" setupenvironment configarchitecture 'i386' +allowremovemanual # Regression test for LP: #1304403 # diff --git a/test/integration/test-ubuntu-bug-614993 b/test/integration/test-ubuntu-bug-614993 index fe830b499..c65c394c8 100755 --- a/test/integration/test-ubuntu-bug-614993 +++ b/test/integration/test-ubuntu-bug-614993 @@ -6,6 +6,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" setupenvironment configarchitecture "amd64" setupaptarchive +allowremovemanual # test success UPGRADE="Reading package lists... -- cgit v1.2.3-70-g09d2 From ffe2565c36421401550d11990a761d70ac81d208 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Feb 2025 19:08:44 +0100 Subject: solver3: Implement phasing as part of strict pinning rules Phased updates are ignored when strict pinning is on; such that only the installed version will be available. By design of SAT solvers, this means that the version selection clause is unit, and hence the version can be directly propagated, i.e. that choice is safe. --- apt-pkg/solver3.cc | 4 +++- test/integration/solver3.broken | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'test/integration/solver3.broken') diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc index 38c3e8f4a..6b0cfe971 100644 --- a/apt-pkg/solver3.cc +++ b/apt-pkg/solver3.cc @@ -879,8 +879,10 @@ bool APT::Solver::FromDepCache(pkgDepCache &depcache) { for (auto P = cache.PkgBegin(); not P.end(); P++) { + bool isForced = depcache[P].Protect() && depcache[P].Install(); + bool isPhasing = IsUpgrade && depcache.PhasingApplied(P) && not isForced; for (auto V = P.VersionList(); not V.end(); ++V) - if (P.CurrentVer() != V && depcache.GetCandidateVersion(P) != V) + if (P.CurrentVer() != V && (depcache.GetCandidateVersion(P) != V || isPhasing)) if (not Enqueue(Var(V), false, {})) return false; } diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken index adddeb9d2..3fff0854c 100644 --- a/test/integration/solver3.broken +++ b/test/integration/solver3.broken @@ -6,12 +6,9 @@ test-bug-470115-new-and-tighten-recommends test-bug-602412-dequote-redirect test-dont-forget-conflicts-via-unknown-architectures # TBD: `apt upgrade` is not allowed to remove packages at all with 3.0 test-explore-or-groups-in-markinstall -test-phased-updates-new-depends # TBD: Phasing is not implemented -test-phased-updates-upgrade # TBD: Phasing is not implemented +test-phased-updates-upgrade # TBD: `upgrade` policy cannot be overriden by explicit arguments test-prevent-markinstall-multiarch-same-versionscrew test-resolve-by-keep-new-recommends test-resolve-by-keep-obsolete-removals test-ubuntu-bug-1304403-obsolete-priority-standard # TBD: Solver3 here happily removes 10 deps to upgrade a package -test-ubuntu-bug-1990586 # TBD: Phasing is not implemented -test-ubuntu-bug-2025462-phased-dist-upgrade # TBD: Phasing is not implemented test-ubuntu-bug-614993 -- cgit v1.2.3-70-g09d2 From 2423207431980cb10c085b0890523b1e802c9ab4 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Feb 2025 20:23:59 +0100 Subject: solver3: Fix ordering of or groups We inadvertently performed a global ordering of all possible solutions for the or group using CompareProviders3. This however is not correct, as we lose the ordering of the dependency group *too* much. Mostly this has no effect, but you can see for example in test-explore-or-groups-in-markinstall various instances of it. Adjust said test case to work with the 3.0 solver to the extent possible under the current design. The 3.0 solver does Recommends after processing any manually installed packages; as such the various Recommends test cases do not work: A `Recommends: okay|upgrade` will not upgrade `upgrade` if it visited `upgrade` first. This may change at a future time, but the correct semantics for Recommends are not entirely clear. Notably, the existing solver is not always consistent. You can see here where they matter, but recently I added test-solver-recommends-depends in which the Recommends do not influence the choice of other Depends. --- apt-pkg/solver3.cc | 16 +++++---- test/integration/solver3.broken | 1 - .../test-explore-or-groups-in-markinstall | 42 +++++++++++++++++----- 3 files changed, 43 insertions(+), 16 deletions(-) (limited to 'test/integration/solver3.broken') diff --git a/apt-pkg/solver3.cc b/apt-pkg/solver3.cc index 6b0cfe971..d7a468227 100644 --- a/apt-pkg/solver3.cc +++ b/apt-pkg/solver3.cc @@ -554,19 +554,23 @@ APT::Solver::Clause APT::Solver::TranslateOrGroup(pkgCache::DepIterator start, p } delete[] all; - // If we are fixing the policy, we need to sort each alternative in an or group separately - // FIXME: This is not really true, though, we should fix the CompareProviders to ignore the - // installed state - if (FixPolicyBroken) - std::stable_sort(clause.solutions.begin() + begin, clause.solutions.end(), CompareProviders3{cache, policy, TgtPkg, *this}); + std::stable_sort(clause.solutions.begin() + begin, clause.solutions.end(), CompareProviders3{cache, policy, TgtPkg, *this}); } if (start == end) break; ++start; } while (1); + // Move obsolete packages to the end, and (non-obsolete) installed packages to the front if (not FixPolicyBroken) - std::stable_sort(clause.solutions.begin(), clause.solutions.end(), CompareProviders3{cache, policy, TgtPkg, *this}); + std::stable_sort(clause.solutions.begin(), clause.solutions.end(), [this](Var a, Var b) + { + if (IsUpgrade) + if (auto obsoleteA = Obsolete(a.CastPkg(cache)), obsoleteB = Obsolete(b.CastPkg(cache)); obsoleteA != obsoleteB) + return obsoleteB; + if ((a.CastPkg(cache)->CurrentVer == 0 || b.CastPkg(cache)->CurrentVer == 0) && a.CastPkg(cache)->CurrentVer != b.CastPkg(cache)->CurrentVer) + return a.CastPkg(cache)->CurrentVer != 0; + return false; }); if (std::all_of(clause.solutions.begin(), clause.solutions.end(), [this](auto var) -> auto { return var.CastPkg(cache)->CurrentVer == 0; })) diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken index 3fff0854c..30137e796 100644 --- a/test/integration/solver3.broken +++ b/test/integration/solver3.broken @@ -5,7 +5,6 @@ test-apt-move-and-forget-manual-sections # TBD: Moving the au test-bug-470115-new-and-tighten-recommends test-bug-602412-dequote-redirect test-dont-forget-conflicts-via-unknown-architectures # TBD: `apt upgrade` is not allowed to remove packages at all with 3.0 -test-explore-or-groups-in-markinstall test-phased-updates-upgrade # TBD: `upgrade` policy cannot be overriden by explicit arguments test-prevent-markinstall-multiarch-same-versionscrew test-resolve-by-keep-new-recommends diff --git a/test/integration/test-explore-or-groups-in-markinstall b/test/integration/test-explore-or-groups-in-markinstall index fe7e998be..00e99875a 100755 --- a/test/integration/test-explore-or-groups-in-markinstall +++ b/test/integration/test-explore-or-groups-in-markinstall @@ -55,7 +55,11 @@ _testsuccessheadtailequal() { msggroup } testsuccessheadequal() { - _testsuccessheadtailequal 'head' "$@" + msg="$1" + shift + testsuccess "$@" + cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess-no-sim-equal.output" + testsuccessequal "$msg" awk '{print} /not upgraded.$/ {exit}' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess-no-sim-equal.output" } testsuccesstailequal() { _testsuccessheadtailequal 'tail' "$@" @@ -63,14 +67,14 @@ testsuccesstailequal() { checkfoos() { msgmsg 'Install checks with foos dependency type' "$2" for level in 0 1 2; do - testsuccessheadequal 7 "Reading package lists... + testsuccessheadequal "Reading package lists... Building dependency tree... The following additional packages will be installed: okay The following NEW packages will be installed: foo-${1}-level${level} okay 0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded." apt install foo-${1}-level${level} -s - testsuccessheadequal 9 "Reading package lists... + testsuccessheadequal "Reading package lists... Building dependency tree... The following additional packages will be installed: upgrade @@ -81,7 +85,7 @@ The following packages will be upgraded: 1 upgraded, 1 newly installed, 0 to remove and 2 not upgraded." apt install foo-${1}-upgrade-level${level} -s done - testsuccessheadequal 7 "Reading package lists... + testsuccessheadequal "Reading package lists... Building dependency tree... The following additional packages will be installed: okay @@ -90,7 +94,8 @@ The following NEW packages will be installed: 0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded." apt install foo-${1}-conflict -s } checkfoos 'd' 'Depends' -checkfoos 'r' 'Recommends' +# FIXME? The 3.0 solver solves Recommends after Depends, so they do not influence our decisions here. +[ "$APT_SOLVER" = "3.0" ] || checkfoos 'r' 'Recommends' testsuccessequal 'Reading package lists... Building dependency tree... @@ -124,9 +129,9 @@ if $TEST_WITH_APTITUDE; then Need to get 0 B/84 B of archives. After unpacking 86.0 kB will be used. Would download/install/remove packages.' testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-d-level2 -sy - testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-r-level2 -sy + [ "$APT_SOLVER" = "3.0" ] || testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-r-level2 -sy # FIXME: See above for 3.0 testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-d-conflict -sy - testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-r-conflict -sy + [ "$APT_SOLVER" = "3.0" ] || testsuccesstailequal 3 "$OKAYAPTITUDE" aptitude install foo-r-conflict -sy # FIXME: See above for 3.0 fi BADSOLVETEXT='Reading package lists... @@ -137,17 +142,36 @@ 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: ' +BADSOLVETEXT3='Reading package lists... +Building dependency tree... +Solving dependencies... +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: +' testfailureequal "$BADSOLVETEXT The following packages have unmet dependencies: bad-level0 : Depends: unknown but it is not installable bad-upgrade-level0 : Depends: unknown but it is not installable -E: Unable to correct problems, you have held broken packages." apt install bad-upgrade-level1 -s +E: Unable to correct problems, you have held broken packages." apt install bad-upgrade-level1 -s --solver internal +testfailureequal "$BADSOLVETEXT3 +The following packages have unmet dependencies: + bad-upgrade-level1 : Depends: bad-upgrade-level0 (>= 2) but 1 is to be installed + Depends: unneeded2 but it is not going to be installed +E: Unsatisfiable dependency group bad-upgrade-level0:amd64=2 -> unknown:amd64" apt install bad-upgrade-level1 -s --solver 3.0 testfailureequal "$BADSOLVETEXT The following packages have unmet dependencies: bad-conflict-level0 : Conflicts: bad-conflict-level2 but 1 is to be installed bad-level0 : Depends: unknown but it is not installable -E: Unable to correct problems, you have held broken packages." apt install bad-conflict-level2 -s +E: Unable to correct problems, you have held broken packages." apt install bad-conflict-level2 -s --solver internal +testfailureequal "$BADSOLVETEXT3 +The following packages have unmet dependencies: + bad-conflict-level2 : Depends: bad-conflict-level1 but it is not going to be installed + Depends: unneeded2 but it is not going to be installed +E: Conflict: bad-conflict-level2:amd64=1 -> bad-conflict-level1:amd64 -> bad-conflict-level0:amd64 but bad-conflict-level2:amd64=1 -> not bad-conflict-level0:amd64" apt install bad-conflict-level2 -s --solver 3.0 if $TEST_WITH_APTITUDE; then testsuccesstailequal 6 'The following packages have been kept back: -- cgit v1.2.3-70-g09d2 From 175f950685df84395547119f93aa305866d7e36d Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Feb 2025 21:21:12 +0100 Subject: Fix test-phased-updates-upgrade Our upgrade policy does not support specifying packagenames to upgrade commands that are not subject to the policy. It's possible this can be addressed at a later time, but let's not block the rest of the test from running. --- test/integration/solver3.broken | 1 - test/integration/test-phased-updates-upgrade | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) (limited to 'test/integration/solver3.broken') diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken index 30137e796..876c23e68 100644 --- a/test/integration/solver3.broken +++ b/test/integration/solver3.broken @@ -5,7 +5,6 @@ test-apt-move-and-forget-manual-sections # TBD: Moving the au test-bug-470115-new-and-tighten-recommends test-bug-602412-dequote-redirect test-dont-forget-conflicts-via-unknown-architectures # TBD: `apt upgrade` is not allowed to remove packages at all with 3.0 -test-phased-updates-upgrade # TBD: `upgrade` policy cannot be overriden by explicit arguments test-prevent-markinstall-multiarch-same-versionscrew test-resolve-by-keep-new-recommends test-resolve-by-keep-obsolete-removals diff --git a/test/integration/test-phased-updates-upgrade b/test/integration/test-phased-updates-upgrade index 4f415f22e..15464bd3b 100755 --- a/test/integration/test-phased-updates-upgrade +++ b/test/integration/test-phased-updates-upgrade @@ -237,7 +237,7 @@ Conf depends-phased-dep (3 unstable-updates [all]) Conf phased-new (3 unstable-updates [all]) Conf depends-phased-new (3 unstable-updates [all]) Conf phased-security (3 unstable-updates [all]) -Conf phased-security-same (3 unstable-security, unstable-updates [all])" aptget $upgrade -s -q depends-phased-dep +Conf phased-security-same (3 unstable-security, unstable-updates [all])" aptget $upgrade -s -q depends-phased-dep --solver internal # FIXME? 3.0 does not support overrides of the policy done testsuccessequal "Reading package lists... @@ -257,7 +257,7 @@ Inst phased-security-same [1] (3 unstable-security, unstable-updates [all]) Conf phased-dep (3 unstable-updates [all]) Conf depends-phased-dep (3 unstable-updates [all]) Conf phased-security (3 unstable-updates [all]) -Conf phased-security-same (3 unstable-security, unstable-updates [all])" aptget upgrade -s -q depends-phased-dep +Conf phased-security-same (3 unstable-security, unstable-updates [all])" aptget upgrade -s -q depends-phased-dep --solver internal # FIXME? 3.0 does not support overrides of the policy # install does not respect phasing testsuccessequal "Reading package lists... -- cgit v1.2.3-70-g09d2 From fdc8682db546077cb24b2cc8861b2d5e4eee9da5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Feb 2025 21:26:10 +0100 Subject: test-dont-forget-conflicts-via-unknown-architectures: Use install, not upgrade The 3.0 solver does not support upgrade arguments to override the policy. --- test/integration/solver3.broken | 1 - test/integration/test-dont-forget-conflicts-via-unknown-architectures | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test/integration/solver3.broken') diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken index 876c23e68..33167b239 100644 --- a/test/integration/solver3.broken +++ b/test/integration/solver3.broken @@ -4,7 +4,6 @@ test-apt-install-order-matters-a-bit # Wontfix: Cannot fi test-apt-move-and-forget-manual-sections # TBD: Moving the auto bit is not implemented test-bug-470115-new-and-tighten-recommends test-bug-602412-dequote-redirect -test-dont-forget-conflicts-via-unknown-architectures # TBD: `apt upgrade` is not allowed to remove packages at all with 3.0 test-prevent-markinstall-multiarch-same-versionscrew test-resolve-by-keep-new-recommends test-resolve-by-keep-obsolete-removals diff --git a/test/integration/test-dont-forget-conflicts-via-unknown-architectures b/test/integration/test-dont-forget-conflicts-via-unknown-architectures index 07d5d8f84..f8b41c69a 100755 --- a/test/integration/test-dont-forget-conflicts-via-unknown-architectures +++ b/test/integration/test-dont-forget-conflicts-via-unknown-architectures @@ -6,6 +6,7 @@ TESTDIR="$(readlink -f "$(dirname "$0")")" setupenvironment configarchitecture 'arm64' configdpkgnoopchroot +allowremovemanual buildsimplenativepackage 'pkga' 'arm64' '1' 'stable' buildsimplenativepackage 'pkgb' 'arm64' '1' 'stable' @@ -38,6 +39,6 @@ testsuccess apt update #apt upgrade pkga -o Debug::pkgDpkgPm=1 -y -o Dpkg::use-pty=0 rm -f rootdir/var/cache/apt/*.bin -testsuccess apt upgrade pkga -y +testsuccess apt install pkga -y testdpkginstalled 'pkga' testdpkgnotinstalled 'pkgb' -- cgit v1.2.3-70-g09d2 From 47b227a6dd609528a9f9f5c46d74f95919e21826 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Feb 2025 22:04:17 +0100 Subject: ResolveByKeep: Do not pass UPGRADE_ALL to EDSP solver When we call an EDSP solver from ResolveByKeep(), we are not in an upgrade context: In an upgrade context, we call the solver directly from upgrade.cc instead of doing any Resolve() or ResolveByKeep() calls. This fixes the test-bug-602412-dequote-redirect test case, where ResolveByKeep() was called as part of --fix-missing --- apt-pkg/algorithms.cc | 2 +- test/integration/solver3.broken | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'test/integration/solver3.broken') diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc index 790ea4778..309d65977 100644 --- a/apt-pkg/algorithms.cc +++ b/apt-pkg/algorithms.cc @@ -1273,7 +1273,7 @@ bool pkgProblemResolver::KeepPhasedUpdates() bool pkgProblemResolver::ResolveByKeep(OpProgress * const Progress) { std::string const solver = _config->Find("APT::Solver", "internal"); - constexpr auto flags = EDSP::Request::UPGRADE_ALL | EDSP::Request::FORBID_NEW_INSTALL | EDSP::Request::FORBID_REMOVE; + constexpr auto flags = EDSP::Request::FORBID_NEW_INSTALL | EDSP::Request::FORBID_REMOVE; auto const ret = EDSP::ResolveExternal(solver.c_str(), Cache, flags, Progress); if (solver != "internal") return ret; diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken index 33167b239..235872b96 100644 --- a/test/integration/solver3.broken +++ b/test/integration/solver3.broken @@ -3,7 +3,6 @@ test-apt-get-upgrade-by-source # TBD: Upgrading by test-apt-install-order-matters-a-bit # Wontfix: Cannot fix, the order is not recorded in the depcache test-apt-move-and-forget-manual-sections # TBD: Moving the auto bit is not implemented test-bug-470115-new-and-tighten-recommends -test-bug-602412-dequote-redirect test-prevent-markinstall-multiarch-same-versionscrew test-resolve-by-keep-new-recommends test-resolve-by-keep-obsolete-removals -- cgit v1.2.3-70-g09d2 From 9028df1955a914230ba772776bac7fa0fb530ecf Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 11 Feb 2025 22:13:27 +0100 Subject: test-ubuntu-bug-614993: Avoid implicit upgrade-by-source requirement This allows it to work with solver3 before that feature is implemented. This essentially reverts the change to that test made in 119a8d0ed19a4e946591b9aef7d662e14ca7ece5 --- test/integration/solver3.broken | 1 - test/integration/test-ubuntu-bug-614993 | 18 ++++++++---------- 2 files changed, 8 insertions(+), 11 deletions(-) (limited to 'test/integration/solver3.broken') diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken index 235872b96..b196bc22a 100644 --- a/test/integration/solver3.broken +++ b/test/integration/solver3.broken @@ -7,4 +7,3 @@ test-prevent-markinstall-multiarch-same-versionscrew test-resolve-by-keep-new-recommends test-resolve-by-keep-obsolete-removals test-ubuntu-bug-1304403-obsolete-priority-standard # TBD: Solver3 here happily removes 10 deps to upgrade a package -test-ubuntu-bug-614993 diff --git a/test/integration/test-ubuntu-bug-614993 b/test/integration/test-ubuntu-bug-614993 index c65c394c8..564c5a860 100755 --- a/test/integration/test-ubuntu-bug-614993 +++ b/test/integration/test-ubuntu-bug-614993 @@ -12,9 +12,8 @@ allowremovemanual UPGRADE="Reading package lists... Building dependency tree... The following additional packages will be installed: - libdrm-intel1 libdrm-nouveau1 libdrm-radeon1 libdrm2 libmtdev1 - libutouch-grail1 libx11-xcb1 libxcb-aux0 libxcb-dri2-0 libxfont1 - xserver-common xserver-xorg-core xserver-xorg-input-all + libdrm-intel1 libdrm-nouveau1 libmtdev1 libutouch-grail1 libx11-xcb1 + libxcb-aux0 libxcb-dri2-0 libxfont1 xserver-common xserver-xorg-core xserver-xorg-input-evdev xserver-xorg-input-mouse xserver-xorg-input-synaptics xserver-xorg-input-vmmouse xserver-xorg-input-wacom xserver-xorg-video-all xserver-xorg-video-apm @@ -34,9 +33,8 @@ The following packages will be REMOVED: The following NEW packages will be installed: libmtdev1 libutouch-grail1 libx11-xcb1 libxcb-aux0 libxcb-dri2-0 The following packages will be upgraded: - libdrm-intel1 libdrm-nouveau1 libdrm-radeon1 libdrm2 libxfont1 - xserver-common xserver-xorg xserver-xorg-core xserver-xorg-input-all - xserver-xorg-input-evdev xserver-xorg-input-mouse + libdrm-intel1 libdrm-nouveau1 libxfont1 xserver-common xserver-xorg + xserver-xorg-core xserver-xorg-input-evdev xserver-xorg-input-mouse xserver-xorg-input-synaptics xserver-xorg-input-vmmouse xserver-xorg-input-wacom xserver-xorg-video-all xserver-xorg-video-apm xserver-xorg-video-ark xserver-xorg-video-ati xserver-xorg-video-chips @@ -50,9 +48,9 @@ The following packages will be upgraded: xserver-xorg-video-sisusb xserver-xorg-video-tdfx xserver-xorg-video-trident xserver-xorg-video-tseng xserver-xorg-video-vesa xserver-xorg-video-vmware xserver-xorg-video-voodoo -44 upgraded, 5 newly installed, 1 to remove and 0 not upgraded. -Need to get 0 B/5561 kB of archives. -After this operation, 3027 kB disk space will be freed. +41 upgraded, 5 newly installed, 1 to remove and 3 not upgraded. +Need to get 0 B/5505 kB of archives. +After this operation, 2294 kB disk space will be freed. E: Trivial Only specified but this is not a trivial operation." -testfailureequal "$UPGRADE" aptget install xserver-xorg --trivial-only +testfailureequal "$UPGRADE" aptget install xserver-xorg --trivial-only -o APT::Get::Upgrade-By-Source-Package=0 -- cgit v1.2.3-70-g09d2 From cfb8a9e8610d9595a6c1f8368835e7cfbcf67cc5 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Wed, 12 Feb 2025 00:07:30 +0100 Subject: test: Annotate the broken test cases --- test/integration/solver3.broken | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/integration/solver3.broken') diff --git a/test/integration/solver3.broken b/test/integration/solver3.broken index b196bc22a..2ad00555b 100644 --- a/test/integration/solver3.broken +++ b/test/integration/solver3.broken @@ -2,8 +2,8 @@ test-allow-scores-for-all-dependency-types # TBD: We are lackin test-apt-get-upgrade-by-source # TBD: Upgrading by source is not supported yet, mostly same issue as above test-apt-install-order-matters-a-bit # Wontfix: Cannot fix, the order is not recorded in the depcache test-apt-move-and-forget-manual-sections # TBD: Moving the auto bit is not implemented -test-bug-470115-new-and-tighten-recommends -test-prevent-markinstall-multiarch-same-versionscrew -test-resolve-by-keep-new-recommends -test-resolve-by-keep-obsolete-removals +test-bug-470115-new-and-tighten-recommends # TBD: Calculation of what is already satisfied Recommends is broken +test-prevent-markinstall-multiarch-same-versionscrew # TBD: We consider the skewed ones obsolete and remove them... +test-resolve-by-keep-new-recommends # TBD: Fixing this seems to break test-bug-591882-conkeror, why? +test-resolve-by-keep-obsolete-removals # TBD: ResolveByKeep() usage is badly aligned here test-ubuntu-bug-1304403-obsolete-priority-standard # TBD: Solver3 here happily removes 10 deps to upgrade a package -- cgit v1.2.3-70-g09d2