Uploaded image for project: 'Commons Compress'
  1. Commons Compress
  2. COMPRESS-85

cpio archive final entry corrupt

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.0
    • 1.1
    • None
    • None
    • Java 1.4.2 run on AIX and Linux

    Description

      The code below is called with an array of 4 file names. The cpio archive archive.cpio is created with no error messages, but when I then run the Unix command "cpio -ivct <archive.cpio" it reports the error "Can't read input" on the last file in the archive. If I run "cpio -ivcBmu <archive.cpio" the last file is incomplete, but the other files are extracted correctly. Same result in AIX and Linux.

      {{
      private void createArchive(String[] outFiles)
      throws FileNotFoundException, IOException, ArchiveException {
      short format = CpioArchiveOutputStream.FORMAT_OLD_ASCII;
      final OutputStream out = new FileOutputStream("archive.cpio");
      ArchiveOutputStream os = new CpioArchiveOutputStream(out, format);

      for (int j = 0; j < outFiles.length; j++)

      { System.out.println("Entry = " + outFiles[j]); File f = new File(outFiles[j]); CpioArchiveEntry entry = new CpioArchiveEntry(format); entry.setName(outFiles[j]); entry.setSize(f.length()); os.putArchiveEntry(entry); IOUtils.copy(new FileInputStream(outFiles[j]), os); os.closeArchiveEntry(); }

      os.finish();
      os.close();
      }
      }}

      Attachments

        1. archive.cpio
          4 kB
          Stefan Bodewig
        2. archive2.cpio
          4 kB
          Stefan Bodewig
        3. archive3.cpio
          4 kB
          Bill Maier
        4. archive4.cpio
          5 kB
          Bill Maier
        5. cpio.tar
          10 kB
          Bill Maier
        6. Creator.java
          1 kB
          Stefan Bodewig

        Activity

          People

            Unassigned Unassigned
            bmaier Bill Maier
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: