Repository navigation
scriptelement.py, buildelement.py: Report relative directories as errors - #2212
Open
Thanatos9404 wants to merge 2 commits into
Open
Thanatos9404 wants to merge 2 commits into
Thanatos9404 wants to merge 2 commits into
Conversation
The sandbox only accepts absolute paths for the working directory and
for the directories it marks, and checks this with an assertion. So an
element with a relative directory, for example a script element with
`cwd: elements`, loads fine and then fails in the build job with a BUG
message and a traceback.
Check these directories in preflight() and raise an ElementError, so
that the element is reported with a normal error message when it is
loaded, before any job starts.
o scriptelement.py: Check the working directory and the install root.
o buildelement.py: Check the build-root and install-root variables.
The working directory is the build root, which command-subdir is
joined onto when it is set.
Fixes apache#2077
Check that `bst show` reports a relative working directory or install root on a script element, and a relative build-root or install-root on a manual element, as an element error, and that a working directory given by a variable which resolves to an absolute path is accepted. This is a part of apache#2077
Thanatos9404
requested review from
BenjaminSchubert,
abderrahim,
cs-shadow,
gtristan and
juergbi
as code owners
October 23, 2026 21:27
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A script element with a relative cwd, like the
cwd: elementsin the issue, loads fine and then trips the assertion inSandbox.set_work_directory()during the build, which shows up as a BUG with a traceback. A relative build-root or install-root on a build element, or a relative install root on a script element, fails the same way inmark_directory().ScriptElement and BuildElement now check these directories in
preflight(), after variables are resolved, and raise an ElementError, sobst showandbst buildreport the element and the path before any job starts. The sandbox assertions stay as they are.I added tests in tests/format/variables.py and ran the format, frontend and related test modules, plus black, pylint and mypy, locally.
Fixes #2077