• Joe Tsai's avatar
    archive/tar: support arbitrary PAX records · a795ca51
    Joe Tsai authored
    This CL adds the following new publicly visible API:
    	type Header struct { ...; PAXRecords map[string]string }
    
    The new Header.PAXRecords field is a map of all PAX extended header records.
    
    We suggest (but do not enforce) that users use VENDOR-prefixed keys
    according to the following in the PAX specification:
    <<<
    The standard developers have reserved keyword name space for vendor extensions.
    It is suggested that the format to be used is:
    	VENDOR.keyword
    where VENDOR is the name of the vendor or organization in all uppercase letters.
    >>>
    
    When reading, the Header.PAXRecords is populated with all PAX records
    encountered so far, including basic ones (e.g., "path", "mtime", etc).
    When writing, the fields of Header will be merged into PAXRecords,
    overwriting any records that may conflict.
    
    Since PAXRecords is a more expressive feature than Xattrs and
    is entirely a superset of Xattrs, we mark Xattrs as deprecated,
    and steer users towards the new PAXRecords API.
    
    The issue has a discussion about adding a Header.SetPAXRecord method
    to help validate records and keep the Header fields in sync.
    However, we do not include that in this CL since that helper
    method can always be added in the future.
    
    There is no support for global records.
    
    Fixes #14472
    
    Change-Id: If285a52749acc733476cf75a2c7ad15bc1542071
    Reviewed-on: https://go-review.googlesource.com/58390
    Run-TryBot: Joe Tsai <thebrokentoaster@gmail.com>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    a795ca51
strconv_test.go 13.5 KB