1 LIBARCHIVE-FORMATS(5) manual page
3 '''libarchive-formats'''
4 - archive formats supported by the libarchive library
8 library reads and writes a variety of streaming archive formats.
9 Generally speaking, all of these archive formats consist of a series of
11 Each entry stores a single file system object, such as a file, directory,
14 The following provides a brief description of each format supported
15 by libarchive, with some information about recognized extensions or
16 limitations of the current library support.
17 Note that just because a format is supported by libarchive does not
18 imply that a program that uses libarchive will support that format.
19 Applications that use libarchive specify which formats they wish
20 to support, though many programs do use libarchive convenience
21 functions to enable all supported formats.
24 [[ManPageLibarchive3]]
25 library can read most tar archives.
26 It can write POSIX-standard
30 formats as well as v7 tar format and a subset of the legacy GNU tar format.
32 All tar formats store each entry in one or more 512-byte records.
33 The first record is used for file metadata, including filename,
34 timestamp, and mode information, and the file data is stored in
36 Later variants have extended this by either appropriating undefined
37 areas of the header record, extending the header to multiple records,
38 or by storing special entries that modify the interpretation of
41 <dt>'''gnutar'''</dt><dd>
43 [[ManPageLibarchive3]]
44 library can read most GNU-format tar archives.
45 It currently supports the most popular GNU extensions, including
46 modern long filename and linkname support, as well as atime and ctime data.
47 The libarchive library does not support multi-volume
48 archives, nor the old GNU long filename format.
49 It can read GNU sparse file entries, including the new POSIX-based
53 [[ManPageLibarchive3]]
54 library can write GNU tar format, including long filename
55 and linkname support, as well as atime and ctime data.
56 </dd><dt>'''pax'''</dt><dd>
58 [[ManPageLibarchive3]]
59 library can read and write POSIX-compliant pax interchange format
61 Pax interchange format archives are an extension of the older ustar
62 format that adds a separate entry with additional attributes stored
63 as key/value pairs immediately before each regular entry.
64 The presence of these additional entries is the only difference between
65 pax interchange format and the older ustar format.
66 The extended attributes are of unlimited length and are stored
67 as UTF-8 Unicode strings.
68 Keywords defined in the standard are in all lowercase; vendors are allowed
69 to define custom keys by preceding them with the vendor name in all uppercase.
70 When writing pax archives, libarchive uses many of the SCHILY keys
71 defined by Joerg Schilling's
73 archiver and a few LIBARCHIVE keys.
74 The libarchive library can read most of the SCHILY keys
75 and most of the GNU keys introduced by GNU tar.
76 It silently ignores any keywords that it does not understand.
78 The pax interchange format converts filenames to Unicode
79 and stores them using the UTF-8 encoding.
80 Prior to libarchive 3.0, libarchive erroneously assumed
81 that the system wide-character routines natively supported
83 This caused it to mis-handle non-ASCII filenames on systems
84 that did not satisfy this assumption.
85 </dd><dt>'''restricted''' pax</dt><dd>
86 The libarchive library can also write pax archives in which it
87 attempts to suppress the extended attributes entry whenever
89 The result will be identical to a ustar archive unless the
90 extended attributes entry is required to store a long file
91 name, long linkname, extended ACL, file flags, or if any of the standard
92 ustar data (user name, group name, UID, GID, etc) cannot be fully
93 represented in the ustar header.
94 In all cases, the result can be dearchived by any program that
95 can read POSIX-compliant pax interchange format archives.
96 Programs that correctly read ustar format (see below) will also be
97 able to read this format; any extended attributes will be extracted as
98 separate files stored in
101 </dd><dt>'''ustar'''</dt><dd>
102 The libarchive library can both read and write this format.
103 This format has the following limitations:
106 Device major and minor numbers are limited to 21 bits.
107 Nodes with larger numbers will not be added to the archive.
109 Path names in the archive are limited to 255 bytes.
110 (Shorter if there is no / character in exactly the right place.)
112 Symbolic links and hard links are stored in the archive with
113 the name of the referenced file.
114 This name is limited to 100 bytes.
116 Extended attributes, file flags, and other extended
117 security information cannot be stored.
119 Archive entries are limited to 8 gigabytes in size.
121 Note that the pax interchange format has none of these restrictions.
122 The ustar format is old and widely supported.
123 It is recommended when compatibility is the primary concern.
124 </dd><dt>'''v7'''</dt><dd>
125 The libarchive library can read and write the legacy v7 tar format.
126 This format has the following limitations:
129 Only regular files, directories, and symbolic links can be archived.
130 Block and character device nodes, FIFOs, and sockets cannot be archived.
132 Path names in the archive are limited to 100 bytes.
134 Symbolic links and hard links are stored in the archive with
135 the name of the referenced file.
136 This name is limited to 100 bytes.
138 User and group information are stored as numeric IDs; there
139 is no provision for storing user or group names.
141 Extended attributes, file flags, and other extended
142 security information cannot be stored.
144 Archive entries are limited to 8 gigabytes in size.
146 Generally, users should prefer the ustar format for portability
147 as the v7 tar format is both less useful and less portable.
150 The libarchive library also reads a variety of commonly-used extensions to
151 the basic tar format.
152 These extensions are recognized automatically whenever they appear.
154 <dt>Numeric extensions.</dt><dd>
155 The POSIX standards require fixed-length numeric fields to be written with
156 some character position reserved for terminators.
157 Libarchive allows these fields to be written without terminator characters.
158 This extends the allowable range; in particular, ustar archives with this
159 extension can support entries up to 64 gigabytes in size.
160 Libarchive also recognizes base-256 values in most numeric fields.
161 This essentially removes all limitations on file size, modification time,
163 </dd><dt>Solaris extensions</dt><dd>
164 Libarchive recognizes ACL and extended attribute records written
168 The first tar program appeared in Seventh Edition Unix in 1979.
169 The first official standard for the tar file format was the
171 (Unix Standard Tar) format defined by POSIX in 1988.
172 POSIX.1-2001 extended the ustar format to create the
176 The libarchive library can read a number of common cpio variants and can write
181 A cpio archive stores each entry as a fixed-size header followed
182 by a variable-length filename and variable-length data.
183 Unlike the tar format, the cpio format does only minimal padding
184 of the header or file data.
185 There are several cpio variants, which differ primarily in
186 how they store the initial header: some store the values as
187 octal or hexadecimal numbers in ASCII, others as binary values of
188 varying byte order and length.
190 <dt>'''binary'''</dt><dd>
191 The libarchive library transparently reads both big-endian and little-endian
192 variants of the original binary cpio format.
193 This format used 32-bit binary values for file size and mtime,
194 and 16-bit binary values for the other fields.
195 </dd><dt>'''odc'''</dt><dd>
196 The libarchive library can both read and write this
197 POSIX-standard format, which is officially known as the
198 "cpio interchange format"
200 "octet-oriented cpio archive format"
201 and sometimes unofficially referred to as the
202 "old character format".
203 This format stores the header contents as octal values in ASCII.
204 It is standard, portable, and immune from byte-order confusion.
205 File sizes and mtime are limited to 33 bits (8GB file size),
206 other fields are limited to 18 bits.
207 </dd><dt>'''SVR4/newc'''</dt><dd>
208 The libarchive library can read both CRC and non-CRC variants of
210 The SVR4 format uses eight-digit hexadecimal values for
212 This limits file size to 4GB, and also limits the mtime and
213 other fields to 32 bits.
214 The SVR4 format can optionally include a CRC of the file
215 contents, although libarchive does not currently verify this CRC.
218 Cpio first appeared in PWB/UNIX 1.0, which was released within
220 PWB/UNIX 1.0 formed the basis of System III Unix, released outside
222 This makes cpio older than tar, although cpio was not included
223 in Version 7 AT&T Unix.
224 As a result, the tar command became much better known in universities
225 and research groups that used Version 7.
226 The combination of the
230 utilities provided very precise control over file selection.
231 Unfortunately, the format has many limitations that make it unsuitable
233 Only the POSIX format permits files over 4GB, and its 18-bit
234 limit for most other fields makes it unsuitable for modern systems.
235 In addition, cpio formats only store numeric UID/GID values (not
236 usernames and group names), which can make it very difficult to correctly
237 transfer archives across systems with dissimilar user numbering.
241 is a shell script that, when executed on a POSIX-compliant
242 system, will recreate a collection of file system objects.
243 The libarchive library can write two different kinds of shar archives:
245 <dt>'''shar'''</dt><dd>
246 The traditional shar format uses a limited set of POSIX
248 [[echo(1)|http://www.freebsd.org/cgi/man.cgi?query=echo&sektion=1]],
249 [[mkdir(1)|http://www.freebsd.org/cgi/man.cgi?query=mkdir&sektion=1]],
251 [[sed(1)|http://www.freebsd.org/cgi/man.cgi?query=sed&sektion=1]].
252 It is suitable for portably archiving small collections of plain text files.
253 However, it is not generally well-suited for large archives
254 (many implementations of
255 [[sh(1)|http://www.freebsd.org/cgi/man.cgi?query=sh&sektion=1]]
256 have limits on the size of a script) nor should it be used with non-text files.
257 </dd><dt>'''shardump'''</dt><dd>
258 This format is similar to shar but encodes files using
259 [[uuencode(1)|http://www.freebsd.org/cgi/man.cgi?query=uuencode&sektion=1]]
260 so that the result will be a plain text file regardless of the file contents.
261 It also includes additional shell commands that attempt to reproduce as
262 many file attributes as possible, including owner, mode, and flags.
263 The additional commands used to restore file attributes make
264 shardump archives less portable than plain shar archives.
266 === ISO9660 format===
267 Libarchive can read and extract from files containing ISO9660-compliant
269 In many cases, this can remove the need to burn a physical CDROM
270 just in order to read the files contained in an ISO9660 image.
271 It also avoids security and complexity issues that come with
272 virtual mounts and loopback devices.
273 Libarchive supports the most common Rockridge extensions and has partial
274 support for Joliet extensions.
275 If both extensions are present, the Joliet extensions will be
276 used and the Rockridge extensions will be ignored.
277 In particular, this can create problems with hardlinks and symlinks,
278 which are supported by Rockridge but not by Joliet.
280 Libarchive reads ISO9660 images using a streaming strategy.
281 This allows it to read compressed images directly
282 (decompressing on the fly) and allows it to read images
283 directly from network sockets, pipes, and other non-seekable
285 This strategy works well for optimized ISO9660 images created
286 by many popular programs.
287 Such programs collect all directory information at the beginning
288 of the ISO9660 image so it can be read from a physical disk
289 with a minimum of seeking.
290 However, not all ISO9660 images can be read in this fashion.
292 Libarchive can also write ISO9660 images.
293 Such images are fully optimized with the directory information
294 preceding all file data.
295 This is done by storing all file data to a temporary file
296 while collecting directory information in memory.
297 When the image is finished, libarchive writes out the
298 directory structure followed by the file data.
299 The location used for the temporary file can be changed
300 by the usual environment variables.
302 Libarchive can read and write zip format archives that have
303 uncompressed entries and entries compressed with the
306 Other zip compression algorithms are not supported.
307 It can extract jar archives, archives that use Zip64 extensions and
308 self-extracting zip archives.
309 Libarchive can use either of two different strategies for
310 reading Zip archives:
311 a streaming strategy which is fast and can handle extremely
312 large archives, and a seeking strategy which can correctly
313 process self-extracting Zip archives and archives with
314 deleted members or other in-place modifications.
316 The streaming reader processes Zip archives as they are read.
317 It can read archives of arbitrary size from tape or
318 network sockets, and can decode Zip archives that have
319 been separately compressed or encoded.
320 However, self-extracting Zip archives and archives with
321 certain types of modifications cannot be correctly
323 Such archives require that the reader first process the
324 Central Directory, which is ordinarily located
325 at the end of a Zip archive and is thus inaccessible
326 to the streaming reader.
327 If the program using libarchive has enabled seek support, then
328 libarchive will use this to processes the central directory first.
330 In particular, the seeking reader must be used to
331 correctly handle self-extracting archives.
332 Such archives consist of a program followed by a regular
334 The streaming reader cannot parse the initial program
335 portion, but the seeking reader starts by reading the
336 Central Directory from the end of the archive.
337 Similarly, Zip archives that have been modified in-place
338 can have deleted entries or other garbage data that
339 can only be accurately detected by first reading the
341 === Archive (library) file format===
342 The Unix archive format (commonly created by the
343 [[ar(1)|http://www.freebsd.org/cgi/man.cgi?query=ar&sektion=1]]
344 archiver) is a general-purpose format which is
345 used almost exclusively for object files to be
346 read by the link editor
347 [[ld(1)|http://www.freebsd.org/cgi/man.cgi?query=ld&sektion=1]].
348 The ar format has never been standardised.
349 There are two common variants:
350 the GNU format derived from SVR4,
351 and the BSD format, which first appeared in 4.4BSD.
352 The two differ primarily in their handling of filenames
353 longer than 15 characters:
354 the GNU/SVR4 variant writes a filename table at the beginning of the archive;
355 the BSD format stores each long filename in an extension
356 area adjacent to the entry.
357 Libarchive can read both extensions,
358 including archives that may include both types of long filenames.
359 Programs using libarchive can write GNU/SVR4 format
360 if they provide an entry called
362 containing a filename table to be written into the archive
363 before any of the entries.
364 Any entries whose names are not in the filename table
365 will be written using BSD-style long filenames.
366 This can cause problems for programs such as
367 GNU ld that do not support the BSD-style long filenames.
369 Libarchive can read and write files in
372 This format is not a true archive format, but rather a textual description
373 of a file hierarchy in which each line specifies the name of a file and
374 provides specific metadata about that file.
375 Libarchive can read all of the keywords supported by both
376 the NetBSD and FreeBSD versions of
377 [[mtree(8)|http://www.freebsd.org/cgi/man.cgi?query=mtree&sektion=8]],
378 although many of the keywords cannot currently be stored in an
381 When writing, libarchive supports use of the
382 [[ManPageArchiveWriteSetOptions3]]
383 interface to specify which keywords should be included in the
385 If libarchive was compiled with access to suitable
386 cryptographic libraries (such as the OpenSSL libraries),
387 it can compute hash entries such as
391 from file data being written to the mtree writer.
393 When reading an mtree file, libarchive will locate the corresponding
394 files on disk using the
396 keyword if present or the regular filename.
397 If it can locate and open the file on disk, it will use that
398 to fill in any metadata that is missing from the mtree file
399 and will read the file contents and return those to the program
401 If it cannot locate and open the file on disk, libarchive
402 will return an error for any attempt to read the entry
405 Libarchive can read and write 7-Zip format archives.
406 TODO: Need more information
408 Libarchive can read Microsoft Cabinet (
411 TODO: Need more information.
413 TODO: Information about libarchive's LHA support
415 Libarchive has limited support for reading RAR format archives.
416 Currently, libarchive can read RARv3 format archives
417 which have been either created uncompressed, or compressed using
418 any of the compression methods supported by the RARv3 format.
419 Libarchive can also read self-extracting RAR archives.
421 Libarchive can read and write
423 TODO: Need more information
425 Libarchive can read and write the XAR format used by many Apple tools.
426 TODO: Need more information
428 [[ar(1)|http://www.freebsd.org/cgi/man.cgi?query=ar&sektion=1]],
430 [[mkisofs(1)|http://www.freebsd.org/cgi/man.cgi?query=mkisofs&sektion=1]],
431 [[shar(1)|http://www.freebsd.org/cgi/man.cgi?query=shar&sektion=1]],
433 [[zip(1)|http://www.freebsd.org/cgi/man.cgi?query=zip&sektion=1]],
434 [[zlib(3)|http://www.freebsd.org/cgi/man.cgi?query=zlib&sektion=3]],