commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stefan Bodewig (JIRA)" <j...@apache.org>
Subject [jira] Updated: (COMPRESS-85) cpio archive final entry corrupt
Date Thu, 18 Feb 2010 12:19:27 GMT

     [ https://issues.apache.org/jira/browse/COMPRESS-85?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Stefan Bodewig updated COMPRESS-85:
-----------------------------------

    Attachment: archive2.cpio
                archive.cpio
                Creator.java

This is both frustrating and fun in a strange way.

-B sets the block size to 5120 while the archive is created with a size of 512, so it isn't
supposed to work.  With svn revision 911353 I've made the block size configurable.

I've also introduced some logic inside the library so you don't have to set inode and device
explicitly in order to get unique values.  nlink and mode should now at least provide reasonable
default values.

archive.cpio has been created with Creator.java and commons-compress svn revision 911353,
archive2.cpio has been created with GNU cpio 2.9 on Ubuntu Linux 9.04.  They only differ in
device and inode numbers and timestamps.

Since the archive doesn't work for your Suse system, could you please create a cpio archive
of your our files and upload it here as well?

> 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
>         Attachments: archive.cpio, archive2.cpio, cpio.tar, Creator.java
>
>
> 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.


Mime
View raw message