You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Stefan Bodewig (JIRA)" <ji...@apache.org> on 2010/02/15 17:27:27 UTC

[jira] Commented: (COMPRESS-85) cpio archive final entry corrupt

    [ https://issues.apache.org/jira/browse/COMPRESS-85?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12833875#action_12833875 ] 

Stefan Bodewig commented on COMPRESS-85:
----------------------------------------

It may be that the result depends on the actual files being archived.  I've turned your snippet into the trivial program (soon to be) attached and created an archive of four files from the current svn tree of commons compress (as of 2010-02-15) and cpio on my Linux box is happy with the result created with either the 1.0 version or currsnt svn trunk.

Would it be possible for you to provide a set of files where creation fails?


> cpio archive final entry corrupt
> --------------------------------
>
>                 Key: COMPRESS-85
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-85
>             Project: Commons Compress
>          Issue Type: Bug
>    Affects Versions: 1.0
>         Environment: Java 1.4.2 run on AIX and Linux
>            Reporter: Bill Maier
>
> 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();
>   }
> }}

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.