Blame doc/text/libarchive.3.txt

Packit Service 1d0348
LIBARCHIVE(3)		 BSD Library Functions Manual		 LIBARCHIVE(3)
Packit Service 1d0348
Packit Service 1d0348
NAME
Packit Service 1d0348
     libarchive — functions for reading and writing streaming archives
Packit Service 1d0348
Packit Service 1d0348
OVERVIEW
Packit Service 1d0348
     The libarchive library provides a flexible interface for reading and
Packit Service 1d0348
     writing archives in various formats such as tar and cpio.	libarchive
Packit Service 1d0348
     also supports reading and writing archives compressed using various com‐
Packit Service 1d0348
     pression filters such as gzip and bzip2.  The library is inherently
Packit Service 1d0348
     stream-oriented; readers serially iterate through the archive, writers
Packit Service 1d0348
     serially add things to the archive.  In particular, note that there is
Packit Service 1d0348
     currently no built-in support for random access nor for in-place modifi‐
Packit Service 1d0348
     cation.
Packit Service 1d0348
Packit Service 1d0348
     When reading an archive, the library automatically detects the format and
Packit Service 1d0348
     the compression.  The library currently has read support for:
Packit Service 1d0348
     ·	 old-style tar archives,
Packit Service 1d0348
     ·	 most variants of the POSIX “ustar” format,
Packit Service 1d0348
     ·	 the POSIX “pax interchange” format,
Packit Service 1d0348
     ·	 GNU-format tar archives,
Packit Service 1d0348
     ·	 most common cpio archive formats,
Packit Service 1d0348
     ·	 ISO9660 CD images (including RockRidge and Joliet extensions),
Packit Service 1d0348
     ·	 Zip archives,
Packit Service 1d0348
     ·	 ar archives (including GNU/SysV and BSD extensions),
Packit Service 1d0348
     ·	 Microsoft CAB archives,
Packit Service 1d0348
     ·	 LHA archives,
Packit Service 1d0348
     ·	 mtree file tree descriptions,
Packit Service 1d0348
     ·	 RAR archives,
Packit Service 1d0348
     ·	 XAR archives.
Packit Service 1d0348
     The library automatically detects archives compressed with gzip(1),
Packit Service 1d0348
     bzip2(1), xz(1), lzip(1), or compress(1) and decompresses them transpar‐
Packit Service 1d0348
     ently.  It can similarly detect and decode archives processed with
Packit Service 1d0348
     uuencode(1) or which have an rpm(1) header.
Packit Service 1d0348
Packit Service 1d0348
     When writing an archive, you can specify the compression to be used and
Packit Service 1d0348
     the format to use.  The library can write
Packit Service 1d0348
     ·	 POSIX-standard “ustar” archives,
Packit Service 1d0348
     ·	 POSIX “pax interchange format” archives,
Packit Service 1d0348
     ·	 POSIX octet-oriented cpio archives,
Packit Service 1d0348
     ·	 Zip archive,
Packit Service 1d0348
     ·	 two different variants of shar archives,
Packit Service 1d0348
     ·	 ISO9660 CD images,
Packit Service 1d0348
     ·	 7-Zip archives,
Packit Service 1d0348
     ·	 ar archives,
Packit Service 1d0348
     ·	 mtree file tree descriptions,
Packit Service 1d0348
     ·	 XAR archives.
Packit Service 1d0348
     Pax interchange format is an extension of the tar archive format that
Packit Service 1d0348
     eliminates essentially all of the limitations of historic tar formats in
Packit Service 1d0348
     a standard fashion that is supported by POSIX-compliant pax(1) implemen‐
Packit Service 1d0348
     tations on many systems as well as several newer implementations of
Packit Service 1d0348
     tar(1).  Note that the default write format will suppress the pax
Packit Service 1d0348
     extended attributes for most entries; explicitly requesting pax format
Packit Service 1d0348
     will enable those attributes for all entries.
Packit Service 1d0348
Packit Service 1d0348
     The read and write APIs are accessed through the archive_read_XXX() func‐
Packit Service 1d0348
     tions and the archive_write_XXX() functions, respectively, and either can
Packit Service 1d0348
     be used independently of the other.
Packit Service 1d0348
Packit Service 1d0348
     The rest of this manual page provides an overview of the library opera‐
Packit Service 1d0348
     tion.  More detailed information can be found in the individual manual
Packit Service 1d0348
     pages for each API or utility function.
Packit Service 1d0348
Packit Service 1d0348
READING AN ARCHIVE
Packit Service 1d0348
     See archive_read(3).
Packit Service 1d0348
Packit Service 1d0348
WRITING AN ARCHIVE
Packit Service 1d0348
     See archive_write(3).
Packit Service 1d0348
Packit Service 1d0348
WRITING ENTRIES TO DISK
Packit Service 1d0348
     The archive_write_disk(3) API allows you to write archive_entry(3)
Packit Service 1d0348
     objects to disk using the same API used by archive_write(3).  The
Packit Service 1d0348
     archive_write_disk(3) API is used internally by archive_read_extract();
Packit Service 1d0348
     using it directly can provide greater control over how entries get writ‐
Packit Service 1d0348
     ten to disk.  This API also makes it possible to share code between ar‐
