forked from lix-project/lix
override rx directory permissions in deletePath()
This fixes instantiation of pythonPackages.pytest that produces a directory with less permissions during one of it's tests that leads to a nix error like: error: opening directory ‘/tmp/nix-build-python2.7-pytest-2.9.2.drv-0/pytest-of-user/pytest-0/testdir/test_cache_failure_warns0/.cache’: Permission denied
This commit is contained in:
parent
ee3032e4de
commit
f91748ba73
|
@ -330,10 +330,11 @@ static void _deletePath(const Path & path, unsigned long long & bytesFreed)
|
||||||
bytesFreed += st.st_blocks * 512;
|
bytesFreed += st.st_blocks * 512;
|
||||||
|
|
||||||
if (S_ISDIR(st.st_mode)) {
|
if (S_ISDIR(st.st_mode)) {
|
||||||
/* Make the directory writable. */
|
/* Make the directory accessible. */
|
||||||
if (!(st.st_mode & S_IWUSR)) {
|
const auto PERM_MASK = S_IRUSR | S_IWUSR | S_IXUSR;
|
||||||
if (chmod(path.c_str(), st.st_mode | S_IWUSR) == -1)
|
if ((st.st_mode & PERM_MASK) != PERM_MASK) {
|
||||||
throw SysError(format("making ‘%1%’ writable") % path);
|
if (chmod(path.c_str(), st.st_mode | PERM_MASK) == -1)
|
||||||
|
throw SysError(format("chmod ‘%1%’") % path);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto & i : readDirectory(path))
|
for (auto & i : readDirectory(path))
|
||||||
|
|
Loading…
Reference in a new issue