You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by pe...@apache.org on 2020/12/10 03:16:37 UTC

[commons-compress] 02/02: COMPRESS-559: Skip extracting with GNU tar 1.28

This is an automated email from the ASF dual-hosted git repository.

peterlee pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit d98e849850a33c1762d318108cb21d8e210388fc
Author: theobisproject <th...@gmail.com>
AuthorDate: Tue Dec 8 20:49:11 2020 +0100

    COMPRESS-559: Skip extracting with GNU tar 1.28
    
    It is known to be broken for the archive the test will extract
---
 .../apache/commons/compress/archivers/tar/SparseFilesTest.java | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java b/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
index fad2fc8..ab41002 100644
--- a/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/tar/SparseFilesTest.java
@@ -178,6 +178,8 @@ public class SparseFilesTest extends AbstractTestCase {
     @Test
     public void testExtractPaxGNU() throws IOException, InterruptedException {
         assumeFalse("This test should be ignored on Windows", isOnWindows);
+        assumeFalse("This test should be ignored if GNU tar is version 1.28",
+                getTarBinaryHelp().startsWith("tar (GNU tar) 1.28"));
 
         final File file = getFile("pax_gnu_sparse.tar");
         try (TarArchiveInputStream tin = new TarArchiveInputStream(new FileInputStream(file))) {
@@ -241,5 +243,13 @@ public class SparseFilesTest extends AbstractTestCase {
         fail("didn't find " + sparseFileName + " after extracting " + tarFile);
         return null;
     }
+
+    private String getTarBinaryHelp() throws IOException {
+        final ProcessBuilder pb = new ProcessBuilder("tar", "--version");
+        pb.redirectErrorStream(true);
+        final Process process = pb.start();
+        // wait until the help is shown
+        return new String(IOUtils.toByteArray(process.getInputStream()));
+    }
 }