You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This does not set Typeflag: tar.TypeReg and so uses the zero value of Typeflag, which is TypeRegA.
The relevant specification says:
0 represents a regular file. For backwards-compatibility, a typeflag value of binary zero ( '\0' ) should be recognized as meaning a regular file when extracting files from the archive. Archives written with this version of the archive file format create regular files with a typeflag value of the ISO/IEC 646:1991 standard IRV '0'.
Thus, the zero value should be interpreted by readers as equivalent to TypeReg. Every tar reader I know of properly does this. However, it seems like a good idea to have the Writer promote TypeRegA to TypeReg as I can't think of any reason why the user would explicitly want to encode TypeRegA.
When people construct their own
tar.Header
, it is common to see something like:This does not set
Typeflag: tar.TypeReg
and so uses the zero value ofTypeflag
, which isTypeRegA
.The relevant specification says:
Thus, the zero value should be interpreted by readers as equivalent to
TypeReg
. Every tar reader I know of properly does this. However, it seems like a good idea to have theWriter
promoteTypeRegA
toTypeReg
as I can't think of any reason why the user would explicitly want to encodeTypeRegA
.Similarly, perhaps the
Reader
should automatically promoteTypeRegA
toTypeReg
so that users don't have to keep putting both versions in their switch statements.\cc @bradfitz
The text was updated successfully, but these errors were encountered: