mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-20 17:49:10 +00:00
Fix #3091 enforce all outgoing tar files to use PAX
While processing the content of a tar image, linuxkit's moby tool is blindly reusing the original tar format. Moreover it locates the files under a new prefix, so if the original file was stored as USTAR in the original archive, the filename length and new prefix could be greater than the USTAR name limit leading to a fatal error. The fix is to always enforce PAX format on all copied files from the original image archive. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
This commit is contained in:
parent
26ae9a0246
commit
7a7f5f66c2
@ -140,6 +140,9 @@ func ImageTar(ref *reference.Spec, prefix string, tw tarWriter, trust bool, pull
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// force PAX format, since it allows for unlimited Name/Linkname
|
||||
// and we move all files below prefix.
|
||||
hdr.Format = tar.FormatPAX
|
||||
if exclude[hdr.Name] {
|
||||
log.Debugf("image tar: %s %s exclude %s", ref, prefix, hdr.Name)
|
||||
_, err = io.Copy(ioutil.Discard, tr)
|
||||
|
Loading…
Reference in New Issue
Block a user