From 8746f20aec2f1f0140a5ae66639e690c3388a4b1 Mon Sep 17 00:00:00 2001 From: Galen S <56940276+schmidt-galen-heb@users.noreply.github.com> Date: Wed, 8 Sep 2021 06:49:34 -0500 Subject: [PATCH] Use POSIX mode for large numbers in tar archives (#4384) (#4388) * Use POSIX mode for large numbers in tar archives (#4384) * PR feedback --- .../main/java/org/testcontainers/containers/ContainerState.java | 1 + .../org/testcontainers/images/builder/ImageFromDockerfile.java | 1 + 2 files changed, 2 insertions(+) diff --git a/core/src/main/java/org/testcontainers/containers/ContainerState.java b/core/src/main/java/org/testcontainers/containers/ContainerState.java index da87dbdf724..5de9ef7c566 100644 --- a/core/src/main/java/org/testcontainers/containers/ContainerState.java +++ b/core/src/main/java/org/testcontainers/containers/ContainerState.java @@ -272,6 +272,7 @@ default void copyFileToContainer(Transferable transferable, String containerPath TarArchiveOutputStream tarArchive = new TarArchiveOutputStream(byteArrayOutputStream) ) { tarArchive.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX); + tarArchive.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX); transferable.transferTo(tarArchive, containerPath); tarArchive.finish(); diff --git a/core/src/main/java/org/testcontainers/images/builder/ImageFromDockerfile.java b/core/src/main/java/org/testcontainers/images/builder/ImageFromDockerfile.java index b36779f1b9e..05bb6911c3e 100644 --- a/core/src/main/java/org/testcontainers/images/builder/ImageFromDockerfile.java +++ b/core/src/main/java/org/testcontainers/images/builder/ImageFromDockerfile.java @@ -123,6 +123,7 @@ public void onNext(BuildResponseItem item) { // To build an image, we have to send the context to Docker in TAR archive format try (TarArchiveOutputStream tarArchive = new TarArchiveOutputStream(new GZIPOutputStream(out))) { tarArchive.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX); + tarArchive.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX); for (Map.Entry entry : transferables.entrySet()) { Transferable transferable = entry.getValue();