Re: [PATCH] Prevent git from rehashing 4GBi files
- From
Philip Oakley <philipoakley@iee.email>
- Date
- May 6, 2022, 21:17 UTC
- Message-ID
- <dd2ffc74-af7e-c2fb-8466-f16e419c39d6@iee.email>
- In-Reply-To
- <xmqqr156obxg.fsf@gitster.g>
On 06/05/2022 17:36, Junio C Hamano wrote:
Show 6 quoted lines
>>> + */
>>> +unsigned int munge_st_size(off_t st_size) {
>>> + unsigned int sd_size = st_size;
>>> +
>>> + if(!sd_size && st_size)
> Style.Ah, the same line / braces choice (as per coding guidelines).
Show 8 quoted lines
>>> + return 0x80000000; >>> + else >>> + return sd_size; >>> +} > This may treat non-zero multiple of 4GiB as "not racy", but has > anybody double checked the concern Réne brought up earlier that a > 4GiB file that was added and then got rewritten to 2GiB within the > same second would suddenly start getting treated as not racy?
This is the pre-existing problem, that ~1in 2^31 size changes might not get noticed for size change. The 0 byte / 4GiB change is an identical issue, as is changing from 3 bytes to 4GiB+3 bytes, etc., so that's no worse than before (well maybe twice as 'unlikely').
> > The patch (the firnal version of it anyway) needs to be accompanied > by a handful of test additions to tickle corner cases like that.
They'd be protected by the EXPENSIVE prerequisite I would assume. Any particular test t/txxx that they should be placed in (I'm not that familiar with the test suit) -- Philip