.\"
.\" $FreeBSD: src/lib/libarchive/libarchive-formats.5,v 1.16 2008/05/26 17:00:23 kientzle Exp $
.\"
-.Dd April 17, 2009
+.Dd July 17, 2009
.Dt libarchive-formats 5
.Os
.Sh NAME
Note that just because a format is supported by libarchive does not
imply that a program that uses libarchive will support that format.
Applications that use libarchive specify which formats they wish
-to support.
+to support, though many programs do use libarchive convenience
+functions to enable all supported formats.
.Ss Tar Formats
The
.Xr libarchive 3
archives.
Pax interchange format archives are an extension of the older ustar
format that adds a separate entry with additional attributes stored
-as key/value pairs.
-The presence of this additional entry is the only difference between
+as key/value pairs immediately before each regular entry.
+The presence of these additional entries is the only difference between
pax interchange format and the older ustar format.
The extended attributes are of unlimited length and are stored
as UTF-8 Unicode strings.
.El
Note that the pax interchange format has none of these restrictions.
.El
+.It Solaris extensions
+Libarchive recognizes ACL and extended attribute records written
+by Solaris tar.
+Currently, libarchive only has support for old-style ACLs; the
+newer NFSv4 ACLs are recognized but discarded.
.Pp
The libarchive library can also read a variety of commonly-used extensions to
the basic tar format.
by a variable-length filename and variable-length data.
Unlike the tar format, the cpio format does only minimal padding
of the header or file data.
-There are a variety of cpio formats, which differ primarily in
+There are several cpio variants, which differ primarily in
how they store the initial header: some store the values as
octal or hexadecimal numbers in ASCII, others as binary values of
varying byte order and length.
.Bl -tag -width indent
.It Cm binary
-The libarchive library can read both big-endian and little-endian
+The libarchive library transparently reads both big-endian and little-endian
variants of the original binary cpio format.
This format used 32-bit binary values for file size and mtime,
and 16-bit binary values for the other fields.
.Ss ISO9660 format
Libarchive can read and extract from files containing ISO9660-compliant
CDROM images.
-It also has partial support for Rockridge extensions.
In many cases, this can remove the need to burn a physical CDROM
just in order to read the files contained in an ISO9660 image.
It also avoids security and complexity issues that come with
virtual mounts and loopback devices.
+Libarchive supports the most common Rockridge extensions and has partial
+support for Joliet extensions.
+If both extensions are present, the Joliet extensions will be
+used and the Rockridge extensions will be ignored.
+In particular, this can create problems with hardlinks and symlinks,
+which are supported by Rockridge but not by Joliet.
.Ss Zip format
-Libarchive can extract from most zip format archives, including
-jar archives, archives that use Zip64 extensions and many
-self-extracting zip archives.
-It currently only supports uncompressed entries and entries
-compressed with the
+Libarchive can read and write zip format archives that have
+uncompressed entries and entries compressed with the
.Dq deflate
algorithm.
Older zip compression algorithms are not supported.
+It can extract jar archives, archives that use Zip64 extensions and many
+self-extracting zip archives.
Libarchive reads Zip archives as they are being streamed,
which allows it to read archives of arbitrary size.
It currently does not use the central directory; this
There are two common variants:
the GNU format derived from SVR4,
and the BSD format, which first appeared in 4.4BSD.
-Libarchive provides read and write support for both variants.
+The two differ primarily in their handling of filenames
+longer than 15 characters:
+the GNU/SVR4 variant writes a filename table at the beginning of the archive;
+the BSD format stores each long filename in an extension
+area adjacent to the entry.
+Libarchive can read both extensions,
+including archives that may include both types of long filenames.
+Programs using libarchive can write GNU/SVR4 format
+if they provide a filename table to be written into
+the archive before any of the entries.
+Any entries whose names are not in the filename table
+will be written using BSD-style long filenames.
+This can cause problems for programs such as
+GNU ld that do not support the BSD-style long filenames.
.Ss mtree
Libarchive can read and write files in
.Xr mtree 5
although many of the keywords cannot currently be stored in an
.Tn archive_entry
object.
-When reading, libarchive supports an extension that allows it
-to obtain the contents of the files described by the
-.Xr mtree 5
-description from files on disk.
When writing, libarchive supports use of the
.Xr archive_write_set_options 3
interface to specify which keywords should be included in the
output.
-This includes the ability to compute hash entries such
-as
+If libarchive was compiled with access to suitable
+cryptographic libraries (such as the OpenSSL libraries),
+it can compute hash entries such as
.Cm sha512
or
.Cm md5
from file data being written to the mtree writer.
+.Pp
+When reading an mtree file, libarchive will locate the corresponding
+files on disk using the
+.Cm contents
+keyword if present or the regular filename.
+If it can locate and open the file on disk, it will use that
+to fill in any metadata that is missing from the mtree file
+and will read the file contents and return those to the program
+using libarchive.
+If it cannot locate and open the file on disk, libarchive
+will return an error for any attempt to read the entry
+body.
.Sh SEE ALSO
.Xr ar 1 ,
.Xr cpio 1 ,