libarchive_changes.3 10.0 KB

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