summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.com>2018-11-16 10:10:31 +0000
committerJames Ennis <james.ennis@codethink.com>2018-11-16 11:00:11 +0000
commit1af9609ef73f9804be82e7fb170463356ca4139c (patch)
treec547bacc8088d9ed61f2926def0478d5f4427a92
parent327b19dde3c9c52c9a1d4dc6feb085467ede14ac (diff)
downloadbuildstream-jennis/less_restrictive_pathways.tar.gz
_yaml.py: Fix incorrect error messagejennis/less_restrictive_pathways
This patch ensures that we receive an appropriate error message if we specify an absolute path that leads within the project.
-rw-r--r--buildstream/_yaml.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/buildstream/_yaml.py b/buildstream/_yaml.py
index f44572ca5..9efef1264 100644
--- a/buildstream/_yaml.py
+++ b/buildstream/_yaml.py
@@ -475,12 +475,18 @@ def node_get_project_path(node, key, project_dir, *,
is_inside = project_dir_path.resolve() in full_resolved_path.parents or (
full_resolved_path == project_dir_path)
- if path.is_absolute() or not is_inside:
+ if not is_inside:
raise LoadError(LoadErrorReason.PROJ_PATH_INVALID,
"{}: Specified path '{}' must not lead outside of the "
"project directory"
.format(provenance, path_str))
+ if path.is_absolute():
+ raise LoadError(LoadErrorReason.PROJ_PATH_INVALID,
+ "{}: Absolute pathway: '{}' invalid.\n"
+ "Please specify a pathway relative to the project's root."
+ .format(provenance, path))
+
if full_resolved_path.is_socket() or (
full_resolved_path.is_fifo() or
full_resolved_path.is_block_device()):