Bug with `bst show`, and `--exclude` and overridden nested junctions.
- Dominant language
- Python
- Stars
- 140
- Forks
- 45
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 6
Description
Encountered a very obscure loading related issue today.
Not writing up an explicit sample test setup just yet but while it's fresh on my mind, consider a diamond setup with 4 projects:
```
(toplevel)
/ \
/ \
(platform) (feature)
\ /
\ /
(freedesktop-sdk)
```
* toplevel: A toplevel *product* project
* platform: A specialized *platform* project modeled on top of fdsdk
* feature: A specialized *feature* project, bringing in a framework, that builds on top of fdsdk
* fdsdk: The base runtime
Both the `platform` and `feature` projects have a junction to fdsdk.
## Toplevel project relations with subprojects
### freedesktop-sdk.bst
There is a [link](https://docs.buildstream.build/master/elements/link.html) to the `platform` project's fdsdk junction
```yaml
kind: link
config:
target: platform.bst:freedesktop-sdk.bst
```
### platform.bst
This is a normal junction element to the `platform` project, we trust the `platform` for deciding on the `fdsdk` version.
### feature.bst
When junctioning our `feature` project, which brings in some framework we want to use... we make sure to build it against the `fdsdk` version determined by the `platform` project, using an [override](https://docs.buildstream.build/master/elements/junction.html#overriding-elements) of it's fdsdk junction.
```yaml
sources:
- kind: git
url: feature.com/git
config:
overrides:
# Override fdsdk with our local link element
freedesktop-sdk.bst: freedesktop-sdk.bst
```
## Feature base stack
Now, the feature project has decided to create a `base.bst` element as shorthand for referring to the *base runtime*, coincidentally, it has done so using a `stack` element rather than a `link`, it looks like this:
```yaml
kind: stack
# depends on bootstrap-import.bst
depends:
- freedesktop-sdk.bst:bootstrap-import.bst
```
## Running `bst show` behaviors.
### Exclude via platform, full path
```bash
bst show --deps run foo.bst bar.bst baz.bst --exclude platform.bst:freedesktop-sdk.bst:bootstrap-import.bst
```
As expected, the bootstrap elements are not reported in `bst show`.
### Exclude via link
```bash
bst show --deps run foo.bst bar.bst baz.bst --exclude freedesktop-sdk.bst:bootstrap-import.bst
```
Again, we get the correct result
### Exclude via the feature project's base element
```bash
bst show --deps run foo.bst bar.bst baz.bst --exclude feature.bst:base.bst
```
Here is the weird bug.
Here we are seeing the bootstrap elements from fdsdk *shown*, even though we have excluded the `base.bst` element in the `feature.bst` project which directly depends on `freedesktop-sdk.bst:bootstrap-import.bst`.
I suspect that this may have to do with load ordering and the fact that the `freedesktop-sdk.bst` junction in the feature branch was overridden.
Contributor guide
Research direction
Start by reproducing the three `bst show --deps run` commands from the issue, focusing on exclusion handling for `feature.bst:base.bst` and the overridden junction. Trace how `bst show` resolves nested junctions and overrides when applying exclusions. Done means excluding `feature.bst:base.bst` also omits the associated freedesktop-sdk bootstrap elements.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, cli
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100