diff --git a/.cirrus.yml b/.cirrus.yml index f719431f539..d5c6d65b512 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -17,14 +17,14 @@ FreeBSD_task: - ./build/ci/cirrus_ci/ci.sh prepare configure_script: - env CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./build/ci/build.sh -a autogen - - env CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./build/ci/build.sh -a configure + - env MAKE=gmake CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./build/ci/build.sh -a configure build_script: - - env MAKE_ARGS="-j 2" ./build/ci/build.sh -a build + - env MAKE=gmake MAKE_ARGS="-j 2" ./build/ci/build.sh -a build test_script: - - env SKIP_TEST_RESTORE_ATIME=1 MAKE_ARGS="-j 2" ./build/ci/build.sh -a test + - env MAKE=gmake SKIP_TEST_RESTORE_ATIME=1 MAKE_ARGS="-j 2" ./build/ci/build.sh -a test - ./build/ci/cirrus_ci/ci.sh test install_script: - - env MAKE_ARGS="-j 2" ./build/ci/build.sh -a install + - env MAKE=gmake MAKE_ARGS="-j 2" ./build/ci/build.sh -a install Windows_Cygwin_task: windows_container: diff --git a/Makefile.am b/Makefile.am index be007e6321c..a3b04e75a04 100644 --- a/Makefile.am +++ b/Makefile.am @@ -96,61 +96,73 @@ distclean-local: include_HEADERS= libarchive/archive.h libarchive/archive_entry.h -libarchive_la_SOURCES= \ - libarchive/archive_acl.c \ +noinst_HEADERS= \ libarchive/archive_acl_private.h \ - libarchive/archive_check_magic.c \ - libarchive/archive_cmdline.c \ libarchive/archive_cmdline_private.h \ libarchive/archive_crc32.h \ - libarchive/archive_cryptor.c \ libarchive/archive_cryptor_private.h \ - libarchive/archive_digest.c \ libarchive/archive_digest_private.h \ libarchive/archive_endian.h \ - libarchive/archive_entry.c \ libarchive/archive_entry.h \ - libarchive/archive_entry_copy_stat.c \ - libarchive/archive_entry_link_resolver.c \ libarchive/archive_entry_locale.h \ libarchive/archive_entry_private.h \ - libarchive/archive_entry_sparse.c \ - libarchive/archive_entry_stat.c \ - libarchive/archive_entry_strmode.c \ - libarchive/archive_entry_xattr.c \ - libarchive/archive_hmac.c \ libarchive/archive_hmac_private.h \ - libarchive/archive_match.c \ libarchive/archive_openssl_evp_private.h \ libarchive/archive_openssl_hmac_private.h \ - libarchive/archive_options.c \ libarchive/archive_options_private.h \ libarchive/archive_pack_dev.h \ - libarchive/archive_pack_dev.c \ - libarchive/archive_parse_date.c \ - libarchive/archive_pathmatch.c \ libarchive/archive_pathmatch.h \ libarchive/archive_platform.h \ libarchive/archive_platform_acl.h \ libarchive/archive_platform_stat.h \ libarchive/archive_platform_xattr.h \ - libarchive/archive_ppmd_private.h \ - libarchive/archive_ppmd7.c \ libarchive/archive_ppmd7_private.h \ - libarchive/archive_ppmd8.c \ libarchive/archive_ppmd8_private.h \ + libarchive/archive_ppmd_private.h \ libarchive/archive_private.h \ - libarchive/archive_random.c \ libarchive/archive_random_private.h \ - libarchive/archive_rb.c \ libarchive/archive_rb.h \ + libarchive/archive_read_disk_private.h \ + libarchive/archive_read_private.h \ + libarchive/archive_string.h \ + libarchive/archive_string_composition.h \ + libarchive/archive_time_private.h \ + libarchive/archive_write_disk_private.h \ + libarchive/archive_write_private.h \ + libarchive/archive_write_set_format_private.h \ + libarchive/archive_xxhash.h \ + libarchive/config_freebsd.h \ + libarchive/filter_fork.h + +libarchive_la_SOURCES= \ + libarchive/archive_acl.c \ + libarchive/archive_check_magic.c \ + libarchive/archive_cmdline.c \ + libarchive/archive_cryptor.c \ + libarchive/archive_digest.c \ + libarchive/archive_entry.c \ + libarchive/archive_entry_copy_stat.c \ + libarchive/archive_entry_link_resolver.c \ + libarchive/archive_entry_sparse.c \ + libarchive/archive_entry_stat.c \ + libarchive/archive_entry_strmode.c \ + libarchive/archive_entry_xattr.c \ + libarchive/archive_hmac.c \ + libarchive/archive_match.c \ + libarchive/archive_options.c \ + libarchive/archive_pack_dev.c \ + libarchive/archive_parse_date.c \ + libarchive/archive_pathmatch.c \ + libarchive/archive_ppmd7.c \ + libarchive/archive_ppmd8.c \ + libarchive/archive_random.c \ + libarchive/archive_rb.c \ libarchive/archive_read.c \ libarchive/archive_read_add_passphrase.c \ libarchive/archive_read_append_filter.c \ libarchive/archive_read_data_into_fd.c \ libarchive/archive_read_disk_entry_from_file.c \ libarchive/archive_read_disk_posix.c \ - libarchive/archive_read_disk_private.h \ libarchive/archive_read_disk_set_standard_lookup.c \ libarchive/archive_read_extract.c \ libarchive/archive_read_extract2.c \ @@ -158,12 +170,11 @@ libarchive_la_SOURCES= \ libarchive/archive_read_open_file.c \ libarchive/archive_read_open_filename.c \ libarchive/archive_read_open_memory.c \ - libarchive/archive_read_private.h \ libarchive/archive_read_set_format.c \ libarchive/archive_read_set_options.c \ libarchive/archive_read_support_filter_all.c \ - libarchive/archive_read_support_filter_bzip2.c \ libarchive/archive_read_support_filter_by_code.c \ + libarchive/archive_read_support_filter_bzip2.c \ libarchive/archive_read_support_filter_compress.c \ libarchive/archive_read_support_filter_grzip.c \ libarchive/archive_read_support_filter_gzip.c \ @@ -194,23 +205,12 @@ libarchive_la_SOURCES= \ libarchive/archive_read_support_format_xar.c \ libarchive/archive_read_support_format_zip.c \ libarchive/archive_string.c \ - libarchive/archive_string.h \ - libarchive/archive_string_composition.h \ libarchive/archive_string_sprintf.c \ libarchive/archive_time.c \ - libarchive/archive_time_private.h \ libarchive/archive_util.c \ libarchive/archive_version_details.c \ libarchive/archive_virtual.c \ libarchive/archive_write.c \ - libarchive/archive_write_disk_posix.c \ - libarchive/archive_write_disk_private.h \ - libarchive/archive_write_disk_set_standard_lookup.c \ - libarchive/archive_write_open_fd.c \ - libarchive/archive_write_open_file.c \ - libarchive/archive_write_open_filename.c \ - libarchive/archive_write_open_memory.c \ - libarchive/archive_write_private.h \ libarchive/archive_write_add_filter.c \ libarchive/archive_write_add_filter_b64encode.c \ libarchive/archive_write_add_filter_by_name.c \ @@ -226,6 +226,12 @@ libarchive_la_SOURCES= \ libarchive/archive_write_add_filter_uuencode.c \ libarchive/archive_write_add_filter_xz.c \ libarchive/archive_write_add_filter_zstd.c \ + libarchive/archive_write_disk_posix.c \ + libarchive/archive_write_disk_set_standard_lookup.c \ + libarchive/archive_write_open_fd.c \ + libarchive/archive_write_open_file.c \ + libarchive/archive_write_open_filename.c \ + libarchive/archive_write_open_memory.c \ libarchive/archive_write_set_format.c \ libarchive/archive_write_set_format_7zip.c \ libarchive/archive_write_set_format_ar.c \ @@ -235,59 +241,54 @@ libarchive_la_SOURCES= \ libarchive/archive_write_set_format_cpio_newc.c \ libarchive/archive_write_set_format_cpio_odc.c \ libarchive/archive_write_set_format_filter_by_ext.c \ + libarchive/archive_write_set_format_gnutar.c \ libarchive/archive_write_set_format_iso9660.c \ libarchive/archive_write_set_format_mtree.c \ libarchive/archive_write_set_format_pax.c \ - libarchive/archive_write_set_format_private.h \ libarchive/archive_write_set_format_raw.c \ libarchive/archive_write_set_format_shar.c \ libarchive/archive_write_set_format_ustar.c \ libarchive/archive_write_set_format_v7tar.c \ - libarchive/archive_write_set_format_gnutar.c \ libarchive/archive_write_set_format_warc.c \ libarchive/archive_write_set_format_xar.c \ libarchive/archive_write_set_format_zip.c \ libarchive/archive_write_set_options.c \ libarchive/archive_write_set_passphrase.c \ - libarchive/archive_xxhash.h \ - libarchive/config_freebsd.h \ libarchive/filter_fork_posix.c \ - libarchive/filter_fork.h \ libarchive/xxhash.c if INC_WINDOWS_FILES +noinst_HEADERS+= \ + libarchive/archive_windows.h libarchive_la_SOURCES+= \ libarchive/archive_entry_copy_bhfi.c \ libarchive/archive_read_disk_windows.c \ - libarchive/archive_windows.h \ libarchive/archive_windows.c \ libarchive/archive_write_disk_windows.c \ libarchive/filter_fork_windows.c endif if INC_BLAKE2 -libarchive_la_SOURCES+= \ +noinst_HEADERS+= \ libarchive/archive_blake2.h \ - libarchive/archive_blake2_impl.h \ + libarchive/archive_blake2_impl.h +libarchive_la_SOURCES+= \ libarchive/archive_blake2s_ref.c \ libarchive/archive_blake2sp_ref.c endif if INC_LINUX_ACL libarchive_la_SOURCES+= libarchive/archive_disk_acl_linux.c -else +endif if INC_SUNOS_ACL libarchive_la_SOURCES+= libarchive/archive_disk_acl_sunos.c -else +endif if INC_DARWIN_ACL libarchive_la_SOURCES+= libarchive/archive_disk_acl_darwin.c -else +endif if INC_FREEBSD_ACL libarchive_la_SOURCES+= libarchive/archive_disk_acl_freebsd.c endif -endif -endif -endif # -no-undefined marks that libarchive doesn't rely on symbols # defined in the application. This is mandatory for cygwin. @@ -351,22 +352,24 @@ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = build/pkgconfig/libarchive.pc # Sources needed by all test programs +noinst_HEADERS+= \ + test_utils/test_common.h \ + test_utils/test_utils.h test_utils_SOURCES= \ - test_utils/test_utils.c \ - test_utils/test_utils.h \ test_utils/test_main.c \ - test_utils/test_common.h + test_utils/test_utils.c # # # libarchive_test program # # +noinst_HEADERS+= \ + libarchive/test/test.h libarchive_test_SOURCES= \ $(libarchive_la_SOURCES) \ $(test_utils_SOURCES) \ libarchive/test/read_open_memory.c \ - libarchive/test/test.h \ libarchive/test/test_7zip_filename_encoding.c \ libarchive/test/test_acl_nfs4.c \ libarchive/test/test_acl_pax.c \ @@ -673,7 +676,6 @@ libarchive_test_SOURCES= \ libarchive/test/test_write_read_format_zip.c \ libarchive/test/test_xattr_platform.c \ libarchive/test/test_zip_filename_encoding.c - libarchive_test_CPPFLAGS= \ -I$(top_srcdir)/libarchive \ -I$(top_srcdir)/libarchive/test \ @@ -686,9 +688,9 @@ libarchive_test_LDADD= $(LTLIBICONV) # The "list.h" file just lists all of the tests defined in all of the sources. # Building it automatically provides a sanity-check on libarchive_test_SOURCES # above. -libarchive/test/list.h: Makefile +libarchive/test/list.h: $(libarchive_test_SOURCES) $(MKDIR_P) libarchive/test - cat $(top_srcdir)/libarchive/test/test_*.c | grep '^DEFINE_TEST' > libarchive/test/list.h + grep -h '^DEFINE_TEST(' $^ | LC_COLLATE=C sort > $@ libarchive_TESTS_ENVIRONMENT= LIBARCHIVE_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/libarchive/test LRZIP=NOCONFIG @@ -969,6 +971,7 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_read_format_rar5_stored_manyfiles.rar.uu \ libarchive/test/test_read_format_rar5_symlink.rar.uu \ libarchive/test/test_read_format_rar5_truncated_huff.rar.uu \ + libarchive/test/test_read_format_rar5_unicode.rar.uu \ libarchive/test/test_read_format_rar5_win32.rar.uu \ libarchive/test/test_read_format_rar5_arm_filter_on_window_boundary.rar.uu \ libarchive/test/test_read_format_rar5_different_winsize_on_merge.rar.uu \ @@ -1078,14 +1081,15 @@ libarchive_test_EXTRA_DIST=\ # # Common code for libarchive frontends (cpio, tar) # -libarchive_fe_la_SOURCES= \ - libarchive_fe/lafe_err.c \ +noinst_HEADERS+= \ libarchive_fe/lafe_err.h \ libarchive_fe/lafe_platform.h \ - libarchive_fe/line_reader.c \ libarchive_fe/line_reader.h \ - libarchive_fe/passphrase.c \ libarchive_fe/passphrase.h +libarchive_fe_la_SOURCES= \ + libarchive_fe/lafe_err.c \ + libarchive_fe/line_reader.c \ + libarchive_fe/passphrase.c libarchive_fe_la_CPPFLAGS= -I$(top_srcdir)/libarchive # @@ -1094,21 +1098,23 @@ libarchive_fe_la_CPPFLAGS= -I$(top_srcdir)/libarchive # # +noinst_HEADERS+= \ + tar/bsdtar.h \ + tar/bsdtar_platform.h bsdtar_SOURCES= \ - tar/bsdtar.c \ - tar/bsdtar.h \ - tar/bsdtar_platform.h \ - tar/cmdline.c \ - tar/creation_set.c \ - tar/read.c \ - tar/subst.c \ - tar/util.c \ - tar/write.c + tar/bsdtar.c \ + tar/cmdline.c \ + tar/creation_set.c \ + tar/read.c \ + tar/subst.c \ + tar/util.c \ + tar/write.c if INC_WINDOWS_FILES +noinst_HEADERS+= \ + tar/bsdtar_windows.h bsdtar_SOURCES+= \ - tar/bsdtar_windows.h \ - tar/bsdtar_windows.c + tar/bsdtar_windows.c endif bsdtar_DEPENDENCIES= libarchive.la libarchive_fe.la @@ -1145,9 +1151,11 @@ endif # bsdtar_test # +noinst_HEADERS+= \ + tar/test/test.h + bsdtar_test_SOURCES= \ $(test_utils_SOURCES) \ - tar/test/test.h \ tar/test/test_0.c \ tar/test/test_basic.c \ tar/test/test_copy.c \ @@ -1228,9 +1236,9 @@ bsdtar_test_CPPFLAGS=\ -I$(top_builddir)/tar/test \ $(PLATFORMCPPFLAGS) -tar/test/list.h: Makefile +tar/test/list.h: $(bsdtar_test_SOURCES) $(MKDIR_P) tar/test - cat $(top_srcdir)/tar/test/test_*.c | grep '^DEFINE_TEST' > tar/test/list.h + grep -h '^DEFINE_TEST(' $^ | LC_COLLATE=C sort > $@ if BUILD_BSDTAR bsdtar_test_programs= bsdtar_test @@ -1271,16 +1279,18 @@ bsdtar_test_EXTRA_DIST= \ # # +noinst_HEADERS+= \ + cpio/cpio.h \ + cpio/cpio_platform.h bsdcpio_SOURCES= \ - cpio/cmdline.c \ - cpio/cpio.c \ - cpio/cpio.h \ - cpio/cpio_platform.h + cpio/cmdline.c \ + cpio/cpio.c if INC_WINDOWS_FILES +noinst_HEADERS+= \ + cpio/cpio_windows.h bsdcpio_SOURCES+= \ - cpio/cpio_windows.h \ - cpio/cpio_windows.c + cpio/cpio_windows.c endif bsdcpio_DEPENDENCIES = libarchive.la libarchive_fe.la @@ -1319,10 +1329,11 @@ endif # bsdcpio_test # +noinst_HEADERS+= \ + cpio/test/test.h bsdcpio_test_SOURCES= \ $(test_utils_SOURCES) \ cpio/cmdline.c \ - cpio/test/test.h \ cpio/test/test_0.c \ cpio/test/test_basic.c \ cpio/test/test_cmdline.c \ @@ -1381,9 +1392,9 @@ bsdcpio_test_CPPFLAGS= \ $(PLATFORMCPPFLAGS) bsdcpio_test_LDADD=libarchive_fe.la -cpio/test/list.h: Makefile +cpio/test/list.h: $(bsdcpio_test_SOURCES) $(MKDIR_P) cpio/test - cat $(top_srcdir)/cpio/test/test_*.c | grep '^DEFINE_TEST' > cpio/test/list.h + grep -h '^DEFINE_TEST(' $^ | LC_COLLATE=C sort > $@ if BUILD_BSDCPIO bsdcpio_test_programs= bsdcpio_test @@ -1428,13 +1439,15 @@ bsdcpio_test_EXTRA_DIST= \ # # +noinst_HEADERS+= \ + cat/bsdcat.h \ + cat/bsdcat_platform.h bsdcat_SOURCES= \ - cat/bsdcat.c \ - cat/bsdcat.h \ - cat/bsdcat_platform.h \ - cat/cmdline.c + cat/bsdcat.c \ + cat/cmdline.c if INC_WINDOWS_FILES +noinst_HEADERS+= bsdcat_SOURCES+= endif @@ -1471,9 +1484,10 @@ endif # bsdcat_test # +noinst_HEADERS+= \ + cat/test/test.h bsdcat_test_SOURCES= \ $(test_utils_SOURCES) \ - cat/test/test.h \ cat/test/test_0.c \ cat/test/test_empty_gz.c \ cat/test/test_empty_lz4.c \ @@ -1501,9 +1515,9 @@ bsdcat_test_CPPFLAGS= \ $(PLATFORMCPPFLAGS) bsdcat_test_LDADD=libarchive_fe.la -cat/test/list.h: Makefile +cat/test/list.h: $(bsdcat_test_SOURCES) $(MKDIR_P) cat/test - cat $(top_srcdir)/cat/test/test_*.c | grep '^DEFINE_TEST' > cat/test/list.h + grep -h '^DEFINE_TEST(' $^ | LC_COLLATE=C sort > $@ if BUILD_BSDCAT bsdcat_test_programs= bsdcat_test @@ -1534,16 +1548,18 @@ bsdcat_test_EXTRA_DIST= \ # # +noinst_HEADERS+= \ + unzip/bsdunzip.h \ + unzip/bsdunzip_platform.h \ + unzip/la_getline.h \ + unzip/la_queue.h bsdunzip_SOURCES= \ - unzip/bsdunzip.c \ - unzip/bsdunzip.h \ - unzip/bsdunzip_platform.h \ - unzip/cmdline.c \ - unzip/la_getline.c \ - unzip/la_getline.h \ - unzip/la_queue.h + unzip/bsdunzip.c \ + unzip/cmdline.c \ + unzip/la_getline.c if INC_WINDOWS_FILES +noinst_HEADERS+= bsdunzip_SOURCES+= endif @@ -1580,9 +1596,10 @@ endif # bsdunzip_test # +noinst_HEADERS+= \ + unzip/test/test.h bsdunzip_test_SOURCES= \ $(test_utils_SOURCES) \ - unzip/test/test.h \ unzip/test/test_0.c \ unzip/test/test_basic.c \ unzip/test/test_doubledash.c \ @@ -1613,9 +1630,9 @@ bsdunzip_test_CPPFLAGS= \ $(PLATFORMCPPFLAGS) bsdunzip_test_LDADD=libarchive_fe.la -unzip/test/list.h: Makefile +unzip/test/list.h: $(bsdunzip_test_SOURCES) $(MKDIR_P) unzip/test - cat $(top_srcdir)/unzip/test/test_*.c | grep '^DEFINE_TEST' > unzip/test/list.h + grep -h '^DEFINE_TEST(' $^ | LC_COLLATE=C sort > $@ if BUILD_BSDUNZIP bsdunzip_test_programs= bsdunzip_test diff --git a/NEWS b/NEWS index 971ae8e441e..fbbb65440b3 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,10 @@ -Nov 17, 2026: libarchive 3.8.3 released +Dec 01, 2025: libarchive 3.8.4 released -Oct 15, 2026: libarchive 3.8.2 released +Nov 17, 2025: libarchive 3.8.3 released -Jun 01, 2026: libarchive 3.8.1 released +Oct 15, 2025: libarchive 3.8.2 released + +Jun 01, 2025: libarchive 3.8.1 released May 20, 2025: libarchive 3.8.0 released diff --git a/build/ci/cirrus_ci/ci.sh b/build/ci/cirrus_ci/ci.sh index 29425121ff4..23120572341 100755 --- a/build/ci/cirrus_ci/ci.sh +++ b/build/ci/cirrus_ci/ci.sh @@ -23,7 +23,7 @@ then tunefs -N enable /dev/$MD mount /dev/$MD /tmp_acl_nfsv4 chmod 1777 /tmp_acl_nfsv4 - pkg install -y autoconf automake cmake libiconv libtool pkgconf expat libxml2 liblz4 zstd + pkg install -y autoconf automake cmake libiconv libtool pkgconf expat libxml2 liblz4 zstd gmake elif [ "${UNAME}" = "Darwin" ] then set -x -e diff --git a/build/version b/build/version index d678a350628..79b0dfb7a03 100644 --- a/build/version +++ b/build/version @@ -1 +1 @@ -3008003 +3008004 diff --git a/configure.ac b/configure.ac index e0e89caaba1..6a55359c0ae 100644 --- a/configure.ac +++ b/configure.ac @@ -4,8 +4,8 @@ dnl First, define all of the version numbers up front. dnl In particular, this allows the version macro to be used in AC_INIT dnl These first two version numbers are updated automatically on each release. -m4_define([LIBARCHIVE_VERSION_S],[3.8.3]) -m4_define([LIBARCHIVE_VERSION_N],[3008003]) +m4_define([LIBARCHIVE_VERSION_S],[3.8.4]) +m4_define([LIBARCHIVE_VERSION_N],[3008004]) dnl bsdtar and bsdcpio versioning tracks libarchive m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) diff --git a/libarchive/archive.h b/libarchive/archive.h index 9794dced6ca..0eda822ae6b 100644 --- a/libarchive/archive.h +++ b/libarchive/archive.h @@ -34,7 +34,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3008003 +#define ARCHIVE_VERSION_NUMBER 3008004 #include #include /* for wchar_t */ @@ -177,7 +177,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.8.3" +#define ARCHIVE_VERSION_ONLY_STRING "3.8.4" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); diff --git a/libarchive/archive_cryptor.c b/libarchive/archive_cryptor.c index 9f03f9ca6dd..b6a02fd1e7c 100644 --- a/libarchive/archive_cryptor.c +++ b/libarchive/archive_cryptor.c @@ -490,9 +490,9 @@ aes_ctr_update(archive_crypto_ctx *ctx, const uint8_t * const in, size_t in_len, uint8_t * const out, size_t *out_len) { uint8_t *const ebuf = ctx->encr_buf; - unsigned pos = ctx->encr_pos; - unsigned max = (unsigned)((in_len < *out_len)? in_len: *out_len); - unsigned i; + size_t pos = ctx->encr_pos; + size_t max = (in_len < *out_len)? in_len: *out_len; + size_t i; for (i = 0; i < max; ) { if (pos == AES_BLOCK_SIZE) { diff --git a/libarchive/archive_cryptor_private.h b/libarchive/archive_cryptor_private.h index 1dbc5c17a01..272f2f84b9c 100644 --- a/libarchive/archive_cryptor_private.h +++ b/libarchive/archive_cryptor_private.h @@ -56,10 +56,10 @@ int __libarchive_cryptor_build_hack(void); typedef struct { CCCryptorRef ctx; uint8_t key[AES_MAX_KEY_SIZE]; - unsigned key_len; + size_t key_len; uint8_t nonce[AES_BLOCK_SIZE]; uint8_t encr_buf[AES_BLOCK_SIZE]; - unsigned encr_pos; + size_t encr_pos; } archive_crypto_ctx; #elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA diff --git a/libarchive/archive_entry.h b/libarchive/archive_entry.h index 924b67a301c..74466f394c4 100644 --- a/libarchive/archive_entry.h +++ b/libarchive/archive_entry.h @@ -28,7 +28,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3008003 +#define ARCHIVE_VERSION_NUMBER 3008004 /* * Note: archive_entry.h is for use outside of libarchive; the diff --git a/libarchive/archive_read_disk_entry_from_file.c b/libarchive/archive_read_disk_entry_from_file.c index 121af19872e..6e6bae6a4e0 100644 --- a/libarchive/archive_read_disk_entry_from_file.c +++ b/libarchive/archive_read_disk_entry_from_file.c @@ -254,7 +254,7 @@ archive_read_disk_entry_from_file(struct archive *_a, if (S_ISLNK(st->st_mode)) { size_t linkbuffer_len = st->st_size; char *linkbuffer; - int lnklen; + ssize_t lnklen; linkbuffer = malloc(linkbuffer_len + 1); if (linkbuffer == NULL) { @@ -892,7 +892,7 @@ setup_sparse_fiemap(struct archive_read_disk *a, for (iters = 0; ; ++iters) { int i, r; - r = ioctl(*fd, FS_IOC_FIEMAP, fm); + r = ioctl(*fd, FS_IOC_FIEMAP, fm); if (r < 0) { /* When something error happens, it is better we * should return ARCHIVE_OK because an earlier @@ -1079,4 +1079,3 @@ setup_sparse(struct archive_read_disk *a, #endif #endif /* !defined(_WIN32) || defined(__CYGWIN__) */ - diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index 7cd292f259f..94fa8fef963 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -2018,11 +2018,8 @@ tree_dup(int fd) } #endif /* F_DUPFD_CLOEXEC */ new_fd = dup(fd); - if (new_fd != -1) { - __archive_ensure_cloexec_flag(new_fd); - return (new_fd); - } - return (-1); + __archive_ensure_cloexec_flag(new_fd); + return (new_fd); } /* @@ -2144,16 +2141,11 @@ tree_reopen(struct tree *t, const char *path, int restore_time) * so try again for execute. The consequences of not opening this are * unhelpful and unnecessary errors later. */ - if (t->initial_dir_fd < 0) { + if (t->initial_dir_fd < 0) t->initial_dir_fd = open(".", o_flag | O_CLOEXEC); - if (t->initial_dir_fd < 0) - return NULL; - } #endif __archive_ensure_cloexec_flag(t->initial_dir_fd); t->working_dir_fd = tree_dup(t->initial_dir_fd); - if (t->working_dir_fd < 0) - return NULL; return (t); } @@ -2359,15 +2351,20 @@ static int tree_dir_next_posix(struct tree *t) { int r; +#if defined(HAVE_FDOPENDIR) + int fd; +#endif const char *name; size_t namelen; if (t->d == NULL) { #if defined(HAVE_FDOPENDIR) - int fd = tree_dup(t->working_dir_fd); - if (fd != -1) - t->d = fdopendir(fd); + if (t->working_dir_fd >= 0) { + fd = tree_dup(t->working_dir_fd); + if (fd != -1) + t->d = fdopendir(fd); + } #else /* HAVE_FDOPENDIR */ if (tree_enter_working_dir(t) == 0) { t->d = opendir("."); diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c index ded13bee79a..96d2c71f4c4 100644 --- a/libarchive/archive_read_support_format_mtree.c +++ b/libarchive/archive_read_support_format_mtree.c @@ -1254,7 +1254,7 @@ parse_file(struct archive_read *a, struct archive_entry *entry, archive_entry_filetype(entry) == AE_IFDIR) { mtree->fd = open(path, O_RDONLY | O_BINARY | O_CLOEXEC); __archive_ensure_cloexec_flag(mtree->fd); - if (mtree->fd < 0 && ( + if (mtree->fd == -1 && ( #if defined(_WIN32) && !defined(__CYGWIN__) /* * On Windows, attempting to open a file with an diff --git a/libarchive/archive_version_details.c b/libarchive/archive_version_details.c index 0cf92db7319..9063faa7942 100644 --- a/libarchive/archive_version_details.c +++ b/libarchive/archive_version_details.c @@ -333,7 +333,7 @@ archive_libbsdxml_version(void) const char * archive_libxml2_version(void) { -#if HAVE_LIBXML_XMLREADER_H && HAVE_LIBXML2 +#if HAVE_LIBXML_XMLVERSION_H && HAVE_LIBXML2 return LIBXML_DOTTED_VERSION; #else return NULL; diff --git a/libarchive/archive_write.c b/libarchive/archive_write.c index 9b9cb196f0f..e1ce5d57288 100644 --- a/libarchive/archive_write.c +++ b/libarchive/archive_write.c @@ -821,7 +821,7 @@ _archive_write_data(struct archive *_a, const void *buff, size_t s) { struct archive_write *a = (struct archive_write *)_a; const size_t max_write = INT_MAX; - int ret; + ssize_t ret; archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, ARCHIVE_STATE_DATA, "archive_write_data"); diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c index cd25620305b..d1f043d2443 100644 --- a/libarchive/archive_write_disk_posix.c +++ b/libarchive/archive_write_disk_posix.c @@ -2561,9 +2561,9 @@ _archive_write_disk_close(struct archive *_a) * for directories. For other file types * we need to verify via fstat() or lstat() */ - if (fd < 0 || p->filetype != AE_IFDIR) { + if (fd == -1 || p->filetype != AE_IFDIR) { #if HAVE_FSTAT - if (fd >= 0 && ( + if (fd > 0 && ( fstat(fd, &st) != 0 || la_verify_filetype(st.st_mode, p->filetype) == 0)) { @@ -4447,7 +4447,7 @@ fixup_appledouble(struct archive_write_disk *a, const char *pathname) */ fd = open(pathname, O_RDONLY | O_BINARY | O_CLOEXEC); __archive_ensure_cloexec_flag(fd); - if (fd < 0) { + if (fd == -1) { archive_set_error(&a->archive, errno, "Failed to open a restoring file"); ret = ARCHIVE_WARN; diff --git a/libarchive/archive_write_set_format_xar.c b/libarchive/archive_write_set_format_xar.c index 9921f1032be..ec3219057e4 100644 --- a/libarchive/archive_write_set_format_xar.c +++ b/libarchive/archive_write_set_format_xar.c @@ -1000,13 +1000,13 @@ xmlwrite_heap(struct archive_write *a, struct xml_writer *writer, const char *encname; int r; - r = xmlwrite_fstring(a, writer, "length", "%ju", heap->length); + r = xmlwrite_fstring(a, writer, "length", "%ju", (uintmax_t)heap->length); if (r < 0) return (ARCHIVE_FATAL); - r = xmlwrite_fstring(a, writer, "offset", "%ju", heap->temp_offset); + r = xmlwrite_fstring(a, writer, "offset", "%ju", (uintmax_t)heap->temp_offset); if (r < 0) return (ARCHIVE_FATAL); - r = xmlwrite_fstring(a, writer, "size", "%ju", heap->size); + r = xmlwrite_fstring(a, writer, "size", "%ju", (uintmax_t)heap->size); if (r < 0) return (ARCHIVE_FATAL); switch (heap->compression) { @@ -1356,7 +1356,7 @@ make_file_entry(struct archive_write *a, struct xml_writer *writer, * Make a inode entry, "". */ r = xmlwrite_fstring(a, writer, "inode", - "%jd", archive_entry_ino64(file->entry)); + "%jd", (intmax_t)archive_entry_ino64(file->entry)); if (r < 0) return (ARCHIVE_FATAL); if (archive_entry_dev(file->entry) != 0) { @@ -1378,7 +1378,7 @@ make_file_entry(struct archive_write *a, struct xml_writer *writer, * Make a user entry, "" and ". */ r = xmlwrite_fstring(a, writer, "uid", - "%d", archive_entry_uid(file->entry)); + "%jd", (intmax_t)archive_entry_uid(file->entry)); if (r < 0) return (ARCHIVE_FATAL); r = archive_entry_uname_l(file->entry, &p, &len, xar->sconv); @@ -1404,7 +1404,7 @@ make_file_entry(struct archive_write *a, struct xml_writer *writer, * Make a group entry, "" and ". */ r = xmlwrite_fstring(a, writer, "gid", - "%d", archive_entry_gid(file->entry)); + "%jd", (intmax_t)archive_entry_gid(file->entry)); if (r < 0) return (ARCHIVE_FATAL); r = archive_entry_gname_l(file->entry, &p, &len, xar->sconv); diff --git a/libarchive/test/test_archive_read_multiple_data_objects.c b/libarchive/test/test_archive_read_multiple_data_objects.c index f9f75d96fa6..791c7ad0112 100644 --- a/libarchive/test/test_archive_read_multiple_data_objects.c +++ b/libarchive/test/test_archive_read_multiple_data_objects.c @@ -202,7 +202,7 @@ static int64_t file_skip(struct archive *a, void *data, int64_t request) { struct mydata *mydata = (struct mydata *)data; - int64_t result = lseek(mydata->fd, SEEK_CUR, request); + int64_t result = lseek(mydata->fd, request, SEEK_CUR); if (result >= 0) return result; archive_set_error(a, errno, "Error seeking in '%s'", mydata->filename); diff --git a/libarchive/test/test_write_disk_perms.c b/libarchive/test/test_write_disk_perms.c index 77a15d1a3e4..72b55179d86 100644 --- a/libarchive/test/test_write_disk_perms.c +++ b/libarchive/test/test_write_disk_perms.c @@ -94,21 +94,21 @@ searchgid(void) close(fd); } -static int +static long altgid(void) { searchgid(); return (_alt_gid); } -static int +static long invalidgid(void) { searchgid(); return (_invalid_gid); } -static int +static long defaultgid(void) { searchgid(); diff --git a/libarchive/test/test_write_filter_bzip2.c b/libarchive/test/test_write_filter_bzip2.c index 7b2e4f857a7..d7ed95e2c7f 100644 --- a/libarchive/test/test_write_filter_bzip2.c +++ b/libarchive/test/test_write_filter_bzip2.c @@ -40,7 +40,8 @@ DEFINE_TEST(test_write_filter_bzip2) size_t buffsize, datasize; char path[16]; size_t used1, used2; - int i, r, use_prog; + ssize_t r; + int i, use_prog; buffsize = 2000000; assert(NULL != (buff = malloc(buffsize))); diff --git a/tar/subst.c b/tar/subst.c index a5d644dc5a7..a466f65358a 100644 --- a/tar/subst.c +++ b/tar/subst.c @@ -235,7 +235,9 @@ apply_substitution(struct bsdtar *bsdtar, const char *name, char **result, (*result)[0] = 0; } - while (1) { + char isEnd = 0; + do { + isEnd = *name == '\0'; if (regexec(&rule->re, name, 10, matches, 0)) break; @@ -290,12 +292,15 @@ apply_substitution(struct bsdtar *bsdtar, const char *name, char **result, } realloc_strcat(result, rule->result + j); - - name += matches[0].rm_eo; - - if (!rule->global) - break; - } + if (matches[0].rm_eo > 0) { + name += matches[0].rm_eo; + } else { + // We skip a character because the match is 0-length + // so we need to add it to the output + realloc_strncat(result, name, 1); + name += 1; + } + } while (rule->global && !isEnd); // Testing one step after because sed et al. run 0-length patterns a last time on the empty string at the end } if (got_match) diff --git a/tar/test/test_option_s.c b/tar/test/test_option_s.c index 125e971d330..00753b99be3 100644 --- a/tar/test/test_option_s.c +++ b/tar/test/test_option_s.c @@ -42,7 +42,13 @@ DEFINE_TEST(test_option_s) systemf("%s -cf test1_2.tar -s /d1/d2/ in/d1/foo", testprog); systemf("%s -xf test1_2.tar -C test1", testprog); assertFileContents("foo", 3, "test1/in/d2/foo"); - + systemf("%s -cf test1_3.tar -s /o/#/g in/d1/foo", testprog); + systemf("%s -xf test1_3.tar -C test1", testprog); + assertFileContents("foo", 3, "test1/in/d1/f##"); + // For the 0-length pattern check, remember that "test1/" isn't part of the string affected by the regexp + systemf("%s -cf test1_4.tar -s /f*/\\<~\\>/g in/d1/foo", testprog); + systemf("%s -xf test1_4.tar -C test1", testprog); + assertFileContents("foo", 3, "test1/<>i<>n<>/<>d<>1<>/<>o<>o<>"); /* * Test 2: Basic substitution when extracting archive. */