getDefaultNixPath: ignore EPERM

This commit is contained in:
Yorick 2023-05-11 13:44:16 +02:00
parent b7cde90c6b
commit a6c78ba367
No known key found for this signature in database
GPG key ID: D8D3CC6D951384DE

View file

@ -2620,6 +2620,7 @@ Strings EvalSettings::getDefaultNixPath()
{ {
Strings res; Strings res;
auto add = [&](const Path & p, const std::string & s = std::string()) { auto add = [&](const Path & p, const std::string & s = std::string()) {
try {
if (pathExists(p)) { if (pathExists(p)) {
if (s.empty()) { if (s.empty()) {
res.push_back(p); res.push_back(p);
@ -2627,6 +2628,10 @@ Strings EvalSettings::getDefaultNixPath()
res.push_back(s + "=" + p); res.push_back(s + "=" + p);
} }
} }
} catch (SysError & e) {
// swallow EPERM
if (e.errNo != EPERM) throw;
}
}; };
if (!evalSettings.restrictEval && !evalSettings.pureEval) { if (!evalSettings.restrictEval && !evalSettings.pureEval) {