From: Johannes Schindelin Date: Mon, 10 Oct 2005 19:42:49 GMT Subject: Re: First cut at git port to Cygwin Message-ID: In-Reply-To: <434AC058.60803@zytor.com> Hi, On Mon, 10 Oct 2005, H. Peter Anvin wrote: > Johannes Schindelin wrote: > > > > > 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. > > > > > > > > > > Then PROT_READ probably makes more sense? > > > > Not necessarily. Sometimes you need to annotate the data from the index, and > > this does not need to be written back to the index file. > > > > 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! Yes, those would be bugs. However, if I understood the man page for mmap() correctly, then PROT_WRITE && MAP_PRIVATE makes the data copy-on-write, which means that those bugs would have been found (because the changes would no longer be present when git was called the next time). And I checked: all mmap() calls in git are MAP_PRIVATE. > > > > Yes. It might have been overkill that you supported writing > > > > changes back, though. > > > > > > Not just overkill; if we do MAP_PRIVATE it's actively WRONG. > > > > See above. > > > > Eh? If we MAP_PRIVATE, *and* we (intentionally) write to it, we *BETTER* not > write anything back. Yes. That was *my* mistake. Ciao, Dscho