archive_write.3 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626
  1. .\" Copyright (c) 2003-2007 Tim Kientzle
  2. .\" All rights reserved.
  3. .\"
  4. .\" Redistribution and use in source and binary forms, with or without
  5. .\" modification, are permitted provided that the following conditions
  6. .\" are met:
  7. .\" 1. Redistributions of source code must retain the above copyright
  8. .\" notice, this list of conditions and the following disclaimer.
  9. .\" 2. Redistributions in binary form must reproduce the above copyright
  10. .\" notice, this list of conditions and the following disclaimer in the
  11. .\" documentation and/or other materials provided with the distribution.
  12. .\"
  13. .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  14. .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  15. .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  16. .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
  17. .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  18. .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  19. .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  20. .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  21. .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  22. .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. .\" SUCH DAMAGE.
  24. .\"
  25. .\" $FreeBSD: src/lib/libarchive/archive_write.3,v 1.25 2008/11/01 19:11:21 kientzle Exp $
  26. .\"
  27. .Dd May 11, 2008
  28. .Dt archive_write 3
  29. .Os
  30. .Sh NAME
  31. .Nm archive_write_new ,
  32. .Nm archive_write_set_format_cpio ,
  33. .Nm archive_write_set_format_pax ,
  34. .Nm archive_write_set_format_pax_restricted ,
  35. .Nm archive_write_set_format_shar ,
  36. .Nm archive_write_set_format_shar_binary ,
  37. .Nm archive_write_set_format_ustar ,
  38. .Nm archive_write_get_bytes_per_block ,
  39. .Nm archive_write_set_bytes_per_block ,
  40. .Nm archive_write_set_bytes_in_last_block ,
  41. .Nm archive_write_set_compression_bzip2 ,
  42. .Nm archive_write_set_compression_compress ,
  43. .Nm archive_write_set_compression_gzip ,
  44. .Nm archive_write_set_compression_none ,
  45. .Nm archive_write_set_compression_program ,
  46. .Nm archive_write_set_compressor_options ,
  47. .Nm archive_write_set_format_options ,
  48. .Nm archive_write_set_options ,
  49. .Nm archive_write_open ,
  50. .Nm archive_write_open_fd ,
  51. .Nm archive_write_open_FILE ,
  52. .Nm archive_write_open_filename ,
  53. .Nm archive_write_open_memory ,
  54. .Nm archive_write_header ,
  55. .Nm archive_write_data ,
  56. .Nm archive_write_finish_entry ,
  57. .Nm archive_write_close ,
  58. .Nm archive_write_finish
  59. .Nd functions for creating archives
  60. .Sh SYNOPSIS
  61. .In archive.h
  62. .Ft struct archive *
  63. .Fn archive_write_new "void"
  64. .Ft int
  65. .Fn archive_write_get_bytes_per_block "struct archive *"
  66. .Ft int
  67. .Fn archive_write_set_bytes_per_block "struct archive *" "int bytes_per_block"
  68. .Ft int
  69. .Fn archive_write_set_bytes_in_last_block "struct archive *" "int"
  70. .Ft int
  71. .Fn archive_write_set_compression_bzip2 "struct archive *"
  72. .Ft int
  73. .Fn archive_write_set_compression_compress "struct archive *"
  74. .Ft int
  75. .Fn archive_write_set_compression_gzip "struct archive *"
  76. .Ft int
  77. .Fn archive_write_set_compression_none "struct archive *"
  78. .Ft int
  79. .Fn archive_write_set_compression_program "struct archive *" "const char * cmd"
  80. .Ft int
  81. .Fn archive_write_set_format_cpio "struct archive *"
  82. .Ft int
  83. .Fn archive_write_set_format_pax "struct archive *"
  84. .Ft int
  85. .Fn archive_write_set_format_pax_restricted "struct archive *"
  86. .Ft int
  87. .Fn archive_write_set_format_shar "struct archive *"
  88. .Ft int
  89. .Fn archive_write_set_format_shar_binary "struct archive *"
  90. .Ft int
  91. .Fn archive_write_set_format_ustar "struct archive *"
  92. .Ft int
  93. .Fn archive_write_set_format_options "struct archive *" "const char *"
  94. .Ft int
  95. .Fn archive_write_set_compressor_options "struct archive *" "const char *"
  96. .Ft int
  97. .Fn archive_write_set_options "struct archive *" "const char *"
  98. .Ft int
  99. .Fo archive_write_open
  100. .Fa "struct archive *"
  101. .Fa "void *client_data"
  102. .Fa "archive_open_callback *"
  103. .Fa "archive_write_callback *"
  104. .Fa "archive_close_callback *"
  105. .Fc
  106. .Ft int
  107. .Fn archive_write_open_fd "struct archive *" "int fd"
  108. .Ft int
  109. .Fn archive_write_open_FILE "struct archive *" "FILE *file"
  110. .Ft int
  111. .Fn archive_write_open_filename "struct archive *" "const char *filename"
  112. .Ft int
  113. .Fo archive_write_open_memory
  114. .Fa "struct archive *"
  115. .Fa "void *buffer"
  116. .Fa "size_t bufferSize"
  117. .Fa "size_t *outUsed"
  118. .Fc
  119. .Ft int
  120. .Fn archive_write_header "struct archive *" "struct archive_entry *"
  121. .Ft ssize_t
  122. .Fn archive_write_data "struct archive *" "const void *" "size_t"
  123. .Ft int
  124. .Fn archive_write_finish_entry "struct archive *"
  125. .Ft int
  126. .Fn archive_write_close "struct archive *"
  127. .Ft int
  128. .Fn archive_write_finish "struct archive *"
  129. .Sh DESCRIPTION
  130. These functions provide a complete API for creating streaming
  131. archive files.
  132. The general process is to first create the
  133. .Tn struct archive
  134. object, set any desired options, initialize the archive, append entries, then
  135. close the archive and release all resources.
  136. The following summary describes the functions in approximately
  137. the order they are ordinarily used:
  138. .Bl -tag -width indent
  139. .It Fn archive_write_new
  140. Allocates and initializes a
  141. .Tn struct archive
  142. object suitable for writing a tar archive.
  143. .It Fn archive_write_set_bytes_per_block
  144. Sets the block size used for writing the archive data.
  145. Every call to the write callback function, except possibly the last one, will
  146. use this value for the length.
  147. The third parameter is a boolean that specifies whether or not the final block
  148. written will be padded to the full block size.
  149. If it is zero, the last block will not be padded.
  150. If it is non-zero, padding will be added both before and after compression.
  151. The default is to use a block size of 10240 bytes and to pad the last block.
  152. Note that a block size of zero will suppress internal blocking
  153. and cause writes to be sent directly to the write callback as they occur.
  154. .It Fn archive_write_get_bytes_per_block
  155. Retrieve the block size to be used for writing.
  156. A value of -1 here indicates that the library should use default values.
  157. A value of zero indicates that internal blocking is suppressed.
  158. .It Fn archive_write_set_bytes_in_last_block
  159. Sets the block size used for writing the last block.
  160. If this value is zero, the last block will be padded to the same size
  161. as the other blocks.
  162. Otherwise, the final block will be padded to a multiple of this size.
  163. In particular, setting it to 1 will cause the final block to not be padded.
  164. For compressed output, any padding generated by this option
  165. is applied only after the compression.
  166. The uncompressed data is always unpadded.
  167. The default is to pad the last block to the full block size (note that
  168. .Fn archive_write_open_filename
  169. will set this based on the file type).
  170. Unlike the other
  171. .Dq set
  172. functions, this function can be called after the archive is opened.
  173. .It Fn archive_write_get_bytes_in_last_block
  174. Retrieve the currently-set value for last block size.
  175. A value of -1 here indicates that the library should use default values.
  176. .It Xo
  177. .Fn archive_write_set_format_cpio ,
  178. .Fn archive_write_set_format_pax ,
  179. .Fn archive_write_set_format_pax_restricted ,
  180. .Fn archive_write_set_format_shar ,
  181. .Fn archive_write_set_format_shar_binary ,
  182. .Fn archive_write_set_format_ustar
  183. .Xc
  184. Sets the format that will be used for the archive.
  185. The library can write
  186. POSIX octet-oriented cpio format archives,
  187. POSIX-standard
  188. .Dq pax interchange
  189. format archives,
  190. traditional
  191. .Dq shar
  192. archives,
  193. enhanced
  194. .Dq binary
  195. shar archives that store a variety of file attributes and handle binary files,
  196. and
  197. POSIX-standard
  198. .Dq ustar
  199. archives.
  200. The pax interchange format is a backwards-compatible tar format that
  201. adds key/value attributes to each entry and supports arbitrary
  202. filenames, linknames, uids, sizes, etc.
  203. .Dq Restricted pax interchange format
  204. is the library default; this is the same as pax format, but suppresses
  205. the pax extended header for most normal files.
  206. In most cases, this will result in ordinary ustar archives.
  207. .It Xo
  208. .Fn archive_write_set_compression_bzip2 ,
  209. .Fn archive_write_set_compression_compress ,
  210. .Fn archive_write_set_compression_gzip ,
  211. .Fn archive_write_set_compression_none
  212. .Xc
  213. The resulting archive will be compressed as specified.
  214. Note that the compressed output is always properly blocked.
  215. .It Fn archive_write_set_compression_program
  216. The archive will be fed into the specified compression program.
  217. The output of that program is blocked and written to the client
  218. write callbacks.
  219. .It Xo
  220. .Fn archive_write_set_compressor_options ,
  221. .Fn archive_write_set_format_options ,
  222. .Fn archive_write_set_options
  223. .Xc
  224. Specifies options that will be passed to the currently-enabled
  225. compressor and/or format writer.
  226. The argument is a comma-separated list of individual options.
  227. Individual options have one of the following forms:
  228. .Bl -tag -compact -width indent
  229. .It Ar option=value
  230. The option/value pair will be provided to every module.
  231. Modules that do not accept an option with this name will ignore it.
  232. .It Ar option
  233. The option will be provided to every module with a value of
  234. .Dq 1 .
  235. .It Ar !option
  236. The option will be provided to every module with a NULL value.
  237. .It Ar module:option=value , Ar module:option , Ar module:!option
  238. As above, but the corresponding option and value will be provided
  239. only to modules whose name matches
  240. .Ar module .
  241. .El
  242. The return value will be
  243. .Cm ARCHIVE_OK
  244. if any module accepts the option, or
  245. .Cm ARCHIVE_WARN
  246. if no module accepted the option, or
  247. .Cm ARCHIVE_FATAL
  248. if there was a fatal error while attempting to process the option.
  249. .Pp
  250. The currently supported options are:
  251. .Bl -tag -compact -width indent
  252. .It Compressor gzip
  253. .Bl -tag -compact -width indent
  254. .It Cm compression-level
  255. The value is interpreted as a decimal integer specifying the
  256. gzip compression level.
  257. .El
  258. .It Compressor xz
  259. .Bl -tag -compact -width indent
  260. .It Cm compression-level
  261. The value is interpreted as a decimal integer specifying the
  262. compression level.
  263. .El
  264. .It Format mtree
  265. .Bl -tag -compact -width indent
  266. .It Cm cksum , Cm device , Cm flags , Cm gid , Cm gname , Cm indent , Cm link , Cm md5 , Cm mode , Cm nlink , Cm rmd160 , Cm sha1 , Cm sha256 , Cm sha384 , Cm sha512 , Cm size , Cm time , Cm uid , Cm uname
  267. Enable a particular keyword in the mtree output.
  268. Prefix with an exclamation mark to disable the corresponding keyword.
  269. The default is equivalent to
  270. .Dq device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname .
  271. .It Cm all
  272. Enables all of the above keywords.
  273. .It Cm use-set
  274. Enables generation of
  275. .Cm /set
  276. lines that specify default values for the following files and/or directories.
  277. .It Cm indent
  278. XXX needs explanation XXX
  279. .El
  280. .El
  281. .It Fn archive_write_open
  282. Freeze the settings, open the archive, and prepare for writing entries.
  283. This is the most generic form of this function, which accepts
  284. pointers to three callback functions which will be invoked by
  285. the compression layer to write the constructed archive.
  286. .It Fn archive_write_open_fd
  287. A convenience form of
  288. .Fn archive_write_open
  289. that accepts a file descriptor.
  290. The
  291. .Fn archive_write_open_fd
  292. function is safe for use with tape drives or other
  293. block-oriented devices.
  294. .It Fn archive_write_open_FILE
  295. A convenience form of
  296. .Fn archive_write_open
  297. that accepts a
  298. .Ft "FILE *"
  299. pointer.
  300. Note that
  301. .Fn archive_write_open_FILE
  302. is not safe for writing to tape drives or other devices
  303. that require correct blocking.
  304. .It Fn archive_write_open_file
  305. A deprecated synonym for
  306. .Fn archive_write_open_filename .
  307. .It Fn archive_write_open_filename
  308. A convenience form of
  309. .Fn archive_write_open
  310. that accepts a filename.
  311. A NULL argument indicates that the output should be written to standard output;
  312. an argument of
  313. .Dq -
  314. will open a file with that name.
  315. If you have not invoked
  316. .Fn archive_write_set_bytes_in_last_block ,
  317. then
  318. .Fn archive_write_open_filename
  319. will adjust the last-block padding depending on the file:
  320. it will enable padding when writing to standard output or
  321. to a character or block device node, it will disable padding otherwise.
  322. You can override this by manually invoking
  323. .Fn archive_write_set_bytes_in_last_block
  324. before calling
  325. .Fn archive_write_open .
  326. The
  327. .Fn archive_write_open_filename
  328. function is safe for use with tape drives or other
  329. block-oriented devices.
  330. .It Fn archive_write_open_memory
  331. A convenience form of
  332. .Fn archive_write_open
  333. that accepts a pointer to a block of memory that will receive
  334. the archive.
  335. The final
  336. .Ft "size_t *"
  337. argument points to a variable that will be updated
  338. after each write to reflect how much of the buffer
  339. is currently in use.
  340. You should be careful to ensure that this variable
  341. remains allocated until after the archive is
  342. closed.
  343. .It Fn archive_write_header
  344. Build and write a header using the data in the provided
  345. .Tn struct archive_entry
  346. structure.
  347. See
  348. .Xr archive_entry 3
  349. for information on creating and populating
  350. .Tn struct archive_entry
  351. objects.
  352. .It Fn archive_write_data
  353. Write data corresponding to the header just written.
  354. Returns number of bytes written or -1 on error.
  355. .It Fn archive_write_finish_entry
  356. Close out the entry just written.
  357. In particular, this writes out the final padding required by some formats.
  358. Ordinarily, clients never need to call this, as it
  359. is called automatically by
  360. .Fn archive_write_next_header
  361. and
  362. .Fn archive_write_close
  363. as needed.
  364. .It Fn archive_write_close
  365. Complete the archive and invoke the close callback.
  366. .It Fn archive_write_finish
  367. Invokes
  368. .Fn archive_write_close
  369. if it was not invoked manually, then releases all resources.
  370. Note that this function was declared to return
  371. .Ft void
  372. in libarchive 1.x, which made it impossible to detect errors when
  373. .Fn archive_write_close
  374. was invoked implicitly from this function.
  375. This is corrected beginning with libarchive 2.0.
  376. .El
  377. More information about the
  378. .Va struct archive
  379. object and the overall design of the library can be found in the
  380. .Xr libarchive 3
  381. overview.
  382. .Sh IMPLEMENTATION
  383. Compression support is built-in to libarchive, which uses zlib and bzlib
  384. to handle gzip and bzip2 compression, respectively.
  385. .Sh CLIENT CALLBACKS
  386. To use this library, you will need to define and register
  387. callback functions that will be invoked to write data to the
  388. resulting archive.
  389. These functions are registered by calling
  390. .Fn archive_write_open :
  391. .Bl -item -offset indent
  392. .It
  393. .Ft typedef int
  394. .Fn archive_open_callback "struct archive *" "void *client_data"
  395. .El
  396. .Pp
  397. The open callback is invoked by
  398. .Fn archive_write_open .
  399. It should return
  400. .Cm ARCHIVE_OK
  401. if the underlying file or data source is successfully
  402. opened.
  403. If the open fails, it should call
  404. .Fn archive_set_error
  405. to register an error code and message and return
  406. .Cm ARCHIVE_FATAL .
  407. .Bl -item -offset indent
  408. .It
  409. .Ft typedef ssize_t
  410. .Fo archive_write_callback
  411. .Fa "struct archive *"
  412. .Fa "void *client_data"
  413. .Fa "const void *buffer"
  414. .Fa "size_t length"
  415. .Fc
  416. .El
  417. .Pp
  418. The write callback is invoked whenever the library
  419. needs to write raw bytes to the archive.
  420. For correct blocking, each call to the write callback function
  421. should translate into a single
  422. .Xr write 2
  423. system call.
  424. This is especially critical when writing archives to tape drives.
  425. On success, the write callback should return the
  426. number of bytes actually written.
  427. On error, the callback should invoke
  428. .Fn archive_set_error
  429. to register an error code and message and return -1.
  430. .Bl -item -offset indent
  431. .It
  432. .Ft typedef int
  433. .Fn archive_close_callback "struct archive *" "void *client_data"
  434. .El
  435. .Pp
  436. The close callback is invoked by archive_close when
  437. the archive processing is complete.
  438. The callback should return
  439. .Cm ARCHIVE_OK
  440. on success.
  441. On failure, the callback should invoke
  442. .Fn archive_set_error
  443. to register an error code and message and
  444. return
  445. .Cm ARCHIVE_FATAL.
  446. .Sh EXAMPLE
  447. The following sketch illustrates basic usage of the library.
  448. In this example,
  449. the callback functions are simply wrappers around the standard
  450. .Xr open 2 ,
  451. .Xr write 2 ,
  452. and
  453. .Xr close 2
  454. system calls.
  455. .Bd -literal -offset indent
  456. #include <sys/stat.h>
  457. #include <archive.h>
  458. #include <archive_entry.h>
  459. #include <fcntl.h>
  460. #include <stdlib.h>
  461. #include <unistd.h>
  462. struct mydata {
  463. const char *name;
  464. int fd;
  465. };
  466. int
  467. myopen(struct archive *a, void *client_data)
  468. {
  469. struct mydata *mydata = client_data;
  470. mydata->fd = open(mydata->name, O_WRONLY | O_CREAT, 0644);
  471. if (mydata->fd >= 0)
  472. return (ARCHIVE_OK);
  473. else
  474. return (ARCHIVE_FATAL);
  475. }
  476. ssize_t
  477. mywrite(struct archive *a, void *client_data, const void *buff, size_t n)
  478. {
  479. struct mydata *mydata = client_data;
  480. return (write(mydata->fd, buff, n));
  481. }
  482. int
  483. myclose(struct archive *a, void *client_data)
  484. {
  485. struct mydata *mydata = client_data;
  486. if (mydata->fd > 0)
  487. close(mydata->fd);
  488. return (0);
  489. }
  490. void
  491. write_archive(const char *outname, const char **filename)
  492. {
  493. struct mydata *mydata = malloc(sizeof(struct mydata));
  494. struct archive *a;
  495. struct archive_entry *entry;
  496. struct stat st;
  497. char buff[8192];
  498. int len;
  499. int fd;
  500. a = archive_write_new();
  501. mydata->name = outname;
  502. archive_write_set_compression_gzip(a);
  503. archive_write_set_format_ustar(a);
  504. archive_write_open(a, mydata, myopen, mywrite, myclose);
  505. while (*filename) {
  506. stat(*filename, &st);
  507. entry = archive_entry_new();
  508. archive_entry_copy_stat(entry, &st);
  509. archive_entry_set_pathname(entry, *filename);
  510. archive_write_header(a, entry);
  511. fd = open(*filename, O_RDONLY);
  512. len = read(fd, buff, sizeof(buff));
  513. while ( len > 0 ) {
  514. archive_write_data(a, buff, len);
  515. len = read(fd, buff, sizeof(buff));
  516. }
  517. archive_entry_free(entry);
  518. filename++;
  519. }
  520. archive_write_finish(a);
  521. }
  522. int main(int argc, const char **argv)
  523. {
  524. const char *outname;
  525. argv++;
  526. outname = argv++;
  527. write_archive(outname, argv);
  528. return 0;
  529. }
  530. .Ed
  531. .Sh RETURN VALUES
  532. Most functions return
  533. .Cm ARCHIVE_OK
  534. (zero) on success, or one of several non-zero
  535. error codes for errors.
  536. Specific error codes include:
  537. .Cm ARCHIVE_RETRY
  538. for operations that might succeed if retried,
  539. .Cm ARCHIVE_WARN
  540. for unusual conditions that do not prevent further operations, and
  541. .Cm ARCHIVE_FATAL
  542. for serious errors that make remaining operations impossible.
  543. The
  544. .Fn archive_errno
  545. and
  546. .Fn archive_error_string
  547. functions can be used to retrieve an appropriate error code and a
  548. textual error message.
  549. .Pp
  550. .Fn archive_write_new
  551. returns a pointer to a newly-allocated
  552. .Tn struct archive
  553. object.
  554. .Pp
  555. .Fn archive_write_data
  556. returns a count of the number of bytes actually written.
  557. On error, -1 is returned and the
  558. .Fn archive_errno
  559. and
  560. .Fn archive_error_string
  561. functions will return appropriate values.
  562. Note that if the client-provided write callback function
  563. returns a non-zero value, that error will be propagated back to the caller
  564. through whatever API function resulted in that call, which
  565. may include
  566. .Fn archive_write_header ,
  567. .Fn archive_write_data ,
  568. .Fn archive_write_close ,
  569. or
  570. .Fn archive_write_finish .
  571. The client callback can call
  572. .Fn archive_set_error
  573. to provide values that can then be retrieved by
  574. .Fn archive_errno
  575. and
  576. .Fn archive_error_string .
  577. .Sh SEE ALSO
  578. .Xr tar 1 ,
  579. .Xr libarchive 3 ,
  580. .Xr tar 5
  581. .Sh HISTORY
  582. The
  583. .Nm libarchive
  584. library first appeared in
  585. .Fx 5.3 .
  586. .Sh AUTHORS
  587. .An -nosplit
  588. The
  589. .Nm libarchive
  590. library was written by
  591. .An Tim Kientzle Aq [email protected] .
  592. .Sh BUGS
  593. There are many peculiar bugs in historic tar implementations that may cause
  594. certain programs to reject archives written by this library.
  595. For example, several historic implementations calculated header checksums
  596. incorrectly and will thus reject valid archives; GNU tar does not fully support
  597. pax interchange format; some old tar implementations required specific
  598. field terminations.
  599. .Pp
  600. The default pax interchange format eliminates most of the historic
  601. tar limitations and provides a generic key/value attribute facility
  602. for vendor-defined extensions.
  603. One oversight in POSIX is the failure to provide a standard attribute
  604. for large device numbers.
  605. This library uses
  606. .Dq SCHILY.devminor
  607. and
  608. .Dq SCHILY.devmajor
  609. for device numbers that exceed the range supported by the backwards-compatible
  610. ustar header.
  611. These keys are compatible with Joerg Schilling's
  612. .Nm star
  613. archiver.
  614. Other implementations may not recognize these keys and will thus be unable
  615. to correctly restore device nodes with large device numbers from archives
  616. created by this library.