From e51217e15c3eb89d18b313dad32db1787d4f2a44 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 30 Jun 2016 05:08:57 -0400 Subject: t5000: test tar files that overflow ustar headers The ustar format only has room for 11 (or 12, depending on some implementations) octal digits for the size and mtime of each file. For values larger than this, we have to add pax extended headers to specify the real data, and git does not yet know how to do so. Before fixing that, let's start off with some test infrastructure, as designing portable and efficient tests for this is non-trivial. We want to use the system tar to check our output (because what we really care about is interoperability), but we can't rely on it: 1. being able to read pax headers 2. being able to handle huge sizes or mtimes 3. supporting a "t" format we can parse So as a prerequisite, we can feed the system tar a reference tarball to make sure it can handle these features. The reference tar here was created with: dd if=/dev/zero seek=64G bs=1 count=1 of=huge touch -d @68719476737 huge tar cf - --format=pax | head -c 2048 using GNU tar. Note that this is not a complete tarfile, but it's enough to contain the headers we want to examine. Likewise, we need to convince git that it has a 64GB blob to output. Running "git add" on that 64GB file takes many minutes of CPU, and even compressed, the result is 64MB. So again, I pre-generated that loose object, and then took only the first 2k of it. That should be enough to generate 2MB of data before hitting an inflate error, which is plenty for us to generate the tar header (and then die of SIGPIPE while streaming the rest out). The tests are split so that we test as much as we can even with an uncooperative system tar. This actually catches the current breakage (which is that we die("BUG") trying to write the ustar header) on every system, and then on systems where we can, we go farther and actually verify the result. Helped-by: Robin H. Johnson Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- t/t5000/huge-and-future.tar | Bin 0 -> 2048 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 t/t5000/huge-and-future.tar (limited to 't/t5000/huge-and-future.tar') diff --git a/t/t5000/huge-and-future.tar b/t/t5000/huge-and-future.tar new file mode 100644 index 0000000000..63155e1855 Binary files /dev/null and b/t/t5000/huge-and-future.tar differ -- cgit v1.2.3