Hi all,

While “git svn fetch”ing a subversion repository (private, sorry),
I've encoutered a bug that appears in several git versions (always
with the same symptoms):

git from master (from 2013-04-08)
git version (compiled from homebrew)
git version (Apple Git-37)

The only symptom is git blowing up with the error:
fatal: write error: Invalid argument

Problems showed up when this happened (in the SVN repo):
rev A: File F with 110K is replaced with a 9G file (don't ask…)
intermediate revs: files got added and changed, not touching file F
rev B: File F finally got reverted to the state before rev A

I can git svn fetch up to rev B-1, but svn fetching rev B will throw
the previously mentioned error.

I traced it down to write() returning <0 and setting errno to EINVAL
if nbytes > INT_MAX:
(the write() will eventually call dofilewrite, which has that check).

Testing with dd bs=INT_MAX+1 count=1 also gets me an “Invalid
argument” error, while bs=INT_MAX will do what's expected.

I have a preliminary patch that fixes it, but it may not be the
preferred way. The code is not ifdef'ed out and I'm doing the fix in
write_in_full(), while it may be preferred to do the fix in xwrite().

A radar bug has been submitted to Apple about this, but I think git
could tolerate the bug while it isn't fixed, by working around it.

Thank you,


Attachment: git-darwin-bigwrites.patch
Description: Binary data

Reply via email to