From 3cf8015a4941c43ae82100dc0d998945485d760c Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 25 Aug 2020 16:18:58 +0200 Subject: Fix bug in interaction of unmatch logic with target groups --- libbuild2/algorithm.ixx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libbuild2/algorithm.ixx') diff --git a/libbuild2/algorithm.ixx b/libbuild2/algorithm.ixx index 9d77d61..97a8519 100644 --- a/libbuild2/algorithm.ixx +++ b/libbuild2/algorithm.ixx @@ -322,12 +322,17 @@ namespace build2 if (s == target_state::failed) throw failed (); + // If this is a member of the group then the state we've got is that of + // the group, not the member, while the member has matched the group and + // incremented its dependency counts. As a result, we cannot rely on the + // unchanged state in this case. + // switch (um) { case unmatch::none: break; case unmatch::unchanged: { - if (s == target_state::unchanged) + if (s == target_state::unchanged && t.group == nullptr) return make_pair (true, s); break; @@ -338,7 +343,7 @@ namespace build2 // we never decrement this count during match so that someone else // cannot change their mind). // - if (s == target_state::unchanged || + if ((s == target_state::unchanged && t.group == nullptr) || t[a].dependents.load (memory_order_consume) != 0) return make_pair (true, s); -- cgit v1.1