Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GNU_FORMAT in tarfile to avoid '././@PaxHeader' in archives #29

Merged
merged 1 commit into from Apr 17, 2024

Conversation

ehaupt
Copy link
Contributor

@ehaupt ehaupt commented Apr 17, 2024

Summary

This merge request updates the archive_files function to use the GNU_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 adds PaxHeader 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 the tarfile.open method to tarfile.GNU_FORMAT, we force the use of the GNU tar format. This format does not use PaxHeader 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.

To address the issue where tarballs created by the archive_files function include unwanted '././@PaxHeader' directories, the tarfile creation mode has been switched to use the GNU_FORMAT. This change ensures that the tar archives generated do not contain these empty directories, resulting in cleaner and more compliant tar files.
@chezou chezou merged commit 37d95f7 into chezou:master Apr 17, 2024
@chezou
Copy link
Owner

chezou commented Apr 17, 2024

@ehaupt Thanks for the patch! I'll release a new version.

@ehaupt ehaupt deleted the specify_tar_format branch April 18, 2024 05:26
freebsd-git pushed a commit to freebsd/freebsd-ports that referenced this pull request Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants