Skip to content

Fix circular reference errors with junction overrides#2114

Open
juergbi wants to merge 4 commits intomasterfrom
jbilleter/loader
Open

Fix circular reference errors with junction overrides#2114
juergbi wants to merge 4 commits intomasterfrom
jbilleter/loader

Conversation

@juergbi
Copy link
Copy Markdown
Contributor

@juergbi juergbi commented Apr 25, 2026

Fixes #2037 and #2118.

juergbi and others added 4 commits April 25, 2026 10:58
Different behavior for `provenance_node is None` is not ideal. And since
commit 07a1e45 ("Ensure that the parent project is fully loaded..."),
it's no longer needed.
Shallow override loading is needed only to discover link elements for
correct link resolution. Defer loading of elements that require the
project to be fully loaded, as second pass loading during shallow
override loading can trigger a circular reference error.

Fixes #2037.
This commit adds an additional level of nesting to a copy of the
override-self buildstream test project by a new subproject and moving
the self-junction into the subproject.

Both the `link.bst` and the `nested-link.bst` elements point to the
subproject's `target.bst` element but `nested-link.bst` does so via the
self-junction, hence the "nesting".

Running `bst show --deps none nested-link.bst` in the directory
`tests/format/junctions/override-self-link` gives the following output:

```
20:17:48 --:--:--              main:core activity                  START   Loading elements
20:17:48 00:00:00              main:core activity                  FAILURE Loading elements

project.conf [line 6 column 2]: Circular reference while searching for 'subproject.bst:self-junction.bst'

    Already searching for 'subproject.bst:self-junction.bst' at: nested-link.bst [line 4 column 10]
```
This creates a variant of the include-complex test project where the
subproject is moved into a new intermediate project and the
subproject.bst junction element is replaced by a link element. Including
a file from a nested junction via a link element in the top level
project.conf file tests more code paths in the loader.

This change shows a bug in the loader, running `bst show --deps none
target.bst` in the `tests/format/junctions/include-complex-nested`
directory gives the following output:

```
20:02:32 --:--:--              main:core activity                  START   Loading elements
20:02:32 00:00:00              main:core activity                  FAILURE Loading elements

intermediate-project.bst:project.conf [line 5 column 2]: Circular reference while searching for 'subproject.bst'

    Already searching for 'subproject.bst' at: subproject.bst [line 4 column 10]
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bst build command fails intermittently

2 participants