Subject: Re: Bug: .gitconfig folder

From: Junio C Hamano <[email-masked]>
Date: Wed, 27 May 2015 15:38:12 -0700

Jeff King <[email-masked]> writes:

>> -			die_errno("Out of memory? mmap failed");
>> +			die_errno("mmap failed");
>
> This is definitely an improvement, but the real failing of that error
> message is that it does not tell us that "~/.gitconfig" is the culprit.
> I don't think we can do much from xmmap, though; it does not have the
> filename. It would be nice if we got EISDIR from open() in the first
> place, but I don't think we can implement that efficiently (if we added
> an "xopen" that checked that, it would have to stat() every file we
> opened).

The patch was meant to be a tongue-in-cheek tangent that is a vast
improvement for cases where we absolutely need to use mmap but does
not help the OP at all ;-)  I do not think there is any need for the
config reader to read the existing file via mmap interface; just
open it, strbuf_read() the whole thing (and complain when it cannot)
and we should be ok.

Or do we write back through the mmaped region or something?