From c4bab3c93567fd5a17652e453d4a65d7c83eb4fb Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 8 Jul 2022 14:07:45 +0200 Subject: Avoid recursion by looping of other binaries twice First mark them for upgrade without autoInst, so we don't call their "mark other binaries loop"; then call them again with it. Without this change, each binary package would upgrade the next one in the list, recursively. --- apt-pkg/depcache.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index f1ad7729e..6aa1fe946 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1496,6 +1496,7 @@ static bool MarkInstall_UpgradeOrRemoveConflicts(pkgDepCache &Cache, bool const /*}}}*/ static bool MarkInstall_UpgradeOtherBinaries(pkgDepCache &Cache, bool const DebugAutoInstall, unsigned long Depth, bool const ForceImportantDeps, pkgCache::PkgIterator Pkg, pkgCache::VerIterator Ver) /*{{{*/ { + APT::PackageSet toUpgrade; auto SrcGrp = Cache.FindGrp(Ver.SourcePkgName()); for (auto OtherBinary = SrcGrp.VersionsInSource(); not OtherBinary.end(); OtherBinary = OtherBinary.NextInSource()) { @@ -1514,8 +1515,13 @@ static bool MarkInstall_UpgradeOtherBinaries(pkgDepCache &Cache, bool const Debu continue; if (DebugAutoInstall) std::clog << OutputInDepth(Depth) << "Upgrading " << APT::PrettyPkg(&Cache, OtherPkg) << " due to " << Pkg.FullName() << '\n'; - Cache.MarkInstall(OtherPkg, true, Depth + 1, false, ForceImportantDeps); + + toUpgrade.insert(OtherPkg); } + for (auto &OtherPkg : toUpgrade) + Cache.MarkInstall(OtherPkg, false, Depth + 1, false, ForceImportantDeps); + for (auto &OtherPkg : toUpgrade) + Cache.MarkInstall(OtherPkg, true, Depth + 1, false, ForceImportantDeps); return true; } /*}}}*/ -- cgit v1.2.3-70-g09d2