tarpatch

package
v0.0.0-...-0a43815 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package tarpatch addresses an issue with stdlib throwing an error in some environments.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FileInfoHeader

func FileInfoHeader(fullPath turbopath.AnchoredUnixPath, fileInfo fs.FileInfo, link string) (*tar.Header, error)

FileInfoHeader creates a populated Header from fi.

Compared to the archive/tar package, this function fills in less information but is safe to call from a chrooted process. The AccessTime and ChangeTime fields are not set in the returned header, ModTime is truncated to one-second precision, and the Uname and Gname fields are only set when fi is a FileInfo value returned from tar.Header.FileInfo().

func FileInfoHeaderNoLookups

func FileInfoHeaderNoLookups(fi fs.FileInfo, link string) (*tar.Header, error)

FileInfoHeaderNoLookups creates a partially-populated tar.Header from fi.

Compared to the archive/tar.FileInfoHeader function, this function is safe to call from a chrooted process as it does not populate fields which would require operating system lookups. It behaves identically to tar.FileInfoHeader when fi is a FileInfo value returned from tar.Header.FileInfo().

When fi is a FileInfo for a native file, such as returned from os.Stat() and os.Lstat(), the returned Header value differs from one returned from tar.FileInfoHeader in the following ways. The Uname and Gname fields are not set as OS lookups would be required to populate them. The AccessTime and ChangeTime fields are not currently set (not yet implemented) although that is subject to change. Callers which require the AccessTime or ChangeTime fields to be zeroed should explicitly zero them out in the returned Header value to avoid any compatibility issues in the future.

Types

This section is empty.

Jump to

Keyboard shortcuts

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