Skip to content

Commit

Permalink
Fix macos sandbox issue
Browse files Browse the repository at this point in the history
  • Loading branch information
P-E-Meunier committed Feb 26, 2025
1 parent 81834e7 commit cc7cf85
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/libstore/unix/build/local-derivation-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2144,6 +2144,7 @@ void LocalDerivationGoal::runChild()
without file-write* allowed, access() incorrectly returns EPERM
*/
sandboxProfile += "(allow file-read* file-write* process-exec\n";
int initialLen = sandboxProfile.length();
for (auto & i : pathsInChroot) {
if (i.first != i.second.source)
throw Error(
Expand All @@ -2161,6 +2162,11 @@ void LocalDerivationGoal::runChild()
sandboxProfile += fmt("\t(subpath \"%s\")\n", path);
else
sandboxProfile += fmt("\t(literal \"%s\")\n", path);

if(sandboxProfile.length() - initialLen > (1 << 15)) {
sandboxProfile += ")\n(allow file-read* file-write* process-exec\n";
initialLen = sandboxProfile.length();
}
}
sandboxProfile += ")\n";

Expand Down

0 comments on commit cc7cf85

Please sign in to comment.