Re: Potential problem in git-add may corrupt the index file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gang Hu <ganghu@xxxxxxxxxxxxxxx> writes:

> If a crash happens after the rename(), the data may have not been
> completely flushed into the index file, so the user may face an empty
> or corrupted index file.

Yeah, probably we should add fsync_or_die() at the end of write_index()
in read-cache.c, possibly protect it with fsync_object_files just like
we do in close_sha1_file() in sha1_file.c for loose object files.

I think the real fix would be to update the write_index() codepath to
use the csum-file API, though.  Then sha1close() will give us the fsync
behaviour for free.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]