Skip to content

t5608, t7508: require LONG_IS_64BIT for >4GB tests#2129

Open
spkrka wants to merge 1 commit into
gitgitgadget:masterfrom
spkrka:fix-4gb-test-prereqs
Open

t5608, t7508: require LONG_IS_64BIT for >4GB tests#2129
spkrka wants to merge 1 commit into
gitgitgadget:masterfrom
spkrka:fix-4gb-test-prereqs

Conversation

@spkrka
Copy link
Copy Markdown

@spkrka spkrka commented May 28, 2026

The >4GB clone tests in t5608 and the large-file status test in t7508
fail on Windows x86_64 where unsigned long is 32 bits.

t5608 (tests 5-6): The server-side pack-objects still uses
unsigned long for object sizes, so cast_size_t_to_ulong() dies
when it encounters a 4294967297-byte object. The streaming/odb side
was widened to size_t in js/objects-larger-than-4gb-on-windows, but
pack-objects was deliberately left as a stop-gap.

t7508 (test 126): ftruncate is implemented via _chsize on
MSVC, which takes a long parameter — overflowing at 2 GiB. The
subsequent git add / git diff-index also route through
object_info.sizep (unsigned long), which would truncate.

Add LONG_IS_64BIT prerequisite so these tests skip on Windows
until the remaining unsigned longsize_t widening lands.

cc: @dscho

The >4GB clone tests in t5608 (tests 5-6) fail on Windows because the
server-side pack-objects still uses `unsigned long` for object sizes.
On Windows x86_64 (LLP64), `unsigned long` is 32 bits, so
pack-objects dies in cast_size_t_to_ulong() when it encounters a
4294967297-byte object:

  fatal: object too large to read on this platform: 4294967297 is cut off to 1

The streaming/odb/index-pack side was widened to size_t in
js/objects-larger-than-4gb-on-windows, but pack-objects was
deliberately left as a stop-gap with cast_size_t_to_ulong() at the
type boundaries. Until the pack-objects path is also widened, gate
these tests on LONG_IS_64BIT so they skip on Windows rather than
failing.

Similarly, t7508's "status does not re-read unchanged 4 or 8 GiB
file" test fails on Windows because ftruncate is implemented via
_chsize which takes a `long` parameter, overflowing at 2 GiB. The
subsequent git-add and git-diff-index also route through
object_info.sizep (unsigned long), which would truncate. Add
LONG_IS_64BIT here too.

Note: LONG_IS_64BIT is a stop-gap, not the right long-term fix.
Once the remaining `unsigned long` code paths (pack-objects,
object_info.sizep, and the MSVC ftruncate compat shim) are widened
to use size_t, these tests should work on all 64-bit platforms and
the LONG_IS_64BIT prerequisite can be dropped.

Signed-off-by: Kristofer Karlsson <krka@spotify.com>
@spkrka spkrka force-pushed the fix-4gb-test-prereqs branch from 279b211 to 79334a2 Compare May 28, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant