commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Henri Yandell (JIRA)" <j...@apache.org>
Subject [jira] Updated: (SANDBOX-30) [compress] TarOutputStream.java long file name bug (and fix!)
Date Wed, 05 Jul 2006 03:57:39 GMT
     [ http://issues.apache.org/jira/browse/SANDBOX-30?page=all ]

Henri Yandell updated SANDBOX-30:
---------------------------------

    Component: Compress

> [compress] TarOutputStream.java long file name bug (and fix!)
> -------------------------------------------------------------
>
>          Key: SANDBOX-30
>          URL: http://issues.apache.org/jira/browse/SANDBOX-30
>      Project: Commons Sandbox
>         Type: Bug

>   Components: Compress
>  Environment: Operating System: other
> Platform: All
>     Reporter: Derc Yamasaki

>
> '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();
> }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message