https://issues.apache.org/bugzilla/show_bug.cgi?id=47421
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
AssignedTo: [email protected]
ReportedBy: [email protected]
Created an attachment (id=23873)
--> (https://issues.apache.org/bugzilla/attachment.cgi?id=23873)
patch to fix the writeBlock call to correctly account for the number of
records.
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:
A
B
C
---
EOF
EOF
C
Looking through the code - in src/main/org/apache/tools/tar/TarBuffer.java 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
contains.
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: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.