You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2004/08/05 19:10:21 UTC
DO NOT REPLY [Bug 30495] New: -
Compress: TarOutputStream.java long file name bug (and fix!)
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30495>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30495
Compress: TarOutputStream.java long file name bug (and fix!)
Summary: Compress: TarOutputStream.java long file name bug (and
fix!)
Product: Commons
Version: unspecified
Platform: All
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Sandbox
AssignedTo: commons-dev@jakarta.apache.org
ReportedBy: dyamasak@aol.com
'LongLink' entries written to a tar file header by
TarOutputStream.putNextEntry() specify the wrong file name length and data,
preventing GNU tar from properly reading long file name entries (in the current
GNU 'tar' implementation, sometimes one gets lucky and the entry happens to be
null-terminated so it works anyway). In particular, the file name
length--stored as an octal string in each header entry--should include an extra
byte for the null terminator that must also be written at the end of the file
name in the header.
Here's what the code in
org.apache.commons.compress.tar.TarOutputStream.putNextEntry() currently looks
like (starting around line 424):
if( m_longFileMode == LONGFILE_GNU ) {
// create a TarEntry for the LongLink, the contents
// of which are the entry's name
final TarEntry longLinkEntry =
new TarEntry( TarConstants.GNU_LONGLINK,
TarConstants.LF_GNUTYPE_LONGNAME );
longLinkEntry.setSize( entry.getName().length() );
putNextEntry( longLinkEntry );
write( entry.getName().getBytes() );
//write( 0 );
closeEntry();
}
Here's what the code should have been:
if( m_longFileMode == LONGFILE_GNU ) {
// create a TarEntry for the LongLink, the contents
// of which are the entry's name
final TarEntry longLinkEntry =
new TarEntry( TarConstants.GNU_LONGLINK,
TarConstants.LF_GNUTYPE_LONGNAME );
longLinkEntry.setSize( entry.getName().length() + 1 );
putNextEntry( longLinkEntry );
write( entry.getName().getBytes() );
write( 0 );
closeEntry();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org