Repository navigation
scriptelement.py, buildelement.py: Report relative directories as errors - #2212
Merged
juergbi merged 2 commits intoNov 6, 2026
Merged
Conversation
Thanatos9404
requested review from
BenjaminSchubert,
abderrahim,
cs-shadow,
gtristan and
juergbi
as code owners
October 23, 2026 21:27
Contributor
|
I feel that conceptually, Otherwise LGTM. |
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 when the element is configured 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 in set_work_dir() and
the install root in set_install_root(), which element plugins call
from their configure() implementation.
o buildelement.py: Check the build-root and install-root variables in
configure(). 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
force-pushed
the
thanatos/relative-work-directory
branch
from
November 3, 2026 14:35
37e74f3 to
9e44bb1
Compare
Contributor
Author
|
Makes sense, moved it. BuildElement now checks in |
abderrahim
approved these changes
Nov 5, 2026
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().These directories are now checked when the element is configured: BuildElement in
configure(), and ScriptElement inset_work_dir()andset_install_root(), which element plugins call from theirconfigure(). A relative path raises 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 test suite, plus black, pylint and mypy, locally.
Fixes #2077