apache / apache/buildstream

An unhandled exception occured, when passing bogus input to bst

Open
#2,077 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
Python
Stars
140
Forks
45
Avg merge
1d 3h
Merged PRs (30d)
6

Description

See elements is not an absolute path
```
# File generated by convert.py

build-depends:
- freedesktop-sdk.bst:components/gtk3.bst
depends: []
sources: []
kind: script
config:
commands:
- install -m755 install-licenses.sh /usr/bin
variables:
cwd: elements

```

Error message:
```
[00:00:00][7aac01d5][ build:licence-extractor.bst ] BUG Build

An unhandled exception occured:

Traceback (most recent call last):
File "/usr/lib64/python3.13/site-packages/buildstream/_scheduler/jobs/job.py", line 350, in child_action result = self.child_process() # pylint: disable=assignment-from-no-return
File "/usr/lib64/python3.13/site-packages/buildstream/_scheduler/jobs/elementjob.py", line 81, in child_process return self._action_cb(self._element)
~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
File "/usr/lib64/python3.13/site-packages/buildstream/_scheduler/queues/buildqueue.py", line 55, in _assemble_element element._assemble()
~~~~~~~~~~~~~~~~~^^
File "/usr/lib64/python3.13/site-packages/buildstream/element.py", line 1695, in _assemble
self.__configure_sandbox(sandbox)
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^ File "/usr/lib64/python3.13/site-packages/buildstream/element.py", line 2681, in __configure_sandbox
self.configure_sandbox(sandbox) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
File "/usr/lib64/python3.13/site-packages/buildstream/scriptelement.py", line 200, in configure_sandbox
sandbox.set_work_directory(self.__cwd)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
File "/usr/lib64/python3.13/site-packages/buildstream/sandbox/sandbox.py", line 149, in set_work_directory
assert directory.startswith("/"), "The working directory must be an absolute path"
~~~~~~~~~~~~~~~~~~~~^^^^^
AssertionError: The working directory must be an absolute path

```

One would expect only an error message (or alternatively making the path absolute relative to where bst is run from or where project.conf is.

Contributor guide

Open the contributing guide

Research direction

Start with buildstream/scriptelement.py at configure_sandbox() and buildstream/sandbox/sandbox.py at set_work_directory(), following how the relative cwd from the element configuration reaches the assertion. Done when bogus input produces a clear user-facing error instead of an unhandled exception, with regression coverage for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.