When a header is initialized it currently sets all the underlying bytes to null. This happens to match the entry type AREGTYPE which is the 'legacy' regular file type. Any new/modern tar file should use entry type REGTYPE (b'0') instead though, which is supposed to be otherwise identical in every way.
This difference came up in maturin where some code paths were not explicitly setting the entry type and it uncovered a bug in the python standard library tarfile module that is triggered only for AREGTYPE entries. See PyO3/maturin#2855 and python/cpython#141707.
It seems to me that end users are most likely creating entries with the legacy type because of a failure to set the type explicitly rather than a conscious choice to use it.
Proposal: Initialize the headers to REGTYPE by default and expose AREGTYPE in the EntryType enum so that users that actually want that mode can explicitly set it.
When a header is initialized it currently sets all the underlying bytes to null. This happens to match the entry type
AREGTYPEwhich is the 'legacy' regular file type. Any new/modern tar file should use entry typeREGTYPE(b'0') instead though, which is supposed to be otherwise identical in every way.This difference came up in
maturinwhere some code paths were not explicitly setting the entry type and it uncovered a bug in the python standard librarytarfilemodule that is triggered only forAREGTYPEentries. See PyO3/maturin#2855 and python/cpython#141707.It seems to me that end users are most likely creating entries with the legacy type because of a failure to set the type explicitly rather than a conscious choice to use it.
Proposal: Initialize the headers to
REGTYPEby default and exposeAREGTYPEin theEntryTypeenum so that users that actually want that mode can explicitly set it.