AdrianVovk commented on issue #1851:
URL: https://github.com/apache/buildstream/issues/1851#issuecomment-1668363193
OK I think I've figured this one out. Here's a minimal reproducer:
```yaml
sources:
- kind: local
path: project.conf
- kind: remote
url: https://bing.com
```
The crash happens when any non-trackable element (i.e. `kind: local`)
precedes an element that actually implements tracking. The problem is here:
https://github.com/apache/buildstream/blob/master/src/buildstream/_projectrefs.py#L149.
If `project.refs` is empty, then we append a blank dict to the list and then
get the specified index. However, a `kind: local` element never reaches this
code path. Thus, we end up with one less empty dictionary than expected!
In the above example:
```
element_list = []
# Here, we start processing the kind:local source
(nothing happens, since there's nothing to track)
# Here, we start processing the kind:remote source
element_list.mapping_at(1) -> raises IndexError
element_list.append({}) -> element_list is now [{}]
element_list.mapping_at(1) -> STILL AN INDEX ERROR!
```
Not sure how to fix
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]