Skip to content

Commit 4b57caf

Browse files
committed
Fix race-condition in features.Parser.filter()
Signed-off-by: Tobias Wolf <[email protected]>
1 parent 8eefc93 commit 4b57caf

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/gardenlinux/features/parser.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,14 @@ def filter(
7272
input_features = Parser.get_cname_as_feature_set(cname)
7373
filter_set = input_features.copy()
7474

75-
for feature in input_features:
76-
# @TODO: Remove "special" handling once "bare" is a first-class citizen of the feature graph
77-
if feature == "bare":
78-
if not self.graph.has_node("bare"):
79-
self.graph.add_node("bare", content=BARE_FLAVOR_FEATURE_CONTENT)
80-
if not self.graph.has_node("libc"):
81-
self.graph.add_node("libc", content=BARE_FLAVOR_LIBC_FEATURE_CONTENT)
82-
83-
continue
75+
# @TODO: Remove "special" handling once "bare" is a first-class citizen of the feature graph
76+
if "bare" in input_features:
77+
if not self.graph.has_node("bare"):
78+
self.graph.add_node("bare", content=BARE_FLAVOR_FEATURE_CONTENT)
79+
if not self.graph.has_node("libc"):
80+
self.graph.add_node("libc", content=BARE_FLAVOR_LIBC_FEATURE_CONTENT)
8481

82+
for feature in input_features:
8583
filter_set.update(networkx.descendants(Parser._get_graph_view_for_attr(self.graph, "include"), feature))
8684

8785
graph = networkx.subgraph_view(self.graph, filter_node = self._get_filter_set_callable(filter_set, additional_filter_func))

0 commit comments

Comments
 (0)