archive

package
v4.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 23, 2026 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Overview

Contains code adapted from:

https://github.com/moby/moby/blob/master/pkg/pools

Copyright 2013-2018 Docker, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Contains code adapted from:

https://github.com/moby/moby/blob/master/daemon/internal/system

Copyright 2013-2018 Docker, Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Index

Constants

This section is empty.

Variables

View Source
var BufioReader32KPool = newBufioReaderPoolWithSize(buffer32K)

BufioReader32KPool is a pool which returns bufio.Reader with a 32K buffer.

Functions

func Chtimes added in v4.4.1

func Chtimes(name string, atime time.Time, mtime time.Time) error

Chtimes changes the access time and modified time of a file at the given path. If the modified time is prior to the Unix Epoch (unixMinTime), or after the end of Unix Time (unixEpochTime), os.Chtimes has undefined behavior. In this case, Chtimes defaults to Unix Epoch, just in case.

func CopyWithTar

func CopyWithTar(src, dst string, disableIDMapping bool) error

CopyWithTar is a wrapper around the docker pkg/archive/copy CopyWithTar function allowing unprivileged use. It forces ownership to the current uid/gid in unprivileged situations. No file may be copied into a location above dst, and hard links / symlinks may not target a file above dst.

func CopyWithTarWithRoot added in v4.1.4

func CopyWithTarWithRoot(src, dst, dstRoot string, disableIDMapping bool) error

CopyWithTarWithRoots copies files as with CopyWithTar, but uses a custom ar.Untar which checks that hard link / symlink targets are under dstRoot, and not dst. This allows copying a directory src to dst, where the directory contains a link to a location above dst, but under dstroot.

func LUtimesNano added in v4.4.1

func LUtimesNano(path string, ts []syscall.Timespec) error

LUtimesNano is used to change access and modification time of the specified path. It's used for symbol link file because unix.UtimesNano doesn't support a NOFOLLOW flag atm.

func Lgetxattr added in v4.4.1

func Lgetxattr(path string, attr string) ([]byte, error)

Lgetxattr retrieves the value of the extended attribute identified by attr and associated with the given path in the file system. It returns a nil slice and nil error if the xattr is not set.

func Lsetxattr added in v4.4.1

func Lsetxattr(path string, attr string, data []byte, flags int) error

Lsetxattr sets the value of the extended attribute identified by attr and associated with the given path in the file system.

func UnpackWithRoot added in v4.1.4

func UnpackWithRoot(decompressedArchive io.Reader, dest, destRoot string, options *archive.TarOptions) error

Unpack unpacks the decompressedArchive to dest with options. The target of any symlinks and hard links must be under destRoot. This differs from the unmodified upstream code, which requires that they are under dest.

Types

type BufioReaderPool added in v4.4.1

type BufioReaderPool struct {
	// contains filtered or unexported fields
}

BufioReaderPool is a bufio reader that uses sync.Pool.

func (*BufioReaderPool) Get added in v4.4.1

func (bufPool *BufioReaderPool) Get(r io.Reader) *bufio.Reader

Get returns a bufio.Reader which reads from r. The buffer size is that of the pool.

func (*BufioReaderPool) Put added in v4.4.1

func (bufPool *BufioReaderPool) Put(b *bufio.Reader)

Put puts the bufio.Reader back into the pool.

type XattrError added in v4.4.1

type XattrError struct {
	Op   string
	Attr string
	Path string
	Err  error
}

func (*XattrError) Error added in v4.4.1

func (e *XattrError) Error() string

func (*XattrError) Timeout added in v4.4.1

func (e *XattrError) Timeout() bool

Timeout reports whether this error represents a timeout.

func (*XattrError) Unwrap added in v4.4.1

func (e *XattrError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL