Skip to content

archive/tar: do not use ustar long filename encoding and binary number encoding together #9683

@lyonel

Description

@lyonel

Go version: go1.3.3 linux/amd64 on Fedora 20

When creating an archive (with tar.NewWriter), long names (> 100 chars) that don't fit into standard tar headers need to be encoded differently.
An optimisation in archive/tar/writer.go: writeHeader() tries to use a ustar header when only the name is too long creates files that are misinterpretated by other tar implementations (but read correctly by archive/tar)

For example, /home/support/.openoffice.org/3/user/uno_packages/cache/registry/com.sun.star.comp.deployment.executable.PackageRegistryBackend becomes com.sun.star.comp.deployment.executable.PackageRegistryBackend for external tar commands (tested with GNU tar, BSD tar and star)

Modifying archive/tar/writer.go and forcing preferPax to true in NewWriter fixes the issue

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions