mirror of
https://github.com/NixOS/nix.git
synced 2025-11-12 21:46:01 +01:00
Censor the gc roots that aren’t under stateDir
This commit is contained in:
parent
8f622ff71b
commit
e1df6c220a
1 changed files with 3 additions and 1 deletions
|
|
@ -340,11 +340,13 @@ Roots LocalStore::findRoots(bool censor)
|
||||||
if (parsedLine.size() != 2)
|
if (parsedLine.size() != 2)
|
||||||
throw Error("Invalid result from the gc helper");
|
throw Error("Invalid result from the gc helper");
|
||||||
auto rawDestPath = parsedLine[0];
|
auto rawDestPath = parsedLine[0];
|
||||||
|
auto retainer = parsedLine[1];
|
||||||
if (!isInStore(rawDestPath)) continue;
|
if (!isInStore(rawDestPath)) continue;
|
||||||
try {
|
try {
|
||||||
auto destPath = toStorePath(rawDestPath).first;
|
auto destPath = toStorePath(rawDestPath).first;
|
||||||
if (!isValidPath(destPath)) continue;
|
if (!isValidPath(destPath)) continue;
|
||||||
roots[destPath].insert(parsedLine[1]);
|
roots[destPath].insert(
|
||||||
|
(!censor || isInDir(retainer, stateDir)) ? retainer : censored);
|
||||||
} catch (Error &) {
|
} catch (Error &) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue