Skip to content

"Operation not permitted" errors due to race condition in clearing/setting the immutable bit #9

@edolstra

Description

@edolstra

Example (http://hydra.nixos.org/build/2488954):

building path(s) `/nix/store/3ap0adrzz2xz5b6my1pfwrry7j08ar9r-nixos-test-driver'
error: linking `/nix/store/2z2ff51yskqm44kddd10hv4xg2mp40lp-nixos-test-driver.drv.chroot/nix/store/c1n81qbnpp98npc6idkkk4a4z8jnzw1s-upstart-udevtrigger.conf' to `/nix/store/c1n81qbnpp98npc6idkkk4a4z8jnzw1s-upstart-udevtrigger.conf': Operation not permitted

This is due to build.cc:

makeMutable(*i);
link(i->c_str(), ...);
makeImmutable(*i);

If two processes do this at the same time, one may call makeImmutable() before the other has called link().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions