Skip to content

Instantly share code, notes, and snippets.

@yorickvP
Last active January 15, 2020 14:24
Show Gist options
  • Save yorickvP/35256fdcfee6cbe9c7fdf74a596204dd to your computer and use it in GitHub Desktop.
Save yorickvP/35256fdcfee6cbe9c7fdf74a596204dd to your computer and use it in GitHub Desktop.
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index e1171082..c3d3002f 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -3592,8 +3592,15 @@ void DerivationGoal::registerOutputs()
if (buildMode == bmRepair)
replaceValidPath(path, actualPath);
else
- if (buildMode != bmCheck && rename(actualPath.c_str(), worker.store.toRealPath(path).c_str()) == -1)
- throw SysError(format("moving build output '%1%' from the sandbox to the Nix store") % path);
+ if (buildMode != bmCheck && rename(actualPath.c_str(), worker.store.toRealPath(path).c_str())) {
+ if(errno == EPERM) {
+ // No need to free since we are in a chroot, and that gets deleted later.
+ // Hope it's a source problem
+ copyPath(actualPath, worker.store.toRealPath(path));
+ } else {
+ throw SysError(format("moving build output '%1%' from the sandbox to the Nix store") % path);
+ }
+ }
}
if (buildMode != bmCheck) actualPath = worker.store.toRealPath(path);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment