commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dennis New (JIRA)" <>
Subject [jira] [Created] (COMPRESS-449) IOUtils.skip throws an IOException sometimes
Date Wed, 18 Apr 2018 01:51:00 GMT
Dennis New created COMPRESS-449:

             Summary: IOUtils.skip throws an IOException sometimes
                 Key: COMPRESS-449
             Project: Commons Compress
          Issue Type: Bug
    Affects Versions: 1.6
            Reporter: Dennis New

commons-compress > 1.5 introduced some weird IOUtils.skip bug (it introduced that function
in 1.6 in 2013 I think). It exists with all the versions of commons-compress that I tested
after 1.5, including 1.6, 1.10. java -version says I'm using openjdk version "1.8.0_151" (IcedTea
3.6.0), and I'm using gnu tar 1.30.

Basically, is.skip() and IOUtils.skip() are throwing an IOException somewhere somehow. Replacing
those functions with "fixes" the bug for me.

I can reproduce the bug by creating a tar file even with a single file in it. Oddly enough,
this bug only appears if the file in the tar is greater than 7680 bytes!?. For every possible
file size less than or equal to that, it works. For every file size greater than that, (I
only tested up to 50,000 bytes :p), it fails. For example:

  dd if=/dev/zero of=testfile2 bs=1 count=7681
  tar cf moo.tar testfile2

Then with the following java test code:
  import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
  import org.apache.commons.compress.archivers.tar.TarArchiveInputStream;
  import org.apache.commons.compress.archivers.ArchiveEntry;
  public class HelloWorld {
                public static void main(String[] args) {
                try {
                        TarArchiveInputStream tis = new TarArchiveInputStream (;
                        ArchiveEntry entry;
                        while ( (entry=tis.getNextEntry()) != null) {
                } catch (IOException e) {
                        for (StackTraceElement ste : e.getStackTrace()) {

Although this works (inputting using that "<" redirection),
  java -Xbootclasspath/a:commons-compress.jar HelloWorld < moo.tar

This doesn't work (piping it out of a cat call),
  cat moo.tar | java -Xbootclasspath/a:commons-compress.jar HelloWorld

testfile2 Method)

This message was sent by Atlassian JIRA

View raw message