From: Peter Oberndorfer Date: Wed, 07 Nov 2012 21:10:59 GMT Subject: Re: crash on git diff-tree -Ganything for new files with textconv filter Message-ID: <509ACE63.9070007@arcor.de> In-Reply-To: <20121029223521.GJ20513@sigill.intra.peff.net> On 2012-10-29 23:35, Jeff King wrote: > On Mon, Oct 29, 2012 at 09:19:48PM +0100, Peter Oberndorfer wrote: > >> I could reproduce with my 0x3000 bytes file on linux. The buffer is not >> read with a trailing null byte it is mapped by mmap in >> diff_populate_filespec... >> So i think we will not get away with expecting a trailing null :-/ > Thanks for the reproduction recipe. I was testing with "git log", which > does not use the mmap optimization. > >> For me the key to reproduce the problem was to have 2 commits. >> Adding the file in the root commit it did not work. [1] > You probably would need to pass "--root" for it to do the diff of the > initial commit. > > The patch below fixes it, but it's terribly inefficient (it just detects > the situation and reallocates). It would be much better to disable the > reuse_worktree_file mmap when we populate the filespec, but it is too > late to pass an option; we may have already populated from an earlier > diffcore stage. Hi, I tested your patch, and i can confirm it fixes the problem for me. (also on my real world test in msysgit) Again, thanks a lot! Greetings Peter > I guess if we teach the whole diff code that "-G" (and --pickaxe-regex) > is brittle, we can disable the optimization from the beginning based on > the diff options. I'll take a look. > >