libarchive-static 1.0.5 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ext/extconf.rb +2 -9
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.c +6 -6
- data/ext/libarchive-0.1.1/ext/archive_read_support_compression.o +0 -0
- data/ext/libarchive-0.1.1/ext/archive_read_support_format.o +0 -0
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.c +1 -1
- data/ext/libarchive-0.1.1/ext/archive_write_open_rb_str.o +0 -0
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.c +5 -5
- data/ext/libarchive-0.1.1/ext/archive_write_set_compression.o +0 -0
- data/ext/libarchive-0.1.1/ext/config.h +23 -0
- data/ext/libarchive-0.1.1/ext/config.log +230 -0
- data/ext/libarchive-0.1.1/ext/config.status +671 -0
- data/ext/libarchive-0.1.1/ext/libarchive.c +1 -1
- data/ext/libarchive-0.1.1/ext/libarchive.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_archive.c +7 -7
- data/ext/libarchive-0.1.1/ext/libarchive_archive.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_entry.c +6 -0
- data/ext/libarchive-0.1.1/ext/libarchive_entry.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_internal.h +0 -1
- data/ext/libarchive-0.1.1/ext/libarchive_reader.c +6 -4
- data/ext/libarchive-0.1.1/ext/libarchive_reader.o +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_ruby.so +0 -0
- data/ext/libarchive-0.1.1/ext/libarchive_win32.h +1 -1
- data/ext/libarchive-0.1.1/ext/libarchive_writer.c +2 -2
- data/ext/libarchive-0.1.1/ext/libarchive_writer.o +0 -0
- data/ext/libarchive-3.6.2/Makefile.in +16892 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_append_compile_flags.m4 +67 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_append_flag.m4 +71 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_check_compile_flag.m4 +74 -0
- data/ext/libarchive-3.6.2/build/autoconf/ax_require_defined.m4 +37 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/check_stdcall_func.m4 +0 -0
- data/ext/libarchive-3.6.2/build/autoconf/compile +348 -0
- data/ext/libarchive-3.6.2/build/autoconf/config.guess +1754 -0
- data/ext/libarchive-3.6.2/build/autoconf/config.rpath +696 -0
- data/ext/libarchive-3.6.2/build/autoconf/config.sub +1890 -0
- data/ext/libarchive-3.6.2/build/autoconf/depcomp +791 -0
- data/ext/libarchive-3.6.2/build/autoconf/iconv.m4 +271 -0
- data/ext/libarchive-3.6.2/build/autoconf/install-sh +541 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/autoconf/la_uid_t.m4 +0 -0
- data/ext/libarchive-3.6.2/build/autoconf/lib-ld.m4 +109 -0
- data/ext/libarchive-3.6.2/build/autoconf/lib-link.m4 +777 -0
- data/ext/libarchive-3.6.2/build/autoconf/lib-prefix.m4 +224 -0
- data/ext/libarchive-3.6.2/build/autoconf/ltmain.sh +11251 -0
- data/ext/libarchive-3.6.2/build/autoconf/m4_ax_compile_check_sizeof.m4 +115 -0
- data/ext/libarchive-3.6.2/build/autoconf/missing +215 -0
- data/ext/libarchive-3.6.2/build/autoconf/test-driver +153 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/build/pkgconfig/libarchive.pc.in +4 -1
- data/ext/libarchive-3.6.2/config.h.in +1504 -0
- data/ext/libarchive-3.6.2/configure +25558 -0
- data/ext/libarchive-3.6.2/libarchive/archive.h +1212 -0
- data/ext/libarchive-3.6.2/libarchive/archive_acl.c +2097 -0
- data/ext/libarchive-3.6.2/libarchive/archive_acl_private.h +83 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2.h +197 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2_impl.h +161 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2s_ref.c +369 -0
- data/ext/libarchive-3.6.2/libarchive/archive_blake2sp_ref.c +361 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_check_magic.c +63 -22
- data/ext/libarchive-3.6.2/libarchive/archive_cmdline.c +227 -0
- data/ext/libarchive-3.6.2/libarchive/archive_cmdline_private.h +47 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_crc32.h +17 -0
- data/ext/libarchive-3.6.2/libarchive/archive_cryptor.c +534 -0
- data/ext/libarchive-3.6.2/libarchive/archive_cryptor_private.h +188 -0
- data/ext/libarchive-3.6.2/libarchive/archive_digest.c +1505 -0
- data/ext/libarchive-3.6.2/libarchive/archive_digest_private.h +416 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_darwin.c +559 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_freebsd.c +712 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_linux.c +760 -0
- data/ext/libarchive-3.6.2/libarchive/archive_disk_acl_sunos.c +824 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_endian.h +48 -15
- data/ext/libarchive-3.6.2/libarchive/archive_entry.c +2149 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry.h +305 -106
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_bhfi.c +5 -4
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_copy_stat.c +9 -3
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_link_resolver.c +104 -62
- data/ext/libarchive-3.6.2/libarchive/archive_entry_locale.h +92 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_private.h +65 -49
- data/ext/libarchive-3.6.2/libarchive/archive_entry_sparse.c +156 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_stat.c +6 -6
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_strmode.c +1 -1
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_entry_xattr.c +4 -6
- data/ext/libarchive-3.6.2/libarchive/archive_getdate.c +1165 -0
- data/ext/libarchive-3.6.2/libarchive/archive_getdate.h +39 -0
- data/ext/libarchive-3.6.2/libarchive/archive_hmac.c +334 -0
- data/ext/libarchive-3.6.2/libarchive/archive_hmac_private.h +117 -0
- data/ext/libarchive-3.6.2/libarchive/archive_match.c +1875 -0
- data/ext/libarchive-3.6.2/libarchive/archive_openssl_evp_private.h +53 -0
- data/ext/libarchive-3.6.2/libarchive/archive_openssl_hmac_private.h +54 -0
- data/ext/libarchive-3.6.2/libarchive/archive_options.c +218 -0
- data/ext/libarchive-3.6.2/libarchive/archive_options_private.h +51 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.c +337 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pack_dev.h +49 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.c +463 -0
- data/ext/libarchive-3.6.2/libarchive/archive_pathmatch.h +52 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_platform.h +77 -9
- data/ext/libarchive-3.6.2/libarchive/archive_platform_acl.h +55 -0
- data/ext/libarchive-3.6.2/libarchive/archive_platform_xattr.h +47 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd7.c +1168 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd7_private.h +119 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd8.c +1287 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd8_private.h +148 -0
- data/ext/libarchive-3.6.2/libarchive/archive_ppmd_private.h +151 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_private.h +74 -18
- data/ext/libarchive-3.6.2/libarchive/archive_random.c +272 -0
- data/ext/libarchive-3.6.2/libarchive/archive_random_private.h +36 -0
- data/ext/libarchive-3.6.2/libarchive/archive_rb.c +709 -0
- data/ext/libarchive-3.6.2/libarchive/archive_rb.h +113 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read.c +1756 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_add_passphrase.c +190 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_append_filter.c +204 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_data_into_fd.c +64 -18
- data/ext/libarchive-3.6.2/libarchive/archive_read_disk_entry_from_file.c +1086 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_disk_posix.c +2732 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_private.h +40 -4
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_disk_set_standard_lookup.c +21 -11
- data/ext/libarchive-3.6.2/libarchive/archive_read_disk_windows.c +2479 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_extract.c +60 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_extract.c → libarchive-3.6.2/libarchive/archive_read_extract2.c} +34 -61
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_fd.c +70 -49
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_file.c +38 -23
- data/ext/libarchive-3.6.2/libarchive/archive_read_open_filename.c +586 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_open_memory.c +58 -28
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_private.h +127 -59
- data/ext/libarchive-3.6.2/libarchive/archive_read_set_format.c +117 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_set_options.c +133 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_all.c → libarchive-3.6.2/libarchive/archive_read_support_filter_all.c} +35 -10
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_by_code.c +83 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_bzip2.c → libarchive-3.6.2/libarchive/archive_read_support_filter_bzip2.c} +38 -26
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_compress.c → libarchive-3.6.2/libarchive/archive_read_support_filter_compress.c} +52 -44
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_grzip.c +112 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_gzip.c → libarchive-3.6.2/libarchive/archive_read_support_filter_gzip.c} +108 -37
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lrzip.c +122 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lz4.c +742 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_lzop.c +499 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_none.c → libarchive-3.6.2/libarchive/archive_read_support_filter_none.c} +15 -3
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_program.c → libarchive-3.6.2/libarchive/archive_read_support_filter_program.c} +114 -77
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_rpm.c → libarchive-3.6.2/libarchive/archive_read_support_filter_rpm.c} +31 -31
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_uu.c → libarchive-3.6.2/libarchive/archive_read_support_filter_uu.c} +141 -85
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_compression_xz.c → libarchive-3.6.2/libarchive/archive_read_support_filter_xz.c} +369 -284
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_filter_zstd.c +297 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_7zip.c +3900 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_all.c +89 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_ar.c +126 -72
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_by_code.c +92 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cab.c +3228 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_cpio.c +1104 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_empty.c +14 -11
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_iso9660.c +990 -541
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_lha.c +2916 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_mtree.c +2150 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar.c +3797 -0
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_rar5.c +4251 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_raw.c +38 -31
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_tar.c +1157 -629
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_warc.c +848 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_read_support_format_xar.c +439 -258
- data/ext/libarchive-3.6.2/libarchive/archive_read_support_format_zip.c +4270 -0
- data/ext/libarchive-3.6.2/libarchive/archive_string.c +4240 -0
- data/ext/libarchive-3.6.2/libarchive/archive_string.h +243 -0
- data/ext/libarchive-3.6.2/libarchive/archive_string_composition.h +2292 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_string_sprintf.c +44 -16
- data/ext/libarchive-3.6.2/libarchive/archive_util.c +655 -0
- data/ext/libarchive-3.6.2/libarchive/archive_version_details.c +151 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_virtual.c +85 -16
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.c +214 -541
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_windows.h +74 -106
- data/ext/libarchive-3.6.2/libarchive/archive_write.c +828 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter.c +72 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_b64encode.c +304 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_by_name.c +77 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_bzip2.c +401 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_write_set_compression_compress.c → libarchive-3.6.2/libarchive/archive_write_add_filter_compress.c} +86 -131
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_grzip.c +135 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_gzip.c +442 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lrzip.c +197 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lz4.c +700 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_lzop.c +478 -0
- data/ext/{libarchive-2.8.4/libarchive/archive_read_support_format_all.c → libarchive-3.6.2/libarchive/archive_write_add_filter_none.c} +11 -11
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_program.c +391 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_uuencode.c +295 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_xz.c +545 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_add_filter_zstd.c +418 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_disk_posix.c +4711 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_private.h +9 -2
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_disk_set_standard_lookup.c +30 -29
- data/ext/libarchive-3.6.2/libarchive/archive_write_disk_windows.c +2842 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_fd.c +15 -10
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_file.c +15 -9
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_filename.c +128 -20
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_open_memory.c +7 -18
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_private.h +72 -29
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format.c +56 -3
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_7zip.c +2322 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ar.c +54 -34
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_by_name.c +20 -2
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio.c +11 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_binary.c +610 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_newc.c +457 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_cpio_odc.c +500 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_filter_by_ext.c +142 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_gnutar.c +755 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_iso9660.c +8165 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_mtree.c +2217 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_pax.c +1049 -387
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_private.h +42 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_raw.c +125 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_shar.c +62 -47
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/archive_write_set_format_ustar.c +279 -108
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_v7tar.c +638 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_warc.c +453 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_xar.c +3259 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_format_zip.c +1704 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_options.c +130 -0
- data/ext/libarchive-3.6.2/libarchive/archive_write_set_passphrase.c +95 -0
- data/ext/libarchive-3.6.2/libarchive/archive_xxhash.h +48 -0
- data/ext/libarchive-3.6.2/libarchive/config_freebsd.h +271 -0
- data/ext/{libarchive-2.8.4 → libarchive-3.6.2}/libarchive/filter_fork.h +10 -5
- data/ext/{libarchive-2.8.4/libarchive/filter_fork.c → libarchive-3.6.2/libarchive/filter_fork_posix.c} +98 -19
- data/ext/libarchive-3.6.2/libarchive/filter_fork_windows.c +236 -0
- data/ext/libarchive-3.6.2/libarchive/xxhash.c +525 -0
- data/ext/libarchive-static-makefile +144 -80
- data/ext/libarchive-static-wrapper-makefile +1 -1
- data/ext/zlib-1.2.13/Makefile.in +404 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/adler32.c +51 -34
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/compress.c +27 -21
- data/ext/zlib-1.2.13/configure +922 -0
- data/ext/zlib-1.2.13/crc32.c +1125 -0
- data/ext/zlib-1.2.13/crc32.h +9446 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.c +842 -459
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/deflate.h +37 -33
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzclose.c +0 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzguts.h +103 -16
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/gzlib.c +155 -53
- data/ext/zlib-1.2.13/gzread.c +650 -0
- data/ext/zlib-1.2.13/gzwrite.c +677 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/infback.c +24 -12
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.c +49 -66
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffast.h +0 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inffixed.h +3 -3
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.c +209 -94
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inflate.h +9 -5
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.c +24 -50
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/inftrees.h +1 -1
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.c +135 -198
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/trees.h +0 -0
- data/ext/zlib-1.2.13/uncompr.c +93 -0
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zconf.h +182 -63
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zlib.h +617 -295
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.c +50 -41
- data/ext/{zlib-1.2.5 → zlib-1.2.13}/zutil.h +83 -82
- metadata +244 -137
- data/ext/libarchive-0.1.1/libarchive.c +0 -1762
- data/ext/libarchive-2.8.4/Makefile.in +0 -7076
- data/ext/libarchive-2.8.4/build/autoconf/compile +0 -143
- data/ext/libarchive-2.8.4/build/autoconf/config.guess +0 -1502
- data/ext/libarchive-2.8.4/build/autoconf/config.sub +0 -1708
- data/ext/libarchive-2.8.4/build/autoconf/depcomp +0 -630
- data/ext/libarchive-2.8.4/build/autoconf/install-sh +0 -291
- data/ext/libarchive-2.8.4/build/autoconf/ltmain.sh +0 -8406
- data/ext/libarchive-2.8.4/build/autoconf/missing +0 -376
- data/ext/libarchive-2.8.4/config.h.in +0 -772
- data/ext/libarchive-2.8.4/configure +0 -17916
- data/ext/libarchive-2.8.4/libarchive/archive.h +0 -741
- data/ext/libarchive-2.8.4/libarchive/archive_entry.c +0 -2202
- data/ext/libarchive-2.8.4/libarchive/archive_hash.h +0 -281
- data/ext/libarchive-2.8.4/libarchive/archive_read.c +0 -1249
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk.c +0 -198
- data/ext/libarchive-2.8.4/libarchive/archive_read_disk_entry_from_file.c +0 -570
- data/ext/libarchive-2.8.4/libarchive/archive_read_open_filename.c +0 -272
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_cpio.c +0 -777
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_mtree.c +0 -1304
- data/ext/libarchive-2.8.4/libarchive/archive_read_support_format_zip.c +0 -903
- data/ext/libarchive-2.8.4/libarchive/archive_string.c +0 -453
- data/ext/libarchive-2.8.4/libarchive/archive_string.h +0 -148
- data/ext/libarchive-2.8.4/libarchive/archive_util.c +0 -391
- data/ext/libarchive-2.8.4/libarchive/archive_write.c +0 -466
- data/ext/libarchive-2.8.4/libarchive/archive_write_disk.c +0 -2628
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_bzip2.c +0 -408
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_gzip.c +0 -477
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_none.c +0 -257
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_program.c +0 -347
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_compression_xz.c +0 -438
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio.c +0 -344
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_cpio_newc.c +0 -295
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_mtree.c +0 -1050
- data/ext/libarchive-2.8.4/libarchive/archive_write_set_format_zip.c +0 -667
- data/ext/libarchive-2.8.4/libarchive/config_freebsd.h +0 -154
- data/ext/libarchive-2.8.4/libarchive/filter_fork_windows.c +0 -113
- data/ext/zlib-1.2.5/Makefile.in +0 -257
- data/ext/zlib-1.2.5/configure +0 -596
- data/ext/zlib-1.2.5/crc32.c +0 -442
- data/ext/zlib-1.2.5/crc32.h +0 -441
- data/ext/zlib-1.2.5/example.c +0 -565
- data/ext/zlib-1.2.5/gzread.c +0 -653
- data/ext/zlib-1.2.5/gzwrite.c +0 -531
- data/ext/zlib-1.2.5/minigzip.c +0 -440
- data/ext/zlib-1.2.5/uncompr.c +0 -59
@@ -0,0 +1,755 @@
|
|
1
|
+
/*-
|
2
|
+
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
3
|
+
* Author: Jonas Gastal <jgastal@profusion.mobi>
|
4
|
+
* Copyright (c) 2011-2012 Michihiro NAKAJIMA
|
5
|
+
*
|
6
|
+
* All rights reserved.
|
7
|
+
*
|
8
|
+
* Redistribution and use in source and binary forms, with or without
|
9
|
+
* modification, are permitted provided that the following conditions
|
10
|
+
* are met:
|
11
|
+
* 1. Redistributions of source code must retain the above copyright
|
12
|
+
* notice, this list of conditions and the following disclaimer.
|
13
|
+
* 2. Redistributions in binary form must reproduce the above copyright
|
14
|
+
* notice, this list of conditions and the following disclaimer in the
|
15
|
+
* documentation and/or other materials provided with the distribution.
|
16
|
+
*
|
17
|
+
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
|
18
|
+
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
19
|
+
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
20
|
+
* IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
|
21
|
+
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
22
|
+
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
23
|
+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
24
|
+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
25
|
+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
26
|
+
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
27
|
+
*/
|
28
|
+
|
29
|
+
#include "archive_platform.h"
|
30
|
+
__FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_gnu_tar.c 191579 2009-04-27 18:35:03Z gastal $");
|
31
|
+
|
32
|
+
|
33
|
+
#ifdef HAVE_ERRNO_H
|
34
|
+
#include <errno.h>
|
35
|
+
#endif
|
36
|
+
#include <stdio.h>
|
37
|
+
#ifdef HAVE_STDLIB_H
|
38
|
+
#include <stdlib.h>
|
39
|
+
#endif
|
40
|
+
#ifdef HAVE_STRING_H
|
41
|
+
#include <string.h>
|
42
|
+
#endif
|
43
|
+
|
44
|
+
#include "archive.h"
|
45
|
+
#include "archive_entry.h"
|
46
|
+
#include "archive_entry_locale.h"
|
47
|
+
#include "archive_private.h"
|
48
|
+
#include "archive_write_private.h"
|
49
|
+
#include "archive_write_set_format_private.h"
|
50
|
+
|
51
|
+
struct gnutar {
|
52
|
+
uint64_t entry_bytes_remaining;
|
53
|
+
uint64_t entry_padding;
|
54
|
+
const char * linkname;
|
55
|
+
size_t linkname_length;
|
56
|
+
const char * pathname;
|
57
|
+
size_t pathname_length;
|
58
|
+
const char * uname;
|
59
|
+
size_t uname_length;
|
60
|
+
const char * gname;
|
61
|
+
size_t gname_length;
|
62
|
+
struct archive_string_conv *opt_sconv;
|
63
|
+
struct archive_string_conv *sconv_default;
|
64
|
+
int init_default_conversion;
|
65
|
+
};
|
66
|
+
|
67
|
+
/*
|
68
|
+
* Define structure of GNU tar header.
|
69
|
+
*/
|
70
|
+
#define GNUTAR_name_offset 0
|
71
|
+
#define GNUTAR_name_size 100
|
72
|
+
#define GNUTAR_mode_offset 100
|
73
|
+
#define GNUTAR_mode_size 7
|
74
|
+
#define GNUTAR_mode_max_size 8
|
75
|
+
#define GNUTAR_uid_offset 108
|
76
|
+
#define GNUTAR_uid_size 7
|
77
|
+
#define GNUTAR_uid_max_size 8
|
78
|
+
#define GNUTAR_gid_offset 116
|
79
|
+
#define GNUTAR_gid_size 7
|
80
|
+
#define GNUTAR_gid_max_size 8
|
81
|
+
#define GNUTAR_size_offset 124
|
82
|
+
#define GNUTAR_size_size 11
|
83
|
+
#define GNUTAR_size_max_size 12
|
84
|
+
#define GNUTAR_mtime_offset 136
|
85
|
+
#define GNUTAR_mtime_size 11
|
86
|
+
#define GNUTAR_mtime_max_size 11
|
87
|
+
#define GNUTAR_checksum_offset 148
|
88
|
+
#define GNUTAR_checksum_size 8
|
89
|
+
#define GNUTAR_typeflag_offset 156
|
90
|
+
#define GNUTAR_typeflag_size 1
|
91
|
+
#define GNUTAR_linkname_offset 157
|
92
|
+
#define GNUTAR_linkname_size 100
|
93
|
+
#define GNUTAR_magic_offset 257
|
94
|
+
#define GNUTAR_magic_size 6
|
95
|
+
#define GNUTAR_version_offset 263
|
96
|
+
#define GNUTAR_version_size 2
|
97
|
+
#define GNUTAR_uname_offset 265
|
98
|
+
#define GNUTAR_uname_size 32
|
99
|
+
#define GNUTAR_gname_offset 297
|
100
|
+
#define GNUTAR_gname_size 32
|
101
|
+
#define GNUTAR_rdevmajor_offset 329
|
102
|
+
#define GNUTAR_rdevmajor_size 6
|
103
|
+
#define GNUTAR_rdevmajor_max_size 8
|
104
|
+
#define GNUTAR_rdevminor_offset 337
|
105
|
+
#define GNUTAR_rdevminor_size 6
|
106
|
+
#define GNUTAR_rdevminor_max_size 8
|
107
|
+
|
108
|
+
/*
|
109
|
+
* A filled-in copy of the header for initialization.
|
110
|
+
*/
|
111
|
+
static const char template_header[] = {
|
112
|
+
/* name: 100 bytes */
|
113
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
114
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
115
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
116
|
+
0,0,0,0,
|
117
|
+
/* Mode, null termination: 8 bytes */
|
118
|
+
'0','0','0','0','0','0', '0','\0',
|
119
|
+
/* uid, null termination: 8 bytes */
|
120
|
+
'0','0','0','0','0','0', '0','\0',
|
121
|
+
/* gid, null termination: 8 bytes */
|
122
|
+
'0','0','0','0','0','0', '0','\0',
|
123
|
+
/* size, space termination: 12 bytes */
|
124
|
+
'0','0','0','0','0','0','0','0','0','0','0', '\0',
|
125
|
+
/* mtime, space termination: 12 bytes */
|
126
|
+
'0','0','0','0','0','0','0','0','0','0','0', '\0',
|
127
|
+
/* Initial checksum value: 8 spaces */
|
128
|
+
' ',' ',' ',' ',' ',' ',' ',' ',
|
129
|
+
/* Typeflag: 1 byte */
|
130
|
+
'0', /* '0' = regular file */
|
131
|
+
/* Linkname: 100 bytes */
|
132
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
133
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
134
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
135
|
+
0,0,0,0,
|
136
|
+
/* Magic: 8 bytes */
|
137
|
+
'u','s','t','a','r',' ', ' ','\0',
|
138
|
+
/* Uname: 32 bytes */
|
139
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
140
|
+
/* Gname: 32 bytes */
|
141
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
142
|
+
/* rdevmajor + null padding: 8 bytes */
|
143
|
+
'\0','\0','\0','\0','\0','\0', '\0','\0',
|
144
|
+
/* rdevminor + null padding: 8 bytes */
|
145
|
+
'\0','\0','\0','\0','\0','\0', '\0','\0',
|
146
|
+
/* Padding: 167 bytes */
|
147
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
148
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
149
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
150
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
151
|
+
0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
|
152
|
+
0,0,0,0,0,0,0
|
153
|
+
};
|
154
|
+
|
155
|
+
static int archive_write_gnutar_options(struct archive_write *,
|
156
|
+
const char *, const char *);
|
157
|
+
static int archive_format_gnutar_header(struct archive_write *, char h[512],
|
158
|
+
struct archive_entry *, int tartype);
|
159
|
+
static int archive_write_gnutar_header(struct archive_write *,
|
160
|
+
struct archive_entry *entry);
|
161
|
+
static ssize_t archive_write_gnutar_data(struct archive_write *a, const void *buff,
|
162
|
+
size_t s);
|
163
|
+
static int archive_write_gnutar_free(struct archive_write *);
|
164
|
+
static int archive_write_gnutar_close(struct archive_write *);
|
165
|
+
static int archive_write_gnutar_finish_entry(struct archive_write *);
|
166
|
+
static int format_256(int64_t, char *, int);
|
167
|
+
static int format_number(int64_t, char *, int size, int maxsize);
|
168
|
+
static int format_octal(int64_t, char *, int);
|
169
|
+
|
170
|
+
/*
|
171
|
+
* Set output format to 'GNU tar' format.
|
172
|
+
*/
|
173
|
+
int
|
174
|
+
archive_write_set_format_gnutar(struct archive *_a)
|
175
|
+
{
|
176
|
+
struct archive_write *a = (struct archive_write *)_a;
|
177
|
+
struct gnutar *gnutar;
|
178
|
+
|
179
|
+
gnutar = (struct gnutar *)calloc(1, sizeof(*gnutar));
|
180
|
+
if (gnutar == NULL) {
|
181
|
+
archive_set_error(&a->archive, ENOMEM,
|
182
|
+
"Can't allocate gnutar data");
|
183
|
+
return (ARCHIVE_FATAL);
|
184
|
+
}
|
185
|
+
a->format_data = gnutar;
|
186
|
+
a->format_name = "gnutar";
|
187
|
+
a->format_options = archive_write_gnutar_options;
|
188
|
+
a->format_write_header = archive_write_gnutar_header;
|
189
|
+
a->format_write_data = archive_write_gnutar_data;
|
190
|
+
a->format_close = archive_write_gnutar_close;
|
191
|
+
a->format_free = archive_write_gnutar_free;
|
192
|
+
a->format_finish_entry = archive_write_gnutar_finish_entry;
|
193
|
+
a->archive.archive_format = ARCHIVE_FORMAT_TAR_GNUTAR;
|
194
|
+
a->archive.archive_format_name = "GNU tar";
|
195
|
+
return (ARCHIVE_OK);
|
196
|
+
}
|
197
|
+
|
198
|
+
static int
|
199
|
+
archive_write_gnutar_options(struct archive_write *a, const char *key,
|
200
|
+
const char *val)
|
201
|
+
{
|
202
|
+
struct gnutar *gnutar = (struct gnutar *)a->format_data;
|
203
|
+
int ret = ARCHIVE_FAILED;
|
204
|
+
|
205
|
+
if (strcmp(key, "hdrcharset") == 0) {
|
206
|
+
if (val == NULL || val[0] == 0)
|
207
|
+
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
208
|
+
"%s: hdrcharset option needs a character-set name",
|
209
|
+
a->format_name);
|
210
|
+
else {
|
211
|
+
gnutar->opt_sconv = archive_string_conversion_to_charset(
|
212
|
+
&a->archive, val, 0);
|
213
|
+
if (gnutar->opt_sconv != NULL)
|
214
|
+
ret = ARCHIVE_OK;
|
215
|
+
else
|
216
|
+
ret = ARCHIVE_FATAL;
|
217
|
+
}
|
218
|
+
return (ret);
|
219
|
+
}
|
220
|
+
|
221
|
+
/* Note: The "warn" return is just to inform the options
|
222
|
+
* supervisor that we didn't handle it. It will generate
|
223
|
+
* a suitable error if no one used this option. */
|
224
|
+
return (ARCHIVE_WARN);
|
225
|
+
}
|
226
|
+
|
227
|
+
static int
|
228
|
+
archive_write_gnutar_close(struct archive_write *a)
|
229
|
+
{
|
230
|
+
return (__archive_write_nulls(a, 512*2));
|
231
|
+
}
|
232
|
+
|
233
|
+
static int
|
234
|
+
archive_write_gnutar_free(struct archive_write *a)
|
235
|
+
{
|
236
|
+
struct gnutar *gnutar;
|
237
|
+
|
238
|
+
gnutar = (struct gnutar *)a->format_data;
|
239
|
+
free(gnutar);
|
240
|
+
a->format_data = NULL;
|
241
|
+
return (ARCHIVE_OK);
|
242
|
+
}
|
243
|
+
|
244
|
+
static int
|
245
|
+
archive_write_gnutar_finish_entry(struct archive_write *a)
|
246
|
+
{
|
247
|
+
struct gnutar *gnutar;
|
248
|
+
int ret;
|
249
|
+
|
250
|
+
gnutar = (struct gnutar *)a->format_data;
|
251
|
+
ret = __archive_write_nulls(a, (size_t)
|
252
|
+
(gnutar->entry_bytes_remaining + gnutar->entry_padding));
|
253
|
+
gnutar->entry_bytes_remaining = gnutar->entry_padding = 0;
|
254
|
+
return (ret);
|
255
|
+
}
|
256
|
+
|
257
|
+
static ssize_t
|
258
|
+
archive_write_gnutar_data(struct archive_write *a, const void *buff, size_t s)
|
259
|
+
{
|
260
|
+
struct gnutar *gnutar;
|
261
|
+
int ret;
|
262
|
+
|
263
|
+
gnutar = (struct gnutar *)a->format_data;
|
264
|
+
if (s > gnutar->entry_bytes_remaining)
|
265
|
+
s = (size_t)gnutar->entry_bytes_remaining;
|
266
|
+
ret = __archive_write_output(a, buff, s);
|
267
|
+
gnutar->entry_bytes_remaining -= s;
|
268
|
+
if (ret != ARCHIVE_OK)
|
269
|
+
return (ret);
|
270
|
+
return (s);
|
271
|
+
}
|
272
|
+
|
273
|
+
static int
|
274
|
+
archive_write_gnutar_header(struct archive_write *a,
|
275
|
+
struct archive_entry *entry)
|
276
|
+
{
|
277
|
+
char buff[512];
|
278
|
+
int r, ret, ret2 = ARCHIVE_OK;
|
279
|
+
int tartype;
|
280
|
+
struct gnutar *gnutar;
|
281
|
+
struct archive_string_conv *sconv;
|
282
|
+
struct archive_entry *entry_main;
|
283
|
+
|
284
|
+
gnutar = (struct gnutar *)a->format_data;
|
285
|
+
|
286
|
+
/* Setup default string conversion. */
|
287
|
+
if (gnutar->opt_sconv == NULL) {
|
288
|
+
if (!gnutar->init_default_conversion) {
|
289
|
+
gnutar->sconv_default =
|
290
|
+
archive_string_default_conversion_for_write(
|
291
|
+
&(a->archive));
|
292
|
+
gnutar->init_default_conversion = 1;
|
293
|
+
}
|
294
|
+
sconv = gnutar->sconv_default;
|
295
|
+
} else
|
296
|
+
sconv = gnutar->opt_sconv;
|
297
|
+
|
298
|
+
/* Only regular files (not hardlinks) have data. */
|
299
|
+
if (archive_entry_hardlink(entry) != NULL ||
|
300
|
+
archive_entry_symlink(entry) != NULL ||
|
301
|
+
!(archive_entry_filetype(entry) == AE_IFREG))
|
302
|
+
archive_entry_set_size(entry, 0);
|
303
|
+
|
304
|
+
if (AE_IFDIR == archive_entry_filetype(entry)) {
|
305
|
+
const char *p;
|
306
|
+
size_t path_length;
|
307
|
+
/*
|
308
|
+
* Ensure a trailing '/'. Modify the entry so
|
309
|
+
* the client sees the change.
|
310
|
+
*/
|
311
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
312
|
+
const wchar_t *wp;
|
313
|
+
|
314
|
+
wp = archive_entry_pathname_w(entry);
|
315
|
+
if (wp != NULL && wp[wcslen(wp) -1] != L'/') {
|
316
|
+
struct archive_wstring ws;
|
317
|
+
|
318
|
+
archive_string_init(&ws);
|
319
|
+
path_length = wcslen(wp);
|
320
|
+
if (archive_wstring_ensure(&ws,
|
321
|
+
path_length + 2) == NULL) {
|
322
|
+
archive_set_error(&a->archive, ENOMEM,
|
323
|
+
"Can't allocate ustar data");
|
324
|
+
archive_wstring_free(&ws);
|
325
|
+
return(ARCHIVE_FATAL);
|
326
|
+
}
|
327
|
+
/* Should we keep '\' ? */
|
328
|
+
if (wp[path_length -1] == L'\\')
|
329
|
+
path_length--;
|
330
|
+
archive_wstrncpy(&ws, wp, path_length);
|
331
|
+
archive_wstrappend_wchar(&ws, L'/');
|
332
|
+
archive_entry_copy_pathname_w(entry, ws.s);
|
333
|
+
archive_wstring_free(&ws);
|
334
|
+
p = NULL;
|
335
|
+
} else
|
336
|
+
#endif
|
337
|
+
p = archive_entry_pathname(entry);
|
338
|
+
/*
|
339
|
+
* On Windows, this is a backup operation just in
|
340
|
+
* case getting WCS failed. On POSIX, this is a
|
341
|
+
* normal operation.
|
342
|
+
*/
|
343
|
+
if (p != NULL && p[0] != '\0' && p[strlen(p) - 1] != '/') {
|
344
|
+
struct archive_string as;
|
345
|
+
|
346
|
+
archive_string_init(&as);
|
347
|
+
path_length = strlen(p);
|
348
|
+
if (archive_string_ensure(&as,
|
349
|
+
path_length + 2) == NULL) {
|
350
|
+
archive_set_error(&a->archive, ENOMEM,
|
351
|
+
"Can't allocate ustar data");
|
352
|
+
archive_string_free(&as);
|
353
|
+
return(ARCHIVE_FATAL);
|
354
|
+
}
|
355
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
356
|
+
/* NOTE: This might break the pathname
|
357
|
+
* if the current code page is CP932 and
|
358
|
+
* the pathname includes a character '\'
|
359
|
+
* as a part of its multibyte pathname. */
|
360
|
+
if (p[strlen(p) -1] == '\\')
|
361
|
+
path_length--;
|
362
|
+
else
|
363
|
+
#endif
|
364
|
+
archive_strncpy(&as, p, path_length);
|
365
|
+
archive_strappend_char(&as, '/');
|
366
|
+
archive_entry_copy_pathname(entry, as.s);
|
367
|
+
archive_string_free(&as);
|
368
|
+
}
|
369
|
+
}
|
370
|
+
|
371
|
+
#if defined(_WIN32) && !defined(__CYGWIN__)
|
372
|
+
/* Make sure the path separators in pathname, hardlink and symlink
|
373
|
+
* are all slash '/', not the Windows path separator '\'. */
|
374
|
+
entry_main = __la_win_entry_in_posix_pathseparator(entry);
|
375
|
+
if (entry_main == NULL) {
|
376
|
+
archive_set_error(&a->archive, ENOMEM,
|
377
|
+
"Can't allocate ustar data");
|
378
|
+
return(ARCHIVE_FATAL);
|
379
|
+
}
|
380
|
+
if (entry != entry_main)
|
381
|
+
entry = entry_main;
|
382
|
+
else
|
383
|
+
entry_main = NULL;
|
384
|
+
#else
|
385
|
+
entry_main = NULL;
|
386
|
+
#endif
|
387
|
+
r = archive_entry_pathname_l(entry, &(gnutar->pathname),
|
388
|
+
&(gnutar->pathname_length), sconv);
|
389
|
+
if (r != 0) {
|
390
|
+
if (errno == ENOMEM) {
|
391
|
+
archive_set_error(&a->archive, ENOMEM,
|
392
|
+
"Can't allocate memory for Pathame");
|
393
|
+
ret = ARCHIVE_FATAL;
|
394
|
+
goto exit_write_header;
|
395
|
+
}
|
396
|
+
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
|
397
|
+
"Can't translate pathname '%s' to %s",
|
398
|
+
archive_entry_pathname(entry),
|
399
|
+
archive_string_conversion_charset_name(sconv));
|
400
|
+
ret2 = ARCHIVE_WARN;
|
401
|
+
}
|
402
|
+
r = archive_entry_uname_l(entry, &(gnutar->uname),
|
403
|
+
&(gnutar->uname_length), sconv);
|
404
|
+
if (r != 0) {
|
405
|
+
if (errno == ENOMEM) {
|
406
|
+
archive_set_error(&a->archive, ENOMEM,
|
407
|
+
"Can't allocate memory for Uname");
|
408
|
+
ret = ARCHIVE_FATAL;
|
409
|
+
goto exit_write_header;
|
410
|
+
}
|
411
|
+
archive_set_error(&a->archive,
|
412
|
+
ARCHIVE_ERRNO_FILE_FORMAT,
|
413
|
+
"Can't translate uname '%s' to %s",
|
414
|
+
archive_entry_uname(entry),
|
415
|
+
archive_string_conversion_charset_name(sconv));
|
416
|
+
ret2 = ARCHIVE_WARN;
|
417
|
+
}
|
418
|
+
r = archive_entry_gname_l(entry, &(gnutar->gname),
|
419
|
+
&(gnutar->gname_length), sconv);
|
420
|
+
if (r != 0) {
|
421
|
+
if (errno == ENOMEM) {
|
422
|
+
archive_set_error(&a->archive, ENOMEM,
|
423
|
+
"Can't allocate memory for Gname");
|
424
|
+
ret = ARCHIVE_FATAL;
|
425
|
+
goto exit_write_header;
|
426
|
+
}
|
427
|
+
archive_set_error(&a->archive,
|
428
|
+
ARCHIVE_ERRNO_FILE_FORMAT,
|
429
|
+
"Can't translate gname '%s' to %s",
|
430
|
+
archive_entry_gname(entry),
|
431
|
+
archive_string_conversion_charset_name(sconv));
|
432
|
+
ret2 = ARCHIVE_WARN;
|
433
|
+
}
|
434
|
+
|
435
|
+
/* If linkname is longer than 100 chars we need to add a 'K' header. */
|
436
|
+
r = archive_entry_hardlink_l(entry, &(gnutar->linkname),
|
437
|
+
&(gnutar->linkname_length), sconv);
|
438
|
+
if (r != 0) {
|
439
|
+
if (errno == ENOMEM) {
|
440
|
+
archive_set_error(&a->archive, ENOMEM,
|
441
|
+
"Can't allocate memory for Linkname");
|
442
|
+
ret = ARCHIVE_FATAL;
|
443
|
+
goto exit_write_header;
|
444
|
+
}
|
445
|
+
archive_set_error(&a->archive,
|
446
|
+
ARCHIVE_ERRNO_FILE_FORMAT,
|
447
|
+
"Can't translate linkname '%s' to %s",
|
448
|
+
archive_entry_hardlink(entry),
|
449
|
+
archive_string_conversion_charset_name(sconv));
|
450
|
+
ret2 = ARCHIVE_WARN;
|
451
|
+
}
|
452
|
+
if (gnutar->linkname_length == 0) {
|
453
|
+
r = archive_entry_symlink_l(entry, &(gnutar->linkname),
|
454
|
+
&(gnutar->linkname_length), sconv);
|
455
|
+
if (r != 0) {
|
456
|
+
if (errno == ENOMEM) {
|
457
|
+
archive_set_error(&a->archive, ENOMEM,
|
458
|
+
"Can't allocate memory for Linkname");
|
459
|
+
ret = ARCHIVE_FATAL;
|
460
|
+
goto exit_write_header;
|
461
|
+
}
|
462
|
+
archive_set_error(&a->archive,
|
463
|
+
ARCHIVE_ERRNO_FILE_FORMAT,
|
464
|
+
"Can't translate linkname '%s' to %s",
|
465
|
+
archive_entry_hardlink(entry),
|
466
|
+
archive_string_conversion_charset_name(sconv));
|
467
|
+
ret2 = ARCHIVE_WARN;
|
468
|
+
}
|
469
|
+
}
|
470
|
+
if (gnutar->linkname_length > GNUTAR_linkname_size) {
|
471
|
+
size_t length = gnutar->linkname_length + 1;
|
472
|
+
struct archive_entry *temp = archive_entry_new2(&a->archive);
|
473
|
+
|
474
|
+
/* Uname/gname here don't really matter since no one reads them;
|
475
|
+
* these are the values that GNU tar happens to use on FreeBSD. */
|
476
|
+
archive_entry_set_uname(temp, "root");
|
477
|
+
archive_entry_set_gname(temp, "wheel");
|
478
|
+
|
479
|
+
archive_entry_set_pathname(temp, "././@LongLink");
|
480
|
+
archive_entry_set_size(temp, length);
|
481
|
+
ret = archive_format_gnutar_header(a, buff, temp, 'K');
|
482
|
+
archive_entry_free(temp);
|
483
|
+
if (ret < ARCHIVE_WARN)
|
484
|
+
goto exit_write_header;
|
485
|
+
ret = __archive_write_output(a, buff, 512);
|
486
|
+
if (ret < ARCHIVE_WARN)
|
487
|
+
goto exit_write_header;
|
488
|
+
/* Write name and trailing null byte. */
|
489
|
+
ret = __archive_write_output(a, gnutar->linkname, length);
|
490
|
+
if (ret < ARCHIVE_WARN)
|
491
|
+
goto exit_write_header;
|
492
|
+
/* Pad to 512 bytes */
|
493
|
+
ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)length));
|
494
|
+
if (ret < ARCHIVE_WARN)
|
495
|
+
goto exit_write_header;
|
496
|
+
}
|
497
|
+
|
498
|
+
/* If pathname is longer than 100 chars we need to add an 'L' header. */
|
499
|
+
if (gnutar->pathname_length > GNUTAR_name_size) {
|
500
|
+
const char *pathname = gnutar->pathname;
|
501
|
+
size_t length = gnutar->pathname_length + 1;
|
502
|
+
struct archive_entry *temp = archive_entry_new2(&a->archive);
|
503
|
+
|
504
|
+
/* Uname/gname here don't really matter since no one reads them;
|
505
|
+
* these are the values that GNU tar happens to use on FreeBSD. */
|
506
|
+
archive_entry_set_uname(temp, "root");
|
507
|
+
archive_entry_set_gname(temp, "wheel");
|
508
|
+
|
509
|
+
archive_entry_set_pathname(temp, "././@LongLink");
|
510
|
+
archive_entry_set_size(temp, length);
|
511
|
+
ret = archive_format_gnutar_header(a, buff, temp, 'L');
|
512
|
+
archive_entry_free(temp);
|
513
|
+
if (ret < ARCHIVE_WARN)
|
514
|
+
goto exit_write_header;
|
515
|
+
ret = __archive_write_output(a, buff, 512);
|
516
|
+
if(ret < ARCHIVE_WARN)
|
517
|
+
goto exit_write_header;
|
518
|
+
/* Write pathname + trailing null byte. */
|
519
|
+
ret = __archive_write_output(a, pathname, length);
|
520
|
+
if(ret < ARCHIVE_WARN)
|
521
|
+
goto exit_write_header;
|
522
|
+
/* Pad to multiple of 512 bytes. */
|
523
|
+
ret = __archive_write_nulls(a, 0x1ff & (-(ssize_t)length));
|
524
|
+
if (ret < ARCHIVE_WARN)
|
525
|
+
goto exit_write_header;
|
526
|
+
}
|
527
|
+
|
528
|
+
if (archive_entry_hardlink(entry) != NULL) {
|
529
|
+
tartype = '1';
|
530
|
+
} else
|
531
|
+
switch (archive_entry_filetype(entry)) {
|
532
|
+
case AE_IFREG: tartype = '0' ; break;
|
533
|
+
case AE_IFLNK: tartype = '2' ; break;
|
534
|
+
case AE_IFCHR: tartype = '3' ; break;
|
535
|
+
case AE_IFBLK: tartype = '4' ; break;
|
536
|
+
case AE_IFDIR: tartype = '5' ; break;
|
537
|
+
case AE_IFIFO: tartype = '6' ; break;
|
538
|
+
default: /* AE_IFSOCK and unknown */
|
539
|
+
__archive_write_entry_filetype_unsupported(
|
540
|
+
&a->archive, entry, "gnutar");
|
541
|
+
ret = ARCHIVE_FAILED;
|
542
|
+
goto exit_write_header;
|
543
|
+
}
|
544
|
+
|
545
|
+
ret = archive_format_gnutar_header(a, buff, entry, tartype);
|
546
|
+
if (ret < ARCHIVE_WARN)
|
547
|
+
goto exit_write_header;
|
548
|
+
if (ret2 < ret)
|
549
|
+
ret = ret2;
|
550
|
+
ret2 = __archive_write_output(a, buff, 512);
|
551
|
+
if (ret2 < ARCHIVE_WARN) {
|
552
|
+
ret = ret2;
|
553
|
+
goto exit_write_header;
|
554
|
+
}
|
555
|
+
if (ret2 < ret)
|
556
|
+
ret = ret2;
|
557
|
+
|
558
|
+
gnutar->entry_bytes_remaining = archive_entry_size(entry);
|
559
|
+
gnutar->entry_padding = 0x1ff & (-(int64_t)gnutar->entry_bytes_remaining);
|
560
|
+
exit_write_header:
|
561
|
+
archive_entry_free(entry_main);
|
562
|
+
return (ret);
|
563
|
+
}
|
564
|
+
|
565
|
+
static int
|
566
|
+
archive_format_gnutar_header(struct archive_write *a, char h[512],
|
567
|
+
struct archive_entry *entry, int tartype)
|
568
|
+
{
|
569
|
+
unsigned int checksum;
|
570
|
+
int i, ret;
|
571
|
+
size_t copy_length;
|
572
|
+
const char *p;
|
573
|
+
struct gnutar *gnutar;
|
574
|
+
|
575
|
+
gnutar = (struct gnutar *)a->format_data;
|
576
|
+
|
577
|
+
ret = 0;
|
578
|
+
|
579
|
+
/*
|
580
|
+
* The "template header" already includes the signature,
|
581
|
+
* various end-of-field markers, and other required elements.
|
582
|
+
*/
|
583
|
+
memcpy(h, &template_header, 512);
|
584
|
+
|
585
|
+
/*
|
586
|
+
* Because the block is already null-filled, and strings
|
587
|
+
* are allowed to exactly fill their destination (without null),
|
588
|
+
* I use memcpy(dest, src, strlen()) here a lot to copy strings.
|
589
|
+
*/
|
590
|
+
|
591
|
+
if (tartype == 'K' || tartype == 'L') {
|
592
|
+
p = archive_entry_pathname(entry);
|
593
|
+
copy_length = strlen(p);
|
594
|
+
} else {
|
595
|
+
p = gnutar->pathname;
|
596
|
+
copy_length = gnutar->pathname_length;
|
597
|
+
}
|
598
|
+
if (copy_length > GNUTAR_name_size)
|
599
|
+
copy_length = GNUTAR_name_size;
|
600
|
+
memcpy(h + GNUTAR_name_offset, p, copy_length);
|
601
|
+
|
602
|
+
if ((copy_length = gnutar->linkname_length) > 0) {
|
603
|
+
if (copy_length > GNUTAR_linkname_size)
|
604
|
+
copy_length = GNUTAR_linkname_size;
|
605
|
+
memcpy(h + GNUTAR_linkname_offset, gnutar->linkname,
|
606
|
+
copy_length);
|
607
|
+
}
|
608
|
+
|
609
|
+
/* TODO: How does GNU tar handle unames longer than GNUTAR_uname_size? */
|
610
|
+
if (tartype == 'K' || tartype == 'L') {
|
611
|
+
p = archive_entry_uname(entry);
|
612
|
+
copy_length = strlen(p);
|
613
|
+
} else {
|
614
|
+
p = gnutar->uname;
|
615
|
+
copy_length = gnutar->uname_length;
|
616
|
+
}
|
617
|
+
if (copy_length > 0) {
|
618
|
+
if (copy_length > GNUTAR_uname_size)
|
619
|
+
copy_length = GNUTAR_uname_size;
|
620
|
+
memcpy(h + GNUTAR_uname_offset, p, copy_length);
|
621
|
+
}
|
622
|
+
|
623
|
+
/* TODO: How does GNU tar handle gnames longer than GNUTAR_gname_size? */
|
624
|
+
if (tartype == 'K' || tartype == 'L') {
|
625
|
+
p = archive_entry_gname(entry);
|
626
|
+
copy_length = strlen(p);
|
627
|
+
} else {
|
628
|
+
p = gnutar->gname;
|
629
|
+
copy_length = gnutar->gname_length;
|
630
|
+
}
|
631
|
+
if (copy_length > 0) {
|
632
|
+
if (strlen(p) > GNUTAR_gname_size)
|
633
|
+
copy_length = GNUTAR_gname_size;
|
634
|
+
memcpy(h + GNUTAR_gname_offset, p, copy_length);
|
635
|
+
}
|
636
|
+
|
637
|
+
/* By truncating the mode here, we ensure it always fits. */
|
638
|
+
format_octal(archive_entry_mode(entry) & 07777,
|
639
|
+
h + GNUTAR_mode_offset, GNUTAR_mode_size);
|
640
|
+
|
641
|
+
/* GNU tar supports base-256 here, so should never overflow. */
|
642
|
+
if (format_number(archive_entry_uid(entry), h + GNUTAR_uid_offset,
|
643
|
+
GNUTAR_uid_size, GNUTAR_uid_max_size)) {
|
644
|
+
archive_set_error(&a->archive, ERANGE,
|
645
|
+
"Numeric user ID %jd too large",
|
646
|
+
(intmax_t)archive_entry_uid(entry));
|
647
|
+
ret = ARCHIVE_FAILED;
|
648
|
+
}
|
649
|
+
|
650
|
+
/* GNU tar supports base-256 here, so should never overflow. */
|
651
|
+
if (format_number(archive_entry_gid(entry), h + GNUTAR_gid_offset,
|
652
|
+
GNUTAR_gid_size, GNUTAR_gid_max_size)) {
|
653
|
+
archive_set_error(&a->archive, ERANGE,
|
654
|
+
"Numeric group ID %jd too large",
|
655
|
+
(intmax_t)archive_entry_gid(entry));
|
656
|
+
ret = ARCHIVE_FAILED;
|
657
|
+
}
|
658
|
+
|
659
|
+
/* GNU tar supports base-256 here, so should never overflow. */
|
660
|
+
if (format_number(archive_entry_size(entry), h + GNUTAR_size_offset,
|
661
|
+
GNUTAR_size_size, GNUTAR_size_max_size)) {
|
662
|
+
archive_set_error(&a->archive, ERANGE,
|
663
|
+
"File size out of range");
|
664
|
+
ret = ARCHIVE_FAILED;
|
665
|
+
}
|
666
|
+
|
667
|
+
/* Shouldn't overflow before 2106, since mtime field is 33 bits. */
|
668
|
+
format_octal(archive_entry_mtime(entry),
|
669
|
+
h + GNUTAR_mtime_offset, GNUTAR_mtime_size);
|
670
|
+
|
671
|
+
if (archive_entry_filetype(entry) == AE_IFBLK
|
672
|
+
|| archive_entry_filetype(entry) == AE_IFCHR) {
|
673
|
+
if (format_octal(archive_entry_rdevmajor(entry),
|
674
|
+
h + GNUTAR_rdevmajor_offset,
|
675
|
+
GNUTAR_rdevmajor_size)) {
|
676
|
+
archive_set_error(&a->archive, ERANGE,
|
677
|
+
"Major device number too large");
|
678
|
+
ret = ARCHIVE_FAILED;
|
679
|
+
}
|
680
|
+
|
681
|
+
if (format_octal(archive_entry_rdevminor(entry),
|
682
|
+
h + GNUTAR_rdevminor_offset,
|
683
|
+
GNUTAR_rdevminor_size)) {
|
684
|
+
archive_set_error(&a->archive, ERANGE,
|
685
|
+
"Minor device number too large");
|
686
|
+
ret = ARCHIVE_FAILED;
|
687
|
+
}
|
688
|
+
}
|
689
|
+
|
690
|
+
h[GNUTAR_typeflag_offset] = tartype;
|
691
|
+
|
692
|
+
checksum = 0;
|
693
|
+
for (i = 0; i < 512; i++)
|
694
|
+
checksum += 255 & (unsigned int)h[i];
|
695
|
+
h[GNUTAR_checksum_offset + 6] = '\0'; /* Can't be pre-set in the template. */
|
696
|
+
/* h[GNUTAR_checksum_offset + 7] = ' '; */ /* This is pre-set in the template. */
|
697
|
+
format_octal(checksum, h + GNUTAR_checksum_offset, 6);
|
698
|
+
return (ret);
|
699
|
+
}
|
700
|
+
|
701
|
+
/*
|
702
|
+
* Format a number into a field, falling back to base-256 if necessary.
|
703
|
+
*/
|
704
|
+
static int
|
705
|
+
format_number(int64_t v, char *p, int s, int maxsize)
|
706
|
+
{
|
707
|
+
int64_t limit = ((int64_t)1 << (s*3));
|
708
|
+
|
709
|
+
if (v < limit)
|
710
|
+
return (format_octal(v, p, s));
|
711
|
+
return (format_256(v, p, maxsize));
|
712
|
+
}
|
713
|
+
|
714
|
+
/*
|
715
|
+
* Format a number into the specified field using base-256.
|
716
|
+
*/
|
717
|
+
static int
|
718
|
+
format_256(int64_t v, char *p, int s)
|
719
|
+
{
|
720
|
+
p += s;
|
721
|
+
while (s-- > 0) {
|
722
|
+
*--p = (char)(v & 0xff);
|
723
|
+
v >>= 8;
|
724
|
+
}
|
725
|
+
*p |= 0x80; /* Set the base-256 marker bit. */
|
726
|
+
return (0);
|
727
|
+
}
|
728
|
+
|
729
|
+
/*
|
730
|
+
* Format a number into the specified field using octal.
|
731
|
+
*/
|
732
|
+
static int
|
733
|
+
format_octal(int64_t v, char *p, int s)
|
734
|
+
{
|
735
|
+
int len = s;
|
736
|
+
|
737
|
+
/* Octal values can't be negative, so use 0. */
|
738
|
+
if (v < 0)
|
739
|
+
v = 0;
|
740
|
+
|
741
|
+
p += s; /* Start at the end and work backwards. */
|
742
|
+
while (s-- > 0) {
|
743
|
+
*--p = (char)('0' + (v & 7));
|
744
|
+
v >>= 3;
|
745
|
+
}
|
746
|
+
|
747
|
+
if (v == 0)
|
748
|
+
return (0);
|
749
|
+
|
750
|
+
/* If it overflowed, fill field with max value. */
|
751
|
+
while (len-- > 0)
|
752
|
+
*p++ = '7';
|
753
|
+
|
754
|
+
return (-1);
|
755
|
+
}
|