Skip to content

Commit

Permalink
Use GNU_FORMAT in tarfile to avoid '././@PaxHeader' in archives
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ehaupt committed Apr 17, 2024
1 parent 3208bfa commit 590b41b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tdworkflow/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def archive_files(target_dir: str, exclude_patterns: List[str]) -> io.BytesIO:

target_dir_path = Path(target_dir)
_bytes = io.BytesIO()
with tarfile.open(mode="w:gz", fileobj=_bytes) as tar:
with tarfile.open(mode="w:gz", fileobj=_bytes, format=tarfile.GNU_FORMAT) as tar:
for current_dir, directories, files in os.walk(target_dir_path):
for file_or_dir in [*directories, *files]:
file_path = Path(os.path.join(current_dir, file_or_dir))
Expand Down

0 comments on commit 590b41b

Please sign in to comment.