Skip to content

Commit

Permalink
pkg/archive: getWhiteoutConverter: don't error with userns enabled
Browse files Browse the repository at this point in the history
Since 838047a, the overlayWhiteoutConverter
is supported with userns enabled, so we no longer need this check.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit af85e47)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Jun 28, 2024
1 parent b70040a commit 02e2448
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
12 changes: 2 additions & 10 deletions pkg/archive/archive.go
Original file line number Diff line number Diff line change
Expand Up @@ -871,11 +871,6 @@ func NewTarballer(srcPath string, options *TarOptions) (*Tarballer, error) {
return nil, err
}

whiteoutConverter, err := getWhiteoutConverter(options.WhiteoutFormat, options.InUserNS)
if err != nil {
return nil, err
}

return &Tarballer{
// Fix the source path to work with long path names. This is a no-op
// on platforms other than Windows.
Expand All @@ -885,7 +880,7 @@ func NewTarballer(srcPath string, options *TarOptions) (*Tarballer, error) {
pipeReader: pipeReader,
pipeWriter: pipeWriter,
compressWriter: compressWriter,
whiteoutConverter: whiteoutConverter,
whiteoutConverter: getWhiteoutConverter(options.WhiteoutFormat),
}, nil
}

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

var dirs []*tar.Header
whiteoutConverter, err := getWhiteoutConverter(options.WhiteoutFormat, options.InUserNS)
if err != nil {
return err
}
whiteoutConverter := getWhiteoutConverter(options.WhiteoutFormat)

// Iterate through the files in the archive.
loop:
Expand Down
9 changes: 3 additions & 6 deletions pkg/archive/archive_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@ import (
"golang.org/x/sys/unix"
)

func getWhiteoutConverter(format WhiteoutFormat, inUserNS bool) (tarWhiteoutConverter, error) {
func getWhiteoutConverter(format WhiteoutFormat) tarWhiteoutConverter {
if format == OverlayWhiteoutFormat {
if inUserNS {
return nil, errors.New("specifying OverlayWhiteoutFormat is not allowed in userns")
}
return overlayWhiteoutConverter{}, nil
return overlayWhiteoutConverter{}
}
return nil, nil
return nil
}

type overlayWhiteoutConverter struct{}
Expand Down
4 changes: 2 additions & 2 deletions pkg/archive/archive_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

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

func getWhiteoutConverter(format WhiteoutFormat, inUserNS bool) (tarWhiteoutConverter, error) {
return nil, nil
func getWhiteoutConverter(format WhiteoutFormat) tarWhiteoutConverter {
return nil
}

0 comments on commit 02e2448

Please sign in to comment.