[llvm] [llvm] Add support for running tests as root (PR #75285)
Alexander Richardson via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 07:51:34 PST 2023
arichardson wrote:
How about testing for the ACL bypassing behaviour instead of checking for username == root?
```sh
$ sudo python3 -c '
import tempfile
from pathlib import Path
with tempfile.TemporaryDirectory() as td:
Path(td, "test.txt").write_text("test")
Path(td, "test.txt").chmod(0o100)
print(Path(td, "test.txt").read_text())
'
test
python3 -c '
import tempfile
from pathlib import Path
with tempfile.TemporaryDirectory() as td:
Path(td, "test.txt").write_text("test")
Path(td, "test.txt").chmod(0o100)
print(Path(td, "test.txt").read_text())
'
Traceback (most recent call last):
File "<string>", line 8, in <module>
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1256, in read_text
with self.open(mode='r', encoding=encoding, errors=errors) as f:
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1242, in open
return io.open(self, mode, buffering, encoding, errors, newline,
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1110, in _opener
return self._accessor.open(self, flags, mode)
PermissionError: [Errno 13] Permission denied: '/var/folders/_5/ltg5zrm5379_yh38z_j2vvgr00w_dz/T/tmpu5g01tt8/test.txt'
```
https://github.com/llvm/llvm-project/pull/75285
More information about the llvm-commits
mailing list