libarchive_changes.3 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. .\" Copyright (c) 2011 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. .Dd December 23, 2011
  26. .Dt LIBARCHIVE_CHANGES 3
  27. .Os
  28. .Sh NAME
  29. .Nm libarchive_changes
  30. .Nd changes in libarchive interface
  31. .\"
  32. .Sh CHANGES IN LIBARCHIVE 3
  33. This page describes user-visible changes in libarchive3, and lists
  34. public functions and other symbols changed, deprecated or removed
  35. in libarchive3, along with their replacements if any.
  36. .\"
  37. .Ss Multiple Filters
  38. .\"
  39. Libarchive2 permitted a single (input or output) filter active
  40. on an archive.
  41. Libarchive3 extends this into a variable-length stack.
  42. Where
  43. .Fn archive_write_set_compression_XXX
  44. would replace any existing filter,
  45. .Fn archive_write_add_filter_XXX
  46. extends the write pipeline with another filter.
  47. .\"
  48. .Ss Character Set Handling
  49. .\"
  50. Libarchive2 assumed that the local platform uses
  51. .Tn Unicode
  52. as the native
  53. .Tn wchar_t
  54. encoding, which is true on
  55. .Tn Windows ,
  56. modern
  57. .Tn Linux ,
  58. and a few other systems, but is certainly not universal.
  59. As a result, pax format archives were written incorrectly on some
  60. systems, since pax format requires
  61. .Tn UTF-8
  62. and libarchive 2 incorrectly
  63. assumed that
  64. .Tn wchar_t
  65. strings can be easily converted to
  66. .Tn UTF-8 .
  67. .Pp
  68. Libarchive3 uses the standard iconv library to convert between character
  69. sets and is introducing the notion of a
  70. .Dq default character set for the archive .
  71. To support this,
  72. .Tn archive_entry
  73. objects can now be bound to a particular archive when they are created.
  74. The automatic character set conversions performed by
  75. .Tn archive_entry
  76. objects when reading and writing filenames, usernames, and other strings
  77. will now use an appropriate default character set:
  78. .Pp
  79. If the
  80. .Tn archive_entry
  81. object is bound to an archive, it will use the
  82. default character set for that archive.
  83. .Pp
  84. The platform default character encoding (as returned by
  85. .Fn nl_langinfo CHARSET )
  86. will be used if nothing else is specified.
  87. .Pp
  88. Libarchive3 also introduces charset options to many of the archive
  89. readers and writers to control the character set that will be used for
  90. filenames written in those archives.
  91. When possible, this will be set automatically based on information in
  92. the archive itself.
  93. Combining this with the notion of a default character set for the
  94. archive should allow you to configure libarchive to read archives from
  95. other platforms and have the filenames and other information
  96. transparently converted to the character encoding suitable for your
  97. application.
  98. .\"
  99. .Ss Prototype Changes
  100. .\"
  101. These changes break binary compatibility; libarchive3 has a new shared
  102. library version to reflect these changes.
  103. The library now uses portable wide types such as
  104. .Tn int64_t
  105. instead of less-portable types such as
  106. .Tn off_t ,
  107. .Tn gid_t ,
  108. .Tn uid_t ,
  109. and
  110. .Tn ino_t .
  111. .Pp
  112. There are a few cases where these changes will affect your source code:
  113. .Bl -bullet -width ind
  114. .It
  115. In some cases, libarchive's wider types will introduce the possibility
  116. of truncation: for example, on a system with a 16-bit
  117. .Tn uid_t , you risk having uid
  118. .Li 65536
  119. be truncated to uid
  120. .Li 0 ,
  121. which can cause serious security problems.
  122. .It
  123. Typedef function pointer types will be incompatible.
  124. For example, if you define custom skip callbacks, you may have to use
  125. code similar to the following if you want to support building against
  126. libarchive2 and libarchive3:
  127. .Bd -literal
  128. #if ARCHIVE_VERSION_NUMBER < 3000000
  129. typedef off_t myoff_t;
  130. #else
  131. typedef int64_t myoff_t;
  132. #endif
  133. myoff_t
  134. my_skip_function(struct archive *a, void *v, myoff_t o)
  135. {
  136. ... implementation ...
  137. }
  138. .Ed
  139. .El
  140. .Pp
  141. Affected functions:
  142. .Pp
  143. .Bl -bullet -compact
  144. .It
  145. .Xo
  146. .Fn archive_entry_gid ,
  147. .Fn archive_entry_set_gid
  148. .Xc
  149. .It
  150. .Xo
  151. .Fn archive_entry_uid ,
  152. .Fn archive_entry_set_uid
  153. .Xc
  154. .It
  155. .Xo
  156. .Fn archive_entry_ino ,
  157. .Fn archive_entry_set_ino
  158. .Xc
  159. .It
  160. .Xo
  161. .Fn archive_read_data_block ,
  162. .Fn archive_write_data_block
  163. .Xc
  164. .It
  165. .Xo
  166. .Fn archive_read_disk_gname ,
  167. .Fn archive_read_disk_uname
  168. .Xc
  169. .It
  170. .Xo
  171. .Fn archive_read_disk_set_gname_lookup ,
  172. .Fn archive_read_disk_set_group_lookup ,
  173. .Fn archive_read_disk_set_uname_lookup ,
  174. .Fn archive_read_disk_set_user_lookup
  175. .Xc
  176. .It
  177. .Fn archive_skip_callback
  178. .It
  179. .Xo
  180. .Fn archive_read_extract_set_skip_file ,
  181. .Fn archive_write_disk_set_skip_file ,
  182. .Fn archive_write_set_skip_file
  183. .Xc
  184. .It
  185. .Xo
  186. .Fn archive_write_disk_set_group_lookup ,
  187. .Fn archive_write_disk_set_user_lookup
  188. .Xc
  189. .El
  190. .Pp
  191. Where these functions or their arguments took or returned
  192. .Tn gid_t ,
  193. .Tn ino_t ,
  194. .Tn off_t ,
  195. or
  196. .Tn uid_t
  197. they now take or return
  198. .Tn int64_t
  199. or equivalent.
  200. .\"
  201. .Ss Deprecated Symbols
  202. .\"
  203. Symbols deprecated in libarchive3 will be removed in libarchive4.
  204. These symbols, along with their replacements if any, are listed below:
  205. .\"
  206. .Bl -tag -width ind
  207. .It Fn archive_position_compressed , Fn archive_position_uncompressed
  208. .Fn archive_filter_bytes
  209. .It Fn archive_compression
  210. .Fn archive_filter_code
  211. .It Fn archive_compression_name
  212. .Fn archive_filter_name
  213. .It Fn archive_read_finish , Fn archive_write_finish
  214. .Fn archive_read_free ,
  215. .Fn archive_write_free
  216. .It Fn archive_read_open_file , Fn archive_write_open_file
  217. .Fn archive_read_open_filename ,
  218. .Fn archive_write_open_filename
  219. .It Fn archive_read_support_compression_all
  220. .\" archive_read_support_compression_* -> archive_read_support_filter_*
  221. .Fn archive_read_support_filter_all
  222. .It Fn archive_read_support_compression_bzip2
  223. .Fn archive_read_support_filter_bzip2
  224. .It Fn archive_read_support_compression_compress
  225. .Fn archive_read_support_filter_compress
  226. .It Fn archive_read_support_compression_gzip
  227. .Fn archive_read_support_filter_gzip
  228. .It Fn archive_read_support_compression_lzip
  229. .Fn archive_read_support_filter_lzip
  230. .It Fn archive_read_support_compression_lzma
  231. .Fn archive_read_support_filter_lzma
  232. .It Fn archive_read_support_compression_none
  233. .Fn archive_read_support_filter_none
  234. .It Fn archive_read_support_compression_program
  235. .Fn archive_read_support_filter_program
  236. .It Fn archive_read_support_compression_program_signature
  237. .Fn archive_read_support_filter_program_signature
  238. .It Fn archive_read_support_compression_rpm
  239. .Fn archive_read_support_filter_rpm
  240. .It Fn archive_read_support_compression_uu
  241. .Fn archive_read_support_filter_uu
  242. .It Fn archive_read_support_compression_xz
  243. .Fn archive_read_support_filter_xz
  244. .\" archive_write_set_compression_* -> archive_write_add_filter_*
  245. .It Fn archive_write_set_compression_bzip2
  246. .Fn archive_write_add_filter_bzip2
  247. .It Fn archive_write_set_compression_compress
  248. .Fn archive_write_add_filter_compress
  249. .It Fn archive_write_set_compression_gzip
  250. .Fn archive_write_add_filter_gzip
  251. .It Fn archive_write_set_compression_lzip
  252. .Fn archive_write_add_filter_lzip
  253. .It Fn archive_write_set_compression_lzma
  254. .Fn archive_write_add_filter_lzma
  255. .It Fn archive_write_set_compression_none
  256. .Fn archive_write_add_filter_none
  257. .It Fn archive_write_set_compression_program
  258. .Fn archive_write_add_filter_program
  259. .It Fn archive_write_set_compression_filter
  260. .Fn archive_write_add_filter_filter
  261. .El
  262. .\"
  263. .Ss Removed Symbols
  264. .\"
  265. These symbols, listed below along with their replacements if any,
  266. were deprecated in libarchive2, and are not part of libarchive3.
  267. .\"
  268. .Bl -tag -width ind
  269. .It Fn archive_api_feature
  270. .Fn archive_version_number
  271. .It Fn archive_api_version
  272. .Fn archive_version_number
  273. .It Fn archive_version
  274. .Fn archive_version_string
  275. .It Fn archive_version_stamp
  276. .Fn archive_version_number
  277. .It Fn archive_read_set_filter_options
  278. .Fn archive_read_set_options
  279. or
  280. .Fn archive_read_set_filter_option
  281. .It Fn archive_read_set_format_options
  282. .Fn archive_read_set_options
  283. or
  284. .Fn archive_read_set_format_option
  285. .It Fn archive_write_set_filter_options
  286. .Fn archive_write_set_options
  287. or
  288. .Fn archive_write_set_filter_option
  289. .It Fn archive_write_set_format_options
  290. .Fn archive_write_set_options
  291. or
  292. .Fn archive_write_set_format_option
  293. .It Dv ARCHIVE_API_FEATURE
  294. .Dv ARCHIVE_VERSION_NUMBER
  295. .It Dv ARCHIVE_API_VERSION
  296. .Dv ARCHIVE_VERSION_NUMBER
  297. .It Dv ARCHIVE_VERSION_STAMP
  298. .Dv ARCHIVE_VERSION_NUMBER
  299. .It Dv ARCHIVE_LIBRARY_VERSION
  300. .Dv ARCHIVE_VERSION_STRING
  301. .\"
  302. .It Dv ARCHIVE_COMPRESSION_NONE
  303. .Dv ARCHIVE_FILTER_NONE
  304. .It Dv ARCHIVE_COMPRESSION_GZIP
  305. .Dv ARCHIVE_FILTER_GZIP
  306. .It Dv ARCHIVE_COMPRESSION_BZIP2
  307. .Dv ARCHIVE_FILTER_BZIP2
  308. .It Dv ARCHIVE_COMPRESSION_COMPRESS
  309. .Dv ARCHIVE_FILTER_COMPRESS
  310. .It Dv ARCHIVE_COMPRESSION_PROGRAM
  311. .Dv ARCHIVE_FILTER_PROGRAM
  312. .It Dv ARCHIVE_COMPRESSION_LZMA
  313. .Dv ARCHIVE_FILTER_LZMA
  314. .It Dv ARCHIVE_COMPRESSION_XZ
  315. .Dv ARCHIVE_FILTER_XZ
  316. .It Dv ARCHIVE_COMPRESSION_UU
  317. .Dv ARCHIVE_FILTER_UU
  318. .It Dv ARCHIVE_COMPRESSION_RPM
  319. .Dv ARCHIVE_FILTER_RPM
  320. .It Dv ARCHIVE_COMPRESSION_LZIP
  321. .Dv ARCHIVE_FILTER_LZIP
  322. .\"
  323. .It Dv ARCHIVE_BYTES_PER_RECORD
  324. .Li 512
  325. .It Dv ARCHIVE_DEFAULT_BYTES_PER_BLOCK
  326. .Li 10240
  327. .El
  328. .Sh SEE ALSO
  329. .Xr archive_read 3 ,
  330. .Xr archive_read_filter 3 ,
  331. .Xr archive_read_format 3 ,
  332. .Xr archive_read_set_options 3 ,
  333. .Xr archive_util 3 ,
  334. .Xr archive_write 3 ,
  335. .Xr archive_write_filter 3 ,
  336. .Xr archive_write_format 3 ,
  337. .Xr archive_write_set_options 3 ,
  338. .Xr libarchive 3