ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject DO NOT REPLY [Bug 47421] New: tar task does not flush the buffer correctly for a short block
Date Thu, 25 Jun 2009 02:07:11 GMT

           Summary: tar task does not flush the buffer correctly for a
                    short block
           Product: Ant
           Version: 1.7.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core tasks

Created an attachment (id=23873)
 --> (
patch to fix the writeBlock call to correctly account for the number of

If the final block does not contain the full number of records that the buffer
supports then the resulting tar file contains the two EOF blocks (2 lots of 512
of nulls) followed by whatever was in the buffer previously. e.g. if the buffer
contains 3 blocks it would look like this in the final two blocks:


Looking through the code - in src/main/org/apache/tools/tar/ the
process is normally as follows:

1. If the buffer is full then write out the block.
2. When writing out the block it always writes out the full blocksize

However when the close is called (or any call to flush) it will call the same
writeBlock method regardless of the number of records the buffer currently

The fix is simple - that when writing the block it should always calculate the
size to write out based upon the number of records and the record size. I've
attached a patch to fix this.

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.

View raw message