Skip to content

Commit c27b2a6

Browse files
winterqttomberek
authored andcommitted
libstore: skip Spotlight processes when finding GC roots
Despite installations of Nix explicitly setting the `nobrowse` mount option on the store, `mdworker` processes continue to run on newly created files within it, which can result in spurious GC/path deletion failures if the stars are aligned right. IMO, the best way to fix this is to simply ignore any processes started by the Spotlight user, so that's exactly what we do here. Fixes: #6141 Change-Id: I6a6a636c70f3f443f07ba9280d5f1e04b2ed2985
1 parent f683a55 commit c27b2a6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/libstore/gc.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,13 @@ void LocalStore::findRuntimeRoots(Roots & roots, bool censor)
414414
if (getEnv("_NIX_TEST_NO_LSOF") != "1") {
415415
try {
416416
std::regex lsofRegex(R"(^n(/.*)$)");
417+
418+
// Despite installations of Nix explicitly setting the `nobrowse` mount
419+
// option on the store, `mdworker` processes continue to run on newly
420+
// created files within it, which can result in spurious GC/path deletion
421+
// failures if the stars are aligned right.
417422
auto lsofLines =
418-
tokenizeString<std::vector<std::string>>(runProgram(LSOF, true, { "-n", "-w", "-F", "n" }), "\n");
423+
tokenizeString<std::vector<std::string>>(runProgram(LSOF, true, { "-n", "-w", "-F", "n", "-u", "^89", "-g", "^89" }), "\n");
419424
for (const auto & line : lsofLines) {
420425
std::smatch match;
421426
if (std::regex_match(line, match, lsofRegex))

0 commit comments

Comments
 (0)