According to git bisect, 1fb42987de0d21c9b6777272320b64230eadb277 is
the first bad commit

commit 1fb42987de0d21c9b6777272320b64230eadb277

Author: Stefan Bodewig <bode...@apache.org>

Date:   Sun Jan 31 13:12:31 2016 +0100


    COMPRESS-331 make tar checksum check as strict as GNU tar

On Thu, Aug 10, 2017 at 11:14 PM, Philipp Grasboeck
<philippag1...@gmail.com> wrote:
> Hello,
> I think I may have found a regression in
> ArchiveFormatFactory.createArchiveInputStream.
> Please run the JUnit testcase at the end of this mail.
> It demonstrates the archive detection working with 1.10, but failing from
> 1.11 through 1.14
> The file "COMPRESS-117.tar" is taken from commons-compress-1.9-src.zip.
> If it's not a bug, please let me know. Reading in COMPRESS-117 JIRA, I
> believe it fixed exactly this situation.
>
>
> import java.io.BufferedInputStream;
> import java.io.FileInputStream;
> import java.io.FileNotFoundException;
> import java.io.IOException;
> import java.io.InputStream;
>
> import org.apache.commons.compress.archivers.ArchiveException;
> import org.apache.commons.compress.archivers.ArchiveInputStream;
> import org.apache.commons.compress.archivers.ArchiveStreamFactory;
> import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
> import org.junit.Assert;
> import org.junit.Test;
>
> public class TarDetectionRegressionTest {
>
>     @Test
>     public void check() throws IOException, ArchiveException {
>         /*
>          * we can read the archive normally
>          */
>         try (InputStream in = open()) {
>             try (TarArchiveInputStream tar = new TarArchiveInputStream(in))
> {
>                 checkContents(tar);
>             }
>         }
>
>         /*
>          * but we cannot detect the stream signature with commons-compress
> version >= 1.11
>          * 1.10: works
>          * 1.11: fail
>          * 1.12: fail
>          * 1.13: fail
>          * 1.14: fail
>          */
>
>         try (InputStream in = open()) {
>             ArchiveInputStream s = new
> ArchiveStreamFactory().createArchiveInputStream(in);
>             Assert.assertTrue(s instanceof TarArchiveInputStream);
>             checkContents((TarArchiveInputStream) s);
>         }
>     }
>
>     private void checkContents(TarArchiveInputStream tar) throws
> IOException {
>         Assert.assertEquals("test1.xml", tar.getNextEntry().getName());
>         Assert.assertEquals("test2.xml", tar.getNextEntry().getName());
>     }
>
>     private InputStream open() throws FileNotFoundException {
>         return new BufferedInputStream( new
> FileInputStream("src/test/resources/COMPRESS-117.tar"));
>     }
> }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to