Fix root creation when the root already exists but is owned by another user

This commit is contained in:
Eelco Dolstra
2017-10-19 12:28:06 +02:00
parent b904f25247
commit b04dc6c76e
4 changed files with 13 additions and 2 deletions

View File

@ -264,7 +264,7 @@ State::StepResult State::doBuildStep(nix::ref<Store> destStore,
assert(stepNr);
for (auto & path : step->drv.outputPaths())
writeFile(rootsDir + "/" + baseNameOf(path), "");
addRoot(path);
/* Register success in the database for all Build objects that
have this step as the top-level step. Since the queue
@ -473,3 +473,10 @@ State::StepResult State::doBuildStep(nix::ref<Store> destStore,
return sDone;
}
void State::addRoot(const Path & storePath)
{
auto root = rootsDir + "/" + baseNameOf(storePath);
if (!pathExists(root)) writeFile(root, "");
}