-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Closed as not planned
Closed as not planned
Copy link
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
Description
The current master implementation elides records, for example pax x typeflag records are collapsed into the following record with the extended headers being merged into the normal file's headers. This is useful for most consumers, who are only interested in consuming the tar content. But two use cases would benefit from more direct access to the lower-level tar details:
- Accessing information that is not yet represented in the the tar structure. For example,
tar.Headerdoes not currently expose pax extended headers outside of these names and prefixes. There are plans to rectify this limitation (archive/tar: add support for arbitrary pax vendor extensions #14472), but until the tar structures expose all of these sorts of details it will be useful to have a way to directly access the header and file data. This will allow users to add their own parsers for any extension they need which is not yet supported by the stdlib, without requiring them to fork archive/tar or replace it with a completely novel parser. - Validating tar files against a particular standard. If a protocol places requirements on the tar elements, users will need more direct access to the tar details to check the tar file against those requirements. For an example along these lines, see layer: Require ustar (originally from IEEE Std 1003.1-1988 but linking IEEE Std 1003.1-2013) opencontainers/image-spec#342 and the extremely naive stub here (which currently doesn't work because
Next()never returns thextypeflag headers).
I think we can address both of these cases without breaking the existing API with two changes:
- Adding a
tar.Reader.NextRaw()that works liketar.Reader.Next(), but always returns the next record regardless of its typeflag. - Adding
tar.Header.Bytesexposing a[]byteslice of the raw header data, to allow clients to access header fields that are not yet mapped to othertar.Headerattributes. Alternatively, this could be a methodtar.Header.Bytes()(or an attribute exposing astringor whatever) to make the data clearly read-only.
Folks who wish to control writing at a low level may want similar changes on the tar.Writer side, but I think that is orthogonal enough to punt to a separate issue (if anyone wants it).
CC @dsnet.
Metadata
Metadata
Assignees
Labels
FeatureRequestIssues asking for a new feature that does not need a proposal.Issues asking for a new feature that does not need a proposal.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.