From c530a192d6a57e091d400cb42f9ce0d5a327ff01 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 8 Jan 2021 12:36:31 +0100 Subject: Make immediate configuration optional The benefits of immediate configuration are that Essential packages will be configured immediately, so if they are wrongly not working without being configured they won't fail later packages. However, we've reached the point where dependencies on the essential set are too complex for immediate configuration to always work, causing installations to error out at the end, despite having succeeded, because we did not correctly return the error here and did not check for pending errors before running dpkg. Given that we check and configure any packages at the end that have not been configured yet, or fail if we can't configure them; making immediate configuration optional is the best way forward - it orders as it does now, but then does not spuriously fail after having successfully installed everything. Closes: #973305, #188161, #211075, #649588 LP: #1871268 --- apt-pkg/packagemanager.cc | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/apt-pkg/packagemanager.cc b/apt-pkg/packagemanager.cc index a1b3f4537..0c6998def 100644 --- a/apt-pkg/packagemanager.cc +++ b/apt-pkg/packagemanager.cc @@ -1006,10 +1006,18 @@ bool pkgPackageManager::SmartUnPack(PkgIterator Pkg, bool const Immediate, int c return false; if (Immediate == true) { - // Perform immediate configuration of the package. - if (SmartConfigure(Pkg, Depth + 1) == false) - _error->Warning(_("Could not perform immediate configuration on '%s'. " - "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"),Pkg.FullName().c_str(),2); + // Perform immediate configuration of the package. + _error->PushToStack(); + bool configured = SmartConfigure(Pkg, Depth + 1); + _error->RevertToStack(); + + if (not configured && Debug) { + clog << OutputInDepth(Depth); + ioprintf(clog, _("Could not perform immediate configuration on '%s'. " + "Please see man 5 apt.conf under APT::Immediate-Configure for details. (%d)"), + Pkg.FullName().c_str(), 2); + clog << endl; + } } return true; -- cgit v1.2.3