Packit Service 1d0348
     chive-to-archive copy and archive-to-disk extraction operations.
Packit Service 1d0348
Packit Service 1d0348
READING ENTRIES FROM DISK
Packit Service 1d0348
     The archive_read_disk(3) supports for populating archive_entry(3) objects
Packit Service 1d0348
     from information in the filesystem.  This includes the information acces‐
Packit Service 1d0348
     sible from the stat(2) system call as well as ACLs, extended attributes,
Packit Service 1d0348
     and other metadata.  The archive_read_disk(3) API also supports iterating
Packit Service 1d0348
     over directory trees, which allows directories of files to be read using
Packit Service 1d0348
     an API compatible with the archive_read(3) API.
Packit Service 1d0348
Packit Service 1d0348
DESCRIPTION
Packit Service 1d0348
     Detailed descriptions of each function are provided by the corresponding
Packit Service 1d0348
     manual pages.
Packit Service 1d0348
Packit Service 1d0348
     All of the functions utilize an opaque struct archive datatype that pro‐
Packit Service 1d0348
     vides access to the archive contents.
Packit Service 1d0348
Packit Service 1d0348
     The struct archive_entry structure contains a complete description of a
Packit Service 1d0348
     single archive entry.  It uses an opaque interface that is fully docu‐
Packit Service 1d0348
     mented in archive_entry(3).
Packit Service 1d0348
Packit Service 1d0348
     Users familiar with historic formats should be aware that the newer vari‐
Packit Service 1d0348
     ants have eliminated most restrictions on the length of textual fields.
Packit Service 1d0348
     Clients should not assume that filenames, link names, user names, or
Packit Service 1d0348
     group names are limited in length.  In particular, pax interchange format
Packit Service 1d0348
     can easily accommodate pathnames in arbitrary character sets that exceed
Packit Service 1d0348
     PATH_MAX.
Packit Service 1d0348
Packit Service 1d0348
RETURN VALUES
Packit Service 1d0348
     Most functions return ARCHIVE_OK (zero) on success, non-zero on error.
Packit Service 1d0348
     The return value indicates the general severity of the error, ranging
Packit Service 1d0348
     from ARCHIVE_WARN, which indicates a minor problem that should probably
Packit Service 1d0348
     be reported to the user, to ARCHIVE_FATAL, which indicates a serious
Packit Service 1d0348
     problem that will prevent any further operations on this archive.	On
Packit Service 1d0348
     error, the archive_errno() function can be used to retrieve a numeric
Packit Service 1d0348
     error code (see errno(2)).  The archive_error_string() returns a textual
Packit Service 1d0348
     error message suitable for display.
Packit Service 1d0348
Packit Service 1d0348
     archive_read_new() and archive_write_new() return pointers to an allo‐
Packit Service 1d0348
     cated and initialized struct archive object.
Packit Service 1d0348
Packit Service 1d0348
     archive_read_data() and archive_write_data() return a count of the number
Packit Service 1d0348
     of bytes actually read or written.  A value of zero indicates the end of
Packit Service 1d0348
     the data for this entry.  A negative value indicates an error, in which
Packit Service 1d0348
     case the archive_errno() and archive_error_string() functions can be used
Packit Service 1d0348
     to obtain more information.
Packit Service 1d0348
Packit Service 1d0348
ENVIRONMENT
Packit Service 1d0348
     There are character set conversions within the archive_entry(3) functions
Packit Service 1d0348
     that are impacted by the currently-selected locale.
Packit Service 1d0348
Packit Service 1d0348
SEE ALSO
Packit Service 1d0348
     tar(1), archive_entry(3), archive_read(3), archive_util(3),
Packit Service 1d0348
     archive_write(3), tar(5)
Packit Service 1d0348
Packit Service 1d0348
HISTORY
Packit Service 1d0348
     The libarchive library first appeared in FreeBSD 5.3.
Packit Service 1d0348
Packit Service 1d0348
AUTHORS
Packit Service 1d0348
     The libarchive library was originally written by Tim Kientzle
Packit Service 1d0348
     <kientzle@acm.org>.
Packit Service 1d0348
Packit Service 1d0348
BUGS
Packit Service 1d0348
     Some archive formats support information that is not supported by struct
Packit Service 1d0348
     archive_entry.  Such information cannot be fully archived or restored
Packit Service 1d0348
     using this library.  This includes, for example, comments, character
Packit Service 1d0348
     sets, or the arbitrary key/value pairs that can appear in pax interchange
Packit Service 1d0348
     format archives.
Packit Service 1d0348
Packit Service 1d0348
     Conversely, of course, not all of the information that can be stored in
Packit Service 1d0348
     an struct archive_entry is supported by all formats.  For example, cpio
Packit Service 1d0348
     formats do not support nanosecond timestamps; old tar formats do not sup‐
Packit Service 1d0348
     port large device numbers.
Packit Service 1d0348
Packit Service 1d0348
     The ISO9660 reader cannot yet read all ISO9660 images; it should learn
Packit Service 1d0348
     how to seek.
Packit Service 1d0348
Packit Service 1d0348
     The AR writer requires the client program to use two passes, unlike all
Packit Service 1d0348
     other libarchive writers.
Packit Service 1d0348
Packit Service 1d0348
BSD				March 18, 2012				   BSD