mirror of
https://github.com/NixOS/nix
synced 2025-06-24 13:51:16 +02:00
libstore: fix race condition when creating state directories
Running parallel nix in nix can lead to multiple instances trying to create the state directories and failing on the `createSymlink` step, because the link already exists. `replaceSymlink` is already idempotent, so let's use that. Resolves #2706
This commit is contained in:
parent
cdb417854b
commit
d64c922164
1 changed files with 1 additions and 1 deletions
|
@ -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"}) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue