You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by GitBox <gi...@apache.org> on 2022/01/18 09:13:27 UTC
[GitHub] [buildstream] abderrahim edited a comment on issue #1360: `notparallel` variable is broken
abderrahim edited a comment on issue #1360:
URL: https://github.com/apache/buildstream/issues/1360#issuecomment-1015097547
Yup, lines have shifted. The line in question is
```python
self.__variables.expand(unexpanded_env)
```
So what happens is that `Node._composite()` does a shallow copy of the nodes, then `Variables.expand()` modifies them in-place, resulting in a modified `__defaults` class variable. which is then composited into other elements with the wrong value.
Here is a minimal reproducer for the issue:
```python
from buildstream.node import Node
from buildstream._variables import Variables
default = Node.from_dict({'MAKEFLAGS': '-j%{max-jobs}'})
element = Node.from_dict({'name': 'my-element.bst'})
v = Variables(Node.from_dict({'max-jobs': '1'}))
print(default, element, sep='\n')
# [synthetic node]: {'MAKEFLAGS': '-j%{max-jobs}'}
# [synthetic node]: {'name': 'my-element.bst'}
default._composite(element)
print(default, element, sep='\n')
# [synthetic node]: {'MAKEFLAGS': '-j%{max-jobs}'}
# [synthetic node]: {'name': 'my-element.bst', 'MAKEFLAGS': '-j%{max-jobs}'}
v.expand(element)
print(default, element, sep='\n')
# [synthetic node]: {'MAKEFLAGS': '-j1'}
# [synthetic node]: {'name': 'my-element.bst', 'MAKEFLAGS': '-j1'}
```
--
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: commits-unsubscribe@buildstream.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org