libarchive_changes.3 10.0 KB

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