From 02f9939163b54b61110e99fec89fa03dad591a17 Mon Sep 17 00:00:00 2001 From: Tristan Maat Date: Mon, 9 Dec 2019 17:38:34 +0000 Subject: tests/sources/tar.py: chown+chmod instead of giving 777 permissions While this is deep in our test suite, and should therefore never create files that leak information, our code security linter complains. So instead we perform a slightly safer chown + chmod to ensure we have write permissions, because there is no practical reason not to and it makes for nicer code to copy + paste. --- tests/sources/tar.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/sources/tar.py b/tests/sources/tar.py index f5f3dde2d..acf0a99a5 100644 --- a/tests/sources/tar.py +++ b/tests/sources/tar.py @@ -306,7 +306,8 @@ def test_read_only_dir(cli, tmpdir, datafiles, tar_name, base_dir): # Make tmpdir deletable no matter what happens def make_dir_writable(_fn, path, _excinfo): - os.chmod(os.path.dirname(path), 0o777) + os.chown(os.path.dirname(path), os.geteuid()) + os.chmod(os.path.dirname(path), 0o700) if os.path.isdir(path): os.rmdir(path) else: -- cgit v1.2.1