summaryrefslogtreecommitdiff
path: root/apt-private
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2023-11-20 10:02:21 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2023-11-20 10:04:05 +0100
commitb6f362e8013b03efce54e7381e0e22fac1fa1539 (patch)
treea93619c3df86e5a5b1bb7194d9072251828e5b57 /apt-private
parent1f5ecf5d211a073892e05047becd4e55f3e055c9 (diff)
Restore ?garbage by calling MarkAndSweep before parsing
This ensures that things work correctly. LP: #1995790
Diffstat (limited to 'apt-private')
-rw-r--r--apt-private/private-install.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc
index e366634ad..2f254ca27 100644
--- a/apt-private/private-install.cc
+++ b/apt-private/private-install.cc
@@ -669,6 +669,9 @@ bool DoCacheManipulationFromCommandLine(CommandLine &CmdL, std::vector<PseudoPkg
fallback = MOD_REMOVE;
}
+ // We need to MarkAndSweep before parsing commandline so that ?garbage pattern works correctly.
+ Cache->MarkAndSweep();
+
std::list<APT::VersionSet::Modifier> mods;
mods.push_back(APT::VersionSet::Modifier(MOD_INSTALL, "+",
APT::VersionSet::Modifier::POSTFIX, APT::CacheSetHelper::CANDIDATE));