зеркало из https://github.com/microsoft/git.git
fsmonitor: do not compare bitmap size with size of split index
3444ec2e
("fsmonitor: don't fill bitmap with entries to be removed",
2019-10-11) added a handful of sanity checks that make sure that a
bit position in fsmonitor bitmap does not go beyond the end of the
index. As each bit in the bitmap corresponds to a path in the
index, this is the right check most of the time.
Except for the case when we are in the split-index mode and looking
at a delta index that is to be overlayed on the base index but
before the base index has actually been merged in, namely in read_
and write_fsmonitor_extension(). In these codepaths, the entries in
the split/delta index is typically a small subset of the entire set
of paths (otherwise why would we be using split-index?), so the
bitmap used by the fsmonitor is almost always larger than the number
of entries in the partial index, and the incorrect comparison would
trigger the BUG().
Reported-by: Utsav Shah <ukshah2@illinois.edu>
Helped-by: Kevin Willford <Kevin.Willford@microsoft.com>
Helped-by: William Baker <William.Baker@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
460782b7be
Коммит
61eea521fe
|
@ -55,7 +55,8 @@ int read_fsmonitor_extension(struct index_state *istate, const void *data,
|
||||||
}
|
}
|
||||||
istate->fsmonitor_dirty = fsmonitor_dirty;
|
istate->fsmonitor_dirty = fsmonitor_dirty;
|
||||||
|
|
||||||
if (istate->fsmonitor_dirty->bit_size > istate->cache_nr)
|
if (!istate->split_index &&
|
||||||
|
istate->fsmonitor_dirty->bit_size > istate->cache_nr)
|
||||||
BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
|
BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
|
||||||
(uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
|
(uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
|
||||||
|
|
||||||
|
@ -83,7 +84,8 @@ void write_fsmonitor_extension(struct strbuf *sb, struct index_state *istate)
|
||||||
uint32_t ewah_size = 0;
|
uint32_t ewah_size = 0;
|
||||||
int fixup = 0;
|
int fixup = 0;
|
||||||
|
|
||||||
if (istate->fsmonitor_dirty->bit_size > istate->cache_nr)
|
if (!istate->split_index &&
|
||||||
|
istate->fsmonitor_dirty->bit_size > istate->cache_nr)
|
||||||
BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
|
BUG("fsmonitor_dirty has more entries than the index (%"PRIuMAX" > %u)",
|
||||||
(uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
|
(uintmax_t)istate->fsmonitor_dirty->bit_size, istate->cache_nr);
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче