Skip to content
Snippets Groups Projects

Fix warning when using an absolute path which exists inside the project

Merged James Ennis requested to merge jennis/less_restrictive_pathways into master
1 unresolved thread

Currently, as it stands, if we specify an absolute pathway to something within our project, BuildStream will fail, see below:

 $ pwd
/home/jennis/project

 $ ls
elements  project.conf  some_file.txt

 $ cat elements/import_file.bst 
kind: import
sources:
- kind: local
  path: /home/jennis/project/some_file.txt

 $ bst build import_file.bst 
[--:--:--][][] START   Build
[--:--:--][][] START   Loading elements
[00:00:00][][] SUCCESS Loading elements
[--:--:--][][] START   Resolving elements
[00:00:00][][] FAILURE Resolving elements
[00:00:00][][] FAILURE Build


import_file.bst [line 4 column 8]: Specified path '/home/jennis/project/some_file.txt' must not lead outside of the project directory

The error message is incorrect as this path does not lead outside of the project

This patch ensures that we receive an appropriate error message.

Edited by James Ennis

Merge request reports

Pipeline #37291977 passed

Pipeline passed for 9fa8a881 on jennis/less_restrictive_pathways

Test coverage 86.19% (-0.01%) from 1 job

Merged by Jürg BilleterJürg Billeter 6 years ago (Nov 20, 2018 5:32pm UTC)

Loading

Pipeline #37295931 passed

Pipeline passed for fb8860db on master

Test coverage 86.19% (-0.01%) from 1 job

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
475 475 is_inside = project_dir_path.resolve() in full_resolved_path.parents or (
476 476 full_resolved_path == project_dir_path)
477 477
478 if path.is_absolute() or not is_inside:
478 if not is_inside:
479 479 raise LoadError(LoadErrorReason.PROJ_PATH_INVALID,
480 480 "{}: Specified path '{}' must not lead outside of the "
481 481 "project directory"
482 482 .format(provenance, path_str))
483 483
484 if path.is_absolute() and is_inside:
485 raise LoadError(LoadErrorReason.PROJ_PATH_INVALID,
  • James Ennis added 1 commit

    added 1 commit

    • 1af9609e - _yaml.py: Fix incorrect error message

    Compare with previous version

  • James Ennis resolved all discussions

    resolved all discussions

  • All looks good to me!

  • James Ennis added 35 commits

    added 35 commits

    Compare with previous version

  • Jürg Billeter enabled an automatic merge when the pipeline for 1d7053ed succeeds

    enabled an automatic merge when the pipeline for 1d7053ed succeeds

  • Jürg Billeter canceled the automatic merge

    canceled the automatic merge

  • Jürg Billeter added 3 commits

    added 3 commits

    Compare with previous version

  • Jürg Billeter enabled an automatic merge when the pipeline for 9fa8a881 succeeds

    enabled an automatic merge when the pipeline for 9fa8a881 succeeds

  • Jürg Billeter mentioned in commit fb8860db

    mentioned in commit fb8860db

  • Please register or sign in to reply
    Loading