@papyrus-sdk/engine-native 0.2.22-beta.9.epub.2 → 0.2.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/PapyrusNativeEngine.podspec +45 -0
  2. package/android/build.gradle +1 -0
  3. package/android/src/main/cpp/CMakeLists.txt +137 -0
  4. package/android/src/main/cpp/PapyrusComicArchiveJni.cpp +68 -0
  5. package/android/src/main/cpp/PapyrusComicArchiveTest.cpp +55 -0
  6. package/android/src/main/cpp/papyrus_outline_loader_test.cpp +240 -0
  7. package/android/src/main/cpp/papyrus_text_word_test.cpp +72 -0
  8. package/android/src/main/java/com/papyrus/engine/PapyrusComicArchiveNative.java +14 -0
  9. package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentView.java +491 -0
  10. package/android/src/main/java/com/papyrus/engine/PapyrusComicDocumentViewManager.java +32 -0
  11. package/android/src/main/java/com/papyrus/engine/PapyrusComicPageLayout.java +38 -0
  12. package/android/src/main/java/com/papyrus/engine/PapyrusNativeEngineModule.java +305 -35
  13. package/android/src/main/java/com/papyrus/engine/PapyrusNativeTextModel.java +195 -0
  14. package/android/src/main/java/com/papyrus/engine/PapyrusPackage.java +3 -1
  15. package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerView.java +195 -5
  16. package/android/src/main/java/com/papyrus/engine/PapyrusPdfViewerViewManager.java +20 -1
  17. package/android/src/main/java/com/papyrus/engine/PapyrusSelectionMenuIcon.java +48 -0
  18. package/android/src/main/java/com/papyrus/engine/PapyrusTextAnnotationModel.java +22 -0
  19. package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentView.java +661 -0
  20. package/android/src/main/java/com/papyrus/engine/PapyrusTextDocumentViewManager.java +49 -0
  21. package/android/src/main/java/com/papyrus/engine/PapyrusTextStore.java +43 -0
  22. package/dist/index.d.mts +614 -4
  23. package/dist/index.d.ts +614 -4
  24. package/dist/index.js +484 -8
  25. package/dist/index.js.map +1 -1
  26. package/dist/index.mjs +477 -7
  27. package/dist/index.mjs.map +1 -1
  28. package/ios/PapyrusComicDocumentView.h +21 -0
  29. package/ios/PapyrusComicDocumentView.m +554 -0
  30. package/ios/PapyrusComicDocumentViewManager.m +23 -0
  31. package/ios/PapyrusEngineStore.h +3 -0
  32. package/ios/PapyrusEngineStore.m +32 -6
  33. package/ios/PapyrusNativeEngine.m +684 -5
  34. package/ios/PapyrusPageRotationRegistry.h +29 -0
  35. package/ios/PapyrusPageRotationRegistry.m +179 -0
  36. package/ios/PapyrusPageView.m +38 -11
  37. package/ios/PapyrusPdfDocumentView.h +55 -0
  38. package/ios/PapyrusPdfDocumentView.m +2370 -0
  39. package/ios/PapyrusPdfDocumentViewManager.m +61 -0
  40. package/ios/PapyrusPdfPageTheme.h +15 -0
  41. package/ios/PapyrusPdfPageTheme.m +218 -0
  42. package/ios/PapyrusSelectionMenu.h +27 -0
  43. package/ios/PapyrusTextAnnotationRange.h +2 -0
  44. package/ios/PapyrusTextAnnotationRange.m +29 -0
  45. package/ios/PapyrusTextDocumentView.h +32 -0
  46. package/ios/PapyrusTextDocumentView.m +518 -0
  47. package/ios/PapyrusTextDocumentViewManager.m +34 -0
  48. package/ios/PapyrusTextStore.h +13 -0
  49. package/ios/PapyrusTextStore.m +73 -0
  50. package/package.json +12 -10
  51. package/react-native.config.js +1 -1
  52. package/third_party_licenses/BLAKE2-NOTICE.txt +11 -0
  53. package/third_party_licenses/libarchive-COPYING +65 -0
  54. package/vendor/libarchive/PapyrusComicArchive.cpp +376 -0
  55. package/vendor/libarchive/PapyrusComicArchive.h +30 -0
  56. package/vendor/libarchive/README.papyrus.md +15 -0
  57. package/vendor/libarchive/android.h +192 -0
  58. package/vendor/libarchive/config/PapyrusArchiveConfig.h +71 -0
  59. package/vendor/libarchive/libarchive/CMakeLists.txt +293 -0
  60. package/vendor/libarchive/libarchive/android_lf.h +36 -0
  61. package/vendor/libarchive/libarchive/archive.h +1266 -0
  62. package/vendor/libarchive/libarchive/archive_acl.c +2025 -0
  63. package/vendor/libarchive/libarchive/archive_acl_private.h +85 -0
  64. package/vendor/libarchive/libarchive/archive_blake2.h +197 -0
  65. package/vendor/libarchive/libarchive/archive_blake2_impl.h +161 -0
  66. package/vendor/libarchive/libarchive/archive_blake2s_ref.c +369 -0
  67. package/vendor/libarchive/libarchive/archive_blake2sp_ref.c +361 -0
  68. package/vendor/libarchive/libarchive/archive_check_magic.c +183 -0
  69. package/vendor/libarchive/libarchive/archive_cmdline.c +211 -0
  70. package/vendor/libarchive/libarchive/archive_cmdline_private.h +45 -0
  71. package/vendor/libarchive/libarchive/archive_crc32.h +123 -0
  72. package/vendor/libarchive/libarchive/archive_cryptor.c +534 -0
  73. package/vendor/libarchive/libarchive/archive_cryptor_private.h +199 -0
  74. package/vendor/libarchive/libarchive/archive_digest.c +1584 -0
  75. package/vendor/libarchive/libarchive/archive_digest_private.h +431 -0
  76. package/vendor/libarchive/libarchive/archive_disk_acl_darwin.c +558 -0
  77. package/vendor/libarchive/libarchive/archive_disk_acl_freebsd.c +712 -0
  78. package/vendor/libarchive/libarchive/archive_disk_acl_linux.c +760 -0
  79. package/vendor/libarchive/libarchive/archive_disk_acl_sunos.c +824 -0
  80. package/vendor/libarchive/libarchive/archive_endian.h +234 -0
  81. package/vendor/libarchive/libarchive/archive_entry.3 +147 -0
  82. package/vendor/libarchive/libarchive/archive_entry.c +2297 -0
  83. package/vendor/libarchive/libarchive/archive_entry.h +763 -0
  84. package/vendor/libarchive/libarchive/archive_entry_acl.3 +458 -0
  85. package/vendor/libarchive/libarchive/archive_entry_copy_bhfi.c +55 -0
  86. package/vendor/libarchive/libarchive/archive_entry_copy_stat.c +82 -0
  87. package/vendor/libarchive/libarchive/archive_entry_link_resolver.c +472 -0
  88. package/vendor/libarchive/libarchive/archive_entry_linkify.3 +224 -0
  89. package/vendor/libarchive/libarchive/archive_entry_locale.h +90 -0
  90. package/vendor/libarchive/libarchive/archive_entry_misc.3 +63 -0
  91. package/vendor/libarchive/libarchive/archive_entry_paths.3 +153 -0
  92. package/vendor/libarchive/libarchive/archive_entry_perms.3 +210 -0
  93. package/vendor/libarchive/libarchive/archive_entry_private.h +205 -0
  94. package/vendor/libarchive/libarchive/archive_entry_sparse.c +156 -0
  95. package/vendor/libarchive/libarchive/archive_entry_stat.3 +274 -0
  96. package/vendor/libarchive/libarchive/archive_entry_stat.c +121 -0
  97. package/vendor/libarchive/libarchive/archive_entry_strmode.c +69 -0
  98. package/vendor/libarchive/libarchive/archive_entry_time.3 +127 -0
  99. package/vendor/libarchive/libarchive/archive_entry_xattr.c +155 -0
  100. package/vendor/libarchive/libarchive/archive_hmac.c +345 -0
  101. package/vendor/libarchive/libarchive/archive_hmac_private.h +119 -0
  102. package/vendor/libarchive/libarchive/archive_integer.h +267 -0
  103. package/vendor/libarchive/libarchive/archive_match.c +1869 -0
  104. package/vendor/libarchive/libarchive/archive_openssl_evp_private.h +54 -0
  105. package/vendor/libarchive/libarchive/archive_openssl_hmac_private.h +54 -0
  106. package/vendor/libarchive/libarchive/archive_options.c +219 -0
  107. package/vendor/libarchive/libarchive/archive_options_private.h +49 -0
  108. package/vendor/libarchive/libarchive/archive_pack_dev.c +330 -0
  109. package/vendor/libarchive/libarchive/archive_pack_dev.h +49 -0
  110. package/vendor/libarchive/libarchive/archive_parse_date.c +1173 -0
  111. package/vendor/libarchive/libarchive/archive_pathmatch.c +480 -0
  112. package/vendor/libarchive/libarchive/archive_pathmatch.h +50 -0
  113. package/vendor/libarchive/libarchive/archive_platform.h +213 -0
  114. package/vendor/libarchive/libarchive/archive_platform_acl.h +53 -0
  115. package/vendor/libarchive/libarchive/archive_platform_stat.h +45 -0
  116. package/vendor/libarchive/libarchive/archive_platform_xattr.h +45 -0
  117. package/vendor/libarchive/libarchive/archive_ppmd7.c +1173 -0
  118. package/vendor/libarchive/libarchive/archive_ppmd7_private.h +119 -0
  119. package/vendor/libarchive/libarchive/archive_ppmd8.c +1293 -0
  120. package/vendor/libarchive/libarchive/archive_ppmd8_private.h +123 -0
  121. package/vendor/libarchive/libarchive/archive_ppmd_private.h +159 -0
  122. package/vendor/libarchive/libarchive/archive_private.h +209 -0
  123. package/vendor/libarchive/libarchive/archive_random.c +274 -0
  124. package/vendor/libarchive/libarchive/archive_random_private.h +36 -0
  125. package/vendor/libarchive/libarchive/archive_rb.c +709 -0
  126. package/vendor/libarchive/libarchive/archive_rb.h +113 -0
  127. package/vendor/libarchive/libarchive/archive_read.3 +250 -0
  128. package/vendor/libarchive/libarchive/archive_read.c +1814 -0
  129. package/vendor/libarchive/libarchive/archive_read_add_passphrase.3 +72 -0
  130. package/vendor/libarchive/libarchive/archive_read_add_passphrase.c +189 -0
  131. package/vendor/libarchive/libarchive/archive_read_append_filter.c +209 -0
  132. package/vendor/libarchive/libarchive/archive_read_data.3 +128 -0
  133. package/vendor/libarchive/libarchive/archive_read_data_into_fd.c +207 -0
  134. package/vendor/libarchive/libarchive/archive_read_disk.3 +422 -0
  135. package/vendor/libarchive/libarchive/archive_read_disk_entry_from_file.c +1086 -0
  136. package/vendor/libarchive/libarchive/archive_read_disk_posix.c +2639 -0
  137. package/vendor/libarchive/libarchive/archive_read_disk_private.h +97 -0
  138. package/vendor/libarchive/libarchive/archive_read_disk_set_standard_lookup.c +315 -0
  139. package/vendor/libarchive/libarchive/archive_read_disk_windows.c +2603 -0
  140. package/vendor/libarchive/libarchive/archive_read_extract.3 +135 -0
  141. package/vendor/libarchive/libarchive/archive_read_extract.c +59 -0
  142. package/vendor/libarchive/libarchive/archive_read_extract2.c +154 -0
  143. package/vendor/libarchive/libarchive/archive_read_filter.3 +163 -0
  144. package/vendor/libarchive/libarchive/archive_read_format.3 +190 -0
  145. package/vendor/libarchive/libarchive/archive_read_free.3 +91 -0
  146. package/vendor/libarchive/libarchive/archive_read_header.3 +89 -0
  147. package/vendor/libarchive/libarchive/archive_read_new.3 +57 -0
  148. package/vendor/libarchive/libarchive/archive_read_open.3 +247 -0
  149. package/vendor/libarchive/libarchive/archive_read_open_fd.c +236 -0
  150. package/vendor/libarchive/libarchive/archive_read_open_file.c +257 -0
  151. package/vendor/libarchive/libarchive/archive_read_open_filename.c +652 -0
  152. package/vendor/libarchive/libarchive/archive_read_open_memory.c +188 -0
  153. package/vendor/libarchive/libarchive/archive_read_private.h +274 -0
  154. package/vendor/libarchive/libarchive/archive_read_set_format.c +116 -0
  155. package/vendor/libarchive/libarchive/archive_read_set_options.3 +290 -0
  156. package/vendor/libarchive/libarchive/archive_read_set_options.c +132 -0
  157. package/vendor/libarchive/libarchive/archive_read_support_filter_all.c +84 -0
  158. package/vendor/libarchive/libarchive/archive_read_support_filter_by_code.c +68 -0
  159. package/vendor/libarchive/libarchive/archive_read_support_filter_bzip2.c +360 -0
  160. package/vendor/libarchive/libarchive/archive_read_support_filter_compress.c +457 -0
  161. package/vendor/libarchive/libarchive/archive_read_support_filter_grzip.c +108 -0
  162. package/vendor/libarchive/libarchive/archive_read_support_filter_gzip.c +538 -0
  163. package/vendor/libarchive/libarchive/archive_read_support_filter_lrzip.c +119 -0
  164. package/vendor/libarchive/libarchive/archive_read_support_filter_lz4.c +829 -0
  165. package/vendor/libarchive/libarchive/archive_read_support_filter_lzop.c +493 -0
  166. package/vendor/libarchive/libarchive/archive_read_support_filter_none.c +51 -0
  167. package/vendor/libarchive/libarchive/archive_read_support_filter_program.c +497 -0
  168. package/vendor/libarchive/libarchive/archive_read_support_filter_rpm.c +249 -0
  169. package/vendor/libarchive/libarchive/archive_read_support_filter_uu.c +739 -0
  170. package/vendor/libarchive/libarchive/archive_read_support_filter_xz.c +792 -0
  171. package/vendor/libarchive/libarchive/archive_read_support_filter_zstd.c +356 -0
  172. package/vendor/libarchive/libarchive/archive_read_support_format_7zip.c +4650 -0
  173. package/vendor/libarchive/libarchive/archive_read_support_format_all.c +88 -0
  174. package/vendor/libarchive/libarchive/archive_read_support_format_ar.c +597 -0
  175. package/vendor/libarchive/libarchive/archive_read_support_format_by_code.c +76 -0
  176. package/vendor/libarchive/libarchive/archive_read_support_format_cab.c +3410 -0
  177. package/vendor/libarchive/libarchive/archive_read_support_format_cpio.c +1152 -0
  178. package/vendor/libarchive/libarchive/archive_read_support_format_empty.c +95 -0
  179. package/vendor/libarchive/libarchive/archive_read_support_format_iso9660.c +3516 -0
  180. package/vendor/libarchive/libarchive/archive_read_support_format_lha.c +2931 -0
  181. package/vendor/libarchive/libarchive/archive_read_support_format_mtree.c +2113 -0
  182. package/vendor/libarchive/libarchive/archive_read_support_format_rar.c +3932 -0
  183. package/vendor/libarchive/libarchive/archive_read_support_format_rar5.c +4501 -0
  184. package/vendor/libarchive/libarchive/archive_read_support_format_raw.c +194 -0
  185. package/vendor/libarchive/libarchive/archive_read_support_format_tar.c +3785 -0
  186. package/vendor/libarchive/libarchive/archive_read_support_format_warc.c +875 -0
  187. package/vendor/libarchive/libarchive/archive_read_support_format_xar.c +3770 -0
  188. package/vendor/libarchive/libarchive/archive_read_support_format_zip.c +4710 -0
  189. package/vendor/libarchive/libarchive/archive_string.c +4391 -0
  190. package/vendor/libarchive/libarchive/archive_string.h +244 -0
  191. package/vendor/libarchive/libarchive/archive_string_composition.h +2289 -0
  192. package/vendor/libarchive/libarchive/archive_string_sprintf.c +200 -0
  193. package/vendor/libarchive/libarchive/archive_time.c +168 -0
  194. package/vendor/libarchive/libarchive/archive_time_private.h +47 -0
  195. package/vendor/libarchive/libarchive/archive_util.3 +239 -0
  196. package/vendor/libarchive/libarchive/archive_util.c +668 -0
  197. package/vendor/libarchive/libarchive/archive_version_details.c +516 -0
  198. package/vendor/libarchive/libarchive/archive_virtual.c +162 -0
  199. package/vendor/libarchive/libarchive/archive_windows.c +1035 -0
  200. package/vendor/libarchive/libarchive/archive_windows.h +332 -0
  201. package/vendor/libarchive/libarchive/archive_write.3 +266 -0
  202. package/vendor/libarchive/libarchive/archive_write.c +896 -0
  203. package/vendor/libarchive/libarchive/archive_write_add_filter.c +71 -0
  204. package/vendor/libarchive/libarchive/archive_write_add_filter_b64encode.c +329 -0
  205. package/vendor/libarchive/libarchive/archive_write_add_filter_by_name.c +76 -0
  206. package/vendor/libarchive/libarchive/archive_write_add_filter_bzip2.c +411 -0
  207. package/vendor/libarchive/libarchive/archive_write_add_filter_compress.c +459 -0
  208. package/vendor/libarchive/libarchive/archive_write_add_filter_grzip.c +143 -0
  209. package/vendor/libarchive/libarchive/archive_write_add_filter_gzip.c +493 -0
  210. package/vendor/libarchive/libarchive/archive_write_add_filter_lrzip.c +214 -0
  211. package/vendor/libarchive/libarchive/archive_write_add_filter_lz4.c +710 -0
  212. package/vendor/libarchive/libarchive/archive_write_add_filter_lzop.c +500 -0
  213. package/vendor/libarchive/libarchive/archive_write_add_filter_none.c +42 -0
  214. package/vendor/libarchive/libarchive/archive_write_add_filter_program.c +398 -0
  215. package/vendor/libarchive/libarchive/archive_write_add_filter_uuencode.c +320 -0
  216. package/vendor/libarchive/libarchive/archive_write_add_filter_xz.c +547 -0
  217. package/vendor/libarchive/libarchive/archive_write_add_filter_zstd.c +608 -0
  218. package/vendor/libarchive/libarchive/archive_write_blocksize.3 +112 -0
  219. package/vendor/libarchive/libarchive/archive_write_data.3 +88 -0
  220. package/vendor/libarchive/libarchive/archive_write_disk.3 +360 -0
  221. package/vendor/libarchive/libarchive/archive_write_disk_posix.c +4789 -0
  222. package/vendor/libarchive/libarchive/archive_write_disk_private.h +43 -0
  223. package/vendor/libarchive/libarchive/archive_write_disk_set_standard_lookup.c +265 -0
  224. package/vendor/libarchive/libarchive/archive_write_disk_windows.c +2952 -0
  225. package/vendor/libarchive/libarchive/archive_write_filter.3 +140 -0
  226. package/vendor/libarchive/libarchive/archive_write_finish_entry.3 +77 -0
  227. package/vendor/libarchive/libarchive/archive_write_format.3 +187 -0
  228. package/vendor/libarchive/libarchive/archive_write_free.3 +94 -0
  229. package/vendor/libarchive/libarchive/archive_write_header.3 +71 -0
  230. package/vendor/libarchive/libarchive/archive_write_new.3 +56 -0
  231. package/vendor/libarchive/libarchive/archive_write_open.3 +270 -0
  232. package/vendor/libarchive/libarchive/archive_write_open_fd.c +141 -0
  233. package/vendor/libarchive/libarchive/archive_write_open_file.c +102 -0
  234. package/vendor/libarchive/libarchive/archive_write_open_filename.c +272 -0
  235. package/vendor/libarchive/libarchive/archive_write_open_memory.c +110 -0
  236. package/vendor/libarchive/libarchive/archive_write_private.h +166 -0
  237. package/vendor/libarchive/libarchive/archive_write_set_format.c +124 -0
  238. package/vendor/libarchive/libarchive/archive_write_set_format_7zip.c +2571 -0
  239. package/vendor/libarchive/libarchive/archive_write_set_format_ar.c +540 -0
  240. package/vendor/libarchive/libarchive/archive_write_set_format_by_name.c +93 -0
  241. package/vendor/libarchive/libarchive/archive_write_set_format_cpio.c +11 -0
  242. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_binary.c +618 -0
  243. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_newc.c +457 -0
  244. package/vendor/libarchive/libarchive/archive_write_set_format_cpio_odc.c +508 -0
  245. package/vendor/libarchive/libarchive/archive_write_set_format_filter_by_ext.c +141 -0
  246. package/vendor/libarchive/libarchive/archive_write_set_format_gnutar.c +790 -0
  247. package/vendor/libarchive/libarchive/archive_write_set_format_iso9660.c +8216 -0
  248. package/vendor/libarchive/libarchive/archive_write_set_format_mtree.c +2307 -0
  249. package/vendor/libarchive/libarchive/archive_write_set_format_pax.c +2249 -0
  250. package/vendor/libarchive/libarchive/archive_write_set_format_private.h +40 -0
  251. package/vendor/libarchive/libarchive/archive_write_set_format_raw.c +123 -0
  252. package/vendor/libarchive/libarchive/archive_write_set_format_shar.c +650 -0
  253. package/vendor/libarchive/libarchive/archive_write_set_format_ustar.c +768 -0
  254. package/vendor/libarchive/libarchive/archive_write_set_format_v7tar.c +648 -0
  255. package/vendor/libarchive/libarchive/archive_write_set_format_warc.c +491 -0
  256. package/vendor/libarchive/libarchive/archive_write_set_format_xar.c +3799 -0
  257. package/vendor/libarchive/libarchive/archive_write_set_format_zip.c +2548 -0
  258. package/vendor/libarchive/libarchive/archive_write_set_options.3 +779 -0
  259. package/vendor/libarchive/libarchive/archive_write_set_options.c +129 -0
  260. package/vendor/libarchive/libarchive/archive_write_set_passphrase.3 +72 -0
  261. package/vendor/libarchive/libarchive/archive_write_set_passphrase.c +95 -0
  262. package/vendor/libarchive/libarchive/archive_xxhash.h +48 -0
  263. package/vendor/libarchive/libarchive/config_freebsd.h +275 -0
  264. package/vendor/libarchive/libarchive/cpio.5 +389 -0
  265. package/vendor/libarchive/libarchive/filter_fork.h +44 -0
  266. package/vendor/libarchive/libarchive/filter_fork_posix.c +269 -0
  267. package/vendor/libarchive/libarchive/filter_fork_windows.c +270 -0
  268. package/vendor/libarchive/libarchive/libarchive-formats.5 +478 -0
  269. package/vendor/libarchive/libarchive/libarchive.3 +297 -0
  270. package/vendor/libarchive/libarchive/libarchive_changes.3 +339 -0
  271. package/vendor/libarchive/libarchive/libarchive_internals.3 +363 -0
  272. package/vendor/libarchive/libarchive/module.modulemap +34 -0
  273. package/vendor/libarchive/libarchive/mtree.5 +323 -0
  274. package/vendor/libarchive/libarchive/tar.5 +947 -0
  275. package/vendor/libarchive/libarchive/xxhash.c +531 -0
  276. package/ios/PapyrusNativeEngine.podspec +0 -15
