summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan van Berkom <tristan@codethink.co.uk>2020-09-21 14:48:54 +0900
committerTristan van Berkom <tristan@codethink.co.uk>2020-09-21 18:29:48 +0900
commit3790e90e80bc30061f12501667de68c3ad66dd64 (patch)
tree0c097f7a3182345482893ec9443c44625ac24e34
parent14377d4e4c2fd1021b3f009a2967cfab03a05462 (diff)
downloadbuildstream-3790e90e80bc30061f12501667de68c3ad66dd64.tar.gz
Sandbox: Assert absolute paths where they are set
-rw-r--r--src/buildstream/sandbox/sandbox.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/buildstream/sandbox/sandbox.py b/src/buildstream/sandbox/sandbox.py
index 031968826..7b3d67815 100644
--- a/src/buildstream/sandbox/sandbox.py
+++ b/src/buildstream/sandbox/sandbox.py
@@ -176,6 +176,8 @@ class Sandbox:
Args:
directory: An absolute path within the sandbox
"""
+ assert directory.startswith("/"), "The working directory must be an absolute path"
+
self.__cwd = directory
def set_output_directory(self, directory: str) -> None:
@@ -199,6 +201,8 @@ class Sandbox:
Any marked directories will be read-write in the sandboxed
environment, only the root directory is allowed to be readonly.
"""
+ assert directory.startswith("/"), "The directories marked in the sandbox must be absolute paths"
+
self.__directories.append({"directory": directory, "artifact": artifact})
def run(