Skip to content

Commit 5bcd2f6

Browse files
committed
builder/dockerfile: ADD with best-effort xattrs
Archives being unpacked by Dockerfiles may have been created on other OSes with different conventions and semantics for xattrs, making them impossible to apply when extracting. Restore the old best-effort xattr behaviour users have come to depend on in the classic builder. The (archive.Archiver).UntarPath function does not allow the options passed to Untar to be customized. It also happens to be a trivial wrapper around the Untar function. Inline the function body and add the option. Signed-off-by: Cory Snider <[email protected]>
1 parent a60546b commit 5bcd2f6

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

builder/dockerfile/copy.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,16 @@ func performCopyForInfo(dest copyInfo, source copyInfo, options copyFileOptions)
459459
return copyDirectory(archiver, srcPath, destPath, options.identity)
460460
}
461461
if options.decompress && archive.IsArchivePath(srcPath) && !source.noDecompress {
462-
return archiver.UntarPath(srcPath, destPath)
462+
f, err := os.Open(srcPath)
463+
if err != nil {
464+
return err
465+
}
466+
defer f.Close()
467+
options := &archive.TarOptions{
468+
IDMap: archiver.IDMapping,
469+
BestEffortXattrs: true,
470+
}
471+
return archiver.Untar(f, destPath, options)
463472
}
464473

465474
destExistsAsDir, err := isExistingDirectory(destPath)

0 commit comments

Comments
 (0)