Use GNU_FORMAT in tarfile to avoid '././@PaxHeader' in archives #29
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.
Summary
This merge request updates the
archive_files
function to use theGNU_FORMAT
when creating tar archives. The current tar file creation process leads to the inclusion of unwanted '././@PaxHeader' directories in the tarballs. These directories are empty and serve no purpose in our context, potentially causing confusion and issues with tarball consumers.Problem
When archiving files using the default tar format, the Python
tarfile
library addsPaxHeader
directories to store extended header information. This behavior, while compliant with POSIX standards, is unnecessary for our use case and results in additional, unneeded directories in our archives.Solution
By setting the
format
parameter of thetarfile.open
method totarfile.GNU_FORMAT
, we force the use of the GNU tar format. This format does not usePaxHeader
directories to store extended headers, thus preventing their creation. This change leads to the generation of cleaner archives, avoiding the inclusion of these empty directories.Impact
This change will make our tar archives simpler and potentially more compatible with systems that do not handle the
PaxHeader
directories properly. It will ensure that only the necessary files are included in the archives, without additional metadata directories.Testing
The change has been tested by creating archives with various sets of files and examining the contents of the resulting tarballs. No
PaxHeader
directories were included in any of the tested archives, confirming that the change achieves its intended effect.