Blame README.md

Packit Service 1d0348
# Welcome to libarchive!
Packit Service 1d0348
Packit Service 1d0348
The libarchive project develops a portable, efficient C library that
Packit Service 1d0348
can read and write streaming archives in a variety of formats.  It
Packit Service 1d0348
also includes implementations of the common `tar`, `cpio`, and `zcat`
Packit Service 1d0348
command-line tools that use the libarchive library.
Packit Service 1d0348
Packit Service 1d0348
## Questions?  Issues?
Packit Service 1d0348
Packit Service 1d0348
* http://www.libarchive.org is the home for ongoing
Packit Service 1d0348
  libarchive development, including documentation,
Packit Service 1d0348
  and links to the libarchive mailing lists.
Packit Service 1d0348
* To report an issue, use the issue tracker at
Packit Service 1d0348
  https://github.com/libarchive/libarchive/issues
Packit Service 1d0348
* To submit an enhancement to libarchive, please
Packit Service 1d0348
  submit a pull request via GitHub: https://github.com/libarchive/libarchive/pulls
Packit Service 1d0348
Packit Service 1d0348
## Contents of the Distribution
Packit Service 1d0348
Packit Service 1d0348
This distribution bundle includes the following major components:
Packit Service 1d0348
Packit Service 1d0348
* **libarchive**: a library for reading and writing streaming archives
Packit Service 1d0348
* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built on libarchive
Packit Service 1d0348
* **cpio**: the 'bsdcpio' program is a different interface to essentially the same functionality
Packit Service 1d0348
* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, xzcat, and such
Packit Service 1d0348
* **examples**: Some small example programs that you may find useful.
Packit Service 1d0348
* **examples/minitar**: a compact sample demonstrating use of libarchive.
Packit Service 1d0348
* **contrib**:  Various items sent to me by third parties; please contact the authors with any questions.
Packit Service 1d0348
Packit Service 1d0348
The top-level directory contains the following information files:
Packit Service 1d0348
Packit Service 1d0348
* **NEWS** - highlights of recent changes
Packit Service 1d0348
* **COPYING** - what you can do with this
Packit Service 1d0348
* **INSTALL** - installation instructions
Packit Service 1d0348
* **README** - this file
Packit Service 1d0348
* **CMakeLists.txt** - input for "cmake" build tool, see INSTALL
Packit Service 1d0348
* **configure** - configuration script, see INSTALL for details.  If your copy of the source lacks a `configure` script, you can try to construct it by running the script in `build/autogen.sh` (or use `cmake`).
Packit Service 1d0348
Packit Service 1d0348
The following files in the top-level directory are used by the 'configure' script:
Packit Service 1d0348
* `Makefile.am`, `aclocal.m4`, `configure.ac` - used to build this distribution, only needed by maintainers
Packit Service 1d0348
* `Makefile.in`, `config.h.in` - templates used by configure script
Packit Service 1d0348
Packit Service 1d0348
## Documentation
Packit Service 1d0348
Packit Service 1d0348
In addition to the informational articles and documentation
Packit Service 1d0348
in the online [libarchive Wiki](https://github.com/libarchive/libarchive/wiki),
Packit Service 1d0348
the distribution also includes a number of manual pages:
Packit Service 1d0348
Packit Service 1d0348
 * bsdtar.1 explains the use of the bsdtar program
Packit Service 1d0348
 * bsdcpio.1 explains the use of the bsdcpio program
Packit Service 1d0348
 * bsdcat.1 explains the use of the bsdcat program
Packit Service 1d0348
 * libarchive.3 gives an overview of the library as a whole
Packit Service 1d0348
 * archive_read.3, archive_write.3, archive_write_disk.3, and
Packit Service 1d0348
   archive_read_disk.3 provide detailed calling sequences for the read
Packit Service 1d0348
   and write APIs
Packit Service 1d0348
 * archive_entry.3 details the "struct archive_entry" utility class
Packit Service 1d0348
 * archive_internals.3 provides some insight into libarchive's
Packit Service 1d0348
   internal structure and operation.
Packit Service 1d0348
 * libarchive-formats.5 documents the file formats supported by the library
Packit Service 1d0348
 * cpio.5, mtree.5, and tar.5 provide detailed information about these
Packit Service 1d0348
   popular archive formats, including hard-to-find details about
Packit Service 1d0348
   modern cpio and tar variants.
Packit Service 1d0348
Packit Service 1d0348
The manual pages above are provided in the 'doc' directory in
Packit Service 1d0348
a number of different formats.
Packit Service 1d0348
Packit Service 1d0348
You should also read the copious comments in `archive.h` and the
Packit Service 1d0348
source code for the sample programs for more details.  Please let us
Packit Service 1d0348
know about any errors or omissions you find.
Packit Service 1d0348
Packit Service 1d0348
## Supported Formats
Packit Service 1d0348
Packit Service 1d0348
Currently, the library automatically detects and reads the following fomats:
Packit Service 1d0348
  * Old V7 tar archives
Packit Service 1d0348
  * POSIX ustar
Packit Service 1d0348
  * GNU tar format (including GNU long filenames, long link names, and sparse files)
Packit Service 1d0348
  * Solaris 9 extended tar format (including ACLs)
Packit Service 1d0348
  * POSIX pax interchange format
Packit Service 1d0348
  * POSIX octet-oriented cpio
Packit Service 1d0348
  * SVR4 ASCII cpio
Packit Service 1d0348
  * POSIX octet-oriented cpio
Packit Service 1d0348
  * Binary cpio (big-endian or little-endian)
Packit Service 1d0348
  * ISO9660 CD-ROM images (with optional Rockridge or Joliet extensions)
Packit Service 1d0348
  * ZIP archives (with uncompressed or "deflate" compressed entries, including support for encrypted Zip archives)
Packit Service 1d0348
  * GNU and BSD 'ar' archives
Packit Service 1d0348
  * 'mtree' format
Packit Service 1d0348
  * 7-Zip archives
Packit Service 1d0348
  * Microsoft CAB format
Packit Service 1d0348
  * LHA and LZH archives
Packit Service 1d0348
  * RAR archives (with some limitations due to RAR's proprietary status)
Packit Service 1d0348
  * XAR archives
Packit Service 1d0348
Packit Service 1d0348
The library also detects and handles any of the following before evaluating the archive:
Packit Service 1d0348
  * uuencoded files
Packit Service 1d0348
  * files with RPM wrapper
Packit Service 1d0348
  * gzip compression
Packit Service 1d0348
  * bzip2 compression
Packit Service 1d0348
  * compress/LZW compression
Packit Service 1d0348
  * lzma, lzip, and xz compression
Packit Service 1d0348
  * lz4 compression
Packit Service 1d0348
  * lzop compression
Packit Service 1d0348
  * zstandard compression
Packit Service 1d0348
Packit Service 1d0348
The library can create archives in any of the following formats:
Packit Service 1d0348
  * POSIX ustar
Packit Service 1d0348
  * POSIX pax interchange format
Packit Service 1d0348
  * "restricted" pax format, which will create ustar archives except for
Packit Service 1d0348
    entries that require pax extensions (for long filenames, ACLs, etc).
Packit Service 1d0348
  * Old GNU tar format
Packit Service 1d0348
  * Old V7 tar format
Packit Service 1d0348
  * POSIX octet-oriented cpio
Packit Service 1d0348
  * SVR4 "newc" cpio
Packit Service 1d0348
  * shar archives
Packit Service 1d0348
  * ZIP archives (with uncompressed or "deflate" compressed entries)
Packit Service 1d0348
  * GNU and BSD 'ar' archives
Packit Service 1d0348
  * 'mtree' format
Packit Service 1d0348
  * ISO9660 format
Packit Service 1d0348
  * 7-Zip archives
Packit Service 1d0348
  * XAR archives
Packit Service 1d0348
Packit Service 1d0348
When creating archives, the result can be filtered with any of the following:
Packit Service 1d0348
  * uuencode
Packit Service 1d0348
  * gzip compression
Packit Service 1d0348
  * bzip2 compression
Packit Service 1d0348
  * compress/LZW compression
Packit Service 1d0348
  * lzma, lzip, and xz compression
Packit Service 1d0348
  * lz4 compression
Packit Service 1d0348
  * lzop compression
Packit Service 1d0348
  * zstandard compression
Packit Service 1d0348
Packit Service 1d0348
## Notes about the Library Design
Packit Service 1d0348
Packit Service 1d0348
The following notes address many of the most common
Packit Service 1d0348
questions we are asked about libarchive:
Packit Service 1d0348
Packit Service 1d0348
* This is a heavily stream-oriented system.  That means that
Packit Service 1d0348
  it is optimized to read or write the archive in a single
Packit Service 1d0348
  pass from beginning to end.  For example, this allows
Packit Service 1d0348
  libarchive to process archives too large to store on disk
Packit Service 1d0348
  by processing them on-the-fly as they are read from or
Packit Service 1d0348
  written to a network or tape drive.  This also makes
Packit Service 1d0348
  libarchive useful for tools that need to produce
Packit Service 1d0348
  archives on-the-fly (such as webservers that provide
Packit Service 1d0348
  archived contents of a users account).
Packit Service 1d0348
Packit Service 1d0348
* In-place modification and random access to the contents
Packit Service 1d0348
  of an archive are not directly supported.  For some formats,
Packit Service 1d0348
  this is not an issue: For example, tar.gz archives are not
Packit Service 1d0348
  designed for random access.  In some other cases, libarchive
Packit Service 1d0348
  can re-open an archive and scan it from the beginning quickly
Packit Service 1d0348
  enough to provide the needed abilities even without true
Packit Service 1d0348
  random access.  Of course, some applications do require true
Packit Service 1d0348
  random access; those applications should consider alternatives
Packit Service 1d0348
  to libarchive.
Packit Service 1d0348
Packit Service 1d0348
* The library is designed to be extended with new compression and
Packit Service 1d0348
  archive formats.  The only requirement is that the format be
Packit Service 1d0348
  readable or writable as a stream and that each archive entry be
Packit Service 1d0348
  independent.  There are articles on the libarchive Wiki explaining
Packit Service 1d0348
  how to extend libarchive.
Packit Service 1d0348
Packit Service 1d0348
* On read, compression and format are always detected automatically.
Packit Service 1d0348
Packit Service 1d0348
* The same API is used for all formats; it should be very
Packit Service 1d0348
  easy for software using libarchive to transparently handle
Packit Service 1d0348
  any of libarchive's archiving formats.
Packit Service 1d0348
Packit Service 1d0348
* Libarchive's automatic support for decompression can be used
Packit Service 1d0348
  without archiving by explicitly selecting the "raw" and "empty"
Packit Service 1d0348
  formats.
Packit Service 1d0348
Packit Service 1d0348
* I've attempted to minimize static link pollution.  If you don't
Packit Service 1d0348
  explicitly invoke a particular feature (such as support for a
Packit Service 1d0348
  particular compression or format), it won't get pulled in to
Packit Service 1d0348
  statically-linked programs.  In particular, if you don't explicitly
Packit Service 1d0348
  enable a particular compression or decompression support, you won't
Packit Service 1d0348
  need to link against the corresponding compression or decompression
Packit Service 1d0348
  libraries.  This also reduces the size of statically-linked
Packit Service 1d0348
  binaries in environments where that matters.
Packit Service 1d0348
Packit Service 1d0348
* The library is generally _thread safe_ depending on the platform:
Packit Service 1d0348
  it does not define any global variables of its own.  However, some
Packit Service 1d0348
  platforms do not provide fully thread-safe versions of key C library
Packit Service 1d0348
  functions.  On those platforms, libarchive will use the non-thread-safe
Packit Service 1d0348
  functions.  Patches to improve this are of great interest to us.
Packit Service 1d0348
Packit Service 1d0348
* In particular, libarchive's modules to read or write a directory
Packit Service 1d0348
  tree do use `chdir()` to optimize the directory traversals.  This
Packit Service 1d0348
  can cause problems for programs that expect to do disk access from
Packit Service 1d0348
  multiple threads.  Of course, those modules are completely
Packit Service 1d0348
  optional and you can use the rest of libarchive without them.
Packit Service 1d0348
Packit Service 1d0348
* The library is _not_ thread aware, however.  It does no locking
Packit Service 1d0348
  or thread management of any kind.  If you create a libarchive
Packit Service 1d0348
  object and need to access it from multiple threads, you will
Packit Service 1d0348
  need to provide your own locking.
Packit Service 1d0348
Packit Service 1d0348
* On read, the library accepts whatever blocks you hand it.
Packit Service 1d0348
  Your read callback is free to pass the library a byte at a time
Packit Service 1d0348
  or mmap the entire archive and give it to the library at once.
Packit Service 1d0348
  On write, the library always produces correctly-blocked output.
Packit Service 1d0348
Packit Service 1d0348
* The object-style approach allows you to have multiple archive streams
Packit Service 1d0348
  open at once.  bsdtar uses this in its "@archive" extension.
Packit Service 1d0348
Packit Service 1d0348
* The archive itself is read/written using callback functions.
Packit Service 1d0348
  You can read an archive directly from an in-memory buffer or
Packit Service 1d0348
  write it to a socket, if you wish.  There are some utility
Packit Service 1d0348
  functions to provide easy-to-use "open file," etc, capabilities.
Packit Service 1d0348
Packit Service 1d0348
* The read/write APIs are designed to allow individual entries
Packit Service 1d0348
  to be read or written to any data source:  You can create
Packit Service 1d0348
  a block of data in memory and add it to a tar archive without
Packit Service 1d0348
  first writing a temporary file.  You can also read an entry from
Packit Service 1d0348
  an archive and write the data directly to a socket.  If you want
Packit Service 1d0348
  to read/write entries to disk, there are convenience functions to
Packit Service 1d0348
  make this especially easy.
Packit Service 1d0348
Packit Service 1d0348
* Note: The "pax interchange format" is a POSIX standard extended tar
Packit Service 1d0348
  format that should be used when the older _ustar_ format is not
Packit Service 1d0348
  appropriate.  It has many advantages over other tar formats
Packit Service 1d0348
  (including the legacy GNU tar format) and is widely supported by
Packit Service 1d0348
  current tar implementations.
Packit Service 1d0348