1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-07 10:11:47 +02:00

Merge pull request #12259 from NixOS/mergify/bp/2.24-maintenance/pr-11922

gc: resume GC after a pathinuse error (backport #11922)
This commit is contained in:
mergify[bot] 2025-01-15 16:42:29 +00:00 committed by GitHub
commit 6e718c7c5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,6 +4,7 @@
#include "finally.hh" #include "finally.hh"
#include "unix-domain-socket.hh" #include "unix-domain-socket.hh"
#include "signals.hh" #include "signals.hh"
#include "posix-fs-canonicalise.hh"
#if !defined(__linux__) #if !defined(__linux__)
// For shelling out to lsof // For shelling out to lsof
@ -763,13 +764,18 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results)
} }
} }
} }
for (auto & path : topoSortPaths(visited)) { for (auto & path : topoSortPaths(visited)) {
if (!dead.insert(path).second) continue; if (!dead.insert(path).second) continue;
if (shouldDelete) { if (shouldDelete) {
try {
invalidatePathChecked(path); invalidatePathChecked(path);
deleteFromStore(path.to_string()); deleteFromStore(path.to_string());
referrersCache.erase(path); referrersCache.erase(path);
} catch (PathInUse &e) {
// If we end up here, it's likely a new occurence
// of https://github.com/NixOS/nix/issues/11923
printError("BUG: %s", e.what());
}
} }
} }
}; };