diff --git a/libarchive/libarchive-formats.5 b/libarchive/libarchive-formats.5 index 9aecc1d93..0fdf470b6 100644 --- a/libarchive/libarchive-formats.5 +++ b/libarchive/libarchive-formats.5 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 23, 2011 +.Dd March 18, 2012 .Dt LIBARCHIVE-FORMATS 5 .Os .Sh NAME @@ -51,11 +51,11 @@ functions to enable all supported formats. The .Xr libarchive 3 library can read most tar archives. -However, it only writes POSIX-standard +It can write POSIX-standard .Dq ustar and .Dq pax interchange -formats. +formats and a subset of the legacy GNU tar format. .Pp All tar formats store each entry in one or more 512-byte records. The first record is used for file metadata, including filename, @@ -70,13 +70,18 @@ subsequent entries. .It Cm gnutar The .Xr libarchive 3 -library can read GNU-format tar archives. +library can read most GNU-format tar archives. It currently supports the most popular GNU extensions, including modern long filename and linkname support, as well as atime and ctime data. The libarchive library does not support multi-volume archives, nor the old GNU long filename format. It can read GNU sparse file entries, including the new POSIX-based -formats, but cannot write GNU sparse file entries. +formats. +.Pp +The +.Xr libarchive 3 +library can write GNU tar format, including long filename +and linkname support, as well as atime and ctime data. .It Cm pax The .Xr libarchive 3 @@ -98,6 +103,14 @@ archiver and a few LIBARCHIVE keys. The libarchive library can read most of the SCHILY keys and most of the GNU keys introduced by GNU tar. It silently ignores any keywords that it does not understand. +.Pp +The pax interchange format converts filenames to Unicode +and stores them using the UTF-8 encoding. +Prior to libarchive 3.0, libarchive erroneously assumed +that the system wide-character routines natively supported +Unicode. +This caused it to mis-handle non-ASCII filenames on systems +that did not satisfy this assumption. .It Cm restricted pax The libarchive library can also write pax archives in which it attempts to suppress the extended attributes entry whenever @@ -135,6 +148,8 @@ security information cannot be stored. Archive entries are limited to 8 gigabytes in size. .El Note that the pax interchange format has none of these restrictions. +The ustar format is old and widely supported. +It is recommended when compatibility is the primary concern. .El .Pp The libarchive library also reads a variety of commonly-used extensions to @@ -268,19 +283,68 @@ 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. +.Pp +Libarchive reads ISO9660 images using a streaming strategy. +This allows it to read compressed images directly +(decompressing on the fly) and allows it to read images +directly from network sockets, pipes, and other non-seekable +data sources. +This strategy works well for optimized ISO9660 images created +by many popular programs. +Such programs collect all directory information at the beginning +of the ISO9660 image so it can be read from a physical disk +with a minimum of seeking. +However, not all ISO9660 images can be read in this fashion. +.Pp +Libarchive can also write ISO9660 images. +Such images are fully optimized with the directory information +preceding all file data. +This is done by storing all file data to a temporary file +while collecting directory information in memory. +When the image is finished, libarchive writes out the +directory structure followed by the file data. +The location used for the temporary file can be changed +by the usual environment variables. .Ss Zip format 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 +Other zip compression algorithms are not supported. +It can extract jar archives, archives that use Zip64 extensions and 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 -limits libarchive's ability to support some self-extracting -archives and ones that have been modified in certain ways. +Libarchive can use either of two different strategies for +reading Zip archives: +a streaming strategy which is fast and can handle extremely +large archives, and a seeking strategy which can correctly +process self-extracting Zip archives and archives with +deleted members or other in-place modifications. +.Pp +The streaming reader processes Zip archives as they are read. +It can read archives of arbitrary size from tape or +network sockets, and can decode Zip archives that have +been separately compressed or encoded. +However, self-extracting Zip archives and archives with +certain types of modifications cannot be correctly +handled. +Such archives require that the reader first process the +Central Directory, which is ordinarily located +at the end of a Zip archive and is thus inaccessible +to the streaming reader. +If the program using libarchive has enabled seek support, then +libarchive will use this to processes the central directory first. +.Pp +In particular, the seeking reader must be used to +correctly handle self-extracting archives. +Such archives consist of a program followed by a regular +Zip archive. +The streaming reader cannot parse the initial program +portion, but the seeking reader starts by reading the +Central Directory from the end of the archive. +Similarly, Zip archives that have been modified in-place +can have deleted entries or other garbage data that +can only be accurately detected by first reading the +Central Directory. .Ss Archive (library) file format The Unix archive format (commonly created by the .Xr ar 1 @@ -342,12 +406,18 @@ 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. +.Ss LHA +XXX Information about libarchive's LHA support XXX +.Ss CAB +XXX Information about libarchive's CAB support XXX +.Ss XAR +XXX Information about libarchive's XAR support XXX .Ss RAR -libarchive has limited support to read files in RAR format. Currently, -libarchive can read single RAR files in RARv3 format which have been either -created uncompressed, or compressed using any of the compression methods -supported by the RARv3 format. libarchive can also extract RAR files which have -been created as self-extracting RAR files. +Libarchive has limited support for reading RAR format archives. +Currently, libarchive can read RARv3 format archives +which have been either created uncompressed, or compressed using +any of the compression methods supported by the RARv3 format. +Libarchive can also read self-extracting RAR archives. .Sh SEE ALSO .Xr ar 1 , .Xr cpio 1 , diff --git a/libarchive/libarchive.3 b/libarchive/libarchive.3 index 2e4c444da..3a9a841d3 100644 --- a/libarchive/libarchive.3 +++ b/libarchive/libarchive.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 2, 2012 +.Dd March 18, 2012 .Dt LIBARCHIVE 3 .Os .Sh NAME @@ -64,15 +64,33 @@ most common cpio archive formats, .It ISO9660 CD images (including RockRidge and Joliet extensions), .It -Zip archives. +Zip archives, +.It +ar archives (including GNU/SysV and BSD extensions), +.It +Microsoft CAB archives, +.It +LHA archives, +.It +mtree file tree descriptions, +.It +RAR archives, +.It +XAR archives. .El The library automatically detects archives compressed with .Xr gzip 1 , .Xr bzip2 1 , .Xr xz 1 , +.Xr lzip 1 , or .Xr compress 1 and decompresses them transparently. +It can similarly detect and decode archives processed with +.Xr uuencode 1 +or which have an +.Xr rpm 1 +header. .Pp When writing an archive, you can specify the compression to be used and the format to use. @@ -91,7 +109,17 @@ POSIX octet-oriented cpio archives, .It Zip archive, .It -two different variants of shar archives. +two different variants of shar archives, +.It +ISO9660 CD images, +.It +7-Zip archives, +.It +ar archives, +.It +mtree file tree descriptions, +.It +XAR archives. .El Pax interchange format is an extension of the tar archive format that eliminates essentially all of the limitations of historic tar formats @@ -143,9 +171,21 @@ operations. .Sh READING ENTRIES FROM DISK The .Xr archive_read_disk 3 -provides some support for populating +supports for populating .Xr archive_entry 3 objects from information in the filesystem. +This includes the information accessible from the +.Xr stat 2 +system call as well as ACLs, extended attributes, +and other metadata. +The +.Xr archive_read_disk 3 +API also supports iterating over directory trees, +which allows directories of files to be read using +an API compatible with +the +.Xr archive_read 3 +API. .Sh DESCRIPTION Detailed descriptions of each function are provided by the corresponding manual pages. @@ -225,7 +265,7 @@ library first appeared in .An -nosplit The .Nm libarchive -library was written by +library was originally written by .An Tim Kientzle Aq kientzle@acm.org . .Sh BUGS Some archive formats support information that is not supported by @@ -242,13 +282,8 @@ is supported by all formats. For example, cpio formats do not support nanosecond timestamps; old tar formats do not support large device numbers. .Pp -The -.Xr archive_read_disk 3 -API should support iterating over filesystems; -that would make it possible to share code among -disk-to-archive, archive-to-archive, archive-to-disk, -and disk-to-disk operations. -Currently, it only supports reading the -information for a single file. -(Which is still quite useful, as it hides a lot -of system-specific details.) +The ISO9660 reader cannot yet read all ISO9660 images; +it should learn how to seek. +.Pp +The AR writer requires the client program to use +two passes, unlike all other libarchive writers.