1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-13 05:56:03 +01:00

gc: Only track sensible paths from maps file

This commit is contained in:
Théophane Hufschmitt 2022-04-11 10:20:36 +02:00
parent 3839eb15d6
commit 35c7d5d2f1

View file

@ -234,8 +234,11 @@ void scanMapsFile(const GlobalOpts & opts, const fs::path & mapsFile, Roots & re
std::string line; std::string line;
while (std::getline(mappedFile, line)) { while (std::getline(mappedFile, line)) {
auto match = std::smatch{}; auto match = std::smatch{};
if (std::regex_match(line, match, mapRegex)) if (std::regex_match(line, match, mapRegex)) {
res[fs::path(match[1])].emplace(mapsFile); auto matchedPath = fs::path(match[1]);
if (isInStore(opts.storeDir, matchedPath))
res[fs::path(match[1])].emplace(mapsFile);
}
} }
} }