commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Spero (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (COMPRESS-407) Validate Block and Record Sizes
Date Fri, 23 Jun 2017 00:06:00 GMT

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

Simon Spero commented on COMPRESS-407:
--------------------------------------

It is definitely an error to attempt to create a PAX or USTAR format file a record size that
is not 512 bytes. Any attempt to use a PAX or USTAR feature with a record size not equal to
512 bytes will have to be modified to throw an exception. 

[The tar format documentation in libarchive| https://github.com/libarchive/libarchive/blob/master/libarchive/tar.5]
 shows that this goes all the way back to V7.

{panel:title=tar (5) }
*General Format*

    A tar archive consists of a series of 512-byte records.  Each file system object requires
a header record which stores basic metadata (pathname, owner, permissions, etc.) and zero
or more records containing any file data.  The end of the archive is indicated by two records
consisting  entirely of zero bytes.

     For compatibility with tape drives that use fixed block sizes, programs that read or
write tar files always read or write a fixed number of records with each I/O operation.  These
“blocks” are always a multiple of the record size.  The maximum block size supported by
early implementations was 10240 bytes or 20 records.  This is still the default for most implementations
although block sizes of 1MiB (2048 records) or larger are commonly used with modern high-speed
tape drives.  (Note: the terms “block” and “record” here are not entirely standard;
this document follows the convention established by John Gilmore in documenting pdtar.)
{panel}
 
If alternative record sizes are to be permitted then these will have to be 512 bytes or greater
in size.  If such uses are permitted then there needs to a warning logged. Which means there
has to be logging added. 

I will add a second pull request on top of this one that adds a logging framework, reduces
the errors to a  warning, and removes the tests. 
As an alternative, I will add a third pull request that uses a system property to enable invalid
tar record sizes. 

I would still advise applying the PR as submitted and rejecting either of the above listed
 alternatives.  

> Validate Block and Record Sizes
> -------------------------------
>
>                 Key: COMPRESS-407
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-407
>             Project: Commons Compress
>          Issue Type: Sub-task
>          Components: Archivers
>            Reporter: Simon Spero
>
> Reject record sizes not equal to 512 bytes; require block sizes to be multiples of 512
bytes.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message