mirror of
https://github.com/git/git
synced 2024-10-30 04:01:21 +00:00
3444ec2eb2
While doing some testing with fsmonitor enabled I found that git commands would segfault after staging and unstaging an untracked file. Looking at the crash it appeared that fsmonitor_ewah_callback was attempting to adjust bits beyond the bounds of the index cache. Digging into how this could happen it became clear that the fsmonitor extension must have been written with more bits than there were entries in the index. The root cause ended up being that fill_fsmonitor_bitmap was populating fsmonitor_dirty with bits for all entries in the index, even those that had been marked for removal. To solve this problem fill_fsmonitor_bitmap has been updated to skip entries with the the CE_REMOVE flag set. With this change the bits written for the fsmonitor extension will be consistent with the index entries written by do_write_index. Additionally, BUG checks have been added to detect if the number of bits in fsmonitor_dirty should ever exceed the number of entries in the index again. Another option that was considered was moving the call to fill_fsmonitor_bitmap closer to where the index is written (and where the fsmonitor extension itself is written). However, that did not work as the fsmonitor_dirty bitmap must be filled before the index is split during writing. Signed-off-by: William Baker <William.Baker@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
24 lines
560 B
Bash
Executable file
24 lines
560 B
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# An test hook script to integrate with git to test fsmonitor.
|
|
#
|
|
# The hook is passed a version (currently 1) and a time in nanoseconds
|
|
# formatted as a string and outputs to stdout all files that have been
|
|
# modified since the given time. Paths must be relative to the root of
|
|
# the working tree and separated by a single NUL.
|
|
#
|
|
#echo "$0 $*" >&2
|
|
|
|
if test "$#" -ne 2
|
|
then
|
|
echo "$0: exactly 2 arguments expected" >&2
|
|
exit 2
|
|
fi
|
|
|
|
if test "$1" != 1
|
|
then
|
|
echo "Unsupported core.fsmonitor hook version." >&2
|
|
exit 1
|
|
fi
|
|
|
|
printf '%s\n' $FSMONITOR_LIST
|