Skip to content

Commit 0e19f07

Browse files
TheMarexoxidase
authored andcommitted
Use byte based tar size encoding above 8GB
1 parent 59c0795 commit 0e19f07

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

third_party/microtar/src/microtar.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ static int header_to_raw(mtar_raw_header_t *rh, const mtar_header_t *h) {
141141
memset(rh, 0, sizeof(*rh));
142142

143143
/* Store size in ASCII octal digits or base-256 formats */
144-
if (sizeof(mtar_size_t) <= 4 || filesize <= (mtar_size_t)0777777777777LL) {
144+
if (sizeof(mtar_size_t) <= 4 || filesize <= (mtar_size_t)077777777777LL) {
145145
#ifdef _MSC_VER
146146
sprintf(rh->size, "%llo", h->size);
147147
#else

unit_tests/storage/tar.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,10 @@ BOOST_AUTO_TEST_CASE(continue_write_tar_file)
189189
CHECK_EQUAL_COLLECTIONS(result_64bit_vector, vector_64bit);
190190
}
191191

192-
// This test case is disabled by default because it needs 70 GiB of storage
192+
// Boost test only supports disabling was only introduced in 1.59
193+
#if BOOST_VERSION >= 105900
194+
// This test case is disabled by default because it needs 10 GiB of storage
195+
// Enable with ./storage-tests --run_test=tar/write_huge_tar_file
193196
BOOST_AUTO_TEST_CASE(write_huge_tar_file, *boost::unit_test::disabled())
194197
{
195198
TemporaryFile tmp{TEST_DATA_DIR "/tar_huge_write_test.tar"};
@@ -202,7 +205,7 @@ BOOST_AUTO_TEST_CASE(write_huge_tar_file, *boost::unit_test::disabled())
202205
reference_checksum += value;
203206
return value++;
204207
};
205-
std::uint64_t num_elements = (70ULL * 1024ULL * 1024ULL * 1024ULL) / sizeof(std::uint64_t);
208+
std::uint64_t num_elements = (10ULL * 1024ULL * 1024ULL * 1024ULL) / sizeof(std::uint64_t);
206209
writer.WriteStreaming<std::uint64_t>(
207210
"huge_data",
208211
boost::make_function_input_iterator(encode_function, boost::infinite()),
@@ -219,5 +222,6 @@ BOOST_AUTO_TEST_CASE(write_huge_tar_file, *boost::unit_test::disabled())
219222

220223
BOOST_CHECK_EQUAL(checksum, reference_checksum);
221224
}
225+
#endif
222226

223227
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)