Update vendor/libarchive to libarchive/libarchive@ee4579617
Important changes (relevant to FreeBSD): #1840 year 2038 fix for pax archives on platforms with 64-bit time_t #1873 bsdunzip ported to libarchive from FreeBSD #1894 read support for zstd compression in 7zip archives #1918 ARM64 filter support in 7zip archives Obtained from: libarchive Libarchive commit: ee45796171324519f0c0bfd012018dd099296336 Libarchive tag: v3.7.0
This commit is contained in:
parent
309e35276a
commit
14b646f7c3
10
.cirrus.yml
10
.cirrus.yml
@ -10,21 +10,21 @@ FreeBSD_task:
|
||||
BS: cmake
|
||||
matrix:
|
||||
freebsd_instance:
|
||||
image_family: freebsd-13-1
|
||||
image_family: freebsd-13-2
|
||||
freebsd_instance:
|
||||
image_family: freebsd-12-3
|
||||
image_family: freebsd-12-4
|
||||
prepare_script:
|
||||
- ./build/ci/cirrus_ci/ci.sh prepare
|
||||
configure_script:
|
||||
- env CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./build/ci/build.sh -a autogen
|
||||
- env CFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib ./build/ci/build.sh -a configure
|
||||
build_script:
|
||||
- ./build/ci/build.sh -a build
|
||||
- env MAKE_ARGS="-j 2" ./build/ci/build.sh -a build
|
||||
test_script:
|
||||
- env SKIP_TEST_RESTORE_ATIME=1 ./build/ci/build.sh -a test
|
||||
- env SKIP_TEST_RESTORE_ATIME=1 MAKE_ARGS="-j 2" ./build/ci/build.sh -a test
|
||||
- ./build/ci/cirrus_ci/ci.sh test
|
||||
install_script:
|
||||
- ./build/ci/build.sh -a install
|
||||
- env MAKE_ARGS="-j 2" ./build/ci/build.sh -a install
|
||||
|
||||
Windows_Cygwin_task:
|
||||
windows_container:
|
||||
|
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@ -4,7 +4,7 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
MacOS:
|
||||
runs-on: macos-12
|
||||
runs-on: macos-13
|
||||
strategy:
|
||||
matrix:
|
||||
bs: [autotools, cmake]
|
||||
@ -24,15 +24,19 @@ jobs:
|
||||
run: ./build/ci/build.sh -a build
|
||||
env:
|
||||
BS: ${{ matrix.bs }}
|
||||
MAKE_ARGS: -j
|
||||
- name: Test
|
||||
run: ./build/ci/build.sh -a test
|
||||
env:
|
||||
BS: ${{ matrix.bs }}
|
||||
SKIP_OPEN_FD_ERR_TEST: 1
|
||||
IGNORE_TRAVERSALS_TEST4: 1
|
||||
MAKE_ARGS: -j
|
||||
- name: Install
|
||||
run: ./build/ci/build.sh -a install
|
||||
env:
|
||||
BS: ${{ matrix.bs }}
|
||||
MAKE_ARGS: -j
|
||||
- name: Artifact
|
||||
run: ./build/ci/build.sh -a artifact
|
||||
env:
|
||||
@ -50,6 +54,8 @@ jobs:
|
||||
crypto: [mbedtls, nettle, openssl]
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Update apt cache
|
||||
run: sudo apt-get update
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install -y autoconf automake build-essential cmake git libssl-dev nettle-dev libmbedtls-dev libacl1-dev libbz2-dev liblzma-dev liblz4-dev libzstd-dev lzop pkg-config zlib1g-dev
|
||||
- name: Autogen
|
||||
@ -65,11 +71,13 @@ jobs:
|
||||
run: ./build/ci/build.sh -a build
|
||||
env:
|
||||
BS: ${{ matrix.bs }}
|
||||
MAKE_ARGS: -j
|
||||
- name: Test
|
||||
run: ./build/ci/build.sh -a test
|
||||
env:
|
||||
BS: ${{ matrix.bs }}
|
||||
SKIP_OPEN_FD_ERR_TEST: 1
|
||||
MAKE_ARGS: -j
|
||||
- name: Install
|
||||
run: ./build/ci/build.sh -a install
|
||||
env:
|
||||
@ -86,6 +94,8 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
- name: Update package definitions
|
||||
run: sudo apt-get update
|
||||
- name: Install dependencies
|
||||
run: sudo apt-get install -y autoconf automake bsdmainutils build-essential cmake ghostscript git groff libssl-dev libacl1-dev libbz2-dev liblzma-dev liblz4-dev libzstd-dev lzop pkg-config zip zlib1g-dev
|
||||
- name: Autogen
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -16,6 +16,7 @@ autom4te.cache/
|
||||
bsdcat
|
||||
bsdcpio
|
||||
bsdtar
|
||||
bsdunzip
|
||||
build/autoconf/compile
|
||||
build/autoconf/config.guess
|
||||
build/autoconf/config.sub
|
||||
@ -41,6 +42,7 @@ libarchive/test/list.h
|
||||
libtool
|
||||
stamp-h1
|
||||
tar/test/list.h
|
||||
unzip/test/list.h
|
||||
CMakeCache.txt
|
||||
CMakeFiles/
|
||||
DartConfiguration.tcl
|
||||
|
@ -21,7 +21,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".
|
||||
@ -199,6 +199,8 @@ ENDIF (MSVC)
|
||||
# Enable CTest/CDash support
|
||||
include(CTest)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
|
||||
|
||||
OPTION(ENABLE_MBEDTLS "Enable use of mbed TLS" OFF)
|
||||
OPTION(ENABLE_NETTLE "Enable use of Nettle" OFF)
|
||||
OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON)
|
||||
@ -223,6 +225,13 @@ OPTION(ENABLE_CPIO "Enable cpio building" ON)
|
||||
OPTION(ENABLE_CPIO_SHARED "Enable dynamic build of cpio" FALSE)
|
||||
OPTION(ENABLE_CAT "Enable cat building" ON)
|
||||
OPTION(ENABLE_CAT_SHARED "Enable dynamic build of cat" FALSE)
|
||||
IF(WIN32 AND NOT CYGWIN)
|
||||
SET(ENABLE_UNZIP FALSE)
|
||||
SET(ENABLE_UNZIP_SHARED FALSE)
|
||||
ELSE()
|
||||
OPTION(ENABLE_UNZIP "Enable unzip building" ON)
|
||||
OPTION(ENABLE_UNZIP_SHARED "Enable dynamic build of unzip" FALSE)
|
||||
ENDIF()
|
||||
OPTION(ENABLE_XATTR "Enable extended attribute support" ON)
|
||||
OPTION(ENABLE_ACL "Enable ACL support" ON)
|
||||
OPTION(ENABLE_ICONV "Enable iconv support" ON)
|
||||
@ -370,7 +379,11 @@ MACRO (TRY_MACRO_FOR_LIBRARY INCLUDES LIBRARIES
|
||||
IF("${TRY_TYPE}" MATCHES "COMPILES")
|
||||
CHECK_C_SOURCE_COMPILES("${SAMPLE_SOURCE}" ${VAR})
|
||||
ELSEIF("${TRY_TYPE}" MATCHES "RUNS")
|
||||
CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR})
|
||||
IF(CMAKE_CROSSCOMPILING)
|
||||
MESSAGE(WARNING "Cannot test run \"${VAR}\" when cross-compiling")
|
||||
ELSE(CMAKE_CROSSCOMPILING)
|
||||
CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR})
|
||||
ENDIF(CMAKE_CROSSCOMPILING)
|
||||
ELSE("${TRY_TYPE}" MATCHES "COMPILES")
|
||||
MESSAGE(FATAL_ERROR "UNKNOWN KEYWORD \"${TRY_TYPE}\" FOR TRY_TYPE")
|
||||
ENDIF("${TRY_TYPE}" MATCHES "COMPILES")
|
||||
@ -508,12 +521,16 @@ IF(LIBLZMA_FOUND)
|
||||
COMPILES
|
||||
"#include <lzma.h>\nint main() {return (int)lzma_version_number(); }"
|
||||
"WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC")
|
||||
CHECK_C_SOURCE_COMPILES(
|
||||
"#include <lzma.h>\n#if LZMA_VERSION < 50020000\n#error unsupported\n#endif\nint main(void){lzma_stream_encoder_mt(0, 0); return 0;}"
|
||||
HAVE_LZMA_STREAM_ENCODER_MT)
|
||||
IF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC)
|
||||
ADD_DEFINITIONS(-DLZMA_API_STATIC)
|
||||
ENDIF(NOT WITHOUT_LZMA_API_STATIC AND LZMA_API_STATIC)
|
||||
CMAKE_POP_CHECK_STATE()
|
||||
ELSE(LIBLZMA_FOUND)
|
||||
# LZMA not found and will not be used.
|
||||
SET(HAVE_LZMA_STREAM_ENCODER_MT 0)
|
||||
ENDIF(LIBLZMA_FOUND)
|
||||
MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR)
|
||||
MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY)
|
||||
@ -567,6 +584,7 @@ IF(LIBB2_FOUND)
|
||||
SET(HAVE_BLAKE2_H 1)
|
||||
SET(ARCHIVE_BLAKE2 FALSE)
|
||||
LIST(APPEND ADDITIONAL_LIBS ${LIBB2_LIBRARY})
|
||||
INCLUDE_DIRECTORIES(${LIBB2_INCLUDE_DIR})
|
||||
CMAKE_PUSH_CHECK_STATE()
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${LIBB2_LIBRARY})
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${LIBB2_INCLUDE_DIR})
|
||||
@ -676,6 +694,7 @@ CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h>
|
||||
int main(void) { return EXT2_IOC_GETFLAGS; }" HAVE_WORKING_EXT2_IOC_GETFLAGS)
|
||||
|
||||
LA_CHECK_INCLUDE_FILE("fcntl.h" HAVE_FCNTL_H)
|
||||
LA_CHECK_INCLUDE_FILE("fnmatch.h" HAVE_FNMATCH_H)
|
||||
LA_CHECK_INCLUDE_FILE("grp.h" HAVE_GRP_H)
|
||||
LA_CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H)
|
||||
LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H)
|
||||
@ -715,6 +734,7 @@ LA_CHECK_INCLUDE_FILE("sys/mkdev.h" HAVE_SYS_MKDEV_H)
|
||||
LA_CHECK_INCLUDE_FILE("sys/mount.h" HAVE_SYS_MOUNT_H)
|
||||
LA_CHECK_INCLUDE_FILE("sys/param.h" HAVE_SYS_PARAM_H)
|
||||
LA_CHECK_INCLUDE_FILE("sys/poll.h" HAVE_SYS_POLL_H)
|
||||
LA_CHECK_INCLUDE_FILE("sys/queue.h" HAVE_SYS_QUEUE_H)
|
||||
LA_CHECK_INCLUDE_FILE("sys/richacl.h" HAVE_SYS_RICHACL_H)
|
||||
LA_CHECK_INCLUDE_FILE("sys/select.h" HAVE_SYS_SELECT_H)
|
||||
LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H)
|
||||
@ -734,9 +754,9 @@ LA_CHECK_INCLUDE_FILE("wchar.h" HAVE_WCHAR_H)
|
||||
LA_CHECK_INCLUDE_FILE("wctype.h" HAVE_WCTYPE_H)
|
||||
LA_CHECK_INCLUDE_FILE("windows.h" HAVE_WINDOWS_H)
|
||||
IF(ENABLE_CNG)
|
||||
LA_CHECK_INCLUDE_FILE("Bcrypt.h" HAVE_BCRYPT_H)
|
||||
LA_CHECK_INCLUDE_FILE("bcrypt.h" HAVE_BCRYPT_H)
|
||||
IF(HAVE_BCRYPT_H)
|
||||
LIST(APPEND ADDITIONAL_LIBS "Bcrypt")
|
||||
LIST(APPEND ADDITIONAL_LIBS "bcrypt")
|
||||
ENDIF(HAVE_BCRYPT_H)
|
||||
ELSE(ENABLE_CNG)
|
||||
UNSET(HAVE_BCRYPT_H CACHE)
|
||||
@ -813,6 +833,10 @@ IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
SET(HAVE_LIBCRYPTO 1)
|
||||
INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR})
|
||||
LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_CRYPTO_LIBRARY})
|
||||
SET(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
|
||||
SET(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR})
|
||||
LA_CHECK_INCLUDE_FILE("openssl/evp.h" HAVE_OPENSSL_EVP_H)
|
||||
CHECK_FUNCTION_EXISTS(PKCS5_PBKDF2_HMAC_SHA1 HAVE_PKCS5_PBKDF2_HMAC_SHA1)
|
||||
ENDIF(OPENSSL_FOUND)
|
||||
ELSE()
|
||||
SET(OPENSSL_FOUND FALSE) # Override cached value
|
||||
@ -1349,6 +1373,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(fchmod HAVE_FCHMOD)
|
||||
CHECK_FUNCTION_EXISTS_GLIBC(fchown HAVE_FCHOWN)
|
||||
CHECK_FUNCTION_EXISTS_GLIBC(fcntl HAVE_FCNTL)
|
||||
CHECK_FUNCTION_EXISTS_GLIBC(fdopendir HAVE_FDOPENDIR)
|
||||
CHECK_FUNCTION_EXISTS_GLIBC(fnmatch HAVE_FNMATCH)
|
||||
CHECK_FUNCTION_EXISTS_GLIBC(fork HAVE_FORK)
|
||||
CHECK_FUNCTION_EXISTS_GLIBC(fstat HAVE_FSTAT)
|
||||
CHECK_FUNCTION_EXISTS_GLIBC(fstatat HAVE_FSTATAT)
|
||||
@ -1461,6 +1486,9 @@ CHECK_C_SOURCE_COMPILES(
|
||||
"#include <fcntl.h>\n#include <unistd.h>\nint main() {char buf[10]; return readlinkat(AT_FDCWD, \"\", buf, 0);}"
|
||||
HAVE_READLINKAT)
|
||||
|
||||
# Check for getopt uses optreset to reset
|
||||
CHECK_SYMBOL_EXISTS(optreset "getopt.h" HAVE_GETOPT_OPTRESET)
|
||||
|
||||
|
||||
# To verify major(), we need to both include the header
|
||||
# of interest and verify that the result can be linked.
|
||||
@ -1473,14 +1501,6 @@ CHECK_C_SOURCE_COMPILES(
|
||||
"#include <sys/sysmacros.h>\nint main() { return major(256); }"
|
||||
MAJOR_IN_SYSMACROS)
|
||||
|
||||
IF(ENABLE_LZMA)
|
||||
CHECK_C_SOURCE_COMPILES(
|
||||
"#include <lzma.h>\n#if LZMA_VERSION < 50020000\n#error unsupported\n#endif\nint main(void){lzma_stream_encoder_mt(0, 0); return 0;}"
|
||||
HAVE_LZMA_STREAM_ENCODER_MT)
|
||||
ELSE()
|
||||
SET(HAVE_LZMA_STREAM_ENCODER_MT 0)
|
||||
ENDIF(ENABLE_LZMA)
|
||||
|
||||
IF(HAVE_STRERROR_R)
|
||||
SET(HAVE_DECL_STRERROR_R 1)
|
||||
ENDIF(HAVE_STRERROR_R)
|
||||
@ -2093,3 +2113,4 @@ add_subdirectory(libarchive)
|
||||
add_subdirectory(cat)
|
||||
add_subdirectory(tar)
|
||||
add_subdirectory(cpio)
|
||||
add_subdirectory(unzip)
|
||||
|
127
Makefile.am
127
Makefile.am
@ -8,17 +8,17 @@ ACLOCAL_AMFLAGS = -I build/autoconf
|
||||
#
|
||||
lib_LTLIBRARIES= libarchive.la
|
||||
noinst_LTLIBRARIES= libarchive_fe.la
|
||||
bin_PROGRAMS= $(bsdtar_programs) $(bsdcpio_programs) $(bsdcat_programs)
|
||||
man_MANS= $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS) $(bsdcat_man_MANS)
|
||||
BUILT_SOURCES= libarchive/test/list.h tar/test/list.h cpio/test/list.h cat/test/list.h
|
||||
bin_PROGRAMS= $(bsdtar_programs) $(bsdcpio_programs) $(bsdcat_programs) $(bsdunzip_programs)
|
||||
man_MANS= $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS) $(bsdcat_man_MANS) $(bsdunzip_man_MANS)
|
||||
BUILT_SOURCES= libarchive/test/list.h tar/test/list.h cpio/test/list.h cat/test/list.h unzip/test/list.h
|
||||
|
||||
#
|
||||
# What to test: We always test libarchive, test bsdtar and bsdcpio only
|
||||
# if we built them.
|
||||
#
|
||||
check_PROGRAMS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs) $(bsdcat_test_programs)
|
||||
TESTS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs) $(bsdcat_test_programs)
|
||||
TESTS_ENVIRONMENT= $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT) $(bsdcat_TESTS_ENVIRONMENT)
|
||||
check_PROGRAMS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs) $(bsdcat_test_programs) $(bsdunzip_test_programs)
|
||||
TESTS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs) $(bsdcat_test_programs) $(bsdunzip_test_programs)
|
||||
TESTS_ENVIRONMENT= $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT) $(bsdcat_TESTS_ENVIRONMENT) $(bsdunzip_TESTS_ENVIRONMENT)
|
||||
# Always build and test both bsdtar and bsdcpio as part of 'distcheck'
|
||||
DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio
|
||||
# The next line is commented out by default in shipping libarchive releases.
|
||||
@ -49,7 +49,9 @@ EXTRA_DIST= \
|
||||
$(bsdcpio_EXTRA_DIST) \
|
||||
$(bsdcpio_test_EXTRA_DIST) \
|
||||
$(bsdcat_EXTRA_DIST) \
|
||||
$(bsdcat_test_EXTRA_DIST)
|
||||
$(bsdcat_test_EXTRA_DIST) \
|
||||
$(bsdunzip_EXTRA_DIST) \
|
||||
$(bsdunzip_test_EXTRA_DIST)
|
||||
|
||||
# a) Clean out some unneeded files and directories
|
||||
# b) Collect all documentation and format it for distribution.
|
||||
@ -69,7 +71,8 @@ DISTCLEANFILES= \
|
||||
libarchive/test/list.h \
|
||||
tar/test/list.h \
|
||||
cpio/test/list.h \
|
||||
cat/test/list.h
|
||||
cat/test/list.h \
|
||||
unzip/test/list.h
|
||||
|
||||
distclean-local:
|
||||
-rm -rf .ref
|
||||
@ -82,7 +85,9 @@ distclean-local:
|
||||
-[ -f cpio/Makefile ] && cd cpio && make clean
|
||||
-[ -f cpio/test/Makefile ] && cd cpio/test && make clean
|
||||
-[ -f cat/Makefile ] && cd cat && make clean
|
||||
-[ -f cpio/test/Makefile ] && cd cat/test && make clean
|
||||
-[ -f cat/test/Makefile ] && cd cat/test && make clean
|
||||
-[ -f unzip/Makefile ] && cd unzip && make clean
|
||||
-[ -f unzip/test/Makefile ] && cd unzip/test && make clean
|
||||
|
||||
#
|
||||
# Libarchive headers, source, etc.
|
||||
@ -763,6 +768,7 @@ libarchive_test_EXTRA_DIST=\
|
||||
libarchive/test/test_read_format_7zip_copy.7z.uu \
|
||||
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_deflate_arm64.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 \
|
||||
@ -776,11 +782,18 @@ libarchive_test_EXTRA_DIST=\
|
||||
libarchive/test/test_read_format_7zip_lzma1_2.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_lzma1_lzma2.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_lzma2.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_lzma2_arm64.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_lzma2_arm.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_malformed.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_malformed2.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_packinfo_digests.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_ppmd.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_solid_zstd.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_symbolic_name.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_zstd_arm.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_zstd_bcj.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_zstd_nobcj.7z.uu \
|
||||
libarchive/test/test_read_format_7zip_zstd.7z.uu \
|
||||
libarchive/test/test_read_format_ar.ar.uu \
|
||||
libarchive/test/test_read_format_cab_1.cab.uu \
|
||||
libarchive/test/test_read_format_cab_2.cab.uu \
|
||||
@ -1428,3 +1441,99 @@ bsdcat_test_EXTRA_DIST= \
|
||||
cat/test/test_expand.plain.uu \
|
||||
cat/test/test_expand.xz.uu \
|
||||
cat/test/CMakeLists.txt
|
||||
|
||||
#
|
||||
#
|
||||
# bsdunzip source, docs, etc.
|
||||
#
|
||||
#
|
||||
|
||||
bsdunzip_SOURCES= \
|
||||
unzip/bsdunzip.c \
|
||||
unzip/bsdunzip_platform.h
|
||||
|
||||
if INC_WINDOWS_FILES
|
||||
bsdunzip_SOURCES+=
|
||||
endif
|
||||
|
||||
bsdunzip_DEPENDENCIES = libarchive.la libarchive_fe.la
|
||||
|
||||
|
||||
if STATIC_BSDUNZIP
|
||||
bsdunzip_ldstatic= -static
|
||||
bsdunzip_ccstatic= -DLIBARCHIVE_STATIC
|
||||
else
|
||||
bsdunzip_ldstatic=
|
||||
bsdunzip_ccstatic=
|
||||
endif
|
||||
|
||||
bsdunzip_LDADD= libarchive_fe.la libarchive.la $(LTLIBICONV)
|
||||
bsdunzip_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdunzip_ccstatic) $(PLATFORMCPPFLAGS)
|
||||
bsdunzip_LDFLAGS= $(bsdunzip_ldstatic) $(GC_SECTIONS)
|
||||
|
||||
bsdunzip_EXTRA_DIST= \
|
||||
unzip/bsdunzip.1 \
|
||||
unzip/CMakeLists.txt
|
||||
|
||||
|
||||
if BUILD_BSDUNZIP
|
||||
# Manpages to install
|
||||
bsdunzip_man_MANS= unzip/bsdunzip.1
|
||||
bsdunzip_programs= bsdunzip
|
||||
else
|
||||
bsdunzip_man_MANS=
|
||||
bsdunzip_programs=
|
||||
endif
|
||||
|
||||
#
|
||||
# bsdcat_test
|
||||
#
|
||||
|
||||
bsdunzip_test_SOURCES= \
|
||||
$(test_utils_SOURCES) \
|
||||
unzip/test/test.h \
|
||||
unzip/test/test_0.c \
|
||||
unzip/test/test_basic.c \
|
||||
unzip/test/test_glob.c \
|
||||
unzip/test/test_not_exist.c \
|
||||
unzip/test/test_singlefile.c \
|
||||
unzip/test/test_C.c \
|
||||
unzip/test/test_p.c \
|
||||
unzip/test/test_d.c \
|
||||
unzip/test/test_j.c \
|
||||
unzip/test/test_L.c \
|
||||
unzip/test/test_n.c \
|
||||
unzip/test/test_o.c \
|
||||
unzip/test/test_q.c \
|
||||
unzip/test/test_t.c \
|
||||
unzip/test/test_t_bad.c \
|
||||
unzip/test/test_x.c \
|
||||
unzip/test/test_Z1.c \
|
||||
unzip/test/test_P_encryption.c
|
||||
|
||||
bsdunzip_test_CPPFLAGS= \
|
||||
-I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \
|
||||
-I$(top_srcdir)/test_utils \
|
||||
-I$(top_srcdir)/unzip -I$(top_srcdir)/unzip/test \
|
||||
-I$(top_builddir)/unzip/test \
|
||||
$(PLATFORMCPPFLAGS)
|
||||
bsdunzip_test_LDADD=libarchive_fe.la
|
||||
|
||||
unzip/test/list.h: Makefile
|
||||
cat $(top_srcdir)/unzip/test/test_*.c | grep '^DEFINE_TEST' > unzip/test/list.h
|
||||
|
||||
if BUILD_BSDUNZIP
|
||||
bsdunzip_test_programs= bsdunzip_test
|
||||
bsdunzip_TESTS_ENVIRONMENT= BSDUNZIP=`cd $(top_builddir);/bin/pwd`/bsdunzip$(EXEEXT) BSDUNZIP_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/unzip/test
|
||||
else
|
||||
bsdunzip_test_programs=
|
||||
bsdunzip_TESTS_ENVIRONMENT=
|
||||
endif
|
||||
|
||||
bsdunzip_test_EXTRA_DIST= \
|
||||
unzip/test/list.h \
|
||||
unzip/test/test_basic.zip.uu \
|
||||
unzip/test/test_encrypted.zip.uu \
|
||||
unzip/test/test_singlefile.zip.uu \
|
||||
unzip/test/test_t_bad.zip.uu \
|
||||
unzip/test/CMakeLists.txt
|
||||
|
4
NEWS
4
NEWS
@ -1,3 +1,7 @@
|
||||
Jul 18, 2023: libarchive 3.7.0 released
|
||||
|
||||
Jul 14, 2023: bsdunzip port from FreeBSD
|
||||
|
||||
Dec 07, 2022: libarchive 3.6.2 released
|
||||
|
||||
Apr 08, 2022: libarchive 3.6.1 released
|
||||
|
16
README.md
16
README.md
@ -7,7 +7,7 @@ command-line tools that use the libarchive library.
|
||||
|
||||
## Questions? Issues?
|
||||
|
||||
* http://www.libarchive.org is the home for ongoing
|
||||
* https://www.libarchive.org is the home for ongoing
|
||||
libarchive development, including documentation,
|
||||
and links to the libarchive mailing lists.
|
||||
* To report an issue, use the issue tracker at
|
||||
@ -23,6 +23,7 @@ This distribution bundle includes the following major components:
|
||||
* **tar**: the 'bsdtar' program is a full-featured 'tar' implementation built on libarchive
|
||||
* **cpio**: the 'bsdcpio' program is a different interface to essentially the same functionality
|
||||
* **cat**: the 'bsdcat' program is a simple replacement tool for zcat, bzcat, xzcat, and such
|
||||
* **unzip**: the 'bsdunzip' program is a simple replacement tool for Info-ZIP's unzip
|
||||
* **examples**: Some small example programs that you may find useful.
|
||||
* **examples/minitar**: a compact sample demonstrating use of libarchive.
|
||||
* **contrib**: Various items sent to me by third parties; please contact the authors with any questions.
|
||||
@ -87,7 +88,7 @@ Currently, the library automatically detects and reads the following formats:
|
||||
* ZIPX archives (with support for bzip2, ppmd8, lzma and xz compressed entries)
|
||||
* GNU and BSD 'ar' archives
|
||||
* 'mtree' format
|
||||
* 7-Zip archives
|
||||
* 7-Zip archives (including archives that use zstandard compression)
|
||||
* Microsoft CAB format
|
||||
* LHA and LZH archives
|
||||
* RAR and RAR 5.0 archives (with some limitations due to RAR's proprietary status)
|
||||
@ -192,6 +193,17 @@ questions we are asked about libarchive:
|
||||
functions. On those platforms, libarchive will use the non-thread-safe
|
||||
functions. Patches to improve this are of great interest to us.
|
||||
|
||||
* The function `archive_write_disk_header()` is _not_ thread safe on
|
||||
POSIX machines and could lead to security issue resulting in world
|
||||
writeable directories. Thus it must be mutexed by the calling code.
|
||||
This is due to calling `umask(oldumask = umask(0))`, which sets the
|
||||
umask for the whole process to 0 for a short time frame.
|
||||
In case other thread calls the same function in parallel, it might
|
||||
get interrupted by it and cause the executable to use umask=0 for the
|
||||
remaining execution.
|
||||
This will then lead to implicitely created directories to have 777
|
||||
permissions without sticky bit.
|
||||
|
||||
* In particular, libarchive's modules to read or write a directory
|
||||
tree do use `chdir()` to optimize the directory traversals. This
|
||||
can cause problems for programs that expect to do disk access from
|
||||
|
19
SECURITY.md
Normal file
19
SECURITY.md
Normal file
@ -0,0 +1,19 @@
|
||||
# Security Policy
|
||||
|
||||
If you have discovered a security vulnerability in this project, please report it
|
||||
privately. **Do not disclose it as a public issue.** This gives us time to work with you
|
||||
to fix the issue before public exposure, reducing the chance that the exploit will be
|
||||
used before a patch is released.
|
||||
|
||||
You may submit the report in the following ways:
|
||||
|
||||
- send an email to security@libarchive.de; and/or
|
||||
- send us a [private vulnerability report](https://github.com/libarchive/libarchive/security/advisories/new)
|
||||
|
||||
Please provide the following information in your report:
|
||||
|
||||
- A description of the vulnerability and its impact
|
||||
- How to reproduce the issue
|
||||
|
||||
This project is maintained by volunteers on a reasonable-effort basis. As such, we ask
|
||||
that you give me 90 days to work on a fix before public exposure.
|
@ -97,9 +97,6 @@ if [ -n "${DEBUG}" ]; then
|
||||
else
|
||||
export CFLAGS="-g -fsanitize=address"
|
||||
fi
|
||||
if [ "${BS}" = "cmake" ]; then
|
||||
CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_C_CFLAGS=-g -fsanitize=address"
|
||||
fi
|
||||
fi
|
||||
if [ -z "${ACTIONS}" ]; then
|
||||
ACTIONS="autogen configure build test install"
|
||||
|
@ -7,7 +7,7 @@ find_library(MBEDCRYPTO_LIBRARY mbedcrypto)
|
||||
set(MBEDTLS_LIBRARIES "${MBEDTLS_LIBRARY}" "${MBEDX509_LIBRARY}" "${MBEDCRYPTO_LIBRARY}")
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(MBEDTLS DEFAULT_MSG
|
||||
find_package_handle_standard_args(MbedTLS DEFAULT_MSG
|
||||
MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
|
||||
|
||||
mark_as_advanced(MBEDTLS_INCLUDE_DIRS MBEDTLS_LIBRARY MBEDX509_LIBRARY MBEDCRYPTO_LIBRARY)
|
||||
|
@ -207,6 +207,9 @@ typedef uint64_t uintmax_t;
|
||||
/* MD5 via ARCHIVE_CRYPTO_MD5_LIBSYSTEM supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_MD5_LIBSYSTEM 1
|
||||
|
||||
/* MD5 via ARCHIVE_CRYPTO_MD5_MBEDTLS supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_MD5_MBEDTLS 1
|
||||
|
||||
/* MD5 via ARCHIVE_CRYPTO_MD5_NETTLE supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_MD5_NETTLE 1
|
||||
|
||||
@ -222,6 +225,9 @@ typedef uint64_t uintmax_t;
|
||||
/* RMD160 via ARCHIVE_CRYPTO_RMD160_NETTLE supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_RMD160_NETTLE 1
|
||||
|
||||
/* RMD160 via ARCHIVE_CRYPTO_RMD160_MBEDTLS supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_RMD160_MBEDTLS 1
|
||||
|
||||
/* RMD160 via ARCHIVE_CRYPTO_RMD160_OPENSSL supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_RMD160_OPENSSL 1
|
||||
|
||||
@ -231,6 +237,9 @@ typedef uint64_t uintmax_t;
|
||||
/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBSYSTEM supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA1_LIBSYSTEM 1
|
||||
|
||||
/* SHA1 via ARCHIVE_CRYPTO_SHA1_MBEDTLS supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA1_MBEDTLS 1
|
||||
|
||||
/* SHA1 via ARCHIVE_CRYPTO_SHA1_NETTLE supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA1_NETTLE 1
|
||||
|
||||
@ -252,6 +261,9 @@ typedef uint64_t uintmax_t;
|
||||
/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBSYSTEM supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBSYSTEM 1
|
||||
|
||||
/* SHA256 via ARCHIVE_CRYPTO_SHA256_MBEDTLS supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA256_MBEDTLS 1
|
||||
|
||||
/* SHA256 via ARCHIVE_CRYPTO_SHA256_NETTLE supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA256_NETTLE 1
|
||||
|
||||
@ -273,6 +285,9 @@ typedef uint64_t uintmax_t;
|
||||
/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBSYSTEM supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBSYSTEM 1
|
||||
|
||||
/* SHA384 via ARCHIVE_CRYPTO_SHA384_MBEDTLS supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA384_MBEDTLS 1
|
||||
|
||||
/* SHA384 via ARCHIVE_CRYPTO_SHA384_NETTLE supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA384_NETTLE 1
|
||||
|
||||
@ -294,6 +309,9 @@ typedef uint64_t uintmax_t;
|
||||
/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBSYSTEM supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBSYSTEM 1
|
||||
|
||||
/* SHA512 via ARCHIVE_CRYPTO_SHA512_MBEDTLS supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA512_MBEDTLS 1
|
||||
|
||||
/* SHA512 via ARCHIVE_CRYPTO_SHA512_NETTLE supported. */
|
||||
#cmakedefine ARCHIVE_CRYPTO_SHA512_NETTLE 1
|
||||
|
||||
@ -366,7 +384,7 @@ typedef uint64_t uintmax_t;
|
||||
/* Define to 1 if you have the <attr/xattr.h> header file. */
|
||||
#cmakedefine HAVE_ATTR_XATTR_H 1
|
||||
|
||||
/* Define to 1 if you have the <Bcrypt.h> header file. */
|
||||
/* Define to 1 if you have the <bcrypt.h> header file. */
|
||||
#cmakedefine HAVE_BCRYPT_H 1
|
||||
|
||||
/* Define to 1 if you have the <bsdxml.h> header file. */
|
||||
@ -570,6 +588,12 @@ typedef uint64_t uintmax_t;
|
||||
/* Define to 1 if you have the `flistxattr' function. */
|
||||
#cmakedefine HAVE_FLISTXATTR 1
|
||||
|
||||
/* Define to 1 if you have the `fnmatch' function. */
|
||||
#cmakedefine HAVE_FNMATCH 1
|
||||
|
||||
/* Define to 1 if you have the <fnmatch.h> header file. */
|
||||
#cmakedefine HAVE_FNMATCH_H 1
|
||||
|
||||
/* Define to 1 if you have the `fork' function. */
|
||||
#cmakedefine HAVE_FORK 1
|
||||
|
||||
@ -618,6 +642,9 @@ typedef uint64_t uintmax_t;
|
||||
/* Define to 1 if you have the `getgrnam_r' function. */
|
||||
#cmakedefine HAVE_GETGRNAM_R 1
|
||||
|
||||
/* Define to 1 if platform uses `optreset` to reset `getopt` */
|
||||
#cmakedefine HAVE_GETOPT_OPTRESET 1
|
||||
|
||||
/* Define to 1 if you have the `getpid' function. */
|
||||
#cmakedefine HAVE_GETPID 1
|
||||
|
||||
@ -827,6 +854,15 @@ typedef uint64_t uintmax_t;
|
||||
/* Define to 1 if you have the <lzo/lzoconf.h> header file. */
|
||||
#cmakedefine HAVE_LZO_LZOCONF_H 1
|
||||
|
||||
/* Define to 1 if you have the <mbedtls/aes.h> header file. */
|
||||
#cmakedefine HAVE_MBEDTLS_AES_H 1
|
||||
|
||||
/* Define to 1 if you have the <mbedtls/md.h> header file. */
|
||||
#cmakedefine HAVE_MBEDTLS_MD_H 1
|
||||
|
||||
/* Define to 1 if you have the <mbedtls/pkcs5.h> header file. */
|
||||
#cmakedefine HAVE_MBEDTLS_PKCS5_H 1
|
||||
|
||||
/* Define to 1 if you have the `mbrtowc' function. */
|
||||
#cmakedefine HAVE_MBRTOWC 1
|
||||
|
||||
@ -878,6 +914,9 @@ typedef uint64_t uintmax_t;
|
||||
/* Define to 1 if you have the `openat' function. */
|
||||
#cmakedefine HAVE_OPENAT 1
|
||||
|
||||
/* Define to 1 if you have the <openssl/evp.h> header file. */
|
||||
#cmakedefine HAVE_OPENSSL_EVP_H 1
|
||||
|
||||
/* Define to 1 if you have the <paths.h> header file. */
|
||||
#cmakedefine HAVE_PATHS_H 1
|
||||
|
||||
@ -1073,6 +1112,9 @@ typedef uint64_t uintmax_t;
|
||||
/* Define to 1 if you have the <sys/poll.h> header file. */
|
||||
#cmakedefine HAVE_SYS_POLL_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/queue.h> header file. */
|
||||
#cmakedefine HAVE_SYS_QUEUE_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/richacl.h> header file. */
|
||||
#cmakedefine HAVE_SYS_RICHACL_H 1
|
||||
|
||||
|
@ -1 +1 @@
|
||||
3006003
|
||||
3007000
|
||||
|
80
configure.ac
80
configure.ac
@ -4,8 +4,8 @@ dnl First, define all of the version numbers up front.
|
||||
dnl In particular, this allows the version macro to be used in AC_INIT
|
||||
|
||||
dnl These first two version numbers are updated automatically on each release.
|
||||
m4_define([LIBARCHIVE_VERSION_S],[3.6.3dev])
|
||||
m4_define([LIBARCHIVE_VERSION_N],[3006003])
|
||||
m4_define([LIBARCHIVE_VERSION_S],[3.7.0])
|
||||
m4_define([LIBARCHIVE_VERSION_N],[3007000])
|
||||
|
||||
dnl bsdtar and bsdcpio versioning tracks libarchive
|
||||
m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S())
|
||||
@ -267,12 +267,64 @@ case $host in
|
||||
;;
|
||||
esac
|
||||
|
||||
#
|
||||
# Options for building bsdunzip.
|
||||
#
|
||||
# Default is to build bsdunzip, but allow people to override that.
|
||||
# Bsdunzip has not yet been ported for Windows
|
||||
#
|
||||
case "$host_os" in
|
||||
*mingw* | *msys*)
|
||||
enable_bsdunzip=no
|
||||
;;
|
||||
*)
|
||||
AC_ARG_ENABLE([bsdunzip],
|
||||
[AS_HELP_STRING([--enable-bsdunzip], [enable build of bsdunzip (default)])
|
||||
AS_HELP_STRING([--enable-bsdunzip=static], [force static build of bsdunzip])
|
||||
AS_HELP_STRING([--enable-bsdunzip=shared], [force dynamic build of bsdunzip])
|
||||
AS_HELP_STRING([--disable-bsdunzip], [disable build of bsdunzip])],
|
||||
[], [enable_bsdunzip=yes])
|
||||
;;
|
||||
esac
|
||||
|
||||
case "$enable_bsdunzip" in
|
||||
yes)
|
||||
if test "$enable_static" = "no"; then
|
||||
static_bsdunzip=no
|
||||
else
|
||||
static_bsdunzip=yes
|
||||
fi
|
||||
build_bsdunzip=yes
|
||||
;;
|
||||
dynamic|shared)
|
||||
if test "$enable_shared" = "no"; then
|
||||
AC_MSG_FAILURE([Shared linking of bsdunzip requires shared libarchive])
|
||||
fi
|
||||
build_bsdunzip=yes
|
||||
static_bsdunzip=no
|
||||
;;
|
||||
static)
|
||||
build_bsdunzip=yes
|
||||
static_bsdunzip=yes
|
||||
;;
|
||||
no)
|
||||
build_bsdunzip=no
|
||||
static_bsdunzip=no
|
||||
;;
|
||||
*)
|
||||
AC_MSG_FAILURE([Unsupported value for --enable-bsdunzip])
|
||||
;;
|
||||
esac
|
||||
|
||||
AM_CONDITIONAL([BUILD_BSDUNZIP], [ test "$build_bsdunzip" = yes ])
|
||||
AM_CONDITIONAL([STATIC_BSDUNZIP], [ test "$static_bsdunzip" = yes ])
|
||||
|
||||
# Checks for header files.
|
||||
AC_HEADER_DIRENT
|
||||
AC_HEADER_SYS_WAIT
|
||||
AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h])
|
||||
AC_CHECK_HEADERS([copyfile.h ctype.h])
|
||||
AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h grp.h])
|
||||
AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h fnmatch.h grp.h])
|
||||
|
||||
AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable],
|
||||
[ac_cv_have_decl_EXT2_IOC_GETFLAGS],
|
||||
@ -305,7 +357,7 @@ AC_CHECK_HEADERS([locale.h membership.h paths.h poll.h pthread.h pwd.h])
|
||||
AC_CHECK_HEADERS([readpassphrase.h signal.h spawn.h])
|
||||
AC_CHECK_HEADERS([stdarg.h stdint.h stdlib.h string.h])
|
||||
AC_CHECK_HEADERS([sys/acl.h sys/cdefs.h sys/ea.h sys/extattr.h])
|
||||
AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h])
|
||||
AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h sys/queue.h])
|
||||
AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/richacl.h])
|
||||
AC_CHECK_HEADERS([sys/select.h sys/statfs.h sys/statvfs.h sys/sysmacros.h])
|
||||
AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h sys/xattr.h])
|
||||
@ -430,6 +482,19 @@ if test "x$with_lzma" != "xno"; then
|
||||
if test "x$ac_cv_lzma_has_mt" != xno; then
|
||||
AC_DEFINE([HAVE_LZMA_STREAM_ENCODER_MT], [1], [Define to 1 if you have the `lzma_stream_encoder_mt' function.])
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK(
|
||||
[whether we have ARM64 filter support in lzma],
|
||||
ac_cv_lzma_has_arm64,
|
||||
[AC_LINK_IFELSE([
|
||||
AC_LANG_PROGRAM([[#include <lzma.h>]
|
||||
[#ifndef LZMA_FILTER_ARM64]
|
||||
[#error unsupported]
|
||||
[#endif]])],
|
||||
[ac_cv_lzma_has_arm64=yes], [ac_cv_lzma_has_arm64=no])])
|
||||
if test "x$ac_cv_lzma_has_arm64" != xno; then
|
||||
AC_DEFINE([HAVE_LZMA_FILTER_ARM64], [1], [Define to 1 if you have the `LZMA_FILTER_ARM64' macro.])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_ARG_WITH([lzo2],
|
||||
@ -674,7 +739,7 @@ AC_FUNC_VPRINTF
|
||||
# workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *'
|
||||
AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *])
|
||||
AC_CHECK_FUNCS([arc4random_buf chflags chown chroot ctime_r])
|
||||
AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fork])
|
||||
AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fnmatch fork])
|
||||
AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate])
|
||||
AC_CHECK_FUNCS([futimens futimes futimesat])
|
||||
AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r])
|
||||
@ -767,6 +832,11 @@ AC_CHECK_MEMBER(struct dirent.d_namlen,,,
|
||||
#endif
|
||||
])
|
||||
|
||||
AC_CHECK_DECL([optreset],
|
||||
[AC_DEFINE(HAVE_GETOPT_OPTRESET, 1, [Platform uses optreset to reset getopt])],
|
||||
[],
|
||||
[#include <getopt.h>])
|
||||
|
||||
# Check for Extended Attributes support
|
||||
AC_ARG_ENABLE([xattr],
|
||||
AS_HELP_STRING([--disable-xattr],
|
||||
|
@ -160,7 +160,7 @@
|
||||
/* Define to 1 if you have the <attr/xattr.h> header file. */
|
||||
/* #undef HAVE_ATTR_XATTR_H */
|
||||
|
||||
/* Define to 1 if you have the <Bcrypt.h> header file. */
|
||||
/* Define to 1 if you have the <bcrypt.h> header file. */
|
||||
#define HAVE_BCRYPT_H
|
||||
|
||||
/* Define to 1 if you have the <bzlib.h> header file. */
|
||||
|
@ -156,7 +156,11 @@ cpio_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||
{
|
||||
wchar_t *wpath;
|
||||
HANDLE handle;
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
#endif
|
||||
|
||||
#if !defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
|
||||
handle = CreateFileA(path, dwDesiredAccess, dwShareMode,
|
||||
lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
|
||||
hTemplateFile);
|
||||
@ -164,12 +168,25 @@ cpio_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||
return (handle);
|
||||
if (GetLastError() != ERROR_PATH_NOT_FOUND)
|
||||
return (handle);
|
||||
#endif
|
||||
wpath = permissive_name(path);
|
||||
if (wpath == NULL)
|
||||
return (handle);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileAttributes = dwFlagsAndAttributes & 0xFFFF;
|
||||
createExParams.dwFileFlags = dwFlagsAndAttributes & 0xFFF00000;
|
||||
createExParams.dwSecurityQosFlags = dwFlagsAndAttributes & 0x000F0000;
|
||||
createExParams.lpSecurityAttributes = lpSecurityAttributes;
|
||||
createExParams.hTemplateFile = hTemplateFile;
|
||||
handle = CreateFile2(wpath, dwDesiredAccess, dwShareMode,
|
||||
dwCreationDisposition, &createExParams);
|
||||
#else
|
||||
handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode,
|
||||
lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
|
||||
hTemplateFile);
|
||||
#endif
|
||||
free(wpath);
|
||||
return (handle);
|
||||
}
|
||||
|
@ -243,10 +243,12 @@ ELSEIF(ARCHIVE_ACL_SUNOS)
|
||||
ENDIF()
|
||||
|
||||
# Libarchive is a shared library
|
||||
ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS})
|
||||
TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .)
|
||||
TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS})
|
||||
SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION})
|
||||
IF(BUILD_SHARED_LIBS)
|
||||
ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS})
|
||||
TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .)
|
||||
TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS})
|
||||
SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION})
|
||||
ENDIF(BUILD_SHARED_LIBS)
|
||||
|
||||
# archive_static is a static library
|
||||
ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS})
|
||||
@ -254,13 +256,19 @@ TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS})
|
||||
SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS
|
||||
LIBARCHIVE_STATIC)
|
||||
# On Posix systems, libarchive.so and libarchive.a can co-exist.
|
||||
IF(NOT WIN32 OR CYGWIN)
|
||||
IF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS)
|
||||
SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive)
|
||||
ENDIF(NOT WIN32 OR CYGWIN)
|
||||
ENDIF(NOT WIN32 OR CYGWIN OR NOT BUILD_SHARED_LIBS)
|
||||
|
||||
IF(ENABLE_INSTALL)
|
||||
# How to install the libraries
|
||||
INSTALL(TARGETS archive archive_static
|
||||
IF(BUILD_SHARED_LIBS)
|
||||
INSTALL(TARGETS archive
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
ENDIF(BUILD_SHARED_LIBS)
|
||||
INSTALL(TARGETS archive_static
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
@ -36,7 +36,7 @@
|
||||
* assert that ARCHIVE_VERSION_NUMBER >= 2012108.
|
||||
*/
|
||||
/* Note: Compiler will complain if this does not match archive_entry.h! */
|
||||
#define ARCHIVE_VERSION_NUMBER 3006003
|
||||
#define ARCHIVE_VERSION_NUMBER 3007000
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <stddef.h> /* for wchar_t */
|
||||
@ -157,7 +157,7 @@ __LA_DECL int archive_version_number(void);
|
||||
/*
|
||||
* Textual name/version of the library, useful for version displays.
|
||||
*/
|
||||
#define ARCHIVE_VERSION_ONLY_STRING "3.6.3dev"
|
||||
#define ARCHIVE_VERSION_ONLY_STRING "3.7.0"
|
||||
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
|
||||
__LA_DECL const char * archive_version_string(void);
|
||||
|
||||
|
@ -36,6 +36,11 @@
|
||||
#error Cannot use both OpenSSL and libmd.
|
||||
#endif
|
||||
|
||||
/* Common in other bcrypt implementations, but missing from VS2008. */
|
||||
#ifndef BCRYPT_SUCCESS
|
||||
#define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Message digest functions for Windows platform.
|
||||
*/
|
||||
@ -48,6 +53,26 @@
|
||||
/*
|
||||
* Initialize a Message digest.
|
||||
*/
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
static int
|
||||
win_crypto_init(Digest_CTX *ctx, const WCHAR *algo)
|
||||
{
|
||||
NTSTATUS status;
|
||||
ctx->valid = 0;
|
||||
|
||||
status = BCryptOpenAlgorithmProvider(&ctx->hAlg, algo, NULL, 0);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
return (ARCHIVE_FAILED);
|
||||
status = BCryptCreateHash(ctx->hAlg, &ctx->hHash, NULL, 0, NULL, 0, 0);
|
||||
if (!BCRYPT_SUCCESS(status)) {
|
||||
BCryptCloseAlgorithmProvider(ctx->hAlg, 0);
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
|
||||
ctx->valid = 1;
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
#else
|
||||
static int
|
||||
win_crypto_init(Digest_CTX *ctx, DWORD prov, ALG_ID algId)
|
||||
{
|
||||
@ -70,6 +95,7 @@ win_crypto_init(Digest_CTX *ctx, DWORD prov, ALG_ID algId)
|
||||
ctx->valid = 1;
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Update a Message digest.
|
||||
@ -81,23 +107,37 @@ win_crypto_Update(Digest_CTX *ctx, const unsigned char *buf, size_t len)
|
||||
if (!ctx->valid)
|
||||
return (ARCHIVE_FAILED);
|
||||
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
BCryptHashData(ctx->hHash,
|
||||
(PUCHAR)(uintptr_t)buf,
|
||||
len, 0);
|
||||
#else
|
||||
CryptHashData(ctx->hash,
|
||||
(unsigned char *)(uintptr_t)buf,
|
||||
(DWORD)len, 0);
|
||||
#endif
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
||||
static int
|
||||
win_crypto_Final(unsigned char *buf, size_t bufsize, Digest_CTX *ctx)
|
||||
{
|
||||
#if !(defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA)
|
||||
DWORD siglen = (DWORD)bufsize;
|
||||
#endif
|
||||
|
||||
if (!ctx->valid)
|
||||
return (ARCHIVE_FAILED);
|
||||
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
BCryptFinishHash(ctx->hHash, buf, (ULONG)bufsize, 0);
|
||||
BCryptDestroyHash(ctx->hHash);
|
||||
BCryptCloseAlgorithmProvider(ctx->hAlg, 0);
|
||||
#else
|
||||
CryptGetHashParam(ctx->hash, HP_HASHVAL, buf, &siglen, 0);
|
||||
CryptDestroyHash(ctx->hash);
|
||||
CryptReleaseContext(ctx->cryptProv, 0);
|
||||
#endif
|
||||
ctx->valid = 0;
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
@ -276,7 +316,11 @@ __archive_md5final(archive_md5_ctx *ctx, void *md)
|
||||
static int
|
||||
__archive_md5init(archive_md5_ctx *ctx)
|
||||
{
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
return (win_crypto_init(ctx, BCRYPT_MD5_ALGORITHM));
|
||||
#else
|
||||
return (win_crypto_init(ctx, PROV_RSA_FULL, CALG_MD5));
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
@ -659,7 +703,11 @@ __archive_sha1final(archive_sha1_ctx *ctx, void *md)
|
||||
static int
|
||||
__archive_sha1init(archive_sha1_ctx *ctx)
|
||||
{
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
return (win_crypto_init(ctx, BCRYPT_SHA1_ALGORITHM));
|
||||
#else
|
||||
return (win_crypto_init(ctx, PROV_RSA_FULL, CALG_SHA1));
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
@ -919,7 +967,11 @@ __archive_sha256final(archive_sha256_ctx *ctx, void *md)
|
||||
static int
|
||||
__archive_sha256init(archive_sha256_ctx *ctx)
|
||||
{
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
return (win_crypto_init(ctx, BCRYPT_SHA256_ALGORITHM));
|
||||
#else
|
||||
return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_256));
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1155,7 +1207,11 @@ __archive_sha384final(archive_sha384_ctx *ctx, void *md)
|
||||
static int
|
||||
__archive_sha384init(archive_sha384_ctx *ctx)
|
||||
{
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
return (win_crypto_init(ctx, BCRYPT_SHA384_ALGORITHM));
|
||||
#else
|
||||
return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_384));
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
@ -1415,7 +1471,11 @@ __archive_sha512final(archive_sha512_ctx *ctx, void *md)
|
||||
static int
|
||||
__archive_sha512init(archive_sha512_ctx *ctx)
|
||||
{
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
return (win_crypto_init(ctx, BCRYPT_SHA512_ALGORITHM));
|
||||
#else
|
||||
return (win_crypto_init(ctx, PROV_RSA_AES, CALG_SHA_512));
|
||||
#endif
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -164,6 +164,15 @@
|
||||
defined(ARCHIVE_CRYPTO_SHA256_WIN) ||\
|
||||
defined(ARCHIVE_CRYPTO_SHA384_WIN) ||\
|
||||
defined(ARCHIVE_CRYPTO_SHA512_WIN)
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
/* don't use bcrypt when XP needs to be supported */
|
||||
#include <bcrypt.h>
|
||||
typedef struct {
|
||||
int valid;
|
||||
BCRYPT_ALG_HANDLE hAlg;
|
||||
BCRYPT_HASH_HANDLE hHash;
|
||||
} Digest_CTX;
|
||||
#else
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
typedef struct {
|
||||
@ -172,6 +181,7 @@ typedef struct {
|
||||
HCRYPTHASH hash;
|
||||
} Digest_CTX;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* typedefs */
|
||||
#if defined(ARCHIVE_CRYPTO_MD5_LIBC)
|
||||
|
@ -30,7 +30,7 @@
|
||||
#define ARCHIVE_ENTRY_H_INCLUDED
|
||||
|
||||
/* Note: Compiler will complain if this does not match archive.h! */
|
||||
#define ARCHIVE_VERSION_NUMBER 3006003
|
||||
#define ARCHIVE_VERSION_NUMBER 3007000
|
||||
|
||||
/*
|
||||
* Note: archive_entry.h is for use outside of libarchive; the
|
||||
|
@ -33,7 +33,8 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/opensslv.h>
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||
#if OPENSSL_VERSION_NUMBER < 0x10100000L || \
|
||||
(defined(LIBRESSL_VERSION_NUMBER) && LIBRESSL_VERSION_NUMBER < 0x2070000fL)
|
||||
#include <stdlib.h> /* malloc, free */
|
||||
#include <string.h> /* memset */
|
||||
static inline EVP_MD_CTX *EVP_MD_CTX_new(void)
|
||||
|
@ -51,16 +51,27 @@ __FBSDID("$FreeBSD$");
|
||||
#include <pthread.h>
|
||||
#endif
|
||||
|
||||
static void arc4random_buf(void *, size_t);
|
||||
static void la_arc4random_buf(void *, size_t);
|
||||
|
||||
#endif /* HAVE_ARC4RANDOM_BUF */
|
||||
|
||||
#include "archive.h"
|
||||
#include "archive_random_private.h"
|
||||
|
||||
#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
/* don't use bcrypt when XP needs to be supported */
|
||||
#include <bcrypt.h>
|
||||
|
||||
/* Common in other bcrypt implementations, but missing from VS2008. */
|
||||
#ifndef BCRYPT_SUCCESS
|
||||
#define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS)
|
||||
#endif
|
||||
|
||||
#elif defined(HAVE_WINCRYPT_H)
|
||||
#include <wincrypt.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef O_CLOEXEC
|
||||
#define O_CLOEXEC 0
|
||||
@ -75,6 +86,20 @@ int
|
||||
archive_random(void *buf, size_t nbytes)
|
||||
{
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
# if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
NTSTATUS status;
|
||||
BCRYPT_ALG_HANDLE hAlg;
|
||||
|
||||
status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_RNG_ALGORITHM, NULL, 0);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
return ARCHIVE_FAILED;
|
||||
status = BCryptGenRandom(hAlg, buf, nbytes, 0);
|
||||
BCryptCloseAlgorithmProvider(hAlg, 0);
|
||||
if (!BCRYPT_SUCCESS(status))
|
||||
return ARCHIVE_FAILED;
|
||||
|
||||
return ARCHIVE_OK;
|
||||
# else
|
||||
HCRYPTPROV hProv;
|
||||
BOOL success;
|
||||
|
||||
@ -92,6 +117,10 @@ archive_random(void *buf, size_t nbytes)
|
||||
}
|
||||
/* TODO: Does this case really happen? */
|
||||
return ARCHIVE_FAILED;
|
||||
# endif
|
||||
#elif !defined(HAVE_ARC4RANDOM_BUF) && (!defined(_WIN32) || defined(__CYGWIN__))
|
||||
la_arc4random_buf(buf, nbytes);
|
||||
return ARCHIVE_OK;
|
||||
#else
|
||||
arc4random_buf(buf, nbytes);
|
||||
return ARCHIVE_OK;
|
||||
@ -256,7 +285,7 @@ arc4_getbyte(void)
|
||||
}
|
||||
|
||||
static void
|
||||
arc4random_buf(void *_buf, size_t n)
|
||||
la_arc4random_buf(void *_buf, size_t n)
|
||||
{
|
||||
uint8_t *buf = (uint8_t *)_buf;
|
||||
_ARC4_LOCK();
|
||||
|
@ -1670,6 +1670,11 @@ setup_current_filesystem(struct archive_read_disk *a)
|
||||
else
|
||||
t->current_filesystem->name_max = nm;
|
||||
#endif
|
||||
if (t->current_filesystem->name_max == 0) {
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
"Cannot determine name_max");
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
#endif /* USE_READDIR_R */
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
@ -1860,7 +1865,16 @@ setup_current_filesystem(struct archive_read_disk *a)
|
||||
|
||||
#if defined(USE_READDIR_R)
|
||||
/* Set maximum filename length. */
|
||||
#if defined(HAVE_STATVFS)
|
||||
t->current_filesystem->name_max = svfs.f_namelen;
|
||||
#else
|
||||
t->current_filesystem->name_max = sfs.f_namelen;
|
||||
#endif
|
||||
if (t->current_filesystem->name_max == 0) {
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
"Cannot determine name_max");
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
#endif
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
@ -1942,6 +1956,11 @@ setup_current_filesystem(struct archive_read_disk *a)
|
||||
#if defined(USE_READDIR_R)
|
||||
/* Set maximum filename length. */
|
||||
t->current_filesystem->name_max = svfs.f_namemax;
|
||||
if (t->current_filesystem->name_max == 0) {
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
"Cannot determine name_max");
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
#endif
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
@ -1996,6 +2015,11 @@ setup_current_filesystem(struct archive_read_disk *a)
|
||||
else
|
||||
t->current_filesystem->name_max = nm;
|
||||
# endif /* _PC_NAME_MAX */
|
||||
if (t->current_filesystem->name_max == 0) {
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
"Cannot determine name_max");
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
#endif /* USE_READDIR_R */
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
@ -2543,7 +2567,11 @@ tree_current_lstat(struct tree *t)
|
||||
#else
|
||||
if (tree_enter_working_dir(t) != 0)
|
||||
return NULL;
|
||||
#ifdef HAVE_LSTAT
|
||||
if (lstat(tree_current_access_path(t), &t->lst) != 0)
|
||||
#else
|
||||
if (la_stat(tree_current_access_path(t), &t->lst) != 0)
|
||||
#endif
|
||||
#endif
|
||||
return NULL;
|
||||
t->flags |= hasLstat;
|
||||
|
@ -418,9 +418,19 @@ la_linkname_from_pathw(const wchar_t *path, wchar_t **outbuf, int *linktype)
|
||||
FILE_FLAG_OPEN_REPARSE_POINT;
|
||||
int ret;
|
||||
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileFlags = flag;
|
||||
h = CreateFile2(path, 0,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
OPEN_EXISTING, &createExParams);
|
||||
#else
|
||||
h = CreateFileW(path, 0,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
|
||||
OPEN_EXISTING, flag, NULL);
|
||||
#endif
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
la_dosmaperr(GetLastError());
|
||||
return (-1);
|
||||
@ -1067,16 +1077,29 @@ next_entry(struct archive_read_disk *a, struct tree *t,
|
||||
if (archive_entry_filetype(entry) == AE_IFREG &&
|
||||
archive_entry_size(entry) > 0) {
|
||||
DWORD flags = FILE_FLAG_BACKUP_SEMANTICS;
|
||||
#if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
#endif
|
||||
if (t->async_io)
|
||||
flags |= FILE_FLAG_OVERLAPPED;
|
||||
if (t->direct_io)
|
||||
flags |= FILE_FLAG_NO_BUFFERING;
|
||||
else
|
||||
flags |= FILE_FLAG_SEQUENTIAL_SCAN;
|
||||
#if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileFlags = flags;
|
||||
t->entry_fh = CreateFile2(tree_current_access_path(t),
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
OPEN_EXISTING, &createExParams);
|
||||
#else
|
||||
t->entry_fh = CreateFileW(tree_current_access_path(t),
|
||||
GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
NULL, OPEN_EXISTING, flags, NULL);
|
||||
#endif
|
||||
if (t->entry_fh == INVALID_HANDLE_VALUE) {
|
||||
la_dosmaperr(GetLastError());
|
||||
archive_set_error(&a->archive, errno,
|
||||
@ -1547,6 +1570,9 @@ close_and_restore_time(HANDLE h, struct tree *t, struct restore_time *rt)
|
||||
{
|
||||
HANDLE handle;
|
||||
int r = 0;
|
||||
#if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
#endif
|
||||
|
||||
if (h == INVALID_HANDLE_VALUE && AE_IFLNK == rt->filetype)
|
||||
return (0);
|
||||
@ -1560,8 +1586,16 @@ close_and_restore_time(HANDLE h, struct tree *t, struct restore_time *rt)
|
||||
if ((t->flags & needsRestoreTimes) == 0)
|
||||
return (r);
|
||||
|
||||
#if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS;
|
||||
handle = CreateFile2(rt->full_path, FILE_WRITE_ATTRIBUTES,
|
||||
0, OPEN_EXISTING, &createExParams);
|
||||
#else
|
||||
handle = CreateFileW(rt->full_path, FILE_WRITE_ATTRIBUTES,
|
||||
0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
#endif
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
errno = EINVAL;
|
||||
return (-1);
|
||||
@ -2046,12 +2080,24 @@ tree_current_file_information(struct tree *t, BY_HANDLE_FILE_INFORMATION *st,
|
||||
HANDLE h;
|
||||
int r;
|
||||
DWORD flag = FILE_FLAG_BACKUP_SEMANTICS;
|
||||
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
#endif
|
||||
|
||||
if (sim_lstat && tree_current_is_physical_link(t))
|
||||
flag |= FILE_FLAG_OPEN_REPARSE_POINT;
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileFlags = flag;
|
||||
h = CreateFile2(tree_current_access_path(t), 0,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
OPEN_EXISTING, &createExParams);
|
||||
#else
|
||||
h = CreateFileW(tree_current_access_path(t), 0,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
|
||||
OPEN_EXISTING, flag, NULL);
|
||||
#endif
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
la_dosmaperr(GetLastError());
|
||||
t->tree_errno = errno;
|
||||
@ -2257,7 +2303,10 @@ archive_read_disk_entry_from_file(struct archive *_a,
|
||||
} else {
|
||||
WIN32_FIND_DATAW findData;
|
||||
DWORD flag, desiredAccess;
|
||||
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
#endif
|
||||
|
||||
h = FindFirstFileW(path, &findData);
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
la_dosmaperr(GetLastError());
|
||||
@ -2279,9 +2328,18 @@ archive_read_disk_entry_from_file(struct archive *_a,
|
||||
} else
|
||||
desiredAccess = GENERIC_READ;
|
||||
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileFlags = flag;
|
||||
h = CreateFile2(path, desiredAccess,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
OPEN_EXISTING, &createExParams);
|
||||
#else
|
||||
h = CreateFileW(path, desiredAccess,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
|
||||
OPEN_EXISTING, flag, NULL);
|
||||
#endif
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
la_dosmaperr(GetLastError());
|
||||
archive_set_error(&a->archive, errno,
|
||||
@ -2342,9 +2400,19 @@ archive_read_disk_entry_from_file(struct archive *_a,
|
||||
if (fd >= 0) {
|
||||
h = (HANDLE)_get_osfhandle(fd);
|
||||
} else {
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS;
|
||||
h = CreateFile2(path, GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
|
||||
OPEN_EXISTING, &createExParams);
|
||||
#else
|
||||
h = CreateFileW(path, GENERIC_READ,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL,
|
||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
#endif
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
la_dosmaperr(GetLastError());
|
||||
archive_set_error(&a->archive, errno,
|
||||
|
@ -255,6 +255,27 @@ have been concatenated together.
|
||||
Without this option, only the contents of
|
||||
the first concatenated archive would be read.
|
||||
.El
|
||||
.It Format zip
|
||||
.Bl -tag -compact -width indent
|
||||
.It Cm compat-2x
|
||||
Libarchive 2.x incorrectly encoded Unicode filenames on
|
||||
some platforms.
|
||||
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 file names.
|
||||
.It Cm ignorecrc32
|
||||
Skip the CRC32 check.
|
||||
Mostly used for testing.
|
||||
.It Cm mac-ext
|
||||
Support Mac OS metadata extension that records data in special
|
||||
files beginning with a period and underscore.
|
||||
Defaults to enabled on Mac OS, disabled on other platforms.
|
||||
Use
|
||||
.Cm !mac-ext
|
||||
to disable.
|
||||
.El
|
||||
.El
|
||||
.\"
|
||||
.Sh ERRORS
|
||||
|
@ -41,6 +41,9 @@ __FBSDID("$FreeBSD$");
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
#ifdef HAVE_ZSTD_H
|
||||
#include <zstd.h>
|
||||
#endif
|
||||
|
||||
#include "archive.h"
|
||||
#include "archive_entry.h"
|
||||
@ -80,8 +83,11 @@ __FBSDID("$FreeBSD$");
|
||||
#define _7Z_IA64 0x03030401
|
||||
#define _7Z_ARM 0x03030501
|
||||
#define _7Z_ARMTHUMB 0x03030701
|
||||
#define _7Z_ARM64 0xa
|
||||
#define _7Z_SPARC 0x03030805
|
||||
|
||||
#define _7Z_ZSTD 0x4F71101 /* Copied from https://github.com/mcmilk/7-Zip-zstd.git */
|
||||
|
||||
/*
|
||||
* 7-Zip header property IDs.
|
||||
*/
|
||||
@ -277,6 +283,11 @@ struct _7zip {
|
||||
#ifdef HAVE_ZLIB_H
|
||||
z_stream stream;
|
||||
int stream_valid;
|
||||
#endif
|
||||
/* Decoding Zstandard data. */
|
||||
#if HAVE_ZSTD_H
|
||||
ZSTD_DStream *zstd_dstream;
|
||||
int zstdstream_valid;
|
||||
#endif
|
||||
/* Decoding PPMd data. */
|
||||
int ppmd7_stat;
|
||||
@ -397,6 +408,9 @@ static int setup_decode_folder(struct archive_read *, struct _7z_folder *,
|
||||
int);
|
||||
static void x86_Init(struct _7zip *);
|
||||
static size_t x86_Convert(struct _7zip *, uint8_t *, size_t);
|
||||
static void arm_Init(struct _7zip *);
|
||||
static size_t arm_Convert(struct _7zip *, uint8_t *, size_t);
|
||||
static size_t arm64_Convert(struct _7zip *, uint8_t *, size_t);
|
||||
static ssize_t Bcj2_Decode(struct _7zip *, uint8_t *, size_t);
|
||||
|
||||
|
||||
@ -1027,10 +1041,13 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
|
||||
case _7Z_COPY:
|
||||
case _7Z_BZ2:
|
||||
case _7Z_DEFLATE:
|
||||
case _7Z_ZSTD:
|
||||
case _7Z_PPMD:
|
||||
if (coder2 != NULL) {
|
||||
if (coder2->codec != _7Z_X86 &&
|
||||
coder2->codec != _7Z_X86_BCJ2) {
|
||||
coder2->codec != _7Z_X86_BCJ2 &&
|
||||
coder2->codec != _7Z_ARM &&
|
||||
coder2->codec != _7Z_ARM64) {
|
||||
archive_set_error(&a->archive,
|
||||
ARCHIVE_ERRNO_MISC,
|
||||
"Unsupported filter %lx for %lx",
|
||||
@ -1041,6 +1058,8 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
|
||||
zip->bcj_state = 0;
|
||||
if (coder2->codec == _7Z_X86)
|
||||
x86_Init(zip);
|
||||
else if (coder2->codec == _7Z_ARM)
|
||||
arm_Init(zip);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@ -1137,6 +1156,12 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
|
||||
filters[fi].id = LZMA_FILTER_ARMTHUMB;
|
||||
fi++;
|
||||
break;
|
||||
#ifdef LZMA_FILTER_ARM64
|
||||
case _7Z_ARM64:
|
||||
filters[fi].id = LZMA_FILTER_ARM64;
|
||||
fi++;
|
||||
break;
|
||||
#endif
|
||||
case _7Z_SPARC:
|
||||
filters[fi].id = LZMA_FILTER_SPARC;
|
||||
fi++;
|
||||
@ -1222,6 +1247,22 @@ init_decompression(struct archive_read *a, struct _7zip *zip,
|
||||
"BZ2 codec is unsupported");
|
||||
return (ARCHIVE_FAILED);
|
||||
#endif
|
||||
case _7Z_ZSTD:
|
||||
{
|
||||
#if defined(HAVE_ZSTD_H)
|
||||
if (zip->zstdstream_valid) {
|
||||
ZSTD_freeDStream(zip->zstd_dstream);
|
||||
zip->zstdstream_valid = 0;
|
||||
}
|
||||
zip->zstd_dstream = ZSTD_createDStream();
|
||||
zip->zstdstream_valid = 1;
|
||||
break;
|
||||
#else
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
"ZSTD codec is unsupported");
|
||||
return (ARCHIVE_FAILED);
|
||||
#endif
|
||||
}
|
||||
case _7Z_DEFLATE:
|
||||
#ifdef HAVE_ZLIB_H
|
||||
if (zip->stream_valid)
|
||||
@ -1487,6 +1528,22 @@ decompress(struct archive_read *a, struct _7zip *zip,
|
||||
t_avail_in = zip->stream.avail_in;
|
||||
t_avail_out = zip->stream.avail_out;
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_ZSTD_H
|
||||
case _7Z_ZSTD:
|
||||
{
|
||||
ZSTD_inBuffer input = { t_next_in, t_avail_in, 0 }; // src, size, pos
|
||||
ZSTD_outBuffer output = { t_next_out, t_avail_out, 0 }; // dst, size, pos
|
||||
|
||||
size_t const zret = ZSTD_decompressStream(zip->zstd_dstream, &output, &input);
|
||||
if (ZSTD_isError(zret)) {
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Zstd decompression failed: %s", ZSTD_getErrorName(zret));
|
||||
return ARCHIVE_FAILED;
|
||||
}
|
||||
t_avail_in -= input.pos;
|
||||
t_avail_out -= output.pos;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case _7Z_PPMD:
|
||||
{
|
||||
@ -1572,16 +1629,23 @@ decompress(struct archive_read *a, struct _7zip *zip,
|
||||
/*
|
||||
* Decord BCJ.
|
||||
*/
|
||||
if (zip->codec != _7Z_LZMA2 && zip->codec2 == _7Z_X86) {
|
||||
size_t l = x86_Convert(zip, buff, *outbytes);
|
||||
zip->odd_bcj_size = *outbytes - l;
|
||||
if (zip->odd_bcj_size > 0 && zip->odd_bcj_size <= 4 &&
|
||||
o_avail_in && ret != ARCHIVE_EOF) {
|
||||
memcpy(zip->odd_bcj, ((unsigned char *)buff) + l,
|
||||
zip->odd_bcj_size);
|
||||
*outbytes = l;
|
||||
} else
|
||||
zip->odd_bcj_size = 0;
|
||||
if (zip->codec != _7Z_LZMA2) {
|
||||
if (zip->codec2 == _7Z_X86) {
|
||||
size_t l = x86_Convert(zip, buff, *outbytes);
|
||||
|
||||
zip->odd_bcj_size = *outbytes - l;
|
||||
if (zip->odd_bcj_size > 0 && zip->odd_bcj_size <= 4 &&
|
||||
o_avail_in && ret != ARCHIVE_EOF) {
|
||||
memcpy(zip->odd_bcj, ((unsigned char *)buff) + l,
|
||||
zip->odd_bcj_size);
|
||||
*outbytes = l;
|
||||
} else
|
||||
zip->odd_bcj_size = 0;
|
||||
} else if (zip->codec2 == _7Z_ARM) {
|
||||
*outbytes = arm_Convert(zip, buff, *outbytes);
|
||||
} else if (zip->codec2 == _7Z_ARM64) {
|
||||
*outbytes = arm64_Convert(zip, buff, *outbytes);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3727,6 +3791,116 @@ x86_Convert(struct _7zip *zip, uint8_t *data, size_t size)
|
||||
return (bufferPos);
|
||||
}
|
||||
|
||||
static void
|
||||
arm_Init(struct _7zip *zip)
|
||||
{
|
||||
zip->bcj_ip = 8;
|
||||
}
|
||||
|
||||
static size_t
|
||||
arm_Convert(struct _7zip *zip, uint8_t *buf, size_t size)
|
||||
{
|
||||
// This function was adapted from
|
||||
// static size_t bcj_arm(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
|
||||
// in https://git.tukaani.org/xz-embedded.git
|
||||
|
||||
/*
|
||||
* Branch/Call/Jump (BCJ) filter decoders
|
||||
*
|
||||
* Authors: Lasse Collin <lasse.collin@tukaani.org>
|
||||
* Igor Pavlov <https://7-zip.org/>
|
||||
*
|
||||
* This file has been put into the public domain.
|
||||
* You can do whatever you want with this file.
|
||||
*/
|
||||
|
||||
size_t i;
|
||||
uint32_t addr;
|
||||
|
||||
for (i = 0; i + 4 <= size; i += 4) {
|
||||
if (buf[i + 3] == 0xEB) {
|
||||
// Calculate the transformed addr.
|
||||
addr = (uint32_t)buf[i] | ((uint32_t)buf[i + 1] << 8)
|
||||
| ((uint32_t)buf[i + 2] << 16);
|
||||
addr <<= 2;
|
||||
addr -= zip->bcj_ip + (uint32_t)i;
|
||||
addr >>= 2;
|
||||
|
||||
// Store the transformed addr in buf.
|
||||
buf[i] = (uint8_t)addr;
|
||||
buf[i + 1] = (uint8_t)(addr >> 8);
|
||||
buf[i + 2] = (uint8_t)(addr >> 16);
|
||||
}
|
||||
}
|
||||
|
||||
zip->bcj_ip += i;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
static size_t
|
||||
arm64_Convert(struct _7zip *zip, uint8_t *buf, size_t size)
|
||||
{
|
||||
// This function was adapted from
|
||||
// static size_t bcj_arm64(struct xz_dec_bcj *s, uint8_t *buf, size_t size)
|
||||
// in https://git.tukaani.org/xz-embedded.git
|
||||
|
||||
/*
|
||||
* Branch/Call/Jump (BCJ) filter decoders
|
||||
*
|
||||
* Authors: Lasse Collin <lasse.collin@tukaani.org>
|
||||
* Igor Pavlov <https://7-zip.org/>
|
||||
*
|
||||
* This file has been put into the public domain.
|
||||
* You can do whatever you want with this file.
|
||||
*/
|
||||
|
||||
size_t i;
|
||||
uint32_t instr;
|
||||
uint32_t addr;
|
||||
|
||||
for (i = 0; i + 4 <= size; i += 4) {
|
||||
instr = (uint32_t)buf[i]
|
||||
| ((uint32_t)buf[i+1] << 8)
|
||||
| ((uint32_t)buf[i+2] << 16)
|
||||
| ((uint32_t)buf[i+3] << 24);
|
||||
|
||||
if ((instr >> 26) == 0x25) {
|
||||
/* BL instruction */
|
||||
addr = instr - ((zip->bcj_ip + (uint32_t)i) >> 2);
|
||||
instr = 0x94000000 | (addr & 0x03FFFFFF);
|
||||
|
||||
buf[i] = (uint8_t)instr;
|
||||
buf[i+1] = (uint8_t)(instr >> 8);
|
||||
buf[i+2] = (uint8_t)(instr >> 16);
|
||||
buf[i+3] = (uint8_t)(instr >> 24);
|
||||
} else if ((instr & 0x9F000000) == 0x90000000) {
|
||||
/* ADRP instruction */
|
||||
addr = ((instr >> 29) & 3) | ((instr >> 3) & 0x1FFFFC);
|
||||
|
||||
/* Only convert values in the range +/-512 MiB. */
|
||||
if ((addr + 0x020000) & 0x1C0000)
|
||||
continue;
|
||||
|
||||
addr -= (zip->bcj_ip + (uint32_t)i) >> 12;
|
||||
|
||||
instr &= 0x9000001F;
|
||||
instr |= (addr & 3) << 29;
|
||||
instr |= (addr & 0x03FFFC) << 3;
|
||||
instr |= (0U - (addr & 0x020000)) & 0xE00000;
|
||||
|
||||
buf[i] = (uint8_t)instr;
|
||||
buf[i+1] = (uint8_t)(instr >> 8);
|
||||
buf[i+2] = (uint8_t)(instr >> 16);
|
||||
buf[i+3] = (uint8_t)(instr >> 24);
|
||||
}
|
||||
}
|
||||
|
||||
zip->bcj_ip += i;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
/*
|
||||
* Brought from LZMA SDK.
|
||||
*
|
||||
|
@ -2294,10 +2294,10 @@ lzx_br_fillup(struct lzx_stream *strm, struct lzx_br *br)
|
||||
(br->cache_buffer << 48) |
|
||||
((uint64_t)strm->next_in[1]) << 40 |
|
||||
((uint64_t)strm->next_in[0]) << 32 |
|
||||
((uint32_t)strm->next_in[3]) << 24 |
|
||||
((uint32_t)strm->next_in[2]) << 16 |
|
||||
((uint32_t)strm->next_in[5]) << 8 |
|
||||
(uint32_t)strm->next_in[4];
|
||||
((uint64_t)strm->next_in[3]) << 24 |
|
||||
((uint64_t)strm->next_in[2]) << 16 |
|
||||
((uint64_t)strm->next_in[5]) << 8 |
|
||||
(uint64_t)strm->next_in[4];
|
||||
strm->next_in += 6;
|
||||
strm->avail_in -= 6;
|
||||
br->cache_avail += 6 * 8;
|
||||
|
@ -985,14 +985,14 @@ archive_read_format_cpio_cleanup(struct archive_read *a)
|
||||
static int64_t
|
||||
le4(const unsigned char *p)
|
||||
{
|
||||
return ((p[0] << 16) + (((int64_t)p[1]) << 24) + (p[2] << 0) + (p[3] << 8));
|
||||
return ((p[0] << 16) | (((int64_t)p[1]) << 24) | (p[2] << 0) | (p[3] << 8));
|
||||
}
|
||||
|
||||
|
||||
static int64_t
|
||||
be4(const unsigned char *p)
|
||||
{
|
||||
return ((((int64_t)p[0]) << 24) + (p[1] << 16) + (p[2] << 8) + (p[3]));
|
||||
return ((((int64_t)p[0]) << 24) | (p[1] << 16) | (p[2] << 8) | (p[3]));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -2009,10 +2009,10 @@ lzh_br_fillup(struct lzh_stream *strm, struct lzh_br *br)
|
||||
((uint64_t)strm->next_in[0]) << 48 |
|
||||
((uint64_t)strm->next_in[1]) << 40 |
|
||||
((uint64_t)strm->next_in[2]) << 32 |
|
||||
((uint32_t)strm->next_in[3]) << 24 |
|
||||
((uint32_t)strm->next_in[4]) << 16 |
|
||||
((uint32_t)strm->next_in[5]) << 8 |
|
||||
(uint32_t)strm->next_in[6];
|
||||
((uint64_t)strm->next_in[3]) << 24 |
|
||||
((uint64_t)strm->next_in[4]) << 16 |
|
||||
((uint64_t)strm->next_in[5]) << 8 |
|
||||
(uint64_t)strm->next_in[6];
|
||||
strm->next_in += 7;
|
||||
strm->avail_in -= 7;
|
||||
br->cache_avail += 7 * 8;
|
||||
@ -2022,10 +2022,10 @@ lzh_br_fillup(struct lzh_stream *strm, struct lzh_br *br)
|
||||
(br->cache_buffer << 48) |
|
||||
((uint64_t)strm->next_in[0]) << 40 |
|
||||
((uint64_t)strm->next_in[1]) << 32 |
|
||||
((uint32_t)strm->next_in[2]) << 24 |
|
||||
((uint32_t)strm->next_in[3]) << 16 |
|
||||
((uint32_t)strm->next_in[4]) << 8 |
|
||||
(uint32_t)strm->next_in[5];
|
||||
((uint64_t)strm->next_in[2]) << 24 |
|
||||
((uint64_t)strm->next_in[3]) << 16 |
|
||||
((uint64_t)strm->next_in[4]) << 8 |
|
||||
(uint64_t)strm->next_in[5];
|
||||
strm->next_in += 6;
|
||||
strm->avail_in -= 6;
|
||||
br->cache_avail += 6 * 8;
|
||||
|
@ -1280,7 +1280,13 @@ parse_file(struct archive_read *a, struct archive_entry *entry,
|
||||
mtree->fd = -1;
|
||||
st = NULL;
|
||||
}
|
||||
} else if (lstat(path, st) == -1) {
|
||||
}
|
||||
#ifdef HAVE_LSTAT
|
||||
else if (lstat(path, st) == -1)
|
||||
#else
|
||||
else if (la_stat(path, st) == -1)
|
||||
#endif
|
||||
{
|
||||
st = NULL;
|
||||
}
|
||||
|
||||
|
@ -2227,7 +2227,7 @@ zip_read_data_zipx_bzip2(struct archive_read *a, const void **buff,
|
||||
to_consume = zip->bzstream.total_in_lo32;
|
||||
__archive_read_consume(a, to_consume);
|
||||
|
||||
total_out = ((uint64_t) zip->bzstream.total_out_hi32 << 32) +
|
||||
total_out = ((uint64_t) zip->bzstream.total_out_hi32 << 32) |
|
||||
zip->bzstream.total_out_lo32;
|
||||
|
||||
zip->entry_bytes_remaining -= to_consume;
|
||||
|
@ -1324,6 +1324,10 @@ free_sconv_object(struct archive_string_conv *sc)
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
# if defined(WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
# define GetOEMCP() CP_OEMCP
|
||||
# endif
|
||||
|
||||
static unsigned
|
||||
my_atoi(const char *p)
|
||||
{
|
||||
|
@ -42,9 +42,20 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_util.c 201098 2009-12-28 02:58:1
|
||||
#ifdef HAVE_STRING_H
|
||||
#include <string.h>
|
||||
#endif
|
||||
#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
|
||||
#if defined(_WIN32) && !defined(__CYGWIN__)
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
/* don't use bcrypt when XP needs to be supported */
|
||||
#include <bcrypt.h>
|
||||
|
||||
/* Common in other bcrypt implementations, but missing from VS2008. */
|
||||
#ifndef BCRYPT_SUCCESS
|
||||
#define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS)
|
||||
#endif
|
||||
|
||||
#elif defined(HAVE_WINCRYPT_H)
|
||||
#include <wincrypt.h>
|
||||
#endif
|
||||
#endif
|
||||
#ifdef HAVE_ZLIB_H
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
@ -233,14 +244,16 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
|
||||
L'm', L'n', L'o', L'p', L'q', L'r', L's', L't',
|
||||
L'u', L'v', L'w', L'x', L'y', L'z'
|
||||
};
|
||||
HCRYPTPROV hProv;
|
||||
struct archive_wstring temp_name;
|
||||
wchar_t *ws;
|
||||
DWORD attr;
|
||||
wchar_t *xp, *ep;
|
||||
int fd;
|
||||
|
||||
hProv = (HCRYPTPROV)NULL;
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
BCRYPT_ALG_HANDLE hAlg = NULL;
|
||||
#else
|
||||
HCRYPTPROV hProv = (HCRYPTPROV)NULL;
|
||||
#endif
|
||||
fd = -1;
|
||||
ws = NULL;
|
||||
|
||||
@ -314,23 +327,42 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
|
||||
abort();
|
||||
}
|
||||
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
if (!BCRYPT_SUCCESS(BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_RNG_ALGORITHM,
|
||||
NULL, 0))) {
|
||||
la_dosmaperr(GetLastError());
|
||||
goto exit_tmpfile;
|
||||
}
|
||||
#else
|
||||
if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
|
||||
CRYPT_VERIFYCONTEXT)) {
|
||||
la_dosmaperr(GetLastError());
|
||||
goto exit_tmpfile;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (;;) {
|
||||
wchar_t *p;
|
||||
HANDLE h;
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
#endif
|
||||
|
||||
/* Generate a random file name through CryptGenRandom(). */
|
||||
p = xp;
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
if (!BCRYPT_SUCCESS(BCryptGenRandom(hAlg, (PUCHAR)p,
|
||||
(DWORD)(ep - p)*sizeof(wchar_t), 0))) {
|
||||
la_dosmaperr(GetLastError());
|
||||
goto exit_tmpfile;
|
||||
}
|
||||
#else
|
||||
if (!CryptGenRandom(hProv, (DWORD)(ep - p)*sizeof(wchar_t),
|
||||
(BYTE*)p)) {
|
||||
la_dosmaperr(GetLastError());
|
||||
goto exit_tmpfile;
|
||||
}
|
||||
#endif
|
||||
for (; p < ep; p++)
|
||||
*p = num[((DWORD)*p) % (sizeof(num)/sizeof(num[0]))];
|
||||
|
||||
@ -347,6 +379,17 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
|
||||
/* mkstemp */
|
||||
attr = FILE_ATTRIBUTE_NORMAL;
|
||||
}
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileAttributes = attr & 0xFFFF;
|
||||
createExParams.dwFileFlags = attr & 0xFFF00000;
|
||||
h = CreateFile2(ws,
|
||||
GENERIC_READ | GENERIC_WRITE | DELETE,
|
||||
0,/* Not share */
|
||||
CREATE_NEW,
|
||||
&createExParams);
|
||||
#else
|
||||
h = CreateFileW(ws,
|
||||
GENERIC_READ | GENERIC_WRITE | DELETE,
|
||||
0,/* Not share */
|
||||
@ -354,6 +397,7 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
|
||||
CREATE_NEW,/* Create a new file only */
|
||||
attr,
|
||||
NULL);
|
||||
#endif
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
/* The same file already exists. retry with
|
||||
* a new filename. */
|
||||
@ -372,8 +416,13 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
|
||||
break;/* success! */
|
||||
}
|
||||
exit_tmpfile:
|
||||
#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
|
||||
if (hAlg != NULL)
|
||||
BCryptCloseAlgorithmProvider(hAlg, 0);
|
||||
#else
|
||||
if (hProv != (HCRYPTPROV)NULL)
|
||||
CryptReleaseContext(hProv, 0);
|
||||
#endif
|
||||
free(ws);
|
||||
if (template == temp_name.s)
|
||||
archive_wstring_free(&temp_name);
|
||||
|
@ -234,7 +234,11 @@ la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||
{
|
||||
wchar_t *wpath;
|
||||
HANDLE handle;
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
#endif
|
||||
|
||||
#if !defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
|
||||
handle = CreateFileA(path, dwDesiredAccess, dwShareMode,
|
||||
lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
|
||||
hTemplateFile);
|
||||
@ -242,12 +246,25 @@ la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode,
|
||||
return (handle);
|
||||
if (GetLastError() != ERROR_PATH_NOT_FOUND)
|
||||
return (handle);
|
||||
#endif
|
||||
wpath = __la_win_permissive_name(path);
|
||||
if (wpath == NULL)
|
||||
return (handle);
|
||||
return INVALID_HANDLE_VALUE;
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileAttributes = dwFlagsAndAttributes & 0xFFFF;
|
||||
createExParams.dwFileFlags = dwFlagsAndAttributes & 0xFFF00000;
|
||||
createExParams.dwSecurityQosFlags = dwFlagsAndAttributes & 0x000F00000;
|
||||
createExParams.lpSecurityAttributes = lpSecurityAttributes;
|
||||
createExParams.hTemplateFile = hTemplateFile;
|
||||
handle = CreateFile2(wpath, dwDesiredAccess, dwShareMode,
|
||||
dwCreationDisposition, &createExParams);
|
||||
#else /* !WINAPI_PARTITION_DESKTOP */
|
||||
handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode,
|
||||
lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes,
|
||||
hTemplateFile);
|
||||
#endif /* !WINAPI_PARTITION_DESKTOP */
|
||||
free(wpath);
|
||||
return (handle);
|
||||
}
|
||||
@ -305,7 +322,10 @@ __la_open(const char *path, int flags, ...)
|
||||
* "Permission denied" error.
|
||||
*/
|
||||
attr = GetFileAttributesA(path);
|
||||
if (attr == (DWORD)-1 && GetLastError() == ERROR_PATH_NOT_FOUND) {
|
||||
#if !defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
|
||||
if (attr == (DWORD)-1 && GetLastError() == ERROR_PATH_NOT_FOUND)
|
||||
#endif
|
||||
{
|
||||
ws = __la_win_permissive_name(path);
|
||||
if (ws == NULL) {
|
||||
errno = EINVAL;
|
||||
@ -320,7 +340,7 @@ __la_open(const char *path, int flags, ...)
|
||||
}
|
||||
if (attr & FILE_ATTRIBUTE_DIRECTORY) {
|
||||
HANDLE handle;
|
||||
|
||||
#if !defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
|
||||
if (ws != NULL)
|
||||
handle = CreateFileW(ws, 0, 0, NULL,
|
||||
OPEN_EXISTING,
|
||||
@ -333,6 +353,15 @@ __la_open(const char *path, int flags, ...)
|
||||
FILE_FLAG_BACKUP_SEMANTICS |
|
||||
FILE_ATTRIBUTE_READONLY,
|
||||
NULL);
|
||||
#else /* !WINAPI_PARTITION_DESKTOP */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileAttributes = FILE_ATTRIBUTE_READONLY;
|
||||
createExParams.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS;
|
||||
handle = CreateFile2(ws, 0, 0,
|
||||
OPEN_EXISTING, &createExParams);
|
||||
#endif /* !WINAPI_PARTITION_DESKTOP */
|
||||
free(ws);
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
la_dosmaperr(GetLastError());
|
||||
|
@ -352,7 +352,7 @@ archive_compressor_compress_write(struct archive_write_filter *f,
|
||||
while (length--) {
|
||||
c = *bp++;
|
||||
state->in_count++;
|
||||
state->cur_fcode = (c << 16) + state->cur_code;
|
||||
state->cur_fcode = (c << 16) | state->cur_code;
|
||||
i = ((c << HSHIFT) ^ state->cur_code); /* Xor hashing. */
|
||||
|
||||
if (state->hashtab[i] == state->cur_fcode) {
|
||||
|
@ -451,6 +451,7 @@ archive_compressor_zstd_write(struct archive_write_filter *f, const void *buff,
|
||||
static int
|
||||
archive_compressor_zstd_flush(struct archive_write_filter *f)
|
||||
{
|
||||
(void)f; /* UNUSED */
|
||||
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
|
@ -397,6 +397,7 @@ static int set_times_from_entry(struct archive_write_disk *);
|
||||
static struct fixup_entry *sort_dir_list(struct fixup_entry *p);
|
||||
static ssize_t write_data_block(struct archive_write_disk *,
|
||||
const char *, size_t);
|
||||
static void close_file_descriptor(struct archive_write_disk *);
|
||||
|
||||
static int _archive_write_disk_close(struct archive *);
|
||||
static int _archive_write_disk_free(struct archive *);
|
||||
@ -514,7 +515,12 @@ lazy_stat(struct archive_write_disk *a)
|
||||
* XXX At this point, symlinks should not be hit, otherwise
|
||||
* XXX a race occurred. Do we want to check explicitly for that?
|
||||
*/
|
||||
if (lstat(a->name, &a->st) == 0) {
|
||||
#ifdef HAVE_LSTAT
|
||||
if (lstat(a->name, &a->st) == 0)
|
||||
#else
|
||||
if (la_stat(a->name, &a->st) == 0)
|
||||
#endif
|
||||
{
|
||||
a->pst = &a->st;
|
||||
return (ARCHIVE_OK);
|
||||
}
|
||||
@ -1726,6 +1732,7 @@ _archive_write_disk_finish_entry(struct archive *_a)
|
||||
r = hfs_write_data_block(
|
||||
a, null_d, a->file_remaining_bytes);
|
||||
if (r < 0)
|
||||
close_file_descriptor(a);
|
||||
return ((int)r);
|
||||
}
|
||||
#endif
|
||||
@ -1735,6 +1742,7 @@ _archive_write_disk_finish_entry(struct archive *_a)
|
||||
a->filesize == 0) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"File size could not be restored");
|
||||
close_file_descriptor(a);
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
#endif
|
||||
@ -1744,8 +1752,10 @@ _archive_write_disk_finish_entry(struct archive *_a)
|
||||
* to see what happened.
|
||||
*/
|
||||
a->pst = NULL;
|
||||
if ((ret = lazy_stat(a)) != ARCHIVE_OK)
|
||||
return (ret);
|
||||
if ((ret = lazy_stat(a)) != ARCHIVE_OK) {
|
||||
close_file_descriptor(a);
|
||||
return (ret);
|
||||
}
|
||||
/* We can use lseek()/write() to extend the file if
|
||||
* ftruncate didn't work or isn't available. */
|
||||
if (a->st.st_size < a->filesize) {
|
||||
@ -1753,11 +1763,13 @@ _archive_write_disk_finish_entry(struct archive *_a)
|
||||
if (lseek(a->fd, a->filesize - 1, SEEK_SET) < 0) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Seek failed");
|
||||
close_file_descriptor(a);
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
if (write(a->fd, &nul, 1) < 0) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Write to restore size failed");
|
||||
close_file_descriptor(a);
|
||||
return (ARCHIVE_FATAL);
|
||||
}
|
||||
a->pst = NULL;
|
||||
@ -2154,7 +2166,11 @@ restore_entry(struct archive_write_disk *a)
|
||||
* then don't follow it.
|
||||
*/
|
||||
if (r != 0 || !S_ISDIR(a->mode))
|
||||
#ifdef HAVE_LSTAT
|
||||
r = lstat(a->name, &a->st);
|
||||
#else
|
||||
r = la_stat(a->name, &a->st);
|
||||
#endif
|
||||
if (r != 0) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"Can't stat existing object");
|
||||
@ -2550,7 +2566,12 @@ _archive_write_disk_close(struct archive *_a)
|
||||
goto skip_fixup_entry;
|
||||
} else
|
||||
#endif
|
||||
if (lstat(p->name, &st) != 0 ||
|
||||
if (
|
||||
#ifdef HAVE_LSTAT
|
||||
lstat(p->name, &st) != 0 ||
|
||||
#else
|
||||
la_stat(p->name, &st) != 0 ||
|
||||
#endif
|
||||
la_verify_filetype(st.st_mode,
|
||||
p->filetype) == 0) {
|
||||
goto skip_fixup_entry;
|
||||
@ -2565,7 +2586,12 @@ _archive_write_disk_close(struct archive *_a)
|
||||
goto skip_fixup_entry;
|
||||
} else
|
||||
#endif
|
||||
if (lstat(p->name, &st) != 0 ||
|
||||
if (
|
||||
#ifdef HAVE_LSTAT
|
||||
lstat(p->name, &st) != 0 ||
|
||||
#else
|
||||
la_stat(p->name, &st) != 0 ||
|
||||
#endif
|
||||
la_verify_filetype(st.st_mode,
|
||||
p->filetype) == 0) {
|
||||
goto skip_fixup_entry;
|
||||
@ -2785,8 +2811,8 @@ check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr,
|
||||
!(defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT))
|
||||
/* Platform doesn't have lstat, so we can't look for symlinks. */
|
||||
(void)path; /* UNUSED */
|
||||
(void)error_number; /* UNUSED */
|
||||
(void)error_string; /* UNUSED */
|
||||
(void)a_eno; /* UNUSED */
|
||||
(void)a_estr; /* UNUSED */
|
||||
(void)flags; /* UNUSED */
|
||||
(void)checking_linkname; /* UNUSED */
|
||||
return (ARCHIVE_OK);
|
||||
@ -2859,8 +2885,10 @@ check_symlinks_fsobj(char *path, int *a_eno, struct archive_string *a_estr,
|
||||
/* Check that we haven't hit a symlink. */
|
||||
#if defined(HAVE_OPENAT) && defined(HAVE_FSTATAT) && defined(HAVE_UNLINKAT)
|
||||
r = fstatat(chdir_fd, head, &st, AT_SYMLINK_NOFOLLOW);
|
||||
#else
|
||||
#elif defined(HAVE_LSTAT)
|
||||
r = lstat(head, &st);
|
||||
#else
|
||||
r = la_stat(head, &st);
|
||||
#endif
|
||||
if (r != 0) {
|
||||
tail[0] = c;
|
||||
@ -3558,7 +3586,9 @@ set_time(int fd, int mode, const char *name,
|
||||
(void)fd; /* UNUSED */
|
||||
(void)mode; /* UNUSED */
|
||||
(void)name; /* UNUSED */
|
||||
(void)atime; /* UNUSED */
|
||||
(void)atime_nsec; /* UNUSED */
|
||||
(void)mtime; /* UNUSED */
|
||||
(void)mtime_nsec; /* UNUSED */
|
||||
return (ARCHIVE_WARN);
|
||||
#endif
|
||||
@ -4391,7 +4421,12 @@ fixup_appledouble(struct archive_write_disk *a, const char *pathname)
|
||||
*/
|
||||
archive_strncpy(&datafork, pathname, p - pathname);
|
||||
archive_strcat(&datafork, p + 2);
|
||||
if (lstat(datafork.s, &st) == -1 ||
|
||||
if (
|
||||
#ifdef HAVE_LSTAT
|
||||
lstat(datafork.s, &st) == -1 ||
|
||||
#else
|
||||
la_stat(datafork.s, &st) == -1 ||
|
||||
#endif
|
||||
(st.st_mode & AE_IFMT) != AE_IFREG)
|
||||
goto skip_appledouble;
|
||||
|
||||
@ -4707,5 +4742,17 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name,
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Close the file descriptor if one is open.
|
||||
*/
|
||||
static void close_file_descriptor(struct archive_write_disk* a)
|
||||
{
|
||||
if (a->fd >= 0) {
|
||||
close(a->fd);
|
||||
a->fd = -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* !_WIN32 || __CYGWIN__ */
|
||||
|
||||
|
@ -254,9 +254,9 @@ static ssize_t _archive_write_disk_data_block(struct archive *, const void *,
|
||||
* which is high-16-bits of nFileIndexHigh. */
|
||||
#define bhfi_ino(bhfi) \
|
||||
((((int64_t)((bhfi)->nFileIndexHigh & 0x0000FFFFUL)) << 32) \
|
||||
+ (bhfi)->nFileIndexLow)
|
||||
| (bhfi)->nFileIndexLow)
|
||||
#define bhfi_size(bhfi) \
|
||||
((((int64_t)(bhfi)->nFileSizeHigh) << 32) + (bhfi)->nFileSizeLow)
|
||||
((((int64_t)(bhfi)->nFileSizeHigh) << 32) | (bhfi)->nFileSizeLow)
|
||||
|
||||
static int
|
||||
file_information(struct archive_write_disk *a, wchar_t *path,
|
||||
@ -266,6 +266,9 @@ file_information(struct archive_write_disk *a, wchar_t *path,
|
||||
int r;
|
||||
DWORD flag = FILE_FLAG_BACKUP_SEMANTICS;
|
||||
WIN32_FIND_DATAW findData;
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
#endif
|
||||
|
||||
if (sim_lstat || mode != NULL) {
|
||||
h = FindFirstFileW(path, &findData);
|
||||
@ -290,14 +293,27 @@ file_information(struct archive_write_disk *a, wchar_t *path,
|
||||
(findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)))
|
||||
flag |= FILE_FLAG_OPEN_REPARSE_POINT;
|
||||
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileFlags = flag;
|
||||
h = CreateFile2(a->name, 0, 0,
|
||||
OPEN_EXISTING, &createExParams);
|
||||
#else
|
||||
h = CreateFileW(a->name, 0, 0, NULL,
|
||||
OPEN_EXISTING, flag, NULL);
|
||||
#endif
|
||||
if (h == INVALID_HANDLE_VALUE &&
|
||||
GetLastError() == ERROR_INVALID_NAME) {
|
||||
wchar_t *full;
|
||||
full = __la_win_permissive_name_w(path);
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
h = CreateFile2(full, 0, 0,
|
||||
OPEN_EXISTING, &createExParams);
|
||||
#else
|
||||
h = CreateFileW(full, 0, 0, NULL,
|
||||
OPEN_EXISTING, flag, NULL);
|
||||
#endif
|
||||
free(full);
|
||||
}
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
@ -559,6 +575,7 @@ la_mktemp(struct archive_write_disk *a)
|
||||
return (fd);
|
||||
}
|
||||
|
||||
#if _WIN32_WINNT < _WIN32_WINNT_VISTA
|
||||
static void *
|
||||
la_GetFunctionKernel32(const char *name)
|
||||
{
|
||||
@ -574,18 +591,24 @@ la_GetFunctionKernel32(const char *name)
|
||||
}
|
||||
return (void *)GetProcAddress(lib, name);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
la_CreateHardLinkW(wchar_t *linkname, wchar_t *target)
|
||||
{
|
||||
static BOOLEAN (WINAPI *f)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES);
|
||||
static int set;
|
||||
static BOOL (WINAPI *f)(LPCWSTR, LPCWSTR, LPSECURITY_ATTRIBUTES);
|
||||
BOOL ret;
|
||||
|
||||
#if _WIN32_WINNT < _WIN32_WINNT_XP
|
||||
static int set;
|
||||
/* CreateHardLinkW is available since XP and always loaded */
|
||||
if (!set) {
|
||||
set = 1;
|
||||
f = la_GetFunctionKernel32("CreateHardLinkW");
|
||||
}
|
||||
#else
|
||||
f = CreateHardLinkW;
|
||||
#endif
|
||||
if (!f) {
|
||||
errno = ENOTSUP;
|
||||
return (0);
|
||||
@ -624,7 +647,6 @@ static int
|
||||
la_CreateSymbolicLinkW(const wchar_t *linkname, const wchar_t *target,
|
||||
int linktype) {
|
||||
static BOOLEAN (WINAPI *f)(LPCWSTR, LPCWSTR, DWORD);
|
||||
static int set;
|
||||
wchar_t *ttarget, *p;
|
||||
size_t len;
|
||||
DWORD attrs = 0;
|
||||
@ -632,10 +654,20 @@ la_CreateSymbolicLinkW(const wchar_t *linkname, const wchar_t *target,
|
||||
DWORD newflags = 0;
|
||||
BOOL ret = 0;
|
||||
|
||||
#if _WIN32_WINNT < _WIN32_WINNT_VISTA
|
||||
/* CreateSymbolicLinkW is available since Vista and always loaded */
|
||||
static int set;
|
||||
if (!set) {
|
||||
set = 1;
|
||||
f = la_GetFunctionKernel32("CreateSymbolicLinkW");
|
||||
}
|
||||
#else
|
||||
# if !defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
f = CreateSymbolicLinkW;
|
||||
# else
|
||||
f = NULL;
|
||||
# endif
|
||||
#endif
|
||||
if (!f)
|
||||
return (0);
|
||||
|
||||
@ -1185,6 +1217,8 @@ _archive_write_disk_finish_entry(struct archive *_a)
|
||||
if (la_ftruncate(a->fh, a->filesize) == -1) {
|
||||
archive_set_error(&a->archive, errno,
|
||||
"File size could not be restored");
|
||||
CloseHandle(a->fh);
|
||||
a->fh = INVALID_HANDLE_VALUE;
|
||||
return (ARCHIVE_FAILED);
|
||||
}
|
||||
}
|
||||
@ -1656,6 +1690,9 @@ create_filesystem_object(struct archive_write_disk *a)
|
||||
mode_t final_mode, mode;
|
||||
int r;
|
||||
DWORD attrs = 0;
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
#endif
|
||||
|
||||
/* We identify hard/symlinks according to the link names. */
|
||||
/* Since link(2) and symlink(2) don't handle modes, we're done here. */
|
||||
@ -1719,8 +1756,16 @@ create_filesystem_object(struct archive_write_disk *a)
|
||||
a->todo = 0;
|
||||
a->deferred = 0;
|
||||
} else if (r == 0 && a->filesize > 0) {
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
|
||||
a->fh = CreateFile2(namefull, GENERIC_WRITE, 0,
|
||||
TRUNCATE_EXISTING, &createExParams);
|
||||
#else
|
||||
a->fh = CreateFileW(namefull, GENERIC_WRITE, 0, NULL,
|
||||
TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#endif
|
||||
if (a->fh == INVALID_HANDLE_VALUE) {
|
||||
la_dosmaperr(GetLastError());
|
||||
r = errno;
|
||||
@ -1783,14 +1828,27 @@ create_filesystem_object(struct archive_write_disk *a)
|
||||
a->tmpname = NULL;
|
||||
fullname = a->name;
|
||||
/* O_WRONLY | O_CREAT | O_EXCL */
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
|
||||
a->fh = CreateFile2(fullname, GENERIC_WRITE, 0,
|
||||
CREATE_NEW, &createExParams);
|
||||
#else
|
||||
a->fh = CreateFileW(fullname, GENERIC_WRITE, 0, NULL,
|
||||
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#endif
|
||||
if (a->fh == INVALID_HANDLE_VALUE &&
|
||||
GetLastError() == ERROR_INVALID_NAME &&
|
||||
fullname == a->name) {
|
||||
fullname = __la_win_permissive_name_w(a->name);
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
a->fh = CreateFile2(fullname, GENERIC_WRITE, 0,
|
||||
CREATE_NEW, &createExParams);
|
||||
#else
|
||||
a->fh = CreateFileW(fullname, GENERIC_WRITE, 0, NULL,
|
||||
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
#endif
|
||||
}
|
||||
if (a->fh == INVALID_HANDLE_VALUE) {
|
||||
if (GetLastError() == ERROR_ACCESS_DENIED) {
|
||||
@ -2551,14 +2609,25 @@ set_times(struct archive_write_disk *a,
|
||||
hw = NULL;
|
||||
} else {
|
||||
wchar_t *ws;
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
CREATEFILE2_EXTENDED_PARAMETERS createExParams;
|
||||
#endif
|
||||
|
||||
if (S_ISLNK(mode))
|
||||
return (ARCHIVE_OK);
|
||||
ws = __la_win_permissive_name_w(name);
|
||||
if (ws == NULL)
|
||||
goto settimes_failed;
|
||||
# if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
|
||||
ZeroMemory(&createExParams, sizeof(createExParams));
|
||||
createExParams.dwSize = sizeof(createExParams);
|
||||
createExParams.dwFileFlags = FILE_FLAG_BACKUP_SEMANTICS;
|
||||
hw = CreateFile2(ws, FILE_WRITE_ATTRIBUTES, 0,
|
||||
OPEN_EXISTING, &createExParams);
|
||||
#else
|
||||
hw = CreateFileW(ws, FILE_WRITE_ATTRIBUTES,
|
||||
0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
#endif
|
||||
free(ws);
|
||||
if (hw == INVALID_HANDLE_VALUE)
|
||||
goto settimes_failed;
|
||||
|
@ -45,15 +45,6 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_pax.c 201162 20
|
||||
#include "archive_write_private.h"
|
||||
#include "archive_write_set_format_private.h"
|
||||
|
||||
/*
|
||||
* Technically, the mtime field in the ustar header can
|
||||
* support 33 bits. We are using all of them to keep
|
||||
* tar/test/test_option_C_mtree.c simple and passing after 2038.
|
||||
* Platforms that use signed 32-bit time values need to fix
|
||||
* their handling of timestamps anyway.
|
||||
*/
|
||||
#define USTAR_MAX_MTIME 0x1ffffffff
|
||||
|
||||
struct sparse_block {
|
||||
struct sparse_block *next;
|
||||
int is_hole;
|
||||
@ -109,6 +100,7 @@ static int has_non_ASCII(const char *);
|
||||
static void sparse_list_clear(struct pax *);
|
||||
static int sparse_list_add(struct pax *, int64_t, int64_t);
|
||||
static char *url_encode(const char *in);
|
||||
static time_t get_ustar_max_mtime(void);
|
||||
|
||||
/*
|
||||
* Set output format to 'restricted pax' format.
|
||||
@ -604,6 +596,8 @@ archive_write_pax_header(struct archive_write *a,
|
||||
need_extension = 0;
|
||||
pax = (struct pax *)a->format_data;
|
||||
|
||||
const time_t ustar_max_mtime = get_ustar_max_mtime();
|
||||
|
||||
/* Sanity check. */
|
||||
if (archive_entry_pathname(entry_original) == NULL) {
|
||||
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
|
||||
@ -1131,7 +1125,7 @@ archive_write_pax_header(struct archive_write *a,
|
||||
*/
|
||||
if (!need_extension &&
|
||||
((archive_entry_mtime(entry_main) < 0)
|
||||
|| (archive_entry_mtime(entry_main) >= USTAR_MAX_MTIME)))
|
||||
|| (archive_entry_mtime(entry_main) >= ustar_max_mtime)))
|
||||
need_extension = 1;
|
||||
|
||||
/* I use a star-compatible file flag attribute. */
|
||||
@ -1196,7 +1190,7 @@ archive_write_pax_header(struct archive_write *a,
|
||||
if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_RESTRICTED ||
|
||||
need_extension) {
|
||||
if (archive_entry_mtime(entry_main) < 0 ||
|
||||
archive_entry_mtime(entry_main) >= USTAR_MAX_MTIME ||
|
||||
archive_entry_mtime(entry_main) >= ustar_max_mtime ||
|
||||
archive_entry_mtime_nsec(entry_main) != 0)
|
||||
add_pax_attr_time(&(pax->pax_header), "mtime",
|
||||
archive_entry_mtime(entry_main),
|
||||
@ -1434,7 +1428,7 @@ archive_write_pax_header(struct archive_write *a,
|
||||
/* Copy mtime, but clip to ustar limits. */
|
||||
s = archive_entry_mtime(entry_main);
|
||||
if (s < 0) { s = 0; }
|
||||
if (s > USTAR_MAX_MTIME) { s = USTAR_MAX_MTIME; }
|
||||
if (s > ustar_max_mtime) { s = ustar_max_mtime; }
|
||||
archive_entry_set_mtime(pax_attr_entry, s, 0);
|
||||
|
||||
/* Standard ustar doesn't support atime. */
|
||||
@ -2052,3 +2046,18 @@ sparse_list_add(struct pax *pax, int64_t offset, int64_t length)
|
||||
return (_sparse_list_add_block(pax, offset, length, 0));
|
||||
}
|
||||
|
||||
static time_t
|
||||
get_ustar_max_mtime(void)
|
||||
{
|
||||
/*
|
||||
* Technically, the mtime field in the ustar header can
|
||||
* support 33 bits. We are using all of them to keep
|
||||
* tar/test/test_option_C_mtree.c simple and passing after 2038.
|
||||
* For platforms that use signed 32-bit time values we
|
||||
* use the 32-bit maximum.
|
||||
*/
|
||||
if (sizeof(time_t) > sizeof(int32_t))
|
||||
return (time_t)0x1ffffffff;
|
||||
else
|
||||
return (time_t)0x7fffffff;
|
||||
}
|
||||
|
@ -31,6 +31,7 @@
|
||||
|
||||
#include "filter_fork.h"
|
||||
|
||||
#if !defined(WINAPI_FAMILY_PARTITION) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
|
||||
/* There are some editions of Windows ("nano server," for example) that
|
||||
* do not host user32.dll. If we want to keep running on those editions,
|
||||
* we need to delay-load WaitForInputIdle. */
|
||||
@ -224,6 +225,14 @@ __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout,
|
||||
__archive_cmdline_free(acmd);
|
||||
return ARCHIVE_FAILED;
|
||||
}
|
||||
#else /* !WINAPI_PARTITION_DESKTOP */
|
||||
int
|
||||
__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout, HANDLE *out_child)
|
||||
{
|
||||
(void)cmd; (void)child_stdin; (void) child_stdout; (void) out_child;
|
||||
return ARCHIVE_FAILED;
|
||||
}
|
||||
#endif /* !WINAPI_PARTITION_DESKTOP */
|
||||
|
||||
void
|
||||
__archive_check_child(int in, int out)
|
||||
|
@ -124,10 +124,9 @@ test_fuzz(const struct files *filesets)
|
||||
newraw = realloc(rawimage, oldsize + size);
|
||||
if (!assert(newraw != NULL))
|
||||
{
|
||||
free(rawimage);
|
||||
rawimage = NULL;
|
||||
free(tmp);
|
||||
continue;
|
||||
size = 0;
|
||||
break;
|
||||
}
|
||||
rawimage = newraw;
|
||||
memcpy(rawimage + oldsize, tmp, size);
|
||||
|
@ -1608,6 +1608,12 @@ test_parent(void)
|
||||
int file_count;
|
||||
int match_count;
|
||||
int r;
|
||||
#if defined(O_PATH) || defined(O_SEARCH) || \
|
||||
(defined(__FreeBSD__) && defined(O_EXEC))
|
||||
const char *ignore_traversals_test4;
|
||||
|
||||
ignore_traversals_test4 = getenv("IGNORE_TRAVERSALS_TEST4");
|
||||
#endif
|
||||
|
||||
assertMakeDir("lock", 0311);
|
||||
assertMakeDir("lock/dir1", 0755);
|
||||
@ -1784,7 +1790,8 @@ test_parent(void)
|
||||
if (r == ARCHIVE_FAILED) {
|
||||
#if defined(O_PATH) || defined(O_SEARCH) || \
|
||||
(defined(__FreeBSD__) && defined(O_EXEC))
|
||||
assertEqualIntA(a, ARCHIVE_OK, r);
|
||||
if (ignore_traversals_test4 == NULL)
|
||||
assertEqualIntA(a, ARCHIVE_OK, r);
|
||||
#endif
|
||||
/* Close the disk object. */
|
||||
archive_read_close(a);
|
||||
|
@ -30,6 +30,9 @@ __FBSDID("$FreeBSD");
|
||||
#define open _open
|
||||
#endif
|
||||
|
||||
#define __LIBARCHIVE_BUILD
|
||||
#include <archive_crc32.h>
|
||||
|
||||
/*
|
||||
* Extract a non-encoded file.
|
||||
* The header of the 7z archive files is not encoded.
|
||||
@ -283,6 +286,141 @@ test_extract_all_files(const char *refname)
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract multi files.
|
||||
* Like test_extract_all_files, but with zstandard compression.
|
||||
*/
|
||||
static void
|
||||
test_extract_all_files_zstd(const char *refname)
|
||||
{
|
||||
struct archive_entry *ae;
|
||||
struct archive *a;
|
||||
char buff[128];
|
||||
|
||||
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));
|
||||
|
||||
/* Verify directory dir1. Note that this comes before the dir1/file1 entry in recent versions of 7-Zip. */
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualInt((AE_IFDIR | 0755), archive_entry_mode(ae));
|
||||
assertEqualString("dir1/", archive_entry_pathname(ae));
|
||||
assertEqualInt(2764801, archive_entry_mtime(ae));
|
||||
assertEqualInt(archive_entry_is_encrypted(ae), 0);
|
||||
assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
|
||||
|
||||
/* Verify regular file1. */
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae));
|
||||
assertEqualString("dir1/file1", archive_entry_pathname(ae));
|
||||
assertEqualInt(86401, archive_entry_mtime(ae));
|
||||
assertEqualInt(13, archive_entry_size(ae));
|
||||
assertEqualInt(archive_entry_is_encrypted(ae), 0);
|
||||
assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
|
||||
assertEqualInt(13, archive_read_data(a, buff, sizeof(buff)));
|
||||
assertEqualMem(buff, "aaaaaaaaaaaa\n", 13);
|
||||
|
||||
/* Verify regular file2. */
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae));
|
||||
assertEqualString("file2", archive_entry_pathname(ae));
|
||||
assertEqualInt(86401, archive_entry_mtime(ae));
|
||||
assertEqualInt(26, archive_entry_size(ae));
|
||||
assertEqualInt(archive_entry_is_encrypted(ae), 0);
|
||||
assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
|
||||
assertEqualInt(26, archive_read_data(a, buff, sizeof(buff)));
|
||||
assertEqualMem(buff, "aaaaaaaaaaaa\nbbbbbbbbbbbb\n", 26);
|
||||
|
||||
/* Verify regular file3. */
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae));
|
||||
assertEqualString("file3", archive_entry_pathname(ae));
|
||||
assertEqualInt(86401, archive_entry_mtime(ae));
|
||||
assertEqualInt(39, archive_entry_size(ae));
|
||||
assertEqualInt(archive_entry_is_encrypted(ae), 0);
|
||||
assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
|
||||
assertEqualInt(39, archive_read_data(a, buff, sizeof(buff)));
|
||||
assertEqualMem(buff, "aaaaaaaaaaaa\nbbbbbbbbbbbb\ncccccccccccc\n", 39);
|
||||
|
||||
/* Verify regular file4. */
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae));
|
||||
assertEqualString("file4", archive_entry_pathname(ae));
|
||||
assertEqualInt(86401, archive_entry_mtime(ae));
|
||||
assertEqualInt(52, archive_entry_size(ae));
|
||||
assertEqualInt(archive_entry_is_encrypted(ae), 0);
|
||||
assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
|
||||
assertEqualInt(52, archive_read_data(a, buff, sizeof(buff)));
|
||||
assertEqualMem(buff,
|
||||
"aaaaaaaaaaaa\nbbbbbbbbbbbb\ncccccccccccc\ndddddddddddd\n", 52);
|
||||
|
||||
assertEqualInt(5, archive_file_count(a));
|
||||
|
||||
/* 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));
|
||||
|
||||
/* Close the archive. */
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract file from an archives using ZSTD compression with and without BCJ.
|
||||
*/
|
||||
static void
|
||||
test_extract_file_zstd_bcj_nobjc(const char *refname)
|
||||
{
|
||||
struct archive_entry *ae;
|
||||
struct archive *a;
|
||||
char buff[4096];
|
||||
uint32_t computed_crc = 0;
|
||||
uint32_t expected_crc = 0xbd66eebc;
|
||||
|
||||
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));
|
||||
|
||||
/* Verify regular file: hw. */
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualInt((AE_IFREG | 0775), archive_entry_mode(ae));
|
||||
assertEqualString("hw", archive_entry_pathname(ae));
|
||||
assertEqualInt(1685913368, archive_entry_mtime(ae));
|
||||
assertEqualInt(15952, archive_entry_size(ae));
|
||||
assertEqualInt(archive_entry_is_encrypted(ae), 0);
|
||||
assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0);
|
||||
|
||||
for (;;) {
|
||||
la_ssize_t bytes_read = archive_read_data(a, buff, sizeof(buff));
|
||||
assert(bytes_read >= 0);
|
||||
if (bytes_read == 0) break;
|
||||
computed_crc = crc32(computed_crc, buff, bytes_read);
|
||||
}
|
||||
assertEqualInt(computed_crc, expected_crc);
|
||||
|
||||
assertEqualInt(1, archive_file_count(a));
|
||||
|
||||
/* 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));
|
||||
|
||||
/* Close the archive. */
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
/*
|
||||
* Extract last file.
|
||||
* The header of the 7z archive files is encoded with LZMA.
|
||||
@ -782,6 +920,74 @@ DEFINE_TEST(test_read_format_7zip_deflate)
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_read_format_7zip_zstd)
|
||||
{
|
||||
struct archive *a;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
|
||||
/* Extracting with libzstd */
|
||||
if (ARCHIVE_OK != archive_read_support_filter_zstd(a)) {
|
||||
skipping(
|
||||
"7zip:zstd decoding is not supported on this platform");
|
||||
} else {
|
||||
test_extract_all_files_zstd("test_read_format_7zip_zstd.7z");
|
||||
}
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_read_format_7zip_zstd_solid)
|
||||
{
|
||||
struct archive *a;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
|
||||
/* Extracting with libzstd */
|
||||
if (ARCHIVE_OK != archive_read_support_filter_zstd(a)) {
|
||||
skipping(
|
||||
"7zip:zstd decoding is not supported on this platform");
|
||||
} else {
|
||||
test_extract_all_files_zstd("test_read_format_7zip_solid_zstd.7z");
|
||||
}
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_read_format_7zip_zstd_bcj)
|
||||
{
|
||||
struct archive *a;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
|
||||
/* Extracting with libzstd */
|
||||
if (ARCHIVE_OK != archive_read_support_filter_zstd(a)) {
|
||||
skipping(
|
||||
"7zip:zstd decoding is not supported on this platform");
|
||||
} else {
|
||||
test_extract_file_zstd_bcj_nobjc("test_read_format_7zip_zstd_bcj.7z");
|
||||
}
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_read_format_7zip_zstd_nobcj)
|
||||
{
|
||||
struct archive *a;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
|
||||
/* Extracting with libzstd */
|
||||
if (ARCHIVE_OK != archive_read_support_filter_zstd(a)) {
|
||||
skipping(
|
||||
"7zip:zstd decoding is not supported on this platform");
|
||||
} else {
|
||||
test_extract_file_zstd_bcj_nobjc("test_read_format_7zip_zstd_nobcj.7z");
|
||||
}
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_read_format_7zip_empty)
|
||||
{
|
||||
test_empty_archive();
|
||||
@ -832,7 +1038,147 @@ DEFINE_TEST(test_read_format_7zip_lzma2)
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
static void
|
||||
test_arm_filter(const char *refname)
|
||||
{
|
||||
struct archive *a;
|
||||
struct archive_entry *ae;
|
||||
char buff[7804];
|
||||
uint32_t computed_crc = 0;
|
||||
uint32_t expected_crc = 0x355ec4e1;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
|
||||
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));
|
||||
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualInt((AE_IFREG | 0755), archive_entry_mode(ae));
|
||||
assertEqualString("hw-gnueabihf", archive_entry_pathname(ae));
|
||||
assertEqualInt(sizeof(buff), archive_entry_size(ae));
|
||||
assertEqualInt(sizeof(buff), archive_read_data(a, buff, sizeof(buff)));
|
||||
computed_crc = crc32(computed_crc, buff, sizeof(buff));
|
||||
assertEqualInt(computed_crc, expected_crc);
|
||||
|
||||
assertEqualInt(1, archive_file_count(a));
|
||||
|
||||
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_read_format_7zip_zstd_arm)
|
||||
{
|
||||
struct archive *a;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
|
||||
if (ARCHIVE_OK != archive_read_support_filter_zstd(a)) {
|
||||
skipping(
|
||||
"7zip:zstd decoding is not supported on this platform");
|
||||
} else {
|
||||
test_arm_filter("test_read_format_7zip_zstd_arm.7z");
|
||||
}
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_read_format_7zip_lzma2_arm)
|
||||
{
|
||||
struct archive *a;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
|
||||
if (ARCHIVE_OK != archive_read_support_filter_lzma(a)) {
|
||||
skipping(
|
||||
"7zip:lzma decoding is not supported on this platform");
|
||||
} else {
|
||||
test_arm_filter("test_read_format_7zip_lzma2_arm.7z");
|
||||
}
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_read_format_7zip_ppmd)
|
||||
{
|
||||
test_ppmd();
|
||||
}
|
||||
|
||||
static void
|
||||
test_arm64_filter(const char *refname)
|
||||
{
|
||||
struct archive *a;
|
||||
struct archive_entry *ae;
|
||||
char buff[70368];
|
||||
uint32_t computed_crc = 0;
|
||||
uint32_t expected_crc = 0xde97d594;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
|
||||
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));
|
||||
|
||||
assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae));
|
||||
assertEqualInt((AE_IFREG | 0775), archive_entry_mode(ae));
|
||||
assertEqualString("hw-arm64", archive_entry_pathname(ae));
|
||||
assertEqualInt(sizeof(buff), archive_entry_size(ae));
|
||||
assertEqualInt(sizeof(buff), archive_read_data(a, buff, sizeof(buff)));
|
||||
computed_crc = crc32(computed_crc, buff, sizeof(buff));
|
||||
assertEqualInt(computed_crc, expected_crc);
|
||||
|
||||
assertEqualInt(1, archive_file_count(a));
|
||||
|
||||
assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae));
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_close(a));
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_read_format_7zip_lzma2_arm64)
|
||||
{
|
||||
#ifdef HAVE_LZMA_FILTER_ARM64
|
||||
struct archive *a;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
|
||||
if (ARCHIVE_OK != archive_read_support_filter_lzma(a)) {
|
||||
skipping(
|
||||
"7zip:lzma decoding is not supported on this platform");
|
||||
} else {
|
||||
test_arm64_filter("test_read_format_7zip_lzma2_arm64.7z");
|
||||
}
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
#else
|
||||
skipping("This version of liblzma does not support LZMA_FILTER_ARM64");
|
||||
#endif
|
||||
}
|
||||
|
||||
DEFINE_TEST(test_read_format_7zip_deflate_arm64)
|
||||
{
|
||||
struct archive *a;
|
||||
|
||||
assert((a = archive_read_new()) != NULL);
|
||||
|
||||
if (ARCHIVE_OK != archive_read_support_filter_gzip(a)) {
|
||||
skipping(
|
||||
"7zip:deflate decoding is not supported on this platform");
|
||||
} else {
|
||||
test_arm64_filter("test_read_format_7zip_deflate_arm64.7z");
|
||||
}
|
||||
|
||||
assertEqualInt(ARCHIVE_OK, archive_read_free(a));
|
||||
}
|
||||
|
64
libarchive/test/test_read_format_7zip_deflate_arm64.7z.uu
Normal file
64
libarchive/test/test_read_format_7zip_deflate_arm64.7z.uu
Normal file
@ -0,0 +1,64 @@
|
||||
begin 664 libarchive/test/test_read_format_7zip_deflate_arm64.7z
|
||||
M-WJ\KR<<``2V^52G)0H```````!:`````````.HY+B_LU5^(3%$<P/%SYPY+
|
||||
M_N1?*/]F5R'Y3_['&'^&0FB]T9BU@ZFQH]F1#65X4C:9"`](HI`'#PHO_N5!
|
||||
M>2.2T-J0XF&*!R-C_.Z=<^_<NSLKWK^?]MS?GM\]OW//W'ONS*&5:U<%#$,Y
|
||||
M3'5;6;UP[TH_K/,=_:RLDY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KPZ*IW_6_D\SAS=HQ3
|
||||
M=]_+O-8V5]O&YMNE5DEMM:;Z#)WG9^A]NRN12J5#^]*95+,R1IF+YNOOJG._
|
||||
MR^4-$K]*;)8XNEPN6]\96R2V2[PA\::U_R0^]KR'QOY-*M@VUAC5?YR=&REM
|
||||
MA<PQQSJYK&ZLE9LB+2>Y&9[?B+"^IO-[$[+>.6M?2FZU73LP=#YXP8R<#*Q_
|
||||
M]_;Y0*?.6M-W&>.\<Z.E6>O[(+E)GKK5[]X.5```````````````````````
|
||||
M````````````````````````````````````````````````````````````
|
||||
M``````````````````````````````#PIQUK"7$B"*(ULY_$__\O$M2#"@F;
|
||||
M]2^"&_^"/S0*(MI,,K.;T62R3"::50\>!/6@B'A8!$'0@X('3^)1;QX4/`I>
|
||||
M5-23@H(?5#36))79Z4EE=P_B:=[2>>G75=7=-36]F0D1(D2($"%"A`@1(D2(
|
||||
M$"%"C`I[(U`'L4+=./%XXH<==9Y`_3-D/X?Z5W[7/>=1/TH\EWB0QN<'QK_^
|
||||
MJ19KXRK4T$'ZG;8Z=S;FI_&QU+]*/(YX-O$,D-'66%]5J;%*_0KQ=/_V$;.(
|
||||
M>SID_6R[O.Y'Q&,"\R\`V>Y7M;X_A:0_U-]+\:K>>!V?J+^.QG]0OQW^+YYW
|
||||
MC(YOXG4=#ND(L(C2E=BV:=.ZV)(#F;+EE&/)Y?'NKN[E7=W)E?%DN:9U+T4U
|
||||
MT95(QAHCL25&I=^PS8)A.5I^:>QP02LYAAVST7OEVK5KXWW+>U<G,VNZ5ZY=
|
||||
M91R!4:`-%%BC<KH*:4['OPJKM\,@JW?`0U;OQ#KG]`A>?TZ/PEY6'P-G67TL
|
||||
MUC&GCX.'K#X>GK/Z!.CIY/2)>`YP^B2XPNJ3X3:K3X%7K#[5.U=D?1H,LOIT
|
||||
MN,GJ,_#^Y_29^*DR^BR8S.JS(0BE=F]^KH($.A>8.AGO^OCT&.DS`4%Y;HXS
|
||||
M!;Y$&)W)\QQ^/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6L',XJQ%C%6/@7F"!%:L^V,<_@7F85-\I]8:
|
||||
MU6,:EZ&`C$78(C[_M"KSXJ;_.3)6!?PKJLRQ$?PW8_N&SVP-_T%5YOFD=WC/
|
||||
M03)VTS.MZCWWROR)]$YL;3[_V<0'25>]YVB9KXZ0OZ/8JK[UKVN7>7I@_6J`
|
||||
MCV/[X_/?VRYSEV_]"K/_4Y33AO_9=ID?^>=G]G^._#=ZS_$R5WS^,QC_R[2N
|
||||
M3N^]A\RS1[C^%QO^+9ZC^T'&9)!Q+>#?TRGS>@4D](",ZP'_,Q&9IX^P_IN!
|
||||
M^^]*Q&/9OT7]W@GXWX[(O'Z$^1\$_%]%9+[7>GZO/B9B:Y/?2R'S]M$`/\4V
|
||||
M:<B??L<CC]+_A7=O>N]'B.G^5:C^/3^Y#E[3_GWOK8@;]3/\_.]E?U\F%9IG
|
||||
M^/Q](*W-6Y=*K'#VJ,KX3%H7>)#\-=9?9A6:42&+GNC0>\44<_^.\=8NXV&T
|
||||
M[K],'7[]4UKXOQE;M_P)P_O_!0$$!@`!"8HE``<+`0`"`P0!"`$*`0`,P>`2
|
||||
MP>`2``@*`935E]X```4!&0(``!$3`&@`=P`M`&$`<@!M`#8`-````!D`%`H!
|
||||
3`#)5M-E?M]D!%08!`""`_8$`````
|
||||
`
|
||||
end
|
50
libarchive/test/test_read_format_7zip_lzma2_arm.7z.uu
Normal file
50
libarchive/test/test_read_format_7zip_lzma2_arm.7z.uu
Normal file
@ -0,0 +1,50 @@
|
||||
begin 664 test_read_format_7zip_lzma2_arm.7z
|
||||
M-WJ\KR<<``3J_$W1N`<```````!B`````````.JU,0K@'GL'L%T`/Y%%A&@[
|
||||
MWMZF$<*4U"093^%DJ=J._J..`X9!2RX<PW^KV'J:BRK]Q@`9?>NX6*J`]\W5
|
||||
MV'E1<]9A1&J5D`#J!0K[IET\(=96D87RO?!\YQ>LH!0''871$*/B-@-70EJ0
|
||||
M`;\!OE9CF-^[@!DI0LA7Z5P`#.!8`&65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EX6PZ03U<?.D&.[%6Z($\PB;7M\A6V$P"YRO+\N`?8J;X[
|
||||
MJ[8\E=5>*3E;4527?8OP\+9NXTSDP.-ML`U\:36)X[JXOZ],_M[4ZD"D0T.7
|
||||
M3C*M=YOXBE!`I5-VO'3:YUR-42G):6"01XCG5%O]H17JJJQM8A<<,3RS8CI-
|
||||
MT7FK7"\1P9GO?#3O07):>\L_RHRH?]3Z#W42TX43Z=2HC/8M!<N0+!")FIB%
|
||||
MV?`J$WI4FYZW":A^MEWJ;@B_>H]),JTZ-@/"U#%4-Q#G9EP-$Y^]=$>X70[D
|
||||
MCP*^+R.X5U[;%+0P8JWW)`P#'VE[%=I>G;TGBX!_**[`)D9.JV9DAAYM[`"#
|
||||
M0]"E%F5%X?]_%@,>,Y*W"%H.!H6KV`7H>4&=7BX&?6K$"V@"*\#2BVIL.FH9
|
||||
M_YP"D5UNL[$1$U$GLQROKS__F*#'PH`%ZC5^,0\)'D&S:;?)8`W<F_<-'U5&
|
||||
M[#<10!!3-G8TP#$/A-+X9)OJ@3KY$/#%F9C-O]K6DXQG<.AE*)N?>EYT,8"?
|
||||
M1]-Z'S1^IEL/*WJ-LQ\;?%QQ8/*JUY93:52Y,XHJNY<;Q.GRQ`&ZY5)H9'2<
|
||||
MVT<0P98-*4HW2:\I<\W>0HW2E[B9D8LYS:````$$!@`!"8>X``<+`0`"(2$!
|
||||
M`@0#`P4!`0`,GGR>?``("@'AQ%XU```%`1D!`!$;`&@`=P`M`&<`;@!U`&4`
|
||||
D80!B`&D`:`!F````&0`4"@$```-.&5"<V0$5!@$`((#M@0``
|
||||
`
|
||||
end
|
54
libarchive/test/test_read_format_7zip_lzma2_arm64.7z.uu
Normal file
54
libarchive/test/test_read_format_7zip_lzma2_arm64.7z.uu
Normal file
@ -0,0 +1,54 @@
|
||||
begin 664 libarchive/test/test_read_format_7zip_lzma2_arm64.7z
|
||||
M-WJ\KR<<``0W'TW><P@```````!:`````````&'_J;[A$M\(:UT`/Y%%A&@]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&R`2$K'#I8'B(J0'\20($ONEJ2AXW;-'V3AP;9ME^L7JBW46
|
||||
M!+9%;M7.G(>CLF;A8*'@X"+832%9%WXO^K*>?/(]*..3\@`!!`8``0F(<P`'
|
||||
M"P$``B$A`0D!"@$`#,'@$L'@$@`("@&4U9?>```%`1D"```1$P!H`'<`+0!A
|
||||
C`'(`;0`V`#0````9`!0*`0`R5;397[?9`14&`0`@@/V!````
|
||||
`
|
||||
end
|
9
libarchive/test/test_read_format_7zip_solid_zstd.7z.uu
Normal file
9
libarchive/test/test_read_format_7zip_solid_zstd.7z.uu
Normal file
@ -0,0 +1,9 @@
|
||||
begin 664 test_read_format_7zip_solid_zstd.7z
|
||||
M-WJ\KR<<``1&(FS)O@`````````B`````````$V+D*,HM2_]`$@!``!0*DT8
|
||||
M!````"$````HM2_]((+%```P80IB8V0*!X"P/JZA4J4;TS.X,9C'`#4``($S
|
||||
M!ZX/T5NC)*"0H'?;G=XO-Y<-`+"F*K87M`OOZ1+1#31#M/`2YN,FY:(1).I)
|
||||
M(B(+;9$W4?0*8=3V5N;BSZ)(0UGD/'LOSN"0&#DNX!A2*5\#&8IP$1G=7-]@
|
||||
MP\EE$]Z;/%6NU^\_,X:MD?57P#S>.+BINH?CHRX,::[Q5P*!X\DH````%P8V
|
||||
?`0F`B``'"P$``2,#`0$%70`0```,@-H*`9/CZP``````
|
||||
`
|
||||
end
|
12
libarchive/test/test_read_format_7zip_zstd.7z.uu
Normal file
12
libarchive/test/test_read_format_7zip_zstd.7z.uu
Normal file
@ -0,0 +1,12 @@
|
||||
begin 664 test_read_format_7zip_zstd.7z
|
||||
M-WJ\KR<<``2QPP_C,`$````````C``````````+H!E<HM2_]`$@!``!0*DT8
|
||||
M!````!$````HM2_](`U%```080H!``80`BBU+_T`2`$``%`J31@$````%```
|
||||
M`"BU+_T@&ET``"!A"F(*`@#`H`'8*+4O_0!(`0``4"I-&`0````6````*+4O
|
||||
M_2`G;0``,&$*8@IC"@,4``@8V2BU+_T`2`$``%`J31@$````&0```"BU+_T@
|
||||
M-(4``$!A"F(*8PID"@04``@8(QL``($S!ZYMP-,)%[KY0NUS!EQ9<T<AN:R"
|
||||
M7Z^`KZ24FV4LJ?"A)\MX&!"$=31!F6U\W/D!@*G'-=Z@#"&#>8R#*L]U;J=*
|
||||
M@K`Q6]^1F4MZF33TE2LJK8X@%5MY%P.#1*EM98=_,9"?K'$*_A0YVC)]1ML=
|
||||
MK-5-,X82B;/_L`I&FQ!5HP#H````%P:`J`$)@(@`!PL!``$C`P$!!5T`$```
|
||||
+#(#Z"@%\$`,4````
|
||||
`
|
||||
end
|
61
libarchive/test/test_read_format_7zip_zstd_arm.7z.uu
Normal file
61
libarchive/test/test_read_format_7zip_zstd_arm.7z.uu
Normal file
@ -0,0 +1,61 @@
|
||||
begin 644 test_read_format_7zip_zstd_arm.7z
|
||||
M-WJ\KR<<``0IIN38A`D```````!R``````````1RSP4HM2_]`$@!``!0*DT8
|
||||
M!````&\)```HM2_]8'P=+4L`REV0%$E@''(._[5GFW&YEVY]?G/)^,\9+2"B
|
||||
M(\1H-(@DHJ*L)A?\C,G6FR3?/D.:6QDP<&`QFLOCXM`%J_](<>7+QU&E6E:N
|
||||
M9=5-A,@4*0%(`38!`-3GD[<=6PPVGV</-O5)9%/+G)7MT/SVF2%"[?YY9?YU
|
||||
MQOSKV/[5+O_IT#_2EO]=G'^=-?^YMW]5Z!^I;:@BQ:G]/U%1=T.&V5/O?8'$
|
||||
M1_>GC_)87GYQ_BZ,9+G<6(:EL+AFM]/OESN[+<?BJN+OQ,!I;>)245575._@
|
||||
M^RPCV7?'7IB-7R_..I.<?_RR2]YGMM,\B7QASI_N3>8;"%/NJ_\?\/_!_P<:
|
||||
M^G3XSS-DOP`414SD%5U,'70<P:9LB=\F,5F\?(8L*B"#5:97+^5R9HG.9OS"
|
||||
MQ!96@'QA!=NI[<^M__^U_7E!?>-F?MS1VK_/VO^C&^I_1SA*^_=)^^5T\.;Z
|
||||
M_W0/7Z?^[E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`P``!`,#!0$!``R>?)Y\``@*`>'$7C4```4!&0H`
|
||||
M````````````$1L`:`!W`"T`9P!N`'4`90!A`&(`:0!H`&8````9`!0*`0``
|
||||
166S@9)S9`14&`0`@@.V!````
|
||||
`
|
||||
end
|
56
libarchive/test/test_read_format_7zip_zstd_bcj.7z.uu
Normal file
56
libarchive/test/test_read_format_7zip_zstd_bcj.7z.uu
Normal file
@ -0,0 +1,56 @@
|
||||
begin 664 test_read_format_7zip_zstd_bcj.7z
|
||||
M-WJ\KR<<``0N5BP@P@@```````!B`````````(*-K]$HM2_]`$@!``!0*DT8
|
||||
M!````*T(```HM2_]8%`]'44`ZE%D$DIPW'$.RP,C]5>);DM31:I?D,QMZ#'[
|
||||
MX]O[KCOFX)J*\$44=%&TV"+)8#QPV28QFR]0!V-3JH9UII:164M``!FT!`!L
|
||||
MXELXL[8O4Q,!'@$2`5/J6F?&6/][6'!>ZPF&:U6C8%?F9DH.#=>\Y71GN:,M
|
||||
M^ZA,>'Z0J2/,U:!!Y(?S^B3?P==^[[?]YK&,Q.+\7;C(4KFQ#"L]4<UNIU\L
|
||||
M=W9;_D1%Y$]$H4B=H$[@2DE$IZ8'OIOBA=GXO>*LEI'SCU\6R?O,=IH;BR_,
|
||||
M^=,]F?4+_I]'MWL=@)3B4LF]J`%84^*+!@]ERRM(EKDF0@0*\*,A13M[J_;,
|
||||
M*JBF":I,JT3`(:"1UI!6,G[AH1;N$0&++]Q;5RDTUW:S#K<G2G>B?&TWF[K]
|
||||
MTO%\G]%M-\G(:E8U$$&Q(;$WDZ;I?H%#_\%^!#:>[<]:V>W_<Z_@?U[X`M[H
|
||||
MA4"P?^$_:O4:WO9[UYB<ABX"31,=K>LQ-_Y?Q`(@"A`L^!S]UHDBP&X#+X<)
|
||||
MS4GK>LP.H+]9:E#78]`VV'FC.[!1K?U2*3:2NB93]/].==UT^O\>==W,\/]?
|
||||
M==V44-=-'0;;@?WP+*-()<@P[!['GHC]HU%G3KK6_QP>N.7:3':M;%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y0D*MH2(6\B5YU*21O#?4OS=K,#>
|
||||
MM?@F6*^:37;#*>NV\;VYS9R567I^EN(RXY3MF[\:?IS1%VRW7Z[:^VI<W^EW
|
||||
M+C1I4NN.\7L'K_%;28(A;"6.*=[#.\.NM%)`@9'*7@+F3A[K)9_8.LC%A)"A
|
||||
M'*)/SZS!C8<S>'LY=_ZBTR<)4IT7]IYY]1OK&'@.&E"VR@9%YH&S'Q,#9CF]
|
||||
MG8&_K//(.AY#/&&R\L5Y9G9*M">BYP#J+4'9&3=D:QBW=45`IG&!W"1D^=K7
|
||||
M3-\)$&`N%0_$JV$!\![TG-`=:",BG5.9A)"?V=NSXPVO21_O-QG<+$FCO"K<
|
||||
M+7,ER$BPT:CS!0`Z0BV^S#)QZ3PK0-/_L#+OU^QUO<'=-9BN6Y:-5!LY:B;N
|
||||
MZREX8;-G[,XTOK;@Y$4Z[)9[!"MHPI^1M7KK1KL45B0C''SO8H,4XUG<1RU\
|
||||
MG/6=<8^3]'MPL\V\;ITR,#$MU@E[S7%[`00&``$)B,(`!PL!``(D!/<1`04!
|
||||
M!0,```0#`P$#`0`,OE"^4``("@&\[F:]```%`1D*`````````````!$'`&@`
|
||||
@=P```!D$`````!0*`0``'';'*9?9`14&`0`@@/V!````
|
||||
`
|
||||
end
|
56
libarchive/test/test_read_format_7zip_zstd_nobcj.7z.uu
Normal file
56
libarchive/test/test_read_format_7zip_zstd_nobcj.7z.uu
Normal file
@ -0,0 +1,56 @@
|
||||
begin 664 test_read_format_7zip_zstd_nobcj.7z
|
||||
M-WJ\KR<<``0`N.\QQ0@```````!2`````````#TEXKPHM2_]`$@!``!0*DT8
|
||||
M!````+`(```HM2_]8%`]-44`*E)P$DIPW'$.R^E<Z*8D%G.UILPF5,4RT_G_
|
||||
M</>\_]^S[,>DG"("L:I:;)%D,!ZX;).8S1>H@[$I[8=UII:164M``!FT!`!L
|
||||
MLB.<6?N3%!4!'@$2`4JZ6"F]QIDPV'_>%=P7BW[I8M4HT)&YD9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-/QT<4.*><[O
|
||||
ML2P=S_X<N'7,5CS>O.NY4@\-FS$OP8EX>6=[`00&``$)B,4`!PL!``$D!/<1
|
||||
M`04!!0,```R^4``("@&\[F:]```%`1D#````$0<`:`!W````&00`````%`H!
|
||||
3```<=L<IE]D!%08!`""`_8$`````
|
||||
`
|
||||
end
|
@ -171,8 +171,10 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
|
||||
int input, output, save_errno, i, need_restart;
|
||||
char ch, *p, *end;
|
||||
struct termios term, oterm;
|
||||
#ifdef HAVE_SIGACTION
|
||||
struct sigaction sa, savealrm, saveint, savehup, savequit, saveterm;
|
||||
struct sigaction savetstp, savettin, savettou, savepipe;
|
||||
#endif
|
||||
|
||||
/* I suppose we could alloc on demand in this case (XXX). */
|
||||
if (bufsiz == 0) {
|
||||
@ -221,6 +223,7 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
|
||||
oterm.c_lflag |= ECHO;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SIGACTION
|
||||
/*
|
||||
* Catch signals that would otherwise cause the user to end
|
||||
* up with echo turned off in the shell. Don't worry about
|
||||
@ -239,6 +242,7 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
|
||||
(void)sigaction(SIGTSTP, &sa, &savetstp);
|
||||
(void)sigaction(SIGTTIN, &sa, &savettin);
|
||||
(void)sigaction(SIGTTOU, &sa, &savettou);
|
||||
#endif
|
||||
|
||||
if (!(flags & RPP_STDIN)) {
|
||||
int r = write(output, prompt, strlen(prompt));
|
||||
@ -276,6 +280,7 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
|
||||
continue;
|
||||
signo[SIGTTOU] = sigttou;
|
||||
}
|
||||
#ifdef HAVE_SIGACTION
|
||||
(void)sigaction(SIGALRM, &savealrm, NULL);
|
||||
(void)sigaction(SIGHUP, &savehup, NULL);
|
||||
(void)sigaction(SIGINT, &saveint, NULL);
|
||||
@ -285,6 +290,7 @@ readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
|
||||
(void)sigaction(SIGTSTP, &savetstp, NULL);
|
||||
(void)sigaction(SIGTTIN, &savettin, NULL);
|
||||
(void)sigaction(SIGTTOU, &savettou, NULL);
|
||||
#endif
|
||||
if (input != STDIN_FILENO)
|
||||
(void)close(input);
|
||||
|
||||
|
@ -327,7 +327,7 @@ my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi)
|
||||
int r;
|
||||
|
||||
memset(bhfi, 0, sizeof(*bhfi));
|
||||
h = CreateFile(path, FILE_READ_ATTRIBUTES, 0, NULL,
|
||||
h = CreateFileA(path, FILE_READ_ATTRIBUTES, 0, NULL,
|
||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
if (h == INVALID_HANDLE_VALUE)
|
||||
return (0);
|
||||
@ -1432,7 +1432,7 @@ assertion_file_time(const char *file, int line,
|
||||
/* Note: FILE_FLAG_BACKUP_SEMANTICS applies to open
|
||||
* a directory file. If not, CreateFile() will fail when
|
||||
* the pathname is a directory. */
|
||||
h = CreateFile(pathname, FILE_READ_ATTRIBUTES, 0, NULL,
|
||||
h = CreateFileA(pathname, FILE_READ_ATTRIBUTES, 0, NULL,
|
||||
OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL);
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
failure_start(file, line, "Can't access %s\n", pathname);
|
||||
|
37
unzip/CMakeLists.txt
Normal file
37
unzip/CMakeLists.txt
Normal file
@ -0,0 +1,37 @@
|
||||
############################################
|
||||
#
|
||||
# How to build bsdunzip
|
||||
#
|
||||
############################################
|
||||
IF(ENABLE_UNZIP)
|
||||
|
||||
SET(bsdunzip_SOURCES
|
||||
bsdunzip.c
|
||||
bsdunzip_platform.h
|
||||
../libarchive_fe/err.c
|
||||
../libarchive_fe/err.h
|
||||
../libarchive_fe/lafe_platform.h
|
||||
../libarchive_fe/passphrase.c
|
||||
../libarchive_fe/passphrase.h
|
||||
)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe)
|
||||
|
||||
# bsdunzip documentation
|
||||
SET(bsdunzip_MANS bsdunzip.1)
|
||||
|
||||
# How to build bsdunzip
|
||||
ADD_EXECUTABLE(bsdunzip ${bsdunzip_SOURCES})
|
||||
IF(ENABLE_UNZIP_SHARED)
|
||||
TARGET_LINK_LIBRARIES(bsdunzip archive ${ADDITIONAL_LIBS})
|
||||
ELSE(ENABLE_UNZIP_SHARED)
|
||||
TARGET_LINK_LIBRARIES(bsdunzip archive_static ${ADDITIONAL_LIBS})
|
||||
SET_TARGET_PROPERTIES(bsdunzip PROPERTIES COMPILE_DEFINITIONS
|
||||
LIBARCHIVE_STATIC)
|
||||
ENDIF(ENABLE_UNZIP_SHARED)
|
||||
|
||||
# Installation rules
|
||||
INSTALL(TARGETS bsdunzip RUNTIME DESTINATION bin)
|
||||
INSTALL_MAN(${bsdunzip_MANS})
|
||||
ENDIF(ENABLE_UNZIP)
|
||||
|
||||
add_subdirectory(test)
|
216
unzip/bsdunzip.1
Normal file
216
unzip/bsdunzip.1
Normal file
@ -0,0 +1,216 @@
|
||||
.\"-
|
||||
.\" Copyright (c) 2007-2008 Dag-Erling Smørgrav
|
||||
.\" 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 AND CONTRIBUTORS ``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 OR CONTRIBUTORS 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$
|
||||
.\"
|
||||
.Dd January 2, 2023
|
||||
.Dt BSDUNZIP 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm bsdunzip
|
||||
.Nd extract files from a ZIP archive
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl aCcfjLlnopqtuvy
|
||||
.Op Fl d Ar dir
|
||||
.Op Fl x Ar pattern
|
||||
.Op Fl P Ar password
|
||||
.Ar zipfile
|
||||
.Op Ar member ...
|
||||
.Sh DESCRIPTION
|
||||
.\" ...
|
||||
The following options are available:
|
||||
.Bl -tag -width Fl
|
||||
.It Fl a
|
||||
When extracting a text file, convert DOS-style line endings to
|
||||
Unix-style line endings.
|
||||
.It Fl C
|
||||
Match file names case-insensitively.
|
||||
.It Fl c
|
||||
Extract to stdout/screen.
|
||||
When extracting files from the zipfile, they are written to stdout.
|
||||
This is similar to
|
||||
.Fl p ,
|
||||
but does not suppress normal output.
|
||||
.It Fl d Ar dir
|
||||
Extract files into the specified directory rather than the current
|
||||
directory.
|
||||
.It Fl f
|
||||
Update existing.
|
||||
Extract only files from the zipfile if a file with the same name
|
||||
already exists on disk and is older than the former.
|
||||
Otherwise, the file is silently skipped.
|
||||
.It Fl j
|
||||
Ignore directories stored in the zipfile; instead, extract all files
|
||||
directly into the extraction directory.
|
||||
.It Fl L
|
||||
Convert the names of the extracted files and directories to lowercase.
|
||||
.It Fl l
|
||||
List, rather than extract, the contents of the zipfile.
|
||||
.It Fl n
|
||||
No overwrite.
|
||||
When extracting a file from the zipfile, if a file with the same name
|
||||
already exists on disk, the file is silently skipped.
|
||||
.It Fl o
|
||||
Overwrite.
|
||||
When extracting a file from the zipfile, if a file with the same name
|
||||
already exists on disk, the existing file is replaced with the file
|
||||
from the zipfile.
|
||||
.It Fl p
|
||||
Extract to stdout.
|
||||
When extracting files from the zipfile, they are written to stdout.
|
||||
The normal output is suppressed as if
|
||||
.Fl q
|
||||
was specified.
|
||||
.It Fl P Ar password
|
||||
Extract encrypted files using a password.
|
||||
Putting a password on the command line using this option can be
|
||||
insecure.
|
||||
.It Fl q
|
||||
Quiet: print less information while extracting.
|
||||
.It Fl t
|
||||
Test: do not extract anything, but verify the checksum of every file
|
||||
in the archive.
|
||||
.It Fl u
|
||||
Update.
|
||||
When extracting a file from the zipfile, if a file with the same name
|
||||
already exists on disk, the existing file is replaced with the file
|
||||
from the zipfile if and only if the latter is newer than the former.
|
||||
Otherwise, the file is silently skipped.
|
||||
.It Fl v
|
||||
List verbosely, rather than extract, the contents of the zipfile.
|
||||
This differs from
|
||||
.Fl l
|
||||
by using the long listing.
|
||||
Note that most of the data is currently fake and does not reflect the
|
||||
content of the archive.
|
||||
.It Fl x Ar pattern
|
||||
Exclude files matching the pattern
|
||||
.Ar pattern .
|
||||
.It Fl y
|
||||
Print four digit years in listings instead of two.
|
||||
.It Fl Z Ar mode
|
||||
Emulate
|
||||
.Xr zipinfo 1L
|
||||
mode.
|
||||
Enabling
|
||||
.Xr zipinfo 1L
|
||||
mode changes the way in which additional arguments are parsed.
|
||||
Currently only
|
||||
.Xr zipinfo 1L
|
||||
mode 1 is supported, which lists the file names one per line.
|
||||
.It Ar [member ...]
|
||||
Optional list of members to extract from the zipfile.
|
||||
Can include patterns, e.g.
|
||||
.Ar 'memberdir/*'
|
||||
will extract all files and dirs below memberdir.
|
||||
.El
|
||||
.Pp
|
||||
Note that only one of
|
||||
.Fl n ,
|
||||
.Fl o ,
|
||||
and
|
||||
.Fl u
|
||||
may be specified.
|
||||
If specified filename is
|
||||
.Qq - ,
|
||||
then data is read from
|
||||
.Va stdin .
|
||||
.Sh ENVIRONMENT
|
||||
If the
|
||||
.Ev UNZIP_DEBUG
|
||||
environment variable is defined, the
|
||||
.Fl q
|
||||
command-line option has no effect, and additional debugging
|
||||
information will be printed to
|
||||
.Va stderr .
|
||||
.Sh COMPATIBILITY
|
||||
The
|
||||
.Nm
|
||||
utility aims to be sufficiently compatible with other implementations
|
||||
to serve as a drop-in replacement in the context of the
|
||||
.Xr ports 7
|
||||
system.
|
||||
No attempt has been made to replicate functionality which is not
|
||||
required for that purpose.
|
||||
.Pp
|
||||
For compatibility reasons, command-line options will be recognized if
|
||||
they are listed not only before but also after the name of the
|
||||
zipfile.
|
||||
.Pp
|
||||
Normally, the
|
||||
.Fl a
|
||||
option should only affect files which are marked as text files in the
|
||||
zipfile's central directory.
|
||||
Since the
|
||||
.Xr archive 3
|
||||
library does not provide access to that information, it is not available
|
||||
to the
|
||||
.Nm
|
||||
utility.
|
||||
Instead, the
|
||||
.Nm
|
||||
utility will assume that a file is a text file if no non-ASCII
|
||||
characters are present within the first block of data decompressed for
|
||||
that file.
|
||||
If non-ASCII characters appear in subsequent blocks of data, a warning
|
||||
will be issued.
|
||||
.Pp
|
||||
The
|
||||
.Nm
|
||||
utility is only able to process ZIP archives handled by
|
||||
.Xr libarchive 3 .
|
||||
Depending on the installed version of
|
||||
.Xr libarchive 3 ,
|
||||
this may or may not include self-extracting or ZIPX archives.
|
||||
.Sh SEE ALSO
|
||||
.Xr libarchive 3
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
utility appeared in
|
||||
.Fx 8.0 .
|
||||
.Sh AUTHORS
|
||||
The
|
||||
.Nm
|
||||
utility and this manual page were written by
|
||||
.An Dag-Erling Sm\(/orgrav Aq Mt des@FreeBSD.org .
|
||||
It uses the
|
||||
.Xr archive 3
|
||||
library developed by
|
||||
.An Tim Kientzle Aq Mt kientzle@FreeBSD.org .
|
||||
.Sh CAVEATS
|
||||
The
|
||||
.Nm
|
||||
utility performs two scans of the command-line for arguments before
|
||||
and after the archive name, so as to maintain compatibility with
|
||||
Info-ZIP unzip.
|
||||
As a result, the POSIX
|
||||
.Ql --
|
||||
double-dash string used to separate options from arguments will need to
|
||||
be repeated.
|
||||
For example, to extract a "-a.jpg" from "-b.zip" with overwrite, one
|
||||
would need to invoke
|
||||
.Dl bsdunzip -o -- -a.jpg -- -b.zip
|
1186
unzip/bsdunzip.c
Normal file
1186
unzip/bsdunzip.c
Normal file
File diff suppressed because it is too large
Load Diff
83
unzip/bsdunzip_platform.h
Normal file
83
unzip/bsdunzip_platform.h
Normal file
@ -0,0 +1,83 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2007 Tim Kientzle
|
||||
* 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: src/usr.bin/tar/bsdtar_platform.h,v 1.26 2008/12/06 07:37:14 kientzle Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
* This header is the first thing included in any of the bsdtar
|
||||
* source files. As far as possible, platform-specific issues should
|
||||
* be dealt with here and not within individual source files.
|
||||
*/
|
||||
|
||||
#ifndef BSDUNZIP_PLATFORM_H_INCLUDED
|
||||
#define BSDUNZIP_PLATFORM_H_INCLUDED
|
||||
|
||||
#if defined(PLATFORM_CONFIG_H)
|
||||
/* Use hand-built config.h in environments that need it. */
|
||||
#include PLATFORM_CONFIG_H
|
||||
#else
|
||||
/* Not having a config.h of some sort is a serious problem. */
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
/* Get a real definition for __FBSDID if we can */
|
||||
#if HAVE_SYS_CDEFS_H
|
||||
#include <sys/cdefs.h>
|
||||
#endif
|
||||
|
||||
/* If not, define it so as to avoid dangling semicolons. */
|
||||
#ifndef __FBSDID
|
||||
#define __FBSDID(a) struct _undefined_hack
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBARCHIVE
|
||||
/* If we're using the platform libarchive, include system headers. */
|
||||
#include <archive.h>
|
||||
#include <archive_entry.h>
|
||||
#else
|
||||
/* Otherwise, include user headers. */
|
||||
#include "archive.h"
|
||||
#include "archive_entry.h"
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETOPT_OPTRESET
|
||||
/*
|
||||
* If platform doesn't use optreset for resetting getopt, declare it so
|
||||
* C source doesn't have to know this platform-specific difference
|
||||
*/
|
||||
int optreset;
|
||||
#endif
|
||||
|
||||
/* How to mark functions that don't return. */
|
||||
/* This facilitates use of some newer static code analysis tools. */
|
||||
#undef __LA_DEAD
|
||||
#if defined(__GNUC__) && (__GNUC__ > 2 || \
|
||||
(__GNUC__ == 2 && __GNUC_MINOR__ >= 5))
|
||||
#define __LA_DEAD __attribute__((__noreturn__))
|
||||
#else
|
||||
#define __LA_DEAD
|
||||
#endif
|
||||
|
||||
#endif /* !BSDUNZIP_PLATFORM_H_INCLUDED */
|
80
unzip/test/CMakeLists.txt
Normal file
80
unzip/test/CMakeLists.txt
Normal file
@ -0,0 +1,80 @@
|
||||
############################################
|
||||
#
|
||||
# How to build bsdunzip_test
|
||||
#
|
||||
############################################
|
||||
IF(ENABLE_UNZIP AND ENABLE_TEST)
|
||||
SET(bsdunzip_test_SOURCES
|
||||
../../libarchive_fe/err.c
|
||||
../../test_utils/test_utils.c
|
||||
../../test_utils/test_main.c
|
||||
test.h
|
||||
test_0.c
|
||||
test_basic.c
|
||||
test_glob.c
|
||||
test_singlefile.c
|
||||
test_C.c
|
||||
test_p.c
|
||||
test_d.c
|
||||
test_j.c
|
||||
test_L.c
|
||||
test_n.c
|
||||
test_o.c
|
||||
test_q.c
|
||||
test_t.c
|
||||
test_t_bad.c
|
||||
test_x.c
|
||||
test_Z1.c
|
||||
test_P_encryption.c
|
||||
)
|
||||
|
||||
#
|
||||
# Register target
|
||||
#
|
||||
ADD_EXECUTABLE(bsdunzip_test ${bsdunzip_test_SOURCES})
|
||||
IF(ENABLE_ACL)
|
||||
SET(TEST_ACL_LIBS "")
|
||||
IF(HAVE_LIBACL)
|
||||
LIST(APPEND TEST_ACL_LIBS ${ACL_LIBRARY})
|
||||
ENDIF(HAVE_LIBACL)
|
||||
IF(HAVE_LIBRICHACL)
|
||||
LIST(APPEND TEST_ACL_LIBS ${RICHACL_LIBRARY})
|
||||
ENDIF(HAVE_LIBRICHACL)
|
||||
TARGET_LINK_LIBRARIES(bsdunzip_test ${TEST_ACL_LIBS})
|
||||
ENDIF(ENABLE_ACL)
|
||||
SET_PROPERTY(TARGET bsdunzip_test PROPERTY COMPILE_DEFINITIONS LIST_H)
|
||||
|
||||
#
|
||||
# Generate list.h by grepping DEFINE_TEST() lines out of the C sources.
|
||||
#
|
||||
GENERATE_LIST_H(${CMAKE_CURRENT_BINARY_DIR}/list.h
|
||||
${CMAKE_CURRENT_LIST_FILE} ${bsdunzip_test_SOURCES})
|
||||
SET_PROPERTY(DIRECTORY APPEND PROPERTY INCLUDE_DIRECTORIES
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
# list.h has a line DEFINE_TEST(testname) for every
|
||||
# test. We can use that to define the tests for cmake by
|
||||
# defining a DEFINE_TEST macro and reading list.h in.
|
||||
MACRO (DEFINE_TEST _testname)
|
||||
ADD_TEST(
|
||||
NAME bsdunzip_${_testname}
|
||||
COMMAND bsdunzip_test -vv
|
||||
-p $<TARGET_FILE:bsdunzip>
|
||||
-r ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${_testname})
|
||||
ENDMACRO (DEFINE_TEST _testname)
|
||||
|
||||
INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/test_utils)
|
||||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/unzip/test)
|
||||
|
||||
# Experimental new test handling
|
||||
ADD_CUSTOM_TARGET(run_bsdunzip_test
|
||||
COMMAND bsdunzip_test -p $<TARGET_FILE:bsdunzip>
|
||||
-r ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
-vv)
|
||||
ADD_DEPENDENCIES(run_bsdunzip_test bsdunzip)
|
||||
ADD_DEPENDENCIES(run_all_tests run_bsdunzip_test)
|
||||
ENDIF(ENABLE_UNZIP AND ENABLE_TEST)
|
||||
|
40
unzip/test/test.h
Normal file
40
unzip/test/test.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2003-2017 Tim Kientzle
|
||||
* 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$
|
||||
*/
|
||||
|
||||
/* Every test program should #include "test.h" as the first thing. */
|
||||
|
||||
#define KNOWNREF "test_basic.zip.uu"
|
||||
#define ENVBASE "BSDUNZIP" /* Prefix for environment variables. */
|
||||
#define PROGRAM "bsdunzip" /* Name of program being tested. */
|
||||
#define PROGRAM_ALIAS "unzip" /* Generic alias for program */
|
||||
#undef LIBRARY /* Not testing a library. */
|
||||
#undef EXTRA_DUMP /* How to dump extra data */
|
||||
#undef EXTRA_ERRNO /* How to dump errno */
|
||||
/* How to generate extra version info. */
|
||||
#define EXTRA_VERSION (systemf("%s -v", testprog) ? "" : "")
|
||||
|
||||
#include "test_common.h"
|
58
unzip/test/test_0.c
Normal file
58
unzip/test/test_0.c
Normal file
@ -0,0 +1,58 @@
|
||||
/*-
|
||||
* Copyright (c) 2003-2007 Tim Kientzle
|
||||
* 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"
|
||||
|
||||
/*
|
||||
* This first test does basic sanity checks on the environment. For
|
||||
* most of these, we just exit on failure.
|
||||
*/
|
||||
#if !defined(_WIN32) || defined(__CYGWIN__)
|
||||
#define DEV_NULL "/dev/null"
|
||||
#else
|
||||
#define DEV_NULL "NUL"
|
||||
#endif
|
||||
|
||||
DEFINE_TEST(test_0)
|
||||
{
|
||||
struct stat st;
|
||||
|
||||
failure("File %s does not exist?!", testprog);
|
||||
if (!assertEqualInt(0, stat(testprogfile, &st))) {
|
||||
fprintf(stderr,
|
||||
"\nFile %s does not exist; aborting test.\n\n",
|
||||
testprog);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
failure("%s is not executable?!", testprog);
|
||||
if (!assert((st.st_mode & 0111) != 0)) {
|
||||
fprintf(stderr,
|
||||
"\nFile %s not executable; aborting test.\n\n",
|
||||
testprog);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* TODO: Ensure that our reference files are available. */
|
||||
}
|
41
unzip/test/test_C.c
Normal file
41
unzip/test/test_C.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test C arg - match case-insensitive */
|
||||
DEFINE_TEST(test_C)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -C %s test_basic/caps >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
|
||||
}
|
44
unzip/test/test_L.c
Normal file
44
unzip/test/test_L.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test L arg - make names lowercase */
|
||||
DEFINE_TEST(test_L)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -L %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("contents a\n", "test_basic/a");
|
||||
assertTextFileContents("contents b\n", "test_basic/b");
|
||||
assertTextFileContents("contents c\n", "test_basic/c");
|
||||
assertTextFileContents("contents CAPS\n", "test_basic/caps");
|
||||
}
|
41
unzip/test/test_P_encryption.c
Normal file
41
unzip/test/test_P_encryption.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test P arg - password protected */
|
||||
DEFINE_TEST(test_P)
|
||||
{
|
||||
const char *reffile = "test_encrypted.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -P password %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("plaintext\n", "encrypted/file.txt");
|
||||
}
|
40
unzip/test/test_Z1.c
Normal file
40
unzip/test/test_Z1.c
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test -Z1 arg - List filenames */
|
||||
DEFINE_TEST(test_Z1)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -Z1 %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertTextFileContents("test_basic/\ntest_basic/a\ntest_basic/b\ntest_basic/c\ntest_basic/CAPS\n", "test.out");
|
||||
assertEmptyFile("test.err");
|
||||
}
|
44
unzip/test/test_basic.c
Normal file
44
unzip/test/test_basic.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* This test just does a basic zip decompression */
|
||||
DEFINE_TEST(test_basic)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("contents a\n", "test_basic/a");
|
||||
assertTextFileContents("contents b\n", "test_basic/b");
|
||||
assertTextFileContents("contents c\n", "test_basic/c");
|
||||
assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
|
||||
}
|
25
unzip/test/test_basic.zip.uu
Normal file
25
unzip/test/test_basic.zip.uu
Normal file
@ -0,0 +1,25 @@
|
||||
begin 644 test_basic.zip
|
||||
M4$L#!!0``````,J0MU8````````````````+`"``=&5S=%]B87-I8R]55`T`
|
||||
M!]PX;63U.6UDW#AM9'5X"P`!!.@#```$Z`,``%!+`P04``@`"``)C;=6````
|
||||
M```````+````#``@`'1E<W1?8F%S:6,O8554#0`'PS)M9/HY;603.&UD=7@+
|
||||
M``$$Z`,```3H`P``2\[/*TG-*RE62.0"`%!+!PAY:C`$#0````L```!02P,$
|
||||
M%``(``@`#HVW5@``````````"P````P`(`!T97-T7V)A<VEC+V)55`T`!\TR
|
||||
M;63Z.6UD.SAM9'5X"P`!!.@#```$Z`,``$O.SRM)S2LI5DCB`@!02P<(NCD=
|
||||
M+PT````+````4$L#!!0`"``(`%*-MU8```````````L````,`"``=&5S=%]B
|
||||
M87-I8R]C550-``=,,VUDTSAM9,\X;61U>`L``03H`P``!.@#``!+SL\K2<TK
|
||||
M*59(Y@(`4$L'"/L(!C8-````"P```%!+`P04``@`"`#*D+=6```````````.
|
||||
M````#P`@`'1E<W1?8F%S:6,O0T%04U54#0`'W#AM9/HY;63<.&UD=7@+``$$
|
||||
MZ`,```3H`P``2\[/*TG-*RE6<'8,".8"`%!+!P@I4T'W$`````X```!02P$"
|
||||
M%`,4``````#*D+=6````````````````"P`@````````````[4$`````=&5S
|
||||
M=%]B87-I8R]55`T`!]PX;63U.6UDW#AM9'5X"P`!!.@#```$Z`,``%!+`0(4
|
||||
M`Q0`"``(``F-MU9Y:C`$#0````L````,`"````````````"D@4D```!T97-T
|
||||
M7V)A<VEC+V%55`T`!\,R;63Z.6UD$SAM9'5X"P`!!.@#```$Z`,``%!+`0(4
|
||||
M`Q0`"``(``Z-MU:Z.1TO#0````L````,`"````````````"D@;````!T97-T
|
||||
M7V)A<VEC+V)55`T`!\TR;63Z.6UD.SAM9'5X"P`!!.@#```$Z`,``%!+`0(4
|
||||
M`Q0`"``(`%*-MU;["`8V#0````L````,`"````````````"D@1<!``!T97-T
|
||||
M7V)A<VEC+V-55`T`!TPS;633.&UDSSAM9'5X"P`!!.@#```$Z`,``%!+`0(4
|
||||
M`Q0`"``(`,J0MU8I4T'W$`````X````/`"````````````"D@7X!``!T97-T
|
||||
M7V)A<VEC+T-!4%-55`T`!]PX;63Z.6UDW#AM9'5X"P`!!.@#```$Z`,``%!+
|
||||
4!08`````!0`%`,0!``#K`0``````
|
||||
`
|
||||
end
|
44
unzip/test/test_d.c
Normal file
44
unzip/test/test_d.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test d arg - extract to target dir */
|
||||
DEFINE_TEST(test_d)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -d foobar %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("contents a\n", "foobar/test_basic/a");
|
||||
assertTextFileContents("contents b\n", "foobar/test_basic/b");
|
||||
assertTextFileContents("contents c\n", "foobar/test_basic/c");
|
||||
assertTextFileContents("contents CAPS\n", "foobar/test_basic/CAPS");
|
||||
}
|
13
unzip/test/test_encrypted.zip.uu
Normal file
13
unzip/test/test_encrypted.zip.uu
Normal file
@ -0,0 +1,13 @@
|
||||
begin 644 test_encrypted.zip
|
||||
M4$L#!!0``````'*1MU8````````````````*`"``96YC<GEP=&5D+U54#0`'
|
||||
M&#IM9!LZ;608.FUD=7@+``$$Z`,```3H`P``4$L#!!0`"0!C`'*1MU8`````
|
||||
M``````H````2`"L`96YC<GEP=&5D+V9I;&4N='AT550-``<8.FUD&#IM9!@Z
|
||||
M;61U>`L``03H`P``!.@#```!F0<``@!!10,(`*_-)-RYPDYFJ$Q9+L<I#-><
|
||||
M'#C?XVBR9/=H?7U\LC!A^8<6[&CO#PM02P<(`````"@````*````4$L!`A0#
|
||||
M%```````<I&W5@````````````````H`(````````````.U!`````&5N8W)Y
|
||||
M<'1E9"]55`T`!Q@Z;60;.FUD&#IM9'5X"P`!!.@#```$Z`,``%!+`0(4`Q0`
|
||||
M"0!C`'*1MU8`````*`````H````2`"L```````````"D@4@```!E;F-R>7!T
|
||||
M960O9FEL92YT>'155`T`!Q@Z;608.FUD&#IM9'5X"P`!!.@#```$Z`,```&9
|
||||
?!P`"`$%%`P@`4$L%!@`````"``(`PP```-L`````````
|
||||
`
|
||||
end
|
44
unzip/test/test_glob.c
Normal file
44
unzip/test/test_glob.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test that the glob works */
|
||||
DEFINE_TEST(test_glob)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s %s test_*/[ab] >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("contents a\n", "test_basic/a");
|
||||
assertTextFileContents("contents b\n", "test_basic/b");
|
||||
assertFileNotExists("test_basic/c");
|
||||
assertFileNotExists("test_basic/CAPS");
|
||||
}
|
44
unzip/test/test_j.c
Normal file
44
unzip/test/test_j.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test j arg - don't make directories */
|
||||
DEFINE_TEST(test_j)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -j %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("contents a\n", "a");
|
||||
assertTextFileContents("contents b\n", "b");
|
||||
assertTextFileContents("contents c\n", "c");
|
||||
assertTextFileContents("contents CAPS\n", "CAPS");
|
||||
}
|
48
unzip/test/test_n.c
Normal file
48
unzip/test/test_n.c
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test n arg - don't overrite existing files */
|
||||
DEFINE_TEST(test_n)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
assertMakeDir("test_basic", 0755);
|
||||
assertMakeFile("test_basic/a", 0644, "orig a\n");
|
||||
assertMakeFile("test_basic/b", 0644, "orig b\n");
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -n %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("orig a\n", "test_basic/a");
|
||||
assertTextFileContents("orig b\n", "test_basic/b");
|
||||
assertTextFileContents("contents c\n", "test_basic/c");
|
||||
assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
|
||||
}
|
36
unzip/test/test_not_exist.c
Normal file
36
unzip/test/test_not_exist.c
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test non existant file */
|
||||
DEFINE_TEST(test_not_exist)
|
||||
{
|
||||
int r;
|
||||
r = systemf("%s nonexist.zip >test.out 2>test.err", testprog);
|
||||
assert(r != 0);
|
||||
assertEmptyFile("test.out");
|
||||
assertNonEmptyFile("test.err");
|
||||
}
|
47
unzip/test/test_o.c
Normal file
47
unzip/test/test_o.c
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test o arg - overrite existing files */
|
||||
DEFINE_TEST(test_o)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
assertMakeDir("test_basic", 0755);
|
||||
assertMakeFile("test_basic/a", 0644, "orig a\n");
|
||||
assertMakeFile("test_basic/b", 0644, "orig b\n");
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -o %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("contents a\n", "test_basic/a");
|
||||
assertTextFileContents("contents b\n", "test_basic/b");
|
||||
assertTextFileContents("contents c\n", "test_basic/c");
|
||||
assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
|
||||
}
|
39
unzip/test/test_p.c
Normal file
39
unzip/test/test_p.c
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test p arg - Print to stdout */
|
||||
DEFINE_TEST(test_p)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -p %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertTextFileContents("contents a\ncontents b\ncontents c\ncontents CAPS\n", "test.out");
|
||||
assertEmptyFile("test.err");
|
||||
}
|
44
unzip/test/test_q.c
Normal file
44
unzip/test/test_q.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test q arg - Quiet */
|
||||
DEFINE_TEST(test_q)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -q %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("contents a\n", "test_basic/a");
|
||||
assertTextFileContents("contents b\n", "test_basic/b");
|
||||
assertTextFileContents("contents c\n", "test_basic/c");
|
||||
assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
|
||||
}
|
41
unzip/test/test_singlefile.c
Normal file
41
unzip/test/test_singlefile.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Ensure single-file zips work */
|
||||
DEFINE_TEST(test_singlefile)
|
||||
{
|
||||
const char *reffile = "test_singlefile.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("hello\n", "file.txt");
|
||||
}
|
8
unzip/test/test_singlefile.zip.uu
Normal file
8
unzip/test/test_singlefile.zip.uu
Normal file
@ -0,0 +1,8 @@
|
||||
begin 644 test_singlefile.zip
|
||||
M4$L#!!0`"``(`&"6MU8```````````8````(`"``9FEL92YT>'155`T`!U1#
|
||||
M;6140VUD5$-M9'5X"P`!!.@#```$Z`,``,M(S<G)YP(`4$L'""`P.C8(````
|
||||
M!@```%!+`0(4`Q0`"``(`&"6MU8@,#HV"`````8````(`"````````````"D
|
||||
M@0````!F:6QE+G1X=%54#0`'5$-M9%1#;6140VUD=7@+``$$Z`,```3H`P``
|
||||
64$L%!@`````!``$`5@```%X`````````
|
||||
`
|
||||
end
|
39
unzip/test/test_t.c
Normal file
39
unzip/test/test_t.c
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test t arg - Test zip contents */
|
||||
DEFINE_TEST(test_t)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -t %s >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
}
|
39
unzip/test/test_t_bad.c
Normal file
39
unzip/test/test_t_bad.c
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test t arg - Test zip contents, but fail! */
|
||||
DEFINE_TEST(test_t_bad)
|
||||
{
|
||||
const char *reffile = "test_t_bad.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s -t %s >test.out 2>test.err", testprog, reffile);
|
||||
assert(r != 0);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertNonEmptyFile("test.err");
|
||||
}
|
25
unzip/test/test_t_bad.zip.uu
Normal file
25
unzip/test/test_t_bad.zip.uu
Normal file
@ -0,0 +1,25 @@
|
||||
begin 644 test_t_bad.zip
|
||||
M4$L#!!0``````,J0MU8````````````````+`"``=&5S=%]B87-I8R]55`T`
|
||||
M!]PX;63U.6UDW#AM9'5X"P`!!.@#```$Z`,``%!+`P04``@`"``)C;=6````
|
||||
M```````+````#``@`'1E<W1?8F%S:6,O85546``'PS)M9/HY;603.&UD=7@+
|
||||
M``$$Z`,```3H`P``2\[/*TG-*RE62.0"`%!+!PAY:C`$#0````L```!02P,$
|
||||
M%&$(``@`#HVW5@``````````"P````P`(`!T97-T7V)A<VEC+V)55`T`!\TR
|
||||
M;63Z.6UD.SAM9'5X"P`!!.@#```$Z`,``$O.SRM)S2LI5DCB`@!02P<(NCD=
|
||||
M+PT````+````4$L#!!0`"``(`%*-MU8```````````L````,`"``=&5S=%]B
|
||||
M87-I8R]C550-``=,,VUDTSAM9,\X;61U>`L``03H`P``!.@#``!+SL\K2<TK
|
||||
M*59(Y@(`4$L'"/L(!C8-````"P```%!+`P04``@`"`#*D+=6```````````.
|
||||
M````#P`@`'1E<W1?8F%S:6,O0T%04U54#0`'W#AM9/HY;63<.&UD=7@+``$$
|
||||
MZ`,```3H`P``2\[/*TG-*RE6<'8,".8"`%!+!P@I4T'W$`````X```!02P$"
|
||||
M%`,4``````#*D+=6````````````````"P`@````````````[4(`````=&5S
|
||||
M=%]B87-I8R]55`T`!]PX;63U.6UDW#AM9'5X"P`!!.@#```$Z`,``%!+`0(4
|
||||
M`Q0`"``(``F-MU9Y:C`$#0````L````,`"````````````"D@4D```!T97-T
|
||||
M7V)A<VEC+V%55`T`!\,R;63Z.6UD$SAM9'5X"P`!!.@#```$Z`,``%!+`0(4
|
||||
M`Q0`"``(``Z-MU:Z.1TO#0````L````,`"````````````"D@;````!T97-T
|
||||
M7V)A<VEC+V)55`T`!\TR;63Z.6UD.SAM9'5X"P`!!.@#```$Z`,``%!+`0(4
|
||||
M`Q0`"``(`%*-MU;["`8V#0````L````,`"````````````"D@1<!``!T97-T
|
||||
M7V)A<VEC+V-55`T`!TPS;633.&UDSSAM9'5X"P`!!.@#```$Z`,``%!+`0(4
|
||||
M`Q0`"``(`,J0MU8I4T'W$`````X````/`"````````````"D@7X!``!T97-T
|
||||
M7V)A<VEC+T-!4%-55`T`!]PX;63Z.6UDW#AM9'5X"P`!!.@#```$Z`,``%!+
|
||||
5!08`````!0`%`,0!``#K`0`````*
|
||||
`
|
||||
end
|
44
unzip/test/test_x.c
Normal file
44
unzip/test/test_x.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2023 Adrian Vovk
|
||||
* 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
|
||||
* in this position and unchanged.
|
||||
* 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"
|
||||
|
||||
/* Test x arg - Exclude paths */
|
||||
DEFINE_TEST(test_x)
|
||||
{
|
||||
const char *reffile = "test_basic.zip";
|
||||
int r;
|
||||
|
||||
extract_reference_file(reffile);
|
||||
r = systemf("%s %s -x test_basic/c >test.out 2>test.err", testprog, reffile);
|
||||
assertEqualInt(0, r);
|
||||
assertNonEmptyFile("test.out");
|
||||
assertEmptyFile("test.err");
|
||||
|
||||
assertTextFileContents("contents a\n", "test_basic/a");
|
||||
assertTextFileContents("contents b\n", "test_basic/b");
|
||||
assertFileNotExists("test_basic/c");
|
||||
assertTextFileContents("contents CAPS\n", "test_basic/CAPS");
|
||||
}
|
Loading…
Reference in New Issue
Block a user