1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-25 03:39:36 +01:00

libstore/unix/derivation-builder: error earlier when sandbox path is inaccessible

This commit is contained in:
Cole Helbling 2025-06-04 10:30:29 -07:00
parent 2a96ae22d7
commit dfa7b2a288
No known key found for this signature in database
2 changed files with 20 additions and 4 deletions

View file

@ -992,10 +992,21 @@ void DerivationBuilderImpl::startBuilder()
i.pop_back();
}
size_t p = i.find('=');
if (p == std::string::npos)
pathsInChroot[i] = {i, optional};
else
pathsInChroot[i.substr(0, p)] = {i.substr(p + 1), optional};
std::string inside, outside;
if (p == std::string::npos) {
inside = i;
outside = i;
} else {
inside = i.substr(0, p);
outside = i.substr(p + 1);
}
if (!optional && !maybeLstat(outside)) {
throw SysError("path '%s' is configured as part of the `sandbox-paths` option, but is inaccessible", outside);
}
pathsInChroot[inside] = {outside, optional};
}
if (hasPrefix(store.storeDir, tmpDirInSandbox))
{