aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2020-02-11 23:48:03 +0000
committerMartin Matuska <mm@FreeBSD.org>2020-02-11 23:48:03 +0000
commit8185c4ae244f9a52ad987b36e7d6300500054d00 (patch)
tree11e2d7cd0caf20998ed1e1146e1c1d7fc747165e
parent98c1f51f769841d99d879099f9075ff60d51ee4a (diff)
downloadsrc-8185c4ae244f9a52ad987b36e7d6300500054d00.tar.gz
src-8185c4ae244f9a52ad987b36e7d6300500054d00.zip
Update vendor/libarchive/dist to git 3288ebb0353beb51dfb09d444dedbe9235ead53dvendor/libarchive/3.4.2
Libarchive 3.4.2 Relevant vendor changes: PR #1289: atomic extraction support (bsdtar -x --safe-writes) PR #1308: big endian fix for UTF16 support in LHA reader PR #1326: reject RAR5 files that declare invalid header flags Issue #987: fix support 7z archive entries with Delta filter Issue #1317: fix compression output buffer handling in XAR writer Issue #1319: fix uname or gname longer than 32 characters in pax writer Issue #1325: fix use after free when archiving hardlinks in ISO9660 or XAR Use localtime_r() and gmtime_r() instead of localtime() and gmtime()
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=357783 svn path=/vendor/libarchive/3.4.2/; revision=357784; tag=vendor/libarchive/3.4.2
-rw-r--r--.github/workflows/ci.yml26
-rw-r--r--CMakeLists.txt13
-rw-r--r--Makefile.am5
-rw-r--r--NEWS8
-rwxr-xr-xbuild/ci/build.sh7
-rwxr-xr-xbuild/ci/github_actions/ci.cmd65
-rw-r--r--build/cmake/config.h.in3
-rw-r--r--build/release/Dockerfile11
-rwxr-xr-xbuild/release/release.sh8
-rw-r--r--build/version2
-rw-r--r--cat/bsdcat.h5
-rw-r--r--cat/test/test_0.c2
-rw-r--r--configure.ac4
-rw-r--r--contrib/archivetest.c16
-rw-r--r--cpio/cpio.c22
-rw-r--r--cpio/test/test_basic.c14
-rw-r--r--cpio/test/test_format_newc.c15
-rw-r--r--libarchive/CMakeLists.txt1
-rw-r--r--libarchive/archive.h4
-rw-r--r--libarchive/archive_acl_private.h6
-rw-r--r--libarchive/archive_blake2.h5
-rw-r--r--libarchive/archive_blake2_impl.h5
-rw-r--r--libarchive/archive_cmdline_private.h6
-rw-r--r--libarchive/archive_crc32.h5
-rw-r--r--libarchive/archive_cryptor_private.h7
-rw-r--r--libarchive/archive_digest_private.h7
-rw-r--r--libarchive/archive_endian.h11
-rw-r--r--libarchive/archive_entry.c10
-rw-r--r--libarchive/archive_entry_locale.h6
-rw-r--r--libarchive/archive_entry_private.h6
-rw-r--r--libarchive/archive_getdate.c149
-rw-r--r--libarchive/archive_getdate.h6
-rw-r--r--libarchive/archive_hmac_private.h7
-rw-r--r--libarchive/archive_openssl_evp_private.h5
-rw-r--r--libarchive/archive_openssl_hmac_private.h5
-rw-r--r--libarchive/archive_options_private.h4
-rw-r--r--libarchive/archive_pack_dev.c9
-rw-r--r--libarchive/archive_pack_dev.h6
-rw-r--r--libarchive/archive_pathmatch.h6
-rw-r--r--libarchive/archive_platform_acl.h6
-rw-r--r--libarchive/archive_platform_xattr.h6
-rw-r--r--libarchive/archive_ppmd7.c2
-rw-r--r--libarchive/archive_ppmd7_private.h6
-rw-r--r--libarchive/archive_ppmd8_private.h4
-rw-r--r--libarchive/archive_ppmd_private.h6
-rw-r--r--libarchive/archive_private.h11
-rw-r--r--libarchive/archive_random_private.h6
-rw-r--r--libarchive/archive_rb.h21
-rw-r--r--libarchive/archive_read.c2
-rw-r--r--libarchive/archive_read_disk_posix.c37
-rw-r--r--libarchive/archive_read_disk_private.h6
-rw-r--r--libarchive/archive_read_private.h6
-rw-r--r--libarchive/archive_read_set_options.334
-rw-r--r--libarchive/archive_read_support_filter_uu.c30
-rw-r--r--libarchive/archive_read_support_format_7zip.c9
-rw-r--r--libarchive/archive_read_support_format_lha.c35
-rw-r--r--libarchive/archive_read_support_format_mtree.c1
-rw-r--r--libarchive/archive_read_support_format_rar.c69
-rw-r--r--libarchive/archive_read_support_format_rar5.c238
-rw-r--r--libarchive/archive_read_support_format_warc.c3
-rw-r--r--libarchive/archive_read_support_format_xar.c17
-rw-r--r--libarchive/archive_string.c3
-rw-r--r--libarchive/archive_string.h6
-rw-r--r--libarchive/archive_string_composition.h6
-rw-r--r--libarchive/archive_util.c230
-rw-r--r--libarchive/archive_windows.h8
-rw-r--r--libarchive/archive_write_disk.37
-rw-r--r--libarchive/archive_write_disk_posix.c78
-rw-r--r--libarchive/archive_write_disk_private.h6
-rw-r--r--libarchive/archive_write_disk_windows.c110
-rw-r--r--libarchive/archive_write_private.h6
-rw-r--r--libarchive/archive_write_set_format.c45
-rw-r--r--libarchive/archive_write_set_format_7zip.c3
-rw-r--r--libarchive/archive_write_set_format_ar.c1
-rw-r--r--libarchive/archive_write_set_format_cpio.c1
-rw-r--r--libarchive/archive_write_set_format_cpio_newc.c1
-rw-r--r--libarchive/archive_write_set_format_gnutar.c15
-rw-r--r--libarchive/archive_write_set_format_iso9660.c22
-rw-r--r--libarchive/archive_write_set_format_pax.c100
-rw-r--r--libarchive/archive_write_set_format_private.h42
-rw-r--r--libarchive/archive_write_set_format_shar.c5
-rw-r--r--libarchive/archive_write_set_format_ustar.c30
-rw-r--r--libarchive/archive_write_set_format_v7tar.c29
-rw-r--r--libarchive/archive_write_set_format_warc.c18
-rw-r--r--libarchive/archive_write_set_format_xar.c65
-rw-r--r--libarchive/archive_write_set_format_zip.c23
-rw-r--r--libarchive/archive_write_set_options.3237
-rw-r--r--libarchive/archive_xxhash.h5
-rw-r--r--libarchive/filter_fork.h6
-rw-r--r--libarchive/test/test_archive_write_set_format_filter_by_ext.c2
-rw-r--r--libarchive/test/test_compat_zip.c10
-rw-r--r--libarchive/test/test_fuzz.c3
-rw-r--r--libarchive/test/test_read_extract.c2
-rw-r--r--libarchive/test/test_read_format_7zip.c19
-rw-r--r--libarchive/test/test_read_format_7zip_delta4_lzma1.7z.uu407
-rw-r--r--libarchive/test/test_read_format_7zip_delta4_lzma2.7z.uu407
-rw-r--r--libarchive/test/test_read_format_7zip_packinfo_digests.c76
-rw-r--r--libarchive/test/test_read_format_gtar_sparse.c5
-rw-r--r--libarchive/test/test_read_format_rar5.c15
-rw-r--r--libarchive/test/test_read_format_rar5_block_size_is_too_small.rar.uu8
-rw-r--r--libarchive/test/test_read_format_zip.c8
-rw-r--r--libarchive/test/test_read_format_zip_7075_utf8_paths.c2
-rw-r--r--libarchive/test/test_read_format_zip_comment_stored.c2
-rw-r--r--libarchive/test/test_read_format_zip_extra_padding.c2
-rw-r--r--libarchive/test/test_read_format_zip_high_compression.c2
-rw-r--r--libarchive/test/test_read_format_zip_jar.c2
-rw-r--r--libarchive/test/test_read_format_zip_mac_metadata.c2
-rw-r--r--libarchive/test/test_read_format_zip_malformed.c2
-rw-r--r--libarchive/test/test_read_format_zip_msdos.c2
-rw-r--r--libarchive/test/test_read_format_zip_nested.c2
-rw-r--r--libarchive/test/test_read_format_zip_nofiletype.c2
-rw-r--r--libarchive/test/test_read_format_zip_padded.c2
-rw-r--r--libarchive/test/test_read_format_zip_sfx.c2
-rw-r--r--libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c2
-rw-r--r--libarchive/test/test_read_format_zip_zip64.c4
-rw-r--r--libarchive/test/test_read_pax_truncated.c6
-rw-r--r--libarchive/test/test_read_truncated_filter.c4
-rw-r--r--libarchive/test/test_sparse_basic.c6
-rw-r--r--libarchive/test/test_write_disk.c2
-rw-r--r--libarchive/test/test_write_format_cpio_empty.c2
-rw-r--r--libarchive/test/test_write_format_pax.c46
-rw-r--r--libarchive/test/test_write_format_shar_empty.c2
-rw-r--r--libarchive/test/test_write_format_tar.c2
-rw-r--r--libarchive/test/test_write_format_tar_sparse.c4
-rw-r--r--libarchive/test/test_write_format_xar.c3
-rw-r--r--libarchive/test/test_write_format_zip_file.c2
-rw-r--r--libarchive/test/test_write_format_zip_file_zip64.c2
-rw-r--r--libarchive_fe/err.h9
-rw-r--r--tar/bsdtar.149
-rw-r--r--tar/bsdtar.c6
-rw-r--r--tar/bsdtar.h7
-rw-r--r--tar/cmdline.c2
-rw-r--r--tar/test/CMakeLists.txt1
-rw-r--r--tar/test/test_basic.c2
-rw-r--r--tar/test/test_copy.c4
-rw-r--r--tar/test/test_option_C_upper.c2
-rw-r--r--tar/test/test_option_s.c6
-rw-r--r--tar/test/test_option_safe_writes.c77
-rw-r--r--tar/util.c22
-rw-r--r--test_utils/test_common.h28
-rw-r--r--test_utils/test_main.c42
141 files changed, 2767 insertions, 728 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 510cb9c29155..2ffa282479b5 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -33,6 +33,14 @@ jobs:
run: ./build/ci/build.sh -a install
env:
BS: ${{ matrix.bs }}
+ - name: Artifact
+ run: ./build/ci/build.sh -a artifact
+ env:
+ BS: ${{ matrix.bs }}
+ - uses: actions/upload-artifact@v1
+ with:
+ name: libarchive-macos-${{ matrix.bs }}-${{ github.sha }}
+ path: libarchive.tar.xz
Ubuntu:
runs-on: ubuntu-latest
@@ -66,7 +74,14 @@ jobs:
run: ./build/ci/build.sh -a install
env:
BS: ${{ matrix.bs }}
-
+ - name: Artifact
+ run: ./build/ci/build.sh -a artifact
+ env:
+ BS: ${{ matrix.bs }}
+ - uses: actions/upload-artifact@v1
+ with:
+ name: libarchive-ubuntu-${{ matrix.bs }}-${{ matrix.crypto }}-${{ github.sha }}
+ path: libarchive.tar.xz
Ubuntu-distcheck:
runs-on: ubuntu-latest
steps:
@@ -114,3 +129,12 @@ jobs:
shell: cmd
env:
BE: ${{ matrix.be }}
+ - name: Artifact
+ run: ./build/ci/github_actions/ci.cmd artifact
+ shell: cmd
+ env:
+ BE: ${{ matrix.be }}
+ - uses: actions/upload-artifact@v1
+ with:
+ name: libarchive-windows-${{ matrix.be }}-${{ github.sha }}
+ path: libarchive.zip
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 51c4c00d3569..5a9b32504439 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ endif()
# RelWithDebInfo : Release build with Debug Info
# MinSizeRel : Release Min Size build
IF(NOT CMAKE_BUILD_TYPE)
- SET(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build Type" FORCE)
+ SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
# Set a value type to properly display CMAKE_BUILD_TYPE on GUI if the
# value type is "UNINITIALIZED".
@@ -155,9 +155,9 @@ IF (MSVC)
#################################################################
# Set compile flags for debug build.
# This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug"
- # Enable level 4 C4061: The enumerate has no associated handler in a switch
- # statement.
- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4061")
+ # Enable level 4 C4062: The enumerate has no associated handler in a switch
+ # statement and there is no default that can catch it.
+ SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4062")
# Enable level 4 C4254: A larger bit field was assigned to a smaller bit
# field.
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4254")
@@ -287,6 +287,10 @@ IF("${CMAKE_C_PLATFORM_ID}" MATCHES "^(HP-UX)$")
ADD_DEFINITIONS(-D_XOPEN_SOURCE=500) # Ask wchar.h for mbstate_t
ENDIF()
+IF(MINGW)
+ ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO)
+ENDIF()
+
#
INCLUDE(CheckCSourceCompiles)
INCLUDE(CheckCSourceRuns)
@@ -1392,6 +1396,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB)
CHECK_FUNCTION_EXISTS_GLIBC(_ctime64_s HAVE__CTIME64_S)
CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64)
CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE)
+CHECK_FUNCTION_EXISTS_GLIBC(_gmtime64_s HAVE__GMTIME64_S)
CHECK_FUNCTION_EXISTS_GLIBC(_localtime64_s HAVE__LOCALTIME64_S)
CHECK_FUNCTION_EXISTS_GLIBC(_mkgmtime64 HAVE__MKGMTIME64)
diff --git a/Makefile.am b/Makefile.am
index 781bbf726c2d..41b2808e9f7d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -228,6 +228,7 @@ libarchive_la_SOURCES= \
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 \
@@ -751,7 +752,9 @@ libarchive_test_EXTRA_DIST=\
libarchive/test/test_read_format_7zip_copy_2.7z.uu \
libarchive/test/test_read_format_7zip_deflate.7z.uu \
libarchive/test/test_read_format_7zip_delta_lzma1.7z.uu \
+ libarchive/test/test_read_format_7zip_delta4_lzma1.7z.uu \
libarchive/test/test_read_format_7zip_delta_lzma2.7z.uu \
+ libarchive/test/test_read_format_7zip_delta4_lzma2.7z.uu \
libarchive/test/test_read_format_7zip_empty_archive.7z.uu \
libarchive/test/test_read_format_7zip_empty_file.7z.uu \
libarchive/test/test_read_format_7zip_encryption.7z.uu \
@@ -876,6 +879,7 @@ libarchive_test_EXTRA_DIST=\
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 \
+ libarchive/test/test_read_format_rar5_block_size_is_too_small.rar.uu \
libarchive/test/test_read_format_raw.bufr.uu \
libarchive/test/test_read_format_raw.data.gz.uu \
libarchive/test/test_read_format_raw.data.Z.uu \
@@ -1081,6 +1085,7 @@ bsdtar_test_SOURCES= \
tar/test/test_option_q.c \
tar/test/test_option_r.c \
tar/test/test_option_s.c \
+ tar/test/test_option_safe_writes.c \
tar/test/test_option_uid_uname.c \
tar/test/test_option_uuencode.c \
tar/test/test_option_xattrs.c \
diff --git a/NEWS b/NEWS
index deffabca0f7d..15360f5d9d00 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,11 @@
+Feb 11, 2020: libarchive 3.4.2 released
+
+Jan 23, 2020: Important fixes for writing XAR archives
+
+Jan 20, 2020: New tar option: --safe-writes (atomical file extraction)
+
+Jan 03, 2020: Support mbed TLS (PolarSSL) as optional crypto provider
+
Dec 30, 2019: libarchive 3.4.1 released
Dec 11, 2019: New pax write option "xattrhdr"
diff --git a/build/ci/build.sh b/build/ci/build.sh
index 97d570b5e016..0e0c2fbab0cf 100755
--- a/build/ci/build.sh
+++ b/build/ci/build.sh
@@ -42,6 +42,7 @@ while getopts a:b:c:d:s: opt; do
test) ;;
install) ;;
distcheck) ;;
+ artifact) ;;
*) inputerror "Invalid action (-a)" ;;
esac
ACTIONS="${ACTIONS} ${OPTARG}"
@@ -147,12 +148,16 @@ for action in ${ACTIONS}; do
install)
${MAKE} ${MAKE_ARGS} install DESTDIR="${BUILDDIR}/destdir"
RET="$?"
- cd ${BUILDDIR}/destdir && ls -lR .
+ cd "${BUILDDIR}/destdir" && ls -lR .
;;
distcheck)
${MAKE} ${MAKE_ARGS} distcheck
RET="$?"
;;
+ artifact)
+ tar -c -J -C "${BUILDDIR}/destdir" -f "${CURDIR}/libarchive.tar.xz" usr
+ ls -l "${CURDIR}/libarchive.tar.xz"
+ ;;
esac
if [ "${RET}" != "0" ]; then
exit "${RET}"
diff --git a/build/ci/github_actions/ci.cmd b/build/ci/github_actions/ci.cmd
index 30626d5c2a40..954d515c3b42 100755
--- a/build/ci/github_actions/ci.cmd
+++ b/build/ci/github_actions/ci.cmd
@@ -1,5 +1,6 @@
@ECHO OFF
SET ZLIB_VERSION=1.2.11
+SET BZIP2_VERSION=b7a672291188a6469f71dd13ad14f2f9a7344fc8
IF NOT "%BE%"=="mingw-gcc" (
IF NOT "%BE%"=="msvc" (
ECHO Environment variable BE must be mingw-gcc or msvc
@@ -7,20 +8,31 @@ IF NOT "%BE%"=="mingw-gcc" (
)
)
+SET ORIGPATH=%PATH%
+IF "%BE%"=="mingw-gcc" (
+ SET MINGWPATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+)
+
IF "%1"=="deplibs" (
IF NOT EXIST build_ci\libs (
MKDIR build_ci\libs
)
CD build_ci\libs
- IF NOT EXIST zlib-%ZLIB_VERSION%.tar.gz (
- curl -o zlib-%ZLIB_VERSION%.tar.gz https://www.zlib.net/zlib-%ZLIB_VERSION%.tar.gz
+ IF NOT EXIST zlib-%ZLIB_VERSION%.zip (
+ curl -L -o zlib-%ZLIB_VERSION%.zip https://github.com/libarchive/zlib/archive/v%ZLIB_VERSION%.zip
)
IF NOT EXIST zlib-%ZLIB_VERSION% (
- tar -x -z -f zlib-%ZLIB_VERSION%.tar.gz
+ tar -x -f zlib-%ZLIB_VERSION%.zip
+ )
+ IF NOT EXIST bzip2-%BZIP2_VERSION%.zip (
+ curl -L -o bzip2-%BZIP2_VERSION%.zip https://github.com/libarchive/bzip2/archive/%BZIP2_VERSION%.zip
+ )
+ IF NOT EXIST bzip2-%BZIP2_VERSION% (
+ tar -x -f bzip2-%BZIP2_VERSION%.zip
)
CD zlib-%ZLIB_VERSION%
IF "%BE%"=="mingw-gcc" (
- SET PATH=C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+ SET PATH=%MINGWPATH%
cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" . || EXIT /b 1
mingw32-make || EXIT /b 1
mingw32-make test || EXIT /b 1
@@ -31,49 +43,66 @@ IF "%1"=="deplibs" (
cmake --build . --target RUN_TESTS --config Release || EXIT /b 1
cmake --build . --target INSTALL --config Release || EXIT /b 1
)
+ CD ..
+ CD bzip2-%BZIP2_VERSION%
+ IF "%BE%"=="mingw-gcc" (
+ SET PATH=%MINGWPATH%
+ cmake -G "MinGW Makefiles" -D CMAKE_BUILD_TYPE="Release" -D ENABLE_LIB_ONLY=ON -D ENABLE_SHARED_LIB=OFF -D ENABLE_STATIC_LIB=ON . || EXIT /b 1
+ mingw32-make || EXIT /b 1
+ REM mingw32-make test || EXIT /b 1
+ mingw32-make install || EXIT /b 1
+ ) ELSE IF "%BE%"=="msvc" (
+ cmake -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE="Release" -D ENABLE_LIB_ONLY=ON -D ENABLE_SHARED_LIB=OFF -D ENABLE_STATIC_LIB=ON . || EXIT /b 1
+ cmake --build . --target ALL_BUILD --config Release || EXIT /b 1
+ REM cmake --build . --target RUN_TESTS --config Release || EXIT /b 1
+ cmake --build . --target INSTALL --config Release || EXIT /b 1
+ )
+ CD ..
) ELSE IF "%1%"=="configure" (
IF "%BE%"=="mingw-gcc" (
- SET PATH=C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+ SET PATH=%MINGWPATH%
MKDIR build_ci\cmake
CD build_ci\cmake
- cmake -G "MinGW Makefiles" ..\.. || EXIT /b 1
+ cmake -G "MinGW Makefiles" -D ZLIB_LIBRARY="C:/Program Files (x86)/zlib/lib/libzlibstatic.a" -D ZLIB_INCLUDE_DIR="C:/Program Files (x86)/zlib/include" -D BZIP2_LIBRARIES="C:/Program Files (x86)/bzip2/lib/libbz2.a" -D BZIP2_INCLUDE_DIR="C:/Program Files (x86)/bzip2/include" ..\.. || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
MKDIR build_ci\cmake
CD build_ci\cmake
- cmake -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE="Release" ..\.. || EXIT /b 1
+ cmake -G "Visual Studio 16 2019" -D CMAKE_BUILD_TYPE="Release" -D ZLIB_LIBRARY="C:/Program Files (x86)/zlib/lib/zlibstatic.lib" -D ZLIB_INCLUDE_DIR="C:/Program Files (x86)/zlib/include" -D BZIP2_LIBRARIES="C:/Program Files (x86)/bzip2/lib/bz2.lib" -D BZIP2_INCLUDE_DIR="C:/Program Files (x86)/bzip2/include" ..\.. || EXIT /b 1
)
) ELSE IF "%1%"=="build" (
IF "%BE%"=="mingw-gcc" (
- SET PATH=C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+ SET PATH=%MINGWPATH%
CD build_ci\cmake
- mingw32-make || EXIT /b 1
+ mingw32-make VERBOSE=1 || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
CD build_ci\cmake
- cmake --build . --target ALL_BUILD --config Release
+ cmake --build . --target ALL_BUILD --config Release || EXIT /b 1
)
) ELSE IF "%1%"=="test" (
IF "%BE%"=="mingw-gcc" (
- SET PATH=C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
- COPY "C:\Program Files (x86)\zlib\bin\libzlib.dll" build_ci\cmake\bin\
+ SET PATH=%MINGWPATH%
CD build_ci\cmake
SET SKIP_TEST_SPARSE=1
- mingw32-make test
+ mingw32-make test VERBOSE=1 || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
ECHO "Skipping tests on this platform"
EXIT /b 0
REM CD build_ci\cmake
- REM cmake --build . --target RUN_TESTS --config Release
+ REM cmake --build . --target RUN_TESTS --config Release || EXIT /b 1
)
) ELSE IF "%1%"=="install" (
IF "%BE%"=="mingw-gcc" (
- SET PATH=C:\Program Files\cmake\bin;C:\ProgramData\chocolatey\lib\mingw\tools\install\mingw64\bin
+ SET PATH=%MINGWPATH%
CD build_ci\cmake
- mingw32-make install DESTDIR=%cd%\destdir
+ mingw32-make install || EXIT /b 1
) ELSE IF "%BE%"=="msvc" (
- cmake --build . --target INSTALL --config Release
+ CD build_ci\cmake
+ cmake --build . --target INSTALL --config Release || EXIT /b 1
)
+) ELSE IF "%1"=="artifact" (
+ tar -c -C "C:\Program Files (x86)" --format=zip -f libarchive.zip libarchive
) ELSE (
- ECHO "Usage: %0% deplibs|configure|build|test|install"
+ ECHO "Usage: %0% deplibs|configure|build|test|install|artifact"
@EXIT /b 0
)
@EXIT /b 0
diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in
index 3b1f0b95c8fb..fcbd80c5a171 100644
--- a/build/cmake/config.h.in
+++ b/build/cmake/config.h.in
@@ -1210,6 +1210,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have the `_get_timezone' function. */
#cmakedefine HAVE__GET_TIMEZONE 1
+/* Define to 1 if you have the `_gmtime64_s' function. */
+#cmakedefine HAVE__GMTIME64_S 1
+
/* Define to 1 if you have the `_localtime64_s' function. */
#cmakedefine HAVE__LOCALTIME64_S 1
diff --git a/build/release/Dockerfile b/build/release/Dockerfile
new file mode 100644
index 000000000000..76944f40c484
--- /dev/null
+++ b/build/release/Dockerfile
@@ -0,0 +1,11 @@
+FROM ubuntu:18.04
+RUN apt-get update && apt-get install -y build-essential autoconf automake libtool pkg-config cmake libssl-dev libacl1-dev libbz2-dev liblzma-dev libzip-dev liblz4-dev libzstd-dev lzop groff ghostscript bsdmainutils zip
+ADD . $HOME/libarchive/
+ADD "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD" $HOME/libarchive/build/autoconf/config.guess
+ADD "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD" $HOME/libarchive/build/autoconf/config.sub
+WORKDIR $HOME/libarchive
+RUN /bin/sh build/clean.sh
+RUN /bin/sh build/autogen.sh
+ENV SKIP_OPEN_FD_ERR_TEST=1 SKIP_TEST_SPARSE=1
+RUN ./configure
+RUN make V=1 distcheck
diff --git a/build/release/release.sh b/build/release/release.sh
new file mode 100755
index 000000000000..4d0803892687
--- /dev/null
+++ b/build/release/release.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+ID=$(docker build -q -f build/release/Dockerfile .)
+if [ -z "$ID" ]; then
+ echo "Failed to build docker image"
+ exit 1
+else
+ docker run $ID sh -c "tar -c -f - libarchive-*" | tar -x -f -
+fi
diff --git a/build/version b/build/version
index bd97679ec3cc..78be3ab7e349 100644
--- a/build/version
+++ b/build/version
@@ -1 +1 @@
-3004002dev
+3004002
diff --git a/cat/bsdcat.h b/cat/bsdcat.h
index 2e055e7c187c..6467d6e3d310 100644
--- a/cat/bsdcat.h
+++ b/cat/bsdcat.h
@@ -23,6 +23,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef BSDCAT_H_INCLUDED
+#define BSDCAT_H_INCLUDED
+
#if defined(PLATFORM_CONFIG_H)
/* Use hand-built config.h in environments that need it. */
#include PLATFORM_CONFIG_H
@@ -54,3 +57,5 @@ void usage(FILE *stream, int eval);
void bsdcat_next(void);
void bsdcat_print_error(void);
void bsdcat_read_to_stdout(const char* filename);
+
+#endif
diff --git a/cat/test/test_0.c b/cat/test/test_0.c
index f9fe5d8473f9..c806c24356c0 100644
--- a/cat/test/test_0.c
+++ b/cat/test/test_0.c
@@ -59,7 +59,7 @@ DEFINE_TEST(test_0)
* we know some option that will succeed.
*/
if (0 != systemf("%s --version >" DEV_NULL, testprog)) {
- failure("Unable to successfully run: %s --version\n", testprog, testprog);
+ failure("Unable to successfully run: %s --version\n", testprog);
assert(0);
}
diff --git a/configure.ac b/configure.ac
index ce90ee83957f..2581087988bf 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@ 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.4.2dev])
+m4_define([LIBARCHIVE_VERSION_S],[3.4.2])
m4_define([LIBARCHIVE_VERSION_N],[3004002])
dnl bsdtar and bsdcpio versioning tracks libarchive
@@ -641,7 +641,7 @@ AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm])
AC_CHECK_FUNCS([tzset unlinkat unsetenv utime utimensat utimes vfork])
AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove])
AC_CHECK_FUNCS([_ctime64_s _fseeki64])
-AC_CHECK_FUNCS([_get_timezone _localtime64_s _mkgmtime64])
+AC_CHECK_FUNCS([_get_timezone _gmtime64_s _localtime64_s _mkgmtime64])
# detects cygwin-1.7, as opposed to older versions
AC_CHECK_FUNCS([cygwin_conv_path])
diff --git a/contrib/archivetest.c b/contrib/archivetest.c
index 8002039ee4e2..e4a25e3c911d 100644
--- a/contrib/archivetest.c
+++ b/contrib/archivetest.c
@@ -37,10 +37,14 @@
#include <archive.h>
#include <archive_entry.h>
-const char *errnostr(int errno)
+#if defined __MINGW32__
+#include <getopt.h>
+#endif
+
+static const char *errnostr(int e)
{
char *estr;
- switch(errno) {
+ switch(e) {
case ARCHIVE_EOF:
estr = "ARCHIVE_EOF";
break;
@@ -66,12 +70,12 @@ const char *errnostr(int errno)
return (estr);
}
-void usage(const char *prog)
+static void usage(const char *prog)
{
fprintf(stderr, "Usage: %s [-f filename] [-h] [-q] [-s]\n", prog);
}
-void printhelp()
+static void printhelp()
{
fprintf(stdout, "archivetest: verify reading archives with "
"libarchive\n\n"
@@ -84,7 +88,7 @@ void printhelp()
"\n%s\n", archive_version_details());
}
-int v_print(int verbose, const char *format, ...)
+static int v_print(int verbose, const char *format, ...)
{
int r = 0;
@@ -139,6 +143,8 @@ int main(int argc, char *argv[])
fprintf(stderr, "Unknown option "
"character '\\x%x'.\n", optopt);
usage(argv[0]);
+ exit(1);
+ break;
default:
exit(1);
}
diff --git a/cpio/cpio.c b/cpio/cpio.c
index 4fd394dea5f1..da5c39860018 100644
--- a/cpio/cpio.c
+++ b/cpio/cpio.c
@@ -1139,6 +1139,14 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
const char *fmt;
time_t mtime;
static time_t now;
+ struct tm *ltime;
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+ struct tm tmbuf;
+#endif
+#if defined(HAVE__LOCALTIME64_S)
+ errno_t terr;
+ __time64_t tmptime;
+#endif
if (!now)
time(&now);
@@ -1186,7 +1194,19 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry)
else
fmt = cpio->day_first ? "%e %b %H:%M" : "%b %e %H:%M";
#endif
- strftime(date, sizeof(date), fmt, localtime(&mtime));
+#if defined(HAVE_LOCALTIME_R)
+ ltime = localtime_r(&mtime, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+ tmptime = mtime;
+ terr = _localtime64_s(&tmbuf, &tmptime);
+ if (terr)
+ ltime = NULL;
+ else
+ ltime = &tmbuf;
+#else
+ ltime = localtime(&mtime);
+#endif
+ strftime(date, sizeof(date), fmt, ltime);
fprintf(out, "%s%3d %-8s %-8s %8s %12s %s",
archive_entry_strmode(entry),
diff --git a/cpio/test/test_basic.c b/cpio/test/test_basic.c
index a8fedf89e968..b716253408fa 100644
--- a/cpio/test/test_basic.c
+++ b/cpio/test/test_basic.c
@@ -33,15 +33,15 @@ verify_files(const char *msg)
*/
/* Regular file with 2 links. */
- failure(msg);
+ failure("%s", msg);
assertIsReg("file", 0644);
- failure(msg);
+ failure("%s", msg);
assertFileSize("file", 10);
- failure(msg);
+ failure("%s", msg);
assertFileNLinks("file", 2);
/* Another name for the same file. */
- failure(msg);
+ failure("%s", msg);
assertIsHardlink("linkfile", "file");
/* Symlink */
@@ -49,11 +49,11 @@ verify_files(const char *msg)
assertIsSymlink("symlink", "file", 0);
/* Another file with 1 link and different permissions. */
- failure(msg);
+ failure("%s", msg);
assertIsReg("file2", 0777);
- failure(msg);
+ failure("%s", msg);
assertFileSize("file2", 10);
- failure(msg);
+ failure("%s", msg);
assertFileNLinks("file2", 1);
/* dir */
diff --git a/cpio/test/test_format_newc.c b/cpio/test/test_format_newc.c
index 6c981f6ac139..49387a73580b 100644
--- a/cpio/test/test_format_newc.c
+++ b/cpio/test/test_format_newc.c
@@ -205,9 +205,11 @@ DEFINE_TEST(test_format_newc)
gid = from_hex(e + 30, 8); /* gid */
assertEqualMem(e + 38, "00000003", 8); /* nlink */
t = from_hex(e + 46, 8); /* mtime */
- failure("t=0x%08x now=0x%08x=%d", t, now, now);
+ failure("t=%#08jx now=%#08jx=%jd", (intmax_t)t, (intmax_t)now,
+ (intmax_t)now);
assert(t <= now); /* File wasn't created in future. */
- failure("t=0x%08x now - 2=0x%08x = %d", t, now - 2, now - 2);
+ failure("t=%#08jx now - 2=%#08jx=%jd", (intmax_t)t, (intmax_t)now - 2,
+ (intmax_t)now - 2);
assert(t >= now - 2); /* File was created w/in last 2 secs. */
failure("newc format stores body only with last appearance of a link\n"
" first appearance should be empty, so this file size\n"
@@ -243,7 +245,8 @@ DEFINE_TEST(test_format_newc)
assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
assertEqualMem(e + 38, "00000001", 8); /* nlink */
t2 = from_hex(e + 46, 8); /* mtime */
- failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+ failure("First entry created at t=%#08jx this entry created"
+ " at t2=%#08jx", (intmax_t)t, (intmax_t)t2);
assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
assertEqualMem(e + 54, "00000005", 8); /* File size */
fs = from_hex(e + 54, 8);
@@ -278,7 +281,8 @@ DEFINE_TEST(test_format_newc)
assertEqualInt(nlinks("dir"), from_hex(e + 38, 8)); /* nlinks */
#endif
t2 = from_hex(e + 46, 8); /* mtime */
- failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+ failure("First entry created at t=%#08jx this entry created at"
+ "t2=%#08jx", (intmax_t)t, (intmax_t)t2);
assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
assertEqualMem(e + 54, "00000000", 8); /* File size */
fs = from_hex(e + 54, 8);
@@ -311,7 +315,8 @@ DEFINE_TEST(test_format_newc)
assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
assertEqualMem(e + 38, "00000003", 8); /* nlink */
t2 = from_hex(e + 46, 8); /* mtime */
- failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+ failure("First entry created at t=%#08jx this entry created at"
+ "t2=%#08jx", (intmax_t)t, (intmax_t)t2);
assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
assertEqualInt(10, from_hex(e + 54, 8)); /* File size */
fs = from_hex(e + 54, 8);
diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt
index ec775bb49939..9389bbc9a95b 100644
--- a/libarchive/CMakeLists.txt
+++ b/libarchive/CMakeLists.txt
@@ -150,6 +150,7 @@ SET(libarchive_SOURCES
archive_write_set_format_iso9660.c
archive_write_set_format_mtree.c
archive_write_set_format_pax.c
+ archive_write_set_format_private.h
archive_write_set_format_raw.c
archive_write_set_format_shar.c
archive_write_set_format_ustar.c
diff --git a/libarchive/archive.h b/libarchive/archive.h
index fe6dc63c8ea3..55818eac8e68 100644
--- a/libarchive/archive.h
+++ b/libarchive/archive.h
@@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void);
/*
* Textual name/version of the library, useful for version displays.
*/
-#define ARCHIVE_VERSION_ONLY_STRING "3.4.2dev"
+#define ARCHIVE_VERSION_ONLY_STRING "3.4.2"
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
__LA_DECL const char * archive_version_string(void);
@@ -693,6 +693,8 @@ __LA_DECL int archive_read_set_passphrase_callback(struct archive *,
#define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000)
/* Default: Do not clear no-change flags when unlinking object */
#define ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS (0x20000)
+/* Default: Do not extract atomically (using rename) */
+#define ARCHIVE_EXTRACT_SAFE_WRITES (0x40000)
__LA_DECL int archive_read_extract(struct archive *, struct archive_entry *,
int flags);
diff --git a/libarchive/archive_acl_private.h b/libarchive/archive_acl_private.h
index ef0b0234cc1a..af108162c664 100644
--- a/libarchive/archive_acl_private.h
+++ b/libarchive/archive_acl_private.h
@@ -25,13 +25,13 @@
* $FreeBSD$
*/
+#ifndef ARCHIVE_ACL_PRIVATE_H_INCLUDED
+#define ARCHIVE_ACL_PRIVATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_ACL_PRIVATE_H_INCLUDED
-#define ARCHIVE_ACL_PRIVATE_H_INCLUDED
-
#include "archive_string.h"
struct archive_acl_entry {
diff --git a/libarchive/archive_blake2.h b/libarchive/archive_blake2.h
index 337be194654e..dd6fe6fe5a98 100644
--- a/libarchive/archive_blake2.h
+++ b/libarchive/archive_blake2.h
@@ -12,8 +12,9 @@
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
-#ifndef BLAKE2_H
-#define BLAKE2_H
+
+#ifndef ARCHIVE_BLAKE2_H
+#define ARCHIVE_BLAKE2_H
#include <stddef.h>
#include <stdint.h>
diff --git a/libarchive/archive_blake2_impl.h b/libarchive/archive_blake2_impl.h
index c1df82e0c95d..0f05defea36f 100644
--- a/libarchive/archive_blake2_impl.h
+++ b/libarchive/archive_blake2_impl.h
@@ -12,8 +12,9 @@
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
-#ifndef BLAKE2_IMPL_H
-#define BLAKE2_IMPL_H
+
+#ifndef ARCHIVE_BLAKE2_IMPL_H
+#define ARCHIVE_BLAKE2_IMPL_H
#include <stdint.h>
#include <string.h>
diff --git a/libarchive/archive_cmdline_private.h b/libarchive/archive_cmdline_private.h
index 4e409e814817..57a19494fd7a 100644
--- a/libarchive/archive_cmdline_private.h
+++ b/libarchive/archive_cmdline_private.h
@@ -25,15 +25,15 @@
* $FreeBSD$
*/
+#ifndef ARCHIVE_CMDLINE_PRIVATE_H
+#define ARCHIVE_CMDLINE_PRIVATE_H
+
#ifndef __LIBARCHIVE_BUILD
#ifndef __LIBARCHIVE_TEST
#error This header is only to be used internally to libarchive.
#endif
#endif
-#ifndef ARCHIVE_CMDLINE_PRIVATE_H
-#define ARCHIVE_CMDLINE_PRIVATE_H
-
struct archive_cmdline {
char *path;
char **argv;
diff --git a/libarchive/archive_crc32.h b/libarchive/archive_crc32.h
index cd633af89b4a..4f1aed305930 100644
--- a/libarchive/archive_crc32.h
+++ b/libarchive/archive_crc32.h
@@ -25,6 +25,9 @@
* $FreeBSD: head/lib/libarchive/archive_crc32.h 201102 2009-12-28 03:11:36Z kientzle $
*/
+#ifndef ARCHIVE_CRC32_H
+#define ARCHIVE_CRC32_H
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
@@ -76,3 +79,5 @@ crc32(unsigned long crc, const void *_p, size_t len)
crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
return (crc ^ 0xffffffffUL);
}
+
+#endif
diff --git a/libarchive/archive_cryptor_private.h b/libarchive/archive_cryptor_private.h
index 0063f3e00149..64a20556a399 100644
--- a/libarchive/archive_cryptor_private.h
+++ b/libarchive/archive_cryptor_private.h
@@ -23,13 +23,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __LIBARCHIVE_BUILD
-#error This header is only to be used internally to libarchive.
-#endif
-
#ifndef ARCHIVE_CRYPTOR_PRIVATE_H_INCLUDED
#define ARCHIVE_CRYPTOR_PRIVATE_H_INCLUDED
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
/*
* On systems that do not support any recognized crypto libraries,
* the archive_cryptor.c file will normally define no usable symbols.
diff --git a/libarchive/archive_digest_private.h b/libarchive/archive_digest_private.h
index 2685b4a017db..15312ee9a07a 100644
--- a/libarchive/archive_digest_private.h
+++ b/libarchive/archive_digest_private.h
@@ -24,13 +24,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef ARCHIVE_DIGEST_PRIVATE_H_INCLUDED
+#define ARCHIVE_DIGEST_PRIVATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-
-#ifndef ARCHIVE_CRYPTO_PRIVATE_H_INCLUDED
-#define ARCHIVE_CRYPTO_PRIVATE_H_INCLUDED
-
/*
* Crypto support in various Operating Systems:
*
diff --git a/libarchive/archive_endian.h b/libarchive/archive_endian.h
index 1c48563b137d..e6d3f2ce5e70 100644
--- a/libarchive/archive_endian.h
+++ b/libarchive/archive_endian.h
@@ -28,16 +28,15 @@
* Borrowed from FreeBSD's <sys/endian.h>
*/
-#ifndef __LIBARCHIVE_BUILD
-#error This header is only to be used internally to libarchive.
-#endif
+#ifndef ARCHIVE_ENDIAN_H_INCLUDED
+#define ARCHIVE_ENDIAN_H_INCLUDED
/* Note: This is a purely internal header! */
/* Do not use this outside of libarchive internal code! */
-#ifndef ARCHIVE_ENDIAN_H_INCLUDED
-#define ARCHIVE_ENDIAN_H_INCLUDED
-
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
/*
* Disabling inline keyword for compilers known to choke on it:
diff --git a/libarchive/archive_entry.c b/libarchive/archive_entry.c
index 72c644e6079b..a15e98c28425 100644
--- a/libarchive/archive_entry.c
+++ b/libarchive/archive_entry.c
@@ -1699,7 +1699,7 @@ static const struct flag {
const wchar_t *wname;
unsigned long set;
unsigned long clear;
-} flags[] = {
+} fileflags[] = {
/* Preferred (shorter) names per flag first, all prefixed by "no" */
#ifdef SF_APPEND
{ "nosappnd", L"nosappnd", SF_APPEND, 0},
@@ -1876,7 +1876,7 @@ ae_fflagstostr(unsigned long bitset, unsigned long bitclear)
bits = bitset | bitclear;
length = 0;
- for (flag = flags; flag->name != NULL; flag++)
+ for (flag = fileflags; flag->name != NULL; flag++)
if (bits & (flag->set | flag->clear)) {
length += strlen(flag->name) + 1;
bits &= ~(flag->set | flag->clear);
@@ -1889,7 +1889,7 @@ ae_fflagstostr(unsigned long bitset, unsigned long bitclear)
return (NULL);
dp = string;
- for (flag = flags; flag->name != NULL; flag++) {
+ for (flag = fileflags; flag->name != NULL; flag++) {
if (bitset & flag->set || bitclear & flag->clear) {
sp = flag->name + 2;
} else if (bitset & flag->clear || bitclear & flag->set) {
@@ -1941,7 +1941,7 @@ ae_strtofflags(const char *s, unsigned long *setp, unsigned long *clrp)
*end != ' ' && *end != ',')
end++;
length = end - start;
- for (flag = flags; flag->name != NULL; flag++) {
+ for (flag = fileflags; flag->name != NULL; flag++) {
size_t flag_length = strlen(flag->name);
if (length == flag_length
&& memcmp(start, flag->name, length) == 0) {
@@ -2009,7 +2009,7 @@ ae_wcstofflags(const wchar_t *s, unsigned long *setp, unsigned long *clrp)
*end != L' ' && *end != L',')
end++;
length = end - start;
- for (flag = flags; flag->wname != NULL; flag++) {
+ for (flag = fileflags; flag->wname != NULL; flag++) {
size_t flag_length = wcslen(flag->wname);
if (length == flag_length
&& wmemcmp(start, flag->wname, length) == 0) {
diff --git a/libarchive/archive_entry_locale.h b/libarchive/archive_entry_locale.h
index 44550c51ec6a..803c0368bb69 100644
--- a/libarchive/archive_entry_locale.h
+++ b/libarchive/archive_entry_locale.h
@@ -25,13 +25,13 @@
* $FreeBSD$
*/
+#ifndef ARCHIVE_ENTRY_LOCALE_H_INCLUDED
+#define ARCHIVE_ENTRY_LOCALE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_ENTRY_LOCALE_H_INCLUDED
-#define ARCHIVE_ENTRY_LOCALE_H_INCLUDED
-
struct archive_entry;
struct archive_string_conv;
diff --git a/libarchive/archive_entry_private.h b/libarchive/archive_entry_private.h
index 3d569bbfc6b5..2b9a084ca154 100644
--- a/libarchive/archive_entry_private.h
+++ b/libarchive/archive_entry_private.h
@@ -25,13 +25,13 @@
* $FreeBSD: head/lib/libarchive/archive_entry_private.h 201096 2009-12-28 02:41:27Z kientzle $
*/
+#ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
+#define ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
-#define ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
-
#include "archive_acl_private.h"
#include "archive_string.h"
diff --git a/libarchive/archive_getdate.c b/libarchive/archive_getdate.c
index 030c083ce716..3ec5bba88896 100644
--- a/libarchive/archive_getdate.c
+++ b/libarchive/archive_getdate.c
@@ -27,6 +27,7 @@
** This code is in the public domain and has no copyright.
*/
+#include "archive_platform.h"
#ifdef __FreeBSD__
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
@@ -694,8 +695,16 @@ Convert(time_t Month, time_t Day, time_t Year,
signed char DaysInMonth[12] = {
31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
- time_t Julian;
- int i;
+ time_t Julian;
+ int i;
+ struct tm *ltime;
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+ struct tm tmbuf;
+#endif
+#if defined(HAVE__LOCALTIME64_S)
+ errno_t terr;
+ __time64_t tmptime;
+#endif
if (Year < 69)
Year += 2000;
@@ -722,21 +731,64 @@ Convert(time_t Month, time_t Day, time_t Year,
Julian *= DAY;
Julian += Timezone;
Julian += Hours * HOUR + Minutes * MINUTE + Seconds;
+#if defined(HAVE_LOCALTIME_R)
+ ltime = localtime_r(&Julian, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+ tmptime = Julian;
+ terr = _localtime64_s(&tmbuf, &tmptime);
+ if (terr)
+ ltime = NULL;
+ else
+ ltime = &tmbuf;
+#else
+ ltime = localtime(&Julian);
+#endif
if (DSTmode == DSTon
- || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
+ || (DSTmode == DSTmaybe && ltime->tm_isdst))
Julian -= HOUR;
return Julian;
}
-
static time_t
DSTcorrect(time_t Start, time_t Future)
{
- time_t StartDay;
- time_t FutureDay;
+ time_t StartDay;
+ time_t FutureDay;
+ struct tm *ltime;
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+ struct tm tmbuf;
+#endif
+#if defined(HAVE__LOCALTIME64_S)
+ errno_t terr;
+ __time64_t tmptime;
+#endif
- StartDay = (localtime(&Start)->tm_hour + 1) % 24;
- FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
+#if defined(HAVE_LOCALTIME_R)
+ ltime = localtime_r(&Start, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+ tmptime = Start;
+ terr = _localtime64_s(&tmbuf, &tmptime);
+ if (terr)
+ ltime = NULL;
+ else
+ ltime = &tmbuf;
+#else
+ ltime = localtime(&Start);
+#endif
+ StartDay = (ltime->tm_hour + 1) % 24;
+#if defined(HAVE_LOCALTIME_R)
+ ltime = localtime_r(&Future, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+ tmptime = Future;
+ terr = _localtime64_s(&tmbuf, &tmptime);
+ if (terr)
+ ltime = NULL;
+ else
+ ltime = &tmbuf;
+#else
+ ltime = localtime(&Future);
+#endif
+ FutureDay = (ltime->tm_hour + 1) % 24;
return (Future - Start) + (StartDay - FutureDay) * HOUR;
}
@@ -747,9 +799,27 @@ RelativeDate(time_t Start, time_t zone, int dstmode,
{
struct tm *tm;
time_t t, now;
+#if defined(HAVE_GMTIME_R) || defined(HAVE__GMTIME64_S)
+ struct tm tmbuf;
+#endif
+#if defined(HAVE__GMTIME64_S)
+ errno_t terr;
+ __time64_t tmptime;
+#endif
t = Start - zone;
+#if defined(HAVE_GMTIME_R)
+ tm = gmtime_r(&t, &tmbuf);
+#elif defined(HAVE__GMTIME64_S)
+ tmptime = t;
+ terr = _gmtime64_s(&tmbuf, &tmptime);
+ if (terr)
+ tm = NULL;
+ else
+ tm = &tmbuf;
+#else
tm = gmtime(&t);
+#endif
now = Start;
now += DAY * ((DayNumber - tm->tm_wday + 7) % 7);
now += 7 * DAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
@@ -765,10 +835,28 @@ RelativeMonth(time_t Start, time_t Timezone, time_t RelMonth)
struct tm *tm;
time_t Month;
time_t Year;
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+ struct tm tmbuf;
+#endif
+#if defined(HAVE__LOCALTIME64_S)
+ errno_t terr;
+ __time64_t tmptime;
+#endif
if (RelMonth == 0)
return 0;
+#if defined(HAVE_LOCALTIME_R)
+ tm = localtime_r(&Start, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+ tmptime = Start;
+ terr = _localtime64_s(&tmbuf, &tmptime);
+ if (terr)
+ tm = NULL;
+ else
+ tm = &tmbuf;
+#else
tm = localtime(&Start);
+#endif
Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth;
Year = Month / 12;
Month = Month % 12 + 1;
@@ -905,6 +993,10 @@ __archive_get_date(time_t now, const char *p)
time_t Start;
time_t tod;
long tzone;
+#if defined(HAVE__LOCALTIME64_S) || defined(HAVE__GMTIME64_S)
+ errno_t terr;
+ __time64_t tmptime;
+#endif
/* Clear out the parsed token array. */
memset(tokens, 0, sizeof(tokens));
@@ -913,20 +1005,44 @@ __archive_get_date(time_t now, const char *p)
gds = &_gds;
/* Look up the current time. */
+#if defined(HAVE_LOCALTIME_R)
+ tm = localtime_r(&now, &local);
+#elif defined(HAVE__LOCALTIME64_S)
+ tmptime = now;
+ terr = _localtime64_s(&local, &tmptime);
+ if (terr)
+ tm = NULL;
+ else
+ tm = &local;
+#else
memset(&local, 0, sizeof(local));
- tm = localtime (&now);
+ tm = localtime(&now);
+#endif
if (tm == NULL)
return -1;
+#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE__LOCALTIME64_S)
local = *tm;
+#endif
/* Look up UTC if we can and use that to determine the current
* timezone offset. */
+#if defined(HAVE_GMTIME_R)
+ gmt_ptr = gmtime_r(&now, &gmt);
+#elif defined(HAVE__GMTIME64_S)
+ tmptime = now;
+ terr = _gmtime64_s(&gmt, &tmptime);
+ if (terr)
+ gmt_ptr = NULL;
+ else
+ gmt_ptr = &gmt;
+#else
memset(&gmt, 0, sizeof(gmt));
- gmt_ptr = gmtime (&now);
+ gmt_ptr = gmtime(&now);
if (gmt_ptr != NULL) {
/* Copy, in case localtime and gmtime use the same buffer. */
gmt = *gmt_ptr;
}
+#endif
if (gmt_ptr != NULL)
tzone = difftm (&gmt, &local);
else
@@ -960,7 +1076,18 @@ __archive_get_date(time_t now, const char *p)
* time components instead of the local timezone. */
if (gds->HaveZone && gmt_ptr != NULL) {
now -= gds->Timezone;
- gmt_ptr = gmtime (&now);
+#if defined(HAVE_GMTIME_R)
+ gmt_ptr = gmtime_r(&now, &gmt);
+#elif defined(HAVE__GMTIME64_S)
+ tmptime = now;
+ terr = _gmtime64_s(&gmt, &tmptime);
+ if (terr)
+ gmt_ptr = NULL;
+ else
+ gmt_ptr = &gmt;
+#else
+ gmt_ptr = gmtime(&now);
+#endif
if (gmt_ptr != NULL)
local = *gmt_ptr;
now += gds->Timezone;
diff --git a/libarchive/archive_getdate.h b/libarchive/archive_getdate.h
index 666ff5ff78b9..900a8f692e98 100644
--- a/libarchive/archive_getdate.h
+++ b/libarchive/archive_getdate.h
@@ -25,13 +25,13 @@
* $FreeBSD$
*/
+#ifndef ARCHIVE_GETDATE_H_INCLUDED
+#define ARCHIVE_GETDATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_GETDATE_H_INCLUDED
-#define ARCHIVE_GETDATE_H_INCLUDED
-
#include <time.h>
time_t __archive_get_date(time_t now, const char *);
diff --git a/libarchive/archive_hmac_private.h b/libarchive/archive_hmac_private.h
index b7b365c7ad42..13a67d4955a5 100644
--- a/libarchive/archive_hmac_private.h
+++ b/libarchive/archive_hmac_private.h
@@ -23,13 +23,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef __LIBARCHIVE_BUILD
-#error This header is only to be used internally to libarchive.
-#endif
-
#ifndef ARCHIVE_HMAC_PRIVATE_H_INCLUDED
#define ARCHIVE_HMAC_PRIVATE_H_INCLUDED
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
/*
* On systems that do not support any recognized crypto libraries,
* the archive_hmac.c file is expected to define no usable symbols.
diff --git a/libarchive/archive_openssl_evp_private.h b/libarchive/archive_openssl_evp_private.h
index 43a3ccc52a1d..ebb06702d0c5 100644
--- a/libarchive/archive_openssl_evp_private.h
+++ b/libarchive/archive_openssl_evp_private.h
@@ -22,9 +22,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#ifndef ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
#define ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
#include <openssl/evp.h>
#include <openssl/opensslv.h>
diff --git a/libarchive/archive_openssl_hmac_private.h b/libarchive/archive_openssl_hmac_private.h
index 921249bb9450..25c8dda654fc 100644
--- a/libarchive/archive_openssl_hmac_private.h
+++ b/libarchive/archive_openssl_hmac_private.h
@@ -22,9 +22,14 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+
#ifndef ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
#define ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
#include <openssl/hmac.h>
#include <openssl/opensslv.h>
diff --git a/libarchive/archive_options_private.h b/libarchive/archive_options_private.h
index 6ef0165aff68..9a7f8080d2f6 100644
--- a/libarchive/archive_options_private.h
+++ b/libarchive/archive_options_private.h
@@ -23,6 +23,9 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef ARCHIVE_OPTIONS_PRIVATE_H_INCLUDED
+#define ARCHIVE_OPTIONS_PRIVATE_H_INCLUDED
+
#include "archive_platform.h"
__FBSDID("$FreeBSD$");
@@ -45,3 +48,4 @@ _archive_set_either_option(struct archive *a,
const char *m, const char *o, const char *v,
option_handler use_format_option, option_handler use_filter_option);
+#endif
diff --git a/libarchive/archive_pack_dev.c b/libarchive/archive_pack_dev.c
index a5e57ac209d4..f8286d82183f 100644
--- a/libarchive/archive_pack_dev.c
+++ b/libarchive/archive_pack_dev.c
@@ -57,11 +57,12 @@ __RCSID("$NetBSD$");
#ifdef HAVE_SYS_STAT_H
#include <sys/stat.h>
#endif
-#ifdef HAVE_SYS_SYSMACROS_H
-#include <sys/sysmacros.h>
-#endif
-#ifdef HAVE_SYS_MKDEV_H
+#if MAJOR_IN_MKDEV
#include <sys/mkdev.h>
+#define HAVE_MAJOR
+#elif MAJOR_IN_SYSMACROS
+#include <sys/sysmacros.h>
+#define HAVE_MAJOR
#endif
#ifdef HAVE_UNISTD_H
#include <unistd.h>
diff --git a/libarchive/archive_pack_dev.h b/libarchive/archive_pack_dev.h
index 749fd3d2cb65..eaf23e3883ef 100644
--- a/libarchive/archive_pack_dev.h
+++ b/libarchive/archive_pack_dev.h
@@ -31,8 +31,8 @@
/* Originally from NetBSD's mknod(8) source. */
-#ifndef _PACK_DEV_H
-#define _PACK_DEV_H
+#ifndef ARCHIVE_PACK_DEV_H
+#define ARCHIVE_PACK_DEV_H
typedef dev_t pack_t(int, unsigned long [], const char **);
@@ -46,4 +46,4 @@ pack_t pack_native;
(((y) << 12) & 0xfff00000) | \
(((y) << 0) & 0x000000ff)))
-#endif /* _PACK_DEV_H */
+#endif /* ARCHIVE_PACK_DEV_H */
diff --git a/libarchive/archive_pathmatch.h b/libarchive/archive_pathmatch.h
index e6901774dddb..9995142921e5 100644
--- a/libarchive/archive_pathmatch.h
+++ b/libarchive/archive_pathmatch.h
@@ -26,15 +26,15 @@
* $FreeBSD$
*/
+#ifndef ARCHIVE_PATHMATCH_H
+#define ARCHIVE_PATHMATCH_H
+
#ifndef __LIBARCHIVE_BUILD
#ifndef __LIBARCHIVE_TEST
#error This header is only to be used internally to libarchive.
#endif
#endif
-#ifndef ARCHIVE_PATHMATCH_H
-#define ARCHIVE_PATHMATCH_H
-
/* Don't anchor at beginning unless the pattern starts with "^" */
#define PATHMATCH_NO_ANCHOR_START 1
/* Don't anchor at end unless the pattern ends with "$" */
diff --git a/libarchive/archive_platform_acl.h b/libarchive/archive_platform_acl.h
index 3498f78b3c85..264e6de375a1 100644
--- a/libarchive/archive_platform_acl.h
+++ b/libarchive/archive_platform_acl.h
@@ -30,6 +30,12 @@
#ifndef ARCHIVE_PLATFORM_ACL_H_INCLUDED
#define ARCHIVE_PLATFORM_ACL_H_INCLUDED
+#ifndef __LIBARCHIVE_BUILD
+#ifndef __LIBARCHIVE_TEST_COMMON
+#error This header is only to be used internally to libarchive.
+#endif
+#endif
+
/*
* Determine what ACL types are supported
*/
diff --git a/libarchive/archive_platform_xattr.h b/libarchive/archive_platform_xattr.h
index 4edfecfdbdf1..ad4b90ab7b2a 100644
--- a/libarchive/archive_platform_xattr.h
+++ b/libarchive/archive_platform_xattr.h
@@ -30,6 +30,12 @@
#ifndef ARCHIVE_PLATFORM_XATTR_H_INCLUDED
#define ARCHIVE_PLATFORM_XATTR_H_INCLUDED
+#ifndef __LIBARCHIVE_BUILD
+#ifndef __LIBARCHIVE_TEST_COMMON
+#error This header is only to be used internally to libarchive.
+#endif
+#endif
+
/*
* Determine if we support extended attributes
*/
diff --git a/libarchive/archive_ppmd7.c b/libarchive/archive_ppmd7.c
index d0bacc68cd7c..4029395b4c7f 100644
--- a/libarchive/archive_ppmd7.c
+++ b/libarchive/archive_ppmd7.c
@@ -1000,7 +1000,7 @@ static void RangeEnc_ShiftLow(CPpmd7z_RangeEnc *p)
static void RangeEnc_Encode(CPpmd7z_RangeEnc *p, UInt32 start, UInt32 size, UInt32 total)
{
- p->Low += start * (p->Range /= total);
+ p->Low += (UInt64)start * (UInt64)(p->Range /= total);
p->Range *= size;
while (p->Range < kTopValue)
{
diff --git a/libarchive/archive_ppmd7_private.h b/libarchive/archive_ppmd7_private.h
index 577d6fb43d0b..71b954458c65 100644
--- a/libarchive/archive_ppmd7_private.h
+++ b/libarchive/archive_ppmd7_private.h
@@ -6,13 +6,13 @@ This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
of RangeCoder from 7z, instead of RangeCoder from original PPMd var.H.
If you need the compatibility with original PPMd var.H, you can use external RangeDecoder */
+#ifndef ARCHIVE_PPMD7_PRIVATE_H_INCLUDED
+#define ARCHIVE_PPMD7_PRIVATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_PPMD7_PRIVATE_H_INCLUDED
-#define ARCHIVE_PPMD7_PRIVATE_H_INCLUDED
-
#include "archive_ppmd_private.h"
#define PPMD7_MIN_ORDER 2
diff --git a/libarchive/archive_ppmd8_private.h b/libarchive/archive_ppmd8_private.h
index 534927860ebc..454b75f41f25 100644
--- a/libarchive/archive_ppmd8_private.h
+++ b/libarchive/archive_ppmd8_private.h
@@ -4,8 +4,8 @@ This code is based on:
PPMd var.I (2002): Dmitry Shkarin : Public domain
Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
-#ifndef __PPMD8_H
-#define __PPMD8_H
+#ifndef ARCHIVE_PPMD8_PRIVATE_H_INCLUDED
+#define ARCHIVE_PPMD8_PRIVATE_H_INCLUDED
#include "archive_ppmd_private.h"
diff --git a/libarchive/archive_ppmd_private.h b/libarchive/archive_ppmd_private.h
index a83b8514d877..582803e5fd0f 100644
--- a/libarchive/archive_ppmd_private.h
+++ b/libarchive/archive_ppmd_private.h
@@ -2,13 +2,13 @@
2010-03-12 : Igor Pavlov : Public domain
This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
+#ifndef ARCHIVE_PPMD_PRIVATE_H_INCLUDED
+#define ARCHIVE_PPMD_PRIVATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_PPMD_PRIVATE_H_INCLUDED
-#define ARCHIVE_PPMD_PRIVATE_H_INCLUDED
-
#include <stddef.h>
#include "archive_read_private.h"
diff --git a/libarchive/archive_private.h b/libarchive/archive_private.h
index 4b4be9796dfc..937a87bb1efc 100644
--- a/libarchive/archive_private.h
+++ b/libarchive/archive_private.h
@@ -25,13 +25,13 @@
* $FreeBSD: head/lib/libarchive/archive_private.h 201098 2009-12-28 02:58:14Z kientzle $
*/
+#ifndef ARCHIVE_PRIVATE_H_INCLUDED
+#define ARCHIVE_PRIVATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_PRIVATE_H_INCLUDED
-#define ARCHIVE_PRIVATE_H_INCLUDED
-
#if HAVE_ICONV_H
#include <iconv.h>
#endif
@@ -153,6 +153,11 @@ void __archive_errx(int retvalue, const char *msg) __LA_DEAD;
void __archive_ensure_cloexec_flag(int fd);
int __archive_mktemp(const char *tmpdir);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+int __archive_mkstemp(wchar_t *template);
+#else
+int __archive_mkstemp(char *template);
+#endif
int __archive_clean(struct archive *);
diff --git a/libarchive/archive_random_private.h b/libarchive/archive_random_private.h
index c414779f8d44..08b91b3b7a31 100644
--- a/libarchive/archive_random_private.h
+++ b/libarchive/archive_random_private.h
@@ -23,13 +23,13 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef ARCHIVE_RANDOM_PRIVATE_H_INCLUDED
+#define ARCHIVE_RANDOM_PRIVATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_RANDOM_PRIVATE_H_INCLUDED
-#define ARCHIVE_RANDOM_PRIVATE_H_INCLUDED
-
/* Random number generator. */
int archive_random(void *buf, size_t nbytes);
diff --git a/libarchive/archive_rb.h b/libarchive/archive_rb.h
index 4562e9ebc41b..8851f1081867 100644
--- a/libarchive/archive_rb.h
+++ b/libarchive/archive_rb.h
@@ -28,8 +28,9 @@
*
* Based on NetBSD: rb.h,v 1.13 2009/08/16 10:57:01 yamt Exp
*/
-#ifndef ARCHIVE_RB_H_
-#define ARCHIVE_RB_H_
+
+#ifndef ARCHIVE_RB_H_INCLUDED
+#define ARCHIVE_RB_H_INCLUDED
struct archive_rb_node {
struct archive_rb_node *rb_nodes[2];
@@ -48,12 +49,24 @@ struct archive_rb_node {
__archive_rb_tree_iterate((T), NULL, ARCHIVE_RB_DIR_LEFT)
#define ARCHIVE_RB_TREE_MAX(T) \
__archive_rb_tree_iterate((T), NULL, ARCHIVE_RB_DIR_RIGHT)
+#define ARCHIVE_RB_TREE_NEXT(T, N) \
+ __archive_rb_tree_iterate((T), (N), ARCHIVE_RB_DIR_RIGHT)
+#define ARCHIVE_RB_TREE_PREV(T, N) \
+ __archive_rb_tree_iterate((T), (N), ARCHIVE_RB_DIR_LEFT)
#define ARCHIVE_RB_TREE_FOREACH(N, T) \
for ((N) = ARCHIVE_RB_TREE_MIN(T); (N); \
- (N) = __archive_rb_tree_iterate((T), (N), ARCHIVE_RB_DIR_RIGHT))
+ (N) = ARCHIVE_RB_TREE_NEXT((T), (N)))
#define ARCHIVE_RB_TREE_FOREACH_REVERSE(N, T) \
for ((N) = ARCHIVE_RB_TREE_MAX(T); (N); \
- (N) = __archive_rb_tree_iterate((T), (N), ARCHIVE_RB_DIR_LEFT))
+ (N) = ARCHIVE_RB_TREE_PREV((T), (N)))
+#define ARCHIVE_RB_TREE_FOREACH_SAFE(N, T, S) \
+ for ((N) = ARCHIVE_RB_TREE_MIN(T); \
+ (N) && ((S) = ARCHIVE_RB_TREE_NEXT((T), (N)), 1); \
+ (N) = (S))
+#define ARCHIVE_RB_TREE_FOREACH_REVERSE_SAFE(N, T, S) \
+ for ((N) = ARCHIVE_RB_TREE_MAX(T); \
+ (N) && ((S) = ARCHIVE_RB_TREE_PREV((T), (N)), 1); \
+ (N) = (S))
/*
* archive_rbto_compare_nodes_fn:
diff --git a/libarchive/archive_read.c b/libarchive/archive_read.c
index 5872601101ba..4a933b2fc084 100644
--- a/libarchive/archive_read.c
+++ b/libarchive/archive_read.c
@@ -433,7 +433,7 @@ archive_read_add_callback_data(struct archive *_a, void *client_data,
return ARCHIVE_FATAL;
}
a->client.dataset = (struct archive_read_data_node *)p;
- for (i = a->client.nodes - 1; i > iindex && i > 0; i--) {
+ for (i = a->client.nodes - 1; i > iindex; i--) {
a->client.dataset[i].data = a->client.dataset[i-1].data;
a->client.dataset[i].begin_position = -1;
a->client.dataset[i].total_size = -1;
diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c
index 183ca1e8790d..52fec7bb42c8 100644
--- a/libarchive/archive_read_disk_posix.c
+++ b/libarchive/archive_read_disk_posix.c
@@ -729,27 +729,23 @@ _archive_read_data_block(struct archive *_a, const void **buff,
if ((t->flags & needsRestoreTimes) != 0 &&
t->restore_time.noatime == 0)
flags |= O_NOATIME;
- do {
#endif
- t->entry_fd = open_on_current_dir(t,
- tree_current_access_path(t), flags);
- __archive_ensure_cloexec_flag(t->entry_fd);
+ t->entry_fd = open_on_current_dir(t,
+ tree_current_access_path(t), flags);
+ __archive_ensure_cloexec_flag(t->entry_fd);
#if defined(O_NOATIME)
- /*
- * When we did open the file with O_NOATIME flag,
- * if successful, set 1 to t->restore_time.noatime
- * not to restore an atime of the file later.
- * if failed by EPERM, retry it without O_NOATIME flag.
- */
- if (flags & O_NOATIME) {
- if (t->entry_fd >= 0)
- t->restore_time.noatime = 1;
- else if (errno == EPERM) {
- flags &= ~O_NOATIME;
- continue;
- }
- }
- } while (0);
+ /*
+ * When we did open the file with O_NOATIME flag,
+ * if successful, set 1 to t->restore_time.noatime
+ * not to restore an atime of the file later.
+ * if failed by EPERM, retry it without O_NOATIME flag.
+ */
+ if (flags & O_NOATIME) {
+ if (t->entry_fd >= 0)
+ t->restore_time.noatime = 1;
+ else if (errno == EPERM)
+ flags &= ~O_NOATIME;
+ }
#endif
if (t->entry_fd < 0) {
archive_set_error(&a->archive, errno,
@@ -1110,8 +1106,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
"%s", delayed_str.s);
}
}
- if (!archive_string_empty(&delayed_str))
- archive_string_free(&delayed_str);
+ archive_string_free(&delayed_str);
return (r);
}
diff --git a/libarchive/archive_read_disk_private.h b/libarchive/archive_read_disk_private.h
index f03a0a9cc30f..bc8abc15d15c 100644
--- a/libarchive/archive_read_disk_private.h
+++ b/libarchive/archive_read_disk_private.h
@@ -26,13 +26,13 @@
* $FreeBSD: head/lib/libarchive/archive_read_disk_private.h 201105 2009-12-28 03:20:54Z kientzle $
*/
+#ifndef ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED
+#define ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED
-#define ARCHIVE_READ_DISK_PRIVATE_H_INCLUDED
-
#include "archive_platform_acl.h"
struct tree;
diff --git a/libarchive/archive_read_private.h b/libarchive/archive_read_private.h
index bf04f6410438..c842e6f09ad8 100644
--- a/libarchive/archive_read_private.h
+++ b/libarchive/archive_read_private.h
@@ -25,15 +25,15 @@
* $FreeBSD: head/lib/libarchive/archive_read_private.h 201088 2009-12-28 02:18:55Z kientzle $
*/
+#ifndef ARCHIVE_READ_PRIVATE_H_INCLUDED
+#define ARCHIVE_READ_PRIVATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#ifndef __LIBARCHIVE_TEST
#error This header is only to be used internally to libarchive.
#endif
#endif
-#ifndef ARCHIVE_READ_PRIVATE_H_INCLUDED
-#define ARCHIVE_READ_PRIVATE_H_INCLUDED
-
#include "archive.h"
#include "archive_string.h"
#include "archive_private.h"
diff --git a/libarchive/archive_read_set_options.3 b/libarchive/archive_read_set_options.3
index d23f028b0ce2..78d99999cf83 100644
--- a/libarchive/archive_read_set_options.3
+++ b/libarchive/archive_read_set_options.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd February 2, 2012
+.Dd January 31, 2020
.Dt ARCHIVE_READ_OPTIONS 3
.Os
.Sh NAME
@@ -180,6 +180,18 @@ only to modules whose name matches
.\"
.Sh OPTIONS
.Bl -tag -compact -width indent
+.It Format cab
+.Bl -tag -compact -width indent
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file names.
+.El
+.It Format cpio
+.Bl -tag -compact -width indent
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file names.
+.El
.It Format iso9660
.Bl -tag -compact -width indent
.It Cm joliet
@@ -193,6 +205,24 @@ Defaults to enabled, use
.Cm !rockridge
to disable.
.El
+.It Format lha
+.Bl -tag -compact -width indent
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file names.
+.El
+.It Format mtree
+.Bl -tag -compact -width indent
+.It Cm checkfs
+Allow reading information missing from the mtree from the file system.
+Disabled by default.
+.El
+.It Format rar
+.Bl -tag -compact -width indent
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file names.
+.El
.It Format tar
.Bl -tag -compact -width indent
.It Cm compat-2x
@@ -202,7 +232,7 @@ This option mimics the libarchive 2.x filename handling
so that such archives can be read correctly.
.It Cm hdrcharset
The value is used as a character set name that will be
-used when translating filenames.
+used when translating file names.
.It Cm mac-ext
Support Mac OS metadata extension that records data in special
files beginning with a period and underscore.
diff --git a/libarchive/archive_read_support_filter_uu.c b/libarchive/archive_read_support_filter_uu.c
index 641297990d26..67ddffb06943 100644
--- a/libarchive/archive_read_support_filter_uu.c
+++ b/libarchive/archive_read_support_filter_uu.c
@@ -574,14 +574,13 @@ read_more:
while (l > 0) {
int n = 0;
- if (l > 0) {
- if (!uuchar[b[0]] || !uuchar[b[1]])
- break;
- n = UUDECODE(*b++) << 18;
- n |= UUDECODE(*b++) << 12;
- *out++ = n >> 16; total++;
- --l;
- }
+ if (!uuchar[b[0]] || !uuchar[b[1]])
+ break;
+ n = UUDECODE(*b++) << 18;
+ n |= UUDECODE(*b++) << 12;
+ *out++ = n >> 16; total++;
+ --l;
+
if (l > 0) {
if (!uuchar[b[0]])
break;
@@ -626,14 +625,13 @@ read_more:
while (l > 0) {
int n = 0;
- if (l > 0) {
- if (!base64[b[0]] || !base64[b[1]])
- break;
- n = base64num[*b++] << 18;
- n |= base64num[*b++] << 12;
- *out++ = n >> 16; total++;
- l -= 2;
- }
+ if (!base64[b[0]] || !base64[b[1]])
+ break;
+ n = base64num[*b++] << 18;
+ n |= base64num[*b++] << 12;
+ *out++ = n >> 16; total++;
+ l -= 2;
+
if (l > 0) {
if (*b == '=')
break;
diff --git a/libarchive/archive_read_support_format_7zip.c b/libarchive/archive_read_support_format_7zip.c
index 87c6c5272197..6ce9d1a0e1bb 100644
--- a/libarchive/archive_read_support_format_7zip.c
+++ b/libarchive/archive_read_support_format_7zip.c
@@ -1086,10 +1086,17 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
zip->bcj_state = 0;
break;
case _7Z_DELTA:
+ if (coder2->propertiesSize != 1) {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC,
+ "Invalid Delta parameter");
+ return (ARCHIVE_FAILED);
+ }
filters[fi].id = LZMA_FILTER_DELTA;
memset(&delta_opt, 0, sizeof(delta_opt));
delta_opt.type = LZMA_DELTA_TYPE_BYTE;
- delta_opt.dist = 1;
+ delta_opt.dist =
+ (uint32_t)coder2->properties[0] + 1;
filters[fi].options = &delta_opt;
fi++;
break;
diff --git a/libarchive/archive_read_support_format_lha.c b/libarchive/archive_read_support_format_lha.c
index 35405bcdd97f..bff0f01f41cf 100644
--- a/libarchive/archive_read_support_format_lha.c
+++ b/libarchive/archive_read_support_format_lha.c
@@ -1246,8 +1246,9 @@ lha_read_file_extended_header(struct archive_read *a, struct lha *lha,
archive_array_append(&lha->filename,
(const char *)extdheader, datasize);
/* Setup a string conversion for a filename. */
- lha->sconv_fname = archive_string_conversion_from_charset(
- &a->archive, "UTF-16LE", 1);
+ lha->sconv_fname =
+ archive_string_conversion_from_charset(&a->archive,
+ "UTF-16LE", 1);
if (lha->sconv_fname == NULL)
return (ARCHIVE_FATAL);
break;
@@ -1273,32 +1274,46 @@ lha_read_file_extended_header(struct archive_read *a, struct lha *lha,
break;
case EXT_UTF16_DIRECTORY:
/* UTF-16 characters take always 2 or 4 bytes */
- if (datasize == 0 || (datasize & 1) || extdheader[0] == '\0')
+ if (datasize == 0 || (datasize & 1) ||
+ extdheader[0] == '\0') {
/* no directory name data. exit this case. */
goto invalid;
+ }
archive_string_empty(&lha->dirname);
archive_array_append(&lha->dirname,
(const char *)extdheader, datasize);
- lha->sconv_dir = archive_string_conversion_from_charset(
- &a->archive, "UTF-16LE", 1);
+ lha->sconv_dir =
+ archive_string_conversion_from_charset(&a->archive,
+ "UTF-16LE", 1);
if (lha->sconv_dir == NULL)
return (ARCHIVE_FATAL);
else {
/*
- * Convert directory delimiter from 0xFF
+ * Convert directory delimiter from 0xFFFF
* to '/' for local system.
*/
+ uint16_t dirSep;
+ uint16_t d = 1;
+ if (archive_be16dec(&d) == 1)
+ dirSep = 0x2F00;
+ else
+ dirSep = 0x002F;
+
/* UTF-16LE character */
- uint16_t *utf16name = (uint16_t *)lha->dirname.s;
+ uint16_t *utf16name =
+ (uint16_t *)lha->dirname.s;
for (i = 0; i < lha->dirname.length / 2; i++) {
- if (utf16name[i] == 0xFFFF)
- utf16name[i] = L'/';
+ if (utf16name[i] == 0xFFFF) {
+ utf16name[i] = dirSep;
+ }
}
/* Is last character directory separator? */
- if (utf16name[lha->dirname.length / 2 - 1] != L'/')
+ if (utf16name[lha->dirname.length / 2 - 1] !=
+ dirSep) {
/* invalid directory data */
goto invalid;
+ }
}
break;
case EXT_DOS_ATTR:
diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c
index a7331a2672c7..332944ac51bf 100644
--- a/libarchive/archive_read_support_format_mtree.c
+++ b/libarchive/archive_read_support_format_mtree.c
@@ -258,6 +258,7 @@ archive_read_support_format_mtree(struct archive *_a)
"Can't allocate mtree data");
return (ARCHIVE_FATAL);
}
+ mtree->checkfs = 0;
mtree->fd = -1;
__archive_rb_tree_init(&mtree->rbtree, &rb_ops);
diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c
index 41e5a3cadd90..98efbb1a6c4a 100644
--- a/libarchive/archive_read_support_format_rar.c
+++ b/libarchive/archive_read_support_format_rar.c
@@ -148,6 +148,9 @@
#define FILE_ATTRIBUTE_DIRECTORY 0x10
#endif
+#undef minimum
+#define minimum(a, b) ((a)<(b)?(a):(b))
+
/* Fields common to all headers */
struct rar_header
{
@@ -1722,6 +1725,13 @@ read_exttime(const char *p, struct rar *rar, const char *endp)
struct tm *tm;
time_t t;
long nsec;
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+ struct tm tmbuf;
+#endif
+#if defined(HAVE__LOCALTIME64_S)
+ errno_t terr;
+ __time64_t tmptime;
+#endif
if (p + 2 > endp)
return (-1);
@@ -1753,7 +1763,18 @@ read_exttime(const char *p, struct rar *rar, const char *endp)
rem = (((unsigned)(unsigned char)*p) << 16) | (rem >> 8);
p++;
}
+#if defined(HAVE_LOCALTIME_R)
+ tm = localtime_r(&t, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+ tmptime = t;
+ terr = _localtime64_s(&tmbuf, &tmptime);
+ if (terr)
+ tm = NULL;
+ else
+ tm = &tmbuf;
+#else
tm = localtime(&t);
+#endif
nsec = tm->tm_sec + rem / NS_UNIT;
if (rmode & 4)
{
@@ -2452,8 +2473,11 @@ create_code(struct archive_read *a, struct huffman_code *code,
if (add_value(a, code, j, codebits, i) != ARCHIVE_OK)
return (ARCHIVE_FATAL);
codebits++;
- if (--symbolsleft <= 0) { break; break; }
+ if (--symbolsleft <= 0)
+ break;
}
+ if (symbolsleft <= 0)
+ break;
codebits <<= 1;
}
return (ARCHIVE_OK);
@@ -2463,7 +2487,8 @@ static int
add_value(struct archive_read *a, struct huffman_code *code, int value,
int codebits, int length)
{
- int repeatpos, lastnode, bitpos, bit, repeatnode, nextnode;
+ int lastnode, bitpos, bit;
+ /* int repeatpos, repeatnode, nextnode; */
free(code->table);
code->table = NULL;
@@ -2473,6 +2498,9 @@ add_value(struct archive_read *a, struct huffman_code *code, int value,
if(length < code->minlength)
code->minlength = length;
+ /*
+ * Dead code, repeatpos was is -1
+ *
repeatpos = -1;
if (repeatpos == 0 || (repeatpos >= 0
&& (((codebits >> (repeatpos - 1)) & 3) == 0
@@ -2482,6 +2510,7 @@ add_value(struct archive_read *a, struct huffman_code *code, int value,
"Invalid repeat position");
return (ARCHIVE_FATAL);
}
+ */
lastnode = 0;
for (bitpos = length - 1; bitpos >= 0; bitpos--)
@@ -2497,9 +2526,12 @@ add_value(struct archive_read *a, struct huffman_code *code, int value,
return (ARCHIVE_FATAL);
}
+ /*
+ * Dead code, repeatpos was -1, bitpos >=0
+ *
if (bitpos == repeatpos)
{
- /* Open branch check */
+ * Open branch check *
if (!(code->tree[lastnode].branches[bit] < 0))
{
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
@@ -2518,16 +2550,17 @@ add_value(struct archive_read *a, struct huffman_code *code, int value,
return (ARCHIVE_FATAL);
}
- /* Set branches */
+ * Set branches *
code->tree[lastnode].branches[bit] = repeatnode;
code->tree[repeatnode].branches[bit] = repeatnode;
code->tree[repeatnode].branches[bit^1] = nextnode;
lastnode = nextnode;
- bitpos++; /* terminating bit already handled, skip it */
+ bitpos++; * terminating bit already handled, skip it *
}
else
{
+ */
/* Open branch check */
if (code->tree[lastnode].branches[bit] < 0)
{
@@ -2541,7 +2574,7 @@ add_value(struct archive_read *a, struct huffman_code *code, int value,
/* set to branch */
lastnode = code->tree[lastnode].branches[bit];
- }
+ /* } */
}
if (!(code->tree[lastnode].branches[0] == -1
@@ -2625,11 +2658,15 @@ make_table_recurse(struct archive_read *a, struct huffman_code *code, int node,
table[i].value = code->tree[node].branches[0];
}
}
+ /*
+ * Dead code, node >= 0
+ *
else if (node < 0)
{
for(i = 0; i < currtablesize; i++)
table[i].length = -1;
}
+ */
else
{
if(depth == maxdepth)
@@ -2661,6 +2698,10 @@ expand(struct archive_read *a, int64_t end)
0, 1, 1, 1, 1, 2, 2,
2, 2, 3, 3, 3, 3, 4,
4, 4, 4, 5, 5, 5, 5 };
+ static const int lengthb_min = minimum(
+ (int)(sizeof(lengthbases)/sizeof(lengthbases[0])),
+ (int)(sizeof(lengthbits)/sizeof(lengthbits[0]))
+ );
static const unsigned int offsetbases[] =
{ 0, 1, 2, 3, 4, 6,
8, 12, 16, 24, 32, 48,
@@ -2678,6 +2719,10 @@ expand(struct archive_read *a, int64_t end)
11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16,
16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18 };
+ static const int offsetb_min = minimum(
+ (int)(sizeof(offsetbases)/sizeof(offsetbases[0])),
+ (int)(sizeof(offsetbits)/sizeof(offsetbits[0]))
+ );
static const unsigned char shortbases[] =
{ 0, 4, 8, 16, 32, 64, 128, 192 };
static const unsigned char shortbits[] =
@@ -2757,9 +2802,7 @@ expand(struct archive_read *a, int64_t end)
if ((lensymbol = read_next_symbol(a, &rar->lengthcode)) < 0)
goto bad_data;
- if (lensymbol > (int)(sizeof(lengthbases)/sizeof(lengthbases[0])))
- goto bad_data;
- if (lensymbol > (int)(sizeof(lengthbits)/sizeof(lengthbits[0])))
+ if (lensymbol > lengthb_min)
goto bad_data;
len = lengthbases[lensymbol] + 2;
if (lengthbits[lensymbol] > 0) {
@@ -2791,9 +2834,7 @@ expand(struct archive_read *a, int64_t end)
}
else
{
- if (symbol-271 > (int)(sizeof(lengthbases)/sizeof(lengthbases[0])))
- goto bad_data;
- if (symbol-271 > (int)(sizeof(lengthbits)/sizeof(lengthbits[0])))
+ if (symbol-271 > lengthb_min)
goto bad_data;
len = lengthbases[symbol-271]+3;
if(lengthbits[symbol-271] > 0) {
@@ -2805,9 +2846,7 @@ expand(struct archive_read *a, int64_t end)
if ((offssymbol = read_next_symbol(a, &rar->offsetcode)) < 0)
goto bad_data;
- if (offssymbol > (int)(sizeof(offsetbases)/sizeof(offsetbases[0])))
- goto bad_data;
- if (offssymbol > (int)(sizeof(offsetbits)/sizeof(offsetbits[0])))
+ if (offssymbol > offsetb_min)
goto bad_data;
offs = offsetbases[offssymbol]+1;
if(offsetbits[offssymbol] > 0)
diff --git a/libarchive/archive_read_support_format_rar5.c b/libarchive/archive_read_support_format_rar5.c
index ce38b1fc990f..82729bdcdb3c 100644
--- a/libarchive/archive_read_support_format_rar5.c
+++ b/libarchive/archive_read_support_format_rar5.c
@@ -73,15 +73,14 @@
* 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x01, 0x00
* "Rar!→•☺·\x00"
*
- * It's stored in `rar5_signature` after XOR'ing it with 0xA1, because I don't
+ * Retrieved with `rar5_signature()` by XOR'ing it with 0xA1, because I don't
* want to put this magic sequence in each binary that uses libarchive, so
* applications that scan through the file for this marker won't trigger on
* this "false" one.
*
* The array itself is decrypted in `rar5_init` function. */
-static unsigned char rar5_signature[] = { 243, 192, 211, 128, 187, 166, 160, 161 };
-static const ssize_t rar5_signature_size = sizeof(rar5_signature);
+static unsigned char rar5_signature_xor[] = { 243, 192, 211, 128, 187, 166, 160, 161 };
static const size_t g_unpack_window_size = 0x20000;
/* These could have been static const's, but they aren't, because of
@@ -211,7 +210,7 @@ struct comp_state {
or just a part of it. */
uint8_t block_parsing_finished : 1;
- int notused : 4;
+ signed int notused : 4;
int flags; /* Uncompression flags. */
int method; /* Uncompression algorithm method. */
@@ -357,6 +356,7 @@ struct rar5 {
/* Forward function declarations. */
+static void rar5_signature(char *buf);
static int verify_global_checksums(struct archive_read* a);
static int rar5_read_data_skip(struct archive_read *a);
static int push_data_ready(struct archive_read* a, struct rar5* rar,
@@ -384,7 +384,7 @@ static int cdeque_init(struct cdeque* d, int max_capacity_power_of_2) {
d->cap_mask = max_capacity_power_of_2 - 1;
d->arr = NULL;
- if((max_capacity_power_of_2 & d->cap_mask) > 0)
+ if((max_capacity_power_of_2 & d->cap_mask) != 0)
return CDE_PARAM;
cdeque_clear(d);
@@ -881,10 +881,10 @@ static inline int get_archive_read(struct archive* a,
static int read_ahead(struct archive_read* a, size_t how_many,
const uint8_t** ptr)
{
+ ssize_t avail = -1;
if(!ptr)
return 0;
- ssize_t avail = -1;
*ptr = __archive_read_ahead(a, how_many, &avail);
if(*ptr == NULL) {
return 0;
@@ -1086,11 +1086,14 @@ static int read_u64(struct archive_read* a, uint64_t* pvalue) {
static int bid_standard(struct archive_read* a) {
const uint8_t* p;
+ char signature[sizeof(rar5_signature_xor)];
+
+ rar5_signature(signature);
- if(!read_ahead(a, rar5_signature_size, &p))
+ if(!read_ahead(a, sizeof(rar5_signature_xor), &p))
return -1;
- if(!memcmp(rar5_signature, p, rar5_signature_size))
+ if(!memcmp(signature, p, sizeof(rar5_signature_xor)))
return 30;
return -1;
@@ -1150,14 +1153,14 @@ static int process_main_locator_extra_block(struct archive_read* a,
{
uint64_t locator_flags;
- if(!read_var(a, &locator_flags, NULL)) {
- return ARCHIVE_EOF;
- }
-
enum LOCATOR_FLAGS {
QLIST = 0x01, RECOVERY = 0x02,
};
+ if(!read_var(a, &locator_flags, NULL)) {
+ return ARCHIVE_EOF;
+ }
+
if(locator_flags & QLIST) {
if(!read_var(a, &rar->qlist_offset, NULL)) {
return ARCHIVE_EOF;
@@ -1183,6 +1186,10 @@ static int parse_file_extra_hash(struct archive_read* a, struct rar5* rar,
size_t hash_type = 0;
size_t value_len;
+ enum HASH_TYPE {
+ BLAKE2sp = 0x00
+ };
+
if(!read_var_sized(a, &hash_type, &value_len))
return ARCHIVE_EOF;
@@ -1191,10 +1198,6 @@ static int parse_file_extra_hash(struct archive_read* a, struct rar5* rar,
return ARCHIVE_EOF;
}
- enum HASH_TYPE {
- BLAKE2sp = 0x00
- };
-
/* The file uses BLAKE2sp checksum algorithm instead of plain old
* CRC32. */
if(hash_type == BLAKE2sp) {
@@ -1257,6 +1260,7 @@ static int parse_file_extra_version(struct archive_read* a,
size_t value_len = 0;
struct archive_string version_string;
struct archive_string name_utf8_string;
+ const char* cur_filename;
/* Flags are ignored. */
if(!read_var_sized(a, &flags, &value_len))
@@ -1275,7 +1279,7 @@ static int parse_file_extra_version(struct archive_read* a,
/* extra_data_size should be zero here. */
- const char* cur_filename = archive_entry_pathname_utf8(e);
+ cur_filename = archive_entry_pathname_utf8(e);
if(cur_filename == NULL) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
"Version entry without file name");
@@ -1586,6 +1590,25 @@ static int process_head_file(struct archive_read* a, struct rar5* rar,
char name_utf8_buf[MAX_NAME_IN_BYTES];
const uint8_t* p;
+ enum FILE_FLAGS {
+ DIRECTORY = 0x0001, UTIME = 0x0002, CRC32 = 0x0004,
+ UNKNOWN_UNPACKED_SIZE = 0x0008,
+ };
+
+ enum FILE_ATTRS {
+ ATTR_READONLY = 0x1, ATTR_HIDDEN = 0x2, ATTR_SYSTEM = 0x4,
+ ATTR_DIRECTORY = 0x10,
+ };
+
+ enum COMP_INFO_FLAGS {
+ SOLID = 0x0040,
+ };
+
+ enum HOST_OS {
+ HOST_WINDOWS = 0,
+ HOST_UNIX = 1,
+ };
+
archive_entry_clear(entry);
/* Do not reset file context if we're switching archives. */
@@ -1615,20 +1638,6 @@ static int process_head_file(struct archive_read* a, struct rar5* rar,
return ARCHIVE_FATAL;
}
- enum FILE_FLAGS {
- DIRECTORY = 0x0001, UTIME = 0x0002, CRC32 = 0x0004,
- UNKNOWN_UNPACKED_SIZE = 0x0008,
- };
-
- enum FILE_ATTRS {
- ATTR_READONLY = 0x1, ATTR_HIDDEN = 0x2, ATTR_SYSTEM = 0x4,
- ATTR_DIRECTORY = 0x10,
- };
-
- enum COMP_INFO_FLAGS {
- SOLID = 0x0040,
- };
-
if(!read_var_sized(a, &file_flags, NULL))
return ARCHIVE_EOF;
@@ -1725,11 +1734,6 @@ static int process_head_file(struct archive_read* a, struct rar5* rar,
if(!read_var_sized(a, &host_os, NULL))
return ARCHIVE_EOF;
- enum HOST_OS {
- HOST_WINDOWS = 0,
- HOST_UNIX = 1,
- };
-
if(host_os == HOST_WINDOWS) {
/* Host OS is Windows */
@@ -1821,12 +1825,16 @@ static int process_head_file(struct archive_read* a, struct rar5* rar,
int ret = process_head_file_extra(a, entry, rar,
extra_data_size);
- /* Sanity check. */
+ /*
+ * TODO: rewrite or remove useless sanity check
+ * as extra_data_size is not passed as a pointer
+ *
if(extra_data_size < 0) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER,
"File extra data size is not zero");
return ARCHIVE_FATAL;
}
+ */
if(ret != ARCHIVE_OK)
return ret;
@@ -1891,14 +1899,28 @@ static int process_head_service(struct archive_read* a, struct rar5* rar,
static int process_head_main(struct archive_read* a, struct rar5* rar,
struct archive_entry* entry, size_t block_flags)
{
- (void) entry;
-
int ret;
size_t extra_data_size = 0;
size_t extra_field_size = 0;
size_t extra_field_id = 0;
size_t archive_flags = 0;
+ enum MAIN_FLAGS {
+ VOLUME = 0x0001, /* multi-volume archive */
+ VOLUME_NUMBER = 0x0002, /* volume number, first vol doesn't
+ * have it */
+ SOLID = 0x0004, /* solid archive */
+ PROTECT = 0x0008, /* contains Recovery info */
+ LOCK = 0x0010, /* readonly flag, not used */
+ };
+
+ enum MAIN_EXTRA {
+ // Just one attribute here.
+ LOCATOR = 0x01,
+ };
+
+ (void) entry;
+
if(block_flags & HFL_EXTRA_DATA) {
if(!read_var_sized(a, &extra_data_size, NULL))
return ARCHIVE_EOF;
@@ -1910,15 +1932,6 @@ static int process_head_main(struct archive_read* a, struct rar5* rar,
return ARCHIVE_EOF;
}
- enum MAIN_FLAGS {
- VOLUME = 0x0001, /* multi-volume archive */
- VOLUME_NUMBER = 0x0002, /* volume number, first vol doesn't
- * have it */
- SOLID = 0x0004, /* solid archive */
- PROTECT = 0x0008, /* contains Recovery info */
- LOCK = 0x0010, /* readonly flag, not used */
- };
-
rar->main.volume = (archive_flags & VOLUME) > 0;
rar->main.solid = (archive_flags & SOLID) > 0;
@@ -1970,11 +1983,6 @@ static int process_head_main(struct archive_read* a, struct rar5* rar,
return ARCHIVE_FATAL;
}
- enum MAIN_EXTRA {
- // Just one attribute here.
- LOCATOR = 0x01,
- };
-
switch(extra_field_id) {
case LOCATOR:
ret = process_main_locator_extra_block(a, rar);
@@ -2080,6 +2088,8 @@ static int scan_for_signature(struct archive_read* a);
static int process_base_block(struct archive_read* a,
struct archive_entry* entry)
{
+ const size_t SMALLEST_RAR5_BLOCK_SIZE = 3;
+
struct rar5* rar = get_context(a);
uint32_t hdr_crc, computed_crc;
size_t raw_hdr_size = 0, hdr_size_len, hdr_size;
@@ -2088,6 +2098,12 @@ static int process_base_block(struct archive_read* a,
const uint8_t* p;
int ret;
+ enum HEADER_TYPE {
+ HEAD_MARK = 0x00, HEAD_MAIN = 0x01, HEAD_FILE = 0x02,
+ HEAD_SERVICE = 0x03, HEAD_CRYPT = 0x04, HEAD_ENDARC = 0x05,
+ HEAD_UNKNOWN = 0xff,
+ };
+
/* Skip any unprocessed data for this file. */
ret = skip_unprocessed_bytes(a);
if(ret != ARCHIVE_OK)
@@ -2103,15 +2119,26 @@ static int process_base_block(struct archive_read* a,
return ARCHIVE_EOF;
}
+ hdr_size = raw_hdr_size + hdr_size_len;
+
/* Sanity check, maximum header size for RAR5 is 2MB. */
- if(raw_hdr_size > (2 * 1024 * 1024)) {
+ if(hdr_size > (2 * 1024 * 1024)) {
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Base block header is too large");
return ARCHIVE_FATAL;
}
- hdr_size = raw_hdr_size + hdr_size_len;
+ /* Additional sanity checks to weed out invalid files. */
+ if(raw_hdr_size == 0 || hdr_size_len == 0 ||
+ hdr_size < SMALLEST_RAR5_BLOCK_SIZE)
+ {
+ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
+ "Too small block encountered (%zu bytes)",
+ raw_hdr_size);
+
+ return ARCHIVE_FATAL;
+ }
/* Read the whole header data into memory, maximum memory use here is
* 2MB. */
@@ -2146,12 +2173,6 @@ static int process_base_block(struct archive_read* a,
rar->main.endarc = 0;
/* Those are possible header ids in RARv5. */
- enum HEADER_TYPE {
- HEAD_MARK = 0x00, HEAD_MAIN = 0x01, HEAD_FILE = 0x02,
- HEAD_SERVICE = 0x03, HEAD_CRYPT = 0x04, HEAD_ENDARC = 0x05,
- HEAD_UNKNOWN = 0xff,
- };
-
switch(header_id) {
case HEAD_MAIN:
ret = process_head_main(a, rar, entry, header_flags);
@@ -2264,7 +2285,7 @@ static int rar5_read_header(struct archive_read *a,
}
if(rar->skipped_magic == 0) {
- if(ARCHIVE_OK != consume(a, rar5_signature_size)) {
+ if(ARCHIVE_OK != consume(a, sizeof(rar5_signature_xor))) {
return ARCHIVE_EOF;
}
@@ -2536,12 +2557,10 @@ static int parse_tables(struct archive_read* a, struct rar5* rar,
/* 0..15: store directly */
table[i] = (uint8_t) num;
i++;
- continue;
- }
-
- if(num < 18) {
+ } else if(num < 18) {
/* 16..17: repeat previous code */
uint16_t n;
+
if(ARCHIVE_OK != read_bits_16(rar, p, &n))
return ARCHIVE_EOF;
@@ -2567,27 +2586,26 @@ static int parse_tables(struct archive_read* a, struct rar5* rar,
"huffman tables");
return ARCHIVE_FATAL;
}
+ } else {
+ /* other codes: fill with zeroes `n` times */
+ uint16_t n;
- continue;
- }
+ if(ARCHIVE_OK != read_bits_16(rar, p, &n))
+ return ARCHIVE_EOF;
- /* other codes: fill with zeroes `n` times */
- uint16_t n;
- if(ARCHIVE_OK != read_bits_16(rar, p, &n))
- return ARCHIVE_EOF;
+ if(num == 18) {
+ n >>= 13;
+ n += 3;
+ skip_bits(rar, 3);
+ } else {
+ n >>= 9;
+ n += 11;
+ skip_bits(rar, 7);
+ }
- if(num == 18) {
- n >>= 13;
- n += 3;
- skip_bits(rar, 3);
- } else {
- n >>= 9;
- n += 11;
- skip_bits(rar, 7);
+ while(n-- > 0 && i < HUFF_TABLE_SIZE)
+ table[i++] = 0;
}
-
- while(n-- > 0 && i < HUFF_TABLE_SIZE)
- table[i++] = 0;
}
ret = create_decode_tables(&table[idx], &rar->cstate.ld, HUFF_NC);
@@ -2632,6 +2650,7 @@ static int parse_tables(struct archive_read* a, struct rar5* rar,
static int parse_block_header(struct archive_read* a, const uint8_t* p,
ssize_t* block_size, struct compressed_block_header* hdr)
{
+ uint8_t calculated_cksum;
memcpy(hdr, p, sizeof(struct compressed_block_header));
if(bf_byte_count(hdr) > 2) {
@@ -2670,7 +2689,7 @@ static int parse_block_header(struct archive_read* a, const uint8_t* p,
/* Verify the block header checksum. 0x5A is a magic value and is
* always * constant. */
- uint8_t calculated_cksum = 0x5A
+ calculated_cksum = 0x5A
^ (uint8_t) hdr->block_flags_u8
^ (uint8_t) *block_size
^ (uint8_t) (*block_size >> 8)
@@ -2744,6 +2763,7 @@ static int is_valid_filter_block_start(struct rar5* rar,
static int parse_filter(struct archive_read* ar, const uint8_t* p) {
uint32_t block_start, block_length;
uint16_t filter_type;
+ struct filter_info* filt = NULL;
struct rar5* rar = get_context(ar);
/* Read the parameters from the input stream. */
@@ -2774,7 +2794,7 @@ static int parse_filter(struct archive_read* ar, const uint8_t* p) {
}
/* Allocate a new filter. */
- struct filter_info* filt = add_new_filter(rar);
+ filt = add_new_filter(rar);
if(filt == NULL) {
archive_set_error(&ar->archive, ENOMEM,
"Can't allocate memory for a filter descriptor.");
@@ -3043,7 +3063,8 @@ static int do_uncompress_block(struct archive_read* a, const uint8_t* p) {
}
continue;
- } else if(num < 262) {
+ } else {
+ /* num < 262 */
const int idx = num - 258;
const int dist = dist_cache_touch(rar, idx);
@@ -3079,6 +3100,7 @@ static int scan_for_signature(struct archive_read* a) {
const uint8_t* p;
const int chunk_size = 512;
ssize_t i;
+ char signature[sizeof(rar5_signature_xor)];
/* If we're here, it means we're on an 'unknown territory' data.
* There's no indication what kind of data we're reading here.
@@ -3092,19 +3114,23 @@ static int scan_for_signature(struct archive_read* a) {
* end of the file? If so, it would be a better approach than the
* current implementation of this function. */
+ rar5_signature(signature);
+
while(1) {
if(!read_ahead(a, chunk_size, &p))
return ARCHIVE_EOF;
- for(i = 0; i < chunk_size - rar5_signature_size; i++) {
- if(memcmp(&p[i], rar5_signature,
- rar5_signature_size) == 0) {
+ for(i = 0; i < chunk_size - (int)sizeof(rar5_signature_xor);
+ i++) {
+ if(memcmp(&p[i], signature,
+ sizeof(rar5_signature_xor)) == 0) {
/* Consume the number of bytes we've used to
* search for the signature, as well as the
* number of bytes used by the signature
* itself. After this we should be standing
* on a valid base block header. */
- (void) consume(a, i + rar5_signature_size);
+ (void) consume(a,
+ i + sizeof(rar5_signature_xor));
return ARCHIVE_OK;
}
}
@@ -3314,6 +3340,8 @@ static int process_block(struct archive_read* a) {
if(rar->cstate.block_parsing_finished) {
ssize_t block_size;
+ ssize_t to_skip;
+ ssize_t cur_block_size;
/* The header size won't be bigger than 6 bytes. */
if(!read_ahead(a, 6, &p)) {
@@ -3337,7 +3365,7 @@ static int process_block(struct archive_read* a) {
/* Skip block header. Next data is huffman tables,
* if present. */
- ssize_t to_skip = sizeof(struct compressed_block_header) +
+ to_skip = sizeof(struct compressed_block_header) +
bf_byte_count(&rar->last_block_hdr) + 1;
if(ARCHIVE_OK != consume(a, to_skip))
@@ -3351,7 +3379,7 @@ static int process_block(struct archive_read* a) {
* bigger than the actual data stored in this file. Remaining
* part of the data will be in another file. */
- ssize_t cur_block_size =
+ cur_block_size =
rar5_min(rar->file.bytes_remaining, block_size);
if(block_size > rar->file.bytes_remaining) {
@@ -3679,6 +3707,7 @@ static int uncompress_file(struct archive_read* a) {
static int do_unstore_file(struct archive_read* a,
struct rar5* rar, const void** buf, size_t* size, int64_t* offset)
{
+ size_t to_read;
const uint8_t* p;
if(rar->file.bytes_remaining == 0 && rar->main.volume > 0 &&
@@ -3697,7 +3726,7 @@ static int do_unstore_file(struct archive_read* a,
}
}
- size_t to_read = rar5_min(rar->file.bytes_remaining, 64 * 1024);
+ to_read = rar5_min(rar->file.bytes_remaining, 64 * 1024);
if(to_read == 0) {
return ARCHIVE_EOF;
}
@@ -3866,6 +3895,18 @@ static int verify_global_checksums(struct archive_read* a) {
return verify_checksums(a);
}
+/*
+ * Decryption function for the magic signature pattern. Check the comment near
+ * the `rar5_signature_xor` symbol to read the rationale behind this.
+ */
+static void rar5_signature(char *buf) {
+ size_t i;
+
+ for(i = 0; i < sizeof(rar5_signature_xor); i++) {
+ buf[i] = rar5_signature_xor[i] ^ 0xA1;
+ }
+}
+
static int rar5_read_data(struct archive_read *a, const void **buff,
size_t *size, int64_t *offset) {
int ret;
@@ -4012,19 +4053,8 @@ static int rar5_has_encrypted_entries(struct archive_read *_a) {
}
static int rar5_init(struct rar5* rar) {
- ssize_t i;
-
memset(rar, 0, sizeof(struct rar5));
- /* Decrypt the magic signature pattern. Check the comment near the
- * `rar5_signature` symbol to read the rationale behind this. */
-
- if(rar5_signature[0] == 243) {
- for(i = 0; i < rar5_signature_size; i++) {
- rar5_signature[i] ^= 0xA1;
- }
- }
-
if(CDE_OK != cdeque_init(&rar->cstate.filters, 8192))
return ARCHIVE_FATAL;
diff --git a/libarchive/archive_read_support_format_warc.c b/libarchive/archive_read_support_format_warc.c
index c1c54450c396..72977b8e0739 100644
--- a/libarchive/archive_read_support_format_warc.c
+++ b/libarchive/archive_read_support_format_warc.c
@@ -626,7 +626,8 @@ _warc_rdver(const char *buf, size_t bsz)
if (ver >= 1200U) {
if (memcmp(c, "\r\n", 2U) != 0)
ver = 0U;
- } else if (ver < 1200U) {
+ } else {
+ /* ver < 1200U */
if (*c != ' ' && *c != '\t')
ver = 0U;
}
diff --git a/libarchive/archive_read_support_format_xar.c b/libarchive/archive_read_support_format_xar.c
index 34253a52fb75..7f8be398c7a2 100644
--- a/libarchive/archive_read_support_format_xar.c
+++ b/libarchive/archive_read_support_format_xar.c
@@ -2613,15 +2613,14 @@ strappend_base64(struct xar *xar,
while (l > 0) {
int n = 0;
- if (l > 0) {
- if (base64[b[0]] < 0 || base64[b[1]] < 0)
- break;
- n = base64[*b++] << 18;
- n |= base64[*b++] << 12;
- *out++ = n >> 16;
- len++;
- l -= 2;
- }
+ if (base64[b[0]] < 0 || base64[b[1]] < 0)
+ break;
+ n = base64[*b++] << 18;
+ n |= base64[*b++] << 12;
+ *out++ = n >> 16;
+ len++;
+ l -= 2;
+
if (l > 0) {
if (base64[*b] < 0)
break;
diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c
index 399299ea631f..c77dcf52c25f 100644
--- a/libarchive/archive_string.c
+++ b/libarchive/archive_string.c
@@ -744,7 +744,8 @@ archive_string_append_from_wcs_in_codepage(struct archive_string *as,
else
dp = &defchar_used;
count = WideCharToMultiByte(to_cp, 0, ws, wslen,
- as->s + as->length, (int)as->buffer_length-1, NULL, dp);
+ as->s + as->length,
+ (int)as->buffer_length - as->length - 1, NULL, dp);
if (count == 0 &&
GetLastError() == ERROR_INSUFFICIENT_BUFFER) {
/* Expand the MBS buffer and retry. */
diff --git a/libarchive/archive_string.h b/libarchive/archive_string.h
index 56dfbb28f287..27e1ad69c56e 100644
--- a/libarchive/archive_string.h
+++ b/libarchive/archive_string.h
@@ -26,15 +26,15 @@
*
*/
+#ifndef ARCHIVE_STRING_H_INCLUDED
+#define ARCHIVE_STRING_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#ifndef __LIBARCHIVE_TEST
#error This header is only to be used internally to libarchive.
#endif
#endif
-#ifndef ARCHIVE_STRING_H_INCLUDED
-#define ARCHIVE_STRING_H_INCLUDED
-
#include <stdarg.h>
#ifdef HAVE_STDLIB_H
#include <stdlib.h> /* required for wchar_t on some systems */
diff --git a/libarchive/archive_string_composition.h b/libarchive/archive_string_composition.h
index 8902ac1f7f30..d0ac340961a0 100644
--- a/libarchive/archive_string_composition.h
+++ b/libarchive/archive_string_composition.h
@@ -34,13 +34,13 @@
* See also http://unicode.org/report/tr15/
*/
+#ifndef ARCHIVE_STRING_COMPOSITION_H_INCLUDED
+#define ARCHIVE_STRING_COMPOSITION_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_STRING_COMPOSITION_H_INCLUDED
-#define ARCHIVE_STRING_COMPOSITION_H_INCLUDED
-
struct unicode_composition_table {
uint32_t cp1;
uint32_t cp2;
diff --git a/libarchive/archive_util.c b/libarchive/archive_util.c
index 3399c0b5f492..288a44280dc2 100644
--- a/libarchive/archive_util.c
+++ b/libarchive/archive_util.c
@@ -218,8 +218,8 @@ __archive_errx(int retvalue, const char *msg)
* Also Windows version of mktemp family including _mktemp_s
* are not secure.
*/
-int
-__archive_mktemp(const char *tmpdir)
+static int
+__archive_mktempx(const char *tmpdir, wchar_t *template)
{
static const wchar_t prefix[] = L"libarchive_";
static const wchar_t suffix[] = L"XXXXXXXXXX";
@@ -243,64 +243,76 @@ __archive_mktemp(const char *tmpdir)
hProv = (HCRYPTPROV)NULL;
fd = -1;
ws = NULL;
- archive_string_init(&temp_name);
- /* Get a temporary directory. */
- if (tmpdir == NULL) {
- size_t l;
- wchar_t *tmp;
+ if (template == NULL) {
+ archive_string_init(&temp_name);
- l = GetTempPathW(0, NULL);
- if (l == 0) {
- la_dosmaperr(GetLastError());
- goto exit_tmpfile;
- }
- tmp = malloc(l*sizeof(wchar_t));
- if (tmp == NULL) {
- errno = ENOMEM;
- goto exit_tmpfile;
- }
- GetTempPathW((DWORD)l, tmp);
- archive_wstrcpy(&temp_name, tmp);
- free(tmp);
- } else {
- if (archive_wstring_append_from_mbs(&temp_name, tmpdir,
- strlen(tmpdir)) < 0)
- goto exit_tmpfile;
- if (temp_name.s[temp_name.length-1] != L'/')
- archive_wstrappend_wchar(&temp_name, L'/');
- }
+ /* Get a temporary directory. */
+ if (tmpdir == NULL) {
+ size_t l;
+ wchar_t *tmp;
- /* Check if temp_name is a directory. */
- attr = GetFileAttributesW(temp_name.s);
- if (attr == (DWORD)-1) {
- if (GetLastError() != ERROR_FILE_NOT_FOUND) {
- la_dosmaperr(GetLastError());
- goto exit_tmpfile;
- }
- ws = __la_win_permissive_name_w(temp_name.s);
- if (ws == NULL) {
- errno = EINVAL;
- goto exit_tmpfile;
+ l = GetTempPathW(0, NULL);
+ if (l == 0) {
+ la_dosmaperr(GetLastError());
+ goto exit_tmpfile;
+ }
+ tmp = malloc(l*sizeof(wchar_t));
+ if (tmp == NULL) {
+ errno = ENOMEM;
+ goto exit_tmpfile;
+ }
+ GetTempPathW((DWORD)l, tmp);
+ archive_wstrcpy(&temp_name, tmp);
+ free(tmp);
+ } else {
+ if (archive_wstring_append_from_mbs(&temp_name, tmpdir,
+ strlen(tmpdir)) < 0)
+ goto exit_tmpfile;
+ if (temp_name.s[temp_name.length-1] != L'/')
+ archive_wstrappend_wchar(&temp_name, L'/');
}
- attr = GetFileAttributesW(ws);
+
+ /* Check if temp_name is a directory. */
+ attr = GetFileAttributesW(temp_name.s);
if (attr == (DWORD)-1) {
- la_dosmaperr(GetLastError());
+ if (GetLastError() != ERROR_FILE_NOT_FOUND) {
+ la_dosmaperr(GetLastError());
+ goto exit_tmpfile;
+ }
+ ws = __la_win_permissive_name_w(temp_name.s);
+ if (ws == NULL) {
+ errno = EINVAL;
+ goto exit_tmpfile;
+ }
+ attr = GetFileAttributesW(ws);
+ if (attr == (DWORD)-1) {
+ la_dosmaperr(GetLastError());
+ goto exit_tmpfile;
+ }
+ }
+ if (!(attr & FILE_ATTRIBUTE_DIRECTORY)) {
+ errno = ENOTDIR;
goto exit_tmpfile;
}
- }
- if (!(attr & FILE_ATTRIBUTE_DIRECTORY)) {
- errno = ENOTDIR;
- goto exit_tmpfile;
- }
- /*
- * Create a temporary file.
- */
- archive_wstrcat(&temp_name, prefix);
- archive_wstrcat(&temp_name, suffix);
- ep = temp_name.s + archive_strlen(&temp_name);
- xp = ep - wcslen(suffix);
+ /*
+ * Create a temporary file.
+ */
+ archive_wstrcat(&temp_name, prefix);
+ archive_wstrcat(&temp_name, suffix);
+ ep = temp_name.s + archive_strlen(&temp_name);
+ xp = ep - wcslen(suffix);
+ template = temp_name.s;
+ } else {
+ xp = wcschr(template, L'X');
+ if (xp == NULL) /* No X, programming error */
+ abort();
+ for (ep = xp; *ep == L'X'; ep++)
+ continue;
+ if (*ep) /* X followed by non X, programming error */
+ abort();
+ }
if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT)) {
@@ -323,20 +335,24 @@ __archive_mktemp(const char *tmpdir)
*p = num[((DWORD)*p) % (sizeof(num)/sizeof(num[0]))];
free(ws);
- ws = __la_win_permissive_name_w(temp_name.s);
+ ws = __la_win_permissive_name_w(template);
if (ws == NULL) {
errno = EINVAL;
goto exit_tmpfile;
}
- /* Specifies FILE_FLAG_DELETE_ON_CLOSE flag is to
- * delete this temporary file immediately when this
- * file closed. */
+ if (template == temp_name.s) {
+ attr = FILE_ATTRIBUTE_TEMPORARY |
+ FILE_FLAG_DELETE_ON_CLOSE;
+ } else {
+ /* mkstemp */
+ attr = FILE_ATTRIBUTE_NORMAL;
+ }
h = CreateFileW(ws,
GENERIC_READ | GENERIC_WRITE | DELETE,
0,/* Not share */
NULL,
CREATE_NEW,/* Create a new file only */
- FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE,
+ attr,
NULL);
if (h == INVALID_HANDLE_VALUE) {
/* The same file already exists. retry with
@@ -358,10 +374,23 @@ exit_tmpfile:
if (hProv != (HCRYPTPROV)NULL)
CryptReleaseContext(hProv, 0);
free(ws);
- archive_wstring_free(&temp_name);
+ if (template == temp_name.s)
+ archive_wstring_free(&temp_name);
return (fd);
}
+int
+__archive_mktemp(const char *tmpdir)
+{
+ return __archive_mktempx(tmpdir, NULL);
+}
+
+int
+__archive_mkstemp(wchar_t *template)
+{
+ return __archive_mktempx(NULL, template);
+}
+
#else
static int
@@ -414,14 +443,24 @@ exit_tmpfile:
return (fd);
}
-#else
+int
+__archive_mkstemp(char *template)
+{
+ int fd = -1;
+ fd = mkstemp(template);
+ if (fd >= 0)
+ __archive_ensure_cloexec_flag(fd);
+ return (fd);
+}
+
+#else /* !HAVE_MKSTEMP */
/*
* We use a private routine.
*/
-int
-__archive_mktemp(const char *tmpdir)
+static int
+__archive_mktempx(const char *tmpdir, char *template)
{
static const char num[] = {
'0', '1', '2', '3', '4', '5', '6', '7',
@@ -439,26 +478,37 @@ __archive_mktemp(const char *tmpdir)
char *tp, *ep;
fd = -1;
- archive_string_init(&temp_name);
- if (tmpdir == NULL) {
- if (get_tempdir(&temp_name) != ARCHIVE_OK)
+ if (template == NULL) {
+ archive_string_init(&temp_name);
+ if (tmpdir == NULL) {
+ if (get_tempdir(&temp_name) != ARCHIVE_OK)
+ goto exit_tmpfile;
+ } else
+ archive_strcpy(&temp_name, tmpdir);
+ if (temp_name.s[temp_name.length-1] == '/') {
+ temp_name.s[temp_name.length-1] = '\0';
+ temp_name.length --;
+ }
+ if (la_stat(temp_name.s, &st) < 0)
goto exit_tmpfile;
- } else
- archive_strcpy(&temp_name, tmpdir);
- if (temp_name.s[temp_name.length-1] == '/') {
- temp_name.s[temp_name.length-1] = '\0';
- temp_name.length --;
- }
- if (la_stat(temp_name.s, &st) < 0)
- goto exit_tmpfile;
- if (!S_ISDIR(st.st_mode)) {
- errno = ENOTDIR;
- goto exit_tmpfile;
+ if (!S_ISDIR(st.st_mode)) {
+ errno = ENOTDIR;
+ goto exit_tmpfile;
+ }
+ archive_strcat(&temp_name, "/libarchive_");
+ tp = temp_name.s + archive_strlen(&temp_name);
+ archive_strcat(&temp_name, "XXXXXXXXXX");
+ ep = temp_name.s + archive_strlen(&temp_name);
+ template = temp_name.s;
+ } else {
+ tp = strchr(template, 'X');
+ if (tp == NULL) /* No X, programming error */
+ abort();
+ for (ep = tp; *ep == 'X'; ep++)
+ continue;
+ if (*ep) /* X followed by non X, programming error */
+ abort();
}
- archive_strcat(&temp_name, "/libarchive_");
- tp = temp_name.s + archive_strlen(&temp_name);
- archive_strcat(&temp_name, "XXXXXXXXXX");
- ep = temp_name.s + archive_strlen(&temp_name);
do {
char *p;
@@ -469,19 +519,33 @@ __archive_mktemp(const char *tmpdir)
int d = *((unsigned char *)p) % sizeof(num);
*p++ = num[d];
}
- fd = open(temp_name.s, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC,
+ fd = open(template, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC,
0600);
} while (fd < 0 && errno == EEXIST);
if (fd < 0)
goto exit_tmpfile;
__archive_ensure_cloexec_flag(fd);
- unlink(temp_name.s);
+ if (template == temp_name.s)
+ unlink(temp_name.s);
exit_tmpfile:
- archive_string_free(&temp_name);
+ if (template == temp_name.s)
+ archive_string_free(&temp_name);
return (fd);
}
-#endif /* HAVE_MKSTEMP */
+int
+__archive_mktemp(const char *tmpdir)
+{
+ return __archive_mktempx(tmpdir, NULL);
+}
+
+int
+__archive_mkstemp(char *template)
+{
+ return __archive_mktempx(NULL, template);
+}
+
+#endif /* !HAVE_MKSTEMP */
#endif /* !_WIN32 || __CYGWIN__ */
/*
diff --git a/libarchive/archive_windows.h b/libarchive/archive_windows.h
index 87d8c891bb0b..47b7cb8e379f 100644
--- a/libarchive/archive_windows.h
+++ b/libarchive/archive_windows.h
@@ -27,10 +27,6 @@
* $FreeBSD$
*/
-#ifndef __LIBARCHIVE_BUILD
-#error This header is only to be used internally to libarchive.
-#endif
-
/*
* TODO: A lot of stuff in here isn't actually used by libarchive and
* can be trimmed out. Note that this file is used by libarchive and
@@ -48,6 +44,10 @@
#ifndef LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED
#define LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
+
/* Start of configuration for native Win32 */
#ifndef MINGW_HAS_SECURE_API
#define MINGW_HAS_SECURE_API 1
diff --git a/libarchive/archive_write_disk.3 b/libarchive/archive_write_disk.3
index ff8e1a36a75c..2fa016e4547b 100644
--- a/libarchive/archive_write_disk.3
+++ b/libarchive/archive_write_disk.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd April 3, 2017
+.Dd January 19, 2020
.Dt ARCHIVE_WRITE_DISK 3
.Os
.Sh NAME
@@ -139,6 +139,11 @@ is not specified, then SUID and SGID bits will only be restored
if the default user and group IDs of newly-created objects on disk
happen to match those specified in the archive entry.
By default, only basic permissions are restored, and umask is obeyed.
+.It Cm ARCHIVE_EXTRACT_SAFE_WRITES
+Extract files atomically, by first creating a unique temporary file and then
+renaming it to its required destination name.
+This avoids a race where an application might see a partial file (or no
+file) during extraction.
.It Cm ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS
Refuse to extract an absolute path.
The default is to not refuse such paths.
diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c
index df4b02f5efa1..cc53a3d318e0 100644
--- a/libarchive/archive_write_disk_posix.c
+++ b/libarchive/archive_write_disk_posix.c
@@ -253,6 +253,8 @@ struct archive_write_disk {
struct archive_entry *entry; /* Entry being extracted. */
char *name; /* Name of entry, possibly edited. */
struct archive_string _name_data; /* backing store for 'name' */
+ char *tmpname; /* Temporary name * */
+ struct archive_string _tmpname_data; /* backing store for 'tmpname' */
/* Tasks remaining for this object. */
int todo;
/* Tasks deferred until end-of-archive. */
@@ -354,6 +356,7 @@ struct archive_write_disk {
static int la_opendirat(int, const char *);
+static int la_mktemp(struct archive_write_disk *);
static void fsobj_error(int *, struct archive_string *, int, const char *,
const char *);
static int check_symlinks_fsobj(char *, int *, struct archive_string *,
@@ -407,6 +410,30 @@ static ssize_t _archive_write_disk_data_block(struct archive *, const void *,
size_t, int64_t);
static int
+la_mktemp(struct archive_write_disk *a)
+{
+ int oerrno, fd;
+ mode_t mode;
+
+ archive_string_empty(&a->_tmpname_data);
+ archive_string_sprintf(&a->_tmpname_data, "%s.XXXXXX", a->name);
+ a->tmpname = a->_tmpname_data.s;
+
+ fd = __archive_mkstemp(a->tmpname);
+ if (fd == -1)
+ return -1;
+
+ mode = a->mode & 0777 & ~a->user_umask;
+ if (fchmod(fd, mode) == -1) {
+ oerrno = errno;
+ close(fd);
+ errno = oerrno;
+ return -1;
+ }
+ return fd;
+}
+
+static int
la_opendirat(int fd, const char *path) {
const int flags = O_CLOEXEC
#if defined(O_BINARY)
@@ -1826,6 +1853,14 @@ finish_metadata:
if (a->fd >= 0) {
close(a->fd);
a->fd = -1;
+ if (a->tmpname) {
+ if (rename(a->tmpname, a->name) == -1) {
+ archive_set_error(&a->archive, errno,
+ "rename failed");
+ ret = ARCHIVE_FATAL;
+ }
+ a->tmpname = NULL;
+ }
}
/* If there's an entry, we can release it now. */
archive_entry_free(a->entry);
@@ -2103,17 +2138,28 @@ restore_entry(struct archive_write_disk *a)
}
if (!S_ISDIR(a->st.st_mode)) {
- /* A non-dir is in the way, unlink it. */
if (a->flags & ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS)
(void)clear_nochange_fflags(a);
- if (unlink(a->name) != 0) {
- archive_set_error(&a->archive, errno,
- "Can't unlink already-existing object");
- return (ARCHIVE_FAILED);
+
+ if ((a->flags & ARCHIVE_EXTRACT_SAFE_WRITES) &&
+ S_ISREG(a->st.st_mode)) {
+ /* Use a temporary file to extract */
+ if ((a->fd = la_mktemp(a)) == -1)
+ return ARCHIVE_FAILED;
+ a->pst = NULL;
+ en = 0;
+ } else {
+ /* A non-dir is in the way, unlink it. */
+ if (unlink(a->name) != 0) {
+ archive_set_error(&a->archive, errno,
+ "Can't unlink already-existing "
+ "object");
+ return (ARCHIVE_FAILED);
+ }
+ a->pst = NULL;
+ /* Try again. */
+ en = create_filesystem_object(a);
}
- a->pst = NULL;
- /* Try again. */
- en = create_filesystem_object(a);
} else if (!S_ISDIR(a->mode)) {
/* A dir is in the way of a non-dir, rmdir it. */
if (a->flags & ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS)
@@ -2215,6 +2261,13 @@ create_filesystem_object(struct archive_write_disk *a)
}
free(linkname_copy);
archive_string_free(&error_string);
+ /*
+ * Unlinking and linking here is really not atomic,
+ * but doing it right, would require us to construct
+ * an mktemplink() function, and then use rename(2).
+ */
+ if (a->flags & ARCHIVE_EXTRACT_SAFE_WRITES)
+ unlink(a->name);
r = link(linkname, a->name) ? errno : 0;
/*
* New cpio and pax formats allow hardlink entries
@@ -2253,6 +2306,13 @@ create_filesystem_object(struct archive_write_disk *a)
linkname = archive_entry_symlink(a->entry);
if (linkname != NULL) {
#if HAVE_SYMLINK
+ /*
+ * Unlinking and linking here is really not atomic,
+ * but doing it right, would require us to construct
+ * an mktempsymlink() function, and then use rename(2).
+ */
+ if (a->flags & ARCHIVE_EXTRACT_SAFE_WRITES)
+ unlink(a->name);
return symlink(linkname, a->name) ? errno : 0;
#else
return (EPERM);
@@ -2288,6 +2348,7 @@ create_filesystem_object(struct archive_write_disk *a)
/* POSIX requires that we fall through here. */
/* FALLTHROUGH */
case AE_IFREG:
+ a->tmpname = NULL;
a->fd = open(a->name,
O_WRONLY | O_CREAT | O_EXCL | O_BINARY | O_CLOEXEC, mode);
__archive_ensure_cloexec_flag(a->fd);
@@ -2449,6 +2510,7 @@ _archive_write_disk_free(struct archive *_a)
archive_write_disk_set_user_lookup(&a->archive, NULL, NULL, NULL);
archive_entry_free(a->entry);
archive_string_free(&a->_name_data);
+ archive_string_free(&a->_tmpname_data);
archive_string_free(&a->archive.error_string);
archive_string_free(&a->path_safe);
a->archive.magic = 0;
diff --git a/libarchive/archive_write_disk_private.h b/libarchive/archive_write_disk_private.h
index b655dea2b659..557d7e2bf34f 100644
--- a/libarchive/archive_write_disk_private.h
+++ b/libarchive/archive_write_disk_private.h
@@ -26,13 +26,13 @@
* $FreeBSD: head/lib/libarchive/archive_write_disk_private.h 201086 2009-12-28 02:17:53Z kientzle $
*/
+#ifndef ARCHIVE_WRITE_DISK_PRIVATE_H_INCLUDED
+#define ARCHIVE_WRITE_DISK_PRIVATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_WRITE_DISK_PRIVATE_H_INCLUDED
-#define ARCHIVE_WRITE_DISK_PRIVATE_H_INCLUDED
-
#include "archive_platform_acl.h"
#include "archive_acl_private.h"
#include "archive_entry.h"
diff --git a/libarchive/archive_write_disk_windows.c b/libarchive/archive_write_disk_windows.c
index 8b947304bd61..77e36c4a621d 100644
--- a/libarchive/archive_write_disk_windows.c
+++ b/libarchive/archive_write_disk_windows.c
@@ -165,6 +165,8 @@ struct archive_write_disk {
struct archive_entry *entry; /* Entry being extracted. */
wchar_t *name; /* Name of entry, possibly edited. */
struct archive_wstring _name_data; /* backing store for 'name' */
+ wchar_t *tmpname; /* Temporary name */
+ struct archive_wstring _tmpname_data; /* backing store for 'tmpname' */
/* Tasks remaining for this object. */
int todo;
/* Tasks deferred until end-of-archive. */
@@ -215,6 +217,7 @@ static int cleanup_pathname(struct archive_write_disk *);
static int create_dir(struct archive_write_disk *, wchar_t *);
static int create_parent_dir(struct archive_write_disk *, wchar_t *);
static int la_chmod(const wchar_t *, mode_t);
+static int la_mktemp(struct archive_write_disk *);
static int older(BY_HANDLE_FILE_INFORMATION *, struct archive_entry *);
static int permissive_name_w(struct archive_write_disk *);
static int restore_entry(struct archive_write_disk *);
@@ -534,6 +537,28 @@ exit_chmode:
return (ret);
}
+static int
+la_mktemp(struct archive_write_disk *a)
+{
+ int fd;
+ mode_t mode;
+
+ archive_wstring_empty(&(a->_tmpname_data));
+ archive_wstrcpy(&(a->_tmpname_data), a->name);
+ archive_wstrcat(&(a->_tmpname_data), L".XXXXXX");
+ a->tmpname = a->_tmpname_data.s;
+
+ fd = __archive_mkstemp(a->tmpname);
+
+ mode = a->mode & 0777 & ~a->user_umask;
+ if (la_chmod(a->tmpname, mode) == -1) {
+ la_dosmaperr(GetLastError());
+ _close(fd);
+ return -1;
+ }
+ return (fd);
+}
+
static void *
la_GetFunctionKernel32(const char *name)
{
@@ -1252,6 +1277,16 @@ _archive_write_disk_finish_entry(struct archive *_a)
if (a->fh != INVALID_HANDLE_VALUE) {
CloseHandle(a->fh);
a->fh = INVALID_HANDLE_VALUE;
+ if (a->tmpname) {
+ /* Windows does not support atomic rename */
+ disk_unlink(a->name);
+ if (_wrename(a->tmpname, a->name) != 0) {
+ archive_set_error(&a->archive, errno,
+ "rename failed");
+ ret = ARCHIVE_FATAL;
+ }
+ a->tmpname = NULL;
+ }
}
/* If there's an entry, we can release it now. */
archive_entry_free(a->entry);
@@ -1530,26 +1565,46 @@ restore_entry(struct archive_write_disk *a)
}
if (!S_ISDIR(st_mode)) {
- /* Edge case: a directory symlink pointing to a file */
if (a->flags &
ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS) {
(void)clear_nochange_fflags(a);
}
- if (dirlnk) {
- if (disk_rmdir(a->name) != 0) {
- archive_set_error(&a->archive, errno,
- "Can't unlink directory symlink");
+ if ((a->flags & ARCHIVE_EXTRACT_SAFE_WRITES) &&
+ S_ISREG(st_mode)) {
+ int fd = la_mktemp(a);
+
+ if (fd == -1)
+ return (ARCHIVE_FAILED);
+ a->fh = (HANDLE)_get_osfhandle(fd);
+ if (a->fh == INVALID_HANDLE_VALUE)
return (ARCHIVE_FAILED);
+
+ a->pst = NULL;
+ en = 0;
+ } else {
+ if (dirlnk) {
+ /* Edge case: dir symlink pointing
+ * to a file */
+ if (disk_rmdir(a->name) != 0) {
+ archive_set_error(&a->archive,
+ errno, "Can't unlink "
+ "directory symlink");
+ return (ARCHIVE_FAILED);
+ }
+ } else {
+ if (disk_unlink(a->name) != 0) {
+ /* A non-dir is in the way,
+ * unlink it. */
+ archive_set_error(&a->archive,
+ errno, "Can't unlink "
+ "already-existing object");
+ return (ARCHIVE_FAILED);
+ }
}
- } else if (disk_unlink(a->name) != 0) {
- /* A non-dir is in the way, unlink it. */
- archive_set_error(&a->archive, errno,
- "Can't unlink already-existing object");
- return (ARCHIVE_FAILED);
+ a->pst = NULL;
+ /* Try again. */
+ en = create_filesystem_object(a);
}
- a->pst = NULL;
- /* Try again. */
- en = create_filesystem_object(a);
} else if (!S_ISDIR(a->mode)) {
/* A dir is in the way of a non-dir, rmdir it. */
if (a->flags & ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS)
@@ -1601,6 +1656,7 @@ create_filesystem_object(struct archive_write_disk *a)
wchar_t *fullname;
mode_t final_mode, mode;
int r;
+ DWORD attrs = 0;
/* We identify hard/symlinks according to the link names. */
/* Since link(2) and symlink(2) don't handle modes, we're done here. */
@@ -1614,6 +1670,20 @@ create_filesystem_object(struct archive_write_disk *a)
errno = EINVAL;
r = -1;
} else {
+ /*
+ * Unlinking and linking here is really not atomic,
+ * but doing it right, would require us to construct
+ * an mktemplink() function, and then use _wrename().
+ */
+ if (a->flags & ARCHIVE_EXTRACT_SAFE_WRITES) {
+ attrs = GetFileAttributesW(namefull);
+ if (attrs != INVALID_FILE_ATTRIBUTES) {
+ if (attrs & FILE_ATTRIBUTE_DIRECTORY)
+ disk_rmdir(namefull);
+ else
+ disk_unlink(namefull);
+ }
+ }
r = la_CreateHardLinkW(namefull, linkfull);
if (r == 0) {
la_dosmaperr(GetLastError());
@@ -1650,6 +1720,18 @@ create_filesystem_object(struct archive_write_disk *a)
}
linkname = archive_entry_symlink_w(a->entry);
if (linkname != NULL) {
+ /*
+ * Unlinking and linking here is really not atomic,
+ * but doing it right, would require us to construct
+ * an mktemplink() function, and then use _wrename().
+ */
+ attrs = GetFileAttributesW(a->name);
+ if (attrs != INVALID_FILE_ATTRIBUTES) {
+ if (attrs & FILE_ATTRIBUTE_DIRECTORY)
+ disk_rmdir(a->name);
+ else
+ disk_unlink(a->name);
+ }
#if HAVE_SYMLINK
return symlink(linkname, a->name) ? errno : 0;
#else
@@ -1686,6 +1768,7 @@ create_filesystem_object(struct archive_write_disk *a)
/* POSIX requires that we fall through here. */
/* FALLTHROUGH */
case AE_IFREG:
+ a->tmpname = NULL;
fullname = a->name;
/* O_WRONLY | O_CREAT | O_EXCL */
a->fh = CreateFileW(fullname, GENERIC_WRITE, 0, NULL,
@@ -1842,6 +1925,7 @@ _archive_write_disk_free(struct archive *_a)
archive_write_disk_set_user_lookup(&a->archive, NULL, NULL, NULL);
archive_entry_free(a->entry);
archive_wstring_free(&a->_name_data);
+ archive_wstring_free(&a->_tmpname_data);
archive_string_free(&a->archive.error_string);
archive_wstring_free(&a->path_safe);
a->archive.magic = 0;
diff --git a/libarchive/archive_write_private.h b/libarchive/archive_write_private.h
index 1c182f136801..27cba0392ce1 100644
--- a/libarchive/archive_write_private.h
+++ b/libarchive/archive_write_private.h
@@ -25,15 +25,15 @@
* $FreeBSD: head/lib/libarchive/archive_write_private.h 201155 2009-12-29 05:20:12Z kientzle $
*/
+#ifndef ARCHIVE_WRITE_PRIVATE_H_INCLUDED
+#define ARCHIVE_WRITE_PRIVATE_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#ifndef __LIBARCHIVE_TEST
#error This header is only to be used internally to libarchive.
#endif
#endif
-#ifndef ARCHIVE_WRITE_PRIVATE_H_INCLUDED
-#define ARCHIVE_WRITE_PRIVATE_H_INCLUDED
-
#include "archive.h"
#include "archive_string.h"
#include "archive_private.h"
diff --git a/libarchive/archive_write_set_format.c b/libarchive/archive_write_set_format.c
index 0f706231add1..12de08077534 100644
--- a/libarchive/archive_write_set_format.c
+++ b/libarchive/archive_write_set_format.c
@@ -36,6 +36,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format.c 201168 2009-1
#include "archive.h"
#include "archive_private.h"
+#include "archive_write_set_format_private.h"
/* A table that maps format codes to functions. */
static const
@@ -76,3 +77,47 @@ archive_write_set_format(struct archive *a, int code)
archive_set_error(a, EINVAL, "No such format");
return (ARCHIVE_FATAL);
}
+
+void
+__archive_write_entry_filetype_unsupported(struct archive *a,
+ struct archive_entry *entry, const char *format)
+{
+ char *name = NULL;
+
+ switch (archive_entry_filetype(entry)) {
+ /*
+ * All formats should be able to archive regular files (AE_IFREG)
+ */
+ case AE_IFDIR:
+ name = "directories";
+ break;
+ case AE_IFLNK:
+ name = "symbolic links";
+ break;
+ case AE_IFCHR:
+ name = "character devices";
+ break;
+ case AE_IFBLK:
+ name = "block devices";
+ break;
+ case AE_IFIFO:
+ name = "named pipes";
+ break;
+ case AE_IFSOCK:
+ name = "sockets";
+ break;
+ default:
+ break;
+ }
+
+ if (name != NULL) {
+ archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
+ "%s: %s format cannot archive %s",
+ archive_entry_pathname(entry), format, name);
+ } else {
+ archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
+ "%s: %s format cannot archive files with mode 0%lo",
+ archive_entry_pathname(entry), format,
+ (unsigned long)archive_entry_mode(entry));
+ }
+}
diff --git a/libarchive/archive_write_set_format_7zip.c b/libarchive/archive_write_set_format_7zip.c
index 92a87f74e625..fb7697f659ca 100644
--- a/libarchive/archive_write_set_format_7zip.c
+++ b/libarchive/archive_write_set_format_7zip.c
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
#include "archive_rb.h"
#include "archive_string.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
/*
* Codec ID
@@ -164,7 +165,7 @@ struct file {
mode_t mode;
uint32_t crc32;
- int dir:1;
+ signed int dir:1;
};
struct _7zip {
diff --git a/libarchive/archive_write_set_format_ar.c b/libarchive/archive_write_set_format_ar.c
index 253cac82efe6..fc0de1e9f6f0 100644
--- a/libarchive/archive_write_set_format_ar.c
+++ b/libarchive/archive_write_set_format_ar.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_ar.c 201108 200
#include "archive_entry.h"
#include "archive_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
struct ar_w {
uint64_t entry_bytes_remaining;
diff --git a/libarchive/archive_write_set_format_cpio.c b/libarchive/archive_write_set_format_cpio.c
index 16cefad7b5b3..729f9c775591 100644
--- a/libarchive/archive_write_set_format_cpio.c
+++ b/libarchive/archive_write_set_format_cpio.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_cpio.c 201170 2
#include "archive_entry_locale.h"
#include "archive_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
static ssize_t archive_write_cpio_data(struct archive_write *,
const void *buff, size_t s);
diff --git a/libarchive/archive_write_set_format_cpio_newc.c b/libarchive/archive_write_set_format_cpio_newc.c
index 2d923cc33061..172fda62f0bb 100644
--- a/libarchive/archive_write_set_format_cpio_newc.c
+++ b/libarchive/archive_write_set_format_cpio_newc.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_cpio_newc.c 201
#include "archive_entry_locale.h"
#include "archive_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
static ssize_t archive_write_newc_data(struct archive_write *,
const void *buff, size_t s);
diff --git a/libarchive/archive_write_set_format_gnutar.c b/libarchive/archive_write_set_format_gnutar.c
index e7757c22badd..ec29c5c418e4 100644
--- a/libarchive/archive_write_set_format_gnutar.c
+++ b/libarchive/archive_write_set_format_gnutar.c
@@ -46,6 +46,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_gnu_tar.c 19157
#include "archive_entry_locale.h"
#include "archive_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
struct gnutar {
uint64_t entry_bytes_remaining;
@@ -534,17 +535,9 @@ archive_write_gnutar_header(struct archive_write *a,
case AE_IFBLK: tartype = '4' ; break;
case AE_IFDIR: tartype = '5' ; break;
case AE_IFIFO: tartype = '6' ; break;
- case AE_IFSOCK:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive socket");
- ret = ARCHIVE_FAILED;
- goto exit_write_header;
- default:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive this (mode=0%lo)",
- (unsigned long)archive_entry_mode(entry));
+ default: /* AE_IFSOCK and unknown */
+ __archive_write_entry_filetype_unsupported(
+ &a->archive, entry, "gnutar");
ret = ARCHIVE_FAILED;
goto exit_write_header;
}
diff --git a/libarchive/archive_write_set_format_iso9660.c b/libarchive/archive_write_set_format_iso9660.c
index cacbdde7dcb0..7cde44c34f75 100644
--- a/libarchive/archive_write_set_format_iso9660.c
+++ b/libarchive/archive_write_set_format_iso9660.c
@@ -289,12 +289,12 @@ struct isoent {
struct extr_rec *current;
} extr_rec_list;
- int virtual:1;
+ signed int virtual:1;
/* If set to one, this file type is a directory.
* A convenience flag to be used as
* "archive_entry_filetype(isoent->file->entry) == AE_IFDIR".
*/
- int dir:1;
+ signed int dir:1;
};
struct hardlink {
@@ -755,9 +755,9 @@ struct iso9660 {
/* Used for making zisofs. */
struct {
- int detect_magic:1;
- int making:1;
- int allzero:1;
+ signed int detect_magic:1;
+ signed int making:1;
+ signed int allzero:1;
unsigned char magic_buffer[64];
int magic_cnt;
@@ -5094,13 +5094,11 @@ isofile_init_hardlinks(struct iso9660 *iso9660)
static void
isofile_free_hardlinks(struct iso9660 *iso9660)
{
- struct archive_rb_node *n, *next;
+ struct archive_rb_node *n, *tmp;
- for (n = ARCHIVE_RB_TREE_MIN(&(iso9660->hardlink_rbtree)); n;) {
- next = __archive_rb_tree_iterate(&(iso9660->hardlink_rbtree),
- n, ARCHIVE_RB_DIR_RIGHT);
+ ARCHIVE_RB_TREE_FOREACH_SAFE(n, &(iso9660->hardlink_rbtree), tmp) {
+ __archive_rb_tree_remove_node(&(iso9660->hardlink_rbtree), n);
free(n);
- n = next;
}
}
@@ -7801,8 +7799,8 @@ struct zisofs_extract {
uint64_t pz_uncompressed_size;
size_t uncompressed_buffer_size;
- int initialized:1;
- int header_passed:1;
+ signed int initialized:1;
+ signed int header_passed:1;
uint32_t pz_offset;
unsigned char *block_pointers;
diff --git a/libarchive/archive_write_set_format_pax.c b/libarchive/archive_write_set_format_pax.c
index 7c5e63bb3a23..a2b27107195d 100644
--- a/libarchive/archive_write_set_format_pax.c
+++ b/libarchive/archive_write_set_format_pax.c
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_pax.c 201162 20
#include "archive_entry_locale.h"
#include "archive_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
struct sparse_block {
struct sparse_block *next;
@@ -713,17 +714,9 @@ archive_write_pax_header(struct archive_write *a,
}
break;
}
- case AE_IFSOCK:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive socket");
- return (ARCHIVE_FAILED);
- default:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive this (type=0%lo)",
- (unsigned long)
- archive_entry_filetype(entry_original));
+ default: /* AE_IFSOCK and unknown */
+ __archive_write_entry_filetype_unsupported(
+ &a->archive, entry_original, "pax");
return (ARCHIVE_FAILED);
}
}
@@ -859,13 +852,16 @@ archive_write_pax_header(struct archive_write *a,
* them do.
*/
r = get_entry_pathname(a, entry_main, &path, &path_length, sconv);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
- else if (r != ARCHIVE_OK) {
+ } else if (r != ARCHIVE_OK) {
r = get_entry_pathname(a, entry_main, &path,
&path_length, NULL);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
+ }
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Can't translate pathname '%s' to %s", path,
archive_string_conversion_charset_name(sconv));
@@ -873,12 +869,15 @@ archive_write_pax_header(struct archive_write *a,
sconv = NULL;/* The header charset switches to binary mode. */
}
r = get_entry_uname(a, entry_main, &uname, &uname_length, sconv);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
- else if (r != ARCHIVE_OK) {
+ } else if (r != ARCHIVE_OK) {
r = get_entry_uname(a, entry_main, &uname, &uname_length, NULL);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
+ }
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Can't translate uname '%s' to %s", uname,
archive_string_conversion_charset_name(sconv));
@@ -886,12 +885,15 @@ archive_write_pax_header(struct archive_write *a,
sconv = NULL;/* The header charset switches to binary mode. */
}
r = get_entry_gname(a, entry_main, &gname, &gname_length, sconv);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
- else if (r != ARCHIVE_OK) {
+ } else if (r != ARCHIVE_OK) {
r = get_entry_gname(a, entry_main, &gname, &gname_length, NULL);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
+ }
archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT,
"Can't translate gname '%s' to %s", gname,
archive_string_conversion_charset_name(sconv));
@@ -903,13 +905,16 @@ archive_write_pax_header(struct archive_write *a,
if (linkpath == NULL) {
r = get_entry_symlink(a, entry_main, &linkpath,
&linkpath_length, sconv);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
- else if (r != ARCHIVE_OK) {
+ } else if (r != ARCHIVE_OK) {
r = get_entry_symlink(a, entry_main, &linkpath,
&linkpath_length, NULL);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
+ }
archive_set_error(&a->archive,
ARCHIVE_ERRNO_FILE_FORMAT,
"Can't translate linkname '%s' to %s", linkpath,
@@ -925,21 +930,29 @@ archive_write_pax_header(struct archive_write *a,
if (hardlink != NULL) {
r = get_entry_hardlink(a, entry_main, &hardlink,
&hardlink_length, NULL);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
+ }
linkpath = hardlink;
linkpath_length = hardlink_length;
}
r = get_entry_pathname(a, entry_main, &path,
&path_length, NULL);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
+ }
r = get_entry_uname(a, entry_main, &uname, &uname_length, NULL);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
+ }
r = get_entry_gname(a, entry_main, &gname, &gname_length, NULL);
- if (r == ARCHIVE_FATAL)
+ if (r == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
return (r);
+ }
}
/* Store the header encoding first, to be nice to readers. */
@@ -1196,24 +1209,33 @@ archive_write_pax_header(struct archive_write *a,
ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID |
ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA |
ARCHIVE_ENTRY_ACL_STYLE_COMPACT);
- if (ret == ARCHIVE_FATAL)
+ if (ret == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
+ archive_string_free(&entry_name);
return (ARCHIVE_FATAL);
+ }
}
if (acl_types & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) {
ret = add_pax_acl(a, entry_original, pax,
ARCHIVE_ENTRY_ACL_TYPE_ACCESS |
ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID |
ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA);
- if (ret == ARCHIVE_FATAL)
+ if (ret == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
+ archive_string_free(&entry_name);
return (ARCHIVE_FATAL);
+ }
}
if (acl_types & ARCHIVE_ENTRY_ACL_TYPE_DEFAULT) {
ret = add_pax_acl(a, entry_original, pax,
ARCHIVE_ENTRY_ACL_TYPE_DEFAULT |
ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID |
ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA);
- if (ret == ARCHIVE_FATAL)
+ if (ret == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
+ archive_string_free(&entry_name);
return (ARCHIVE_FATAL);
+ }
}
/* We use GNU-tar-compatible sparse attributes. */
@@ -1352,8 +1374,11 @@ archive_write_pax_header(struct archive_write *a,
* numeric fields, though they're less critical.
*/
if (__archive_write_format_header_ustar(a, ustarbuff, entry_main, -1, 0,
- NULL) == ARCHIVE_FATAL)
+ NULL) == ARCHIVE_FATAL) {
+ archive_entry_free(entry_main);
+ archive_string_free(&entry_name);
return (ARCHIVE_FATAL);
+ }
/* If we built any extended attributes, write that entry first. */
if (archive_strlen(&(pax->pax_header)) > 0) {
@@ -1418,6 +1443,8 @@ archive_write_pax_header(struct archive_write *a,
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"archive_write_pax_header: "
"'x' header failed?! This can't happen.\n");
+ archive_entry_free(entry_main);
+ archive_string_free(&entry_name);
return (ARCHIVE_FATAL);
} else if (r < ret)
ret = r;
@@ -1426,6 +1453,8 @@ archive_write_pax_header(struct archive_write *a,
sparse_list_clear(pax);
pax->entry_bytes_remaining = 0;
pax->entry_padding = 0;
+ archive_entry_free(entry_main);
+ archive_string_free(&entry_name);
return (ARCHIVE_FATAL);
}
@@ -1437,12 +1466,16 @@ archive_write_pax_header(struct archive_write *a,
archive_strlen(&(pax->pax_header)));
if (r != ARCHIVE_OK) {
/* If a write fails, we're pretty much toast. */
+ archive_entry_free(entry_main);
+ archive_string_free(&entry_name);
return (ARCHIVE_FATAL);
}
/* Pad out the end of the entry. */
r = __archive_write_nulls(a, (size_t)pax->entry_padding);
if (r != ARCHIVE_OK) {
/* If a write fails, we're pretty much toast. */
+ archive_entry_free(entry_main);
+ archive_string_free(&entry_name);
return (ARCHIVE_FATAL);
}
pax->entry_bytes_remaining = pax->entry_padding = 0;
@@ -1450,8 +1483,11 @@ archive_write_pax_header(struct archive_write *a,
/* Write the header for main entry. */
r = __archive_write_output(a, ustarbuff, 512);
- if (r != ARCHIVE_OK)
+ if (r != ARCHIVE_OK) {
+ archive_entry_free(entry_main);
+ archive_string_free(&entry_name);
return (r);
+ }
/*
* Inform the client of the on-disk size we're using, so
diff --git a/libarchive/archive_write_set_format_private.h b/libarchive/archive_write_set_format_private.h
new file mode 100644
index 000000000000..e20022755f8b
--- /dev/null
+++ b/libarchive/archive_write_set_format_private.h
@@ -0,0 +1,42 @@
+/*-
+ * Copyright (c) 2020 Martin Matuska
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef ARCHIVE_WRITE_SET_FORMAT_PRIVATE_H_INCLUDED
+#define ARCHIVE_WRITE_SET_FORMAT_PRIVATE_H_INCLUDED
+
+#ifndef __LIBARCHIVE_BUILD
+#ifndef __LIBARCHIVE_TEST
+#error This header is only to be used internally to libarchive.
+#endif
+#endif
+
+#include "archive.h"
+#include "archive_entry.h"
+
+void __archive_write_entry_filetype_unsupported(struct archive *a,
+ struct archive_entry *entry, const char *format);
+#endif
diff --git a/libarchive/archive_write_set_format_shar.c b/libarchive/archive_write_set_format_shar.c
index 600c88257a0c..9e4931c95c1f 100644
--- a/libarchive/archive_write_set_format_shar.c
+++ b/libarchive/archive_write_set_format_shar.c
@@ -42,6 +42,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_shar.c 189438 2
#include "archive_entry.h"
#include "archive_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
struct shar {
int dump;
@@ -194,8 +195,8 @@ archive_write_shar_header(struct archive_write *a, struct archive_entry *entry)
archive_entry_set_size(entry, 0);
if (archive_entry_hardlink(entry) == NULL &&
archive_entry_symlink(entry) == NULL) {
- archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "shar format cannot archive this");
+ __archive_write_entry_filetype_unsupported(
+ &a->archive, entry, "shar");
return (ARCHIVE_WARN);
}
}
diff --git a/libarchive/archive_write_set_format_ustar.c b/libarchive/archive_write_set_format_ustar.c
index ad4ccb77ea53..d1a06bc4f7ec 100644
--- a/libarchive/archive_write_set_format_ustar.c
+++ b/libarchive/archive_write_set_format_ustar.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_ustar.c 191579
#include "archive_entry_locale.h"
#include "archive_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
struct ustar {
uint64_t entry_bytes_remaining;
@@ -512,9 +513,11 @@ __archive_write_format_header_ustar(struct archive_write *a, char h[512],
}
if (copy_length > 0) {
if (copy_length > USTAR_uname_size) {
- archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "Username too long");
- ret = ARCHIVE_FAILED;
+ if (tartype != 'x') {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC, "Username too long");
+ ret = ARCHIVE_FAILED;
+ }
copy_length = USTAR_uname_size;
}
memcpy(h + USTAR_uname_offset, p, copy_length);
@@ -535,9 +538,11 @@ __archive_write_format_header_ustar(struct archive_write *a, char h[512],
}
if (copy_length > 0) {
if (strlen(p) > USTAR_gname_size) {
- archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "Group name too long");
- ret = ARCHIVE_FAILED;
+ if (tartype != 'x') {
+ archive_set_error(&a->archive,
+ ARCHIVE_ERRNO_MISC, "Group name too long");
+ ret = ARCHIVE_FAILED;
+ }
copy_length = USTAR_gname_size;
}
memcpy(h + USTAR_gname_offset, p, copy_length);
@@ -609,16 +614,9 @@ __archive_write_format_header_ustar(struct archive_write *a, char h[512],
case AE_IFBLK: h[USTAR_typeflag_offset] = '4' ; break;
case AE_IFDIR: h[USTAR_typeflag_offset] = '5' ; break;
case AE_IFIFO: h[USTAR_typeflag_offset] = '6' ; break;
- case AE_IFSOCK:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive socket");
- return (ARCHIVE_FAILED);
- default:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive this (mode=0%lo)",
- (unsigned long)archive_entry_mode(entry));
+ default: /* AE_IFSOCK and unknown */
+ __archive_write_entry_filetype_unsupported(
+ &a->archive, entry, "ustar");
ret = ARCHIVE_FAILED;
}
}
diff --git a/libarchive/archive_write_set_format_v7tar.c b/libarchive/archive_write_set_format_v7tar.c
index 1fdaafd2a939..599407144121 100644
--- a/libarchive/archive_write_set_format_v7tar.c
+++ b/libarchive/archive_write_set_format_v7tar.c
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
#include "archive_entry_locale.h"
#include "archive_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
struct v7tar {
uint64_t entry_bytes_remaining;
@@ -491,31 +492,11 @@ format_header_v7tar(struct archive_write *a, char h[512],
case AE_IFLNK:
h[V7TAR_typeflag_offset] = '2';
break;
- case AE_IFCHR:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive character device");
- return (ARCHIVE_FAILED);
- case AE_IFBLK:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive block device");
- return (ARCHIVE_FAILED);
- case AE_IFIFO:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive fifo");
- return (ARCHIVE_FAILED);
- case AE_IFSOCK:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive socket");
- return (ARCHIVE_FAILED);
default:
- archive_set_error(&a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "tar format cannot archive this (mode=0%lo)",
- (unsigned long)archive_entry_mode(entry));
+ /* AE_IFBLK, AE_IFCHR, AE_IFIFO, AE_IFSOCK
+ * and unknown */
+ __archive_write_entry_filetype_unsupported(
+ &a->archive, entry, "v7tar");
ret = ARCHIVE_FAILED;
}
}
diff --git a/libarchive/archive_write_set_format_warc.c b/libarchive/archive_write_set_format_warc.c
index edad072cf77d..46b05734121c 100644
--- a/libarchive/archive_write_set_format_warc.c
+++ b/libarchive/archive_write_set_format_warc.c
@@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$");
#include "archive_private.h"
#include "archive_random_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
struct warc_s {
unsigned int omit_warcinfo:1;
@@ -259,10 +260,8 @@ _warc_header(struct archive_write *a, struct archive_entry *entry)
return (ARCHIVE_OK);
}
/* just resort to erroring as per Tim's advice */
- archive_set_error(
- &a->archive,
- ARCHIVE_ERRNO_FILE_FORMAT,
- "WARC can only process regular files");
+ __archive_write_entry_filetype_unsupported(
+ &a->archive, entry, "WARC");
return (ARCHIVE_FAILED);
}
@@ -333,6 +332,10 @@ xstrftime(struct archive_string *as, const char *fmt, time_t t)
#if defined(HAVE_GMTIME_R) || defined(HAVE__GMTIME64_S)
struct tm timeHere;
#endif
+#if defined(HAVE__GMTIME64_S)
+ errno_t terr;
+ __time64_t tmptime;
+#endif
char strtime[100];
size_t len;
@@ -340,7 +343,12 @@ xstrftime(struct archive_string *as, const char *fmt, time_t t)
if ((rt = gmtime_r(&t, &timeHere)) == NULL)
return;
#elif defined(HAVE__GMTIME64_S)
- _gmtime64_s(&timeHere, &t);
+ tmptime = t;
+ terr = _gmtime64_s(&timeHere, &tmptime);
+ if (terr)
+ rt = NULL;
+ else
+ rt = &timeHere;
#else
if ((rt = gmtime(&t)) == NULL)
return;
diff --git a/libarchive/archive_write_set_format_xar.c b/libarchive/archive_write_set_format_xar.c
index 5e4b90e06b3f..d456cf8f8aa9 100644
--- a/libarchive/archive_write_set_format_xar.c
+++ b/libarchive/archive_write_set_format_xar.c
@@ -212,8 +212,8 @@ struct file {
struct heap_data data;
struct archive_string script;
- int virtual:1;
- int dir:1;
+ signed int virtual:1;
+ signed int dir:1;
};
struct hardlink {
@@ -411,6 +411,8 @@ xar_options(struct archive_write *a, const char *key, const char *value)
if (strcmp(key, "checksum") == 0) {
if (value == NULL)
xar->opt_sumalg = CKSUM_NONE;
+ else if (strcmp(value, "none") == 0)
+ xar->opt_sumalg = CKSUM_NONE;
else if (strcmp(value, "sha1") == 0)
xar->opt_sumalg = CKSUM_SHA1;
else if (strcmp(value, "md5") == 0)
@@ -429,6 +431,8 @@ xar_options(struct archive_write *a, const char *key, const char *value)
if (value == NULL)
xar->opt_compression = NONE;
+ else if (strcmp(value, "none") == 0)
+ xar->opt_compression = NONE;
else if (strcmp(value, "gzip") == 0)
xar->opt_compression = GZIP;
else if (strcmp(value, "bzip2") == 0)
@@ -482,6 +486,8 @@ xar_options(struct archive_write *a, const char *key, const char *value)
if (strcmp(key, "toc-checksum") == 0) {
if (value == NULL)
xar->opt_toc_sumalg = CKSUM_NONE;
+ else if (strcmp(value, "none") == 0)
+ xar->opt_toc_sumalg = CKSUM_NONE;
else if (strcmp(value, "sha1") == 0)
xar->opt_toc_sumalg = CKSUM_SHA1;
else if (strcmp(value, "md5") == 0)
@@ -696,13 +702,37 @@ xar_write_data(struct archive_write *a, const void *buff, size_t s)
else
run = ARCHIVE_Z_FINISH;
/* Compress file data. */
- r = compression_code(&(a->archive), &(xar->stream), run);
- if (r != ARCHIVE_OK && r != ARCHIVE_EOF)
- return (ARCHIVE_FATAL);
+ for (;;) {
+ r = compression_code(&(a->archive), &(xar->stream),
+ run);
+ if (r != ARCHIVE_OK && r != ARCHIVE_EOF)
+ return (ARCHIVE_FATAL);
+ if (xar->stream.avail_out == 0 ||
+ run == ARCHIVE_Z_FINISH) {
+ size = sizeof(xar->wbuff) -
+ xar->stream.avail_out;
+ checksum_update(&(xar->a_sumwrk), xar->wbuff,
+ size);
+ xar->cur_file->data.length += size;
+ if (write_to_temp(a, xar->wbuff,
+ size) != ARCHIVE_OK)
+ return (ARCHIVE_FATAL);
+ if (r == ARCHIVE_OK) {
+ /* Output buffer was full */
+ xar->stream.next_out = xar->wbuff;
+ xar->stream.avail_out =
+ sizeof(xar->wbuff);
+ } else {
+ /* ARCHIVE_EOF - We are done */
+ break;
+ }
+ } else {
+ /* Compressor wants more input */
+ break;
+ }
+ }
rsize = s - xar->stream.avail_in;
checksum_update(&(xar->e_sumwrk), buff, rsize);
- size = sizeof(xar->wbuff) - xar->stream.avail_out;
- checksum_update(&(xar->a_sumwrk), xar->wbuff, size);
}
#if !defined(_WIN32) || defined(__CYGWIN__)
if (xar->bytes_remaining ==
@@ -739,12 +769,9 @@ xar_write_data(struct archive_write *a, const void *buff, size_t s)
if (xar->cur_file->data.compression == NONE) {
if (write_to_temp(a, buff, size) != ARCHIVE_OK)
return (ARCHIVE_FATAL);
- } else {
- if (write_to_temp(a, xar->wbuff, size) != ARCHIVE_OK)
- return (ARCHIVE_FATAL);
+ xar->cur_file->data.length += size;
}
xar->bytes_remaining -= rsize;
- xar->cur_file->data.length += size;
return (rsize);
}
@@ -878,11 +905,15 @@ xmlwrite_time(struct archive_write *a, xmlTextWriterPtr writer,
{
char timestr[100];
struct tm tm;
+#if defined(HAVE__GMTIME64_S)
+ __time64_t tmptime;
+#endif
#if defined(HAVE_GMTIME_R)
gmtime_r(&t, &tm);
#elif defined(HAVE__GMTIME64_S)
- _gmtime64_s(&tm, &t);
+ tmptime = t;
+ _gmtime64_s(&tm, &tmptime);
#else
memcpy(&tm, gmtime(&t), sizeof(tm));
#endif
@@ -2103,7 +2134,7 @@ file_gen_utility_names(struct archive_write *a, struct file *file)
while (len > 0) {
size_t ll = len;
- if (len > 0 && p[len-1] == '/') {
+ if (p[len-1] == '/') {
p[len-1] = '\0';
len--;
}
@@ -2532,13 +2563,11 @@ file_init_hardlinks(struct xar *xar)
static void
file_free_hardlinks(struct xar *xar)
{
- struct archive_rb_node *n, *next;
+ struct archive_rb_node *n, *tmp;
- for (n = ARCHIVE_RB_TREE_MIN(&(xar->hardlink_rbtree)); n;) {
- next = __archive_rb_tree_iterate(&(xar->hardlink_rbtree),
- n, ARCHIVE_RB_DIR_RIGHT);
+ ARCHIVE_RB_TREE_FOREACH_SAFE(n, &(xar->hardlink_rbtree), tmp) {
+ __archive_rb_tree_remove_node(&(xar->hardlink_rbtree), n);
free(n);
- n = next;
}
}
diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c
index f28a8c3a341f..6d485295d50f 100644
--- a/libarchive/archive_write_set_format_zip.c
+++ b/libarchive/archive_write_set_format_zip.c
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_zip.c 201168 20
#include "archive_private.h"
#include "archive_random_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
#ifndef HAVE_ZLIB_H
#include "archive_crc32.h"
@@ -526,8 +527,8 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
/* Ignore types of entries that we don't support. */
type = archive_entry_filetype(entry);
if (type != AE_IFREG && type != AE_IFDIR && type != AE_IFLNK) {
- archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "Filetype not supported");
+ __archive_write_entry_filetype_unsupported(
+ &a->archive, entry, "zip");
return ARCHIVE_FAILED;
};
@@ -1372,10 +1373,28 @@ dos_time(const time_t unix_time)
{
struct tm *t;
unsigned int dt;
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+ struct tm tmbuf;
+#endif
+#if defined(HAVE__LOCALTIME64_S)
+ errno_t terr;
+ __time64_t tmptime;
+#endif
/* This will not preserve time when creating/extracting the archive
* on two systems with different time zones. */
+#if defined(HAVE_LOCALTIME_R)
+ t = localtime_r(&unix_time, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+ tmptime = unix_time;
+ terr = _localtime64_s(&tmbuf, &tmptime);
+ if (terr)
+ t = NULL;
+ else
+ t = &tmbuf;
+#else
t = localtime(&unix_time);
+#endif
/* MSDOS-style date/time is only between 1980-01-01 and 2107-12-31 */
if (t->tm_year < 1980 - 1900)
diff --git a/libarchive/archive_write_set_options.3 b/libarchive/archive_write_set_options.3
index 09eb95ea5aa9..cffe571e90a6 100644
--- a/libarchive/archive_write_set_options.3
+++ b/libarchive/archive_write_set_options.3
@@ -24,7 +24,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd December 3, 2019
+.Dd January 31, 2020
.Dt ARCHIVE_WRITE_OPTIONS 3
.Os
.Sh NAME
@@ -170,33 +170,125 @@ only to modules whose name matches
.\"
.Sh OPTIONS
.Bl -tag -compact -width indent
+.It Filter b64encode
+.Bl -tag -compact -width indent
+.It Cm mode
+The value is interpreted as octal digits specifying the file mode.
+.It Cm name
+The value specifies the file name.
+.El
+.It Filter bzip2
+.Bl -tag -compact -width indent
+.It Cm compression-level
+The value is interpreted as a decimal integer specifying the
+bzip2 compression level. Supported values are from 1 to 9.
+.El
.It Filter gzip
.Bl -tag -compact -width indent
.It Cm compression-level
The value is interpreted as a decimal integer specifying the
-gzip compression level.
+gzip compression level. Supported values are from 0 to 9.
+.It Cm timestamp
+Store timestamp. This is enabled by default.
+.El
+.It Filter lrzip
+.Bl -tag -compact -width indent
+.It Cm compression Ns = Ns Ar type
+Use
+.Ar type
+as compression method.
+Supported values are
+.Dq bzip2 ,
+.Dq gzipi ,
+.Dq lzo
+.Pq ultra fast ,
+and
+.Dq zpaq
+.Pq best, extremely slow .
+.It Cm compression-level
+The value is interpreted as a decimal integer specifying the
+lrzip compression level. Supported values are from 1 to 9.
+.El
+.It Filter lz4
+.Bl -tag -compact -width indent
+.It Cm compression-level
+The value is interpreted as a decimal integer specifying the
+lz4 compression level. Supported values are from 0 to 9.
+.It Cm stream-checksum
+Enable stream checksum. This is enabled by default.
+.It Cm block-checksum
+Enable block checksum. This is disabled by default.
+.It Cm block-size
+The value is interpreted as a decimal integer specifying the
+lz4 compression block size. Supported values are from 4 to 7
+.Pq default .
+.It Cm block-dependence
+Use the previous block of the block being compressed for
+a compression dictionary to improve compression ratio.
+This is disabled by default.
+.El
+.It Filter lzop
+.Bl -tag -compact -width indent
+.It Cm compression-level
+The value is interpreted as a decimal integer specifying the
+lzop compression level. Supported values are from 1 to 9.
+.El
+.It Filter uuencode
+.Bl -tag -compact -width indent
+.It Cm mode
+The value is interpreted as octal digits specifying the file mode.
+.It Cm name
+The value specifies the file name.
.El
.It Filter xz
.Bl -tag -compact -width indent
.It Cm compression-level
The value is interpreted as a decimal integer specifying the
+compression level. Supported values are from 0 to 9.
+.It Cm threads
+The value is interpreted as a decimal integer specifying the
+number of threads for multi-threaded lzma compression.
+If supported, the default value is read from
+.Fn lzma_cputhreads .
+.El
+.It Filter zstd
+.Bl -tag -compact -width indent
+.It Cm compression-level
+The value is interpreted as a decimal integer specifying the
+compression level. Supported values are from 1 to 22.
+.El
+.It Format 7zip
+.Bl -tag -compact -width indent
+.It Cm compression
+The value is one of
+.Dq store ,
+.Dq deflate ,
+.Dq bzip2 ,
+.Dq lzma1 ,
+.Dq lzma2
+or
+.Dq ppmd
+to indicate how the following entries should be compressed.
+Note that this setting is ignored for directories, symbolic links,
+and other special entries.
+.It Cm compression-level
+The value is interpreted as a decimal integer specifying the
compression level.
+Values between 0 and 9 are supported.
+The interpretation of the compression level depends on the chosen
+compression method.
.El
-.It Format mtree
+.It Format cpio
.Bl -tag -compact -width indent
-.It Cm cksum , Cm device , Cm flags , Cm gid , Cm gname , Cm indent , Cm link , Cm md5 , Cm mode , Cm nlink , Cm rmd160 , Cm sha1 , Cm sha256 , Cm sha384 , Cm sha512 , Cm size , Cm time , Cm uid , Cm uname
-Enable a particular keyword in the mtree output.
-Prefix with an exclamation mark to disable the corresponding keyword.
-The default is equivalent to
-.Dq device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname .
-.It Cm all
-Enables all of the above keywords.
-.It Cm use-set
-Enables generation of
-.Cm /set
-lines that specify default values for the following files and/or directories.
-.It Cm indent
-XXX needs explanation XXX
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file names.
+.El
+.It Format gnutar
+.Bl -tag -compact -width indent
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file, group and user names.
.El
.It Format iso9660 - volume metadata
These options are used to set standard ISO9660 metadata.
@@ -404,10 +496,33 @@ Specifies a filename that should not be compressed when using
This option can be provided multiple times to suppress compression
on many files.
.El
+.It Format mtree
+.Bl -tag -compact -width indent
+.It Cm cksum , Cm device , Cm flags , Cm gid , Cm gname , Cm indent , Cm link , Cm md5 , Cm mode , Cm nlink , Cm rmd160 , Cm sha1 , Cm sha256 , Cm sha384 , Cm sha512 , Cm size , Cm time , Cm uid , Cm uname
+Enable a particular keyword in the mtree output.
+Prefix with an exclamation mark to disable the corresponding keyword.
+The default is equivalent to
+.Dq device, flags, gid, gname, link, mode, nlink, size, time, type, uid, uname .
+.It Cm all
+Enables all of the above keywords.
+.It Cm use-set
+Enables generation of
+.Cm /set
+lines that specify default values for the following files and/or directories.
+.It Cm indent
+XXX needs explanation XXX
+.El
+.It Format newc
+.Bl -tag -compact -width indent
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file names.
+.El
.It Format pax
.Bl -tag -compact -width indent
.It Cm hdrcharset
-This sets the character set used for filenames, uname and gname.
+The value is used as a character set name that will be
+used when translating file, group and user names.
The value is one of
.Dq BINARY
or
@@ -430,26 +545,61 @@ and
.Dq SCHILY.xattr
headers are written.
.El
-.It Format 7zip
+.It Format ustar
.Bl -tag -compact -width indent
-.It Cm compression
-The value is one of
-.Dq store ,
-.Dq deflate ,
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file, group and user names.
+.El
+.It Format v7tar
+.Bl -tag -compact -width indent
+.It Cm hdrcharset
+The value is used as a character set name that will be
+used when translating file, group and user names.
+.El
+.It Format warc
+.Bl -tag -compact -width indent
+.It Cm omit-warcinfo
+Set to
+.Dq true
+to disable output of the warcinfo record.
+.El
+.It Format xar
+.Bl -tag -compact -width indent
+.It Cm checksum Ns = Ns Ar type
+Use
+.Ar type
+as file checksum method.
+Supported values are
+.Dq none ,
+.Dq md5 ,
+and
+.Dq sha1
+.Pq default .
+.It Cm compression Ns = Ns Ar type
+Use
+.Ar type
+as compression method.
+Supported values are
+.Dq none ,
.Dq bzip2 ,
-.Dq lzma1 ,
-.Dq lzma2
-or
-.Dq ppmd
-to indicate how the following entries should be compressed.
-Note that this setting is ignored for directories, symbolic links,
-and other special entries.
-.It Cm compression-level
-The value is interpreted as a decimal integer specifying the
-compression level.
-Values between 0 and 9 are supported.
-The interpretation of the compression level depends on the chosen
-compression method.
+.Dq gzip
+.Pq default ,
+.Dq lzma
+and
+.Dq xz .
+.It Cm compression_level
+The value is a decimal integer from 1 to 9 specifying the compression level.
+.It Cm toc-checksum Ns = Ns Ar type
+Use
+.Ar type
+as table of contents checksum method.
+Supported values are
+.Dq none ,
+.Dq md5
+and
+.Dq sha1
+.Pq default .
.El
.It Format zip
.Bl -tag -compact -width indent
@@ -470,6 +620,20 @@ A compression level of 0 switches the compression method to
other values will enable
.Dq deflate
compression with the given level.
+.It Cm encryption
+Enable encryption using traditional zip encryption.
+.It Cm encryption Ns = Ns Ar type
+Use
+.Ar type
+as encryption type.
+Supported values are
+.Dq zipcrypt
+.Pq traditional zip encryption ,
+.Dq aes128
+.Pq WinZip AES-128 encryption
+and
+.Dq aes256
+.Pq WinZip AES-256 encryption .
.It Cm experimental
This boolean option enables or disables experimental Zip features
that may not be compatible with other Zip implementations.
@@ -478,7 +642,8 @@ This boolean option disables CRC calculations.
All CRC fields are set to zero.
It should not be used except for testing purposes.
.It Cm hdrcharset
-This sets the character set used for filenames.
+The value is used as a character set name that will be
+used when translating file names.
.It Cm zip64
Zip64 extensions provide additional file size information
for entries larger than 4 GiB.
diff --git a/libarchive/archive_xxhash.h b/libarchive/archive_xxhash.h
index 427241641a02..1c7131ca1e7d 100644
--- a/libarchive/archive_xxhash.h
+++ b/libarchive/archive_xxhash.h
@@ -24,12 +24,13 @@
*
*/
+#ifndef ARCHIVE_XXHASH_H_INCLUDED
+#define ARCHIVE_XXHASH_H_INCLUDED
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef ARCHIVE_XXHASH_H
-#define ARCHIVE_XXHASH_H
typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode;
diff --git a/libarchive/filter_fork.h b/libarchive/filter_fork.h
index a28272bee33b..908e7cdd4ddd 100644
--- a/libarchive/filter_fork.h
+++ b/libarchive/filter_fork.h
@@ -25,13 +25,13 @@
* $FreeBSD: head/lib/libarchive/filter_fork.h 201087 2009-12-28 02:18:26Z kientzle $
*/
+#ifndef FILTER_FORK_H
+#define FILTER_FORK_H
+
#ifndef __LIBARCHIVE_BUILD
#error This header is only to be used internally to libarchive.
#endif
-#ifndef FILTER_FORK_H
-#define FILTER_FORK_H
-
pid_t
__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout);
diff --git a/libarchive/test/test_archive_write_set_format_filter_by_ext.c b/libarchive/test/test_archive_write_set_format_filter_by_ext.c
index 4fe18e18c2d1..22345038609a 100644
--- a/libarchive/test/test_archive_write_set_format_filter_by_ext.c
+++ b/libarchive/test/test_archive_write_set_format_filter_by_ext.c
@@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$");
static void
test_format_filter_by_ext(const char *output_file,
- int format_id, int filter_id, int dot_stored, char * def_ext)
+ int format_id, int filter_id, int dot_stored, const char * def_ext)
{
struct archive_entry *ae;
struct archive *a;
diff --git a/libarchive/test/test_compat_zip.c b/libarchive/test/test_compat_zip.c
index 39152206c1bc..813ea5dc6701 100644
--- a/libarchive/test/test_compat_zip.c
+++ b/libarchive/test/test_compat_zip.c
@@ -156,7 +156,7 @@ DEFINE_TEST(test_compat_zip_4)
size_t s;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
/* SFX files require seek support. */
assert((a = archive_read_new()) != NULL);
@@ -214,7 +214,7 @@ DEFINE_TEST(test_compat_zip_5)
size_t s;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
/* Verify with seek support.
* Everything works correctly here. */
@@ -370,7 +370,7 @@ DEFINE_TEST(test_compat_zip_6)
size_t s;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
@@ -402,7 +402,7 @@ DEFINE_TEST(test_compat_zip_7)
int i;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
for (i = 1; i < 1000; ++i) {
assert((a = archive_read_new()) != NULL);
@@ -436,7 +436,7 @@ DEFINE_TEST(test_compat_zip_8)
size_t s;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a));
diff --git a/libarchive/test/test_fuzz.c b/libarchive/test/test_fuzz.c
index d02fd993f972..b2654c4a3396 100644
--- a/libarchive/test/test_fuzz.c
+++ b/libarchive/test/test_fuzz.c
@@ -119,7 +119,8 @@ test_fuzz(const struct files *filesets)
for (i = 0; filesets[n].names[i] != NULL; ++i)
{
char *newraw;
- tmp = slurpfile(&size, filesets[n].names[i]);
+ tmp = slurpfile(&size, "%s",
+ filesets[n].names[i]);
newraw = realloc(rawimage, oldsize + size);
if (!assert(newraw != NULL))
{
diff --git a/libarchive/test/test_read_extract.c b/libarchive/test/test_read_extract.c
index cd06096eff69..2b1a21e4715b 100644
--- a/libarchive/test/test_read_extract.c
+++ b/libarchive/test/test_read_extract.c
@@ -120,7 +120,7 @@ DEFINE_TEST(test_read_extract)
assertA(0 == archive_read_support_filter_all(a));
assertA(0 == archive_read_open_memory(a, buff, BUFF_SIZE));
/* Restore first entry with _EXTRACT_PERM. */
- failure("Error reading first entry", i);
+ failure("Error reading first entry");
assertA(0 == archive_read_next_header(a, &ae));
assertA(0 == archive_read_extract(a, ae, ARCHIVE_EXTRACT_PERM));
/* Rest of entries get restored with no flags. */
diff --git a/libarchive/test/test_read_format_7zip.c b/libarchive/test/test_read_format_7zip.c
index 1d1e4c75d2d6..3c72595aeef7 100644
--- a/libarchive/test/test_read_format_7zip.c
+++ b/libarchive/test/test_read_format_7zip.c
@@ -87,7 +87,7 @@ test_copy(int use_open_fd)
* An archive file has no entry.
*/
static void
-test_empty_archive()
+test_empty_archive(void)
{
const char *refname = "test_read_format_7zip_empty_archive.7z";
struct archive_entry *ae;
@@ -119,7 +119,7 @@ test_empty_archive()
* in the archive file except for a header.
*/
static void
-test_empty_file()
+test_empty_file(void)
{
const char *refname = "test_read_format_7zip_empty_file.7z";
struct archive_entry *ae;
@@ -609,7 +609,7 @@ test_bcj(const char *refname)
* Extract a file compressed with PPMd.
*/
static void
-test_ppmd()
+test_ppmd(void)
{
const char *refname = "test_read_format_7zip_ppmd.7z";
struct archive_entry *ae;
@@ -663,7 +663,7 @@ test_ppmd()
}
static void
-test_symname()
+test_symname(void)
{
const char *refname = "test_read_format_7zip_symbolic_name.7z";
struct archive_entry *ae;
@@ -720,7 +720,8 @@ DEFINE_TEST(test_read_format_7zip)
/* Extracting with liblzma */
if (ARCHIVE_OK != archive_read_support_filter_xz(a)) {
- skipping("7zip:lzma decoding is not supported on this platform");
+ skipping("7zip:lzma decoding is not supported on this "
+ "platform");
} else {
test_symname();
test_extract_all_files("test_read_format_7zip_copy_2.7z");
@@ -795,7 +796,8 @@ DEFINE_TEST(test_read_format_7zip_lzma1)
/* Extracting with liblzma */
if (ARCHIVE_OK != archive_read_support_filter_xz(a)) {
- skipping("7zip:lzma decoding is not supported on this platform");
+ skipping("7zip:lzma decoding is not supported on this "
+ "platform");
} else {
test_plain_header("test_read_format_7zip_lzma1.7z");
test_extract_all_files("test_read_format_7zip_lzma1_2.7z");
@@ -804,6 +806,7 @@ DEFINE_TEST(test_read_format_7zip_lzma1)
test_bcj("test_read_format_7zip_bcj2_lzma1_1.7z");
test_bcj("test_read_format_7zip_bcj2_lzma1_2.7z");
test_delta_lzma("test_read_format_7zip_delta_lzma1.7z");
+ test_delta_lzma("test_read_format_7zip_delta4_lzma1.7z");
}
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
}
@@ -816,13 +819,15 @@ DEFINE_TEST(test_read_format_7zip_lzma2)
/* Extracting with liblzma */
if (ARCHIVE_OK != archive_read_support_filter_xz(a)) {
- skipping("7zip:lzma decoding is not supported on this platform");
+ skipping("7zip:lzma decoding is not supported on this "
+ "platform");
} else {
test_plain_header("test_read_format_7zip_lzma2.7z");
test_bcj("test_read_format_7zip_bcj_lzma2.7z");
test_bcj("test_read_format_7zip_bcj2_lzma2_1.7z");
test_bcj("test_read_format_7zip_bcj2_lzma2_2.7z");
test_delta_lzma("test_read_format_7zip_delta_lzma2.7z");
+ test_delta_lzma("test_read_format_7zip_delta4_lzma2.7z");
}
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
}
diff --git a/libarchive/test/test_read_format_7zip_delta4_lzma1.7z.uu b/libarchive/test/test_read_format_7zip_delta4_lzma1.7z.uu
new file mode 100644
index 000000000000..750769c3e4f4
--- /dev/null
+++ b/libarchive/test/test_read_format_7zip_delta4_lzma1.7z.uu
@@ -0,0 +1,407 @@
+begin 664 test_read_format_7zip_delta4_lzma1.7z
+M-WJ\KR<<``2BP`@-648```````!B`````````'T^3LD`)QO*P@;2+(;6`.G?
+M97%G65J_4ERCV:^K1%6D4`M822)8PY<D^7G/"B('W#;A;/.<=2:F/\-O87SZ
+MD&`;L&),.K'5%'\0+@/P0N8HLMJO&R0YO^&>*%1<PY8IPQ5"L/NPIF49[<&@
+M"%+UW+)Y@7Q(U>4J=_<,7#6T/3RFH$9!9G6HOBE'<!.D2&1'&GJT+"P_(<MZ
+M`E8JLGT2IS"#`;@H/"BUVB1G3$?]A%,'`E0\0[C^JNSB$5;G;,N*`A>E<0M'
+M0-5!6&]I9Q(LNP>FO1,4C"0-HJF]E+UO?$`OP,0L]9]-?IRQ"#_84'^\-:$G
+MT3JIHJE5;*\M)]-TIEK1=3?[2#(5!+N!_HL=H!H_R)BU+F9HX\D5.\?T=(M`
+M=9=W4SJW579?/KS>1Y+'M^%0#4C+X<'3U$3C&%='!5[\EF[@4#2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Q[_8+2A9^V[>0T4
+MZNHACJ&`])R!9R7BFS=:[OL:HPQ@V'KC?/.[0-)\/2GV<5=TTD@X$``!!`8`
+M`0G`648`!PL!``(C`P$!!5T`@```(0,!`P$`#,#K:\#K:P`("@$6V^8W```%
+M`1D)````````````$0T`9@!I`&P`90`Q````%`H!```M0RMQLYT!%08!`""`
+$I($`````
+`
+end
diff --git a/libarchive/test/test_read_format_7zip_delta4_lzma2.7z.uu b/libarchive/test/test_read_format_7zip_delta4_lzma2.7z.uu
new file mode 100644
index 000000000000..951da15ec6f8
--- /dev/null
+++ b/libarchive/test/test_read_format_7zip_delta4_lzma2.7z.uu
@@ -0,0 +1,407 @@
+begin 664 test_read_format_7zip_delta4_lzma2.7z
+M-WJ\KR<<``1,P\W78$8```````!B`````````-6%26G@:^I&6%T`)QO*P@;2
+M+(;6`.G?97%G65J_4ERCV:^K1%6D4`M822)8PY<D^7G/"B('W#;A;/.<=2:F
+M/\-O87SZD&`;L&),.K'5%'\0+@/P0N8HLMJO&R0YO^&>*%1<PY8IPQ5"L/NP
+MIF49[<&@"%+UW+)Y@7Q(U>4J=_<,7#6T/3RFH$9!9G6HOBE'<!.D2&1'&GJT
+M+"P_(<MZ`E8JLGT2IS"#`;@H/"BUVB1G3$?]A%,'`E0\0[C^JNSB$5;G;,N*
+M`A>E<0M'0-5!6&]I9Q(LNP>FO1,4C"0-HJF]E+UO?$`OP,0L]9]-?IRQ"#_8
+M4'^\-:$GT3JIHJE5;*\M)]-TIEK1=3?[2#(5!+N!_HL=H!H_R)BU+F9HX\D5
+M.\?T=(M`=9=W4SJW579?/KS>1Y+'M^%0#4C+X<'3U$3C&%='!5[\EF[@4#2B
+M9^U]FY)?`J8B_0+7B.I$N.X)PP3;'V&J*6VY.!&;Q7R,;M8N$$GCE7A'DD("
+M6>XDN+^7'[7.>5XJAT[)1$"IP%"H\ENNG?(IVD$"4B#R#;E,KWX0"(+I)G\I
+M;FDXUW0:G\77W)*"$2C1DY7G2A@X<7?H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*`0``+4,K<;.=
++`14&`0`@@*2!````
+`
+end
diff --git a/libarchive/test/test_read_format_7zip_packinfo_digests.c b/libarchive/test/test_read_format_7zip_packinfo_digests.c
index 94cd1ad32e42..7f105d1f2806 100644
--- a/libarchive/test/test_read_format_7zip_packinfo_digests.c
+++ b/libarchive/test/test_read_format_7zip_packinfo_digests.c
@@ -35,43 +35,55 @@ DEFINE_TEST(test_read_format_7zip_packinfo_digests)
extract_reference_file(refname);
assert((a = archive_read_new()) != NULL);
- assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
- assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
- assertEqualIntA(a, ARCHIVE_OK,
- archive_read_open_filename(a, refname, 10240));
+ if (ARCHIVE_OK != archive_read_support_filter_xz(a)) {
+ skipping("7zip:lzma decoding is not supported on this "
+ "platform");
+ } else {
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_filter_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_support_format_all(a));
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_open_filename(a, refname, 10240));
- /* Verify regular file1. */
- assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
- assertEqualInt((AE_IFREG | 0666), archive_entry_mode(ae));
- assertEqualString("a.txt", archive_entry_pathname(ae));
- assertEqualInt(1576808819, archive_entry_mtime(ae));
- assertEqualInt(4, archive_entry_size(ae));
- assertEqualInt(archive_entry_is_encrypted(ae), 0);
- assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
- assertEqualInt(4, archive_read_data(a, buff, sizeof(buff)));
- assertEqualMem(buff, "aaa\n", 4);
+ /* Verify regular file1. */
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_next_header(a, &ae));
+ assertEqualInt((AE_IFREG | 0666), archive_entry_mode(ae));
+ assertEqualString("a.txt", archive_entry_pathname(ae));
+ assertEqualInt(1576808819, archive_entry_mtime(ae));
+ assertEqualInt(4, archive_entry_size(ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+ assertEqualInt(4, archive_read_data(a, buff, sizeof(buff)));
+ assertEqualMem(buff, "aaa\n", 4);
- /* Verify regular file2. */
- assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
- assertEqualInt((AE_IFREG | 0666), archive_entry_mode(ae));
- assertEqualString("b.txt", archive_entry_pathname(ae));
- assertEqualInt(1576808819, archive_entry_mtime(ae));
- assertEqualInt(4, archive_entry_size(ae));
- assertEqualInt(archive_entry_is_encrypted(ae), 0);
- assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
- assertEqualInt(4, archive_read_data(a, buff, sizeof(buff)));
- assertEqualMem(buff, "bbb\n", 4);
+ /* Verify regular file2. */
+ assertEqualIntA(a, ARCHIVE_OK,
+ archive_read_next_header(a, &ae));
+ assertEqualInt((AE_IFREG | 0666), archive_entry_mode(ae));
+ assertEqualString("b.txt", archive_entry_pathname(ae));
+ assertEqualInt(1576808819, archive_entry_mtime(ae));
+ assertEqualInt(4, archive_entry_size(ae));
+ assertEqualInt(archive_entry_is_encrypted(ae), 0);
+ assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
+ assertEqualInt(4, archive_read_data(a, buff, sizeof(buff)));
+ assertEqualMem(buff, "bbb\n", 4);
- assertEqualInt(2, archive_file_count(a));
+ assertEqualInt(2, archive_file_count(a));
- /* End of archive. */
- assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
+ /* End of archive. */
+ assertEqualIntA(a, ARCHIVE_EOF,
+ archive_read_next_header(a, &ae));
- /* Verify archive format. */
- assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0));
- assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP, archive_format(a));
+ /* Verify archive format. */
+ assertEqualIntA(a, ARCHIVE_FILTER_NONE,
+ archive_filter_code(a, 0));
+ assertEqualIntA(a, ARCHIVE_FORMAT_7ZIP,
+ archive_format(a));
- /* Close the archive. */
- assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+ /* Close the archive. */
+ assertEqualInt(ARCHIVE_OK, archive_read_close(a));
+ }
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
}
diff --git a/libarchive/test/test_read_format_gtar_sparse.c b/libarchive/test/test_read_format_gtar_sparse.c
index 7ab13c1109a0..6d15a4745f9c 100644
--- a/libarchive/test/test_read_format_gtar_sparse.c
+++ b/libarchive/test/test_read_format_gtar_sparse.c
@@ -214,8 +214,9 @@ verify_archive_file(const char *name, struct archive_contents *ac)
* Any byte before the expected
* data must be NULL.
*/
- failure("%s: pad at offset %d "
- "should be zero", name, actual.o);
+ failure("%s: pad at offset %jd "
+ "should be zero", name,
+ (intmax_t)actual.o);
assertEqualInt(c, 0);
} else if (actual.o == expect.o) {
/*
diff --git a/libarchive/test/test_read_format_rar5.c b/libarchive/test/test_read_format_rar5.c
index bb94d4e34e25..f91521e72f82 100644
--- a/libarchive/test/test_read_format_rar5.c
+++ b/libarchive/test/test_read_format_rar5.c
@@ -1256,3 +1256,18 @@ DEFINE_TEST(test_read_format_rar5_different_winsize_on_merge)
EPILOGUE();
}
+
+DEFINE_TEST(test_read_format_rar5_block_size_is_too_small)
+{
+ char buf[4096];
+ PROLOGUE("test_read_format_rar5_block_size_is_too_small.rar");
+
+ /* This file is damaged, so those functions should return failure.
+ * Additionally, SIGSEGV shouldn't be raised during execution
+ * of those functions. */
+
+ assertA(archive_read_next_header(a, &ae) != ARCHIVE_OK);
+ assertA(archive_read_data(a, buf, sizeof(buf)) <= 0);
+
+ EPILOGUE();
+}
diff --git a/libarchive/test/test_read_format_rar5_block_size_is_too_small.rar.uu b/libarchive/test/test_read_format_rar5_block_size_is_too_small.rar.uu
new file mode 100644
index 000000000000..5cad2194ee1e
--- /dev/null
+++ b/libarchive/test/test_read_format_rar5_block_size_is_too_small.rar.uu
@@ -0,0 +1,8 @@
+begin 644 test_read_format_rar5_block_size_is_too_small.rar
+M4F%R(1H'`0"-[P+2``+'(!P,("`@N`,!`B`@("`@("`@("`@("`@("#_("`@
+M("`@("`@("`@((:Q;2!4-'-^4B`!((WO`M(``O\@$/\@-R`@("`@("`@("`@
+M``X@("`@("`@____("`@("`@(/\@("`@("`@("`@("#_(+6U,2"UM;6UM[CU
+M)B`@*(0G(`!.`#D\3R``(/__(,+_````-0#_($&%*/HE=C+N`"```"```"`D
+J`)$#("#_("#__P`@__\@_R#_("`@("`@("#_("#__R`@(/__("#__R`"
+`
+end
diff --git a/libarchive/test/test_read_format_zip.c b/libarchive/test/test_read_format_zip.c
index 9afbfb6c5866..04f7e98ccfcd 100644
--- a/libarchive/test/test_read_format_zip.c
+++ b/libarchive/test/test_read_format_zip.c
@@ -194,7 +194,7 @@ test_basic(void)
verify_basic(a, 1);
/* Verify with streaming reader. */
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
@@ -264,7 +264,7 @@ test_info_zip_ux(void)
verify_info_zip_ux(a, 1);
/* Verify with streaming reader. */
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
@@ -328,7 +328,7 @@ test_extract_length_at_end(void)
verify_extract_length_at_end(a, 1);
/* Verify extraction with streaming reader. */
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
@@ -347,7 +347,7 @@ test_symlink(void)
struct archive_entry *ae;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
/* Symlinks can only be extracted with the seeking reader. */
assert((a = archive_read_new()) != NULL);
diff --git a/libarchive/test/test_read_format_zip_7075_utf8_paths.c b/libarchive/test/test_read_format_zip_7075_utf8_paths.c
index 7b78770aae43..a0a510c8f29b 100644
--- a/libarchive/test/test_read_format_zip_7075_utf8_paths.c
+++ b/libarchive/test/test_read_format_zip_7075_utf8_paths.c
@@ -90,7 +90,7 @@ DEFINE_TEST(test_read_format_zip_utf8_paths)
assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a));
/* Verify with streaming reader. */
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
diff --git a/libarchive/test/test_read_format_zip_comment_stored.c b/libarchive/test/test_read_format_zip_comment_stored.c
index b92b2886cdda..95df0107fecb 100644
--- a/libarchive/test/test_read_format_zip_comment_stored.c
+++ b/libarchive/test/test_read_format_zip_comment_stored.c
@@ -38,7 +38,7 @@ verify(const char *refname)
struct archive_entry *ae;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
/* Symlinks can only be extracted with the seeking reader. */
assert((a = archive_read_new()) != NULL);
diff --git a/libarchive/test/test_read_format_zip_extra_padding.c b/libarchive/test/test_read_format_zip_extra_padding.c
index 54f7fa04ee89..6e2f836f16e4 100644
--- a/libarchive/test/test_read_format_zip_extra_padding.c
+++ b/libarchive/test/test_read_format_zip_extra_padding.c
@@ -80,7 +80,7 @@ DEFINE_TEST(test_read_format_zip_extra_padding)
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
/* Verify with streaming reader. */
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
diff --git a/libarchive/test/test_read_format_zip_high_compression.c b/libarchive/test/test_read_format_zip_high_compression.c
index 42faed378f6d..16cfbb182893 100644
--- a/libarchive/test/test_read_format_zip_high_compression.c
+++ b/libarchive/test/test_read_format_zip_high_compression.c
@@ -56,7 +56,7 @@ DEFINE_TEST(test_read_format_zip_high_compression)
}
extract_reference_file(refname);
- p = slurpfile(&archive_size, refname);
+ p = slurpfile(&archive_size, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a));
diff --git a/libarchive/test/test_read_format_zip_jar.c b/libarchive/test/test_read_format_zip_jar.c
index ffb520eb83c1..912e67137704 100644
--- a/libarchive/test/test_read_format_zip_jar.c
+++ b/libarchive/test/test_read_format_zip_jar.c
@@ -40,7 +40,7 @@ DEFINE_TEST(test_read_format_zip_jar)
char data[16];
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip_seekable(a));
diff --git a/libarchive/test/test_read_format_zip_mac_metadata.c b/libarchive/test/test_read_format_zip_mac_metadata.c
index 99b7012328cb..3f2813cc9894 100644
--- a/libarchive/test/test_read_format_zip_mac_metadata.c
+++ b/libarchive/test/test_read_format_zip_mac_metadata.c
@@ -76,7 +76,7 @@ DEFINE_TEST(test_read_format_zip_mac_metadata)
};
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
/* Mac metadata can only be extracted with the seeking reader. */
assert((a = archive_read_new()) != NULL);
diff --git a/libarchive/test/test_read_format_zip_malformed.c b/libarchive/test/test_read_format_zip_malformed.c
index e14a3f5660da..f1160648e759 100644
--- a/libarchive/test/test_read_format_zip_malformed.c
+++ b/libarchive/test/test_read_format_zip_malformed.c
@@ -46,7 +46,7 @@ test_malformed1(void)
assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a));
/* Verify with streaming reader. */
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
diff --git a/libarchive/test/test_read_format_zip_msdos.c b/libarchive/test/test_read_format_zip_msdos.c
index 5f147d557784..1867204bb6ec 100644
--- a/libarchive/test/test_read_format_zip_msdos.c
+++ b/libarchive/test/test_read_format_zip_msdos.c
@@ -103,7 +103,7 @@ DEFINE_TEST(test_read_format_zip_msdos)
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
/* Verify with streaming reader. */
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a));
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a));
diff --git a/libarchive/test/test_read_format_zip_nested.c b/libarchive/test/test_read_format_zip_nested.c
index 5f6edf267443..4418fc4f2502 100644
--- a/libarchive/test/test_read_format_zip_nested.c
+++ b/libarchive/test/test_read_format_zip_nested.c
@@ -34,7 +34,7 @@ DEFINE_TEST(test_read_format_zip_nested)
struct archive_entry *ae;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
/* Inspect outer Zip */
assert((a = archive_read_new()) != NULL);
diff --git a/libarchive/test/test_read_format_zip_nofiletype.c b/libarchive/test/test_read_format_zip_nofiletype.c
index b01afabe953b..b3260fa7563b 100644
--- a/libarchive/test/test_read_format_zip_nofiletype.c
+++ b/libarchive/test/test_read_format_zip_nofiletype.c
@@ -40,7 +40,7 @@ DEFINE_TEST(test_read_format_zip_nofiletype)
char data[16];
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip_seekable(a));
diff --git a/libarchive/test/test_read_format_zip_padded.c b/libarchive/test/test_read_format_zip_padded.c
index 2094eca3557a..d8c694bae5e2 100644
--- a/libarchive/test/test_read_format_zip_padded.c
+++ b/libarchive/test/test_read_format_zip_padded.c
@@ -34,7 +34,7 @@ verify_padded_archive(const char *refname)
struct archive_entry *ae;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip_seekable(a));
diff --git a/libarchive/test/test_read_format_zip_sfx.c b/libarchive/test/test_read_format_zip_sfx.c
index dc76ef9b3826..a33c1b808c56 100644
--- a/libarchive/test/test_read_format_zip_sfx.c
+++ b/libarchive/test/test_read_format_zip_sfx.c
@@ -37,7 +37,7 @@ DEFINE_TEST(test_read_format_zip_sfx)
struct archive_entry *ae;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
/* Symlinks can only be extracted with the seeking reader. */
assert((a = archive_read_new()) != NULL);
diff --git a/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c b/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c
index dc94f94f1571..aca8bed60948 100644
--- a/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c
+++ b/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c
@@ -39,7 +39,7 @@ DEFINE_TEST(test_read_format_zip_with_invalid_traditional_eocd)
struct archive_entry *ae;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
assert((a = archive_read_new()) != NULL);
assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip_seekable(a));
diff --git a/libarchive/test/test_read_format_zip_zip64.c b/libarchive/test/test_read_format_zip_zip64.c
index ac3789f46b83..bd2324e549b3 100644
--- a/libarchive/test/test_read_format_zip_zip64.c
+++ b/libarchive/test/test_read_format_zip_zip64.c
@@ -88,7 +88,7 @@ DEFINE_TEST(test_read_format_zip_zip64a)
size_t s;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
/* First read with seeking. */
assert((a = archive_read_new()) != NULL);
@@ -112,7 +112,7 @@ DEFINE_TEST(test_read_format_zip_zip64b)
size_t s;
extract_reference_file(refname);
- p = slurpfile(&s, refname);
+ p = slurpfile(&s, "%s", refname);
/* First read with seeking. */
assert((a = archive_read_new()) != NULL);
diff --git a/libarchive/test/test_read_pax_truncated.c b/libarchive/test/test_read_pax_truncated.c
index bc5d74d5bdb8..1f6e78ace202 100644
--- a/libarchive/test/test_read_pax_truncated.c
+++ b/libarchive/test/test_read_pax_truncated.c
@@ -82,7 +82,7 @@ DEFINE_TEST(test_read_pax_truncated)
assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae));
goto wrap_up;
} else {
- failure("Archive truncated to %d bytes", i);
+ failure("Archive truncated to %zu bytes", i);
assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
}
@@ -91,7 +91,7 @@ DEFINE_TEST(test_read_pax_truncated)
assertEqualIntA(a, ARCHIVE_FATAL, archive_read_data(a, filedata, filedata_size));
goto wrap_up;
} else {
- failure("Archive truncated to %d bytes", i);
+ failure("Archive truncated to %zu bytes", i);
assertEqualIntA(a, filedata_size,
archive_read_data(a, filedata, filedata_size));
}
@@ -103,7 +103,7 @@ DEFINE_TEST(test_read_pax_truncated)
* does not return an error if it can't consume
* it.) */
if (i < 1536 + 512*((filedata_size + 511)/512) + 512) {
- failure("i=%d minsize=%d", i,
+ failure("i=%zu minsize=%zu", i,
1536 + 512*((filedata_size + 511)/512) + 512);
assertEqualIntA(a, ARCHIVE_FATAL,
archive_read_next_header(a, &ae));
diff --git a/libarchive/test/test_read_truncated_filter.c b/libarchive/test/test_read_truncated_filter.c
index 6cc91e347a23..632638d6fe92 100644
--- a/libarchive/test/test_read_truncated_filter.c
+++ b/libarchive/test/test_read_truncated_filter.c
@@ -83,7 +83,7 @@ test_truncation(const char *compression,
for (i = 0; i < 100; i++) {
sprintf(path, "%s%d", compression, i);
archive_entry_copy_pathname(ae, path);
- failure(path);
+ failure("%s", path);
if (!assertEqualIntA(a, ARCHIVE_OK,
archive_write_header(a, ae))) {
archive_write_free(a);
@@ -94,7 +94,7 @@ test_truncation(const char *compression,
for (j = 0; j < (int)datasize; ++j) {
data[j] = (char)(rand() % 256);
}
- failure(path);
+ failure("%s", path);
if (!assertEqualIntA(a, datasize,
archive_write_data(a, data, datasize))) {
archive_write_free(a);
diff --git a/libarchive/test/test_sparse_basic.c b/libarchive/test/test_sparse_basic.c
index 5ad591be830d..0fbb7f7bf467 100644
--- a/libarchive/test/test_sparse_basic.c
+++ b/libarchive/test/test_sparse_basic.c
@@ -430,7 +430,7 @@ verify_sparse_file(struct archive *a, const char *path,
assert(sparse->type == END);
assertEqualInt(expected_offset, archive_entry_size(ae));
- failure(path);
+ failure("%s", path);
assertEqualInt(holes_seen, expected_holes);
assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a));
@@ -466,13 +466,13 @@ verify_sparse_file2(struct archive *a, const char *path,
/* Verify the number of holes only, not its offset nor its
* length because those alignments are deeply dependence on
* its filesystem. */
- failure(path);
+ failure("%s", path);
assertEqualInt(blocks, archive_entry_sparse_count(ae));
archive_entry_free(ae);
}
static void
-test_sparse_whole_file_data()
+test_sparse_whole_file_data(void)
{
struct archive_entry *ae;
int64_t offset;
diff --git a/libarchive/test/test_write_disk.c b/libarchive/test/test_write_disk.c
index 60bcdc24edf5..e38dbc78ff4e 100644
--- a/libarchive/test/test_write_disk.c
+++ b/libarchive/test/test_write_disk.c
@@ -186,7 +186,7 @@ static void create_reg_file4(struct archive_entry *ae, const char *msg)
#if !defined(_WIN32) || defined(__CYGWIN__)
assertEqualInt(st.st_mode, (archive_entry_mode(ae) & ~UMASK));
#endif
- failure(msg);
+ failure("%s", msg);
assertEqualInt(st.st_size, sizeof(data));
}
diff --git a/libarchive/test/test_write_format_cpio_empty.c b/libarchive/test/test_write_format_cpio_empty.c
index 60fb28340133..2ba415c7b987 100644
--- a/libarchive/test/test_write_format_cpio_empty.c
+++ b/libarchive/test/test_write_format_cpio_empty.c
@@ -64,7 +64,7 @@ DEFINE_TEST(test_write_format_cpio_empty)
assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
assertEqualInt(ARCHIVE_OK, archive_write_free(a));
- failure("Empty cpio archive should be exactly 87 bytes, was %d.", used);
+ failure("Empty cpio archive should be exactly 87 bytes, was %zu.", used);
assert(used == 87);
failure("Empty cpio archive is incorrectly formatted.");
assertEqualMem(buff, ref, 87);
diff --git a/libarchive/test/test_write_format_pax.c b/libarchive/test/test_write_format_pax.c
index 41a423a96a0e..4538aac8241d 100644
--- a/libarchive/test/test_write_format_pax.c
+++ b/libarchive/test/test_write_format_pax.c
@@ -105,6 +105,28 @@ DEFINE_TEST(test_write_format_pax)
assertEqualIntA(a, 8, archive_write_data(a, "12345678", 9));
/*
+ * "file4" is similar to "file1" but has a large uid, large gid,
+ * uname and gname are longer than 32 characters
+ */
+ assert((ae = archive_entry_new()) != NULL);
+ archive_entry_set_atime(ae, 2, 20);
+ archive_entry_set_birthtime(ae, 3, 30);
+ archive_entry_set_ctime(ae, 4, 40);
+ archive_entry_set_mtime(ae, 5, 50);
+ archive_entry_copy_pathname(ae, "file4");
+ archive_entry_set_mode(ae, S_IFREG | 0755);
+ archive_entry_set_size(ae, 8);
+ archive_entry_copy_uname(ae,
+ "long-uname123456789012345678901234567890");
+ archive_entry_copy_gname(ae,
+ "long-gname123456789012345678901234567890");
+ archive_entry_set_uid(ae, 536870912);
+ archive_entry_set_gid(ae, 536870913);
+ assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
+ archive_entry_free(ae);
+ assertEqualIntA(a, 8, archive_write_data(a, "12345678", 9));
+
+ /*
* XXX TODO XXX Archive directory, other file types.
* Archive extended attributes, ACLs, other metadata.
* Verify they get read back correctly.
@@ -199,6 +221,30 @@ DEFINE_TEST(test_write_format_pax)
assertEqualMem(buff2, "12345678", 8);
/*
+ * Read "file4
+ */
+ assertEqualIntA(a, 0, archive_read_next_header(a, &ae));
+ assertEqualInt(2, archive_entry_atime(ae));
+ assertEqualInt(20, archive_entry_atime_nsec(ae));
+ assertEqualInt(3, archive_entry_birthtime(ae));
+ assertEqualInt(30, archive_entry_birthtime_nsec(ae));
+ assertEqualInt(4, archive_entry_ctime(ae));
+ assertEqualInt(40, archive_entry_ctime_nsec(ae));
+ assertEqualInt(5, archive_entry_mtime(ae));
+ assertEqualInt(50, archive_entry_mtime_nsec(ae));
+ assertEqualString("file4", archive_entry_pathname(ae));
+ assertEqualString("long-uname123456789012345678901234567890",
+ archive_entry_uname(ae));
+ assertEqualString("long-gname123456789012345678901234567890",
+ archive_entry_gname(ae));
+ assertEqualInt(536870912, archive_entry_uid(ae));
+ assertEqualInt(536870913, archive_entry_gid(ae));
+ assert((S_IFREG | 0755) == archive_entry_mode(ae));
+ assertEqualInt(8, archive_entry_size(ae));
+ assertEqualIntA(a, 8, archive_read_data(a, buff2, 10));
+ assertEqualMem(buff2, "12345678", 8);
+
+ /*
* Verify the end of the archive.
*/
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
diff --git a/libarchive/test/test_write_format_shar_empty.c b/libarchive/test/test_write_format_shar_empty.c
index 03d70a3b5fa6..13794b02bb06 100644
--- a/libarchive/test/test_write_format_shar_empty.c
+++ b/libarchive/test/test_write_format_shar_empty.c
@@ -49,6 +49,6 @@ DEFINE_TEST(test_write_format_shar_empty)
assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
assertEqualInt(ARCHIVE_OK, archive_write_free(a));
- failure("Empty shar archive should be exactly 0 bytes, was %d.", used);
+ failure("Empty shar archive should be exactly 0 bytes, was %zu.", used);
assert(used == 0);
}
diff --git a/libarchive/test/test_write_format_tar.c b/libarchive/test/test_write_format_tar.c
index 3588e8fe2d94..a5ccdc0115bf 100644
--- a/libarchive/test/test_write_format_tar.c
+++ b/libarchive/test/test_write_format_tar.c
@@ -81,7 +81,7 @@ DEFINE_TEST(test_write_format_tar)
/* This calculation gives "the smallest multiple of
* the block size that is at least 2048 bytes". */
- failure("blocksize=%d", blocksize);
+ failure("blocksize=%zu", blocksize);
assertEqualInt(((2048 - 1)/blocksize+1)*blocksize, used);
/*
diff --git a/libarchive/test/test_write_format_tar_sparse.c b/libarchive/test/test_write_format_tar_sparse.c
index cc725a9a72ea..54ac00988e3d 100644
--- a/libarchive/test/test_write_format_tar_sparse.c
+++ b/libarchive/test/test_write_format_tar_sparse.c
@@ -94,7 +94,7 @@ test_1(void)
/* This calculation gives "the smallest multiple of
* the block size that is at least 11264 bytes". */
- failure("blocksize=%d", blocksize);
+ failure("blocksize=%zu", blocksize);
assertEqualInt(((11264 - 1)/blocksize+1)*blocksize, used);
/*
@@ -229,7 +229,7 @@ test_2(void)
/* This calculation gives "the smallest multiple of
* the block size that is at least 11264 bytes". */
- failure("blocksize=%d", blocksize);
+ failure("blocksize=%zu", blocksize);
assertEqualInt(((11264 - 1)/blocksize+1)*blocksize, used);
/*
diff --git a/libarchive/test/test_write_format_xar.c b/libarchive/test/test_write_format_xar.c
index 7cfdbcf4d17d..02fd2c0e35a7 100644
--- a/libarchive/test/test_write_format_xar.c
+++ b/libarchive/test/test_write_format_xar.c
@@ -279,6 +279,7 @@ DEFINE_TEST(test_write_format_xar)
/* Disable TOC checksum. */
test_xar("!toc-checksum");
+ test_xar("toc-checksum=none");
/* Specify TOC checksum type to sha1. */
test_xar("toc-checksum=sha1");
/* Specify TOC checksum type to md5. */
@@ -286,6 +287,7 @@ DEFINE_TEST(test_write_format_xar)
/* Disable file checksum. */
test_xar("!checksum");
+ test_xar("checksum=none");
/* Specify file checksum type to sha1. */
test_xar("checksum=sha1");
/* Specify file checksum type to md5. */
@@ -293,6 +295,7 @@ DEFINE_TEST(test_write_format_xar)
/* Disable compression. */
test_xar("!compression");
+ test_xar("compression=none");
/* Specify compression type to gzip. */
test_xar("compression=gzip");
test_xar("compression=gzip,compression-level=1");
diff --git a/libarchive/test/test_write_format_zip_file.c b/libarchive/test/test_write_format_zip_file.c
index e27b23b4b6d1..9ac0126e5ace 100644
--- a/libarchive/test/test_write_format_zip_file.c
+++ b/libarchive/test/test_write_format_zip_file.c
@@ -84,7 +84,7 @@ DEFINE_TEST(test_write_format_zip_file)
unsigned char *central_header, *local_header, *eocd, *eocd_record;
unsigned char *extension_start, *extension_end;
char file_data[] = {'1', '2', '3', '4', '5', '6', '7', '8'};
- char *file_name = "file";
+ const char *file_name = "file";
#ifndef HAVE_ZLIB_H
zip_version = 10;
diff --git a/libarchive/test/test_write_format_zip_file_zip64.c b/libarchive/test/test_write_format_zip_file_zip64.c
index 7bba50d29223..4e6344fb5333 100644
--- a/libarchive/test/test_write_format_zip_file_zip64.c
+++ b/libarchive/test/test_write_format_zip_file_zip64.c
@@ -86,7 +86,7 @@ DEFINE_TEST(test_write_format_zip_file_zip64)
unsigned char *central_header, *local_header, *eocd, *eocd_record;
unsigned char *extension_start, *extension_end;
char file_data[] = {'1', '2', '3', '4', '5', '6', '7', '8'};
- char *file_name = "file";
+ const char *file_name = "file";
#ifndef HAVE_ZLIB_H
zip_compression = 0;
diff --git a/libarchive_fe/err.h b/libarchive_fe/err.h
index ebf5de814f5e..c663103b0b44 100644
--- a/libarchive_fe/err.h
+++ b/libarchive_fe/err.h
@@ -35,9 +35,14 @@
#if defined(__GNUC__) && (__GNUC__ > 2 || \
(__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
-#define __LA_PRINTFLIKE(f,a) __attribute__((__format__(__printf__, f, a)))
+# ifdef __MINGW_PRINTF_FORMAT
+# define __LA_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
+# else
+# define __LA_PRINTF_FORMAT __printf__
+# endif
+# define __LA_PRINTFLIKE(f,a) __attribute__((__format__(__LA_PRINTF_FORMAT, f, a)))
#else
-#define __LA_PRINTFLIKE(f,a)
+# define __LA_PRINTFLIKE(f,a)
#endif
void lafe_warnc(int code, const char *fmt, ...) __LA_PRINTFLIKE(2, 3);
diff --git a/tar/bsdtar.1 b/tar/bsdtar.1
index 04b56553ce02..f1574234905c 100644
--- a/tar/bsdtar.1
+++ b/tar/bsdtar.1
@@ -25,7 +25,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd June 3, 2019
+.Dd January 31, 2020
.Dt TAR 1
.Os
.Sh NAME
@@ -209,15 +209,16 @@ specified on the command line.
.It Fl Fl exclude-vcs
Do not process files or directories internally used by the
version control systems
+.Sq Arch ,
+.Sq Bazaar ,
.Sq CVS ,
+.Sq Darcs ,
+.Sq Mercurial ,
.Sq RCS ,
.Sq SCCS ,
-.Sq SVN ,
-.Sq Arch ,
-.Sq Bazaar ,
-.Sq Mercurial
+.Sq SVN
and
-.Sq Darcs .
+.Sq git .
.It Fl Fl fflags
(c, r, u, x modes only)
Archive or extract platform-specific file attributes or file flags.
@@ -469,6 +470,13 @@ This is the reverse of
and the default behavior if
.Nm
is run as non-root in x mode.
+.It Fl Fl no-safe-writes
+(x mode only)
+Do not create temporary files and use
+.Xr rename 2
+to replace the original ones.
+This is the reverse of
+.Fl Fl safe-writes .
.It Fl Fl no-same-owner
(x mode only)
Do not extract owner and group IDs.
@@ -567,7 +575,14 @@ As above, but the corresponding key and value will be provided
only to modules whose name matches
.Ar module .
.El
-The currently supported modules and keys are:
+.Pp
+The complete list of supported modules and keys
+for create and append modes is in
+.Xr archive_write_set_options 3
+and for extract and list modes in
+.Xr archive_read_set_options 3 .
+.Pp
+Examples of supported options:
.Bl -tag -compact -width indent
.It Cm iso9660:joliet
Support Joliet extensions.
@@ -756,6 +771,26 @@ The default is
.Ar hrs
which applies substitutions to all names.
In particular, it is never necessary to specify h, r, or s.
+.It Fl Fl safe-writes
+(x mode only)
+Extract files atomically.
+By default
+.Nm
+unlinks the original file with the same name as the extracted file (if it
+exists), and then creates it immediately under the same name and writes to
+it.
+For a short period of time, applications trying to access the file might
+not find it, or see incomplete results.
+If
+.Fl Fl safe-writes
+is enabled,
+.Nm
+first creates a unique temporary file, then writes the new contents to
+the temporary file, and finally renames the temporary file to its final
+name atomically using
+.Xr rename 2 .
+This guarantees that an application accessing the file, will either see
+the old contents or the new contents at all times.
.It Fl Fl same-owner
(x mode only)
Extract owner and group IDs.
diff --git a/tar/bsdtar.c b/tar/bsdtar.c
index b59963d0f822..af41be5e4e26 100644
--- a/tar/bsdtar.c
+++ b/tar/bsdtar.c
@@ -542,6 +542,9 @@ main(int argc, char **argv)
bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_MAC_METADATA;
bsdtar->flags |= OPTFLAG_NO_MAC_METADATA;
break;
+ case OPTION_NO_SAFE_WRITES:
+ bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_SAFE_WRITES;
+ break;
case OPTION_NO_SAME_OWNER: /* GNU tar */
bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_OWNER;
break;
@@ -658,6 +661,9 @@ main(int argc, char **argv)
usage();
#endif
break;
+ case OPTION_SAFE_WRITES:
+ bsdtar->extract_flags |= ARCHIVE_EXTRACT_SAFE_WRITES;
+ break;
case OPTION_SAME_OWNER: /* GNU tar */
bsdtar->extract_flags |= ARCHIVE_EXTRACT_OWNER;
break;
diff --git a/tar/bsdtar.h b/tar/bsdtar.h
index c61d568fd748..89aa3aa9198d 100644
--- a/tar/bsdtar.h
+++ b/tar/bsdtar.h
@@ -25,6 +25,9 @@
* $FreeBSD: src/usr.bin/tar/bsdtar.h,v 1.37 2008/12/06 07:37:14 kientzle Exp $
*/
+#ifndef BSDTAR_H_INCLUDED
+#define BSDTAR_H_INCLUDED
+
#include "bsdtar_platform.h"
#include <stdio.h>
@@ -161,6 +164,7 @@ enum {
OPTION_NO_ACLS,
OPTION_NO_FFLAGS,
OPTION_NO_MAC_METADATA,
+ OPTION_NO_SAFE_WRITES,
OPTION_NO_SAME_OWNER,
OPTION_NO_SAME_PERMISSIONS,
OPTION_NO_XATTRS,
@@ -174,6 +178,7 @@ enum {
OPTION_OPTIONS,
OPTION_PASSPHRASE,
OPTION_POSIX,
+ OPTION_SAFE_WRITES,
OPTION_SAME_OWNER,
OPTION_STRIP_COMPONENTS,
OPTION_TOTALS,
@@ -224,3 +229,5 @@ const char * passphrase_callback(struct archive *, void *);
void passphrase_free(char *);
void list_item_verbose(struct bsdtar *, FILE *,
struct archive_entry *);
+
+#endif
diff --git a/tar/cmdline.c b/tar/cmdline.c
index 21558e12df42..b80937ffcb6e 100644
--- a/tar/cmdline.c
+++ b/tar/cmdline.c
@@ -123,6 +123,7 @@ static const struct bsdtar_option {
{ "no-fflags", 0, OPTION_NO_FFLAGS },
{ "no-mac-metadata", 0, OPTION_NO_MAC_METADATA },
{ "no-recursion", 0, 'n' },
+ { "no-safe-writes", 0, OPTION_NO_SAFE_WRITES },
{ "no-same-owner", 0, OPTION_NO_SAME_OWNER },
{ "no-same-permissions", 0, OPTION_NO_SAME_PERMISSIONS },
{ "no-xattr", 0, OPTION_NO_XATTRS },
@@ -144,6 +145,7 @@ static const struct bsdtar_option {
{ "posix", 0, OPTION_POSIX },
{ "preserve-permissions", 0, 'p' },
{ "read-full-blocks", 0, 'B' },
+ { "safe-writes", 0, OPTION_SAFE_WRITES },
{ "same-owner", 0, OPTION_SAME_OWNER },
{ "same-permissions", 0, 'p' },
{ "strip-components", 1, OPTION_STRIP_COMPONENTS },
diff --git a/tar/test/CMakeLists.txt b/tar/test/CMakeLists.txt
index 459d9dcb1eff..2cd573acfaa5 100644
--- a/tar/test/CMakeLists.txt
+++ b/tar/test/CMakeLists.txt
@@ -59,6 +59,7 @@ IF(ENABLE_TAR AND ENABLE_TEST)
test_option_q.c
test_option_r.c
test_option_s.c
+ test_option_safe_writes.c
test_option_uid_uname.c
test_option_uuencode.c
test_option_xattrs.c
diff --git a/tar/test/test_basic.c b/tar/test/test_basic.c
index 9bb966a0cf86..b1c49834a45f 100644
--- a/tar/test/test_basic.c
+++ b/tar/test/test_basic.c
@@ -96,7 +96,7 @@ run_tar(const char *target, const char *pack_options,
/* Use the tar program to create an archive. */
r = systemf("%s cf - %s %s >%s/archive 2>%s/pack.err", testprog, pack_options, flist, target, target);
- failure("Error invoking %s cf -", testprog, pack_options);
+ failure("Error invoking %s cf -%s", testprog, pack_options);
assertEqualInt(r, 0);
assertChdir(target);
diff --git a/tar/test/test_copy.c b/tar/test/test_copy.c
index b828666b93fd..d618e45ca36b 100644
--- a/tar/test/test_copy.c
+++ b/tar/test/test_copy.c
@@ -256,13 +256,13 @@ verify_tree(size_t limit)
continue;
switch(dp[0]) {
case 'l': case 'm': case 'd':
- failure("strlen(p)=%d", strlen(p));
+ failure("strlen(p)=%zu", strlen(p));
assert(strlen(p) < limit);
assertEqualString(p,
filenames[strlen(p)]);
break;
case 'f': case 's':
- failure("strlen(p)=%d", strlen(p));
+ failure("strlen(p)=%zu", strlen(p));
assert(strlen(p) < limit + 1);
assertEqualString(p,
filenames[strlen(p)]);
diff --git a/tar/test/test_option_C_upper.c b/tar/test/test_option_C_upper.c
index dae985446892..538890f58178 100644
--- a/tar/test/test_option_C_upper.c
+++ b/tar/test/test_option_C_upper.c
@@ -117,7 +117,7 @@ DEFINE_TEST(test_option_C_upper)
assertMakeDir("test6", 0755);
assertChdir("test6");
r = systemf("%s -cf archive.tar -C XXX -C ../d1 file1 2>write.err",
- testprog, testworkdir);
+ testprog);
assert(r != 0);
assertNonEmptyFile("write.err");
assertEqualInt(0,
diff --git a/tar/test/test_option_s.c b/tar/test/test_option_s.c
index 09c72ee7d63d..fa799a295d01 100644
--- a/tar/test/test_option_s.c
+++ b/tar/test/test_option_s.c
@@ -92,10 +92,8 @@ DEFINE_TEST(test_option_s)
* Test 5: Name-switching substitutions when extracting archive.
*/
assertMakeDir("test5", 0755);
- systemf("%s -cf test5.tar in/d1/foo in/d1/bar",
- testprog, testprog);
- systemf("%s -xf test5.tar -s /foo/bar/ -s }bar}foo} -C test5",
- testprog, testprog);
+ systemf("%s -cf test5.tar in/d1/foo in/d1/bar", testprog);
+ systemf("%s -xf test5.tar -s /foo/bar/ -s }bar}foo} -C test5", testprog);
assertFileContents("foo", 3, "test5/in/d1/bar");
assertFileContents("bar", 3, "test5/in/d1/foo");
diff --git a/tar/test/test_option_safe_writes.c b/tar/test/test_option_safe_writes.c
new file mode 100644
index 000000000000..8edf5c69f7ec
--- /dev/null
+++ b/tar/test/test_option_safe_writes.c
@@ -0,0 +1,77 @@
+/*-
+ * Copyright (c) 2020 Martin Matuska
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "test.h"
+__FBSDID("$FreeBSD$");
+
+DEFINE_TEST(test_option_safe_writes)
+{
+ /* Create files */
+ assertMakeDir("in", 0755);
+ assertEqualInt(0, chdir("in"));
+ assertMakeFile("f", 0644, "a");
+ assertMakeFile("fh", 0644, "b");
+ assertMakeFile("d", 0644, "c");
+ assertMakeFile("fs", 0644, "d");
+ assertMakeFile("ds", 0644, "e");
+ assertEqualInt(0, chdir(".."));
+
+ /* Tar files up */
+ assertEqualInt(0,
+ systemf("%s -c -C in -f t.tar f fh d fs ds "
+ ">pack.out 2>pack.err", testprog));
+
+ /* Verify that nothing went to stdout or stderr. */
+ assertEmptyFile("pack.err");
+ assertEmptyFile("pack.out");
+
+ /* Create various objects */
+ assertMakeDir("out", 0755);
+ assertEqualInt(0, chdir("out"));
+ assertMakeFile("f", 0644, "a");
+ assertMakeHardlink("fh", "f");
+ assertMakeDir("d", 0755);
+ if (canSymlink()) {
+ assertMakeSymlink("fs", "f", 0);
+ assertMakeSymlink("ds", "d", 1);
+ }
+ assertEqualInt(0, chdir(".."));
+
+ /* Extract created archive withe safe writes */
+ assertEqualInt(0,
+ systemf("%s -x -C out --safe-writes -f t.tar "
+ ">unpack.out 2>unpack.err", testprog));
+
+ /* Verify that nothing went to stdout or stderr. */
+ assertEmptyFile("unpack.err");
+ assertEmptyFile("unpack.out");
+
+ /* Verify that files were overwritten properly */
+ assertEqualInt(0, chdir("out"));
+ assertTextFileContents("a","f");
+ assertTextFileContents("b","fh");
+ assertTextFileContents("c","d");
+ assertTextFileContents("d","fs");
+ assertTextFileContents("e","ds");
+}
diff --git a/tar/util.c b/tar/util.c
index 662db5baa796..8ebec64c48d9 100644
--- a/tar/util.c
+++ b/tar/util.c
@@ -666,6 +666,14 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
const char *fmt;
time_t tim;
static time_t now;
+ struct tm *ltime;
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+ struct tm tmbuf;
+#endif
+#if defined(HAVE__LOCALTIME64_S)
+ errno_t terr;
+ __time64_t tmptime;
+#endif
/*
* We avoid collecting the entire list in memory at once by
@@ -737,7 +745,19 @@ list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
fmt = bsdtar->day_first ? DAY_FMT " %b %Y" : "%b " DAY_FMT " %Y";
else
fmt = bsdtar->day_first ? DAY_FMT " %b %H:%M" : "%b " DAY_FMT " %H:%M";
- strftime(tmp, sizeof(tmp), fmt, localtime(&tim));
+#if defined(HAVE_LOCALTIME_R)
+ ltime = localtime_r(&tim, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+ tmptime = tim;
+ terr = _localtime64_s(&tmbuf, &tmptime);
+ if (terr)
+ ltime = NULL;
+ else
+ ltime = &tmbuf;
+#else
+ ltime = localtime(&tim);
+#endif
+ strftime(tmp, sizeof(tmp), fmt, ltime);
fprintf(out, " %s ", tmp);
safe_fprintf(out, "%s", archive_entry_pathname(entry));
diff --git a/test_utils/test_common.h b/test_utils/test_common.h
index 7538d8cb7b5a..80d54f0a450c 100644
--- a/test_utils/test_common.h
+++ b/test_utils/test_common.h
@@ -38,6 +38,9 @@
#elif defined(__FreeBSD__)
/* Building as part of FreeBSD system requires a pre-built config.h. */
#include "config_freebsd.h"
+#elif defined(__NetBSD__)
+/* Building as part of NetBSD system requires a pre-built config.h. */
+#include "config_netbsd.h"
#elif defined(_WIN32) && !defined(__CYGWIN__)
/* Win32 can't run the 'configure' script. */
#include "config_windows.h"
@@ -112,6 +115,19 @@
#pragma warn -8068 /* Constant out of range in comparison. */
#endif
+
+#if defined(__GNUC__) && (__GNUC__ > 2 || \
+ (__GNUC__ == 2 && __GNUC_MINOR__ >= 7))
+# ifdef __MINGW_PRINTF_FORMAT
+# define __LA_PRINTF_FORMAT __MINGW_PRINTF_FORMAT
+# else
+# define __LA_PRINTF_FORMAT __printf__
+# endif
+# define __LA_PRINTFLIKE(f,a) __attribute__((__format__(__LA_PRINTF_FORMAT, f, a)))
+#else
+# define __LA_PRINTFLIKE(f,a)
+#endif
+
/* Haiku OS and QNX */
#if defined(__HAIKU__) || defined(__QNXNTO__)
/* Haiku and QNX have typedefs in stdint.h (needed for int64_t) */
@@ -132,6 +148,10 @@
#define O_BINARY 0
#endif
+#ifndef __LIBARCHIVE_TEST_COMMON
+#define __LIBARCHIVE_TEST_COMMON
+#endif
+
#include "archive_platform_acl.h"
#define ARCHIVE_TEST_ACL_TYPE_POSIX1E 1
#define ARCHIVE_TEST_ACL_TYPE_NFS4 2
@@ -259,7 +279,7 @@
skipping_setup(__FILE__, __LINE__);test_skipping
/* Function declarations. These are defined in test_utility.c. */
-void failure(const char *fmt, ...);
+void failure(const char *fmt, ...) __LA_PRINTFLIKE(1, 2);
int assertion_assert(const char *, int, int, const char *, void *);
int assertion_chdir(const char *, int, const char *);
int assertion_compare_fflags(const char *, int, const char *, const char *,
@@ -302,10 +322,10 @@ int assertion_utimes(const char *, int, const char *, long, long, long, long );
int assertion_version(const char*, int, const char *, const char *);
void skipping_setup(const char *, int);
-void test_skipping(const char *fmt, ...);
+void test_skipping(const char *fmt, ...) __LA_PRINTFLIKE(1, 2);
/* Like sprintf, then system() */
-int systemf(const char * fmt, ...);
+int systemf(const char *fmt, ...) __LA_PRINTFLIKE(1, 2);
/* Delay until time() returns a value after this. */
void sleepUntilAfter(time_t);
@@ -368,7 +388,7 @@ void *sunacl_get(int cmd, int *aclcnt, int fd, const char *path);
/* Suck file into string allocated via malloc(). Call free() when done. */
/* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */
-char *slurpfile(size_t *, const char *fmt, ...);
+char *slurpfile(size_t *, const char *fmt, ...) __LA_PRINTFLIKE(2, 3);
/* Dump block of bytes to a file. */
void dumpfile(const char *filename, void *, size_t);
diff --git a/test_utils/test_main.c b/test_utils/test_main.c
index 1b44edf171d9..7b8aa70fac2a 100644
--- a/test_utils/test_main.c
+++ b/test_utils/test_main.c
@@ -388,7 +388,7 @@ static const char *refdir;
*/
static int log_console = 0;
static FILE *logfile;
-static void
+static void __LA_PRINTFLIKE(1, 0)
vlogprintf(const char *fmt, va_list ap)
{
#ifdef va_copy
@@ -406,7 +406,7 @@ vlogprintf(const char *fmt, va_list ap)
#endif
}
-static void
+static void __LA_PRINTFLIKE(1, 2)
logprintf(const char *fmt, ...)
{
va_list ap;
@@ -478,7 +478,7 @@ static struct line {
const char *failed_filename;
/* Count this failure, setup up log destination and handle initial report. */
-static void
+static void __LA_PRINTFLIKE(3, 4)
failure_start(const char *filename, int line, const char *fmt, ...)
{
va_list ap;
@@ -751,7 +751,7 @@ static void strdump(const char *e, const char *p, int ewidth, int utf8)
logprintf("]");
logprintf(" (count %d", cnt);
if (n < 0) {
- logprintf(",unknown %d bytes", len);
+ logprintf(",unknown %zu bytes", len);
}
logprintf(")");
@@ -1167,7 +1167,7 @@ assertion_text_file_contents(const char *filename, int line, const char *buff, c
logprintf(" file=\"%s\"\n", fn);
if (n > 0) {
hexdump(contents, buff, n, 0);
- logprintf(" expected\n", fn);
+ logprintf(" expected\n");
hexdump(buff, contents, s, 0);
} else {
logprintf(" File empty, contents should be:\n");
@@ -1497,7 +1497,7 @@ assertion_file_time(const char *file, int line,
}
} else if (filet != t || filet_nsec != nsec) {
failure_start(file, line,
- "File %s has %ctime %lld.%09lld, expected %lld.%09lld",
+ "File %s has %ctime %lld.%09lld, expected %ld.%09ld",
pathname, type, filet, filet_nsec, t, nsec);
failure_finish(NULL);
return (0);
@@ -1593,8 +1593,8 @@ assertion_file_nlinks(const char *file, int line,
r = my_GetFileInformationByName(pathname, &bhfi);
if (r != 0 && bhfi.nNumberOfLinks == (DWORD)nlinks)
return (1);
- failure_start(file, line, "File %s has %d links, expected %d",
- pathname, bhfi.nNumberOfLinks, nlinks);
+ failure_start(file, line, "File %s has %jd links, expected %d",
+ pathname, (intmax_t)bhfi.nNumberOfLinks, nlinks);
failure_finish(NULL);
return (0);
#else
@@ -1605,8 +1605,8 @@ assertion_file_nlinks(const char *file, int line,
r = lstat(pathname, &st);
if (r == 0 && (int)st.st_nlink == nlinks)
return (1);
- failure_start(file, line, "File %s has %d links, expected %d",
- pathname, st.st_nlink, nlinks);
+ failure_start(file, line, "File %s has %jd links, expected %d",
+ pathname, (intmax_t)st.st_nlink, nlinks);
failure_finish(NULL);
return (0);
#endif
@@ -2480,7 +2480,7 @@ canBzip2(void)
static int tested = 0, value = 0;
if (!tested) {
tested = 1;
- if (systemf("bzip2 -d -V %s", redirectArgs) == 0)
+ if (systemf("bzip2 --help %s", redirectArgs) == 0)
value = 1;
}
return (value);
@@ -2510,7 +2510,7 @@ canGzip(void)
static int tested = 0, value = 0;
if (!tested) {
tested = 1;
- if (systemf("gzip -V %s", redirectArgs) == 0)
+ if (systemf("gzip --help %s", redirectArgs) == 0)
value = 1;
}
return (value);
@@ -2552,7 +2552,7 @@ canLz4(void)
static int tested = 0, value = 0;
if (!tested) {
tested = 1;
- if (systemf("lz4 -V %s", redirectArgs) == 0)
+ if (systemf("lz4 --help %s", redirectArgs) == 0)
value = 1;
}
return (value);
@@ -2567,7 +2567,7 @@ canZstd(void)
static int tested = 0, value = 0;
if (!tested) {
tested = 1;
- if (systemf("zstd -V %s", redirectArgs) == 0)
+ if (systemf("zstd --help %s", redirectArgs) == 0)
value = 1;
}
return (value);
@@ -2582,7 +2582,7 @@ canLzip(void)
static int tested = 0, value = 0;
if (!tested) {
tested = 1;
- if (systemf("lzip -V %s", redirectArgs) == 0)
+ if (systemf("lzip --help %s", redirectArgs) == 0)
value = 1;
}
return (value);
@@ -2597,7 +2597,7 @@ canLzma(void)
static int tested = 0, value = 0;
if (!tested) {
tested = 1;
- if (systemf("lzma -V %s", redirectArgs) == 0)
+ if (systemf("lzma %s", redirectArgs) == 0)
value = 1;
}
return (value);
@@ -2612,7 +2612,7 @@ canLzop(void)
static int tested = 0, value = 0;
if (!tested) {
tested = 1;
- if (systemf("lzop -V %s", redirectArgs) == 0)
+ if (systemf("lzop --help %s", redirectArgs) == 0)
value = 1;
}
return (value);
@@ -2627,7 +2627,7 @@ canXz(void)
static int tested = 0, value = 0;
if (!tested) {
tested = 1;
- if (systemf("xz -V %s", redirectArgs) == 0)
+ if (systemf("xz --help %s", redirectArgs) == 0)
value = 1;
}
return (value);
@@ -3271,7 +3271,7 @@ assertion_entry_set_acls(const char *file, int line, struct archive_entry *ae,
acls[i].qual, acls[i].name);
if (r != 0) {
ret = 1;
- failure_start(file, line, "type=%#010x, ",
+ failure_start(file, line, "type=%#010x, "
"permset=%#010x, tag=%d, qual=%d name=%s",
acls[i].type, acls[i].permset, acls[i].tag,
acls[i].qual, acls[i].name);
@@ -3499,9 +3499,9 @@ static int
test_run(int i, const char *tmpdir)
{
#ifdef PATH_MAX
- char workdir[PATH_MAX];
+ char workdir[PATH_MAX * 2];
#else
- char workdir[1024];
+ char workdir[1024 * 2];
#endif
char logfilename[64];
int failures_before = failures;