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:
parent
2a96ae22d7
commit
dfa7b2a288
2 changed files with 20 additions and 4 deletions
|
|
@ -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))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue