Skip to content

Commit af85e47

Browse files
committed
pkg/archive: getWhiteoutConverter: don't error with userns enabled
Since 838047a, the overlayWhiteoutConverter is supported with userns enabled, so we no longer need this check. Signed-off-by: Sebastiaan van Stijn <[email protected]>
1 parent 47eebd7 commit af85e47

3 files changed

Lines changed: 7 additions & 18 deletions

File tree

pkg/archive/archive.go

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -871,11 +871,6 @@ func NewTarballer(srcPath string, options *TarOptions) (*Tarballer, error) {
871871
return nil, err
872872
}
873873

874-
whiteoutConverter, err := getWhiteoutConverter(options.WhiteoutFormat, options.InUserNS)
875-
if err != nil {
876-
return nil, err
877-
}
878-
879874
return &Tarballer{
880875
// Fix the source path to work with long path names. This is a no-op
881876
// on platforms other than Windows.
@@ -885,7 +880,7 @@ func NewTarballer(srcPath string, options *TarOptions) (*Tarballer, error) {
885880
pipeReader: pipeReader,
886881
pipeWriter: pipeWriter,
887882
compressWriter: compressWriter,
888-
whiteoutConverter: whiteoutConverter,
883+
whiteoutConverter: getWhiteoutConverter(options.WhiteoutFormat),
889884
}, nil
890885
}
891886

@@ -1080,10 +1075,7 @@ func Unpack(decompressedArchive io.Reader, dest string, options *TarOptions) err
10801075
defer pools.BufioReader32KPool.Put(trBuf)
10811076

10821077
var dirs []*tar.Header
1083-
whiteoutConverter, err := getWhiteoutConverter(options.WhiteoutFormat, options.InUserNS)
1084-
if err != nil {
1085-
return err
1086-
}
1078+
whiteoutConverter := getWhiteoutConverter(options.WhiteoutFormat)
10871079

10881080
// Iterate through the files in the archive.
10891081
loop:

pkg/archive/archive_linux.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ import (
1212
"golang.org/x/sys/unix"
1313
)
1414

15-
func getWhiteoutConverter(format WhiteoutFormat, inUserNS bool) (tarWhiteoutConverter, error) {
15+
func getWhiteoutConverter(format WhiteoutFormat) tarWhiteoutConverter {
1616
if format == OverlayWhiteoutFormat {
17-
if inUserNS {
18-
return nil, errors.New("specifying OverlayWhiteoutFormat is not allowed in userns")
19-
}
20-
return overlayWhiteoutConverter{}, nil
17+
return overlayWhiteoutConverter{}
2118
}
22-
return nil, nil
19+
return nil
2320
}
2421

2522
type overlayWhiteoutConverter struct{}

pkg/archive/archive_other.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
package archive // import "github.com/docker/docker/pkg/archive"
44

5-
func getWhiteoutConverter(format WhiteoutFormat, inUserNS bool) (tarWhiteoutConverter, error) {
6-
return nil, nil
5+
func getWhiteoutConverter(format WhiteoutFormat) tarWhiteoutConverter {
6+
return nil
77
}

0 commit comments

Comments
 (0)