Thread (11 messages) flat view 11 messages, 4 authors, 2016-06-15

Re: [PATCH] git-{repack,pack-objects} accept --{pack,blob}-limit to control pack size

From: Shawn O. Pearce <hidden>
Date: 2016-06-15 22:43:03

Dana How [off-list ref] wrote:
it's not clear to me that
the mmap window code works on 32b systems
with >2GB-sized objects in packs.
Hmmph.  Depends on the system.

For glibc we do try to set _FILE_OFFSET_BITS to 64, so that
even on 32 bit glibcs we pick up a 64 bit off_t.  But really old
glibcs won't have any 64 bit off_t support no matter what we do.
And some systems don't know what _FILE_OFFSET_BITS is, so they
give us whatever size off_t they want.

Forget mmap.  In a 32 bit off_t case there is absolutely no way
that open_packed_git_1 can verify the packfile signature (last
20 bytes) against the index if the packfile is larger than 2 GiB.
In this case we will have an off_t that is negative, subtract 20
from it, and its still probably negative.  I doubt SEEK_SET will
like a negative offset.  This of course assumes that the earlier
fstat call actually succeeded on such a file a large file with
such a small off_t.

If we get through that open_packed_git_1 and actually verify the
signature, we either have some random sequence in the middle of the
packfile that matches the signature in the index (sort of unlikely),
or our off_t is actually large enough to handle the window position
tests that the use_pack and in_window functions perform.  In this
latter case we shouldn't have any problems with the mmap code.

-- 
Shawn.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help