mirror of
https://github.com/containers/podman.git
synced 2025-12-09 15:19:35 +08:00
Bump github.com/containers/storage from 1.25.0 to 1.28.0
Bumps [github.com/containers/storage](https://github.com/containers/storage) from 1.25.0 to 1.28.0. - [Release notes](https://github.com/containers/storage/releases) - [Changelog](https://github.com/containers/storage/blob/master/docs/containers-storage-changes.md) - [Commits](https://github.com/containers/storage/compare/v1.25.0...v1.28.0) Signed-off-by: dependabot-preview[bot] <support@dependabot.com> Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
27
vendor/github.com/containers/storage/pkg/archive/archive.go
generated
vendored
27
vendor/github.com/containers/storage/pkg/archive/archive.go
generated
vendored
@@ -99,6 +99,12 @@ func NewDefaultArchiver() *Archiver {
|
||||
// in order for the test to pass.
|
||||
type breakoutError error
|
||||
|
||||
// overwriteError is used to differentiate errors related to attempting to
|
||||
// overwrite a directory with a non-directory or vice-versa. When testing
|
||||
// copying a file over a directory, this error is expected in order for the
|
||||
// test to pass.
|
||||
type overwriteError error
|
||||
|
||||
const (
|
||||
// Uncompressed represents the uncompressed.
|
||||
Uncompressed Compression = iota
|
||||
@@ -437,9 +443,16 @@ func ReadUserXattrToTarHeader(path string, hdr *tar.Header) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
type tarWhiteoutConverter interface {
|
||||
type TarWhiteoutHandler interface {
|
||||
Setxattr(path, name string, value []byte) error
|
||||
Mknod(path string, mode uint32, dev int) error
|
||||
Chown(path string, uid, gid int) error
|
||||
}
|
||||
|
||||
type TarWhiteoutConverter interface {
|
||||
ConvertWrite(*tar.Header, string, os.FileInfo) (*tar.Header, error)
|
||||
ConvertRead(*tar.Header, string) (bool, error)
|
||||
ConvertReadWithHandler(*tar.Header, string, TarWhiteoutHandler) (bool, error)
|
||||
}
|
||||
|
||||
type tarAppender struct {
|
||||
@@ -455,7 +468,7 @@ type tarAppender struct {
|
||||
// non standard format. The whiteout files defined
|
||||
// by the AUFS standard are used as the tar whiteout
|
||||
// standard.
|
||||
WhiteoutConverter tarWhiteoutConverter
|
||||
WhiteoutConverter TarWhiteoutConverter
|
||||
// CopyPass indicates that the contents of any archive we're creating
|
||||
// will instantly be extracted and written to disk, so we can deviate
|
||||
// from the traditional behavior/format to get features like subsecond
|
||||
@@ -792,7 +805,7 @@ func TarWithOptions(srcPath string, options *TarOptions) (io.ReadCloser, error)
|
||||
compressWriter,
|
||||
options.ChownOpts,
|
||||
)
|
||||
ta.WhiteoutConverter = getWhiteoutConverter(options.WhiteoutFormat, options.WhiteoutData)
|
||||
ta.WhiteoutConverter = GetWhiteoutConverter(options.WhiteoutFormat, options.WhiteoutData)
|
||||
ta.CopyPass = options.CopyPass
|
||||
|
||||
defer func() {
|
||||
@@ -952,11 +965,11 @@ func Unpack(decompressedArchive io.Reader, dest string, options *TarOptions) err
|
||||
var dirs []*tar.Header
|
||||
idMappings := idtools.NewIDMappingsFromMaps(options.UIDMaps, options.GIDMaps)
|
||||
rootIDs := idMappings.RootPair()
|
||||
whiteoutConverter := getWhiteoutConverter(options.WhiteoutFormat, options.WhiteoutData)
|
||||
whiteoutConverter := GetWhiteoutConverter(options.WhiteoutFormat, options.WhiteoutData)
|
||||
buffer := make([]byte, 1<<20)
|
||||
|
||||
if options.ForceMask != nil {
|
||||
uid, gid, mode, err := getFileOwner(dest)
|
||||
uid, gid, mode, err := GetFileOwner(dest)
|
||||
if err == nil {
|
||||
value := fmt.Sprintf("%d:%d:0%o", uid, gid, mode)
|
||||
if err := system.Lsetxattr(dest, containersOverrideXattr, []byte(value), 0); err != nil {
|
||||
@@ -1020,13 +1033,13 @@ loop:
|
||||
if options.NoOverwriteDirNonDir && fi.IsDir() && hdr.Typeflag != tar.TypeDir {
|
||||
// If NoOverwriteDirNonDir is true then we cannot replace
|
||||
// an existing directory with a non-directory from the archive.
|
||||
return fmt.Errorf("cannot overwrite directory %q with non-directory %q", path, dest)
|
||||
return overwriteError(fmt.Errorf("cannot overwrite directory %q with non-directory %q", path, dest))
|
||||
}
|
||||
|
||||
if options.NoOverwriteDirNonDir && !fi.IsDir() && hdr.Typeflag == tar.TypeDir {
|
||||
// If NoOverwriteDirNonDir is true then we cannot replace
|
||||
// an existing non-directory with a directory from the archive.
|
||||
return fmt.Errorf("cannot overwrite non-directory %q with directory %q", path, dest)
|
||||
return overwriteError(fmt.Errorf("cannot overwrite non-directory %q with directory %q", path, dest))
|
||||
}
|
||||
|
||||
if fi.IsDir() && hdr.Name == "." {
|
||||
|
||||
6
vendor/github.com/containers/storage/pkg/archive/archive_ffjson.go
generated
vendored
6
vendor/github.com/containers/storage/pkg/archive/archive_ffjson.go
generated
vendored
@@ -1945,7 +1945,7 @@ func (j *tarAppender) MarshalJSONBuf(buf fflib.EncodingBuffer) error {
|
||||
buf.WriteString(`,"ChownOpts":null`)
|
||||
}
|
||||
buf.WriteString(`,"WhiteoutConverter":`)
|
||||
/* Interface types must use runtime reflection. type=archive.tarWhiteoutConverter kind=interface */
|
||||
/* Interface types must use runtime reflection. type=archive.TarWhiteoutConverter kind=interface */
|
||||
err = buf.Encode(j.WhiteoutConverter)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -2393,10 +2393,10 @@ handle_ChownOpts:
|
||||
|
||||
handle_WhiteoutConverter:
|
||||
|
||||
/* handler: j.WhiteoutConverter type=archive.tarWhiteoutConverter kind=interface quoted=false*/
|
||||
/* handler: j.WhiteoutConverter type=archive.TarWhiteoutConverter kind=interface quoted=false*/
|
||||
|
||||
{
|
||||
/* Falling back. type=archive.tarWhiteoutConverter kind=interface */
|
||||
/* Falling back. type=archive.TarWhiteoutConverter kind=interface */
|
||||
tbuf, err := fs.CaptureField(tok)
|
||||
if err != nil {
|
||||
return fs.WrapErr(err)
|
||||
|
||||
32
vendor/github.com/containers/storage/pkg/archive/archive_linux.go
generated
vendored
32
vendor/github.com/containers/storage/pkg/archive/archive_linux.go
generated
vendored
@@ -12,7 +12,7 @@ import (
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
func getWhiteoutConverter(format WhiteoutFormat, data interface{}) tarWhiteoutConverter {
|
||||
func GetWhiteoutConverter(format WhiteoutFormat, data interface{}) TarWhiteoutConverter {
|
||||
if format == OverlayWhiteoutFormat {
|
||||
if rolayers, ok := data.([]string); ok && len(rolayers) > 0 {
|
||||
return overlayWhiteoutConverter{rolayers: rolayers}
|
||||
@@ -108,13 +108,13 @@ func (o overlayWhiteoutConverter) ConvertWrite(hdr *tar.Header, path string, fi
|
||||
return
|
||||
}
|
||||
|
||||
func (overlayWhiteoutConverter) ConvertRead(hdr *tar.Header, path string) (bool, error) {
|
||||
func (overlayWhiteoutConverter) ConvertReadWithHandler(hdr *tar.Header, path string, handler TarWhiteoutHandler) (bool, error) {
|
||||
base := filepath.Base(path)
|
||||
dir := filepath.Dir(path)
|
||||
|
||||
// if a directory is marked as opaque by the AUFS special file, we need to translate that to overlay
|
||||
if base == WhiteoutOpaqueDir {
|
||||
err := unix.Setxattr(dir, "trusted.overlay.opaque", []byte{'y'}, 0)
|
||||
err := handler.Setxattr(dir, "trusted.overlay.opaque", []byte{'y'})
|
||||
// don't write the file itself
|
||||
return false, err
|
||||
}
|
||||
@@ -124,10 +124,10 @@ func (overlayWhiteoutConverter) ConvertRead(hdr *tar.Header, path string) (bool,
|
||||
originalBase := base[len(WhiteoutPrefix):]
|
||||
originalPath := filepath.Join(dir, originalBase)
|
||||
|
||||
if err := unix.Mknod(originalPath, unix.S_IFCHR, 0); err != nil {
|
||||
if err := handler.Mknod(originalPath, unix.S_IFCHR, 0); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if err := idtools.SafeChown(originalPath, hdr.Uid, hdr.Gid); err != nil {
|
||||
if err := handler.Chown(originalPath, hdr.Uid, hdr.Gid); err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
@@ -138,12 +138,32 @@ func (overlayWhiteoutConverter) ConvertRead(hdr *tar.Header, path string) (bool,
|
||||
return true, nil
|
||||
}
|
||||
|
||||
type directHandler struct {
|
||||
}
|
||||
|
||||
func (d directHandler) Setxattr(path, name string, value []byte) error {
|
||||
return unix.Setxattr(path, name, value, 0)
|
||||
}
|
||||
|
||||
func (d directHandler) Mknod(path string, mode uint32, dev int) error {
|
||||
return unix.Mknod(path, mode, dev)
|
||||
}
|
||||
|
||||
func (d directHandler) Chown(path string, uid, gid int) error {
|
||||
return idtools.SafeChown(path, uid, gid)
|
||||
}
|
||||
|
||||
func (o overlayWhiteoutConverter) ConvertRead(hdr *tar.Header, path string) (bool, error) {
|
||||
var handler directHandler
|
||||
return o.ConvertReadWithHandler(hdr, path, handler)
|
||||
}
|
||||
|
||||
func isWhiteOut(stat os.FileInfo) bool {
|
||||
s := stat.Sys().(*syscall.Stat_t)
|
||||
return major(uint64(s.Rdev)) == 0 && minor(uint64(s.Rdev)) == 0
|
||||
}
|
||||
|
||||
func getFileOwner(path string) (uint32, uint32, uint32, error) {
|
||||
func GetFileOwner(path string) (uint32, uint32, uint32, error) {
|
||||
f, err := os.Stat(path)
|
||||
if err != nil {
|
||||
return 0, 0, 0, err
|
||||
|
||||
4
vendor/github.com/containers/storage/pkg/archive/archive_other.go
generated
vendored
4
vendor/github.com/containers/storage/pkg/archive/archive_other.go
generated
vendored
@@ -2,10 +2,10 @@
|
||||
|
||||
package archive
|
||||
|
||||
func getWhiteoutConverter(format WhiteoutFormat, data interface{}) tarWhiteoutConverter {
|
||||
func GetWhiteoutConverter(format WhiteoutFormat, data interface{}) TarWhiteoutConverter {
|
||||
return nil
|
||||
}
|
||||
|
||||
func getFileOwner(path string) (uint32, uint32, uint32, error) {
|
||||
func GetFileOwner(path string) (uint32, uint32, uint32, error) {
|
||||
return 0, 0, 0, nil
|
||||
}
|
||||
|
||||
19
vendor/github.com/containers/storage/pkg/archive/changes_linux.go
generated
vendored
19
vendor/github.com/containers/storage/pkg/archive/changes_linux.go
generated
vendored
@@ -296,8 +296,14 @@ func parseDirent(buf []byte, names []nameIno) (consumed int, newnames []nameIno)
|
||||
if dirent.Ino == 0 { // File absent in directory.
|
||||
continue
|
||||
}
|
||||
bytes := (*[10000]byte)(unsafe.Pointer(&dirent.Name[0]))
|
||||
var name = string(bytes[0:clen(bytes[:])])
|
||||
builder := make([]byte, 0, dirent.Reclen)
|
||||
for i := 0; i < len(dirent.Name); i++ {
|
||||
if dirent.Name[i] == 0 {
|
||||
break
|
||||
}
|
||||
builder = append(builder, byte(dirent.Name[i]))
|
||||
}
|
||||
name := string(builder)
|
||||
if name == "." || name == ".." { // Useless names
|
||||
continue
|
||||
}
|
||||
@@ -306,15 +312,6 @@ func parseDirent(buf []byte, names []nameIno) (consumed int, newnames []nameIno)
|
||||
return origlen - len(buf), names
|
||||
}
|
||||
|
||||
func clen(n []byte) int {
|
||||
for i := 0; i < len(n); i++ {
|
||||
if n[i] == 0 {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return len(n)
|
||||
}
|
||||
|
||||
// OverlayChanges walks the path rw and determines changes for the files in the path,
|
||||
// with respect to the parent layers
|
||||
func OverlayChanges(layers []string, rw string) ([]Change, error) {
|
||||
|
||||
Reference in New Issue
Block a user