go/src/archive/tar/common.go

var tarinsecurepath

var ErrHeader

var ErrWriteTooLong

var ErrFieldTooLong

var ErrWriteAfterClose

var ErrInsecurePath

var errMissData

var errUnrefData

var errWriteHole

type headerError

func (he headerError) Error() string {}

const TypeReg

const TypeRegA

const TypeLink

const TypeSymlink

const TypeChar

const TypeBlock

const TypeDir

const TypeFifo

const TypeCont

const TypeXHeader

const TypeXGlobalHeader

const TypeGNUSparse

const TypeGNULongName

const TypeGNULongLink

const paxNone

const paxPath

const paxLinkpath

const paxSize

const paxUid

const paxGid

const paxUname

const paxGname

const paxMtime

const paxAtime

const paxCtime

const paxCharset

const paxComment

const paxSchilyXattr

const paxGNUSparse

const paxGNUSparseNumBlocks

const paxGNUSparseOffset

const paxGNUSparseNumBytes

const paxGNUSparseMap

const paxGNUSparseName

const paxGNUSparseMajor

const paxGNUSparseMinor

const paxGNUSparseSize

const paxGNUSparseRealSize

var basicKeys

type Header

type sparseEntry

func (s sparseEntry) endOffset() int64 {}

type sparseDatas

type sparseHoles

// validateSparseEntries reports whether sp is a valid sparse map.
// It does not matter whether sp represents data fragments or hole fragments.
func validateSparseEntries(sp []sparseEntry, size int64) bool {}

// alignSparseEntries mutates src and returns dst where each fragment's
// starting offset is aligned up to the nearest block edge, and each
// ending offset is aligned down to the nearest block edge.
//
// Even though the Go tar Reader and the BSD tar utility can handle entries
// with arbitrary offsets and lengths, the GNU tar utility can only handle
// offsets and lengths that are multiples of blockSize.
func alignSparseEntries(src []sparseEntry, size int64) []sparseEntry {}

// invertSparseEntries converts a sparse map from one form to the other.
// If the input is sparseHoles, then it will output sparseDatas and vice-versa.
// The input must have been already validated.
//
// This function mutates src and returns a normalized map where:
//   - adjacent fragments are coalesced together
//   - only the last fragment may be empty
//   - the endOffset of the last fragment is the total size
func invertSparseEntries(src []sparseEntry, size int64) []sparseEntry {}

type fileState

// allowedFormats determines which formats can be used.
// The value returned is the logical OR of multiple possible formats.
// If the value is FormatUnknown, then the input Header cannot be encoded
// and an error is returned explaining why.
//
// As a by-product of checking the fields, this function returns paxHdrs, which
// contain all fields that could not be directly encoded.
// A value receiver ensures that this method does not mutate the source Header.
func (h Header) allowedFormats() (format Format, paxHdrs map[string]string, err error) {}

// FileInfo returns an fs.FileInfo for the Header.
func (h *Header) FileInfo() fs.FileInfo {}

type headerFileInfo

func (fi headerFileInfo) Size() int64        {}

func (fi headerFileInfo) IsDir() bool        {}

func (fi headerFileInfo) ModTime() time.Time {}

func (fi headerFileInfo) Sys() any           {}

// Name returns the base name of the file.
func (fi headerFileInfo) Name() string {}

// Mode returns the permission and mode bits for the headerFileInfo.
func (fi headerFileInfo) Mode() (mode fs.FileMode) {}

func (fi headerFileInfo) String() string {}

var sysStat

const c_ISUID

const c_ISGID

const c_ISVTX

const c_ISDIR

const c_ISFIFO

const c_ISREG

const c_ISLNK

const c_ISBLK

const c_ISCHR

const c_ISSOCK

// FileInfoHeader creates a partially-populated [Header] from fi.
// If fi describes a symlink, FileInfoHeader records link as the link target.
// If fi describes a directory, a slash is appended to the name.
//
// Since fs.FileInfo's Name method only returns the base name of
// the file it describes, it may be necessary to modify Header.Name
// to provide the full path name of the file.
//
// If fi implements [FileInfoNames]
// Header.Gname and Header.Uname
// are provided by the methods of the interface.
func FileInfoHeader(fi fs.FileInfo, link string) (*Header, error) {}

type FileInfoNames

// isHeaderOnlyType checks if the given type flag is of the type that has no
// data section even if a size is specified.
func isHeaderOnlyType(flag byte) bool {}