commons-issues mailing list archives

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


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|]
 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.)
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

> Validate Block and Record Sizes
> -------------------------------
>                 Key: COMPRESS-407
>                 URL:
>             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

This message was sent by Atlassian JIRA

View raw message