diff --git a/pkg/helpers/archive.go b/pkg/helpers/archive.go index 8f2ba247..d64d174f 100644 --- a/pkg/helpers/archive.go +++ b/pkg/helpers/archive.go @@ -95,9 +95,7 @@ func UntarProtect(src, dst string, sameOwner bool, protectedFiles []string, modi replacerArchive := archive.ReplaceFileTarWrapper(in, mods) opts := &archive.TarOptions{ - // NOTE: NoLchown boolean is used for chmod of the symlink - // Probably it's needed set this always to true. - NoLchown: true, + NoLchown: false, ExcludePatterns: []string{"dev/"}, // prevent 'operation not permitted' ContinueOnError: true, } @@ -201,12 +199,8 @@ func Untar(src, dest string, sameOwner bool) error { defer in.Close() if sameOwner { - // PRE: i have root privileged. - opts := &archive.TarOptions{ - // NOTE: NoLchown boolean is used for chmod of the symlink - // Probably it's needed set this always to true. - NoLchown: true, + NoLchown: false, ExcludePatterns: []string{"dev/"}, // prevent 'operation not permitted' ContinueOnError: true, } diff --git a/pkg/helpers/imgworker/unpack.go b/pkg/helpers/imgworker/unpack.go index 0b0803e3..6197b63c 100644 --- a/pkg/helpers/imgworker/unpack.go +++ b/pkg/helpers/imgworker/unpack.go @@ -71,7 +71,7 @@ func (c *Client) Unpack(image, dest string) error { // Unpack the tarfile to the rootfs path. // FROM: https://godoc.org/github.com/moby/moby/pkg/archive#TarOptions if err := archive.Untar(content.NewReader(layer), dest, &archive.TarOptions{ - NoLchown: true, + NoLchown: false, ExcludePatterns: []string{"dev/"}, // prevent 'operation not permitted' }); err != nil { return fmt.Errorf("extracting tar for %s to directory %s failed: %v", desc.Digest.String(), dest, err)