@@ -0,0 +1,947 @@
1
+ .\" Copyright (c) 2003-2009 Tim Kientzle
2
+ .\" Copyright (c) 2016 Martin Matuska
3
+ .\" All rights reserved.
4
+ .\"
5
+ .\" Redistribution and use in source and binary forms, with or without
6
+ .\" modification, are permitted provided that the following conditions
7
+ .\" are met:
8
+ .\" 1. Redistributions of source code must retain the above copyright
9
+ .\" notice, this list of conditions and the following disclaimer.
10
+ .\" 2. Redistributions in binary form must reproduce the above copyright
11
+ .\" notice, this list of conditions and the following disclaimer in the
12
+ .\" documentation and/or other materials provided with the distribution.
13
+ .\"
14
+ .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15
+ .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16
+ .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17
+ .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18
+ .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19
+ .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20
+ .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21
+ .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22
+ .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23
+ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24
+ .\" SUCH DAMAGE.
25
+ .\"
26
+ .Dd December 27, 2016
27
+ .Dt TAR 5
28
+ .Os
29
+ .Sh NAME
30
+ .Nm tar
31
+ .Nd format of tape archive files
32
+ .Sh DESCRIPTION
33
+ The
34
+ .Nm
35
+ archive format collects any number of files, directories, and other
36
+ file system objects (symbolic links, device nodes, etc.) into a single
37
+ stream of bytes.
38
+ The format was originally designed to be used with
39
+ tape drives that operate with fixed-size blocks, but is widely used as
40
+ a general packaging mechanism.
41
+ .Ss General Format
42
+ A
43
+ .Nm
44
+ archive consists of a series of 512-byte records.
45
+ Each file system object requires a header record which stores basic metadata
46
+ (pathname, owner, permissions, etc.) and zero or more records containing any
47
+ file data.
48
+ The end of the archive is indicated by two records consisting
49
+ entirely of zero bytes.
50
+ .Pp
51
+ For compatibility with tape drives that use fixed block sizes,
52
+ programs that read or write tar files always read or write a fixed
53
+ number of records with each I/O operation.
54
+ These
55
+ .Dq blocks
56
+ are always a multiple of the record size.
57
+ The maximum block size supported by early
58
+ implementations was 10240 bytes or 20 records.
59
+ This is still the default for most implementations
60
+ although block sizes of 1MiB (2048 records) or larger are
61
+ commonly used with modern high-speed tape drives.
62
+ (Note: the terms
63
+ .Dq block
64
+ and
65
+ .Dq record
66
+ here are not entirely standard; this document follows the
67
+ convention established by John Gilmore in documenting
68
+ .Nm pdtar . )
69
+ .Ss Old-Style Archive Format
70
+ The original tar archive format has been extended many times to
71
+ include additional information that various implementors found
72
+ necessary.
73
+ This section describes the variant implemented by the tar command
74
+ included in
75
+ .At v7 ,
76
+ which seems to be the earliest widely-used version of the tar program.
77
+ .Pp
78
+ The header record for an old-style
79
+ .Nm
80
+ archive consists of the following:
81
+ .Bd -literal -offset indent
82
+ struct header_old_tar {
83
+ char name[100];
84
+ char mode[8];
85
+ char uid[8];
86
+ char gid[8];
87
+ char size[12];
88
+ char mtime[12];
89
+ char checksum[8];
90
+ char linkflag[1];
91
+ char linkname[100];
92
+ char pad[255];
93
+ };
94
+ .Ed
95
+ All unused bytes in the header record are filled with nulls.
96
+ .Bl -tag -width indent
97
+ .It Va name
98
+ Pathname, stored as a null-terminated string.
99
+ Early tar implementations only stored regular files (including
100
+ hardlinks to those files).
101
+ One common early convention used a trailing "/" character to indicate
102
+ a directory name, allowing directory permissions and owner information
103
+ to be archived and restored.
104
+ .It Va mode
105
+ File mode, stored as an octal number in ASCII.
106
+ .It Va uid , Va gid
107
+ User id and group id of owner, as octal numbers in ASCII.
108
+ .It Va size
109
+ Size of file, as octal number in ASCII.
110
+ For regular files only, this indicates the amount of data
111
+ that follows the header.
112
+ In particular, this field was ignored by early tar implementations
113
+ when extracting hardlinks.
114
+ Modern writers should always store a zero length for hardlink entries.
115
+ .It Va mtime
116
+ Modification time of file, as an octal number in ASCII.
117
+ This indicates the number of seconds since the start of the epoch,
118
+ 00:00:00 UTC January 1, 1970.
119
+ Note that negative values should be avoided
120
+ here, as they are handled inconsistently.
121
+ .It Va checksum
122
+ Header checksum, stored as an octal number in ASCII.
123
+ To compute the checksum, set the checksum field to all spaces,
124
+ then sum all bytes in the header using unsigned arithmetic.
125
+ This field should be stored as six octal digits followed by a null and a space
126
+ character.
127
+ Note that many early implementations of tar used signed arithmetic
128
+ for the checksum field, which can cause interoperability problems
129
+ when transferring archives between systems.
130
+ Modern robust readers compute the checksum both ways and accept the
131
+ header if either computation matches.
132
+ .It Va linkflag , Va linkname
133
+ In order to preserve hardlinks and conserve tape, a file
134
+ with multiple links is only written to the archive the first
135
+ time it is encountered.
136
+ The next time it is encountered, the
137
+ .Va linkflag
138
+ is set to an ASCII
139
+ .Sq 1
140
+ and the
141
+ .Va linkname
142
+ field holds the first name under which this file appears.
143
+ (Note that regular files have a null value in the
144
+ .Va linkflag
145
+ field.)
146
+ .El
147
+ .Pp
148
+ Early tar implementations varied in how they terminated these fields.
149
+ The tar command in
150
+ .At v7
151
+ used the following conventions (this is also documented in early BSD manpages):
152
+ the pathname must be null-terminated;
153
+ the mode, uid, and gid fields must end in a space and a null byte;
154
+ the size and mtime fields must end in a space;
155
+ the checksum is terminated by a null and a space.
156
+ Early implementations filled the numeric fields with leading spaces.
157
+ This seems to have been common practice until the
158
+ .St -p1003.1-88
159
+ standard was released.
160
+ For best portability, modern implementations should fill the numeric
161
+ fields with leading zeros.
162
+ .Ss Pre-POSIX Archives
163
+ An early draft of
164
+ .St -p1003.1-88
165
+ served as the basis for John Gilmore's
166
+ .Nm pdtar
167
+ program and many system implementations from the late 1980s
168
+ and early 1990s.
169
+ These archives generally follow the POSIX ustar
170
+ format described below with the following variations:
171
+ .Bl -bullet -compact -width indent
172
+ .It
173
+ The magic value consists of the five characters
174
+ .Dq ustar
175
+ followed by a space.
176
+ The version field contains a space character followed by a null.
177
+ .It
178
+ The numeric fields are generally filled with leading spaces
179
+ (not leading zeros as recommended in the final standard).
180
+ .It
181
+ The prefix field is often not used, limiting pathnames to
182
+ the 100 characters of old-style archives.
183
+ .El
184
+ .Ss POSIX ustar Archives
185
+ .St -p1003.1-88
186
+ defined a standard tar file format to be read and written
187
+ by compliant implementations of
188
+ .Xr tar 1 .
189
+ This format is often called the
190
+ .Dq ustar
191
+ format, after the magic value used
192
+ in the header.
193
+ (The name is an acronym for
194
+ .Dq Unix Standard TAR . )
195
+ It extends the historic format with new fields:
196
+ .Bd -literal -offset indent
197
+ struct header_posix_ustar {
198
+ char name[100];
199
+ char mode[8];
200
+ char uid[8];
201
+ char gid[8];
202
+ char size[12];
203
+ char mtime[12];
204
+ char checksum[8];
205
+ char typeflag[1];
206
+ char linkname[100];
207
+ char magic[6];
208
+ char version[2];
209
+ char uname[32];
210
+ char gname[32];
211
+ char devmajor[8];
212
+ char devminor[8];
213
+ char prefix[155];
214
+ char pad[12];
215
+ };
216
+ .Ed
217
+ .Bl -tag -width indent
218
+ .It Va typeflag
219
+ Type of entry.
220
+ POSIX extended the earlier
221
+ .Va linkflag
222
+ field with several new type values:
223
+ .Bl -tag -width indent -compact
224
+ .It Dq 0
225
+ Regular file.
226
+ NUL should be treated as a synonym, for compatibility purposes.
227
+ .It Dq 1
228
+ Hard link.
229
+ .It Dq 2
230
+ Symbolic link.
231
+ .It Dq 3
232
+ Character device node.
233
+ .It Dq 4
234
+ Block device node.
235
+ .It Dq 5
236
+ Directory.
237
+ .It Dq 6
238
+ FIFO node.
239
+ .It Dq 7
240
+ Reserved.
241
+ .It Other
242
+ A POSIX-compliant implementation must treat any unrecognized typeflag value
243
+ as a regular file.
244
+ In particular, writers should ensure that all entries
245
+ have a valid filename so that they can be restored by readers that do not
246
+ support the corresponding extension.
247
+ Uppercase letters "A" through "Z" are reserved for custom extensions.
248
+ Note that sockets and whiteout entries are not archivable.
249
+ .El
250
+ It is worth noting that the
251
+ .Va size
252
+ field, in particular, has different meanings depending on the type.
253
+ For regular files, of course, it indicates the amount of data
254
+ following the header.
255
+ For directories, it may be used to indicate the total size of all
256
+ files in the directory, for use by operating systems that pre-allocate
257
+ directory space.
258
+ For all other types, it should be set to zero by writers and ignored
259
+ by readers.
260
+ .It Va magic
261
+ Contains the magic value
262
+ .Dq ustar
263
+ followed by a NUL byte to indicate that this is a POSIX standard archive.
264
+ Full compliance requires the uname and gname fields be properly set.
265
+ .It Va version
266
+ Version.
267
+ This should be
268
+ .Dq 00
269
+ (two copies of the ASCII digit zero) for POSIX standard archives.
270
+ .It Va uname , Va gname
271
+ User and group names, as null-terminated ASCII strings.
272
+ These should be used in preference to the uid/gid values
273
+ when they are set and the corresponding names exist on
274
+ the system.
275
+ .It Va devmajor , Va devminor
276
+ Major and minor numbers for character device or block device entry.
277
+ .It Va name , Va prefix
278
+ If the pathname is too long to fit in the 100 bytes provided by the standard
279
+ format, it can be split at any
280
+ .Pa /
281
+ character with the first portion going into the prefix field.
282
+ If the prefix field is not empty, the reader will prepend
283
+ the prefix value and a
284
+ .Pa /
285
+ character to the regular name field to obtain the full pathname.
286
+ The standard does not require a trailing
287
+ .Pa /
288
+ character on directory names, though most implementations still
289
+ include this for compatibility reasons.
290
+ .El
291
+ .Pp
292
+ Note that all unused bytes must be set to
293
+ .Dv NUL .
294
+ .Pp
295
+ Field termination is specified slightly differently by POSIX
296
+ than by previous implementations.
297
+ The
298
+ .Va magic ,
299
+ .Va uname ,
300
+ and
301
+ .Va gname
302
+ fields must have a trailing
303
+ .Dv NUL .
304
+ The
305
+ .Va pathname ,
306
+ .Va linkname ,
307
+ and
308
+ .Va prefix
309
+ fields must have a trailing
310
+ .Dv NUL
311
+ unless they fill the entire field.
312
+ (In particular, it is possible to store a 256-character pathname if it
313
+ happens to have a
314
+ .Pa /
315
+ as the 156th character.)
316
+ POSIX requires numeric fields to be zero-padded in the front, and requires
317
+ them to be terminated with either space or
318
+ .Dv NUL
319
+ characters.
320
+ .Pp
321
+ Currently, most tar implementations comply with the ustar
322
+ format, occasionally extending it by adding new fields to the
323
+ blank area at the end of the header record.
324
+ .Ss Numeric Extensions
325
+ There have been several attempts to extend the range of sizes
326
+ or times supported by modifying how numbers are stored in the
327
+ header.
328
+ .Pp
329
+ One obvious extension to increase the size of files is to
330
+ eliminate the terminating characters from the various
331
+ numeric fields.
332
+ For example, the standard only allows the size field to contain
333
+ 11 octal digits, reserving the twelfth byte for a trailing
334
+ NUL character.
335
+ Allowing 12 octal digits allows file sizes up to 64 GB.
336
+ .Pp
337
+ Another extension, utilized by GNU tar, star, and other newer
338
+ .Nm
339
+ implementations, permits binary numbers in the standard numeric fields.
340
+ This is flagged by setting the high bit of the first byte.
341
+ The remainder of the field is treated as a signed twos-complement
342
+ value.
343
+ This permits 95-bit values for the length and time fields
344
+ and 63-bit values for the uid, gid, and device numbers.
345
+ In particular, this provides a consistent way to handle
346
+ negative time values.
347
+ GNU tar supports this extension for the
348
+ length, mtime, ctime, and atime fields.
349
+ Joerg Schilling's star program and the libarchive library support
350
+ this extension for all numeric fields.
351
+ Note that this extension is largely obsoleted by the extended
352
+ attribute record provided by the pax interchange format.
353
+ .Pp
354
+ Another early GNU extension allowed base-64 values rather than octal.
355
+ This extension was short-lived and is no longer supported by any
356
+ implementation.
357
+ .Ss Pax Interchange Format
358
+ There are many attributes that cannot be portably stored in a
359
+ POSIX ustar archive.
360
+ .St -p1003.1-2001
361
+ defined a
362
+ .Dq pax interchange format
363
+ that uses two new types of entries to hold text-formatted
364
+ metadata that applies to following entries.
365
+ Note that a pax interchange format archive is a ustar archive in every
366
+ respect.
367
+ The new data is stored in ustar-compatible archive entries that use the
368
+ .Dq x
369
+ or
370
+ .Dq g
371
+ typeflag.
372
+ In particular, older implementations that do not fully support these
373
+ extensions will extract the metadata into regular files, where the
374
+ metadata can be examined as necessary.
375
+ .Pp
376
+ An entry in a pax interchange format archive consists of one or
377
+ two standard ustar entries, each with its own header and data.
378
+ The first optional entry stores the extended attributes
379
+ for the following entry.
380
+ This optional first entry has an "x" typeflag and a size field that
381
+ indicates the total size of the extended attributes.
382
+ The extended attributes themselves are stored as a series of text-format
383
+ lines encoded in the portable UTF-8 encoding.
384
+ Each line consists of a decimal number, a space, a key string, an equals
385
+ sign, a value string, and a new line.
386
+ The decimal number indicates the length of the entire line, including the
387
+ initial length field and the trailing newline.
388
+ An example of such a field is:
389
+ .Dl 25 ctime=1084839148.1212\en
390
+ Keys in all lowercase are standard keys.
391
+ Vendors can add their own keys by prefixing them with an all uppercase
392
+ vendor name and a period.
393
+ Note that, unlike the historic header, numeric values are stored using
394
+ decimal, not octal.
395
+ A description of some common keys follows:
396
+ .Bl -tag -width indent
397
+ .It Cm atime , Cm ctime , Cm mtime
398
+ File access, inode change, and modification times.
399
+ These fields can be negative or include a decimal point and a fractional value.
400
+ .It Cm hdrcharset
401
+ The character set used by the pax extension values.
402
+ By default, all textual values in the pax extended attributes
403
+ are assumed to be in UTF-8, including pathnames, user names,
404
+ and group names.
405
+ In some cases, it is not possible to translate local
406
+ conventions into UTF-8.
407
+ If this key is present and the value is the six-character ASCII string
408
+ .Dq BINARY ,
409
+ then all textual values are assumed to be in a platform-dependent
410
+ multi-byte encoding.
411
+ Note that there are only two valid values for this key:
412
+ .Dq BINARY
413
+ or
414
+ .Dq ISO-IR\ 10646\ 2000\ UTF-8 .
415
+ No other values are permitted by the standard, and
416
+ the latter value should generally not be used as it is the
417
+ default when this key is not specified.
418
+ In particular, this flag should not be used as a general
419
+ mechanism to allow filenames to be stored in arbitrary
420
+ encodings.
421
+ .It Cm uname , Cm uid , Cm gname , Cm gid
422
+ User name, group name, and numeric UID and GID values.
423
+ The user name and group name stored here are encoded in UTF8
424
+ and can thus include non-ASCII characters.
425
+ The UID and GID fields can be of arbitrary length.
426
+ .It Cm linkpath
427
+ The full path of the linked-to file.
428
+ Note that this is encoded in UTF8 and can thus include non-ASCII characters.
429
+ .It Cm path
430
+ The full pathname of the entry.
431
+ Note that this is encoded in UTF8 and can thus include non-ASCII characters.
432
+ .It Cm realtime.* , Cm security.*
433
+ These keys are reserved and may be used for future standardization.
434
+ .It Cm size
435
+ The size of the file.
436
+ Note that there is no length limit on this field, allowing conforming
437
+ archives to store files much larger than the historic 8GB limit.
438
+ .It Cm SCHILY.*
439
+ Vendor-specific attributes used by Joerg Schilling's
440
+ .Nm star
441
+ implementation.
442
+ .It Cm SCHILY.acl.access , Cm SCHILY.acl.default , Cm SCHILY.acl.ace
443
+ Stores the access, default and NFSv4 ACLs as textual strings in a format
444
+ that is an extension of the format specified by POSIX.1e draft 17.
445
+ In particular, each user or group access specification can include
446
+ an additional colon-separated field with the numeric UID or GID.
447
+ This allows ACLs to be restored on systems that may not have complete
448
+ user or group information available (such as when NIS/YP or LDAP services
449
+ are temporarily unavailable).
450
+ .It Cm SCHILY.devminor , Cm SCHILY.devmajor
451
+ The full minor and major numbers for device nodes.
452
+ .It Cm SCHILY.fflags
453
+ The file flags.
454
+ .It Cm SCHILY.realsize
455
+ The full size of the file on disk.
456
+ XXX explain? XXX
457
+ .It Cm SCHILY.dev , Cm SCHILY.ino , Cm SCHILY.nlinks
458
+ The device number, inode number, and link count for the entry.
459
+ In particular, note that a pax interchange format archive using Joerg
460
+ Schilling's
461
+ .Cm SCHILY.*
462
+ extensions can store all of the data from
463
+ .Va struct stat .
464
+ .It Cm LIBARCHIVE.*
465
+ Vendor-specific attributes used by the
466
+ .Nm libarchive
467
+ library and programs that use it.
468
+ .It Cm LIBARCHIVE.creationtime
469
+ The time when the file was created.
470
+ (This should not be confused with the POSIX
471
+ .Dq ctime
472
+ attribute, which refers to the time when the file
473
+ metadata was last changed.)
474
+ .It Cm LIBARCHIVE.xattr . Ns Ar namespace . Ns Ar key
475
+ Libarchive stores POSIX.1e-style extended attributes using
476
+ keys of this form.
477
+ The
478
+ .Ar key
479
+ value is URL-encoded:
480
+ All non-ASCII characters and the two special characters
481
+ .Dq =
482
+ and
483
+ .Dq %
484
+ are encoded as
485
+ .Dq %
486
+ followed by two uppercase hexadecimal digits.
487
+ The value of this key is the extended attribute value
488
+ encoded in base 64.
489
+ XXX Detail the base-64 format here XXX
490
+ .It Cm VENDOR.*
491
+ XXX document other vendor-specific extensions XXX
492
+ .El
493
+ .Pp
494
+ Any values stored in an extended attribute override the corresponding
495
+ values in the regular tar header.
496
+ Note that compliant readers should ignore the regular fields when they
497
+ are overridden.
498
+ This is important, as existing archivers are known to store non-compliant
499
+ values in the standard header fields in this situation.
500
+ There are no limits on length for any of these fields.
501
+ In particular, numeric fields can be arbitrarily large.
502
+ All text fields are encoded in UTF8.
503
+ Compliant writers should store only portable 7-bit ASCII characters in
504
+ the standard ustar header and use extended
505
+ attributes whenever a text value contains non-ASCII characters.
506
+ .Pp
507
+ In addition to the
508
+ .Cm x
509
+ entry described above, the pax interchange format
510
+ also supports a
511
+ .Cm g
512
+ entry.
513
+ The
514
+ .Cm g
515
+ entry is identical in format, but specifies attributes that serve as
516
+ defaults for all subsequent archive entries.
517
+ The
518
+ .Cm g
519
+ entry is not widely used.
520
+ .Pp
521
+ Besides the new
522
+ .Cm x
523
+ and
524
+ .Cm g
525
+ entries, the pax interchange format has a few other minor variations
526
+ from the earlier ustar format.
527
+ The most troubling one is that hardlinks are permitted to have
528
+ data following them.
529
+ This allows readers to restore any hardlink to a file without
530
+ having to rewind the archive to find an earlier entry.
531
+ However, it creates complications for robust readers, as it is no longer
532
+ clear whether or not they should ignore the size field for hardlink entries.
533
+ .Ss GNU Tar Archives
534
+ The GNU tar program started with a pre-POSIX format similar to that
535
+ described earlier and has extended it using several different mechanisms:
536
+ It added new fields to the empty space in the header (some of which was later
537
+ used by POSIX for conflicting purposes);
538
+ it allowed the header to be continued over multiple records;
539
+ and it defined new entries that modify following entries
540
+ (similar in principle to the
541
+ .Cm x
542
+ entry described above, but each GNU special entry is single-purpose,
543
+ unlike the general-purpose
544
+ .Cm x
545
+ entry).
546
+ As a result, GNU tar archives are not POSIX compatible, although
547
+ more lenient POSIX-compliant readers can successfully extract most
548
+ GNU tar archives.
549
+ .Bd -literal -offset indent
550
+ struct header_gnu_tar {
551
+ char name[100];
552
+ char mode[8];
553
+ char uid[8];
554
+ char gid[8];
555
+ char size[12];
556
+ char mtime[12];
557
+ char checksum[8];
558
+ char typeflag[1];
559
+ char linkname[100];
560
+ char magic[6];
561
+ char version[2];
562
+ char uname[32];
563
+ char gname[32];
564
+ char devmajor[8];
565
+ char devminor[8];
566
+ char atime[12];
567
+ char ctime[12];
568
+ char offset[12];
569
+ char longnames[4];
570
+ char unused[1];
571
+ struct {
572
+ char offset[12];
573
+ char numbytes[12];
574
+ } sparse[4];
575
+ char isextended[1];
576
+ char realsize[12];
577
+ char pad[17];
578
+ };
579
+ .Ed
580
+ .Bl -tag -width indent
581
+ .It Va typeflag
582
+ GNU tar uses the following special entry types, in addition to
583
+ those defined by POSIX:
584
+ .Bl -tag -width indent
585
+ .It "7"
586
+ GNU tar treats type "7" records identically to type "0" records,
587
+ except on one obscure RTOS where they are used to indicate the
588
+ pre-allocation of a contiguous file on disk.
589
+ .It "D"
590
+ This indicates a directory entry.
591
+ Unlike the POSIX-standard "5"
592
+ typeflag, the header is followed by data records listing the names
593
+ of files in this directory.
594
+ Each name is preceded by an ASCII "Y"
595
+ if the file is stored in this archive or "N" if the file is not
596
+ stored in this archive.
597
+ Each name is terminated with a null, and
598
+ an extra null marks the end of the name list.
599
+ The purpose of this
600
+ entry is to support incremental backups; a program restoring from
601
+ such an archive may wish to delete files on disk that did not exist
602
+ in the directory when the archive was made.
603
+ .Pp
604
+ Note that the "D" typeflag specifically violates POSIX, which requires
605
+ that unrecognized typeflags be restored as normal files.
606
+ In this case, restoring the "D" entry as a file could interfere
607
+ with subsequent creation of the like-named directory.
608
+ .It "K"
609
+ The data for this entry is a long linkname for the following regular entry.
610
+ .It "L"
611
+ The data for this entry is a long pathname for the following regular entry.
612
+ .It "M"
613
+ This is a continuation of the last file on the previous volume.
614
+ GNU multi-volume archives guarantee that each volume begins with a valid
615
+ entry header.
616
+ To ensure this, a file may be split, with part stored at the end of one volume,
617
+ and part stored at the beginning of the next volume.
618
+ The "M" typeflag indicates that this entry continues an existing file.
619
+ Such entries can only occur as the first or second entry
620
+ in an archive (the latter only if the first entry is a volume label).
621
+ The
622
+ .Va size
623
+ field specifies the size of this entry.
624
+ The
625
+ .Va offset
626
+ field at bytes 369-380 specifies the offset where this file fragment
627
+ begins.
628
+ The
629
+ .Va realsize
630
+ field specifies the total size of the file (which must equal
631
+ .Va size
632
+ plus
633
+ .Va offset ) .
634
+ When extracting, GNU tar checks that the header file name is the one it is
635
+ expecting, that the header offset is in the correct sequence, and that
636
+ the sum of offset and size is equal to realsize.
637
+ .It "N"
638
+ Type "N" records are no longer generated by GNU tar.
639
+ They contained a
640
+ list of files to be renamed or symlinked after extraction; this was
641
+ originally used to support long names.
642
+ The contents of this record
643
+ are a text description of the operations to be done, in the form
644
+ .Dq Rename %s to %s\en
645
+ or
646
+ .Dq Symlink %s to %s\en ;
647
+ in either case, both
648
+ filenames are escaped using K&R C syntax.
649
+ Due to security concerns, "N" records are now generally ignored
650
+ when reading archives.
651
+ .It "S"
652
+ This is a
653
+ .Dq sparse
654
+ regular file.
655
+ Sparse files are stored as a series of fragments.
656
+ The header contains a list of fragment offset/length pairs.
657
+ If more than four such entries are required, the header is
658
+ extended as necessary with
659
+ .Dq extra
660
+ header extensions (an older format that is no longer used), or
661
+ .Dq sparse
662
+ extensions.
663
+ .It "V"
664
+ The
665
+ .Va name
666
+ field should be interpreted as a tape/volume header name.
667
+ This entry should generally be ignored on extraction.
668
+ .El
669
+ .It Va magic
670
+ The magic field holds the five characters
671
+ .Dq ustar
672
+ followed by a space.
673
+ Note that POSIX ustar archives have a trailing null.
674
+ .It Va version
675
+ The version field holds a space character followed by a null.
676
+ Note that POSIX ustar archives use two copies of the ASCII digit
677
+ .Dq 0 .
678
+ .It Va atime , Va ctime
679
+ The time the file was last accessed and the time of
680
+ last change of file information, stored in octal as with
681
+ .Va mtime .
682
+ .It Va longnames
683
+ This field is apparently no longer used.
684
+ .It Sparse Va offset / Va numbytes
685
+ Each such structure specifies a single fragment of a sparse
686
+ file.
687
+ The two fields store values as octal numbers.
688
+ The fragments are each padded to a multiple of 512 bytes
689
+ in the archive.
690
+ On extraction, the list of fragments is collected from the
691
+ header (including any extension headers), and the data
692
+ is then read and written to the file at appropriate offsets.
693
+ .It Va isextended
694
+ If this is set to non-zero, the header will be followed by additional
695
+ .Dq sparse header
696
+ records.
697
+ Each such record contains information about as many as 21 additional
698
+ sparse blocks as shown here:
699
+ .Bd -literal -offset indent
700
+ struct gnu_sparse_header {
701
+ struct {
702
+ char offset[12];
703
+ char numbytes[12];
704
+ } sparse[21];
705
+ char isextended[1];
706
+ char padding[7];
707
+ };
708
+ .Ed
709
+ .It Va realsize
710
+ A binary representation of the file's complete size, with a much larger range
711
+ than the POSIX file size.
712
+ In particular, with
713
+ .Cm M
714
+ type files, the current entry is only a portion of the file.
715
+ In that case, the POSIX size field will indicate the size of this
716
+ entry; the
717
+ .Va realsize
718
+ field will indicate the total size of the file.
719
+ .El
720
+ .Ss GNU tar pax archives
721
+ GNU tar 1.14 (XXX check this XXX) and later will write
722
+ pax interchange format archives when you specify the
723
+ .Fl -posix
724
+ flag.
725
+ This format follows the pax interchange format closely,
726
+ using some
727
+ .Cm SCHILY
728
+ tags and introducing new keywords to store sparse file information.
729
+ There have been three iterations of the sparse file support, referred to
730
+ as
731
+ .Dq 0.0 ,
732
+ .Dq 0.1 ,
733
+ and
734
+ .Dq 1.0 .
735
+ .Bl -tag -width indent
736
+ .It Cm GNU.sparse.numblocks , Cm GNU.sparse.offset , Cm GNU.sparse.numbytes , Cm GNU.sparse.size
737
+ The
738
+ .Dq 0.0
739
+ format used an initial
740
+ .Cm GNU.sparse.numblocks
741
+ attribute to indicate the number of blocks in the file, a pair of
742
+ .Cm GNU.sparse.offset
743
+ and
744
+ .Cm GNU.sparse.numbytes
745
+ to indicate the offset and size of each block,
746
+ and a single
747
+ .Cm GNU.sparse.size
748
+ to indicate the full size of the file.
749
+ This is not the same as the size in the tar header because the
750
+ latter value does not include the size of any holes.
751
+ This format required that the order of attributes be preserved and
752
+ relied on readers accepting multiple appearances of the same attribute
753
+ names, which is not officially permitted by the standards.
754
+ .It Cm GNU.sparse.map
755
+ The
756
+ .Dq 0.1
757
+ format used a single attribute that stored a comma-separated
758
+ list of decimal numbers.
759
+ Each pair of numbers indicated the offset and size, respectively,
760
+ of a block of data.
761
+ This does not work well if the archive is extracted by an archiver
762
+ that does not recognize this extension, since many pax implementations
763
+ simply discard unrecognized attributes.
764
+ .It Cm GNU.sparse.major , Cm GNU.sparse.minor , Cm GNU.sparse.name , Cm GNU.sparse.realsize
765
+ The
766
+ .Dq 1.0
767
+ format stores the sparse block map in one or more 512-byte blocks
768
+ prepended to the file data in the entry body.
769
+ The pax attributes indicate the existence of this map
770
+ (via the
771
+ .Cm GNU.sparse.major
772
+ and
773
+ .Cm GNU.sparse.minor
774
+ fields)
775
+ and the full size of the file.
776
+ The
777
+ .Cm GNU.sparse.name
778
+ holds the true name of the file.
779
+ To avoid confusion, the name stored in the regular tar header
780
+ is a modified name so that extraction errors will be apparent
781
+ to users.
782
+ .El
783
+ .Ss Solaris Tar
784
+ XXX More Details Needed XXX
785
+ .Pp
786
+ Solaris tar (beginning with SunOS XXX 5.7 ?? XXX) supports an
787
+ .Dq extended
788
+ format that is fundamentally similar to pax interchange format,
789
+ with the following differences:
790
+ .Bl -bullet -compact -width indent
791
+ .It
792
+ Extended attributes are stored in an entry whose type is
793
+ .Cm X ,
794
+ not
795
+ .Cm x ,
796
+ as used by pax interchange format.
797
+ The detailed format of this entry appears to be the same
798
+ as detailed above for the
799
+ .Cm x
800
+ entry.
801
+ .It
802
+ An additional
803
+ .Cm A
804
+ header is used to store an ACL for the following regular entry.
805
+ The body of this entry contains a seven-digit octal number
806
+ followed by a zero byte, followed by the
807
+ textual ACL description.
808
+ The octal value is the number of ACL entries
809
+ plus a constant that indicates the ACL type: 01000000
810
+ for POSIX.1e ACLs and 03000000 for NFSv4 ACLs.
811
+ .El
812
+ .Ss AIX Tar
813
+ XXX More details needed XXX
814
+ .Pp
815
+ AIX Tar uses a ustar-formatted header with the type
816
+ .Cm A
817
+ for storing coded ACL information.
818
+ Unlike the Solaris format, AIX tar writes this header after the
819
+ regular file body to which it applies.
820
+ The pathname in this header is either
821
+ .Cm NFS4
822
+ or
823
+ .Cm AIXC
824
+ to indicate the type of ACL stored.
825
+ The actual ACL is stored in platform-specific binary format.
826
+ .Ss Mac OS X Tar
827
+ The tar distributed with Apple's Mac OS X stores most regular files
828
+ as two separate files in the tar archive.
829
+ The two files have the same name except that the first
830
+ one has
831
+ .Dq ._
832
+ prepended to the last path element.
833
+ This special file stores an AppleDouble-encoded
834
+ binary blob with additional metadata about the second file,
835
+ including ACL, extended attributes, and resources.
836
+ To recreate the original file on disk, each
837
+ separate file can be extracted and the Mac OS X
838
+ .Fn copyfile
839
+ function can be used to unpack the separate
840
+ metadata file and apply it to th regular file.
841
+ Conversely, the same function provides a
842
+ .Dq pack
843
+ option to encode the extended metadata from
844
+ a file into a separate file whose contents
845
+ can then be put into a tar archive.
846
+ .Pp
847
+ Note that the Apple extended attributes interact
848
+ badly with long filenames.
849
+ Since each file is stored with the full name,
850
+ a separate set of extensions needs to be included
851
+ in the archive for each one, doubling the overhead
852
+ required for files with long names.
853
+ .Ss Summary of tar type codes
854
+ The following list is a condensed summary of the type codes
855
+ used in tar header records generated by different tar implementations.
856
+ More details about specific implementations can be found above:
857
+ .Bl -tag -compact -width XXX
858
+ .It NUL
859
+ Early tar programs stored a zero byte for regular files.
860
+ .It Cm 0
861
+ POSIX standard type code for a regular file.
862
+ .It Cm 1
863
+ POSIX standard type code for a hard link description.
864
+ .It Cm 2
865
+ POSIX standard type code for a symbolic link description.
866
+ .It Cm 3
867
+ POSIX standard type code for a character device node.
868
+ .It Cm 4
869
+ POSIX standard type code for a block device node.
870
+ .It Cm 5
871
+ POSIX standard type code for a directory.
872
+ .It Cm 6
873
+ POSIX standard type code for a FIFO.
874
+ .It Cm 7
875
+ POSIX reserved.
876
+ .It Cm 7
877
+ GNU tar used for pre-allocated files on some systems.
878
+ .It Cm A
879
+ Solaris tar ACL description stored prior to a regular file header.
880
+ .It Cm A
881
+ AIX tar ACL description stored after the file body.
882
+ .It Cm D
883
+ GNU tar directory dump.
884
+ .It Cm K
885
+ GNU tar long linkname for the following header.
886
+ .It Cm L
887
+ GNU tar long pathname for the following header.
888
+ .It Cm M
889
+ GNU tar multivolume marker, indicating the file is a continuation of a file from the previous volume.
890
+ .It Cm N
891
+ GNU tar long filename support.
892
+ Deprecated.
893
+ .It Cm S
894
+ GNU tar sparse regular file.
895
+ .It Cm V
896
+ GNU tar tape/volume header name.
897
+ .It Cm X
898
+ Solaris tar general-purpose extension header.
899
+ .It Cm g
900
+ POSIX pax interchange format global extensions.
901
+ .It Cm x
902
+ POSIX pax interchange format per-file extensions.
903
+ .El
904
+ .Sh SEE ALSO
905
+ .Xr ar 1 ,
906
+ .Xr pax 1 ,
907
+ .Xr tar 1
908
+ .Sh STANDARDS
909
+ The
910
+ .Nm tar
911
+ utility is no longer a part of POSIX or the Single Unix Standard.
912
+ It last appeared in
913
+ .St -susv2 .
914
+ It has been supplanted in subsequent standards by
915
+ .Xr pax 1 .
916
+ The ustar format is currently part of the specification for the
917
+ .Xr pax 1
918
+ utility.
919
+ The pax interchange file format is new with
920
+ .St -p1003.1-2001 .
921
+ .Sh HISTORY
922
+ A
923
+ .Nm tar
924
+ command appeared in Seventh Edition Unix, which was released in January, 1979.
925
+ It replaced the
926
+ .Nm tp
927
+ program from Fourth Edition Unix which in turn replaced the
928
+ .Nm tap
929
+ program from First Edition Unix.
930
+ John Gilmore's
931
+ .Nm pdtar
932
+ public-domain implementation (circa 1987) was highly influential
933
+ and formed the basis of
934
+ .Nm GNU tar
935
+ (circa 1988).
936
+ Joerg Shilling's
937
+ .Nm star
938
+ archiver is another open-source (CDDL) archiver (originally developed
939
+ circa 1985) which features complete support for pax interchange
940
+ format.
941
+ .Pp
942
+ This documentation was written as part of the
943
+ .Nm libarchive
944
+ and
945
+ .Nm bsdtar
946
+ project by
947
+ .An Tim Kientzle Aq kientzle@FreeBSD.org .