From 8cd4bd5f708b69d536395675da4fce18d7f9c3f3 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 25 Oct 2025 21:25:23 +0200 Subject: solver3: Do not lose notion that we backtracked Record a silly string if we backtracked such that we are aware of it. We need to handle this in a broader fashion, but this was at least breaking test-apt-never-markauto-sections with remove-manual LP: #2129819 --- apt-pkg/solver3.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg/solver3.h') diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h index 8d834b313..5590df5cc 100644 --- a/apt-pkg/solver3.h +++ b/apt-pkg/solver3.h @@ -477,6 +477,8 @@ struct APT::Solver::State // Vars < 0 are package ID, reasons > 0 are version IDs. const Clause *reason{}; + const char *reasonStr{}; + // \brief The depth at which the decision has been taken depth_type depth{0}; -- cgit v1.2.3-70-g09d2 From a3fca052ca21ad222ac7f2fdd7f3fe84b44beb60 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sat, 25 Oct 2025 21:31:34 +0200 Subject: solver3: Allow removing manually installed packages --- apt-pkg/solver3.h | 2 +- test/integration/test-apt-never-markauto-sections | 4 ++-- ...test-bug-598669-install-postfix-gets-exim-heavy | 4 ++-- test/integration/test-bug-612557-garbage-upgrade | 4 ++-- .../test-bug-618848-always-respect-user-requests | 4 ++-- ...test-bug-64141-install-dependencies-for-on-hold | 8 ++++++-- test/integration/test-bug-961266-hold-means-hold | 23 +++++++++------------ .../integration/test-dpkg-i-apt-install-fix-broken | 24 ++++++++++++++++++++++ .../test-solver3-show-version-selection | 24 ++++++++++++++++++++-- ...st-ubuntu-bug-2111792-intersecting-dependencies | 23 +++++++++------------ vendor/ubuntu/apt.conf-01-vendor-ubuntu | 4 ---- 11 files changed, 81 insertions(+), 43 deletions(-) (limited to 'apt-pkg/solver3.h') diff --git a/apt-pkg/solver3.h b/apt-pkg/solver3.h index 5590df5cc..45b55d962 100644 --- a/apt-pkg/solver3.h +++ b/apt-pkg/solver3.h @@ -237,7 +237,7 @@ class Solver // \brief If set, removals are allowed. bool AllowRemove{_config->FindB("APT::Solver::Remove", not(requestFlags & EDSP::Request::FORBID_REMOVE))}; // \brief If set, removal of manual packages is allowed. - bool AllowRemoveManual{AllowRemove && _config->FindB("APT::Solver::RemoveManual", false)}; + bool AllowRemoveManual{AllowRemove && _config->FindB("APT::Solver::RemoveManual", true)}; // \brief If set, installs are allowed. bool AllowInstall{_config->FindB("APT::Solver::Install", not(requestFlags & EDSP::Request::FORBID_NEW_INSTALL))}; // \brief If set, we use strict pinning. diff --git a/test/integration/test-apt-never-markauto-sections b/test/integration/test-apt-never-markauto-sections index bf08507d0..14ce3ae5a 100755 --- a/test/integration/test-apt-never-markauto-sections +++ b/test/integration/test-apt-never-markauto-sections @@ -60,7 +60,7 @@ testfailuremsg 'E: Unable to satisfy dependencies. Reached two conflicting decis - texteditor:amd64 is selected for removal 2. bad-texteditor:amd64 Depends texteditor but none of the choices are installable: - - texteditor:amd64 is selected for removal' aptget autoremove texteditor -s --solver 3.0 #-o Debug::pkgDepCache::AutoInstall=1 -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 + - texteditor:amd64 is selected for removal' aptget autoremove texteditor -s --solver 3.0 -o APT::Solver::RemoveManual=0 #-o Debug::pkgDepCache::AutoInstall=1 -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 testsuccessequal 'Reading package lists... Building dependency tree... Reading state information... @@ -69,7 +69,7 @@ The following packages will be REMOVED: 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. Remv mydesktop [1] Remv mydesktop-core [1] -Remv texteditor [1]' aptget autoremove texteditor -s --solver internal #-o Debug::pkgDepCache::AutoInstall=1 -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 +Remv texteditor [1]' aptget autoremove texteditor -s #-o Debug::pkgDepCache::AutoInstall=1 -o Debug::pkgProblemResolver=1 -o Debug::pkgDepCache::Marker=1 testsuccess aptget autoremove texteditor -y --solver internal testdpkgnotinstalled mydesktop mydesktop-core texteditor diff --git a/test/integration/test-bug-598669-install-postfix-gets-exim-heavy b/test/integration/test-bug-598669-install-postfix-gets-exim-heavy index b3f11956b..a87481302 100755 --- a/test/integration/test-bug-598669-install-postfix-gets-exim-heavy +++ b/test/integration/test-bug-598669-install-postfix-gets-exim-heavy @@ -13,8 +13,8 @@ testfailuremsg "E: Unable to satisfy dependencies. Reached two conflicting decis 2. postfix:i386=2.7.1-1 is not selected for install because: 1. exim4-daemon-light:i386 is selected for install 2. exim4-daemon-light:i386 Conflicts mail-transport-agent - [selected exim4-daemon-light:i386]" aptget install postfix --solver 3.0 -allowremovemanual + [selected exim4-daemon-light:i386]" aptget install postfix --solver 3.0 -o APT::Solver::RemoveManual=0 -s + testfailureequal "Reading package lists... Building dependency tree... The following packages will be REMOVED: diff --git a/test/integration/test-bug-612557-garbage-upgrade b/test/integration/test-bug-612557-garbage-upgrade index 00bc9ac2d..ced55a5bf 100755 --- a/test/integration/test-bug-612557-garbage-upgrade +++ b/test/integration/test-bug-612557-garbage-upgrade @@ -26,7 +26,7 @@ testfailuremsg "E: Unable to satisfy dependencies. Reached two conflicting decis 2. openoffice.org-common:i386=1:3.2.1-11+squeeze2 is selected for install because: 1. openoffice.org-emailmerge:i386 is selected for install 2. openoffice.org-emailmerge:i386 PreDepends openoffice.org-common - 3. openoffice.org-common:i386 is available in version 1:3.2.1-11+squeeze2" aptget --trivial-only install python-uno --solver 3.0 + 3. openoffice.org-common:i386 is available in version 1:3.2.1-11+squeeze2" aptget --trivial-only install python-uno --solver 3.0 -o APT::Solver::RemoveManual=false testfailureequal 'Reading package lists... Building dependency tree... Reading state information... @@ -41,7 +41,7 @@ The following packages will be upgraded: 1 upgraded, 1 newly installed, 2 to remove and 0 not upgraded. Need to get 0 B/84 B of archives. After this operation, 53.2 MB disk space will be freed. -E: Trivial Only specified but this is not a trivial operation.' aptget --trivial-only install python-uno --solver internal +E: Trivial Only specified but this is not a trivial operation.' aptget --trivial-only install python-uno testsuccess aptmark markauto openoffice.org-emailmerge testmarkedauto python-uno openoffice.org-common openoffice.org-emailmerge diff --git a/test/integration/test-bug-618848-always-respect-user-requests b/test/integration/test-bug-618848-always-respect-user-requests index b1cccef9d..6dd77af58 100755 --- a/test/integration/test-bug-618848-always-respect-user-requests +++ b/test/integration/test-bug-618848-always-respect-user-requests @@ -18,8 +18,8 @@ testfailuremsg "E: Unable to satisfy dependencies. Reached two conflicting decis 1. exim4-daemon-light:i386 is selected for install 2. exim4-daemon-light:i386 Depends libdb4.8 but none of the choices are installable: - - libdb4.8:i386 is selected for removal" aptget remove libdb4.8 --solver 3.0 -s -allowremovemanual + - libdb4.8:i386 is selected for removal" aptget remove libdb4.8 --solver 3.0 -o APT::Solver::RemoveManual=0 -s + testsuccessequal "Reading package lists... Building dependency tree... The following packages will be REMOVED: diff --git a/test/integration/test-bug-64141-install-dependencies-for-on-hold b/test/integration/test-bug-64141-install-dependencies-for-on-hold index cfb241614..8e2083602 100755 --- a/test/integration/test-bug-64141-install-dependencies-for-on-hold +++ b/test/integration/test-bug-64141-install-dependencies-for-on-hold @@ -31,11 +31,15 @@ The following packages will be upgraded: 1 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. Need to get 0 B/42 B of archives. After this operation, 0 B of additional disk space will be used. -E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only --solver 3.0 +E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only --solver 3.0 -o APT::Solver::RemoveManual=0 -testfailure aptget dist-upgrade --trivial-only --solver 3.0 -o debug::apt::solver=2 +testfailure aptget dist-upgrade --trivial-only --solver 3.0 -o debug::apt::solver=2 -o APT::Solver::RemoveManual=0 testsuccess grep -Fx "[0] Reject:apt:$native=0.8.10 (oldcrap:$native -> oldcrap:$native=1-1)" rootdir/tmp/testfailure.output +testfailure aptget dist-upgrade --trivial-only --solver 3.0 -o debug::apt::solver=2 -o APT::Solver::RemoveManual=1 +testsuccess grep -Fx "[2] Reject:apt:$native=0.8.10 (oldcrap:$native -> oldcrap:$native=1-1)" rootdir/tmp/testfailure.output + + testsuccess aptmark auto ~i testfailureequal 'Reading package lists... diff --git a/test/integration/test-bug-961266-hold-means-hold b/test/integration/test-bug-961266-hold-means-hold index 750d32968..08c74e052 100755 --- a/test/integration/test-bug-961266-hold-means-hold +++ b/test/integration/test-bug-961266-hold-means-hold @@ -136,19 +136,16 @@ 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 satisfy dependencies. Reached two conflicting decisions: - 1. git:amd64=1:2.26.2-1 is selected as an upgrade because: - 1. git-ng:amd64=1:2.26.2-1 is selected for install - 2. git-ng:amd64 Depends git (> 1:2.26.2) and Depends git (< 1:2.26.2-.) - [selected git-ng:amd64] - For context, additional choices that could not be installed: - * In git-ng:amd64 Depends git (> 1:2.26.2) and Depends git (< 1:2.26.2-.): - - git:i386=1:2.26.2-1 is not selected for install because: - 1. git:amd64 is selected for install - 2. git:amd64 Conflicts git:i386 - 2. git:amd64=1:2.26.2-1 is not selected for install because: - 1. git-cvs:amd64=1:2.25.1-1 is selected for install - 2. git-cvs:amd64=1:2.25.1-1 Depends git (> 1:2.25.1) and Depends git (< 1:2.25.1-.) - 3. git:amd64=1:2.25.1-1 conflicts with other versions of itself' apt install git-ng -s --solver 3.0 + 1. git-ng:amd64=1:2.26.2-1 is selected for install + 2. git-ng:amd64 Depends git (> 1:2.26.2) and Depends git (< 1:2.26.2-.) + but none of the choices are installable: + - git:amd64=1:2.26.2-1 is not selected for install because: + 1. git-cvs:amd64=1:2.25.1-1 is selected for install + 2. git-cvs:amd64=1:2.25.1-1 Depends git (> 1:2.25.1) and Depends git (< 1:2.25.1-.) + 3. git:amd64=1:2.25.1-1 conflicts with other versions of itself + - git:i386=1:2.26.2-1 is not selected for install because: + 1-2. git:amd64=1:2.25.1-1 is selected for install as above + 3. git:amd64 Conflicts git:i386' apt install git-ng -s --solver 3.0 msgmsg 'Now mix it up by' 'holding both' diff --git a/test/integration/test-dpkg-i-apt-install-fix-broken b/test/integration/test-dpkg-i-apt-install-fix-broken index 252933184..0fa542d9e 100755 --- a/test/integration/test-dpkg-i-apt-install-fix-broken +++ b/test/integration/test-dpkg-i-apt-install-fix-broken @@ -27,6 +27,30 @@ Install autopkgtest-satdep:amd64 () [0] Install:debhelper:amd64=1 (autopkgtest-satdep:amd64) [0] Install:debhelper:amd64 (autopkgtest-satdep:amd64 -> debhelper:amd64=1) +The following additional packages will be installed: + debhelper +The following NEW packages will be installed: + debhelper +0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. +1 not fully installed or removed. +Inst debhelper (1 stable [all]) +Conf debhelper (1 stable [all]) +Conf autopkgtest-satdep (1 stable [amd64])' apt install -fso Debug::APT::Solver=1 --solver 3.0 -o APT::Solver::RemoveManual=0 +testsuccessequal 'Reading package lists... +Building dependency tree... +Correcting dependencies...Install autopkgtest-satdep:amd64 () +[1] Install:autopkgtest-satdep:amd64 () +[1] Install:autopkgtest-satdep:amd64=1 (autopkgtest-satdep:amd64) +[1] Install:debhelper:amd64=1 (autopkgtest-satdep:amd64) +[1] Install:debhelper:amd64 (autopkgtest-satdep:amd64 -> debhelper:amd64=1) + Done +Solving dependencies...Install debhelper:amd64 (M) +Install autopkgtest-satdep:amd64 () +[1] Install:autopkgtest-satdep:amd64 () +[1] Install:autopkgtest-satdep:amd64=1 (autopkgtest-satdep:amd64) +[1] Install:debhelper:amd64=1 (autopkgtest-satdep:amd64) +[1] Install:debhelper:amd64 (autopkgtest-satdep:amd64 -> debhelper:amd64=1) + The following additional packages will be installed: debhelper The following NEW packages will be installed: diff --git a/test/integration/test-solver3-show-version-selection b/test/integration/test-solver3-show-version-selection index c4d23eccf..de81a303f 100755 --- a/test/integration/test-solver3-show-version-selection +++ b/test/integration/test-solver3-show-version-selection @@ -14,6 +14,27 @@ insertpackage 'installed,unstable' 'libgcc-s1' 'amd64' '14.2.0-18' 'Multi-Arch: setupaptarchive +testsuccessequal "Reading package lists... +Building dependency tree... +Solving dependencies... +The following additional packages will be installed: + libc6:s390x libgcc-s1:s390x libgstreamer1.0-dev:s390x +The following packages will be REMOVED: + libgcc-s1 +The following NEW packages will be installed: + libc6:s390x libgcc-s1:s390x libgstreamer1.0-dev:s390x + sbuild-build-depends-main-dummy:s390x +0 upgraded, 4 newly installed, 1 to remove and 0 not upgraded. +Remv libgcc-s1 [14.2.0-18] +Inst libgcc-s1:s390x (14.2.0-17 unstable [s390x]) +Inst libc6:s390x (14.2.0-17 unstable [s390x]) +Inst libgstreamer1.0-dev:s390x (1.25.90-2 unstable [s390x]) +Inst sbuild-build-depends-main-dummy:s390x (0.invalid.0 unstable [s390x]) +Conf libgcc-s1:s390x (14.2.0-17 unstable [s390x]) +Conf libc6:s390x (14.2.0-17 unstable [s390x]) +Conf libgstreamer1.0-dev:s390x (1.25.90-2 unstable [s390x]) +Conf sbuild-build-depends-main-dummy:s390x (0.invalid.0 unstable [s390x])" apt install sbuild-build-depends-main-dummy --solver 3.0 -s + testfailuremsg "E: Unable to satisfy dependencies. Reached two conflicting decisions: 1. libc6:s390x is selected for install because: 1. sbuild-build-depends-main-dummy:s390x=0.invalid.0 is selected for install @@ -24,5 +45,4 @@ testfailuremsg "E: Unable to satisfy dependencies. Reached two conflicting decis - libgcc-s1:s390x is not selected for install because: 1. libgcc-s1:amd64 is selected for install 2. libgcc-s1:amd64 is available in version 14.2.0-18 - 3. libgcc-s1:s390x Breaks libgcc-s1 (!= 14.2.0-17)" apt install sbuild-build-depends-main-dummy --solver 3.0 - + 3. libgcc-s1:s390x Breaks libgcc-s1 (!= 14.2.0-17)" apt install sbuild-build-depends-main-dummy --solver 3.0 -o APT::Solver::RemoveManual=0 -s diff --git a/test/integration/test-ubuntu-bug-2111792-intersecting-dependencies b/test/integration/test-ubuntu-bug-2111792-intersecting-dependencies index b63991aa4..4d32c0130 100755 --- a/test/integration/test-ubuntu-bug-2111792-intersecting-dependencies +++ b/test/integration/test-ubuntu-bug-2111792-intersecting-dependencies @@ -130,19 +130,16 @@ 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 satisfy dependencies. Reached two conflicting decisions: - 1. git:amd64=1:2.26.2-1 is selected as an upgrade because: - 1. git-ng:amd64=1:2.26.2-1 is selected for install - 2. git-ng:amd64 Depends git (> 1:2.26.2) and Depends git (< 1:2.26.2-.) - [selected git-ng:amd64] - For context, additional choices that could not be installed: - * In git-ng:amd64 Depends git (> 1:2.26.2) and Depends git (< 1:2.26.2-.): - - git:i386=1:2.26.2-1 is not selected for install because: - 1. git:amd64 is selected for install - 2. git:amd64 Conflicts git:i386 - 2. git:amd64=1:2.26.2-1 is not selected for install because: - 1. git-cvs:amd64=1:2.25.1-1 is selected for install - 2. git-cvs:amd64=1:2.25.1-1 Depends git (> 1:2.25.1) and Depends git (< 1:2.25.1-.) - 3. git:amd64=1:2.25.1-1 conflicts with other versions of itself' apt install git-ng -s + 1. git-ng:amd64=1:2.26.2-1 is selected for install + 2. git-ng:amd64 Depends git (> 1:2.26.2) and Depends git (< 1:2.26.2-.) + but none of the choices are installable: + - git:amd64=1:2.26.2-1 is not selected for install because: + 1. git-cvs:amd64=1:2.25.1-1 is selected for install + 2. git-cvs:amd64=1:2.25.1-1 Depends git (> 1:2.25.1) and Depends git (< 1:2.25.1-.) + 3. git:amd64=1:2.25.1-1 conflicts with other versions of itself + - git:i386=1:2.26.2-1 is not selected for install because: + 1-2. git:amd64=1:2.25.1-1 is selected for install as above + 3. git:amd64 Conflicts git:i386' apt install git-ng -s msgmsg 'Now mix it up by' 'holding both' diff --git a/vendor/ubuntu/apt.conf-01-vendor-ubuntu b/vendor/ubuntu/apt.conf-01-vendor-ubuntu index cc7cb8356..30d25a717 100644 --- a/vendor/ubuntu/apt.conf-01-vendor-ubuntu +++ b/vendor/ubuntu/apt.conf-01-vendor-ubuntu @@ -1,6 +1,2 @@ Acquire::Changelogs::AlwaysOnline "true"; Acquire::http::User-Agent-Non-Interactive "true"; - -// Allow apt-get to remove manually installed packages for the -// first phase. -binary::apt-get::APT::Solver::RemoveManual "true"; -- cgit v1.2.3-70-g09d2