if ((stripped = startswith(de->d_name, ".sysupdate.partial."))) {
de_d_name_stripped = stripped;
is_partial = true;
+ is_pending = false;
} else if ((stripped = startswith(de->d_name, ".sysupdate.pending."))) {
de_d_name_stripped = stripped;
is_pending = true;
+ is_partial = false;
} else
de_d_name_stripped = de->d_name;
if (instance->metadata.mode == MODE_INVALID)
instance->metadata.mode = st.st_mode & 0775; /* mask out world-writability and suid and stuff, for safety */
+ /* Can’t be both partial and pending. */
+ assert(!(is_partial && is_pending));
+
instance->is_partial = is_partial;
instance->is_pending = is_pending;
}
if (instance->metadata.read_only < 0)
instance->metadata.read_only = instance->partition_info.read_only;
+ /* Can’t be both partial and pending. */
+ assert(!(is_partial && is_pending));
+
instance->is_partial = is_partial;
instance->is_pending = is_pending;
}
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;