Skip to content

Creating missing state directories if they don't already exist is racey #2706

@grahamc

Description

@grahamc

if (!pathExists(gcRootsDir)) {
createDirs(gcRootsDir);
createSymlink(profilesDir, gcRootsDir + "/profiles");
}

When running a Nix build inside a Nix build with parallel nix-build's, I often see race conditions here:

error: creating symlink from '/tmp/nix-build-foo.drv-0/nix-test/nix/var/nix/gcroots/profiles' to '/tmp/nix-build-foo.drv-0/nix-test/nix/var/nix/profiles': File exists

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions