-
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