sysupdate: Prevent a possible invalid partial+pending state on an instance
If the resource code is recursing, it’s possible for one iteration to set a partial flag, and then a recursive iteration to set a pending flag (or vice-versa). It doesn’t make sense to have both set at the same time for a specific instance, so make sure to clear the other flag when setting one of them. Add some assertions to make this invariant clearer and easier to debug if it fails. Signed-off-by: Philip Withnall <pwithnall@gnome.org>
This commit is contained in:
@@ -410,7 +410,10 @@ static int context_discover_update_sets_by_flag(Context *c, UpdateSetFlags flags
|
||||
extra_flags |= UPDATE_PROTECTED;
|
||||
|
||||
/* Partial or pending updates by definition are not incomplete, they’re
|
||||
* partial/pending instead */
|
||||
* partial/pending instead. While an individual Instance cannot be both partial and
|
||||
* pending, an UpdateSet as a whole can contain both partial and pending instances. */
|
||||
assert(!match || !(match->is_partial && match->is_pending));
|
||||
|
||||
if (match && match->is_partial)
|
||||
extra_flags = (extra_flags | UPDATE_PARTIAL) & ~UPDATE_INCOMPLETE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user