Subject: Re: First cut at git port to Cygwin

From: "H. Peter Anvin" <[email-masked]>
Date: Mon, 10 Oct 2005 13:52:27 -0700

Junio C Hamano wrote:
> "H. Peter Anvin" <[email-masked]> writes:
> 
> 
>>>>Junio C Hamano wrote:
>>>>
>>>>
>>>>>PROT_WRITE is true, but we do MAP_PRIVATE, and if I recall
>>>>>correctly we do not write file via mmap -- at least we do not
>>>>>intend to.
>>>>>
>>
>>In the above sentence, emphasis on "at least we do not intend to."  If 
>>writes are done legitimately then that's fine, but we shouldn't have 
>>"accidental writes" -- those would be program bugs!
> 
> 
> What I meant to say was "we do not intend to write back the
> changes by expecting the modification on mapped area are written
> back by mmap() mechanism -- the updates to index file is done by
> creat - write - close - rename".  So your saying "the overkill
> being actively wrong" was technically correct, but that wrongly
> written data was renamed out anyway and no real harm was done.

Well, it broke the atomicity of an operation, which *is* a real problem.

Anyway, malloc+read is a dead ringer for MAP_PRIVATE with PROT_WRITE, so 
that makes it even easier to mimic.

	-hpa