• Cristian Staretu's avatar
    archive/tar: fix writing of pax headers · 7a9e7c0a
    Cristian Staretu authored
    "archive/tar: reuse temporary buffer in writeHeader" introduced a
    change which was supposed to help lower the number of allocations from
    512 bytes for every call to writeHeader. This change broke the writing
    of PAX headers.
    
    writeHeader calls writePAXHeader and writePAXHeader calls writeHeader
    again. writeHeader will end up writing the PAX header twice.
    
    example broken header:
    PaxHeaders.4007/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021512 xustar0000000000000000
    PaxHeaders.4007/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021512 xustar0000000000000000
    
    example correct header:
    PaxHeaders.4290/NetLock_Arany_=Class_Gold=_Ftanstvny.crt0000000000000000000000000000007112301216634021516 xustar0000000000000000
    0100644000000000000000000000270412301216634007250 0ustar0000000000000000
    
    This commit adds a dedicated buffer for pax headers to the Writer
    struct. This change increases the size of the struct by 512 bytes, but
    allows tar/writer to avoid allocating 512 bytes for all written
    headers and it avoids allocating 512 more bytes for pax headers.
    
    LGTM=dsymonds
    R=dsymonds, dave, iant
    CC=golang-codereviews
    https://golang.org/cl/110480043
    7a9e7c0a
Name
Last commit
Last update
..
testdata Loading commit data...
common.go Loading commit data...
example_test.go Loading commit data...
reader.go Loading commit data...
reader_test.go Loading commit data...
stat_atim.go Loading commit data...
stat_atimespec.go Loading commit data...
stat_unix.go Loading commit data...
tar_test.go Loading commit data...
writer.go Loading commit data...
writer_test.go Loading commit data...