tar: Only pad partially-filled blocks #67
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Tar archives are stored sequences of 512-byte blocks, so archive members must be zero-padded to the nearest whole number of blocks. The current padding calculation incorrectly adds a full 512-byte padding block if the member already finishes on a block boundary.
The tar end of file marker is defined as two consecutive empty blocks:
https://www.loc.gov/preservation/digital/formats/fdd/fdd000531.shtml
However interoperability testing with the system tar binary shows that a single unnecessary empty block will be interpreted as the end of the file.
Modifications
The padding calculation now correctly avoids zero-padding a file which is already a whole number of blocks in length.
Result
Tarmodule will match the out put of the system tar utilities.containertoolcurrently only stores one member - the application binary - in an archive.Test Plan