Merge pull request #13368 from wolfgangwalther/race-state-creation

libstore: fix race condition when creating state directories
This commit is contained in:
Eelco Dolstra
2025-06-17 11:33:29 +02:00
committed by GitHub

View File

@@ -133,7 +133,7 @@ LocalStore::LocalStore(ref<const Config> config)
Path gcRootsDir = config->stateDir + "/gcroots";
if (!pathExists(gcRootsDir)) {
createDirs(gcRootsDir);
createSymlink(profilesDir, gcRootsDir + "/profiles");
replaceSymlink(profilesDir, gcRootsDir + "/profiles");
}
for (auto & perUserDir : {profilesDir + "/per-user", gcRootsDir + "/per-user"}) {