commit 1e6773d2a7795df3195d7b9d1569326a7b6ba23f
parent 78c918c2c1a700be6b1e8f78e551b7632ab99e2c
Author: James Prestwood <prestwoj@gmail.com>
Date: Wed, 25 May 2022 12:37:26 -0700
test-runner: disallow result/monitor/log directly under /tmp
Inside the virtual environments /tmp is mounted as its own FS and not
taken from the host. This poses issues if any output files are directly
under /tmp since test-runner tries to mount the parent directory (/tmp).
The can be fixed by ensuring these output files are either not under
/tmp or at least one folder down the tree (e.g. /tmp/outputs/outfile.txt).
Now this requirement is enforced and test-runner will not start if any
output files parent directory is /tmp.
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/runner.py b/tools/runner.py
@@ -311,6 +311,9 @@ class RunnerAbstract:
gid = int(os.environ.get('SUDO_GID', os.getgid()))
if self.args.log:
+ if self.args.log == '/tmp':
+ raise Exception('Log directly cannot be /tmp')
+
append_gid_uid = True
if not os.path.exists(self.args.log):
@@ -324,12 +327,16 @@ class RunnerAbstract:
self.args.monitor_parent = os.path.abspath(
os.path.join(self.args.monitor, os.pardir))
+ if self.args.monitor_parent == '/tmp':
+ raise Exception('--monitor cannot be directly under /tmp')
if self.args.result:
append_gid_uid = True
self.args.result_parent = os.path.abspath(
os.path.join(self.args.result, os.pardir))
+ if self.args.result_parent == '/tmp':
+ raise Exception('--result cannot be directly under /tmp')
if append_gid_uid:
self.args.SUDO_UID = uid