• Marco Hennings's avatar
    archive/tar: Fix support for long links and improve PAX support. · a07c95a5
    Marco Hennings authored
    The tar/archive code from golang has a problem with linknames with length >
    100. A pax header is added but the original header still written with a too
    long field length.
    
    As it is clear that pax support is incomplete I have added missing
    implementation parts.
    
    This commit contains code from the golang project in the folder tar/archiv.
    
    The following pax header records are now automatically written:
    
    - gname)
    - linkpath
    - path
    - uname
    
    The following fields can be written with PAX, but the default is to use the
    star binary extension.
    
    - gid  (value > 2097151)
    - size (value > 8589934591)
    - uid (value > 2097151)
    
    The string fields are written when the value is longer as the field or if the
    string contains a char that is not encodable as 7-bit ASCII value.
    
    The change was tested against a current ubuntu-cloud image tarball comparing
    the compressed result.
    
    + added some automated tests for the new functionality.
    
    Fixes #6056.
    
    R=dsymonds
    CC=golang-dev
    https://golang.org/cl/12561043
    a07c95a5
reader.go 9.49 KB