From 43341e7cf4b9eee3ead77da04edc14370fe5b166 Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Tue, 10 May 2016 21:12:32 +0000 Subject: [PATCH 1/3] Trim libarchive/dist using FREEBSD-Xlist --- CMakeLists.txt | 1525 ---------- CTestConfig.cmake | 11 - INSTALL | 35 - Makefile.am | 1014 ------- build/README.txt | 35 - build/autoconf/check_stdcall_func.m4 | 51 - build/autoconf/config.rpath | 696 ----- build/autoconf/iconv.m4 | 268 -- build/autoconf/la_uid_t.m4 | 20 - build/autoconf/lib-ld.m4 | 109 - build/autoconf/lib-link.m4 | 777 ----- build/autoconf/lib-prefix.m4 | 224 -- build/autogen.sh | 67 - build/bump-version.sh | 36 - build/clean.sh | 97 - build/cmake/CheckFileOffsetBits.c | 14 - build/cmake/CheckFileOffsetBits.cmake | 44 - build/cmake/CheckFuncs.cmake | 49 - build/cmake/CheckFuncs_stub.c.in | 16 - build/cmake/CheckHeaderDirent.cmake | 32 - build/cmake/CheckStructMember.cmake | 43 - build/cmake/CheckTypeExists.cmake | 42 - build/cmake/FindLZMA.cmake | 48 - build/cmake/FindLibGCC.cmake | 22 - build/cmake/FindNettle.cmake | 23 - build/cmake/FindPCREPOSIX.cmake | 34 - .../LibarchiveCheckCSourceCompiles.cmake | 106 - build/cmake/LibarchiveCheckCSourceRuns.cmake | 102 - build/cmake/config.h.in | 1143 -------- build/makerelease.sh | 58 - build/pkgconfig/libarchive.pc.in | 11 - .../utils/gen_archive_string_composition_h.sh | 455 --- build/version | 1 - configure.ac | 788 ------ contrib/README | 59 - contrib/libarchive.1aix53.spec | 160 -- contrib/libarchive.spec | 147 - .../libarchive_autodetect-st_lib_archive.m4 | 154 - contrib/psota-benchmark/results.txt | 136 - contrib/psota-benchmark/tcp.sh | 110 - contrib/shar/Makefile | 14 - contrib/shar/shar.1 | 128 - contrib/shar/shar.c | 314 --- contrib/shar/tree.c | 542 ---- contrib/shar/tree.h | 115 - contrib/shar/tree_config.h | 78 - contrib/untar.c | 225 -- cpio/CMakeLists.txt | 47 - cpio/config_freebsd.h | 56 - cpio/cpio_windows.c | 338 --- cpio/cpio_windows.h | 72 - cpio/test/CMakeLists.txt | 93 - doc/html/.ignore_me | 2 - doc/man/.ignore_me | 2 - doc/mdoc2man.awk | 391 --- doc/mdoc2wiki.awk | 451 --- doc/pdf/.ignore_me | 2 - doc/text/.ignore_me | 2 - doc/update.sh | 119 - doc/wiki/.ignore_me | 2 - examples/minitar/Makefile | 26 - examples/minitar/README | 12 - examples/minitar/minitar.c | 458 --- examples/tarfilter.c | 113 - examples/untar.c | 266 -- libarchive/CMakeLists.txt | 193 -- libarchive/archive_entry_copy_bhfi.c | 75 - libarchive/archive_read_disk_windows.c | 2296 --------------- libarchive/archive_windows.c | 908 ------ libarchive/archive_windows.h | 306 -- libarchive/archive_write_disk_windows.c | 2502 ----------------- libarchive/config_freebsd.h | 160 -- libarchive/filter_fork_windows.c | 190 -- libarchive/mtree.5 | 269 -- libarchive/test/.cvsignore | 10 - libarchive/test/CMakeLists.txt | 257 -- tar/CMakeLists.txt | 49 - tar/bsdtar_windows.c | 298 -- tar/bsdtar_windows.h | 60 - tar/config_freebsd.h | 84 - tar/test/CMakeLists.txt | 101 - tar/test/test_windows.c | 324 --- 82 files changed, 20712 deletions(-) delete mode 100644 CMakeLists.txt delete mode 100644 CTestConfig.cmake delete mode 100644 INSTALL delete mode 100644 Makefile.am delete mode 100644 build/README.txt delete mode 100644 build/autoconf/check_stdcall_func.m4 delete mode 100755 build/autoconf/config.rpath delete mode 100644 build/autoconf/iconv.m4 delete mode 100644 build/autoconf/la_uid_t.m4 delete mode 100644 build/autoconf/lib-ld.m4 delete mode 100644 build/autoconf/lib-link.m4 delete mode 100644 build/autoconf/lib-prefix.m4 delete mode 100755 build/autogen.sh delete mode 100644 build/bump-version.sh delete mode 100644 build/clean.sh delete mode 100644 build/cmake/CheckFileOffsetBits.c delete mode 100644 build/cmake/CheckFileOffsetBits.cmake delete mode 100644 build/cmake/CheckFuncs.cmake delete mode 100644 build/cmake/CheckFuncs_stub.c.in delete mode 100644 build/cmake/CheckHeaderDirent.cmake delete mode 100644 build/cmake/CheckStructMember.cmake delete mode 100644 build/cmake/CheckTypeExists.cmake delete mode 100644 build/cmake/FindLZMA.cmake delete mode 100644 build/cmake/FindLibGCC.cmake delete mode 100644 build/cmake/FindNettle.cmake delete mode 100644 build/cmake/FindPCREPOSIX.cmake delete mode 100644 build/cmake/LibarchiveCheckCSourceCompiles.cmake delete mode 100644 build/cmake/LibarchiveCheckCSourceRuns.cmake delete mode 100644 build/cmake/config.h.in delete mode 100755 build/makerelease.sh delete mode 100644 build/pkgconfig/libarchive.pc.in delete mode 100755 build/utils/gen_archive_string_composition_h.sh delete mode 100644 build/version delete mode 100644 configure.ac delete mode 100644 contrib/README delete mode 100644 contrib/libarchive.1aix53.spec delete mode 100644 contrib/libarchive.spec delete mode 100644 contrib/libarchive_autodetect-st_lib_archive.m4 delete mode 100644 contrib/psota-benchmark/results.txt delete mode 100644 contrib/psota-benchmark/tcp.sh delete mode 100644 contrib/shar/Makefile delete mode 100644 contrib/shar/shar.1 delete mode 100644 contrib/shar/shar.c delete mode 100644 contrib/shar/tree.c delete mode 100644 contrib/shar/tree.h delete mode 100644 contrib/shar/tree_config.h delete mode 100644 contrib/untar.c delete mode 100644 cpio/CMakeLists.txt delete mode 100644 cpio/config_freebsd.h delete mode 100644 cpio/cpio_windows.c delete mode 100644 cpio/cpio_windows.h delete mode 100644 cpio/test/CMakeLists.txt delete mode 100644 doc/html/.ignore_me delete mode 100644 doc/man/.ignore_me delete mode 100644 doc/mdoc2man.awk delete mode 100644 doc/mdoc2wiki.awk delete mode 100644 doc/pdf/.ignore_me delete mode 100644 doc/text/.ignore_me delete mode 100644 doc/update.sh delete mode 100644 doc/wiki/.ignore_me delete mode 100644 examples/minitar/Makefile delete mode 100644 examples/minitar/README delete mode 100644 examples/minitar/minitar.c delete mode 100644 examples/tarfilter.c delete mode 100644 examples/untar.c delete mode 100644 libarchive/CMakeLists.txt delete mode 100644 libarchive/archive_entry_copy_bhfi.c delete mode 100644 libarchive/archive_read_disk_windows.c delete mode 100644 libarchive/archive_windows.c delete mode 100644 libarchive/archive_windows.h delete mode 100644 libarchive/archive_write_disk_windows.c delete mode 100644 libarchive/config_freebsd.h delete mode 100644 libarchive/filter_fork_windows.c delete mode 100644 libarchive/mtree.5 delete mode 100644 libarchive/test/.cvsignore delete mode 100644 libarchive/test/CMakeLists.txt delete mode 100644 tar/CMakeLists.txt delete mode 100644 tar/bsdtar_windows.c delete mode 100644 tar/bsdtar_windows.h delete mode 100644 tar/config_freebsd.h delete mode 100644 tar/test/CMakeLists.txt delete mode 100644 tar/test/test_windows.c diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 2cdb9fb48585..000000000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,1525 +0,0 @@ -# -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6 FATAL_ERROR) -# -PROJECT(libarchive C) -# -SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") -if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) -endif() -# -# Set the Build type for make based generators. -# You can choose following types: -# Debug : Debug build -# Release : Release build -# RelWithDebInfo : Release build with Debug Info -# MinSizeRel : Release Min Size build -IF(NOT CMAKE_BUILD_TYPE) - 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". -GET_PROPERTY(cached_type CACHE CMAKE_BUILD_TYPE PROPERTY TYPE) -IF("${cached_type}" STREQUAL "UNINITIALIZED") - SET(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Build Type" FORCE) -ENDIF("${cached_type}" STREQUAL "UNINITIALIZED") -# Check the Build Type. -IF(NOT "${CMAKE_BUILD_TYPE}" - MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)\$") - MESSAGE(FATAL_ERROR - "Unknown keyword for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}\n" - "Acceptable keywords: Debug,Release,RelWithDebInfo,MinSizeRel") -ENDIF(NOT "${CMAKE_BUILD_TYPE}" - MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)\$") - -# On MacOS, prefer MacPorts libraries to system libraries. -# I haven't come up with a compelling argument for this to be conditional. -list(APPEND CMAKE_PREFIX_PATH /opt/local) - -# -# Version - read from 'version' file. -# -FILE(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/build/version _version) -STRING(REGEX REPLACE - "^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]?$" "\\1" _major ${_version}) -STRING(REGEX REPLACE - "^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]?$" "\\1" _minor ${_version}) -STRING(REGEX REPLACE - "^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]?$" "\\1" _revision ${_version}) -STRING(REGEX REPLACE - "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]?)$" "\\1" _quality ${_version}) -SET(_version_number ${_major}${_minor}${_revision}) -STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_minor ${_minor}) -STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_revision ${_revision}) -# -SET(VERSION "${_major}.${_trimmed_minor}.${_trimmed_revision}${_quality}") -SET(BSDCPIO_VERSION_STRING "${VERSION}") -SET(BSDTAR_VERSION_STRING "${VERSION}") -SET(LIBARCHIVE_VERSION_NUMBER "${_version_number}") -SET(LIBARCHIVE_VERSION_STRING "${VERSION}") - -# INTERFACE_VERSION increments with every release -# libarchive 2.7 == interface version 9 = 2 + 7 -# libarchive 2.8 == interface version 10 = 2 + 8 -# libarchive 2.9 == interface version 11 = 2 + 9 -# libarchive 3.0 == interface version 12 -# libarchive 3.1 == interface version 13 -math(EXPR INTERFACE_VERSION "13 + ${_minor}") - -# Set SOVERSION == Interface version -# ?? Should there be more here ?? -SET(SOVERSION "${INTERFACE_VERSION}") - -# Enalbe CMAKE_PUSH_CHECK_STATE() and CMAKE_POP_CHECK_STATE() macros -# saving and restoring the state of the variables. -INCLUDE(CMakePushCheckState) - -# Initialize the state of the variables. This initialization is not -# necessary but this shows you what value the variables initially have. -SET(CMAKE_REQUIRED_DEFINITIONS) -SET(CMAKE_REQUIRED_INCLUDES) -SET(CMAKE_REQUIRED_LIBRARIES) -SET(CMAKE_REQUIRED_FLAGS) - -# Especially for early development, we want to be a little -# aggressive about diagnosing build problems; this can get -# relaxed somewhat in final shipping versions. -IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") - SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") - ################################################################# - # Set compile flags for all build types. - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wformat -Wformat-security") - ################################################################# - # Set compile flags for debug build. - # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror -Wextra -Wunused") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") -ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") -IF (MSVC) - ################################################################# - # Set compile flags for debug build. - # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" - # Enable level 4 C4061: The enumerate has no associated handler in a switch - # statement. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4061") - # Enable level 4 C4254: A larger bit field was assigned to a smaller bit - # field. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4254") - # Enable level 4 C4295: An array was initialized but the last character in - # the array is not a null; accessing the array may - # produce unexpected results. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4295") - # Enable level 4 C4296: An unsigned variable was used in a comparison - # operation with zero. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4296") - # Enable level 4 C4389: An operation involved signed and unsigned variables. - # This could result in a loss of data. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4389") - # Enable level 4 C4505: The given function is local and not referenced in - # the body of the module; therefore, the function is - # dead code. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4505") - # Enable level 4 C4514: The optimizer removed an inline function that is not - # called. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4514") - # Enable level 4 C4702: Unreachable code. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4702") - # Enable level 4 C4706: The test value in a conditional expression was the - # result of an assignment. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4706") - # /WX option is the same as gcc's -Werror option. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /WX") - # /Oi option enables built-in functions. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Oi") - ################################################################# - # Set compile flags for release build. - SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi") -ENDIF (MSVC) - -# Enable CTest/CDash support -include(CTest) - -OPTION(ENABLE_NETTLE "Enable use of Nettle" ON) -OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON) -OPTION(ENABLE_TAR "Enable tar building" ON) -OPTION(ENABLE_TAR_SHARED "Enable dynamic build of tar" FALSE) -OPTION(ENABLE_CPIO "Enable cpio building" ON) -OPTION(ENABLE_CPIO_SHARED "Enable dynamic build of cpio" FALSE) -OPTION(ENABLE_XATTR "Enable extended attribute support" ON) -OPTION(ENABLE_ACL "Enable ACL support" ON) -OPTION(ENABLE_ICONV "Enable iconv support" ON) -OPTION(ENABLE_TEST "Enable unit and regression tests" ON) -SET(POSIX_REGEX_LIB "AUTO" CACHE STRING "Choose what library should provide POSIX regular expression support") -SET(ENABLE_SAFESEH "AUTO" CACHE STRING "Enable use of /SAFESEH linker flag (MSVC only)") -SET(WINDOWS_VERSION "" CACHE STRING "Set Windows version to use (Windows only)") - -IF(ENABLE_TEST) - ENABLE_TESTING() -ENDIF(ENABLE_TEST) - -IF(WIN32) - IF(WINDOWS_VERSION STREQUAL "WIN8") - SET(WINVER 0x0602) - ELSEIF(WINDOWS_VERSION STREQUAL "WIN7") - SET(WINVER 0x0601) - ELSEIF(WINDOWS_VERSION STREQUAL "WS08") - SET(WINVER 0x0600) - ELSEIF(WINDOWS_VERSION STREQUAL "VISTA") - SET(WINVER 0x0600) - ELSEIF(WINDOWS_VERSION STREQUAL "WS03") - SET(WINVER 0x0502) - ELSEIF(WINDOWS_VERSION STREQUAL "WINXP") - SET(WINVER 0x0501) - ELSE(WINDOWS_VERSION STREQUAL "WIN8") - # The default is to use Windows 2000 API. - SET(WINVER 0x0500) - ENDIF(WINDOWS_VERSION STREQUAL "WIN8") - SET(_WIN32_WINNT ${WINVER}) -ENDIF(WIN32) - -IF(MSVC) - IF(ENABLE_SAFESEH STREQUAL "YES") - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH") - SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH") - SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH") - SET(CMAKE_REQUIRED_LINKER_FLAGS "/SAFESEH") - ELSEIF(ENABLE_SAFESEH STREQUAL "NO") - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") - SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") - SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO") - SET(CMAKE_REQUIRED_LINKER_FLAGS "/SAFESEH:NO") - ENDIF(ENABLE_SAFESEH STREQUAL "YES") -ENDIF(MSVC) - -IF("${CMAKE_C_PLATFORM_ID}" MATCHES "^(HP-UX)$") - ADD_DEFINITIONS(-D_XOPEN_SOURCE=500) # Ask wchar.h for mbstate_t -ENDIF() - -# -INCLUDE(LibarchiveCheckCSourceCompiles) -INCLUDE(LibarchiveCheckCSourceRuns) -INCLUDE(CheckFileOffsetBits) -INCLUDE(CheckFuncs) -INCLUDE(CheckHeaderDirent) -INCLUDE(CheckIncludeFile) -INCLUDE(CheckIncludeFiles) -INCLUDE(CheckLibraryExists) -INCLUDE(CheckStructMember) -INCLUDE(CheckSymbolExists) -INCLUDE(CheckTypeExists) -INCLUDE(CheckTypeSize) - -# -# Generate list.h -# -MACRO (GENERATE_LIST_H _listfile _cmlist __list_sources) - SET(_argv ${ARGV}) - # Remove _listfile and _cmlist from _argv - LIST(REMOVE_AT _argv 0 1) - IF (NOT EXISTS "${_listfile}" OR - ${_cmlist} IS_NEWER_THAN "${_listfile}") - - MESSAGE(STATUS "Generating ${_listfile}") - FILE(WRITE ${_listfile} "") - FOREACH (testfile ${_argv}) - IF (testfile MATCHES "^test_[^/]+[.]c$") - FILE(STRINGS ${testfile} testvar REGEX "^DEFINE_TEST") - FOREACH (deftest ${testvar}) - FILE(APPEND ${_listfile} "${deftest}\n") - ENDFOREACH (deftest) - ENDIF (testfile MATCHES "^test_[^/]+[.]c$") - ENDFOREACH (testfile) - - ENDIF (NOT EXISTS "${_listfile}" OR - ${_cmlist} IS_NEWER_THAN "${_listfile}") -ENDMACRO (GENERATE_LIST_H) -# -# Generate installation rules for man pages. -# -MACRO (INSTALL_MAN __mans) - FOREACH (_man ${ARGV}) - STRING(REGEX REPLACE "^.+[.]([1-9])" "\\1" _mansect ${_man}) - INSTALL(FILES ${_man} DESTINATION "share/man/man${_mansect}") - ENDFOREACH (_man) -ENDMACRO (INSTALL_MAN __mans) -# -# Find out what macro is needed to use libraries on Windows. -# -MACRO (TRY_MACRO_FOR_LIBRARY INCLUDES LIBRARIES - TRY_TYPE SAMPLE_SOURCE MACRO_LIST) - IF(WIN32 AND NOT CYGWIN) - CMAKE_PUSH_CHECK_STATE() # Save the state of the variables - SET(CMAKE_REQUIRED_INCLUDES ${INCLUDES}) - SET(CMAKE_REQUIRED_LIBRARIES ${LIBRARIES}) - FOREACH(VAR ${MACRO_LIST}) - # Clear ${VAR} from CACHE If the libraries which ${VAR} was - # checked with are changed. - SET(VAR_WITH_LIB "${VAR}_WITH_LIB") - GET_PROPERTY(PREV_VAR_WITH_LIB VARIABLE PROPERTY ${VAR_WITH_LIB}) - IF(NOT "${PREV_VAR_WITH_LIB}" STREQUAL "${LIBRARIES}") - UNSET(${VAR} CACHE) - ENDIF(NOT "${PREV_VAR_WITH_LIB}" STREQUAL "${LIBRARIES}") - # Check if the library can be used with the macro. - IF("${TRY_TYPE}" MATCHES "COMPILES") - LIBARCHIVE_CHECK_C_SOURCE_COMPILES("${SAMPLE_SOURCE}" ${VAR}) - ELSEIF("${TRY_TYPE}" MATCHES "RUNS") - LIBARCHIVE_CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR}) - ELSE("${TRY_TYPE}" MATCHES "COMPILES") - MESSAGE(FATAL_ERROR "UNKNOWN KEYWORD \"${TRY_TYPE}\" FOR TRY_TYPE") - ENDIF("${TRY_TYPE}" MATCHES "COMPILES") - # Save the libraries which ${VAR} is checked with. - SET(${VAR_WITH_LIB} "${LIBRARIES}" CACHE INTERNAL - "Macro ${VAR} is checked with") - ENDFOREACH(VAR) - CMAKE_POP_CHECK_STATE() # Restore the state of the variables - ENDIF(WIN32 AND NOT CYGWIN) -ENDMACRO (TRY_MACRO_FOR_LIBRARY) -# -# Check compress/decompress libraries -# -IF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN) - # GnuWin32 is only for Win32, not Win64. - SET(__GNUWIN32PATH "C:/Program Files/GnuWin32") -ENDIF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN) -IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") - # You have to add a path availabel DLL file into PATH environment variable. - # Maybe DLL path is "C:/Program Files/GnuWin32/bin". - # The zlib and the bzip2 Setup program have installed programs and DLLs into - # "C:/Program Files/GnuWin32" by default. - # This is convenience setting for Windows. - SET(CMAKE_PREFIX_PATH ${__GNUWIN32PATH} $(CMAKE_PREFIX_PATH)) - # - # If you didn't use Setup program or installed into nonstandard path, - # cmake cannot find out your zlib or bzip2 libraries and include files, - # you should execute cmake with -DCMAKE_PREFIX_PATH option. - # e.g. - # cmake -DCMAKE_PREFIX_PATH= - # - # If compiling error occured in zconf.h, You may need patch to zconf.h. - #--- zconf.h.orig 2005-07-21 00:40:26.000000000 - #+++ zconf.h 2009-01-19 11:39:10.093750000 - #@@ -286,7 +286,7 @@ - # - # #if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */ - # # include /* for off_t */ - #-# include /* for SEEK_* and off_t */ - #+# include /* for SEEK_* and off_t */ - # # ifdef VMS - # # include /* for off_t */ - # # endif -ENDIF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") - -SET(ADDITIONAL_LIBS "") -# -# Find ZLIB -# -FIND_PACKAGE(ZLIB) -IF(ZLIB_FOUND) - SET(HAVE_LIBZ 1) - SET(HAVE_ZLIB_H 1) - INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) - IF(WIN32 AND NOT CYGWIN) - # - # Test if ZLIB_WINAPI macro is needed to use. - # - TRY_MACRO_FOR_LIBRARY( - "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" - RUNS - "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" - ZLIB_WINAPI) - IF(ZLIB_WINAPI) - ADD_DEFINITIONS(-DZLIB_WINAPI) - ELSE(ZLIB_WINAPI) - # Test if a macro is needed for the library. - TRY_MACRO_FOR_LIBRARY( - "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" - COMPILES - "#include \nint main() {return zlibVersion()?1:0; }" - "ZLIB_DLL;WITHOUT_ZLIB_DLL") - IF(ZLIB_DLL) - ADD_DEFINITIONS(-DZLIB_DLL) - ENDIF(ZLIB_DLL) - ENDIF(ZLIB_WINAPI) - ENDIF(WIN32 AND NOT CYGWIN) -ENDIF(ZLIB_FOUND) -MARK_AS_ADVANCED(CLEAR ZLIB_INCLUDE_DIR) -MARK_AS_ADVANCED(CLEAR ZLIB_LIBRARY) -# -# Find BZip2 -# -FIND_PACKAGE(BZip2) -IF(BZIP2_FOUND) - SET(HAVE_LIBBZ2 1) - SET(HAVE_BZLIB_H 1) - INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES}) - # Test if a macro is needed for the library. - TRY_MACRO_FOR_LIBRARY( - "${BZIP2_INCLUDE_DIR}" "${BZIP2_LIBRARIES}" - COMPILES - "#include \nint main() {return BZ2_bzlibVersion()?1:0; }" - "USE_BZIP2_DLL;USE_BZIP2_STATIC") - IF(USE_BZIP2_DLL) - ADD_DEFINITIONS(-DUSE_BZIP2_DLL) - ELSEIF(USE_BZIP2_STATIC) - ADD_DEFINITIONS(-DUSE_BZIP2_STATIC) - ENDIF(USE_BZIP2_DLL) -ENDIF(BZIP2_FOUND) -MARK_AS_ADVANCED(CLEAR BZIP2_INCLUDE_DIR) -MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARIES) -# -# Find LZMA -# -FIND_PACKAGE(LZMA) -IF(LZMA_FOUND) - SET(HAVE_LIBLZMA 1) - SET(HAVE_LZMA_H 1) - INCLUDE_DIRECTORIES(${LZMA_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${LZMA_LIBRARIES}) - # Test if a macro is needed for the library. - TRY_MACRO_FOR_LIBRARY( - "${LZMA_INCLUDE_DIR}" "${LZMA_LIBRARIES}" - COMPILES - "#include \nint main() {return (int)lzma_version_number(); }" - "WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC") - 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) -ELSEIF(LZMADEC_FOUND) - SET(HAVE_LIBLZMADEC 1) - SET(HAVE_LZMADEC_H 1) - INCLUDE_DIRECTORIES(${LZMADEC_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${LZMADEC_LIBRARIES}) -ENDIF(LZMA_FOUND) -# -# Find LZO2 -# -IF (LZO2_INCLUDE_DIR) - # Already in cache, be silent - SET(LZO2_FIND_QUIETLY TRUE) -ENDIF (LZO2_INCLUDE_DIR) - -FIND_PATH(LZO2_INCLUDE_DIR lzo/lzoconf.h) -FIND_LIBRARY(LZO2_LIBRARY NAMES lzo2 liblzo2) -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO2 DEFAULT_MSG LZO2_LIBRARY LZO2_INCLUDE_DIR) -IF(LZO2_FOUND) - SET(HAVE_LIBLZO2 1) - SET(HAVE_LZO_LZOCONF_H 1) - SET(HAVE_LZO_LZO1X_H 1) - INCLUDE_DIRECTORIES(${LZO2_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${LZO2_LIBRARY}) - # - # TODO: test for static library. - # -ENDIF(LZO2_FOUND) -MARK_AS_ADVANCED(CLEAR LZO2_INCLUDE_DIR) -MARK_AS_ADVANCED(CLEAR LZO2_LIBRARY) - -# -# Check headers -# -CHECK_HEADER_DIRENT() - -SET(INCLUDES "") -MACRO (LA_CHECK_INCLUDE_FILE header var) - CHECK_INCLUDE_FILES("${INCLUDES};${header}" ${var}) - IF (${var}) - SET(INCLUDES ${INCLUDES} ${header}) - ENDIF (${var}) -ENDMACRO (LA_CHECK_INCLUDE_FILE) - -# Some FreeBSD headers assume sys/types.h was already included. -LA_CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H) - -# Alphabetize the rest unless there's a compelling reason -LA_CHECK_INCLUDE_FILE("acl/libacl.h" HAVE_ACL_LIBACL_H) -LA_CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H) -LA_CHECK_INCLUDE_FILE("copyfile.h" HAVE_COPYFILE_H) -LA_CHECK_INCLUDE_FILE("direct.h" HAVE_DIRECT_H) -LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H) -LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H) -LA_CHECK_INCLUDE_FILE("ext2fs/ext2_fs.h" HAVE_EXT2FS_EXT2_FS_H) - -LIBARCHIVE_CHECK_C_SOURCE_COMPILES("#include -#include -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("grp.h" HAVE_GRP_H) -LA_CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H) -LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H) -LA_CHECK_INCLUDE_FILE("langinfo.h" HAVE_LANGINFO_H) -LA_CHECK_INCLUDE_FILE("limits.h" HAVE_LIMITS_H) -LA_CHECK_INCLUDE_FILE("linux/types.h" HAVE_LINUX_TYPES_H) -LA_CHECK_INCLUDE_FILE("linux/fiemap.h" HAVE_LINUX_FIEMAP_H) -LA_CHECK_INCLUDE_FILE("linux/fs.h" HAVE_LINUX_FS_H) -LA_CHECK_INCLUDE_FILE("linux/magic.h" HAVE_LINUX_MAGIC_H) -LA_CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H) -LA_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H) -LA_CHECK_INCLUDE_FILE("paths.h" HAVE_PATHS_H) -LA_CHECK_INCLUDE_FILE("poll.h" HAVE_POLL_H) -LA_CHECK_INCLUDE_FILE("process.h" HAVE_PROCESS_H) -LA_CHECK_INCLUDE_FILE("pwd.h" HAVE_PWD_H) -LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H) -LA_CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H) -LA_CHECK_INCLUDE_FILE("spawn.h" HAVE_SPAWN_H) -LA_CHECK_INCLUDE_FILE("stdarg.h" HAVE_STDARG_H) -LA_CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H) -LA_CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H) -LA_CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H) -LA_CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H) -LA_CHECK_INCLUDE_FILE("sys/acl.h" HAVE_SYS_ACL_H) -LA_CHECK_INCLUDE_FILE("sys/cdefs.h" HAVE_SYS_CDEFS_H) -LA_CHECK_INCLUDE_FILE("sys/ioctl.h" HAVE_SYS_IOCTL_H) -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/select.h" HAVE_SYS_SELECT_H) -LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H) -LA_CHECK_INCLUDE_FILE("sys/statfs.h" HAVE_SYS_STATFS_H) -LA_CHECK_INCLUDE_FILE("sys/statvfs.h" HAVE_SYS_STATVFS_H) -LA_CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H) -LA_CHECK_INCLUDE_FILE("sys/utime.h" HAVE_SYS_UTIME_H) -LA_CHECK_INCLUDE_FILE("sys/utsname.h" HAVE_SYS_UTSNAME_H) -LA_CHECK_INCLUDE_FILE("sys/vfs.h" HAVE_SYS_VFS_H) -LA_CHECK_INCLUDE_FILE("sys/wait.h" HAVE_SYS_WAIT_H) -LA_CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H) -LA_CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) -LA_CHECK_INCLUDE_FILE("utime.h" HAVE_UTIME_H) -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) -# Following files need windwos.h, so we should test it after windows.h test. -LA_CHECK_INCLUDE_FILE("wincrypt.h" HAVE_WINCRYPT_H) -LA_CHECK_INCLUDE_FILE("winioctl.h" HAVE_WINIOCTL_H) - -# -# Check whether use of __EXTENSIONS__ is safe. -# We need some macro such as _GNU_SOURCE to use extension functions. -# -SET(_INCLUDE_FILES) -FOREACH (it ${_HEADER}) - SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") -ENDFOREACH (it) - -LIBARCHIVE_CHECK_C_SOURCE_COMPILES( - "#define __EXTENSIONS__ 1 - ${_INCLUDE_FILES} - int main() { return 0;}" - SAFE_TO_DEFINE_EXTENSIONS) - -# -# Find Nettle -# -IF(ENABLE_NETTLE) - FIND_PACKAGE(Nettle) - IF(NETTLE_FOUND) - SET(HAVE_LIBNETTLE 1) - SET(HAVE_NETTLE_MD5_H 1) - SET(HAVE_NETTLE_RIPEMD160_H 1) - SET(HAVE_NETTLE_SHA_H 1) - INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES}) - ENDIF(NETTLE_FOUND) - MARK_AS_ADVANCED(CLEAR NETTLE_INCLUDE_DIR) - MARK_AS_ADVANCED(CLEAR NETTLE_LIBRARIES) -ENDIF(ENABLE_NETTLE) - -# -# Find OpenSSL -# (Except on Mac, where OpenSSL is deprecated.) -# -IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") - FIND_PACKAGE(OpenSSL) -ELSE() - SET(OPENSSL_FOUND FALSE) # Override cached value -ENDIF() - -# FreeBSD libmd -IF(NOT OPENSSL_FOUND) - CHECK_LIBRARY_EXISTS(md "MD5Init" "" LIBMD_FOUND) - IF(LIBMD_FOUND) - CMAKE_PUSH_CHECK_STATE() # Save the state of the variables - SET(CMAKE_REQUIRED_LIBRARIES "md") - FIND_LIBRARY(LIBMD_LIBRARY NAMES md) - LIST(APPEND ADDITIONAL_LIBS ${LIBMD_LIBRARY}) - CMAKE_POP_CHECK_STATE() # Restore the state of the variables - ENDIF(LIBMD_FOUND) -ENDIF(NOT OPENSSL_FOUND) - -# -# How to prove that CRYPTO functions, which have several names on various -# platforms, just see if archive_crypto.c can compile and link against -# required libraries. -# -MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) - FOREACH(ALGORITHM ${ALGORITHMS}) - IF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) - STRING(TOLOWER "${ALGORITHM}" lower_algorithm) - STRING(TOUPPER "${ALGORITHM}" algorithm) - IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) - SET(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} FALSE) - ELSEIF("${IMPLEMENTATION}" MATCHES "^NETTLE$" AND NOT NETTLE_FOUND) - SET(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} FALSE) - ENDIF("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) - - IF(NOT DEFINED ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) - # Probe the local implementation for whether this - # crypto implementation is available on this platform. - SET(TRY_CRYPTO_REQUIRED_INCLUDES - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive;${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp") - SET(TRY_CRYPTO_REQUIRED_LIBS) - IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) - SET(TRY_CRYPTO_REQUIRED_INCLUDES - "${TRY_CRYPTO_REQUIRED_INCLUDES};${OPENSSL_INCLUDE_DIR}") - SET(TRY_CRYPTO_REQUIRED_LIBS - "-DLINK_LIBRARIES:STRING=${OPENSSL_LIBRARIES}") - ELSEIF("${IMPLEMENTATION}" MATCHES "^NETTLE$" AND NETTLE_FOUND) - SET(TRY_CRYPTO_REQUIRED_INCLUDES - "${TRY_CRYPTO_REQUIRED_INCLUDES};${NETTLE_INCLUDE_DIR}") - SET(TRY_CRYPTO_REQUIRED_LIBS - "-DLINK_LIBRARIES:STRING=${NETTLE_LIBRARY}") - ELSEIF("${IMPLEMENTATION}" MATCHES "^LIBMD$" AND LIBMD_FOUND) - SET(TRY_CRYPTO_REQUIRED_LIBS - "-DLINK_LIBRARIES:STRING=${LIBMD_LIBRARY}") - ENDIF("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) - - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h) - FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h" - CONFDEFS_H) - FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/libarchive/archive_crypto.c" - ARCHIVE_CRYPTO_C) - - SET(SOURCE "${CONFDEFS_H} - -#define ARCHIVE_${algorithm}_COMPILE_TEST -#define ARCHIVE_CRYPTO_${algorithm}_${IMPLEMENTATION} -#define PLATFORM_CONFIG_H \"check_crypto_md.h\" - -${ARCHIVE_CRYPTO_C} - -int -main(int argc, char **argv) -{ - archive_${lower_algorithm}_ctx ctx; - archive_${lower_algorithm}_init(&ctx); - archive_${lower_algorithm}_update(&ctx, *argv, argc); - archive_${lower_algorithm}_final(&ctx, NULL); - return 0; -} -") - - FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.h" "") - FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c" "${SOURCE}") - MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}") - - IF(CMAKE_REQUIRED_LINKER_FLAGS) - SET(CHECK_CRYPTO_ADD_LINKER_FLAGS - "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") - ELSE(CMAKE_REQUIRED_LINKER_FLAGS) - SET(CHECK_CRYPTO_ADD_LINKER_FLAGS) - ENDIF(CMAKE_REQUIRED_LINKER_FLAGS) - TRY_COMPILE(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c - CMAKE_FLAGS ${CHECK_CRYPTO_ADD_LINKER_FLAGS} - "${TRY_CRYPTO_REQUIRED_LIBS}" - "${TRY_CRYPTO_REQUIRED_INCLUDES}" - OUTPUT_VARIABLE OUTPUT) - - # Inform user whether or not we found it; if not, log why we didn't. - IF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) - MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} -- found") - SET(ARCHIVE_CRYPTO_${ALGORITHM} 1) - ELSE (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) - MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} -- not found") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} failed with the following output:\n" - "${OUTPUT}\n" - "Source file was:\n${SOURCE}\n") - ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) - ENDIF(NOT DEFINED ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) - - # Add appropriate libs/includes depending on whether the implementation - # was found on this platform. - IF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) - IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) - INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES}) - LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS) - ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) - ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) - ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) - ENDFOREACH(ALGORITHM ${ALGORITHMS}) -ENDMACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) - -# -# CRYPTO functions on Windows is defined at archive_windows.c, thus we do not -# need the test what the functions can be mapped to archive_{crypto name}_init, -# archive_{crypto name}_update and archive_{crypto name}_final. -# The functions on Windows use CALG_{crypto name} macro to create a crypt object -# and then we need to know what CALG_{crypto name} macros is available to show -# ARCHIVE_CRYPTO_{crypto name}_WIN macros because Windows 2000 and earlier version -# of Windows XP do not support SHA256, SHA384 and SHA512. -# -MACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) - IF(WIN32 AND NOT CYGWIN) - FOREACH(CRYPTO ${CRYPTO_LIST}) - IF(NOT ARCHIVE_CRYPTO_${CRYPTO}) - IF(NOT DEFINED ARCHIVE_CRYPTO_${CRYPTO}_WIN) - STRING(TOUPPER "${CRYPTO}" crypto) - SET(ALGID "") - IF ("${CRYPTO}" MATCHES "^MD5$") - SET(ALGID "CALG_MD5") - ENDIF ("${CRYPTO}" MATCHES "^MD5$") - IF ("${CRYPTO}" MATCHES "^SHA1$") - SET(ALGID "CALG_SHA1") - ENDIF ("${CRYPTO}" MATCHES "^SHA1$") - IF ("${CRYPTO}" MATCHES "^SHA256$") - SET(ALGID "CALG_SHA_256") - ENDIF ("${CRYPTO}" MATCHES "^SHA256$") - IF ("${CRYPTO}" MATCHES "^SHA384$") - SET(ALGID "CALG_SHA_384") - ENDIF ("${CRYPTO}" MATCHES "^SHA384$") - IF ("${CRYPTO}" MATCHES "^SHA512$") - SET(ALGID "CALG_SHA_512") - ENDIF ("${CRYPTO}" MATCHES "^SHA512$") - - CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h) - FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h" - CONFDEFS_H) - - SET(SOURCE "${CONFDEFS_H} - -#define ${crypto}_COMPILE_TEST -#include -#include - -int -main(int argc, char **argv) -{ - return ${ALGID}; -} -") - SET(SOURCE_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_win.c") - - FILE(WRITE "${SOURCE_FILE}" "${SOURCE}") - MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN") - - IF(CMAKE_REQUIRED_LINKER_FLAGS) - SET(CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS - "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") - ELSE(CMAKE_REQUIRED_LINKER_FLAGS) - SET(CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS) - ENDIF(CMAKE_REQUIRED_LINKER_FLAGS) - TRY_COMPILE(ARCHIVE_CRYPTO_${CRYPTO}_WIN - ${CMAKE_BINARY_DIR} - ${SOURCE_FILE} - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive" ${CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS} - OUTPUT_VARIABLE OUTPUT) - - IF (ARCHIVE_CRYPTO_${CRYPTO}_WIN) - MESSAGE(STATUS - "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN -- found") - SET(ARCHIVE_CRYPTO_${CRYPTO} 1) - ELSE (ARCHIVE_CRYPTO_${CRYPTO}_WIN) - MESSAGE(STATUS - "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN -- not found") - FILE(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN failed with the following output:\n" - "${OUTPUT}\n" - "Source file was:\n${SOURCE}\n") - ENDIF (ARCHIVE_CRYPTO_${CRYPTO}_WIN) - - ENDIF(NOT DEFINED ARCHIVE_CRYPTO_${CRYPTO}_WIN) - ENDIF(NOT ARCHIVE_CRYPTO_${CRYPTO}) - ENDFOREACH(CRYPTO) - ENDIF(WIN32 AND NOT CYGWIN) -ENDMACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) - -# -# Find iconv -# POSIX defines the second arg as const char ** -# and requires it to be in libc. But we can accept -# a non-const argument here and can support iconv() -# being in libiconv. -# -MACRO(CHECK_ICONV LIB TRY_ICONV_CONST) - IF(NOT HAVE_ICONV) - CMAKE_PUSH_CHECK_STATE() # Save the state of the variables - IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") - # - # During checking iconv proto type, we should use -Werror to avoid the - # success of iconv detection with a warnig which success is a miss - # detection. So this needs for all build mode(even it's a release mode). - # - SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") - ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") - IF (MSVC) - # NOTE: /WX option is the same as gcc's -Werror option. - SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /WX") - ENDIF (MSVC) - # - LIBARCHIVE_CHECK_C_SOURCE_COMPILES( - "#include - #include - int main() { - ${TRY_ICONV_CONST} char *ccp; - iconv_t cd = iconv_open(\"\", \"\"); - iconv(cd, &ccp, (size_t *)0, (char **)0, (size_t *)0); - iconv_close(cd); - return 0; - }" - HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) - IF(HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) - SET(HAVE_ICONV true) - SET(ICONV_CONST ${TRY_ICONV_CONST}) - ENDIF(HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) - CMAKE_POP_CHECK_STATE() # Restore the state of the variables - ENDIF(NOT HAVE_ICONV) -ENDMACRO(CHECK_ICONV TRY_ICONV_CONST) - -IF(ENABLE_ICONV) - CMAKE_PUSH_CHECK_STATE() # Save the state of the variables - FIND_PATH(ICONV_INCLUDE_DIR iconv.h) - IF(ICONV_INCLUDE_DIR) - #SET(INCLUDES ${INCLUDES} "iconv.h") - SET(HAVE_ICONV_H 1) - INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR}) - SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) - CHECK_ICONV("libc" "const") - CHECK_ICONV("libc" "") - - # If iconv isn't in libc and we have a libiconv, try that. - FIND_LIBRARY(LIBICONV_PATH NAMES iconv libiconv) - IF(NOT HAVE_ICONV AND LIBICONV_PATH) - LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBICONV_PATH}) - # Test if a macro is needed for the library. - TRY_MACRO_FOR_LIBRARY( - "${ICONV_INCLUDE_DIR}" "${LIBICONV_PATH}" - COMPILES - "#include \nint main() {return iconv_close((iconv_t)0);}" - "WITHOUT_LIBICONV_STATIC;LIBICONV_STATIC") - IF(NOT WITHOUT_LIBICONV_STATIC AND LIBICONV_STATIC) - ADD_DEFINITIONS(-DLIBICONV_STATIC) - ENDIF(NOT WITHOUT_LIBICONV_STATIC AND LIBICONV_STATIC) - # - # Set up CMAKE_REQUIRED_* for CHECK_ICONV - # - SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) - SET(CMAKE_REQUIRED_LIBRARIES ${LIBICONV_PATH}) - IF(LIBICONV_STATIC) - # LIBICONV_STATIC is necessary for the success of CHECK_ICONV - # on Windows. - SET(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC") - ELSE(LIBICONV_STATIC) - SET(CMAKE_REQUIRED_DEFINITIONS) - ENDIF(LIBICONV_STATIC) - CHECK_ICONV("libiconv" "const") - CHECK_ICONV("libiconv" "") - IF (HAVE_ICONV) - LIST(APPEND ADDITIONAL_LIBS ${LIBICONV_PATH}) - ENDIF(HAVE_ICONV) - ENDIF(NOT HAVE_ICONV AND LIBICONV_PATH) - ENDIF(ICONV_INCLUDE_DIR) - # - # Find locale_charset() for libiconv. - # - IF(LIBICONV_PATH) - SET(CMAKE_REQUIRED_DEFINITIONS) - SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) - SET(CMAKE_REQUIRED_LIBRARIES) - CHECK_INCLUDE_FILES("localcharset.h" HAVE_LOCALCHARSET_H) - FIND_LIBRARY(LIBCHARSET_PATH NAMES charset libcharset) - IF(LIBCHARSET_PATH) - SET(CMAKE_REQUIRED_LIBRARIES ${LIBCHARSET_PATH}) - IF(WIN32 AND NOT CYGWIN) - # Test if a macro is needed for the library. - TRY_MACRO_FOR_LIBRARY( - "${ICONV_INCLUDE_DIR}" "${LIBCHARSET_PATH}" - COMPILES - "#include \nint main() {return locale_charset()?1:0;}" - "WITHOUT_LIBCHARSET_STATIC;LIBCHARSET_STATIC") - IF(NOT WITHOUT_LIBCHARSET_STATIC AND LIBCHARSET_STATIC) - ADD_DEFINITIONS(-DLIBCHARSET_STATIC) - ENDIF(NOT WITHOUT_LIBCHARSET_STATIC AND LIBCHARSET_STATIC) - IF(WITHOUT_LIBCHARSET_STATIC OR LIBCHARSET_STATIC) - SET(HAVE_LOCALE_CHARSET ON CACHE INTERNAL - "Have function locale_charset") - ENDIF(WITHOUT_LIBCHARSET_STATIC OR LIBCHARSET_STATIC) - ELSE(WIN32 AND NOT CYGWIN) - CHECK_FUNCTION_EXISTS_GLIBC(locale_charset HAVE_LOCALE_CHARSET) - ENDIF(WIN32 AND NOT CYGWIN) - IF(HAVE_LOCALE_CHARSET) - LIST(APPEND ADDITIONAL_LIBS ${LIBCHARSET_PATH}) - ENDIF(HAVE_LOCALE_CHARSET) - ENDIF(LIBCHARSET_PATH) - ENDIF(LIBICONV_PATH) - CMAKE_POP_CHECK_STATE() # Restore the state of the variables -ELSE(ENABLE_ICONV) - # Make sure ICONV variables are not in CACHE after ENABLE_ICONV disabled - # (once enabled). - UNSET(HAVE_LOCALE_CHARSET CACHE) - UNSET(HAVE_ICONV CACHE) - UNSET(HAVE_ICONV_libc_ CACHE) - UNSET(HAVE_ICONV_libc_const CACHE) - UNSET(HAVE_ICONV_libiconv_ CACHE) - UNSET(HAVE_ICONV_libiconv_const CACHE) - UNSET(ICONV_INCLUDE_DIR CACHE) - UNSET(LIBICONV_PATH CACHE) - UNSET(LIBICONV_DLL CACHE) - UNSET(LIBICONV_STATIC CACHE) - UNSET(LIBCHARSET_DLL CACHE) - UNSET(LIBCHARSET_STATIC CACHE) -ENDIF(ENABLE_ICONV) - -# -# Find Libxml2 -# -FIND_PACKAGE(LibXml2) -IF(LIBXML2_FOUND) - CMAKE_PUSH_CHECK_STATE() # Save the state of the variables - INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${LIBXML2_LIBRARIES}) - SET(HAVE_LIBXML2 1) - # libxml2's include files use iconv.h - SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}) - CHECK_INCLUDE_FILES("libxml/xmlreader.h" HAVE_LIBXML_XMLREADER_H) - CHECK_INCLUDE_FILES("libxml/xmlwriter.h" HAVE_LIBXML_XMLWRITER_H) - # Test if a macro is needed for the library. - TRY_MACRO_FOR_LIBRARY( - "${ICONV_INCLUDE_DIR};${LIBXML2_INCLUDE_DIR}" - "ws2_32.lib;${ZLIB_LIBRARIES};${LIBICONV_PATH};${LIBXML2_LIBRARIES}" - COMPILES - "#include \n#include \nint main() {return xmlTextReaderRead((xmlTextReaderPtr)(void *)0);}" - "WITHOUT_LIBXML_STATIC;LIBXML_STATIC") - IF(NOT WITHOUT_LIBXML_STATIC AND LIBXML_STATIC) - ADD_DEFINITIONS(-DLIBXML_STATIC) - ENDIF(NOT WITHOUT_LIBXML_STATIC AND LIBXML_STATIC) - CMAKE_POP_CHECK_STATE() # Restore the state of the variables -ELSE(LIBXML2_FOUND) - # - # Find Expat - # - FIND_PACKAGE(EXPAT) - IF(EXPAT_FOUND) - CMAKE_PUSH_CHECK_STATE() # Save the state of the variables - INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${EXPAT_LIBRARIES}) - SET(HAVE_LIBEXPAT 1) - LA_CHECK_INCLUDE_FILE("expat.h" HAVE_EXPAT_H) - CMAKE_POP_CHECK_STATE() # Restore the state of the variables - ENDIF(EXPAT_FOUND) -ENDIF(LIBXML2_FOUND) -MARK_AS_ADVANCED(CLEAR LIBXML2_INCLUDE_DIR) -MARK_AS_ADVANCED(CLEAR LIBXML2_LIBRARIES) - -# -# POSIX Regular Expression support -# -IF(POSIX_REGEX_LIB MATCHES "^(AUTO|LIBC|LIBREGEX)$") - # - # If PCREPOSIX is not found or not requested, try using regex - # from libc or libregex - # - FIND_PATH(REGEX_INCLUDE_DIR regex.h) - IF(REGEX_INCLUDE_DIR) - CHECK_FUNCTION_EXISTS_GLIBC(regcomp HAVE_REGCOMP_LIBC) - # - # If libc does not provide regex, find libregex. - # - IF(NOT HAVE_REGCOMP_LIBC) - CMAKE_PUSH_CHECK_STATE() # Save the state of the variables - FIND_LIBRARY(REGEX_LIBRARY regex) - IF(REGEX_LIBRARY) - SET(CMAKE_REQUIRED_LIBRARIES ${REGEX_LIBRARY}) - CHECK_FUNCTION_EXISTS_GLIBC(regcomp HAVE_REGCOMP_LIBREGEX) - IF(HAVE_REGCOMP_LIBREGEX) - LIST(APPEND ADDITIONAL_LIBS ${REGEX_LIBRARY}) - # - # If regex.h is not found, retry looking for regex.h at - # REGEX_INCLUDE_DIR - # - IF(NOT HAVE_REGEX_H) - UNSET(HAVE_REGEX_H CACHE) - INCLUDE_DIRECTORIES(${REGEX_INCLUDE_DIR}) - SET(CMAKE_REQUIRED_INCLUDES ${REGEX_INCLUDE_DIR}) - LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H) - ENDIF(NOT HAVE_REGEX_H) - # Test if a macro is needed for the library. - TRY_MACRO_FOR_LIBRARY( - "${REGEX_INCLUDE_DIR}" "${REGEX_LIBRARY}" - COMPILES - "#include \n#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" - "USE_REGEX_DLL;USE_REGEX_STATIC") - IF(USE_REGEX_DLL) - ADD_DEFINITIONS(-DUSE_REGEX_DLL) - ELSEIF(USE_REGEX_STATIC) - ADD_DEFINITIONS(-DUSE_REGEX_STATIC) - ENDIF(USE_REGEX_DLL) - ENDIF(HAVE_REGCOMP_LIBREGEX) - ENDIF(REGEX_LIBRARY) - CMAKE_POP_CHECK_STATE() # Restore the state of the variables - ENDIF(NOT HAVE_REGCOMP_LIBC) - ENDIF(REGEX_INCLUDE_DIR) - IF(HAVE_REGCOMP_LIBC OR HAVE_REGCOMP_LIBREGEX) - SET(FOUND_POSIX_REGEX_LIB 1) - ENDIF(HAVE_REGCOMP_LIBC OR HAVE_REGCOMP_LIBREGEX) -ENDIF(POSIX_REGEX_LIB MATCHES "^(AUTO|LIBC|LIBREGEX)$") - -IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$") - # - # If requested, try finding library for PCREPOSIX - # - FIND_PACKAGE(LibGCC) - FIND_PACKAGE(PCREPOSIX) - IF(PCREPOSIX_FOUND) - INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR}) - LIST(APPEND ADDITIONAL_LIBS ${PCREPOSIX_LIBRARIES}) - # Test if a macro is needed for the library. - TRY_MACRO_FOR_LIBRARY( - "${PCRE_INCLUDE_DIR}" "${PCREPOSIX_LIBRARIES}" - COMPILES - "#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" - "WITHOUT_PCRE_STATIC;PCRE_STATIC") - IF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) - ADD_DEFINITIONS(-DPCRE_STATIC) - ELSEIF(NOT WITHOUT_PCRE_STATIC AND NOT PCRE_STATIC AND PCRE_FOUND) - # Determine if pcre static libraries are to be used. - LIST(APPEND ADDITIONAL_LIBS ${PCRE_LIBRARIES}) - SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES}) - MESSAGE(STATUS "trying again with -lpcre included") - TRY_MACRO_FOR_LIBRARY( - "${PCRE_INCLUDE_DIR}" "${TMP_LIBRARIES}" - COMPILES - "#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" - "WITHOUT_PCRE_STATIC;PCRE_STATIC") - IF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) - ADD_DEFINITIONS(-DPCRE_STATIC) - ELSEIF(NOT WITHOUT_PCRE_STATIC AND NOT PCRE_STATIC AND MSVC AND LIBGCC_FOUND) - # When doing a Visual Studio build using pcre static libraries - # built using the mingw toolchain, -lgcc is needed to resolve - # ___chkstk_ms. - MESSAGE(STATUS "Visual Studio build detected, trying again with -lgcc included") - LIST(APPEND ADDITIONAL_LIBS ${LIBGCC_LIBRARIES}) - SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES} ${LIBGCC_LIBRARIES}) - TRY_MACRO_FOR_LIBRARY( - "${PCRE_INCLUDE_DIR}" "${TMP_LIBRARIES}" - COMPILES - "#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" - "WITHOUT_PCRE_STATIC;PCRE_STATIC") - IF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) - ADD_DEFINITIONS(-DPCRE_STATIC) - ENDIF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) - ENDIF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) - ENDIF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) - ENDIF(PCREPOSIX_FOUND) - MARK_AS_ADVANCED(CLEAR PCRE_INCLUDE_DIR) - MARK_AS_ADVANCED(CLEAR PCREPOSIX_LIBRARIES) - MARK_AS_ADVANCED(CLEAR PCRE_LIBRARIES) - MARK_AS_ADVANCED(CLEAR LIBGCC_LIBRARIES) -ENDIF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$") - -# -# Check functions -# -CMAKE_PUSH_CHECK_STATE() # Save the state of the variables -IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") - # - # During checking functions, we should use -fno-builtin to avoid the - # failure of function detection which failure is an error "conflicting - # types for built-in function" caused by using -Werror option. - # - SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-builtin") -ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") -CHECK_SYMBOL_EXISTS(_CrtSetReportMode "crtdbg.h" HAVE__CrtSetReportMode) -CHECK_FUNCTION_EXISTS_GLIBC(chflags HAVE_CHFLAGS) -CHECK_FUNCTION_EXISTS_GLIBC(chown HAVE_CHOWN) -CHECK_FUNCTION_EXISTS_GLIBC(chroot HAVE_CHROOT) -CHECK_FUNCTION_EXISTS_GLIBC(ctime_r HAVE_CTIME_R) -CHECK_FUNCTION_EXISTS_GLIBC(dirfd HAVE_DIRFD) -CHECK_FUNCTION_EXISTS_GLIBC(fchdir HAVE_FCHDIR) -CHECK_FUNCTION_EXISTS_GLIBC(fchflags HAVE_FCHFLAGS) -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(fork HAVE_FORK) -CHECK_FUNCTION_EXISTS_GLIBC(fstat HAVE_FSTAT) -CHECK_FUNCTION_EXISTS_GLIBC(fstatat HAVE_FSTATAT) -CHECK_FUNCTION_EXISTS_GLIBC(fstatfs HAVE_FSTATFS) -CHECK_FUNCTION_EXISTS_GLIBC(fstatvfs HAVE_FSTATVFS) -CHECK_FUNCTION_EXISTS_GLIBC(ftruncate HAVE_FTRUNCATE) -CHECK_FUNCTION_EXISTS_GLIBC(futimens HAVE_FUTIMENS) -CHECK_FUNCTION_EXISTS_GLIBC(futimes HAVE_FUTIMES) -CHECK_FUNCTION_EXISTS_GLIBC(futimesat HAVE_FUTIMESAT) -CHECK_FUNCTION_EXISTS_GLIBC(geteuid HAVE_GETEUID) -CHECK_FUNCTION_EXISTS_GLIBC(getgrgid_r HAVE_GETGRGID_R) -CHECK_FUNCTION_EXISTS_GLIBC(getgrnam_r HAVE_GETGRNAM_R) -CHECK_FUNCTION_EXISTS_GLIBC(getpwnam_r HAVE_GETPWNAM_R) -CHECK_FUNCTION_EXISTS_GLIBC(getpwuid_r HAVE_GETPWUID_R) -CHECK_FUNCTION_EXISTS_GLIBC(getpid HAVE_GETPID) -CHECK_FUNCTION_EXISTS_GLIBC(getvfsbyname HAVE_GETVFSBYNAME) -CHECK_FUNCTION_EXISTS_GLIBC(gmtime_r HAVE_GMTIME_R) -CHECK_FUNCTION_EXISTS_GLIBC(lchflags HAVE_LCHFLAGS) -CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD) -CHECK_FUNCTION_EXISTS_GLIBC(lchown HAVE_LCHOWN) -CHECK_FUNCTION_EXISTS_GLIBC(link HAVE_LINK) -CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R) -CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT) -CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES) -CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC) -CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) -CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR) -CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO) -CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD) -CHECK_FUNCTION_EXISTS_GLIBC(mkstemp HAVE_MKSTEMP) -CHECK_FUNCTION_EXISTS_GLIBC(nl_langinfo HAVE_NL_LANGINFO) -CHECK_FUNCTION_EXISTS_GLIBC(openat HAVE_OPENAT) -CHECK_FUNCTION_EXISTS_GLIBC(pipe HAVE_PIPE) -CHECK_FUNCTION_EXISTS_GLIBC(poll HAVE_POLL) -CHECK_FUNCTION_EXISTS_GLIBC(posix_spawnp HAVE_POSIX_SPAWNP) -CHECK_FUNCTION_EXISTS_GLIBC(readlink HAVE_READLINK) -CHECK_FUNCTION_EXISTS_GLIBC(select HAVE_SELECT) -CHECK_FUNCTION_EXISTS_GLIBC(setenv HAVE_SETENV) -CHECK_FUNCTION_EXISTS_GLIBC(setlocale HAVE_SETLOCALE) -CHECK_FUNCTION_EXISTS_GLIBC(sigaction HAVE_SIGACTION) -CHECK_FUNCTION_EXISTS_GLIBC(statfs HAVE_STATFS) -CHECK_FUNCTION_EXISTS_GLIBC(statvfs HAVE_STATVFS) -CHECK_FUNCTION_EXISTS_GLIBC(strchr HAVE_STRCHR) -CHECK_FUNCTION_EXISTS_GLIBC(strdup HAVE_STRDUP) -CHECK_FUNCTION_EXISTS_GLIBC(strerror HAVE_STRERROR) -CHECK_FUNCTION_EXISTS_GLIBC(strncpy_s HAVE_STRNCPY_S) -CHECK_FUNCTION_EXISTS_GLIBC(strrchr HAVE_STRRCHR) -CHECK_FUNCTION_EXISTS_GLIBC(symlink HAVE_SYMLINK) -CHECK_FUNCTION_EXISTS_GLIBC(timegm HAVE_TIMEGM) -CHECK_FUNCTION_EXISTS_GLIBC(tzset HAVE_TZSET) -CHECK_FUNCTION_EXISTS_GLIBC(unsetenv HAVE_UNSETENV) -CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME) -CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES) -CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT) -CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK) -CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) -CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) -CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) -CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) -CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) -CHECK_FUNCTION_EXISTS_GLIBC(_ctime64_s HAVE__CTIME64_S) -CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) -CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) -CHECK_FUNCTION_EXISTS_GLIBC(_localtime64_s HAVE__LOCALTIME64_S) -CHECK_FUNCTION_EXISTS_GLIBC(_mkgmtime64 HAVE__MKGMTIME64) - -SET(CMAKE_REQUIRED_LIBRARIES "") -CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH) -CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) -CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R) -CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) -CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) -CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) -CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) - -CMAKE_POP_CHECK_STATE() # Restore the state of the variables - -# Make sure we have the POSIX version of readdir_r, not the -# older 2-argument version. -LIBARCHIVE_CHECK_C_SOURCE_COMPILES( - "#include \nint main() {DIR *d = opendir(\".\"); struct dirent e,*r; return readdir_r(d,&e,&r);}" - HAVE_READDIR_R) - - -# Only detect readlinkat() if we also have AT_FDCWD in unistd.h. -# NOTE: linux requires fcntl.h for AT_FDCWD. -LIBARCHIVE_CHECK_C_SOURCE_COMPILES( - "#include \n#include \nint main() {char buf[10]; return readlinkat(AT_FDCWD, \"\", buf, 0);}" - HAVE_READLINKAT) - - -# To verify major(), we need to both include the header -# of interest and verify that the result can be linked. -# CHECK_FUNCTION_EXISTS doesn't accept a header argument, -# CHECK_SYMBOL_EXISTS doesn't test linkage. -LIBARCHIVE_CHECK_C_SOURCE_COMPILES( - "#include \nint main() { return major(256); }" - MAJOR_IN_MKDEV) -LIBARCHIVE_CHECK_C_SOURCE_COMPILES( - "#include \nint main() { return major(256); }" - MAJOR_IN_SYSMACROS) - -IF(HAVE_STRERROR_R) - SET(HAVE_DECL_STRERROR_R 1) -ENDIF(HAVE_STRERROR_R) - -# -# Check defines -# -SET(headers "limits.h") -IF(HAVE_STDINT_H) - LIST(APPEND headers "stdint.h") -ENDIF(HAVE_STDINT_H) -IF(HAVE_INTTYPES_H) - LIST(APPEND headers "inttypes.h") -ENDIF(HAVE_INTTYPES_H) -CHECK_SYMBOL_EXISTS(EFTYPE "errno.h" HAVE_EFTYPE) -CHECK_SYMBOL_EXISTS(EILSEQ "errno.h" HAVE_EILSEQ) -CHECK_SYMBOL_EXISTS(D_MD_ORDER "langinfo.h" HAVE_D_MD_ORDER) -CHECK_SYMBOL_EXISTS(INT64_MAX "${headers}" HAVE_DECL_INT64_MAX) -CHECK_SYMBOL_EXISTS(INT64_MIN "${headers}" HAVE_DECL_INT64_MIN) -CHECK_SYMBOL_EXISTS(UINT32_MAX "${headers}" HAVE_DECL_UINT32_MAX) -CHECK_SYMBOL_EXISTS(UINT64_MAX "${headers}" HAVE_DECL_UINT64_MAX) -CHECK_SYMBOL_EXISTS(SIZE_MAX "${headers}" HAVE_DECL_SIZE_MAX) -CHECK_SYMBOL_EXISTS(SSIZE_MAX "limits.h" HAVE_DECL_SSIZE_MAX) - -# -# Check struct members -# -# Check for tm_gmtoff in struct tm -CHECK_STRUCT_MEMBER("struct tm" tm_gmtoff - "time.h" HAVE_STRUCT_TM_TM_GMTOFF) -CHECK_STRUCT_MEMBER("struct tm" __tm_gmtoff - "time.h" HAVE_STRUCT_TM___TM_GMTOFF) - -# Check for f_namemax in struct statfs -CHECK_STRUCT_MEMBER("struct statfs" f_namemax - "sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_NAMEMAX) - -# Check for birthtime in struct stat -CHECK_STRUCT_MEMBER("struct stat" st_birthtime - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIME) - -# Check for high-resolution timestamps in struct stat -CHECK_STRUCT_MEMBER("struct stat" st_birthtimespec.tv_nsec - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC) -CHECK_STRUCT_MEMBER("struct stat" st_mtimespec.tv_nsec - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC) -CHECK_STRUCT_MEMBER("struct stat" st_mtim.tv_nsec - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) -CHECK_STRUCT_MEMBER("struct stat" st_mtime_n - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_N) -CHECK_STRUCT_MEMBER("struct stat" st_umtime - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_UMTIME) -CHECK_STRUCT_MEMBER("struct stat" st_mtime_usec - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_USEC) -# Check for block size support in struct stat -CHECK_STRUCT_MEMBER("struct stat" st_blksize - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BLKSIZE) -# Check for st_flags in struct stat (BSD fflags) -CHECK_STRUCT_MEMBER("struct stat" st_flags - "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_FLAGS) - -IF(HAVE_SYS_STATVFS_H) - CHECK_STRUCT_MEMBER("struct statvfs" f_iosize - "sys/types.h;sys/statvfs.h" HAVE_STRUCT_STATVFS_F_IOSIZE) -ENDIF() - -# -# -CHECK_STRUCT_MEMBER("struct tm" tm_sec - "sys/types.h;sys/time.h;time.h" TIME_WITH_SYS_TIME) - -# -# Check for integer types -# -# -CHECK_TYPE_SIZE("short" SIZE_OF_SHORT) -CHECK_TYPE_SIZE("int" SIZE_OF_INT) -CHECK_TYPE_SIZE("long" SIZE_OF_LONG) -CHECK_TYPE_SIZE("long long" SIZE_OF_LONG_LONG) - -CHECK_TYPE_SIZE("unsigned short" SIZE_OF_UNSIGNED_SHORT) -CHECK_TYPE_SIZE("unsigned" SIZE_OF_UNSIGNED) -CHECK_TYPE_SIZE("unsigned long" SIZE_OF_UNSIGNED_LONG) -CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG) - -CHECK_TYPE_SIZE("__int64" __INT64) -CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64) - -CHECK_TYPE_SIZE(int16_t INT16_T) -CHECK_TYPE_SIZE(int32_t INT32_T) -CHECK_TYPE_SIZE(int64_t INT64_T) -CHECK_TYPE_SIZE(intmax_t INTMAX_T) -CHECK_TYPE_SIZE(uint8_t UINT8_T) -CHECK_TYPE_SIZE(uint16_t UINT16_T) -CHECK_TYPE_SIZE(uint32_t UINT32_T) -CHECK_TYPE_SIZE(uint64_t UINT64_T) -CHECK_TYPE_SIZE(uintmax_t UINTMAX_T) - -CHECK_TYPE_SIZE(dev_t DEV_T) -IF(NOT HAVE_DEV_T) - IF(MSVC) - SET(dev_t "unsigned int") - ENDIF(MSVC) -ENDIF(NOT HAVE_DEV_T) -# -CHECK_TYPE_SIZE(gid_t GID_T) -IF(NOT HAVE_GID_T) - IF(WIN32) - SET(gid_t "short") - ELSE(WIN32) - SET(gid_t "unsigned int") - ENDIF(WIN32) -ENDIF(NOT HAVE_GID_T) -# -CHECK_TYPE_SIZE(id_t ID_T) -IF(NOT HAVE_ID_T) - IF(WIN32) - SET(id_t "short") - ELSE(WIN32) - SET(id_t "unsigned int") - ENDIF(WIN32) -ENDIF(NOT HAVE_ID_T) -# -CHECK_TYPE_SIZE(mode_t MODE_T) -IF(NOT HAVE_MODE_T) - IF(WIN32) - SET(mode_t "unsigned short") - ELSE(WIN32) - SET(mode_t "int") - ENDIF(WIN32) -ENDIF(NOT HAVE_MODE_T) -# -CHECK_TYPE_SIZE(off_t OFF_T) -IF(NOT HAVE_OFF_T) - SET(off_t "__int64") -ENDIF(NOT HAVE_OFF_T) -# -CHECK_TYPE_SIZE(size_t SIZE_T) -IF(NOT HAVE_SIZE_T) - IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(size_t "uint64_t") - ELSE("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(size_t "uint32_t") - ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) -ENDIF(NOT HAVE_SIZE_T) -# -CHECK_TYPE_SIZE(ssize_t SSIZE_T) -IF(NOT HAVE_SSIZE_T) - IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(ssize_t "int64_t") - ELSE("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(ssize_t "long") - ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) -ENDIF(NOT HAVE_SSIZE_T) -# -CHECK_TYPE_SIZE(uid_t UID_T) -IF(NOT HAVE_UID_T) - IF(WIN32) - SET(uid_t "short") - ELSE(WIN32) - SET(uid_t "unsigned int") - ENDIF(WIN32) -ENDIF(NOT HAVE_UID_T) -# -CHECK_TYPE_SIZE(pid_t PID_T) -IF(NOT HAVE_PID_T) - IF(WIN32) - SET(pid_t "int") - ELSE(WIN32) - MESSAGE(FATAL_ERROR "pid_t doesn't exist on this platform?") - ENDIF(WIN32) -ENDIF(NOT HAVE_PID_T) -# -CHECK_TYPE_SIZE(intptr_t INTPTR_T) -IF(NOT HAVE_INTPTR_T) - IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(intptr_t "int64_t") - ELSE() - SET(intptr_t "int32_t") - ENDIF() -ENDIF(NOT HAVE_INTPTR_T) -# -CHECK_TYPE_SIZE(uintptr_t UINTPTR_T) -IF(NOT HAVE_UINTPTR_T) - IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) - SET(uintptr_t "uint64_t") - ELSE() - SET(uintptr_t "uint32_t") - ENDIF() -ENDIF(NOT HAVE_UINTPTR_T) -# -CHECK_TYPE_SIZE(wchar_t SIZEOF_WCHAR_T) -IF(HAVE_SIZEOF_WCHAR_T) - SET(HAVE_WCHAR_T 1) -ENDIF(HAVE_SIZEOF_WCHAR_T) -# -# Check if _FILE_OFFSET_BITS macro needed for large files -# -CHECK_FILE_OFFSET_BITS() - -# -# Check for Extended Attribute libraries, headers, and functions -# -IF(ENABLE_XATTR) - LA_CHECK_INCLUDE_FILE(attr/xattr.h HAVE_ATTR_XATTR_H) - LA_CHECK_INCLUDE_FILE(sys/xattr.h HAVE_SYS_XATTR_H) - LA_CHECK_INCLUDE_FILE(sys/extattr.h HAVE_SYS_EXTATTR_H) - CHECK_LIBRARY_EXISTS(attr "setxattr" "" HAVE_LIBATTR) - IF(HAVE_LIBATTR) - SET(CMAKE_REQUIRED_LIBRARIES "attr") - ENDIF(HAVE_LIBATTR) - CHECK_SYMBOL_EXISTS(EXTATTR_NAMESPACE_USER "sys/types.h;sys/extattr.h" HAVE_DECL_EXTATTR_NAMESPACE_USER) - CHECK_FUNCTION_EXISTS_GLIBC(extattr_get_file HAVE_EXTATTR_GET_FILE) - CHECK_FUNCTION_EXISTS_GLIBC(extattr_list_file HAVE_EXTATTR_LIST_FILE) - CHECK_FUNCTION_EXISTS_GLIBC(extattr_set_fd HAVE_EXTATTR_SET_FD) - CHECK_FUNCTION_EXISTS_GLIBC(extattr_set_file HAVE_EXTATTR_SET_FILE) - CHECK_FUNCTION_EXISTS_GLIBC(fgetxattr HAVE_FGETXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(flistxattr HAVE_FLISTXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(fsetxattr HAVE_FSETXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(getxattr HAVE_GETXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(lgetxattr HAVE_LGETXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(listxattr HAVE_LISTXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(llistxattr HAVE_LLISTXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(lsetxattr HAVE_LSETXATTR) - CHECK_FUNCTION_EXISTS_GLIBC(fgetea HAVE_FGETEA) - CHECK_FUNCTION_EXISTS_GLIBC(flistea HAVE_FLISTEA) - CHECK_FUNCTION_EXISTS_GLIBC(fsetea HAVE_FSETEA) - CHECK_FUNCTION_EXISTS_GLIBC(getea HAVE_GETEA) - CHECK_FUNCTION_EXISTS_GLIBC(lgetea HAVE_LGETEA) - CHECK_FUNCTION_EXISTS_GLIBC(listea HAVE_LISTEA) - CHECK_FUNCTION_EXISTS_GLIBC(llistea HAVE_LLISTEA) - CHECK_FUNCTION_EXISTS_GLIBC(lsetea HAVE_LSETEA) -ELSE(ENABLE_XATTR) - SET(HAVE_ATTR_LIB FALSE) - SET(HAVE_ATTR_XATTR_H FALSE) - SET(HAVE_DECL_EXTATTR_NAMESPACE_USER FALSE) - SET(HAVE_EXTATTR_GET_FILE FALSE) - SET(HAVE_EXTATTR_LIST_FILE FALSE) - SET(HAVE_EXTATTR_SET_FD FALSE) - SET(HAVE_EXTATTR_SET_FILE FALSE) - SET(HAVE_FGETEA FALSE) - SET(HAVE_FGETXATTR FALSE) - SET(HAVE_FLISTEA FALSE) - SET(HAVE_FLISTXATTR FALSE) - SET(HAVE_FSETEA FALSE) - SET(HAVE_FSETXATTR FALSE) - SET(HAVE_GETEA FALSE) - SET(HAVE_GETXATTR FALSE) - SET(HAVE_LGETEA FALSE) - SET(HAVE_LGETXATTR FALSE) - SET(HAVE_LISTEA FALSE) - SET(HAVE_LISTXATTR FALSE) - SET(HAVE_LLISTEA FALSE) - SET(HAVE_LLISTXATTR FALSE) - SET(HAVE_LSETEA FALSE) - SET(HAVE_LSETXATTR FALSE) - SET(HAVE_SYS_EXTATTR_H FALSE) - SET(HAVE_SYS_XATTR_H FALSE) -ENDIF(ENABLE_XATTR) - -# -# Check for ACL libraries, headers, and functions -# -# The ACL support in libarchive is written against the POSIX1e draft, -# which was never officially approved and varies quite a bit across -# platforms. Worse, some systems have completely non-POSIX acl functions, -# which makes the following checks rather more complex than I would like. -# -IF(ENABLE_ACL) - CHECK_LIBRARY_EXISTS(acl "acl_get_file" "" HAVE_LIBACL) - IF(HAVE_LIBACL) - SET(CMAKE_REQUIRED_LIBRARIES "acl") - FIND_LIBRARY(ACL_LIBRARY NAMES acl) - LIST(APPEND ADDITIONAL_LIBS ${ACL_LIBRARY}) - ENDIF(HAVE_LIBACL) - # - CHECK_FUNCTION_EXISTS_GLIBC(acl_create_entry HAVE_ACL_CREATE_ENTRY) - CHECK_FUNCTION_EXISTS_GLIBC(acl_init HAVE_ACL_INIT) - CHECK_FUNCTION_EXISTS_GLIBC(acl_set_fd HAVE_ACL_SET_FD) - CHECK_FUNCTION_EXISTS_GLIBC(acl_set_fd_np HAVE_ACL_SET_FD_NP) - CHECK_FUNCTION_EXISTS_GLIBC(acl_set_file HAVE_ACL_SET_FILE) - CHECK_TYPE_EXISTS(acl_permset_t "${INCLUDES}" HAVE_ACL_PERMSET_T) - - # The "acl_get_perm()" function was omitted from the POSIX draft. - # (It's a pretty obvious oversight; otherwise, there's no way to - # test for specific permissions in a permset.) Linux uses the obvious - # name, FreeBSD adds _np to mark it as "non-Posix extension." - # Test for both as a double-check that we really have POSIX-style ACL support. - CHECK_FUNCTION_EXISTS(acl_get_perm HAVE_ACL_GET_PERM) - CHECK_FUNCTION_EXISTS(acl_get_perm_np HAVE_ACL_GET_PERM_NP) - CHECK_FUNCTION_EXISTS(acl_get_link HAVE_ACL_GET_LINK) - CHECK_FUNCTION_EXISTS(acl_get_link_np HAVE_ACL_GET_LINK_NP) - CHECK_FUNCTION_EXISTS(acl_is_trivial_np HAVE_ACL_IS_TRIVIAL_NP) - CHECK_FUNCTION_EXISTS(acl_set_link_np HAVE_ACL_SET_LINK_NP) - - # MacOS has an acl.h that isn't POSIX. It can be detected by - # checking for ACL_USER - CHECK_SYMBOL_EXISTS(ACL_USER "${INCLUDES}" HAVE_ACL_USER) -ELSE(ENABLE_ACL) - # If someone runs cmake, then disables ACL support, we need - # to forcibly override the cached values for these. - SET(HAVE_ACL_CREATE_ENTRY FALSE) - SET(HAVE_ACL_GET_LINK FALSE) - SET(HAVE_ACL_GET_LINK_NP FALSE) - SET(HAVE_ACL_GET_PERM FALSE) - SET(HAVE_ACL_GET_PERM_NP FALSE) - SET(HAVE_ACL_INIT FALSE) - SET(HAVE_ACL_LIB FALSE) - SET(HAVE_ACL_PERMSET_T FALSE) - SET(HAVE_ACL_SET_FD FALSE) - SET(HAVE_ACL_SET_FD_NP FALSE) - SET(HAVE_ACL_SET_FILE FALSE) - SET(HAVE_ACL_USER FALSE) -ENDIF(ENABLE_ACL) - -# -# Check MD5/RMD160/SHA support -# NOTE: Crypto checks must be run last before generating config.h -# -CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" LIBC) -CHECK_CRYPTO("SHA256;SHA384;SHA512" LIBC2) -CHECK_CRYPTO("SHA256;SHA384;SHA512" LIBC3) -CHECK_CRYPTO("MD5;SHA1;SHA256;SHA384;SHA512" LIBSYSTEM) -CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" NETTLE) -CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" OPENSSL) - -# Libmd has to be probed after OpenSSL. -CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA512" LIBMD) - -CHECK_CRYPTO_WIN("MD5;SHA1;SHA256;SHA384;SHA512") - -# Generate "config.h" from "build/cmake/config.h.in" -CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in - ${CMAKE_CURRENT_BINARY_DIR}/config.h) -INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) -ADD_DEFINITIONS(-DHAVE_CONFIG_H) - -# -# Register installation of PDF documents. -# -IF(WIN32 AND NOT CYGWIN) - # - # On Windows platform, It's better that we install PDF documents - # on one's computer. - # These PDF documents are available in the release package. - # - IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf) - INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf - DESTINATION share/man - FILES_MATCHING PATTERN "*.pdf" - ) - ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf) -ENDIF(WIN32 AND NOT CYGWIN) -# -# -# -INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/libarchive) -# -IF(MSVC) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE) -ENDIF(MSVC) - -IF(ENABLE_TEST) - ADD_CUSTOM_TARGET(run_all_tests) -ENDIF(ENABLE_TEST) - -add_subdirectory(libarchive) -add_subdirectory(tar) -add_subdirectory(cpio) diff --git a/CTestConfig.cmake b/CTestConfig.cmake deleted file mode 100644 index 7a09742db098..000000000000 --- a/CTestConfig.cmake +++ /dev/null @@ -1,11 +0,0 @@ -# TODO: This file should be moved into the build/cmake directory... - -# The libarchive CDash page appears at -# http://my.cdash.org/index.php?project=libarchive -set(CTEST_PROJECT_NAME "libarchive") -set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") - -set(CTEST_DROP_METHOD "http") -set(CTEST_DROP_SITE "my.cdash.org") -set(CTEST_DROP_LOCATION "/submit.php?project=libarchive") -set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/INSTALL b/INSTALL deleted file mode 100644 index 33c58b7ed454..000000000000 --- a/INSTALL +++ /dev/null @@ -1,35 +0,0 @@ -More complete build documentation is available on the libarchive -Wiki: http://libarchive.googlecode.com/ - -On most Unix-like systems, you should be able to install libarchive, -bsdtar, and bsdcpio using the following common steps: - ./configure - make - make install - -If you need to customize the target directories or otherwise adjust -the build setting, use - ./configure --help -to list the configure options. - -If you are developing libarchive and need to update the -configure script and other build files: - /bin/sh build/autogen.sh - -To create a distribution, please use the 'distcheck' target: - /bin/sh build/autogen.sh && ./configure && make distcheck - -On Unix-like and non-Unix-like systems, use the "cmake" utility (available from -http://cmake.org/) to generate suitable build files for your platform. -Cmake requires the name of the directory containing CmakeLists.txt and -the "generator" to use for your build environment. For example, to -build with Xcode on Mac OS, you can use the following command: - cmake -G "Xcode" ~/libarchive-download-dir/ -The result will be appropriate makefiles, solution files, or project -files that can be used with the corresponding development tool. -The default on Unix-like systems is to generate Makefiles, so you -can also use cmake instead of the configure script: - cmake ~/libarchive-download-dir/ - make - make install -See the libarchive Wiki or the cmake site for further documentation. diff --git a/Makefile.am b/Makefile.am deleted file mode 100644 index 9e22a9b34ade..000000000000 --- a/Makefile.am +++ /dev/null @@ -1,1014 +0,0 @@ -## Process this file with automake to produce Makefile.in - -AUTOMAKE_OPTIONS= foreign subdir-objects -ACLOCAL_AMFLAGS = -I build/autoconf - -# -# What to build and install -# -lib_LTLIBRARIES= libarchive.la -noinst_LTLIBRARIES= libarchive_fe.la -bin_PROGRAMS= $(bsdtar_programs) $(bsdcpio_programs) -man_MANS= $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS) -BUILT_SOURCES= libarchive/test/list.h tar/test/list.h cpio/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) -TESTS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs) -TESTS_ENVIRONMENT= $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT) -# Always build and test both bsdtar and bsdcpio as part of 'distcheck' -DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio -COMMON_CFLAGS=-Wall -Wformat -Wformat-security -# The next line is commented out by default in shipping libarchive releases. -# It is uncommented by default in trunk. -# DEV_CFLAGS=-Werror -Wextra -Wunused -Wshadow -Wmissing-prototypes -Wcast-qual -AM_CFLAGS=$(COMMON_CFLAGS) $(DEV_CFLAGS) -PLATFORMCPPFLAGS = @PLATFORMCPPFLAGS@ -AM_CPPFLAGS=$(PLATFORMCPPFLAGS) - -# -# What to include in the distribution -# -EXTRA_DIST= \ - CMakeLists.txt \ - build/autogen.sh \ - build/bump-version.sh \ - build/clean.sh \ - build/cmake \ - build/version \ - contrib \ - doc \ - examples \ - $(libarchive_EXTRA_DIST) \ - $(libarchive_test_EXTRA_DIST) \ - $(bsdtar_EXTRA_DIST) \ - $(bsdtar_test_EXTRA_DIST) \ - $(bsdcpio_EXTRA_DIST) \ - $(bsdcpio_test_EXTRA_DIST) - -# a) Clean out some unneeded files and directories -# b) Collect all documentation and format it for distribution. -dist-hook: - rm -rf `find $(distdir) -name CVS -type d` - rm -rf `find $(distdir) -name .svn -type d` - rm -f `find $(distdir) -name '*~'` - rm -f `find $(distdir) -name '*.out'` - rm -f `find $(distdir) -name '*.core'` - -rm -f $(distdir)/*/Makefile $(distdir)/*/*/Makefile - cd $(distdir)/doc && /bin/sh update.sh - -# -# Extra rules for cleanup -# -DISTCLEANFILES= \ - libarchive/test/list.h \ - tar/test/list.h \ - cpio/test/list.h - -distclean-local: - -rm -rf .ref - -rm -rf autom4te.cache/ - -rm -f *~ - -[ -f libarchive/Makefile ] && cd libarchive && make clean - -[ -f libarchive/test/Makefile ] && cd libarchive/test && make clean - -[ -f tar/Makefile ] && cd tar && make clean - -[ -f tar/test/Makefile ] && cd tar/test && make clean - -[ -f cpio/Makefile ] && cd cpio && make clean - -[ -f cpio/test/Makefile ] && cd cpio/test && make clean - -# -# Libarchive headers, source, etc. -# -# - -include_HEADERS= libarchive/archive.h libarchive/archive_entry.h - -libarchive_la_SOURCES= \ - libarchive/archive_acl.c \ - libarchive/archive_acl_private.h \ - libarchive/archive_check_magic.c \ - libarchive/archive_cmdline.c \ - libarchive/archive_cmdline_private.h \ - libarchive/archive_crc32.h \ - libarchive/archive_crypto.c \ - libarchive/archive_crypto_private.h \ - libarchive/archive_endian.h \ - libarchive/archive_entry.c \ - libarchive/archive_entry.h \ - libarchive/archive_entry_copy_stat.c \ - libarchive/archive_entry_link_resolver.c \ - libarchive/archive_entry_locale.h \ - libarchive/archive_entry_private.h \ - libarchive/archive_entry_sparse.c \ - libarchive/archive_entry_stat.c \ - libarchive/archive_entry_strmode.c \ - libarchive/archive_entry_xattr.c \ - libarchive/archive_getdate.c \ - libarchive/archive_match.c \ - libarchive/archive_options.c \ - libarchive/archive_options_private.h \ - libarchive/archive_pathmatch.c \ - libarchive/archive_pathmatch.h \ - libarchive/archive_platform.h \ - libarchive/archive_ppmd_private.h \ - libarchive/archive_ppmd7.c \ - libarchive/archive_ppmd7_private.h \ - libarchive/archive_private.h \ - libarchive/archive_rb.c \ - libarchive/archive_rb.h \ - libarchive/archive_read.c \ - libarchive/archive_read_append_filter.c \ - libarchive/archive_read_data_into_fd.c \ - libarchive/archive_read_disk_entry_from_file.c \ - libarchive/archive_read_disk_posix.c \ - libarchive/archive_read_disk_private.h \ - libarchive/archive_read_disk_set_standard_lookup.c \ - libarchive/archive_read_extract.c \ - libarchive/archive_read_open_fd.c \ - libarchive/archive_read_open_file.c \ - libarchive/archive_read_open_filename.c \ - libarchive/archive_read_open_memory.c \ - libarchive/archive_read_private.h \ - libarchive/archive_read_set_format.c \ - libarchive/archive_read_set_options.c \ - libarchive/archive_read_support_filter_all.c \ - libarchive/archive_read_support_filter_bzip2.c \ - libarchive/archive_read_support_filter_compress.c \ - libarchive/archive_read_support_filter_grzip.c \ - libarchive/archive_read_support_filter_gzip.c \ - libarchive/archive_read_support_filter_lrzip.c \ - libarchive/archive_read_support_filter_lzop.c \ - libarchive/archive_read_support_filter_none.c \ - libarchive/archive_read_support_filter_program.c \ - libarchive/archive_read_support_filter_rpm.c \ - libarchive/archive_read_support_filter_uu.c \ - libarchive/archive_read_support_filter_xz.c \ - libarchive/archive_read_support_format_7zip.c \ - libarchive/archive_read_support_format_all.c \ - libarchive/archive_read_support_format_ar.c \ - libarchive/archive_read_support_format_by_code.c \ - libarchive/archive_read_support_format_cab.c \ - libarchive/archive_read_support_format_cpio.c \ - libarchive/archive_read_support_format_empty.c \ - libarchive/archive_read_support_format_iso9660.c \ - libarchive/archive_read_support_format_lha.c \ - libarchive/archive_read_support_format_mtree.c \ - libarchive/archive_read_support_format_rar.c \ - libarchive/archive_read_support_format_raw.c \ - libarchive/archive_read_support_format_tar.c \ - libarchive/archive_read_support_format_xar.c \ - libarchive/archive_read_support_format_zip.c \ - libarchive/archive_string.c \ - libarchive/archive_string.h \ - libarchive/archive_string_composition.h \ - libarchive/archive_string_sprintf.c \ - libarchive/archive_util.c \ - libarchive/archive_virtual.c \ - libarchive/archive_write.c \ - libarchive/archive_write_disk_acl.c \ - libarchive/archive_write_disk_posix.c \ - libarchive/archive_write_disk_private.h \ - libarchive/archive_write_disk_set_standard_lookup.c \ - libarchive/archive_write_open_fd.c \ - libarchive/archive_write_open_file.c \ - libarchive/archive_write_open_filename.c \ - libarchive/archive_write_open_memory.c \ - libarchive/archive_write_private.h \ - libarchive/archive_write_add_filter.c \ - libarchive/archive_write_add_filter_b64encode.c \ - libarchive/archive_write_add_filter_by_name.c \ - libarchive/archive_write_add_filter_bzip2.c \ - libarchive/archive_write_add_filter_compress.c \ - libarchive/archive_write_add_filter_grzip.c \ - libarchive/archive_write_add_filter_gzip.c \ - libarchive/archive_write_add_filter_lrzip.c \ - libarchive/archive_write_add_filter_lzop.c \ - libarchive/archive_write_add_filter_none.c \ - libarchive/archive_write_add_filter_program.c \ - libarchive/archive_write_add_filter_uuencode.c \ - libarchive/archive_write_add_filter_xz.c \ - libarchive/archive_write_set_format.c \ - libarchive/archive_write_set_format_7zip.c \ - libarchive/archive_write_set_format_ar.c \ - libarchive/archive_write_set_format_by_name.c \ - libarchive/archive_write_set_format_cpio.c \ - libarchive/archive_write_set_format_cpio_newc.c \ - libarchive/archive_write_set_format_iso9660.c \ - libarchive/archive_write_set_format_mtree.c \ - libarchive/archive_write_set_format_pax.c \ - libarchive/archive_write_set_format_shar.c \ - libarchive/archive_write_set_format_ustar.c \ - libarchive/archive_write_set_format_v7tar.c \ - libarchive/archive_write_set_format_gnutar.c \ - libarchive/archive_write_set_format_xar.c \ - libarchive/archive_write_set_format_zip.c \ - libarchive/archive_write_set_options.c \ - libarchive/config_freebsd.h \ - libarchive/filter_fork_posix.c \ - libarchive/filter_fork.h - -if INC_WINDOWS_FILES -libarchive_la_SOURCES+= \ - libarchive/archive_entry_copy_bhfi.c \ - libarchive/archive_read_disk_windows.c \ - libarchive/archive_windows.h \ - libarchive/archive_windows.c \ - libarchive/archive_write_disk_windows.c \ - libarchive/filter_fork_windows.c -endif - -# -no-undefined marks that libarchive doesn't rely on symbols -# defined in the application. This is mandatory for cygwin. -libarchive_la_LDFLAGS= -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION) -libarchive_la_LIBADD= $(LTLIBICONV) - -# Manpages to install -libarchive_man_MANS= \ - libarchive/archive_entry.3 \ - libarchive/archive_entry_acl.3 \ - libarchive/archive_entry_linkify.3 \ - libarchive/archive_entry_paths.3 \ - libarchive/archive_entry_perms.3 \ - libarchive/archive_entry_stat.3 \ - libarchive/archive_entry_time.3 \ - libarchive/archive_read.3 \ - libarchive/archive_read_data.3 \ - libarchive/archive_read_disk.3 \ - libarchive/archive_read_extract.3 \ - libarchive/archive_read_filter.3 \ - libarchive/archive_read_format.3 \ - libarchive/archive_read_free.3 \ - libarchive/archive_read_header.3 \ - libarchive/archive_read_new.3 \ - libarchive/archive_read_open.3 \ - libarchive/archive_read_set_options.3 \ - libarchive/archive_util.3 \ - libarchive/archive_write.3 \ - libarchive/archive_write_blocksize.3 \ - libarchive/archive_write_data.3 \ - libarchive/archive_write_disk.3 \ - libarchive/archive_write_filter.3 \ - libarchive/archive_write_finish_entry.3 \ - libarchive/archive_write_format.3 \ - libarchive/archive_write_free.3 \ - libarchive/archive_write_header.3 \ - libarchive/archive_write_new.3 \ - libarchive/archive_write_open.3 \ - libarchive/archive_write_set_options.3 \ - libarchive/cpio.5 \ - libarchive/libarchive.3 \ - libarchive/libarchive_changes.3 \ - libarchive/libarchive_internals.3 \ - libarchive/libarchive-formats.5 \ - libarchive/mtree.5 \ - libarchive/tar.5 - -# Additional libarchive files to include in the distribution -libarchive_EXTRA_DIST= \ - libarchive/archive_windows.c \ - libarchive/archive_windows.h \ - libarchive/filter_fork_windows.c \ - libarchive/CMakeLists.txt \ - $(libarchive_man_MANS) - -# pkgconfig -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = build/pkgconfig/libarchive.pc - -# Sources needed by all test programs -test_utils_SOURCES= \ - test_utils/test_utils.c \ - test_utils/test_utils.h - -# -# -# libarchive_test program -# -# -libarchive_test_SOURCES= \ - $(libarchive_la_SOURCES) \ - $(test_utils_SOURCES) \ - libarchive/test/main.c \ - libarchive/test/read_open_memory.c \ - libarchive/test/test.h \ - libarchive/test/test_acl_freebsd_posix1e.c \ - libarchive/test/test_acl_freebsd_nfs4.c \ - libarchive/test/test_acl_nfs4.c \ - libarchive/test/test_acl_pax.c \ - libarchive/test/test_acl_posix1e.c \ - libarchive/test/test_archive_api_feature.c \ - libarchive/test/test_archive_clear_error.c \ - libarchive/test/test_archive_cmdline.c \ - libarchive/test/test_archive_crypto.c \ - libarchive/test/test_archive_getdate.c \ - libarchive/test/test_archive_match_owner.c \ - libarchive/test/test_archive_match_path.c \ - libarchive/test/test_archive_match_time.c \ - libarchive/test/test_archive_pathmatch.c \ - libarchive/test/test_archive_read_close_twice.c \ - libarchive/test/test_archive_read_close_twice_open_fd.c \ - libarchive/test/test_archive_read_close_twice_open_filename.c \ - libarchive/test/test_archive_read_multiple_data_objects.c \ - libarchive/test/test_archive_read_next_header_empty.c \ - libarchive/test/test_archive_read_next_header_raw.c \ - libarchive/test/test_archive_read_open2.c \ - libarchive/test/test_archive_read_set_filter_option.c \ - libarchive/test/test_archive_read_set_format_option.c \ - libarchive/test/test_archive_read_set_option.c \ - libarchive/test/test_archive_read_set_options.c \ - libarchive/test/test_archive_read_support.c \ - libarchive/test/test_archive_set_error.c \ - libarchive/test/test_archive_string.c \ - libarchive/test/test_archive_string_conversion.c \ - libarchive/test/test_archive_write_add_filter_by_name.c \ - libarchive/test/test_archive_write_set_filter_option.c \ - libarchive/test/test_archive_write_set_format_by_name.c \ - libarchive/test/test_archive_write_set_format_option.c \ - libarchive/test/test_archive_write_set_option.c \ - libarchive/test/test_archive_write_set_options.c \ - libarchive/test/test_bad_fd.c \ - libarchive/test/test_compat_bzip2.c \ - libarchive/test/test_compat_cpio.c \ - libarchive/test/test_compat_gtar.c \ - libarchive/test/test_compat_gzip.c \ - libarchive/test/test_compat_lzip.c \ - libarchive/test/test_compat_lzma.c \ - libarchive/test/test_compat_lzop.c \ - libarchive/test/test_compat_mac.c \ - libarchive/test/test_compat_pax_libarchive_2x.c \ - libarchive/test/test_compat_solaris_tar_acl.c \ - libarchive/test/test_compat_solaris_pax_sparse.c \ - libarchive/test/test_compat_tar_hardlink.c \ - libarchive/test/test_compat_uudecode.c \ - libarchive/test/test_compat_xz.c \ - libarchive/test/test_compat_zip.c \ - libarchive/test/test_empty_write.c \ - libarchive/test/test_entry.c \ - libarchive/test/test_entry_strmode.c \ - libarchive/test/test_extattr_freebsd.c \ - libarchive/test/test_filter_count.c \ - libarchive/test/test_fuzz.c \ - libarchive/test/test_gnutar_filename_encoding.c \ - libarchive/test/test_link_resolver.c \ - libarchive/test/test_open_failure.c \ - libarchive/test/test_open_fd.c \ - libarchive/test/test_open_file.c \ - libarchive/test/test_open_filename.c \ - libarchive/test/test_pax_filename_encoding.c \ - libarchive/test/test_read_data_large.c \ - libarchive/test/test_read_disk.c \ - libarchive/test/test_read_disk_directory_traversals.c \ - libarchive/test/test_read_disk_entry_from_file.c \ - libarchive/test/test_read_extract.c \ - libarchive/test/test_read_file_nonexistent.c \ - libarchive/test/test_read_filter_grzip.c \ - libarchive/test/test_read_filter_lrzip.c \ - libarchive/test/test_read_filter_lzop.c \ - libarchive/test/test_read_filter_lzop_multiple_parts.c \ - libarchive/test/test_read_filter_program.c \ - libarchive/test/test_read_filter_program_signature.c \ - libarchive/test/test_read_filter_uudecode.c \ - libarchive/test/test_read_format_7zip.c \ - libarchive/test/test_read_format_ar.c \ - libarchive/test/test_read_format_cab.c \ - libarchive/test/test_read_format_cab_filename.c \ - libarchive/test/test_read_format_cpio_afio.c \ - libarchive/test/test_read_format_cpio_bin.c \ - libarchive/test/test_read_format_cpio_bin_Z.c \ - libarchive/test/test_read_format_cpio_bin_be.c \ - libarchive/test/test_read_format_cpio_bin_bz2.c \ - libarchive/test/test_read_format_cpio_bin_gz.c \ - libarchive/test/test_read_format_cpio_bin_lzip.c \ - libarchive/test/test_read_format_cpio_bin_lzma.c \ - libarchive/test/test_read_format_cpio_bin_xz.c \ - libarchive/test/test_read_format_cpio_filename.c \ - libarchive/test/test_read_format_cpio_odc.c \ - libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c \ - libarchive/test/test_read_format_cpio_svr4_gzip.c \ - libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c \ - libarchive/test/test_read_format_cpio_svr4c_Z.c \ - libarchive/test/test_read_format_empty.c \ - libarchive/test/test_read_format_gtar_filename.c \ - libarchive/test/test_read_format_gtar_gz.c \ - libarchive/test/test_read_format_gtar_lzma.c \ - libarchive/test/test_read_format_gtar_sparse.c \ - libarchive/test/test_read_format_gtar_sparse_skip_entry.c \ - libarchive/test/test_read_format_iso_Z.c \ - libarchive/test/test_read_format_iso_multi_extent.c \ - libarchive/test/test_read_format_iso_xorriso.c \ - libarchive/test/test_read_format_isojoliet_bz2.c \ - libarchive/test/test_read_format_isojoliet_long.c \ - libarchive/test/test_read_format_isojoliet_rr.c \ - libarchive/test/test_read_format_isojoliet_versioned.c \ - libarchive/test/test_read_format_isorr_bz2.c \ - libarchive/test/test_read_format_isorr_ce.c \ - libarchive/test/test_read_format_isorr_new_bz2.c \ - libarchive/test/test_read_format_isorr_rr_moved.c \ - libarchive/test/test_read_format_isozisofs_bz2.c \ - libarchive/test/test_read_format_lha.c \ - libarchive/test/test_read_format_lha_filename.c \ - libarchive/test/test_read_format_mtree.c \ - libarchive/test/test_read_format_pax_bz2.c \ - libarchive/test/test_read_format_rar.c \ - libarchive/test/test_read_format_raw.c \ - libarchive/test/test_read_format_tar.c \ - libarchive/test/test_read_format_tar_empty_filename.c \ - libarchive/test/test_read_format_tar_filename.c \ - libarchive/test/test_read_format_tbz.c \ - libarchive/test/test_read_format_tgz.c \ - libarchive/test/test_read_format_tlz.c \ - libarchive/test/test_read_format_txz.c \ - libarchive/test/test_read_format_tz.c \ - libarchive/test/test_read_format_ustar_filename.c \ - libarchive/test/test_read_format_xar.c \ - libarchive/test/test_read_format_zip.c \ - libarchive/test/test_read_format_zip_comment_stored.c \ - libarchive/test/test_read_format_zip_filename.c \ - libarchive/test/test_read_format_zip_mac_metadata.c \ - libarchive/test/test_read_format_zip_sfx.c \ - libarchive/test/test_read_large.c \ - libarchive/test/test_read_pax_truncated.c \ - libarchive/test/test_read_position.c \ - libarchive/test/test_read_set_format.c \ - libarchive/test/test_read_truncated.c \ - libarchive/test/test_read_truncated_filter.c \ - libarchive/test/test_sparse_basic.c \ - libarchive/test/test_tar_filenames.c \ - libarchive/test/test_tar_large.c \ - libarchive/test/test_ustar_filenames.c \ - libarchive/test/test_ustar_filename_encoding.c \ - libarchive/test/test_write_disk.c \ - libarchive/test/test_write_disk_appledouble.c \ - libarchive/test/test_write_disk_failures.c \ - libarchive/test/test_write_disk_hardlink.c \ - libarchive/test/test_write_disk_hfs_compression.c \ - libarchive/test/test_write_disk_lookup.c \ - libarchive/test/test_write_disk_mac_metadata.c \ - libarchive/test/test_write_disk_no_hfs_compression.c \ - libarchive/test/test_write_disk_perms.c \ - libarchive/test/test_write_disk_secure.c \ - libarchive/test/test_write_disk_sparse.c \ - libarchive/test/test_write_disk_symlink.c \ - libarchive/test/test_write_disk_times.c \ - libarchive/test/test_write_filter_b64encode.c \ - libarchive/test/test_write_filter_bzip2.c \ - libarchive/test/test_write_filter_compress.c \ - libarchive/test/test_write_filter_gzip.c \ - libarchive/test/test_write_filter_gzip_timestamp.c \ - libarchive/test/test_write_filter_lrzip.c \ - libarchive/test/test_write_filter_lzip.c \ - libarchive/test/test_write_filter_lzma.c \ - libarchive/test/test_write_filter_lzop.c \ - libarchive/test/test_write_filter_program.c \ - libarchive/test/test_write_filter_uuencode.c \ - libarchive/test/test_write_filter_xz.c \ - libarchive/test/test_write_format_7zip.c \ - libarchive/test/test_write_format_7zip_empty.c \ - libarchive/test/test_write_format_7zip_large.c \ - libarchive/test/test_write_format_ar.c \ - libarchive/test/test_write_format_cpio.c \ - libarchive/test/test_write_format_cpio_empty.c \ - libarchive/test/test_write_format_cpio_newc.c \ - libarchive/test/test_write_format_cpio_odc.c \ - libarchive/test/test_write_format_gnutar.c \ - libarchive/test/test_write_format_iso9660.c \ - libarchive/test/test_write_format_iso9660_boot.c \ - libarchive/test/test_write_format_iso9660_empty.c \ - libarchive/test/test_write_format_iso9660_filename.c \ - libarchive/test/test_write_format_iso9660_zisofs.c \ - libarchive/test/test_write_format_mtree.c \ - libarchive/test/test_write_format_mtree_absolute_path.c \ - libarchive/test/test_write_format_mtree_classic.c \ - libarchive/test/test_write_format_mtree_classic_indent.c\ - libarchive/test/test_write_format_mtree_fflags.c \ - libarchive/test/test_write_format_mtree_no_separator.c \ - libarchive/test/test_write_format_mtree_quoted_filename.c\ - libarchive/test/test_write_format_pax.c \ - libarchive/test/test_write_format_shar_empty.c \ - libarchive/test/test_write_format_tar.c \ - libarchive/test/test_write_format_tar_empty.c \ - libarchive/test/test_write_format_tar_sparse.c \ - libarchive/test/test_write_format_tar_ustar.c \ - libarchive/test/test_write_format_tar_v7tar.c \ - libarchive/test/test_write_format_xar.c \ - libarchive/test/test_write_format_xar_empty.c \ - libarchive/test/test_write_format_zip.c \ - libarchive/test/test_write_format_zip_empty.c \ - libarchive/test/test_write_format_zip_no_compression.c \ - libarchive/test/test_write_open_memory.c \ - libarchive/test/test_write_zip_set_compression_store.c \ - libarchive/test/test_zip_filename_encoding.c - -libarchive_test_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/test_utils -I$(top_builddir)/libarchive/test -DLIBARCHIVE_STATIC $(PLATFORMCPPFLAGS) -libarchive_test_LDADD= $(LTLIBICONV) - -# The "list.h" file just lists all of the tests defined in all of the sources. -# Building it automatically provides a sanity-check on libarchive_test_SOURCES -# above. -libarchive/test/list.h: Makefile - cat $(top_srcdir)/libarchive/test/test_*.c | grep DEFINE_TEST > libarchive/test/list.h - -libarchive_TESTS_ENVIRONMENT= LIBARCHIVE_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/libarchive/test LRZIP=NOCONFIG - -libarchive_test_EXTRA_DIST=\ - libarchive/test/list.h \ - libarchive/test/test_acl_pax.tar.uu \ - libarchive/test/test_archive_string_conversion.txt.Z.uu \ - libarchive/test/test_compat_bzip2_1.tbz.uu \ - libarchive/test/test_compat_bzip2_2.tbz.uu \ - libarchive/test/test_compat_cpio_1.cpio.uu \ - libarchive/test/test_compat_gtar_1.tar.uu \ - libarchive/test/test_compat_gzip_1.tgz.uu \ - libarchive/test/test_compat_gzip_2.tgz.uu \ - libarchive/test/test_compat_lzip_1.tlz.uu \ - libarchive/test/test_compat_lzip_2.tlz.uu \ - libarchive/test/test_compat_lzma_1.tlz.uu \ - libarchive/test/test_compat_lzma_2.tlz.uu \ - libarchive/test/test_compat_lzma_3.tlz.uu \ - libarchive/test/test_compat_lzop_1.tar.lzo.uu \ - libarchive/test/test_compat_lzop_2.tar.lzo.uu \ - libarchive/test/test_compat_lzop_3.tar.lzo.uu \ - libarchive/test/test_compat_mac-1.tar.Z.uu \ - libarchive/test/test_compat_mac-2.tar.Z.uu \ - libarchive/test/test_compat_pax_libarchive_2x.tar.Z.uu \ - libarchive/test/test_compat_solaris_tar_acl.tar.uu \ - libarchive/test/test_compat_solaris_pax_sparse_1.pax.Z.uu \ - libarchive/test/test_compat_solaris_pax_sparse_2.pax.Z.uu \ - libarchive/test/test_compat_tar_hardlink_1.tar.uu \ - libarchive/test/test_compat_xz_1.txz.uu \ - libarchive/test/test_compat_zip_1.zip.uu \ - libarchive/test/test_compat_zip_2.zip.uu \ - libarchive/test/test_compat_zip_3.zip.uu \ - libarchive/test/test_compat_zip_4.zip.uu \ - libarchive/test/test_compat_zip_5.zip.uu \ - libarchive/test/test_compat_zip_6.zip.uu \ - libarchive/test/test_compat_zip_7.xps.uu \ - libarchive/test/test_fuzz_1.iso.Z.uu \ - libarchive/test/test_fuzz.cab.uu \ - libarchive/test/test_fuzz.lzh.uu \ - libarchive/test/test_pax_filename_encoding.tar.uu \ - libarchive/test/test_rar_multivolume_multiple_files.part1.rar.uu \ - libarchive/test/test_rar_multivolume_multiple_files.part2.rar.uu \ - libarchive/test/test_rar_multivolume_multiple_files.part3.rar.uu \ - libarchive/test/test_rar_multivolume_multiple_files.part4.rar.uu \ - libarchive/test/test_rar_multivolume_multiple_files.part5.rar.uu \ - libarchive/test/test_rar_multivolume_multiple_files.part6.rar.uu \ - libarchive/test/test_rar_multivolume_single_file.part1.rar.uu \ - libarchive/test/test_rar_multivolume_single_file.part2.rar.uu \ - libarchive/test/test_rar_multivolume_single_file.part3.rar.uu \ - libarchive/test/test_rar_multivolume_uncompressed_files.part01.rar.uu \ - libarchive/test/test_rar_multivolume_uncompressed_files.part02.rar.uu \ - libarchive/test/test_rar_multivolume_uncompressed_files.part03.rar.uu \ - libarchive/test/test_rar_multivolume_uncompressed_files.part04.rar.uu \ - libarchive/test/test_rar_multivolume_uncompressed_files.part05.rar.uu \ - libarchive/test/test_rar_multivolume_uncompressed_files.part06.rar.uu \ - libarchive/test/test_rar_multivolume_uncompressed_files.part07.rar.uu \ - libarchive/test/test_rar_multivolume_uncompressed_files.part08.rar.uu \ - libarchive/test/test_rar_multivolume_uncompressed_files.part09.rar.uu \ - libarchive/test/test_rar_multivolume_uncompressed_files.part10.rar.uu \ - libarchive/test/test_read_filter_grzip.tar.grz.uu \ - libarchive/test/test_read_filter_lrzip.tar.lrz.uu \ - libarchive/test/test_read_filter_lzop.tar.lzo.uu \ - libarchive/test/test_read_filter_lzop_multiple_parts.tar.lzo.uu \ - libarchive/test/test_read_format_7zip_bcj_bzip2.7z.uu \ - libarchive/test/test_read_format_7zip_bcj_copy.7z.uu \ - libarchive/test/test_read_format_7zip_bcj_deflate.7z.uu \ - libarchive/test/test_read_format_7zip_bcj_lzma1.7z.uu \ - libarchive/test/test_read_format_7zip_bcj_lzma2.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_bzip2.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_copy_1.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_copy_2.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_copy_lzma.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_deflate.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_lzma1_1.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_lzma1_2.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_lzma2_1.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_lzma2_2.7z.uu \ - libarchive/test/test_read_format_7zip_bzip2.7z.uu \ - 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_delta_lzma1.7z.uu \ - libarchive/test/test_read_format_7zip_delta_lzma2.7z.uu \ - libarchive/test/test_read_format_7zip_empty_archive.7z.uu \ - libarchive/test/test_read_format_7zip_empty_file.7z.uu \ - libarchive/test/test_read_format_7zip_lzma1.7z.uu \ - 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_ppmd.7z.uu \ - libarchive/test/test_read_format_7zip_symbolic_name.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 \ - libarchive/test/test_read_format_cab_3.cab.uu \ - libarchive/test/test_read_format_cab_filename_cp932.cab.uu \ - libarchive/test/test_read_format_cpio_bin_be.cpio.uu \ - libarchive/test/test_read_format_cpio_filename_cp866.cpio.uu \ - libarchive/test/test_read_format_cpio_filename_eucjp.cpio.uu \ - libarchive/test/test_read_format_cpio_filename_koi8r.cpio.uu \ - libarchive/test/test_read_format_cpio_filename_utf8_jp.cpio.uu \ - libarchive/test/test_read_format_cpio_filename_utf8_ru.cpio.uu \ - libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu \ - libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu \ - libarchive/test/test_read_format_gtar_filename_cp866.tar.Z.uu \ - libarchive/test/test_read_format_gtar_filename_eucjp.tar.Z.uu \ - libarchive/test/test_read_format_gtar_filename_koi8r.tar.Z.uu \ - libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu \ - libarchive/test/test_read_format_iso.iso.Z.uu \ - libarchive/test/test_read_format_iso_2.iso.Z.uu \ - libarchive/test/test_read_format_iso_joliet.iso.Z.uu \ - libarchive/test/test_read_format_iso_joliet_by_nero.iso.Z.uu \ - libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu \ - libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu \ - libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu\ - libarchive/test/test_read_format_iso_xorriso.iso.Z.uu \ - libarchive/test/test_read_format_iso_zisofs.iso.Z.uu \ - libarchive/test/test_read_format_lha_filename_cp932.lzh.uu \ - libarchive/test/test_read_format_lha_header0.lzh.uu \ - libarchive/test/test_read_format_lha_header1.lzh.uu \ - libarchive/test/test_read_format_lha_header2.lzh.uu \ - libarchive/test/test_read_format_lha_header3.lzh.uu \ - libarchive/test/test_read_format_lha_lh0.lzh.uu \ - libarchive/test/test_read_format_lha_lh6.lzh.uu \ - libarchive/test/test_read_format_lha_lh7.lzh.uu \ - libarchive/test/test_read_format_lha_withjunk.lzh.uu \ - libarchive/test/test_read_format_mtree.mtree.uu \ - libarchive/test/test_read_format_mtree_nomagic.mtree.uu \ - libarchive/test/test_read_format_mtree_nomagic2.mtree.uu \ - libarchive/test/test_read_format_mtree_nomagic3.mtree.uu \ - libarchive/test/test_read_format_rar.rar.uu \ - libarchive/test/test_read_format_rar_binary_data.rar.uu \ - libarchive/test/test_read_format_rar_compress_best.rar.uu \ - libarchive/test/test_read_format_rar_compress_normal.rar.uu \ - libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu \ - libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu\ - libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu\ - libarchive/test/test_read_format_rar_multivolume.part0003.rar.uu\ - libarchive/test/test_read_format_rar_multivolume.part0004.rar.uu\ - libarchive/test/test_read_format_rar_noeof.rar.uu \ - libarchive/test/test_read_format_rar_ppmd_lzss_conversion.rar.uu\ - libarchive/test/test_read_format_rar_sfx.exe.uu \ - libarchive/test/test_read_format_rar_subblock.rar.uu \ - libarchive/test/test_read_format_rar_unicode.rar.uu \ - libarchive/test/test_read_format_rar_windows.rar.uu \ - libarchive/test/test_read_format_raw.data.Z.uu \ - libarchive/test/test_read_format_raw.data.uu \ - libarchive/test/test_read_format_tar_empty_filename.tar.uu \ - libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu \ - libarchive/test/test_read_format_ustar_filename_cp866.tar.Z.uu \ - libarchive/test/test_read_format_ustar_filename_eucjp.tar.Z.uu \ - libarchive/test/test_read_format_ustar_filename_koi8r.tar.Z.uu \ - libarchive/test/test_read_format_zip.zip.uu \ - libarchive/test/test_read_format_zip_comment_stored_1.zip.uu \ - libarchive/test/test_read_format_zip_comment_stored_2.zip.uu \ - libarchive/test/test_read_format_zip_filename_cp866.zip.uu \ - libarchive/test/test_read_format_zip_filename_cp932.zip.uu \ - libarchive/test/test_read_format_zip_filename_koi8r.zip.uu \ - libarchive/test/test_read_format_zip_filename_utf8_jp.zip.uu \ - libarchive/test/test_read_format_zip_filename_utf8_ru2.zip.uu \ - libarchive/test/test_read_format_zip_filename_utf8_ru.zip.uu \ - libarchive/test/test_read_format_zip_length_at_end.zip.uu \ - libarchive/test/test_read_format_zip_mac_metadata.zip.uu \ - libarchive/test/test_read_format_zip_sfx.uu \ - libarchive/test/test_read_format_zip_symlink.zip.uu \ - libarchive/test/test_read_format_zip_ux.zip.uu \ - libarchive/test/test_read_large_splitted_rar_aa.uu \ - libarchive/test/test_read_large_splitted_rar_ab.uu \ - libarchive/test/test_read_large_splitted_rar_ac.uu \ - libarchive/test/test_read_large_splitted_rar_ad.uu \ - libarchive/test/test_read_large_splitted_rar_ae.uu \ - libarchive/test/test_read_splitted_rar_aa.uu \ - libarchive/test/test_read_splitted_rar_ab.uu \ - libarchive/test/test_read_splitted_rar_ac.uu \ - libarchive/test/test_read_splitted_rar_ad.uu \ - libarchive/test/test_splitted_rar_seek_support_aa.uu \ - libarchive/test/test_splitted_rar_seek_support_ab.uu \ - libarchive/test/test_splitted_rar_seek_support_ac.uu \ - libarchive/test/test_write_disk_appledouble.cpio.gz.uu \ - libarchive/test/test_write_disk_hfs_compression.tgz.uu \ - libarchive/test/test_write_disk_mac_metadata.tar.gz.uu \ - libarchive/test/test_write_disk_no_hfs_compression.tgz.uu \ - libarchive/test/CMakeLists.txt \ - libarchive/test/README - -# -# Common code for libarchive frontends (cpio, tar) -# -libarchive_fe_la_SOURCES= \ - libarchive_fe/err.c \ - libarchive_fe/err.h \ - libarchive_fe/lafe_platform.h \ - libarchive_fe/line_reader.c \ - libarchive_fe/line_reader.h - -libarchive_fe_la_CPPFLAGS= -I$(top_srcdir)/libarchive -# -# -# bsdtar source, docs, etc. -# -# - -bsdtar_SOURCES= \ - tar/bsdtar.c \ - tar/bsdtar.h \ - tar/bsdtar_platform.h \ - tar/cmdline.c \ - tar/creation_set.c \ - tar/read.c \ - tar/subst.c \ - tar/util.c \ - tar/write.c - -if INC_WINDOWS_FILES -bsdtar_SOURCES+= \ - tar/bsdtar_windows.h \ - tar/bsdtar_windows.c -endif - -bsdtar_DEPENDENCIES= libarchive.la libarchive_fe.la - -if STATIC_BSDTAR -bsdtar_ldstatic= -static -bsdtar_ccstatic= -DLIBARCHIVE_STATIC -else -bsdtar_ldstatic= -bsdtar_ccstatic= -endif - -bsdtar_LDADD= libarchive.la libarchive_fe.la $(LTLIBICONV) -bsdtar_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdtar_ccstatic) $(PLATFORMCPPFLAGS) -bsdtar_LDFLAGS= $(bsdtar_ldstatic) - -bsdtar_EXTRA_DIST= \ - tar/bsdtar.1 \ - tar/bsdtar_windows.h \ - tar/bsdtar_windows.c \ - tar/CMakeLists.txt \ - tar/config_freebsd.h - - -if BUILD_BSDTAR -bsdtar_man_MANS= tar/bsdtar.1 -bsdtar_programs= bsdtar -else -bsdtar_man_MANS= -bsdtar_programs= -endif - -# -# bsdtar_test -# - -bsdtar_test_SOURCES= \ - $(test_utils_SOURCES) \ - tar/test/main.c \ - tar/test/test.h \ - tar/test/test_0.c \ - tar/test/test_basic.c \ - tar/test/test_copy.c \ - tar/test/test_empty_mtree.c \ - tar/test/test_extract_tar_Z.c \ - tar/test/test_extract_tar_bz2.c \ - tar/test/test_extract_tar_grz.c \ - tar/test/test_extract_tar_gz.c \ - tar/test/test_extract_tar_lrz.c \ - tar/test/test_extract_tar_lz.c \ - tar/test/test_extract_tar_lzma.c \ - tar/test/test_extract_tar_lzo.c \ - tar/test/test_extract_tar_xz.c \ - tar/test/test_format_newc.c \ - tar/test/test_help.c \ - tar/test/test_option_C_upper.c \ - tar/test/test_option_H_upper.c \ - tar/test/test_option_L_upper.c \ - tar/test/test_option_O_upper.c \ - tar/test/test_option_T_upper.c \ - tar/test/test_option_U_upper.c \ - tar/test/test_option_X_upper.c \ - tar/test/test_option_a.c \ - tar/test/test_option_b.c \ - tar/test/test_option_b64encode.c \ - tar/test/test_option_exclude.c \ - tar/test/test_option_gid_gname.c \ - tar/test/test_option_grzip.c \ - tar/test/test_option_j.c \ - tar/test/test_option_k.c \ - tar/test/test_option_keep_newer_files.c \ - tar/test/test_option_lrzip.c \ - tar/test/test_option_lzma.c \ - tar/test/test_option_lzop.c \ - tar/test/test_option_n.c \ - tar/test/test_option_newer_than.c \ - tar/test/test_option_nodump.c \ - tar/test/test_option_older_than.c \ - tar/test/test_option_q.c \ - tar/test/test_option_r.c \ - tar/test/test_option_s.c \ - tar/test/test_option_uid_uname.c \ - tar/test/test_option_uuencode.c \ - tar/test/test_option_xz.c \ - tar/test/test_option_z.c \ - tar/test/test_patterns.c \ - tar/test/test_print_longpath.c \ - tar/test/test_stdio.c \ - tar/test/test_strip_components.c \ - tar/test/test_symlink_dir.c \ - tar/test/test_version.c \ - tar/test/test_windows.c - -bsdtar_test_CPPFLAGS=\ - -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \ - -I$(top_srcdir)/test_utils \ - -I$(top_srcdir)/tar -I$(top_builddir)/tar/test \ - $(PLATFORMCPPFLAGS) - -tar/test/list.h: Makefile - cat $(top_srcdir)/tar/test/test_*.c | grep DEFINE_TEST > tar/test/list.h - -if BUILD_BSDTAR -bsdtar_test_programs= bsdtar_test -bsdtar_TESTS_ENVIRONMENT= BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar$(EXEEXT) BSDTAR_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/tar/test -else -bsdtar_test_programs= -bsdtar_TESTS_ENVIRONMENT= -endif - -bsdtar_test_EXTRA_DIST= \ - tar/test/list.h \ - tar/test/test_extract.tar.Z.uu \ - tar/test/test_extract.tar.bz2.uu \ - tar/test/test_extract.tar.grz.uu \ - tar/test/test_extract.tar.gz.uu \ - tar/test/test_extract.tar.lrz.uu \ - tar/test/test_extract.tar.lz.uu \ - tar/test/test_extract.tar.lzma.uu \ - tar/test/test_extract.tar.lzo.uu \ - tar/test/test_extract.tar.xz.uu \ - tar/test/test_option_keep_newer_files.tar.Z.uu \ - tar/test/test_option_s.tar.Z.uu \ - tar/test/test_patterns_2.tar.uu \ - tar/test/test_patterns_3.tar.uu \ - tar/test/test_patterns_4.tar.uu \ - tar/test/test_print_longpath.tar.Z.uu \ - tar/test/CMakeLists.txt - - -# -# -# bsdcpio source, docs, etc. -# -# - -bsdcpio_SOURCES= \ - cpio/cmdline.c \ - cpio/cpio.c \ - cpio/cpio.h \ - cpio/cpio_platform.h - -if INC_WINDOWS_FILES -bsdcpio_SOURCES+= \ - cpio/cpio_windows.h \ - cpio/cpio_windows.c -endif - -bsdcpio_DEPENDENCIES = libarchive.la libarchive_fe.la - - -if STATIC_BSDCPIO -bsdcpio_ldstatic= -static -bsdcpio_ccstatic= -DLIBARCHIVE_STATIC -else -bsdcpio_ldstatic= -bsdcpio_ccstatic= -endif - -bsdcpio_LDADD= libarchive_fe.la libarchive.la $(LTLIBICONV) -bsdcpio_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcpio_ccstatic) $(PLATFORMCPPFLAGS) -bsdcpio_LDFLAGS= $(bsdcpio_ldstatic) - -bsdcpio_EXTRA_DIST= \ - cpio/bsdcpio.1 \ - cpio/cpio_windows.h \ - cpio/cpio_windows.c \ - cpio/CMakeLists.txt \ - cpio/config_freebsd.h - - -if BUILD_BSDCPIO -# Manpages to install -bsdcpio_man_MANS= cpio/bsdcpio.1 -bsdcpio_programs= bsdcpio -else -bsdcpio_man_MANS= -bsdcpio_programs= -endif - -# -# bsdcpio_test -# - -bsdcpio_test_SOURCES= \ - $(test_utils_SOURCES) \ - cpio/cmdline.c \ - cpio/test/main.c \ - cpio/test/test.h \ - cpio/test/test_0.c \ - cpio/test/test_basic.c \ - cpio/test/test_cmdline.c \ - cpio/test/test_extract_cpio_Z.c \ - cpio/test/test_extract_cpio_bz2.c \ - cpio/test/test_extract_cpio_grz.c \ - cpio/test/test_extract_cpio_gz.c \ - cpio/test/test_extract_cpio_lrz.c \ - cpio/test/test_extract_cpio_lz.c \ - cpio/test/test_extract_cpio_lzma.c \ - cpio/test/test_extract_cpio_lzo.c \ - cpio/test/test_extract_cpio_xz.c \ - cpio/test/test_format_newc.c \ - cpio/test/test_gcpio_compat.c \ - cpio/test/test_option_0.c \ - cpio/test/test_option_B_upper.c \ - cpio/test/test_option_C_upper.c \ - cpio/test/test_option_J_upper.c \ - cpio/test/test_option_L_upper.c \ - cpio/test/test_option_Z_upper.c \ - cpio/test/test_option_a.c \ - cpio/test/test_option_b64encode.c \ - cpio/test/test_option_c.c \ - cpio/test/test_option_d.c \ - cpio/test/test_option_f.c \ - cpio/test/test_option_grzip.c \ - cpio/test/test_option_help.c \ - cpio/test/test_option_l.c \ - cpio/test/test_option_lrzip.c \ - cpio/test/test_option_lzma.c \ - cpio/test/test_option_lzop.c \ - cpio/test/test_option_m.c \ - cpio/test/test_option_t.c \ - cpio/test/test_option_u.c \ - cpio/test/test_option_uuencode.c \ - cpio/test/test_option_version.c \ - cpio/test/test_option_xz.c \ - cpio/test/test_option_y.c \ - cpio/test/test_option_z.c \ - cpio/test/test_owner_parse.c \ - cpio/test/test_passthrough_dotdot.c \ - cpio/test/test_passthrough_reverse.c - -bsdcpio_test_CPPFLAGS= \ - -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \ - -I$(top_srcdir)/test_utils \ - -I$(top_srcdir)/cpio -I$(top_builddir)/cpio/test \ - $(PLATFORMCPPFLAGS) -bsdcpio_test_LDADD=libarchive_fe.la - -cpio/test/list.h: Makefile - cat $(top_srcdir)/cpio/test/test_*.c | grep DEFINE_TEST > cpio/test/list.h - -if BUILD_BSDCPIO -bsdcpio_test_programs= bsdcpio_test -bsdcpio_TESTS_ENVIRONMENT= BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio$(EXEEXT) BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test -else -bsdcpio_test_programs= -bsdcpio_TESTS_ENVIRONMENT= -endif - -bsdcpio_test_EXTRA_DIST= \ - cpio/test/list.h \ - cpio/test/test_extract.cpio.Z.uu \ - cpio/test/test_extract.cpio.bz2.uu \ - cpio/test/test_extract.cpio.grz.uu \ - cpio/test/test_extract.cpio.gz.uu \ - cpio/test/test_extract.cpio.lrz.uu \ - cpio/test/test_extract.cpio.lz.uu \ - cpio/test/test_extract.cpio.lzma.uu \ - cpio/test/test_extract.cpio.lzo.uu \ - cpio/test/test_extract.cpio.xz.uu \ - cpio/test/test_gcpio_compat_ref.bin.uu \ - cpio/test/test_gcpio_compat_ref.crc.uu \ - cpio/test/test_gcpio_compat_ref.newc.uu \ - cpio/test/test_gcpio_compat_ref.ustar.uu \ - cpio/test/test_gcpio_compat_ref_nosym.bin.uu \ - cpio/test/test_gcpio_compat_ref_nosym.crc.uu \ - cpio/test/test_gcpio_compat_ref_nosym.newc.uu \ - cpio/test/test_gcpio_compat_ref_nosym.ustar.uu \ - cpio/test/test_option_f.cpio.uu \ - cpio/test/test_option_m.cpio.uu \ - cpio/test/test_option_t.cpio.uu \ - cpio/test/test_option_t.stdout.uu \ - cpio/test/test_option_tv.stdout.uu \ - cpio/test/CMakeLists.txt diff --git a/build/README.txt b/build/README.txt deleted file mode 100644 index ce8e1a32a577..000000000000 --- a/build/README.txt +++ /dev/null @@ -1,35 +0,0 @@ -Notes on making a new release of libarchive -=========================================== - -The following serves as a guide for libarchive developers on the general -process to be followed when making a new release of libarchive. - -* Update build/version with the version number of the release to be made. -* If the library's ABI has changed, the library's soname major version *MUST* - be updated. Update configure.ac and CMakeLists.txt appropriately. - - For configure.ac, the variable ARCHIVE_INTERFACE needs to be updated. - - For CMakeLists.txt, the variable INTERFACE_VERSION needs to be updated. -* Update the entries in the NEWS file accordingly. -* Run `build/makerelease.sh` from the top source directory. Running this script - will do the following. - - Removes all Makefile.am development build specific CFLAGS from - Makefile.am. - - Update configure scripts and header files with the appropriate version - number from build/version. - - Rebuild the documentation directory. - - Runs a full cmake build and test. - - Runs a full autotools build and test. - - Builds the .tar.gz and .zip distribution files. -* Commit all changed files into git. - - This should be build/version, NEWS, and the files edited by running - build/makerelease.sh. -* Tag the release appropriately. The tag should also have an appropriate - message. - - The git command is as follows: - $ git tag -m "Libarchive " v - Replace with the version to be released. -* Copy all the generated wiki files and commit them into the libarchive.wiki - repository. Overwrite any preexisting files with the same name (these files - are always autogenerated from the libarchive release after every release). -* Update the libarchive.org website accordingly. -* Make an announcement to the libarchive-announce mailing list. diff --git a/build/autoconf/check_stdcall_func.m4 b/build/autoconf/check_stdcall_func.m4 deleted file mode 100644 index 926b046c5330..000000000000 --- a/build/autoconf/check_stdcall_func.m4 +++ /dev/null @@ -1,51 +0,0 @@ -# AC_LANG_STDCALL_FUNC_LINK_TRY(FUNCTION, SIGNATURE) -# ------------------------------- -# Produce a source which links correctly iff the FUNCTION exists. -AC_DEFUN([AC_LANG_STDCALL_FUNC_LINK_TRY], -[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) - -# AC_CHECK_STDCALL_FUNC(FUNCTION, SIGNATURE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) -# ----------------------------------------------------------------- -AC_DEFUN([AC_CHECK_STDCALL_FUNC], -[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl -AC_CACHE_CHECK([for $1], ac_var, -[AC_LINK_IFELSE([AC_LANG_STDCALL_FUNC_LINK_TRY([$1],[$2])], - [AS_VAR_SET(ac_var, yes)], - [AS_VAR_SET(ac_var, no)])]) -AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl -AS_VAR_POPDEF([ac_var])dnl -])# AC_CHECK_FUNC - -# AC_LANG_STDCALL_FUNC_LINK_TRY(C)(FUNCTION, SIGNATURE) -# ---------------------------------- -# Don't include because on OSF/1 3.0 it includes -# which includes which contains a -# prototype for select. Similarly for bzero. -m4_define([AC_LANG_STDCALL_FUNC_LINK_TRY(C)], -[AC_LANG_PROGRAM( -[/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char __stdcall $1 ( $2 ) below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char __stdcall $1 ( $2 ); -char (*f) ( $2 ); -], -[/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$1) || defined (__stub___$1) -choke me -#else -f = $1; -#endif -])]) - -# AC_LANG_STDCALL_FUNC_LINK_TRY(C++)(FUNCTION) -# ------------------------------------ -m4_copy([AC_LANG_STDCALL_FUNC_LINK_TRY(C)], [AC_LANG_STDCALL_FUNC_LINK_TRY(C++)]) - diff --git a/build/autoconf/config.rpath b/build/autoconf/config.rpath deleted file mode 100755 index 8a8cf8edec5e..000000000000 --- a/build/autoconf/config.rpath +++ /dev/null @@ -1,696 +0,0 @@ -#! /bin/sh -# -# NOTE: This file was brought from -# http://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/config.rpath -# You should sometimes check if the file is updated and bring it to -# our trunk and copy this note to the top of that file. -# -# Output a system dependent set of variables, describing how to set the -# run time search path of shared libraries in an executable. -# -# Copyright 1996-2011 Free Software Foundation, Inc. -# Taken from GNU libtool, 2001 -# Originally by Gordon Matzigkeit , 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. -# -# The first argument passed to this file is the canonical host specification, -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld -# should be set by the caller. -# -# The set of defined variables is at the end of this script. - -# Known limitations: -# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer -# than 256 bytes, otherwise the compiler driver will dump core. The only -# known workaround is to choose shorter directory names for the build -# directory and/or the installation directory. - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a -shrext=.so - -host="$1" -host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` -host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` -host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` - -# Code taken from libtool.m4's _LT_CC_BASENAME. - -for cc_temp in $CC""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` - -# Code taken from libtool.m4's _LT_COMPILER_PIC. - -wl= -if test "$GCC" = yes; then - wl='-Wl,' -else - case "$host_os" in - aix*) - wl='-Wl,' - ;; - mingw* | cygwin* | pw32* | os2* | cegcc*) - ;; - hpux9* | hpux10* | hpux11*) - wl='-Wl,' - ;; - irix5* | irix6* | nonstopux*) - wl='-Wl,' - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - ecc*) - wl='-Wl,' - ;; - icc* | ifort*) - wl='-Wl,' - ;; - lf95*) - wl='-Wl,' - ;; - nagfor*) - wl='-Wl,-Wl,,' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - wl='-Wl,' - ;; - ccc*) - wl='-Wl,' - ;; - xl* | bgxl* | bgf* | mpixl*) - wl='-Wl,' - ;; - como) - wl='-lopt=' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ F* | *Sun*Fortran*) - wl= - ;; - *Sun\ C*) - wl='-Wl,' - ;; - esac - ;; - esac - ;; - newsos6) - ;; - *nto* | *qnx*) - ;; - osf3* | osf4* | osf5*) - wl='-Wl,' - ;; - rdos*) - ;; - solaris*) - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - wl='-Qoption ld ' - ;; - *) - wl='-Wl,' - ;; - esac - ;; - sunos4*) - wl='-Qoption ld ' - ;; - sysv4 | sysv4.2uw2* | sysv4.3*) - wl='-Wl,' - ;; - sysv4*MP*) - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - wl='-Wl,' - ;; - unicos*) - wl='-Wl,' - ;; - uts4*) - ;; - esac -fi - -# Code taken from libtool.m4's _LT_LINKER_SHLIBS. - -hardcode_libdir_flag_spec= -hardcode_libdir_separator= -hardcode_direct=no -hardcode_minus_L=no - -case "$host_os" in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; -esac - -ld_shlibs=yes -if test "$with_gnu_ld" = yes; then - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - # Unlike libtool, we use -rpath here, not --rpath, since the documented - # option of GNU ld is called -rpath, not --rpath. - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - case "$host_os" in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - fi - ;; - amigaos*) - case "$host_cpu" in - powerpc) - ;; - m68k) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - beos*) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - cygwin* | mingw* | pw32* | cegcc*) - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - haiku*) - ;; - interix[3-9]*) - hardcode_direct=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - netbsd*) - ;; - solaris*) - if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' - else - ld_shlibs=no - fi - ;; - esac - ;; - sunos4*) - hardcode_direct=yes - ;; - *) - if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then - : - else - ld_shlibs=no - fi - ;; - esac - if test "$ld_shlibs" = no; then - hardcode_libdir_flag_spec= - fi -else - case "$host_os" in - aix3*) - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - else - aix_use_runtimelinking=no - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - fi - hardcode_direct=yes - hardcode_libdir_separator=':' - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && \ - strings "$collect2name" | grep resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - fi - # Begin _LT_AC_SYS_LIBPATH_AIX. - echo 'int main () { return 0; }' > conftest.c - ${CC} ${LDFLAGS} conftest.c -o conftest - aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` - if test -z "$aix_libpath"; then - aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } -}'` - fi - if test -z "$aix_libpath"; then - aix_libpath="/usr/lib:/lib" - fi - rm -f conftest.c conftest - # End _LT_AC_SYS_LIBPATH_AIX. - if test "$aix_use_runtimelinking" = yes; then - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - else - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - fi - fi - ;; - amigaos*) - case "$host_cpu" in - powerpc) - ;; - m68k) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - bsdi[45]*) - ;; - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec=' ' - libext=lib - ;; - darwin* | rhapsody*) - hardcode_direct=no - if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then - : - else - ld_shlibs=no - fi - ;; - dgux*) - hardcode_libdir_flag_spec='-L$libdir' - ;; - freebsd2.2*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - freebsd2*) - hardcode_direct=yes - hardcode_minus_L=yes - ;; - freebsd* | dragonfly*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - hpux9*) - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - hpux10*) - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - hpux11*) - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - ;; - *) - hardcode_direct=yes - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - irix5* | irix6* | nonstopux*) - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - netbsd*) - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - ;; - newsos6) - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - *nto* | *qnx*) - ;; - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - else - case "$host_os" in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - osf3*) - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - osf4* | osf5*) - if test "$GCC" = yes; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - # Both cc and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - hardcode_libdir_separator=: - ;; - solaris*) - hardcode_libdir_flag_spec='-R$libdir' - ;; - sunos4*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - ;; - sysv4) - case $host_vendor in - sni) - hardcode_direct=yes # is this really true??? - ;; - siemens) - hardcode_direct=no - ;; - motorola) - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - ;; - sysv4.3*) - ;; - sysv4*MP*) - if test -d /usr/nec; then - ld_shlibs=yes - fi - ;; - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - ;; - sysv5* | sco3.2v5* | sco5v6*) - hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' - hardcode_libdir_separator=':' - ;; - uts4*) - hardcode_libdir_flag_spec='-L$libdir' - ;; - *) - ld_shlibs=no - ;; - esac -fi - -# Check dynamic linker characteristics -# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. -# Unlike libtool.m4, here we don't care about _all_ names of the library, but -# only about the one the linker finds when passed -lNAME. This is the last -# element of library_names_spec in libtool.m4, or possibly two of them if the -# linker has special search rules. -library_names_spec= # the last element of library_names_spec in libtool.m4 -libname_spec='lib$name' -case "$host_os" in - aix3*) - library_names_spec='$libname.a' - ;; - aix[4-9]*) - library_names_spec='$libname$shrext' - ;; - amigaos*) - case "$host_cpu" in - powerpc*) - library_names_spec='$libname$shrext' ;; - m68k) - library_names_spec='$libname.a' ;; - esac - ;; - beos*) - library_names_spec='$libname$shrext' - ;; - bsdi[45]*) - library_names_spec='$libname$shrext' - ;; - cygwin* | mingw* | pw32* | cegcc*) - shrext=.dll - library_names_spec='$libname.dll.a $libname.lib' - ;; - darwin* | rhapsody*) - shrext=.dylib - library_names_spec='$libname$shrext' - ;; - dgux*) - library_names_spec='$libname$shrext' - ;; - freebsd* | dragonfly*) - case "$host_os" in - freebsd[123]*) - library_names_spec='$libname$shrext$versuffix' ;; - *) - library_names_spec='$libname$shrext' ;; - esac - ;; - gnu*) - library_names_spec='$libname$shrext' - ;; - haiku*) - library_names_spec='$libname$shrext' - ;; - hpux9* | hpux10* | hpux11*) - case $host_cpu in - ia64*) - shrext=.so - ;; - hppa*64*) - shrext=.sl - ;; - *) - shrext=.sl - ;; - esac - library_names_spec='$libname$shrext' - ;; - interix[3-9]*) - library_names_spec='$libname$shrext' - ;; - irix5* | irix6* | nonstopux*) - library_names_spec='$libname$shrext' - case "$host_os" in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; - *) libsuff= shlibsuff= ;; - esac - ;; - esac - ;; - linux*oldld* | linux*aout* | linux*coff*) - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) - library_names_spec='$libname$shrext' - ;; - knetbsd*-gnu) - library_names_spec='$libname$shrext' - ;; - netbsd*) - library_names_spec='$libname$shrext' - ;; - newsos6) - library_names_spec='$libname$shrext' - ;; - *nto* | *qnx*) - library_names_spec='$libname$shrext' - ;; - openbsd*) - library_names_spec='$libname$shrext$versuffix' - ;; - os2*) - libname_spec='$name' - shrext=.dll - library_names_spec='$libname.a' - ;; - osf3* | osf4* | osf5*) - library_names_spec='$libname$shrext' - ;; - rdos*) - ;; - solaris*) - library_names_spec='$libname$shrext' - ;; - sunos4*) - library_names_spec='$libname$shrext$versuffix' - ;; - sysv4 | sysv4.3*) - library_names_spec='$libname$shrext' - ;; - sysv4*MP*) - library_names_spec='$libname$shrext' - ;; - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - library_names_spec='$libname$shrext' - ;; - tpf*) - library_names_spec='$libname$shrext' - ;; - uts4*) - library_names_spec='$libname$shrext' - ;; -esac - -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' -escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` -shlibext=`echo "$shrext" | sed -e 's,^\.,,'` -escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` -escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` -escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` - -LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' < -#include - ]], - [[iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);]])], - [am_cv_func_iconv=yes]) - if test "$am_cv_func_iconv" != yes; then - am_save_LIBS="$LIBS" - LIBS="$LIBS $LIBICONV" - AC_LINK_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include - ]], - [[iconv_t cd = iconv_open("",""); - iconv(cd,NULL,NULL,NULL,NULL); - iconv_close(cd);]])], - [am_cv_lib_iconv=yes] - [am_cv_func_iconv=yes]) - LIBS="$am_save_LIBS" - fi - ]) - if test "$am_cv_func_iconv" = yes; then - AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ - dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, - dnl Solaris 10. - am_save_LIBS="$LIBS" - if test $am_cv_lib_iconv = yes; then - LIBS="$LIBS $LIBICONV" - fi - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ -#include -#include -int main () -{ - int result = 0; - /* Test against AIX 5.1 bug: Failures are not distinguishable from successful - returns. */ - { - iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); - if (cd_utf8_to_88591 != (iconv_t)(-1)) - { - static const char input[] = "\342\202\254"; /* EURO SIGN */ - char buf[10]; - const char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_utf8_to_88591, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res == 0) - result |= 1; - iconv_close (cd_utf8_to_88591); - } - } - /* Test against Solaris 10 bug: Failures are not distinguishable from - successful returns. */ - { - iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); - if (cd_ascii_to_88591 != (iconv_t)(-1)) - { - static const char input[] = "\263"; - char buf[10]; - const char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_ascii_to_88591, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res == 0) - result |= 2; - iconv_close (cd_ascii_to_88591); - } - } - /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ - { - iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); - if (cd_88591_to_utf8 != (iconv_t)(-1)) - { - static const char input[] = "\304"; - static char buf[2] = { (char)0xDE, (char)0xAD }; - const char *inptr = input; - size_t inbytesleft = 1; - char *outptr = buf; - size_t outbytesleft = 1; - size_t res = iconv (cd_88591_to_utf8, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) - result |= 4; - iconv_close (cd_88591_to_utf8); - } - } -#if 0 /* This bug could be worked around by the caller. */ - /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ - { - iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); - if (cd_88591_to_utf8 != (iconv_t)(-1)) - { - static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; - char buf[50]; - const char *inptr = input; - size_t inbytesleft = strlen (input); - char *outptr = buf; - size_t outbytesleft = sizeof (buf); - size_t res = iconv (cd_88591_to_utf8, - (char **) &inptr, &inbytesleft, - &outptr, &outbytesleft); - if ((int)res > 0) - result |= 8; - iconv_close (cd_88591_to_utf8); - } - } -#endif - /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is - provided. */ - if (/* Try standardized names. */ - iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) - /* Try IRIX, OSF/1 names. */ - && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) - /* Try AIX names. */ - && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) - /* Try HP-UX names. */ - && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) - result |= 16; - return result; -}]])], - [am_cv_func_iconv_works=yes], - [am_cv_func_iconv_works=no], - [ -changequote(,)dnl - case "$host_os" in - aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; - *) am_cv_func_iconv_works="guessing yes" ;; - esac -changequote([,])dnl - ]) - LIBS="$am_save_LIBS" - ]) - case "$am_cv_func_iconv_works" in - *no) am_func_iconv=no am_cv_lib_iconv=no ;; - *) am_func_iconv=yes ;; - esac - else - am_func_iconv=no am_cv_lib_iconv=no - fi - if test "$am_func_iconv" = yes; then - AC_DEFINE([HAVE_ICONV], [1], - [Define if you have the iconv() function and it works.]) - fi - if test "$am_cv_lib_iconv" = yes; then - AC_MSG_CHECKING([how to link with libiconv]) - AC_MSG_RESULT([$LIBICONV]) - else - dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV - dnl either. - CPPFLAGS="$am_save_CPPFLAGS" - LIBICONV= - LTLIBICONV= - fi - AC_SUBST([LIBICONV]) - AC_SUBST([LTLIBICONV]) -]) - -dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to -dnl avoid warnings like -dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". -dnl This is tricky because of the way 'aclocal' is implemented: -dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. -dnl Otherwise aclocal's initial scan pass would miss the macro definition. -dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. -dnl Otherwise aclocal would emit many "Use of uninitialized value $1" -dnl warnings. -m4_define([gl_iconv_AC_DEFUN], - m4_version_prereq([2.64], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [m4_ifdef([gl_00GNULIB], - [[AC_DEFUN_ONCE( - [$1], [$2])]], - [[AC_DEFUN( - [$1], [$2])]])])) -gl_iconv_AC_DEFUN([AM_ICONV], -[ - AM_ICONV_LINK - if test "$am_cv_func_iconv" = yes; then - AC_MSG_CHECKING([for iconv declaration]) - AC_CACHE_VAL([am_cv_proto_iconv], [ - AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM( - [[ -#include -#include -extern -#ifdef __cplusplus -"C" -#endif -#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) -size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); -#else -size_t iconv(); -#endif - ]], - [[]])], - [am_cv_proto_iconv_arg1=""], - [am_cv_proto_iconv_arg1="const"]) - am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) - am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` - AC_MSG_RESULT([ - $am_cv_proto_iconv]) - AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], - [Define as const if the declaration of iconv() needs const.]) - dnl Also substitute ICONV_CONST in the gnulib generated . - m4_ifdef([gl_ICONV_H_DEFAULTS], - [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) - if test -n "$am_cv_proto_iconv_arg1"; then - ICONV_CONST="const" - fi - ]) - fi -]) diff --git a/build/autoconf/la_uid_t.m4 b/build/autoconf/la_uid_t.m4 deleted file mode 100644 index 31eef5e96fcb..000000000000 --- a/build/autoconf/la_uid_t.m4 +++ /dev/null @@ -1,20 +0,0 @@ -# la_TYPE_UID_T -# ------------- -AC_DEFUN([la_TYPE_UID_T], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_CACHE_CHECK(for uid_t in sys/types.h, la_cv_type_uid_t, -[AC_EGREP_HEADER(uid_t, sys/types.h, - la_cv_type_uid_t=yes, la_cv_type_uid_t=no)]) -if test $la_cv_type_uid_t = no; then - case $host in - *mingw*) def_uid_t=short ;; - *) def_uid_t=int ;; - esac - AC_DEFINE_UNQUOTED(uid_t, [$def_uid_t], - [Define to match typeof st_uid field of struct stat if doesn't define.]) - AC_DEFINE_UNQUOTED(gid_t, [$def_uid_t], - [Define to match typeof st_gid field of struct stat if doesn't define.]) -fi -]) -AU_ALIAS([AC_TYPE_UID_T], [la_TYPE_UID_T]) - diff --git a/build/autoconf/lib-ld.m4 b/build/autoconf/lib-ld.m4 deleted file mode 100644 index ae003f7c5943..000000000000 --- a/build/autoconf/lib-ld.m4 +++ /dev/null @@ -1,109 +0,0 @@ -# lib-ld.m4 serial 5 (gettext-0.18.2) -dnl Copyright (C) 1996-2003, 2009-2011 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl Subroutines of libtool.m4, -dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision -dnl with libtool.m4. - -dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. -AC_DEFUN([AC_LIB_PROG_LD_GNU], -[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], -[# I'd rather use --version here, but apparently some GNU ld's only accept -v. -case `$LD -v 2>&1 /dev/null 2>&1 \ - && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ - || PATH_SEPARATOR=';' - } -fi -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by GCC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]* | [A-Za-z]:[\\/]*)] - [re_direlt='/[^/][^/]*/\.\./'] - # Canonicalize the path of ld - ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` - while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do - ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL([acl_cv_path_LD], -[if test -z "$LD"; then - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" - for ac_dir in $PATH; do - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - acl_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some GNU ld's only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in - *GNU* | *'with BFD'*) - test "$with_gnu_ld" != no && break ;; - *) - test "$with_gnu_ld" != yes && break ;; - esac - fi - done - IFS="$ac_save_ifs" -else - acl_cv_path_LD="$LD" # Let the user override the test with a path. -fi]) -LD="$acl_cv_path_LD" -if test -n "$LD"; then - AC_MSG_RESULT([$LD]) -else - AC_MSG_RESULT([no]) -fi -test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) -AC_LIB_PROG_LD_GNU -]) diff --git a/build/autoconf/lib-link.m4 b/build/autoconf/lib-link.m4 deleted file mode 100644 index e7c9ba9d3d71..000000000000 --- a/build/autoconf/lib-link.m4 +++ /dev/null @@ -1,777 +0,0 @@ -# lib-link.m4 serial 26 (gettext-0.18.2) -dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -AC_PREREQ([2.54]) - -dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and -dnl augments the CPPFLAGS variable. -dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname -dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - pushdef([Name],[m4_translit([$1],[./+-], [____])]) - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - ac_cv_lib[]Name[]_libs="$LIB[]NAME" - ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" - ac_cv_lib[]Name[]_cppflags="$INC[]NAME" - ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" - ]) - LIB[]NAME="$ac_cv_lib[]Name[]_libs" - LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" - INC[]NAME="$ac_cv_lib[]Name[]_cppflags" - LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - AC_SUBST([LIB]NAME[_PREFIX]) - dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the - dnl results of this search when this library appears as a dependency. - HAVE_LIB[]NAME=yes - popdef([NAME]) - popdef([Name]) -]) - -dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message]) -dnl searches for libname and the libraries corresponding to explicit and -dnl implicit dependencies, together with the specified include files and -dnl the ability to compile and link the specified testcode. The missing-message -dnl defaults to 'no' and may contain additional hints for the user. -dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} -dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and -dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs -dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. -dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname -dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], -[ - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - AC_REQUIRE([AC_LIB_RPATH]) - pushdef([Name],[m4_translit([$1],[./+-], [____])]) - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - - dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME - dnl accordingly. - AC_LIB_LINKFLAGS_BODY([$1], [$2]) - - dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, - dnl because if the user has installed lib[]Name and not disabled its use - dnl via --without-lib[]Name-prefix, he wants to use it. - ac_save_CPPFLAGS="$CPPFLAGS" - AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) - - AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ - ac_save_LIBS="$LIBS" - dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS, - dnl because these -l options might require -L options that are present in - dnl LIBS. -l options benefit only from the -L options listed before it. - dnl Otherwise, add it to the front of LIBS, because it may be a static - dnl library that depends on another static library that is present in LIBS. - dnl Static libraries benefit only from the static libraries listed after - dnl it. - case " $LIB[]NAME" in - *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; - *) LIBS="$LIB[]NAME $LIBS" ;; - esac - AC_LINK_IFELSE( - [AC_LANG_PROGRAM([[$3]], [[$4]])], - [ac_cv_lib[]Name=yes], - [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) - LIBS="$ac_save_LIBS" - ]) - if test "$ac_cv_lib[]Name" = yes; then - HAVE_LIB[]NAME=yes - AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.]) - AC_MSG_CHECKING([how to link with lib[]$1]) - AC_MSG_RESULT([$LIB[]NAME]) - else - HAVE_LIB[]NAME=no - dnl If $LIB[]NAME didn't lead to a usable library, we don't need - dnl $INC[]NAME either. - CPPFLAGS="$ac_save_CPPFLAGS" - LIB[]NAME= - LTLIB[]NAME= - LIB[]NAME[]_PREFIX= - fi - AC_SUBST([HAVE_LIB]NAME) - AC_SUBST([LIB]NAME) - AC_SUBST([LTLIB]NAME) - AC_SUBST([LIB]NAME[_PREFIX]) - popdef([NAME]) - popdef([Name]) -]) - -dnl Determine the platform dependent parameters needed to use rpath: -dnl acl_libext, -dnl acl_shlibext, -dnl acl_libname_spec, -dnl acl_library_names_spec, -dnl acl_hardcode_libdir_flag_spec, -dnl acl_hardcode_libdir_separator, -dnl acl_hardcode_direct, -dnl acl_hardcode_minus_L. -AC_DEFUN([AC_LIB_RPATH], -[ - dnl Tell automake >= 1.10 to complain if config.rpath is missing. - m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) - AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS - AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld - AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host - AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir - AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ - CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ - ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh - . ./conftest.sh - rm -f ./conftest.sh - acl_cv_rpath=done - ]) - wl="$acl_cv_wl" - acl_libext="$acl_cv_libext" - acl_shlibext="$acl_cv_shlibext" - acl_libname_spec="$acl_cv_libname_spec" - acl_library_names_spec="$acl_cv_library_names_spec" - acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" - acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" - acl_hardcode_direct="$acl_cv_hardcode_direct" - acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" - dnl Determine whether the user wants rpath handling at all. - AC_ARG_ENABLE([rpath], - [ --disable-rpath do not hardcode runtime library paths], - :, enable_rpath=yes) -]) - -dnl AC_LIB_FROMPACKAGE(name, package) -dnl declares that libname comes from the given package. The configure file -dnl will then not have a --with-libname-prefix option but a -dnl --with-package-prefix option. Several libraries can come from the same -dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar -dnl macro call that searches for libname. -AC_DEFUN([AC_LIB_FROMPACKAGE], -[ - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - define([acl_frompackage_]NAME, [$2]) - popdef([NAME]) - pushdef([PACK],[$2]) - pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - define([acl_libsinpackage_]PACKUP, - m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) - popdef([PACKUP]) - popdef([PACK]) -]) - -dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and -dnl the libraries corresponding to explicit and implicit dependencies. -dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. -dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found -dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. -AC_DEFUN([AC_LIB_LINKFLAGS_BODY], -[ - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) - pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], - [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) - pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) - dnl Autoconf >= 2.61 supports dots in --with options. - pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_ARG_WITH(P_A_C_K[-prefix], -[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib - --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - if test "$acl_libdirstem2" != "$acl_libdirstem" \ - && ! test -d "$withval/$acl_libdirstem"; then - additional_libdir="$withval/$acl_libdirstem2" - fi - fi - fi -]) - dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. - LIB[]NAME= - LTLIB[]NAME= - INC[]NAME= - LIB[]NAME[]_PREFIX= - dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been - dnl computed. So it has to be reset here. - HAVE_LIB[]NAME= - rpathdirs= - ltrpathdirs= - names_already_handled= - names_next_round='$1 $2' - while test -n "$names_next_round"; do - names_this_round="$names_next_round" - names_next_round= - for name in $names_this_round; do - already_handled= - for n in $names_already_handled; do - if test "$n" = "$name"; then - already_handled=yes - break - fi - done - if test -z "$already_handled"; then - names_already_handled="$names_already_handled $name" - dnl See if it was already located by an earlier AC_LIB_LINKFLAGS - dnl or AC_LIB_HAVE_LINKFLAGS call. - uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` - eval value=\"\$HAVE_LIB$uppername\" - if test -n "$value"; then - if test "$value" = yes; then - eval value=\"\$LIB$uppername\" - test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" - eval value=\"\$LTLIB$uppername\" - test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" - else - dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined - dnl that this library doesn't exist. So just drop it. - : - fi - else - dnl Search the library lib$name in $additional_libdir and $LDFLAGS - dnl and the already constructed $LIBNAME/$LTLIBNAME. - found_dir= - found_la= - found_so= - found_a= - eval libname=\"$acl_libname_spec\" # typically: libname=lib$name - if test -n "$acl_shlibext"; then - shrext=".$acl_shlibext" # typically: shrext=.so - else - shrext= - fi - if test $use_additional = yes; then - dir="$additional_libdir" - dnl The same code as in the loop below: - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - fi - if test "X$found_dir" = "X"; then - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - case "$x" in - -L*) - dir=`echo "X$x" | sed -e 's/^X-L//'` - dnl First look for a shared library. - if test -n "$acl_shlibext"; then - if test -f "$dir/$libname$shrext"; then - found_dir="$dir" - found_so="$dir/$libname$shrext" - else - if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then - ver=`(cd "$dir" && \ - for f in "$libname$shrext".*; do echo "$f"; done \ - | sed -e "s,^$libname$shrext\\\\.,," \ - | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ - | sed 1q ) 2>/dev/null` - if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then - found_dir="$dir" - found_so="$dir/$libname$shrext.$ver" - fi - else - eval library_names=\"$acl_library_names_spec\" - for f in $library_names; do - if test -f "$dir/$f"; then - found_dir="$dir" - found_so="$dir/$f" - break - fi - done - fi - fi - fi - dnl Then look for a static library. - if test "X$found_dir" = "X"; then - if test -f "$dir/$libname.$acl_libext"; then - found_dir="$dir" - found_a="$dir/$libname.$acl_libext" - fi - fi - if test "X$found_dir" != "X"; then - if test -f "$dir/$libname.la"; then - found_la="$dir/$libname.la" - fi - fi - ;; - esac - if test "X$found_dir" != "X"; then - break - fi - done - fi - if test "X$found_dir" != "X"; then - dnl Found the library. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" - if test "X$found_so" != "X"; then - dnl Linking with a shared library. We attempt to hardcode its - dnl directory into the executable's runpath, unless it's the - dnl standard /usr/lib. - if test "$enable_rpath" = no \ - || test "X$found_dir" = "X/usr/$acl_libdirstem" \ - || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then - dnl No hardcoding is needed. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $found_dir" - fi - dnl The hardcoding into $LIBNAME is system dependent. - if test "$acl_hardcode_direct" = yes; then - dnl Using DIR/libNAME.so during linking hardcodes DIR into the - dnl resulting binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode DIR into the resulting - dnl binary. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $found_dir" - fi - else - dnl Rely on "-L$found_dir". - dnl But don't add it if it's already contained in the LDFLAGS - dnl or the already constructed $LIBNAME - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$found_dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" - fi - if test "$acl_hardcode_minus_L" != no; then - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" - else - dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH - dnl here, because this doesn't fit in flags passed to the - dnl compiler. So give up. No hardcoding. This affects only - dnl very old systems. - dnl FIXME: Not sure whether we should use - dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" - dnl here. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - fi - fi - fi - fi - else - if test "X$found_a" != "X"; then - dnl Linking with a static library. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" - else - dnl We shouldn't come here, but anyway it's good to have a - dnl fallback. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" - fi - fi - dnl Assume the include files are nearby. - additional_includedir= - case "$found_dir" in - */$acl_libdirstem | */$acl_libdirstem/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - */$acl_libdirstem2 | */$acl_libdirstem2/) - basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` - if test "$name" = '$1'; then - LIB[]NAME[]_PREFIX="$basedir" - fi - additional_includedir="$basedir/include" - ;; - esac - if test "X$additional_includedir" != "X"; then - dnl Potentially add $additional_includedir to $INCNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's /usr/local/include and we are using GCC on Linux, - dnl 3. if it's already present in $CPPFLAGS or the already - dnl constructed $INCNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - for x in $CPPFLAGS $INC[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $INCNAME. - INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" - fi - fi - fi - fi - fi - dnl Look for dependencies. - if test -n "$found_la"; then - dnl Read the .la file. It defines the variables - dnl dlname, library_names, old_library, dependency_libs, current, - dnl age, revision, installed, dlopen, dlpreopen, libdir. - save_libdir="$libdir" - case "$found_la" in - */* | *\\*) . "$found_la" ;; - *) . "./$found_la" ;; - esac - libdir="$save_libdir" - dnl We use only dependency_libs. - for dep in $dependency_libs; do - case "$dep" in - -L*) - additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` - dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's /usr/local/lib and we are using GCC on Linux, - dnl 3. if it's already present in $LDFLAGS or the already - dnl constructed $LIBNAME, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ - && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then - haveit= - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ - || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - haveit= - for x in $LDFLAGS $LIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LIBNAME. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" - fi - fi - haveit= - for x in $LDFLAGS $LTLIB[]NAME; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LTLIBNAME. - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" - fi - fi - fi - fi - ;; - -R*) - dir=`echo "X$dep" | sed -e 's/^X-R//'` - if test "$enable_rpath" != no; then - dnl Potentially add DIR to rpathdirs. - dnl The rpathdirs will be appended to $LIBNAME at the end. - haveit= - for x in $rpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - rpathdirs="$rpathdirs $dir" - fi - dnl Potentially add DIR to ltrpathdirs. - dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. - haveit= - for x in $ltrpathdirs; do - if test "X$x" = "X$dir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - ltrpathdirs="$ltrpathdirs $dir" - fi - fi - ;; - -l*) - dnl Handle this in the next round. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` - ;; - *.la) - dnl Handle this in the next round. Throw away the .la's - dnl directory; it is already contained in a preceding -L - dnl option. - names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` - ;; - *) - dnl Most likely an immediate library name. - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" - ;; - esac - done - fi - else - dnl Didn't find the library; assume it is in the system directories - dnl known to the linker and runtime loader. (All the system - dnl directories known to the linker should also be known to the - dnl runtime loader, otherwise the system is severely misconfigured.) - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" - fi - fi - fi - done - done - if test "X$rpathdirs" != "X"; then - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user must - dnl pass all path elements in one option. We can arrange that for a - dnl single library, but not when more than one $LIBNAMEs are used. - alldirs= - for found_dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" - done - dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - else - dnl The -rpath options are cumulative. - for found_dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$found_dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" - done - fi - fi - if test "X$ltrpathdirs" != "X"; then - dnl When using libtool, the option that works for both libraries and - dnl executables is -R. The -R options are cumulative. - for found_dir in $ltrpathdirs; do - LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" - done - fi - popdef([P_A_C_K]) - popdef([PACKLIBS]) - popdef([PACKUP]) - popdef([PACK]) - popdef([NAME]) -]) - -dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, -dnl unless already present in VAR. -dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes -dnl contains two or three consecutive elements that belong together. -AC_DEFUN([AC_LIB_APPENDTOVAR], -[ - for element in [$2]; do - haveit= - for x in $[$1]; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X$element"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - [$1]="${[$1]}${[$1]:+ }$element" - fi - done -]) - -dnl For those cases where a variable contains several -L and -l options -dnl referring to unknown libraries and directories, this macro determines the -dnl necessary additional linker options for the runtime path. -dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) -dnl sets LDADDVAR to linker options needed together with LIBSVALUE. -dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, -dnl otherwise linking without libtool is assumed. -AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], -[ - AC_REQUIRE([AC_LIB_RPATH]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - $1= - if test "$enable_rpath" != no; then - if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then - dnl Use an explicit option to hardcode directories into the resulting - dnl binary. - rpathdirs= - next= - for opt in $2; do - if test -n "$next"; then - dir="$next" - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= - else - case $opt in - -L) next=yes ;; - -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` - dnl No need to hardcode the standard /usr/lib. - if test "X$dir" != "X/usr/$acl_libdirstem" \ - && test "X$dir" != "X/usr/$acl_libdirstem2"; then - rpathdirs="$rpathdirs $dir" - fi - next= ;; - *) next= ;; - esac - fi - done - if test "X$rpathdirs" != "X"; then - if test -n ""$3""; then - dnl libtool is used for linking. Use -R options. - for dir in $rpathdirs; do - $1="${$1}${$1:+ }-R$dir" - done - else - dnl The linker is used for linking directly. - if test -n "$acl_hardcode_libdir_separator"; then - dnl Weird platform: only the last -rpath option counts, the user - dnl must pass all path elements in one option. - alldirs= - for dir in $rpathdirs; do - alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" - done - acl_save_libdir="$libdir" - libdir="$alldirs" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - $1="$flag" - else - dnl The -rpath options are cumulative. - for dir in $rpathdirs; do - acl_save_libdir="$libdir" - libdir="$dir" - eval flag=\"$acl_hardcode_libdir_flag_spec\" - libdir="$acl_save_libdir" - $1="${$1}${$1:+ }$flag" - done - fi - fi - fi - fi - fi - AC_SUBST([$1]) -]) diff --git a/build/autoconf/lib-prefix.m4 b/build/autoconf/lib-prefix.m4 deleted file mode 100644 index 7e5f0bde03d8..000000000000 --- a/build/autoconf/lib-prefix.m4 +++ /dev/null @@ -1,224 +0,0 @@ -# lib-prefix.m4 serial 7 (gettext-0.18) -dnl Copyright (C) 2001-2005, 2008-2011 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -dnl From Bruno Haible. - -dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and -dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't -dnl require excessive bracketing. -ifdef([AC_HELP_STRING], -[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], -[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) - -dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed -dnl to access previously installed libraries. The basic assumption is that -dnl a user will want packages to use other packages he previously installed -dnl with the same --prefix option. -dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate -dnl libraries, but is otherwise very convenient. -AC_DEFUN([AC_LIB_PREFIX], -[ - AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) - AC_REQUIRE([AC_PROG_CC]) - AC_REQUIRE([AC_CANONICAL_HOST]) - AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) - AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) - dnl By default, look in $includedir and $libdir. - use_additional=yes - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - AC_LIB_ARG_WITH([lib-prefix], -[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib - --without-lib-prefix don't search for libraries in includedir and libdir], -[ - if test "X$withval" = "Xno"; then - use_additional=no - else - if test "X$withval" = "X"; then - AC_LIB_WITH_FINAL_PREFIX([ - eval additional_includedir=\"$includedir\" - eval additional_libdir=\"$libdir\" - ]) - else - additional_includedir="$withval/include" - additional_libdir="$withval/$acl_libdirstem" - fi - fi -]) - if test $use_additional = yes; then - dnl Potentially add $additional_includedir to $CPPFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/include, - dnl 2. if it's already present in $CPPFLAGS, - dnl 3. if it's /usr/local/include and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_includedir" != "X/usr/include"; then - haveit= - for x in $CPPFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-I$additional_includedir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_includedir" = "X/usr/local/include"; then - if test -n "$GCC"; then - case $host_os in - linux* | gnu* | k*bsd*-gnu) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_includedir"; then - dnl Really add $additional_includedir to $CPPFLAGS. - CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" - fi - fi - fi - fi - dnl Potentially add $additional_libdir to $LDFLAGS. - dnl But don't add it - dnl 1. if it's the standard /usr/lib, - dnl 2. if it's already present in $LDFLAGS, - dnl 3. if it's /usr/local/lib and we are using GCC on Linux, - dnl 4. if it doesn't exist as a directory. - if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then - haveit= - for x in $LDFLAGS; do - AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) - if test "X$x" = "X-L$additional_libdir"; then - haveit=yes - break - fi - done - if test -z "$haveit"; then - if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then - if test -n "$GCC"; then - case $host_os in - linux*) haveit=yes;; - esac - fi - fi - if test -z "$haveit"; then - if test -d "$additional_libdir"; then - dnl Really add $additional_libdir to $LDFLAGS. - LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" - fi - fi - fi - fi - fi -]) - -dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, -dnl acl_final_exec_prefix, containing the values to which $prefix and -dnl $exec_prefix will expand at the end of the configure script. -AC_DEFUN([AC_LIB_PREPARE_PREFIX], -[ - dnl Unfortunately, prefix and exec_prefix get only finally determined - dnl at the end of configure. - if test "X$prefix" = "XNONE"; then - acl_final_prefix="$ac_default_prefix" - else - acl_final_prefix="$prefix" - fi - if test "X$exec_prefix" = "XNONE"; then - acl_final_exec_prefix='${prefix}' - else - acl_final_exec_prefix="$exec_prefix" - fi - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the -dnl variables prefix and exec_prefix bound to the values they will have -dnl at the end of the configure script. -AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], -[ - acl_save_prefix="$prefix" - prefix="$acl_final_prefix" - acl_save_exec_prefix="$exec_prefix" - exec_prefix="$acl_final_exec_prefix" - $1 - exec_prefix="$acl_save_exec_prefix" - prefix="$acl_save_prefix" -]) - -dnl AC_LIB_PREPARE_MULTILIB creates -dnl - a variable acl_libdirstem, containing the basename of the libdir, either -dnl "lib" or "lib64" or "lib/64", -dnl - a variable acl_libdirstem2, as a secondary possible value for -dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or -dnl "lib/amd64". -AC_DEFUN([AC_LIB_PREPARE_MULTILIB], -[ - dnl There is no formal standard regarding lib and lib64. - dnl On glibc systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine - dnl the compiler's default mode by looking at the compiler's library search - dnl path. If at least one of its elements ends in /lib64 or points to a - dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. - dnl Otherwise we use the default, namely "lib". - dnl On Solaris systems, the current practice is that on a system supporting - dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under - dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or - dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. - AC_REQUIRE([AC_CANONICAL_HOST]) - acl_libdirstem=lib - acl_libdirstem2= - case "$host_os" in - solaris*) - dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment - dnl . - dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." - dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the - dnl symlink is missing, so we set acl_libdirstem2 too. - AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], - [AC_EGREP_CPP([sixtyfour bits], [ -#ifdef _LP64 -sixtyfour bits -#endif - ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) - ]) - if test $gl_cv_solaris_64bit = yes; then - acl_libdirstem=lib/64 - case "$host_cpu" in - sparc*) acl_libdirstem2=lib/sparcv9 ;; - i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; - esac - fi - ;; - *) - searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` - if test -n "$searchpath"; then - acl_save_IFS="${IFS= }"; IFS=":" - for searchdir in $searchpath; do - if test -d "$searchdir"; then - case "$searchdir" in - */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; - */../ | */.. ) - # Better ignore directories of this form. They are misleading. - ;; - *) searchdir=`cd "$searchdir" && pwd` - case "$searchdir" in - */lib64 ) acl_libdirstem=lib64 ;; - esac ;; - esac - fi - done - IFS="$acl_save_IFS" - fi - ;; - esac - test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" -]) diff --git a/build/autogen.sh b/build/autogen.sh deleted file mode 100755 index e73162465d2a..000000000000 --- a/build/autogen.sh +++ /dev/null @@ -1,67 +0,0 @@ -#!/bin/sh - -PATH=/usr/local/gnu-autotools/bin/:$PATH -export PATH - -# Start from one level above the build directory -if [ -f version ]; then - cd .. -fi - -if [ \! -f build/version ]; then - echo "Can't find source directory" - exit 1 -fi - -# BSD make's "OBJDIR" support freaks out the automake-generated -# Makefile. Effectively disable it. -export MAKEOBJDIRPREFIX=/junk - -# Start from the build directory, where the version file is located -if [ -f build/version ]; then - cd build -fi - -if [ \! -f version ]; then - echo "Can't find version file" - exit 1 -fi - -# Update the build number in the 'version' file. -# Separate number from additional alpha/beta/etc marker -MARKER=`cat version | sed 's/[0-9.]//g'` -# Bump the number -VN=`cat version | sed 's/[^0-9.]//g'` -# Build out the string. -VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER" - -cd .. - -# Clean up the source dir as much as we can. -/bin/sh build/clean.sh - -# Substitute the versions into Libarchive's archive.h and archive_entry.h -perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive.h -perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive_entry.h -perl -p -i -e "s/^(#define\tARCHIVE_VERSION_STRING).*/\$1 \"libarchive $VS\"/" libarchive/archive.h -# Substitute versions into configure.ac as well -perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_S\]),.*\)/$1,['"$VS"'])/' configure.ac -perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_N\]),.*\)/$1,['"$VN"'])/' configure.ac - -# Remove developer CFLAGS if a release build is being made -if [ -n "${MAKE_LIBARCHIVE_RELEASE}" ]; then - perl -p -i -e "s/^(DEV_CFLAGS.*)/# \$1/" Makefile.am -fi - -set -xe -aclocal -I build/autoconf - -# Note: --automake flag needed only for libtoolize from -# libtool 1.5.x; in libtool 2.2.x it is a synonym for --quiet -case `uname` in -Darwin) glibtoolize --automake -c;; -*) libtoolize --automake -c;; -esac -autoconf -autoheader -automake -a -c diff --git a/build/bump-version.sh b/build/bump-version.sh deleted file mode 100644 index eec42354fd47..000000000000 --- a/build/bump-version.sh +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh +v - -# Start from the build directory, where the version file is located -if [ -f build/version ]; then - cd build -fi - -if [ \! -f version ]; then - echo "Can't find version file" - exit 1 -fi - -# Update the build number in the 'version' file. -# Separate number from additional alpha/beta/etc marker -MARKER=`cat version | sed 's/[0-9.]//g'` -# Bump the number -VN=`cat version | sed 's/[^0-9.]//g'` -# Reassemble and write back out -VN=$(($VN + 1)) -rm -f version.old -mv version version.old -chmod +w version.old -echo $VN$MARKER > version -VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER" -cd .. - -ANNOUNCE=`date +"%b %d, %Y:"`" libarchive $VS released" - -echo $ANNOUNCE - -# Add a version notice to NEWS -mv NEWS NEWS.bak -chmod +w NEWS.bak -echo $ANNOUNCE >> NEWS -echo >> NEWS -cat NEWS.bak >> NEWS diff --git a/build/clean.sh b/build/clean.sh deleted file mode 100644 index e4465f8a786c..000000000000 --- a/build/clean.sh +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh - -# -# Attempt to remove as many generated files as we can. -# Ideally, a well-used development sandbox would look like -# a pristine checkout after running this script. -# - -if [ \! -f build/version ]; then - echo 'Must run the clean script from the top-level dir of the libarchive distribution' 1>&2 - exit 1 -fi - -# If we're on BSD, blow away the build dir under /usr/obj -rm -rf /usr/obj`pwd` - -# -# Try to clean up a bit more... -# - -find . -name '*.So' | xargs rm -f -find . -name '*.a' | xargs rm -f -find . -name '*.la' | xargs rm -f -find . -name '*.lo' | xargs rm -f -find . -name '*.o' | xargs rm -f -find . -name '*.orig' | xargs rm -f -find . -name '*.po' | xargs rm -f -find . -name '*.rej' | xargs rm -f -find . -name '*~' | xargs rm -f -find . -name '.depend' | xargs rm -f -find . -name '.deps' | xargs rm -rf -find . -name '.dirstamp' | xargs rm -f -find . -name '.libs' | xargs rm -rf -find . -name 'CMakeFiles' | xargs rm -rf -find . -name 'cmake_install.cmake' | xargs rm -f -find . -name 'CTestTestfile.cmake' | xargs rm -f - -rm -rf Testing -rm -rf autom4te.cache -rm -rf bin -rm -rf cmake.tmp -rm -rf libarchive/Testing - -rm -f CMakeCache.txt -rm -f DartConfiguration.tcl -rm -f Makefile -rm -f Makefile.in -rm -f aclocal.m4 -rm -f bsdcpio -rm -f bsdcpio_test -rm -f bsdtar -rm -f bsdtar_test -rm -f build/autoconf/compile -rm -f build/autoconf/config.guess -rm -f build/autoconf/config.sub -rm -f build/autoconf/depcomp -rm -f build/autoconf/install-sh -rm -f build/autoconf/libtool.m4 -rm -f build/autoconf/ltmain.sh -rm -f build/autoconf/ltoptions.m4 -rm -f build/autoconf/ltsugar.m4 -rm -f build/autoconf/ltversion.m4 -rm -f build/autoconf/lt~obsolete.m4 -rm -f build/autoconf/missing -rm -f build/pkgconfig/libarchive.pc -rm -f build/version.old -rm -f config.h -rm -f config.h.in -rm -f config.log -rm -f config.status -rm -f configure -rm -f cpio/*.1.gz -rm -f cpio/Makefile -rm -f cpio/bsdcpio -rm -f cpio/test/Makefile -rm -f cpio/test/bsdcpio_test -rm -f cpio/test/list.h -rm -f doc/html/* -rm -f doc/man/* -rm -f doc/pdf/* -rm -f doc/text/* -rm -f doc/wiki/* -rm -f libarchive/*.[35].gz -rm -f libarchive/Makefile -rm -f libarchive/libarchive.so* -rm -f libarchive/test/Makefile -rm -f libarchive/test/libarchive_test -rm -f libarchive/test/list.h -rm -f libarchive_test -rm -f libtool -rm -f stamp-h1 -rm -f tar/*.1.gz -rm -f tar/Makefile -rm -f tar/bsdtar -rm -f tar/test/Makefile -rm -f tar/test/bsdtar_test -rm -f tar/test/list.h diff --git a/build/cmake/CheckFileOffsetBits.c b/build/cmake/CheckFileOffsetBits.c deleted file mode 100644 index d948fecf2b4e..000000000000 --- a/build/cmake/CheckFileOffsetBits.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -#define KB ((off_t)1024) -#define MB ((off_t)1024 * KB) -#define GB ((off_t)1024 * MB) -#define TB ((off_t)1024 * GB) -int t2[(((64 * GB -1) % 671088649) == 268434537) - && (((TB - (64 * GB -1) + 255) % 1792151290) == 305159546)? 1: -1]; - -int main() -{ - ; - return 0; -} diff --git a/build/cmake/CheckFileOffsetBits.cmake b/build/cmake/CheckFileOffsetBits.cmake deleted file mode 100644 index b347c9366e4a..000000000000 --- a/build/cmake/CheckFileOffsetBits.cmake +++ /dev/null @@ -1,44 +0,0 @@ -# - Check if _FILE_OFFSET_BITS macro needed for large files -# CHECK_FILE_OFFSET_BITS () -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# Copyright (c) 2009, Michihiro NAKAJIMA -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -#INCLUDE(CheckCXXSourceCompiles) - -GET_FILENAME_COMPONENT(_selfdir_CheckFileOffsetBits - "${CMAKE_CURRENT_LIST_FILE}" PATH) - -MACRO (CHECK_FILE_OFFSET_BITS) - IF(NOT DEFINED _FILE_OFFSET_BITS) - MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files") - TRY_COMPILE(__WITHOUT_FILE_OFFSET_BITS_64 - ${CMAKE_CURRENT_BINARY_DIR} - ${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}) - IF(NOT __WITHOUT_FILE_OFFSET_BITS_64) - TRY_COMPILE(__WITH_FILE_OFFSET_BITS_64 - ${CMAKE_CURRENT_BINARY_DIR} - ${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64) - ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64) - - IF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64) - SET(_FILE_OFFSET_BITS 64 CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files") - MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - needed") - ELSE(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64) - SET(_FILE_OFFSET_BITS "" CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files") - MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - not needed") - ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64) - ENDIF(NOT DEFINED _FILE_OFFSET_BITS) - -ENDMACRO (CHECK_FILE_OFFSET_BITS) - diff --git a/build/cmake/CheckFuncs.cmake b/build/cmake/CheckFuncs.cmake deleted file mode 100644 index 0670df97f869..000000000000 --- a/build/cmake/CheckFuncs.cmake +++ /dev/null @@ -1,49 +0,0 @@ -# Check if the system has the specified function; treat glibc "stub" -# functions as nonexistent: -# CHECK_FUNCTION_EXISTS_GLIBC (FUNCTION FUNCVAR) -# -# FUNCTION - the function(s) where the prototype should be declared -# FUNCVAR - variable to define if the function does exist -# -# In particular, this understands the glibc convention of -# defining macros __stub_XXXX or __stub___XXXX if the function -# does appear in the library but is merely a stub that does nothing. -# By detecting this case, we can select alternate behavior on -# platforms that don't support this functionality. -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# Copyright (c) 2009, Michihiro NAKAJIMA -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -INCLUDE(CheckFunctionExists) -GET_FILENAME_COMPONENT(_selfdir_CheckFunctionExistsGlibc - "${CMAKE_CURRENT_LIST_FILE}" PATH) - -MACRO (CHECK_FUNCTION_EXISTS_GLIBC _FUNC _FUNCVAR) - IF(NOT DEFINED ${_FUNCVAR}) - SET(CHECK_STUB_FUNC_1 "__stub_${_FUNC}") - SET(CHECK_STUB_FUNC_2 "__stub___${_FUNC}") - CONFIGURE_FILE( ${_selfdir_CheckFunctionExistsGlibc}/CheckFuncs_stub.c.in - ${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c IMMEDIATE) - TRY_COMPILE(__stub - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS - -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS} - "${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}") - IF (__stub) - SET("${_FUNCVAR}" "" CACHE INTERNAL "Have function ${_FUNC}") - ELSE (__stub) - CHECK_FUNCTION_EXISTS("${_FUNC}" "${_FUNCVAR}") - ENDIF (__stub) - ENDIF(NOT DEFINED ${_FUNCVAR}) -ENDMACRO (CHECK_FUNCTION_EXISTS_GLIBC) - diff --git a/build/cmake/CheckFuncs_stub.c.in b/build/cmake/CheckFuncs_stub.c.in deleted file mode 100644 index 50da414b5f51..000000000000 --- a/build/cmake/CheckFuncs_stub.c.in +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef __STDC__ -#include -#else -#include -#endif - -int -main() -{ -#if defined ${CHECK_STUB_FUNC_1} || defined ${CHECK_STUB_FUNC_2} - return 0; -#else -this system have stub - return 0; -#endif -} diff --git a/build/cmake/CheckHeaderDirent.cmake b/build/cmake/CheckHeaderDirent.cmake deleted file mode 100644 index e9a7ea855326..000000000000 --- a/build/cmake/CheckHeaderDirent.cmake +++ /dev/null @@ -1,32 +0,0 @@ -# - Check if the system has the specified type -# CHECK_HEADER_DIRENT (HEADER1 HEARDER2 ...) -# -# HEADER - the header(s) where the prototype should be declared -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# Copyright (c) 2009, Michihiro NAKAJIMA -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -INCLUDE(CheckTypeExists) - -MACRO (CHECK_HEADER_DIRENT) - CHECK_TYPE_EXISTS("DIR *" dirent.h HAVE_DIRENT_H) - IF(NOT HAVE_DIRENT_H) - CHECK_TYPE_EXISTS("DIR *" sys/ndir.h HAVE_SYS_NDIR_H) - IF(NOT HAVE_SYS_NDIR_H) - CHECK_TYPE_EXISTS("DIR *" ndir.h HAVE_NDIR_H) - IF(NOT HAVE_NDIR_H) - CHECK_TYPE_EXISTS("DIR *" sys/dir.h HAVE_SYS_DIR_H) - ENDIF(NOT HAVE_NDIR_H) - ENDIF(NOT HAVE_SYS_NDIR_H) - ENDIF(NOT HAVE_DIRENT_H) -ENDMACRO (CHECK_HEADER_DIRENT) - diff --git a/build/cmake/CheckStructMember.cmake b/build/cmake/CheckStructMember.cmake deleted file mode 100644 index 05ddb3a11f20..000000000000 --- a/build/cmake/CheckStructMember.cmake +++ /dev/null @@ -1,43 +0,0 @@ -# - Check if the given struct or class has the specified member variable -# CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE) -# -# STRUCT - the name of the struct or class you are interested in -# MEMBER - the member which existence you want to check -# HEADER - the header(s) where the prototype should be declared -# VARIABLE - variable to store the result -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories - -# Copyright (c) 2006, Alexander Neundorf, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -INCLUDE(CheckCSourceCompiles) - -MACRO (CHECK_STRUCT_MEMBER _STRUCT _MEMBER _HEADER _RESULT) - SET(_INCLUDE_FILES) - FOREACH (it ${_HEADER}) - SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") - ENDFOREACH (it) - - SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE " -${_INCLUDE_FILES} -int main() -{ - static ${_STRUCT} tmp; - if (sizeof(tmp.${_MEMBER})) - return 0; - return 0; -} -") - CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) - -ENDMACRO (CHECK_STRUCT_MEMBER) - diff --git a/build/cmake/CheckTypeExists.cmake b/build/cmake/CheckTypeExists.cmake deleted file mode 100644 index b05234fd8753..000000000000 --- a/build/cmake/CheckTypeExists.cmake +++ /dev/null @@ -1,42 +0,0 @@ -# - Check if the system has the specified type -# CHECK_TYPE_EXISTS (TYPE HEADER VARIABLE) -# -# TYPE - the name of the type or struct or class you are interested in -# HEADER - the header(s) where the prototype should be declared -# VARIABLE - variable to store the result -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# Copyright (c) 2009, Michihiro NAKAJIMA -# Copyright (c) 2006, Alexander Neundorf, -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - - -INCLUDE(CheckCSourceCompiles) - -MACRO (CHECK_TYPE_EXISTS _TYPE _HEADER _RESULT) - SET(_INCLUDE_FILES) - FOREACH (it ${_HEADER}) - SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") - ENDFOREACH (it) - - SET(_CHECK_TYPE_EXISTS_SOURCE_CODE " -${_INCLUDE_FILES} -int main() -{ - static ${_TYPE} tmp; - if (sizeof(tmp)) - return 0; - return 0; -} -") - CHECK_C_SOURCE_COMPILES("${_CHECK_TYPE_EXISTS_SOURCE_CODE}" ${_RESULT}) - -ENDMACRO (CHECK_TYPE_EXISTS) - diff --git a/build/cmake/FindLZMA.cmake b/build/cmake/FindLZMA.cmake deleted file mode 100644 index 0b46b2cdd125..000000000000 --- a/build/cmake/FindLZMA.cmake +++ /dev/null @@ -1,48 +0,0 @@ -# - Find lzma and lzmadec -# Find the native LZMA includes and library -# -# LZMA_INCLUDE_DIR - where to find lzma.h, etc. -# LZMA_LIBRARIES - List of libraries when using liblzma. -# LZMA_FOUND - True if liblzma found. -# LZMADEC_INCLUDE_DIR - where to find lzmadec.h, etc. -# LZMADEC_LIBRARIES - List of libraries when using liblzmadec. -# LZMADEC_FOUND - True if liblzmadec found. - -IF (LZMA_INCLUDE_DIR) - # Already in cache, be silent - SET(LZMA_FIND_QUIETLY TRUE) -ENDIF (LZMA_INCLUDE_DIR) - -FIND_PATH(LZMA_INCLUDE_DIR lzma.h) -FIND_LIBRARY(LZMA_LIBRARY NAMES lzma liblzma) - -# handle the QUIETLY and REQUIRED arguments and set LZMA_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZMA DEFAULT_MSG LZMA_LIBRARY LZMA_INCLUDE_DIR) - -IF(LZMA_FOUND) - SET( LZMA_LIBRARIES ${LZMA_LIBRARY} ) -ELSE(LZMA_FOUND) - SET( LZMA_LIBRARIES ) - - IF (LZMADEC_INCLUDE_DIR) - # Already in cache, be silent - SET(LZMADEC_FIND_QUIETLY TRUE) - ENDIF (LZMADEC_INCLUDE_DIR) - - FIND_PATH(LZMADEC_INCLUDE_DIR lzmadec.h) - FIND_LIBRARY(LZMADEC_LIBRARY NAMES lzmadec ) - - # handle the QUIETLY and REQUIRED arguments and set LZMADEC_FOUND to TRUE if - # all listed variables are TRUE - INCLUDE(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZMADEC DEFAULT_MSG LZMADEC_LIBRARY - LZMADEC_INCLUDE_DIR) - - IF(LZMADEC_FOUND) - SET( LZMADEC_LIBRARIES ${LZMADEC_LIBRARY} ) - ELSE(LZMADEC_FOUND) - SET( LZMADEC_LIBRARIES ) - ENDIF(LZMADEC_FOUND) -ENDIF(LZMA_FOUND) diff --git a/build/cmake/FindLibGCC.cmake b/build/cmake/FindLibGCC.cmake deleted file mode 100644 index 5883ff802642..000000000000 --- a/build/cmake/FindLibGCC.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# - Find libgcc -# Find the libgcc library. -# -# LIBGCC_LIBRARIES - List of libraries when using libgcc -# LIBGCC_FOUND - True if libgcc found. - -IF (LIBGCC_LIBRARY) - # Already in cache, be silent - SET(LIBGCC_FIND_QUIETLY TRUE) -ENDIF (LIBGCC_LIBRARY) - -FIND_LIBRARY(LIBGCC_LIBRARY NAMES gcc libgcc) - -# handle the QUIETLY and REQUIRED arguments and set LIBGCC_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGCC DEFAULT_MSG LIBGCC_LIBRARY) - -IF(LIBGCC_FOUND) - SET(LIBGCC_LIBRARIES ${LIBGCC_LIBRARY}) - SET(HAVE_LIBGCC 1) -ENDIF(LIBGCC_FOUND) diff --git a/build/cmake/FindNettle.cmake b/build/cmake/FindNettle.cmake deleted file mode 100644 index 54ec9f5d39b5..000000000000 --- a/build/cmake/FindNettle.cmake +++ /dev/null @@ -1,23 +0,0 @@ -# - Find Nettle -# Find the Nettle include directory and library -# -# NETTLE_INCLUDE_DIR - where to find , etc. -# NETTLE_LIBRARIES - List of libraries when using libnettle. -# NETTLE_FOUND - True if libnettle found. - -IF (NETTLE_INCLUDE_DIR) - # Already in cache, be silent - SET(NETTLE_FIND_QUIETLY TRUE) -ENDIF (NETTLE_INCLUDE_DIR) - -FIND_PATH(NETTLE_INCLUDE_DIR nettle/md5.h nettle/ripemd160.h nettle/sha.h) -FIND_LIBRARY(NETTLE_LIBRARY NAMES nettle libnettle) - -# handle the QUIETLY and REQUIRED arguments and set NETTLE_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETTLE DEFAULT_MSG NETTLE_LIBRARY NETTLE_INCLUDE_DIR) - -IF(NETTLE_FOUND) - SET(NETTLE_LIBRARIES ${NETTLE_LIBRARY}) -ENDIF(NETTLE_FOUND) diff --git a/build/cmake/FindPCREPOSIX.cmake b/build/cmake/FindPCREPOSIX.cmake deleted file mode 100644 index 56cc17eacb47..000000000000 --- a/build/cmake/FindPCREPOSIX.cmake +++ /dev/null @@ -1,34 +0,0 @@ -# - Find pcreposix -# Find the native PCRE and PCREPOSIX include and libraries -# -# PCRE_INCLUDE_DIR - where to find pcreposix.h, etc. -# PCREPOSIX_LIBRARIES - List of libraries when using libpcreposix. -# PCRE_LIBRARIES - List of libraries when using libpcre. -# PCREPOSIX_FOUND - True if libpcreposix found. -# PCRE_FOUND - True if libpcre found. - -IF (PCRE_INCLUDE_DIR) - # Already in cache, be silent - SET(PCRE_FIND_QUIETLY TRUE) -ENDIF (PCRE_INCLUDE_DIR) - -FIND_PATH(PCRE_INCLUDE_DIR pcreposix.h) -FIND_LIBRARY(PCREPOSIX_LIBRARY NAMES pcreposix libpcreposix) -FIND_LIBRARY(PCRE_LIBRARY NAMES pcre libpcre) - -# handle the QUIETLY and REQUIRED arguments and set PCREPOSIX_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCREPOSIX DEFAULT_MSG PCREPOSIX_LIBRARY PCRE_INCLUDE_DIR) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY) - -IF(PCREPOSIX_FOUND) - SET(PCREPOSIX_LIBRARIES ${PCREPOSIX_LIBRARY}) - SET(HAVE_LIBPCREPOSIX 1) - SET(HAVE_PCREPOSIX_H 1) -ENDIF(PCREPOSIX_FOUND) - -IF(PCRE_FOUND) - SET(PCRE_LIBRARIES ${PCRE_LIBRARY}) - SET(HAVE_LIBPCRE 1) -ENDIF(PCRE_FOUND) diff --git a/build/cmake/LibarchiveCheckCSourceCompiles.cmake b/build/cmake/LibarchiveCheckCSourceCompiles.cmake deleted file mode 100644 index 6b6f59334da4..000000000000 --- a/build/cmake/LibarchiveCheckCSourceCompiles.cmake +++ /dev/null @@ -1,106 +0,0 @@ -# - Check if given C source compiles and links into an executable -# CHECK_C_SOURCE_COMPILES( [FAIL_REGEX ]) -# - source code to try to compile, must define 'main' -# - variable to store whether the source code compiled -# - fail if test output matches this regex -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# CMAKE_REQUIRED_LIBRARIES = list of libraries to link - -#============================================================================= -# Copyright 2005-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# -# Extra arguments added by libarchive -# CMAKE_REQUIRED_LINKER_FLAGS = string of linker command line flags -# - -include(CMakeExpandImportedTargets) - - -macro(LIBARCHIVE_CHECK_C_SOURCE_COMPILES SOURCE VAR) - if("${VAR}" MATCHES "^${VAR}$") - set(_FAIL_REGEX) - set(_key) - foreach(arg ${ARGN}) - if("${arg}" MATCHES "^(FAIL_REGEX)$") - set(_key "${arg}") - elseif(_key) - list(APPEND _${_key} "${arg}") - else() - message(FATAL_ERROR "Unknown argument:\n ${arg}\n") - endif() - endforeach() - set(MACRO_CHECK_FUNCTION_DEFINITIONS - "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") - if(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - endif() - if(CMAKE_REQUIRED_INCLUDES) - set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) - endif() - if(CMAKE_REQUIRED_LINKER_FLAGS) - set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS - "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS) - endif() - file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" - "${SOURCE}\n") - - message(STATUS "Performing Test ${VAR}") - try_compile(${VAR} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} ${CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS} - "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" - "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" - OUTPUT_VARIABLE OUTPUT) - - foreach(_regex ${_FAIL_REGEX}) - if("${OUTPUT}" MATCHES "${_regex}") - set(${VAR} 0) - endif() - endforeach() - - if(${VAR}) - set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" - "${OUTPUT}\n" - "Source file was:\n${SOURCE}\n") - else() - message(STATUS "Performing Test ${VAR} - Failed") - set(${VAR} "" CACHE INTERNAL "Test ${VAR}") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" - "${OUTPUT}\n" - "Source file was:\n${SOURCE}\n") - endif() - endif() -endmacro() - diff --git a/build/cmake/LibarchiveCheckCSourceRuns.cmake b/build/cmake/LibarchiveCheckCSourceRuns.cmake deleted file mode 100644 index 498f52265aca..000000000000 --- a/build/cmake/LibarchiveCheckCSourceRuns.cmake +++ /dev/null @@ -1,102 +0,0 @@ -# - Check if the given C source code compiles and runs. -# CHECK_C_SOURCE_RUNS( ) -# - source code to try to compile -# - variable to store the result -# (1 for success, empty for failure) -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# CMAKE_REQUIRED_LIBRARIES = list of libraries to link - -#============================================================================= -# Copyright 2006-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# -# Extra arguments added by libarchive -# CMAKE_REQUIRED_LINKER_FLAGS = string of linker command line flags -# - -include(CMakeExpandImportedTargets) - - -macro(LIBARCHIVE_CHECK_C_SOURCE_RUNS SOURCE VAR) - if("${VAR}" MATCHES "^${VAR}$") - set(MACRO_CHECK_FUNCTION_DEFINITIONS - "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") - if(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - endif() - if(CMAKE_REQUIRED_INCLUDES) - set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) - endif() - if(CMAKE_REQUIRED_LINKER_FLAGS) - set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS - "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS) - endif() - file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" - "${SOURCE}\n") - - message(STATUS "Performing Test ${VAR}") - try_run(${VAR}_EXITCODE ${VAR}_COMPILED - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} ${CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS} - -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} - "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" - "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" - COMPILE_OUTPUT_VARIABLE OUTPUT) - # if it did not compile make the return value fail code of 1 - if(NOT ${VAR}_COMPILED) - set(${VAR}_EXITCODE 1) - endif() - # if the return value was 0 then it worked - if("${${VAR}_EXITCODE}" EQUAL 0) - set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" - "${OUTPUT}\n" - "Return value: ${${VAR}}\n" - "Source file was:\n${SOURCE}\n") - else() - if(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") - set(${VAR} "${${VAR}_EXITCODE}") - else() - set(${VAR} "" CACHE INTERNAL "Test ${VAR}") - endif() - - message(STATUS "Performing Test ${VAR} - Failed") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" - "${OUTPUT}\n" - "Return value: ${${VAR}_EXITCODE}\n" - "Source file was:\n${SOURCE}\n") - - endif() - endif() -endmacro() - diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in deleted file mode 100644 index c04314ee5e32..000000000000 --- a/build/cmake/config.h.in +++ /dev/null @@ -1,1143 +0,0 @@ -/* config.h. Generated from build/cmake/config.h.in by cmake configure */ - -/* - * Ensure we have C99-style int64_t, etc, all defined. - */ - -/* First, we need to know if the system has already defined them. */ -#cmakedefine HAVE_INT16_T -#cmakedefine HAVE_INT32_T -#cmakedefine HAVE_INT64_T -#cmakedefine HAVE_INTMAX_T - -#cmakedefine HAVE_UINT8_T -#cmakedefine HAVE_UINT16_T -#cmakedefine HAVE_UINT32_T -#cmakedefine HAVE_UINT64_T -#cmakedefine HAVE_UINTMAX_T - -/* We might have the types we want under other spellings. */ -#cmakedefine HAVE___INT64 -#cmakedefine HAVE_U_INT64_T -#cmakedefine HAVE_UNSIGNED___INT64 - -/* The sizes of various standard integer types. */ -@SIZE_OF_SHORT_CODE@ -@SIZE_OF_INT_CODE@ -@SIZE_OF_LONG_CODE@ -@SIZE_OF_LONG_LONG_CODE@ -@SIZE_OF_UNSIGNED_SHORT_CODE@ -@SIZE_OF_UNSIGNED_CODE@ -@SIZE_OF_UNSIGNED_LONG_CODE@ -@SIZE_OF_UNSIGNED_LONG_LONG_CODE@ - -/* - * If we lack int64_t, define it to the first of __int64, int, long, and long long - * that exists and is the right size. - */ -#if !defined(HAVE_INT64_T) && defined(HAVE___INT64) -typedef __int64 int64_t; -#define HAVE_INT64_T -#endif - -#if !defined(HAVE_INT64_T) && SIZE_OF_INT == 8 -typedef int int64_t; -#define HAVE_INT64_T -#endif - -#if !defined(HAVE_INT64_T) && SIZE_OF_LONG == 8 -typedef long int64_t; -#define HAVE_INT64_T -#endif - -#if !defined(HAVE_INT64_T) && SIZE_OF_LONG_LONG == 8 -typedef long long int64_t; -#define HAVE_INT64_T -#endif - -#if !defined(HAVE_INT64_T) -#error No 64-bit integer type was found. -#endif - -/* - * Similarly for int32_t - */ -#if !defined(HAVE_INT32_T) && SIZE_OF_INT == 4 -typedef long int32_t; -#define HAVE_INT32_T -#endif - -#if !defined(HAVE_INT32_T) && SIZE_OF_LONG == 4 -typedef long int32_t; -#define HAVE_INT32_T -#endif - -#if !defined(HAVE_INT32_T) -#error No 32-bit integer type was found. -#endif - -/* - * Similarly for int16_t - */ -#if !defined(HAVE_INT16_T) && SIZE_OF_INT == 2 -typedef int int16_t; -#define HAVE_INT16_T -#endif - -#if !defined(HAVE_INT16_T) && SIZE_OF_SHORT == 2 -typedef short int16_t; -#define HAVE_INT16_T -#endif - -#if !defined(HAVE_INT16_T) -#error No 16-bit integer type was found. -#endif - -/* - * Similarly for uint64_t - */ -#if !defined(HAVE_UINT64_T) && defined(HAVE_UNSIGNED___INT64) -typedef unsigned __int64 uint64_t; -#define HAVE_UINT64_T -#endif - -#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED == 8 -typedef unsigned uint64_t; -#define HAVE_UINT64_T -#endif - -#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG == 8 -typedef unsigned long uint64_t; -#define HAVE_UINT64_T -#endif - -#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG_LONG == 8 -typedef unsigned long long uint64_t; -#define HAVE_UINT64_T -#endif - -#if !defined(HAVE_UINT64_T) -#error No 64-bit unsigned integer type was found. -#endif - - -/* - * Similarly for uint32_t - */ -#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED == 4 -typedef unsigned uint32_t; -#define HAVE_UINT32_T -#endif - -#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED_LONG == 4 -typedef unsigned long uint32_t; -#define HAVE_UINT32_T -#endif - -#if !defined(HAVE_UINT32_T) -#error No 32-bit unsigned integer type was found. -#endif - -/* - * Similarly for uint16_t - */ -#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED == 2 -typedef unsigned uint16_t; -#define HAVE_UINT16_T -#endif - -#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED_SHORT == 2 -typedef unsigned short uint16_t; -#define HAVE_UINT16_T -#endif - -#if !defined(HAVE_UINT16_T) -#error No 16-bit unsigned integer type was found. -#endif - -/* - * Similarly for uint8_t - */ -#if !defined(HAVE_UINT8_T) -typedef unsigned char uint8_t; -#define HAVE_UINT8_T -#endif - -#if !defined(HAVE_UINT16_T) -#error No 8-bit unsigned integer type was found. -#endif - -/* Define intmax_t and uintmax_t if they are not already defined. */ -#if !defined(HAVE_INTMAX_T) -typedef int64_t intmax_t; -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX -#endif - -#if !defined(HAVE_UINTMAX_T) -typedef uint64_t uintmax_t; -#endif - -/* Define ZLIB_WINAPI if zlib was built on Visual Studio. */ -#cmakedefine ZLIB_WINAPI 1 - -/* MD5 via ARCHIVE_CRYPTO_MD5_LIBC supported. */ -#cmakedefine ARCHIVE_CRYPTO_MD5_LIBC 1 - -/* MD5 via ARCHIVE_CRYPTO_MD5_LIBSYSTEM supported. */ -#cmakedefine ARCHIVE_CRYPTO_MD5_LIBSYSTEM 1 - -/* MD5 via ARCHIVE_CRYPTO_MD5_NETTLE supported. */ -#cmakedefine ARCHIVE_CRYPTO_MD5_NETTLE 1 - -/* MD5 via ARCHIVE_CRYPTO_MD5_OPENSSL supported. */ -#cmakedefine ARCHIVE_CRYPTO_MD5_OPENSSL 1 - -/* MD5 via ARCHIVE_CRYPTO_MD5_WIN supported. */ -#cmakedefine ARCHIVE_CRYPTO_MD5_WIN 1 - -/* RMD160 via ARCHIVE_CRYPTO_RMD160_LIBC supported. */ -#cmakedefine ARCHIVE_CRYPTO_RMD160_LIBC 1 - -/* RMD160 via ARCHIVE_CRYPTO_RMD160_NETTLE supported. */ -#cmakedefine ARCHIVE_CRYPTO_RMD160_NETTLE 1 - -/* RMD160 via ARCHIVE_CRYPTO_RMD160_OPENSSL supported. */ -#cmakedefine ARCHIVE_CRYPTO_RMD160_OPENSSL 1 - -/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBC supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA1_LIBC 1 - -/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBSYSTEM supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA1_LIBSYSTEM 1 - -/* SHA1 via ARCHIVE_CRYPTO_SHA1_NETTLE supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA1_NETTLE 1 - -/* SHA1 via ARCHIVE_CRYPTO_SHA1_OPENSSL supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA1_OPENSSL 1 - -/* SHA1 via ARCHIVE_CRYPTO_SHA1_WIN supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA1_WIN 1 - -/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBC 1 - -/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC2 supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBC2 1 - -/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC3 supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBC3 1 - -/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBSYSTEM supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBSYSTEM 1 - -/* SHA256 via ARCHIVE_CRYPTO_SHA256_NETTLE supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA256_NETTLE 1 - -/* SHA256 via ARCHIVE_CRYPTO_SHA256_OPENSSL supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA256_OPENSSL 1 - -/* SHA256 via ARCHIVE_CRYPTO_SHA256_WIN supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA256_WIN 1 - -/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBC 1 - -/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC2 supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBC2 1 - -/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC3 supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBC3 1 - -/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBSYSTEM supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBSYSTEM 1 - -/* SHA384 via ARCHIVE_CRYPTO_SHA384_NETTLE supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA384_NETTLE 1 - -/* SHA384 via ARCHIVE_CRYPTO_SHA384_OPENSSL supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA384_OPENSSL 1 - -/* SHA384 via ARCHIVE_CRYPTO_SHA384_WIN supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA384_WIN 1 - -/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBC 1 - -/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC2 supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBC2 1 - -/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC3 supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBC3 1 - -/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBSYSTEM supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBSYSTEM 1 - -/* SHA512 via ARCHIVE_CRYPTO_SHA512_NETTLE supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA512_NETTLE 1 - -/* SHA512 via ARCHIVE_CRYPTO_SHA512_OPENSSL supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA512_OPENSSL 1 - -/* SHA512 via ARCHIVE_CRYPTO_SHA512_WIN supported. */ -#cmakedefine ARCHIVE_CRYPTO_SHA512_WIN 1 - -/* Version number of bsdcpio */ -#cmakedefine BSDCPIO_VERSION_STRING "${BSDCPIO_VERSION_STRING}" - -/* Version number of bsdtar */ -#cmakedefine BSDTAR_VERSION_STRING "${BSDTAR_VERSION_STRING}" - -/* Define to 1 if you have the `acl_create_entry' function. */ -#cmakedefine HAVE_ACL_CREATE_ENTRY 1 - -/* Define to 1 if you have the `acl_get_link' function. */ -#cmakedefine HAVE_ACL_GET_LINK 1 - -/* Define to 1 if you have the `acl_get_link_np' function. */ -#cmakedefine HAVE_ACL_GET_LINK_NP 1 - -/* Define to 1 if you have the `acl_get_perm' function. */ -#cmakedefine HAVE_ACL_GET_PERM 1 - -/* Define to 1 if you have the `acl_get_perm_np' function. */ -#cmakedefine HAVE_ACL_GET_PERM_NP 1 - -/* Define to 1 if you have the `acl_init' function. */ -#cmakedefine HAVE_ACL_INIT 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ACL_LIBACL_H 1 - -/* Define to 1 if the system has the type `acl_permset_t'. */ -#cmakedefine HAVE_ACL_PERMSET_T 1 - -/* Define to 1 if you have the `acl_set_fd' function. */ -#cmakedefine HAVE_ACL_SET_FD 1 - -/* Define to 1 if you have the `acl_set_fd_np' function. */ -#cmakedefine HAVE_ACL_SET_FD_NP 1 - -/* Define to 1 if you have the `acl_set_file' function. */ -#cmakedefine HAVE_ACL_SET_FILE 1 - -/* True for systems with POSIX ACL support */ -#cmakedefine HAVE_ACL_USER 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ATTR_XATTR_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_BSDXML_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_BZLIB_H 1 - -/* Define to 1 if you have the `chflags' function. */ -#cmakedefine HAVE_CHFLAGS 1 - -/* Define to 1 if you have the `chown' function. */ -#cmakedefine HAVE_CHOWN 1 - -/* Define to 1 if you have the `chroot' function. */ -#cmakedefine HAVE_CHROOT 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_COPYFILE_H 1 - -/* Define to 1 if you have the `ctime_r' function. */ -#cmakedefine HAVE_CTIME_R 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_CTYPE_H 1 - -/* Define to 1 if you have the `cygwin_conv_path' function. */ -#cmakedefine HAVE_CYGWIN_CONV_PATH 1 - -/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_INT64_MAX 1 - -/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_INT64_MIN 1 - -/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_SIZE_MAX 1 - -/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_SSIZE_MAX 1 - -/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_STRERROR_R 1 - -/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_UINT32_MAX 1 - -/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you - don't. */ -#cmakedefine HAVE_DECL_UINT64_MAX 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DIRECT_H 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#cmakedefine HAVE_DIRENT_H 1 - -/* Define to 1 if you have the `dirfd' function. */ -#cmakedefine HAVE_DIRFD 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DLFCN_H 1 - -/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ -#cmakedefine HAVE_DOPRNT 1 - -/* Define to 1 if nl_langinfo supports D_MD_ORDER */ -#cmakedefine HAVE_D_MD_ORDER 1 - -/* A possible errno value for invalid file format errors */ -#cmakedefine HAVE_EFTYPE 1 - -/* A possible errno value for invalid file format errors */ -#cmakedefine HAVE_EILSEQ 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ERRNO_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_EXPAT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_EXT2FS_EXT2_FS_H 1 - -/* Define to 1 if you have the `extattr_get_file' function. */ -#cmakedefine HAVE_EXTATTR_GET_FILE 1 - -/* Define to 1 if you have the `extattr_list_file' function. */ -#cmakedefine HAVE_EXTATTR_LIST_FILE 1 - -/* Define to 1 if you have the `extattr_set_fd' function. */ -#cmakedefine HAVE_EXTATTR_SET_FD 1 - -/* Define to 1 if you have the `extattr_set_file' function. */ -#cmakedefine HAVE_EXTATTR_SET_FILE 1 - -/* Define to 1 if EXTATTR_NAMESPACE_USER is defined in sys/extattr.h. */ -#cmakedefine HAVE_DECL_EXTATTR_NAMESPACE_USER 1 - -/* Define to 1 if you have the `fchdir' function. */ -#cmakedefine HAVE_FCHDIR 1 - -/* Define to 1 if you have the `fchflags' function. */ -#cmakedefine HAVE_FCHFLAGS 1 - -/* Define to 1 if you have the `fchmod' function. */ -#cmakedefine HAVE_FCHMOD 1 - -/* Define to 1 if you have the `fchown' function. */ -#cmakedefine HAVE_FCHOWN 1 - -/* Define to 1 if you have the `fcntl' function. */ -#cmakedefine HAVE_FCNTL 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `fdopendir' function. */ -#cmakedefine HAVE_FDOPENDIR 1 - -/* Define to 1 if you have the `fgetea' function. */ -#cmakedefine HAVE_FGETEA 1 - -/* Define to 1 if you have the `fgetxattr' function. */ -#cmakedefine HAVE_FGETXATTR 1 - -/* Define to 1 if you have the `flistea' function. */ -#cmakedefine HAVE_FLISTEA 1 - -/* Define to 1 if you have the `flistxattr' function. */ -#cmakedefine HAVE_FLISTXATTR 1 - -/* Define to 1 if you have the `fork' function. */ -#cmakedefine HAVE_FORK 1 - -/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ -#cmakedefine HAVE_FSEEKO 1 - -/* Define to 1 if you have the `fsetea' function. */ -#cmakedefine HAVE_FSETEA 1 - -/* Define to 1 if you have the `fsetxattr' function. */ -#cmakedefine HAVE_FSETXATTR 1 - -/* Define to 1 if you have the `fstat' function. */ -#cmakedefine HAVE_FSTAT 1 - -/* Define to 1 if you have the `fstatat' function. */ -#cmakedefine HAVE_FSTATAT 1 - -/* Define to 1 if you have the `fstatfs' function. */ -#cmakedefine HAVE_FSTATFS 1 - -/* Define to 1 if you have the `fstatvfs' function. */ -#cmakedefine HAVE_FSTATVFS 1 - -/* Define to 1 if you have the `ftruncate' function. */ -#cmakedefine HAVE_FTRUNCATE 1 - -/* Define to 1 if you have the `futimens' function. */ -#cmakedefine HAVE_FUTIMENS 1 - -/* Define to 1 if you have the `futimes' function. */ -#cmakedefine HAVE_FUTIMES 1 - -/* Define to 1 if you have the `futimesat' function. */ -#cmakedefine HAVE_FUTIMESAT 1 - -/* Define to 1 if you have the `getea' function. */ -#cmakedefine HAVE_GETEA 1 - -/* Define to 1 if you have the `geteuid' function. */ -#cmakedefine HAVE_GETEUID 1 - -/* Define to 1 if you have the `getgrgid_r' function. */ -#cmakedefine HAVE_GETGRGID_R 1 - -/* Define to 1 if you have the `getgrnam_r' function. */ -#cmakedefine HAVE_GETGRNAM_R 1 - -/* Define to 1 if you have the `getpid' function. */ -#cmakedefine HAVE_GETPID 1 - -/* Define to 1 if you have the `getpwnam_r' function. */ -#cmakedefine HAVE_GETPWNAM_R 1 - -/* Define to 1 if you have the `getpwuid_r' function. */ -#cmakedefine HAVE_GETPWUID_R 1 - -/* Define to 1 if you have the `getvfsbyname' function. */ -#cmakedefine HAVE_GETVFSBYNAME 1 - -/* Define to 1 if you have the `getxattr' function. */ -#cmakedefine HAVE_GETXATTR 1 - -/* Define to 1 if you have the `gmtime_r' function. */ -#cmakedefine HAVE_GMTIME_R 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_GRP_H 1 - -/* Define to 1 if you have the `iconv' function. */ -#cmakedefine HAVE_ICONV 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ICONV_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_IO_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LANGINFO_H 1 - -/* Define to 1 if you have the `lchflags' function. */ -#cmakedefine HAVE_LCHFLAGS 1 - -/* Define to 1 if you have the `lchmod' function. */ -#cmakedefine HAVE_LCHMOD 1 - -/* Define to 1 if you have the `lchown' function. */ -#cmakedefine HAVE_LCHOWN 1 - -/* Define to 1 if you have the `lgetea' function. */ -#cmakedefine HAVE_LGETEA 1 - -/* Define to 1 if you have the `lgetxattr' function. */ -#cmakedefine HAVE_LGETXATTR 1 - -/* Define to 1 if you have the `acl' library (-lacl). */ -#cmakedefine HAVE_LIBACL 1 - -/* Define to 1 if you have the `attr' library (-lattr). */ -#cmakedefine HAVE_LIBATTR 1 - -/* Define to 1 if you have the `bsdxml' library (-lbsdxml). */ -#cmakedefine HAVE_LIBBSDXML 1 - -/* Define to 1 if you have the `bz2' library (-lbz2). */ -#cmakedefine HAVE_LIBBZ2 1 - -/* Define to 1 if you have the `expat' library (-lexpat). */ -#cmakedefine HAVE_LIBEXPAT 1 - -/* Define to 1 if you have the `gcc' library (-lgcc). */ -#cmakedefine HAVE_LIBGCC 1 - -/* Define to 1 if you have the `lzma' library (-llzma). */ -#cmakedefine HAVE_LIBLZMA 1 - -/* Define to 1 if you have the `lzmadec' library (-llzmadec). */ -#cmakedefine HAVE_LIBLZMADEC 1 - -/* Define to 1 if you have the `lzo2' library (-llzo2). */ -#cmakedefine HAVE_LIBLZO2 1 - -/* Define to 1 if you have the `nettle' library (-lnettle). */ -#cmakedefine HAVE_LIBNETTLE 1 - -/* Define to 1 if you have the `pcre' library (-lpcre). */ -#cmakedefine HAVE_LIBPCRE 1 - -/* Define to 1 if you have the `pcreposix' library (-lpcreposix). */ -#cmakedefine HAVE_LIBPCREPOSIX 1 - -/* Define to 1 if you have the `xml2' library (-lxml2). */ -#cmakedefine HAVE_LIBXML2 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LIBXML_XMLREADER_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LIBXML_XMLWRITER_H 1 - -/* Define to 1 if you have the `z' library (-lz). */ -#cmakedefine HAVE_LIBZ 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LIMITS_H 1 - -/* Define to 1 if you have the `link' function. */ -#cmakedefine HAVE_LINK 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LINUX_FIEMAP_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LINUX_FS_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LINUX_MAGIC_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LINUX_TYPES_H 1 - -/* Define to 1 if you have the `listea' function. */ -#cmakedefine HAVE_LISTEA 1 - -/* Define to 1 if you have the `listxattr' function. */ -#cmakedefine HAVE_LISTXATTR 1 - -/* Define to 1 if you have the `llistea' function. */ -#cmakedefine HAVE_LLISTEA 1 - -/* Define to 1 if you have the `llistxattr' function. */ -#cmakedefine HAVE_LLISTXATTR 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LOCALCHARSET_H 1 - -/* Define to 1 if you have the `locale_charset' function. */ -#cmakedefine HAVE_LOCALE_CHARSET 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LOCALE_H 1 - -/* Define to 1 if you have the `localtime_r' function. */ -#cmakedefine HAVE_LOCALTIME_R 1 - -/* Define to 1 if the system has the type `long long int'. */ -#cmakedefine HAVE_LONG_LONG_INT 1 - -/* Define to 1 if you have the `lsetea' function. */ -#cmakedefine HAVE_LSETEA 1 - -/* Define to 1 if you have the `lsetxattr' function. */ -#cmakedefine HAVE_LSETXATTR 1 - -/* Define to 1 if you have the `lstat' function. */ -#cmakedefine HAVE_LSTAT 1 - -/* Define to 1 if `lstat' has the bug that it succeeds when given the - zero-length file name argument. */ -#cmakedefine HAVE_LSTAT_EMPTY_STRING_BUG 1 - -/* Define to 1 if you have the `lutimes' function. */ -#cmakedefine HAVE_LUTIMES 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LZMADEC_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LZMA_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LZO_LZO1X_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_LZO_LZOCONF_H 1 - -/* Define to 1 if you have the `mbrtowc' function. */ -#cmakedefine HAVE_MBRTOWC 1 - -/* Define to 1 if you have the `memmove' function. */ -#cmakedefine HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_MEMORY_H 1 - -/* Define to 1 if you have the `mkdir' function. */ -#cmakedefine HAVE_MKDIR 1 - -/* Define to 1 if you have the `mkfifo' function. */ -#cmakedefine HAVE_MKFIFO 1 - -/* Define to 1 if you have the `mknod' function. */ -#cmakedefine HAVE_MKNOD 1 - -/* Define to 1 if you have the `mkstemp' function. */ -#cmakedefine HAVE_MKSTEMP 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. */ -#cmakedefine HAVE_NDIR_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_NETTLE_MD5_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_NETTLE_RIPEMD160_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_NETTLE_SHA_H 1 - -/* Define to 1 if you have the `nl_langinfo' function. */ -#cmakedefine HAVE_NL_LANGINFO 1 - -/* Define to 1 if you have the `openat' function. */ -#cmakedefine HAVE_OPENAT 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_PATHS_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_PCREPOSIX_H 1 - -/* Define to 1 if you have the `pipe' function. */ -#cmakedefine HAVE_PIPE 1 - -/* Define to 1 if you have the `poll' function. */ -#cmakedefine HAVE_POLL 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_POLL_H 1 - -/* Define to 1 if you have the `posix_spawnp' function. */ -#cmakedefine HAVE_POSIX_SPAWNP 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_PROCESS_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_PWD_H 1 - -/* Define to 1 if you have the `readdir_r' function. */ -#cmakedefine HAVE_READDIR_R 1 - -/* Define to 1 if you have the `readlink' function. */ -#cmakedefine HAVE_READLINK 1 - -/* Define to 1 if you have the `readlinkat' function. */ -#cmakedefine HAVE_READLINKAT 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_REGEX_H 1 - -/* Define to 1 if you have the `select' function. */ -#cmakedefine HAVE_SELECT 1 - -/* Define to 1 if you have the `setenv' function. */ -#cmakedefine HAVE_SETENV 1 - -/* Define to 1 if you have the `setlocale' function. */ -#cmakedefine HAVE_SETLOCALE 1 - -/* Define to 1 if you have the `sigaction' function. */ -#cmakedefine HAVE_SIGACTION 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SIGNAL_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SPAWN_H 1 - -/* Define to 1 if you have the `statfs' function. */ -#cmakedefine HAVE_STATFS 1 - -/* Define to 1 if you have the `statvfs' function. */ -#cmakedefine HAVE_STATVFS 1 - -/* Define to 1 if `stat' has the bug that it succeeds when given the - zero-length file name argument. */ -#cmakedefine HAVE_STAT_EMPTY_STRING_BUG 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDARG_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDLIB_H 1 - -/* Define to 1 if you have the `strchr' function. */ -#cmakedefine HAVE_STRCHR 1 - -/* Define to 1 if you have the `strdup' function. */ -#cmakedefine HAVE_STRDUP 1 - -/* Define to 1 if you have the `strerror' function. */ -#cmakedefine HAVE_STRERROR 1 - -/* Define to 1 if you have the `strerror_r' function. */ -#cmakedefine HAVE_STRERROR_R 1 - -/* Define to 1 if you have the `strftime' function. */ -#cmakedefine HAVE_STRFTIME 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRING_H 1 - -/* Define to 1 if you have the `strrchr' function. */ -#cmakedefine HAVE_STRRCHR 1 - -/* Define to 1 if `f_namemax' is a member of `struct statfs'. */ -#cmakedefine HAVE_STRUCT_STATFS_F_NAMEMAX 1 - -/* Define to 1 if `f_iosize' is a member of `struct statvfs'. */ -#cmakedefine HAVE_STRUCT_STATVFS_F_IOSIZE 1 - -/* Define to 1 if `st_birthtime' is a member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIME 1 - -/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 - -/* Define to 1 if `st_blksize' is a member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_BLKSIZE 1 - -/* Define to 1 if `st_flags' is a member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_FLAGS 1 - -/* Define to 1 if `st_mtimespec.tv_nsec' is a member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 - -/* Define to 1 if `st_mtime_n' is a member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_MTIME_N 1 - -/* Define to 1 if `st_mtime_usec' is a member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_MTIME_USEC 1 - -/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 - -/* Define to 1 if `st_umtime' is a member of `struct stat'. */ -#cmakedefine HAVE_STRUCT_STAT_ST_UMTIME 1 - -/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */ -#cmakedefine HAVE_STRUCT_TM_TM_GMTOFF 1 - -/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */ -#cmakedefine HAVE_STRUCT_TM___TM_GMTOFF 1 - -/* Define to 1 if you have the `symlink' function. */ -#cmakedefine HAVE_SYMLINK 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_ACL_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_CDEFS_H 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#cmakedefine HAVE_SYS_DIR_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_EA_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_EXTATTR_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_IOCTL_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_MKDEV_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_MOUNT_H 1 - -/* Define to 1 if you have the header file, and it defines `DIR'. - */ -#cmakedefine HAVE_SYS_NDIR_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_POLL_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_SELECT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STATFS_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STATVFS_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TIME_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_UTIME_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_UTSNAME_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_VFS_H 1 - -/* Define to 1 if you have that is POSIX.1 compatible. */ -#cmakedefine HAVE_SYS_WAIT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_XATTR_H 1 - -/* Define to 1 if you have the `timegm' function. */ -#cmakedefine HAVE_TIMEGM 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_TIME_H 1 - -/* Define to 1 if you have the `tzset' function. */ -#cmakedefine HAVE_TZSET 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_UNISTD_H 1 - -/* Define to 1 if you have the `unsetenv' function. */ -#cmakedefine HAVE_UNSETENV 1 - -/* Define to 1 if the system has the type `unsigned long long'. */ -#cmakedefine HAVE_UNSIGNED_LONG_LONG 1 - -/* Define to 1 if the system has the type `unsigned long long int'. */ -#cmakedefine HAVE_UNSIGNED_LONG_LONG_INT 1 - -/* Define to 1 if you have the `utime' function. */ -#cmakedefine HAVE_UTIME 1 - -/* Define to 1 if you have the `utimensat' function. */ -#cmakedefine HAVE_UTIMENSAT 1 - -/* Define to 1 if you have the `utimes' function. */ -#cmakedefine HAVE_UTIMES 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_UTIME_H 1 - -/* Define to 1 if you have the `vfork' function. */ -#cmakedefine HAVE_VFORK 1 - -/* Define to 1 if you have the `vprintf' function. */ -#cmakedefine HAVE_VPRINTF 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_WCHAR_H 1 - -/* Define to 1 if the system has the type `wchar_t'. */ -#cmakedefine HAVE_WCHAR_T 1 - -/* Define to 1 if you have the `wcrtomb' function. */ -#cmakedefine HAVE_WCRTOMB 1 - -/* Define to 1 if you have the `wcscmp' function. */ -#cmakedefine HAVE_WCSCMP 1 - -/* Define to 1 if you have the `wcscpy' function. */ -#cmakedefine HAVE_WCSCPY 1 - -/* Define to 1 if you have the `wcslen' function. */ -#cmakedefine HAVE_WCSLEN 1 - -/* Define to 1 if you have the `wctomb' function. */ -#cmakedefine HAVE_WCTOMB 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_WCTYPE_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_WINCRYPT_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_WINDOWS_H 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_WINIOCTL_H 1 - -/* Define to 1 if you have _CrtSetReportMode in */ -#cmakedefine HAVE__CrtSetReportMode 1 - -/* Define to 1 if you have the `wmemcmp' function. */ -#cmakedefine HAVE_WMEMCMP 1 - -/* Define to 1 if you have the `wmemcpy' function. */ -#cmakedefine HAVE_WMEMCPY 1 - -/* Define to 1 if you have a working EXT2_IOC_GETFLAGS */ -#cmakedefine HAVE_WORKING_EXT2_IOC_GETFLAGS 1 - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_ZLIB_H 1 - -/* Define to 1 if you have the `_ctime64_s' function. */ -#cmakedefine HAVE__CTIME64_S 1 - -/* Define to 1 if you have the `_fseeki64' function. */ -#cmakedefine HAVE__FSEEKI64 1 - -/* Define to 1 if you have the `_get_timezone' function. */ -#cmakedefine HAVE__GET_TIMEZONE 1 - -/* Define to 1 if you have the `_localtime64_s' function. */ -#cmakedefine HAVE__LOCALTIME64_S 1 - -/* Define to 1 if you have the `_mkgmtime64' function. */ -#cmakedefine HAVE__MKGMTIME64 1 - -/* Define as const if the declaration of iconv() needs const. */ -#define ICONV_CONST ${ICONV_CONST} - -/* Version number of libarchive as a single integer */ -#cmakedefine LIBARCHIVE_VERSION_NUMBER "${LIBARCHIVE_VERSION_NUMBER}" - -/* Version number of libarchive */ -#cmakedefine LIBARCHIVE_VERSION_STRING "${LIBARCHIVE_VERSION_STRING}" - -/* Define to 1 if `lstat' dereferences a symlink specified with a trailing - slash. */ -#cmakedefine LSTAT_FOLLOWS_SLASHED_SYMLINK 1 - -/* Define to 1 if `major', `minor', and `makedev' are declared in . - */ -#cmakedefine MAJOR_IN_MKDEV 1 - -/* Define to 1 if `major', `minor', and `makedev' are declared in - . */ -#cmakedefine MAJOR_IN_SYSMACROS 1 - -/* Define to 1 if your C compiler doesn't accept -c and -o together. */ -#cmakedefine NO_MINUS_C_MINUS_O 1 - -/* The size of `wchar_t', as computed by sizeof. */ -#cmakedefine SIZEOF_WCHAR_T ${SIZEOF_WCHAR_T} - -/* Define to 1 if strerror_r returns char *. */ -#cmakedefine STRERROR_R_CHAR_P 1 - -/* Define to 1 if you can safely include both and . */ -#cmakedefine TIME_WITH_SYS_TIME 1 - -/* - * Some platform requires a macro to use extension functions. - */ -#cmakedefine SAFE_TO_DEFINE_EXTENSIONS 1 -#ifdef SAFE_TO_DEFINE_EXTENSIONS -/* Enable extensions on AIX 3, Interix. */ -#ifndef _ALL_SOURCE -# define _ALL_SOURCE 1 -#endif -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 -#endif -/* Enable threading extensions on Solaris. */ -#ifndef _POSIX_PTHREAD_SEMANTICS -# define _POSIX_PTHREAD_SEMANTICS 1 -#endif -/* Enable extensions on HP NonStop. */ -#ifndef _TANDEM_SOURCE -# define _TANDEM_SOURCE 1 -#endif -/* Enable general extensions on Solaris. */ -#ifndef __EXTENSIONS__ -# define __EXTENSIONS__ 1 -#endif -#endif /* SAFE_TO_DEFINE_EXTENSIONS */ - -/* Version number of package */ -#cmakedefine VERSION "${VERSION}" - -/* Number of bits in a file offset, on hosts where this is settable. */ -#cmakedefine _FILE_OFFSET_BITS ${_FILE_OFFSET_BITS} - -/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ -#cmakedefine _LARGEFILE_SOURCE 1 - -/* Define for large files, on AIX-style hosts. */ -#cmakedefine _LARGE_FILES ${_LARGE_FILES} - -/* Define for Windows to use Windows 2000+ APIs. */ -#cmakedefine _WIN32_WINNT ${_WIN32_WINNT} -#cmakedefine WINVER ${WINVER} - -/* Define to empty if `const' does not conform to ANSI C. */ -#cmakedefine const ${const} - -/* Define to `int' if doesn't define. */ -#cmakedefine gid_t ${gid_t} - -/* Define to `unsigned long' if does not define. */ -#cmakedefine id_t ${id_t} - -/* Define to `int' if does not define. */ -#cmakedefine mode_t ${mode_t} - -/* Define to `long long' if does not define. */ -#cmakedefine off_t ${off_t} - -/* Define to `int' if doesn't define. */ -#cmakedefine pid_t ${pid_t} - -/* Define to `unsigned int' if does not define. */ -#cmakedefine size_t ${size_t} - -/* Define to `int' if does not define. */ -#cmakedefine ssize_t ${ssize_t} - -/* Define to `int' if doesn't define. */ -#cmakedefine uid_t ${uid_t} - -/* Define to `int' if does not define. */ -#cmakedefine intptr_t ${intptr_t} - -/* Define to `unsigned int' if does not define. */ -#cmakedefine uintptr_t ${uintptr_t} diff --git a/build/makerelease.sh b/build/makerelease.sh deleted file mode 100755 index f2869dfca5ed..000000000000 --- a/build/makerelease.sh +++ /dev/null @@ -1,58 +0,0 @@ -#!/bin/sh - -# -# This script exists primarily to document some of the -# steps needed when building an "official libarchive distribution". -# Feel free to hack it up as necessary to adjust to the peculiarities -# of a particular build environment. -# - -PATH=/usr/local/gnu-autotools/bin/:$PATH -export PATH - -# Start from one level above the build directory -if [ -f version ]; then - cd .. -fi - -if [ \! -f build/version ]; then - echo "Can't find source directory" - exit 1 -fi - -# BSD make's "OBJDIR" support freaks out the automake-generated -# Makefile. Effectively disable it. -export MAKEOBJDIRPREFIX=/junk - -set -ex - -# -# Scrub the local tree before running the build tests below. -# -/bin/sh build/clean.sh - -# -# Verify the CMake-generated build -# -mkdir -p _cmtest -cd _cmtest -cmake .. -make -make test -cd .. -rm -rf _cmtest -# TODO: Build distribution using cmake - -# -# Construct and verify the autoconf build system -# -export MAKE_LIBARCHIVE_RELEASE="1" -/bin/sh build/autogen.sh - -# Get the newest config.guess/config.sub from savannah.gnu.org -curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' > build/autoconf/config.guess -curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' > build/autoconf/config.sub - -./configure -make distcheck -make dist-zip diff --git a/build/pkgconfig/libarchive.pc.in b/build/pkgconfig/libarchive.pc.in deleted file mode 100644 index 95d715951774..000000000000 --- a/build/pkgconfig/libarchive.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: libarchive -Description: library that can create and read several streaming archive formats -Version: @VERSION@ -Cflags: -I${includedir} -Libs: -L${libdir} -larchive -Libs.private: @LIBS@ diff --git a/build/utils/gen_archive_string_composition_h.sh b/build/utils/gen_archive_string_composition_h.sh deleted file mode 100755 index 925de5c85e78..000000000000 --- a/build/utils/gen_archive_string_composition_h.sh +++ /dev/null @@ -1,455 +0,0 @@ -#!/bin/sh -# -# This needs http://unicode.org/Public/6.0.0/ucd/UnicodeData.txt -# -inputfile="$1" # Expect UnicodeData.txt -outfile=archive_string_composition.h -pickout=/tmp/mk_unicode_composition_tbl$$.awk -pickout2=/tmp/mk_unicode_composition_tbl2$$.awk -#nfdtmp=/tmp/mk_unicode_decomposition_tmp$$.txt -nfdtmp="nfdtmpx" -################################################################################# -# -# Append the file header of "archive_string_composition.h" -# -################################################################################# -append_copyright() -{ -cat > ${outfile} < ${pickout} <>8) <= 0x%X && u_decomposable_blocks[(uc)>>8])\\n", highnum - printf "static const char u_decomposable_blocks[0x%X+1] = {\\n\\t", highnum - # - # Output blockmap - for (i = 0; i <= highnum; i++) { - if (i != 0 && i % 32 == 0) - printf "\\n\\t" - # Additionally Hangul[11XX(17), AC00(172) - D7FF(215)] is decomposable. - if (blockmap[i] || i == 17 || (i >= 172 && i <= 215)) - printf "1," - else - printf "0," - } - printf "\\n};\\n\\n" - # - # Output a macro to get a canonical combining class. - # - print "/* Get Canonical Combining Class(CCC). */" - printf "#define CCC(uc)\\t\\\\\n" - printf "\\t(((uc) > 0x%s)?0:\\\\\\n", max - printf "\\tccc_val[ccc_val_index[ccc_index[(uc)>>8]][((uc)>>4)&0x0F]][(uc)&0x0F])\\n" - print "" - # - # Output a canonical combining class value table. - # - midcnt = 0 - printf "/* The table of the value of Canonical Cimbining Class */\\n" - print "static const unsigned char ccc_val[][16] = {" - print " /* idx=0: XXXX0 - XXXXF */" - print " { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }," - for (h = 0; h <= highnum; h++) { - if (!blockmap[h]) - continue; - for (m = 0; m < 16; m++) { - if (!xx_blockmap[h, m]) - continue; - midcnt++ - printf " /* idx=%d: %03X%1X0 - %03X%1XF */\\n {", midcnt, h, m, h, m - for (l = 0; l < 15; l++) { - printf "%d, ", xxx_blockmap[h, m, l] - } - printf "%d },\n", xxx_blockmap[h, m, 15] - } - } - printf "};\n" - # - # Output the index table of the canonical combining class value table. - # - cnt = 0 - midcnt = 0 - printf "\\n/* The index table to ccc_val[*][16] */\\n" - print "static const unsigned char ccc_val_index[][16] = {" - print " /* idx=0: XXX00 - XXXFF */" - print " { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }," - for (h = 0; h <= highnum; h++) { - if (!blockmap[h]) - continue; - cnt++ - printf " /* idx=%d: %03X00 - %03XFF */\\n {", cnt, h, h - for (m = 0; m < 16; m++) { - if (m != 0) - printf "," - if (xx_blockmap[h, m]) { - midcnt++ - printf "%2d", midcnt - } else - printf " 0" - } - printf " },\\n" - } - printf "};\\n" - # - # Output the index table to the index table of the canonical combining - # class value table. - # - printf "\\n/* The index table to ccc_val_index[*][16] */\\n" - printf "static const unsigned char ccc_index[] = {\\n ", h - cnt = 0 - for (h = 0; h <= highnum; h++) { - if (h != 0 && h % 24 == 0) - printf "\\n " - if (blockmap[h]) { - cnt++; - printf "%2d,", cnt - } else - printf " 0," - } - print "};" - print "" -} -# -# -function hextoi(hex) -{ - dec = 0 - for (i=0; i < length(hex); i++) { - x = substr(hex, i+1, 1) - if (x ~/[0-9]/) - dec = dec * 16 + x; - else if (x == "A") - dec = dec * 16 + 10; - else if (x == "B") - dec = dec * 16 + 11; - else if (x == "C") - dec = dec * 16 + 12; - else if (x == "D") - dec = dec * 16 + 13; - else if (x == "E") - dec = dec * 16 + 14; - else if (x == "F") - dec = dec * 16 + 15; - } - return dec -} -# -# Collect Canonical Combining Class values. -# -\$4 ~/^[0-9A-F]+$/ { - if (\$4 !~/^0$/) { - if (min == "") { - min = \$1 - } - max = \$1 - high = substr(\$1, 1, length(\$1) -2) - highnum = hextoi(high) - mid = substr(\$1, length(\$1) -1, 1) - midnum = hextoi(mid) - low = substr(\$1, length(\$1), 1) - lownum = hextoi(low) - blockmap[highnum] = 1 - xx_blockmap[highnum, midnum] = 1 - xxx_blockmap[highnum, midnum, lownum] = \$4 - } -} -# -# Following code points are not decomposed in MAC OS. -# U+2000 - U+2FFF -# U+F900 - U+FAFF -# U+2F800 - U+2FAFF -# -#\$1 ~/^2[0-9A-F][0-9A-F][0-9A-F]\$/ { -# next -#} -#\$1 ~/^F[9A][0-9A-F][0-9A-F]\$/ { -# next -#} -#\$1 ~/^2F[89A][0-9A-F][0-9A-F]\$/ { -# next -#} -# -# Exclusion code points specified by -# http://unicode.org/Public/6.0.0/ucd/CompositionExclusions.txt -## -# 1. Script Specifices -## -\$1 ~/^095[89ABCDEF]\$/ { - next -} -\$1 ~/^09D[CDF]\$/ { - next -} -\$1 ~/^0A3[36]\$/ { - next -} -\$1 ~/^0A5[9ABE]\$/ { - next -} -\$1 ~/^0B5[CD]\$/ { - next -} -\$1 ~/^0F4[3D]\$/ { - next -} -\$1 ~/^0F5[27C]\$/ { - next -} -\$1 ~/^0F69\$/ { - next -} -\$1 ~/^0F7[68]\$/ { - next -} -\$1 ~/^0F9[3D]\$/ { - next -} -\$1 ~/^0FA[27C]\$/ { - next -} -\$1 ~/^0FB9\$/ { - next -} -\$1 ~/^FB1[DF]\$/ { - next -} -\$1 ~/^FB2[ABCDEF]\$/ { - next -} -\$1 ~/^FB3[012345689ABCE]\$/ { - next -} -\$1 ~/^FB4[01346789ABCDE]\$/ { - next -} -## -# 2. Post Composition Version precomposed characters -## -\$1 ~/^2ADC\$/ { - next -} -\$1 ~/^1D15[EF]\$/ { - next -} -\$1 ~/^1D16[01234]\$/ { - next -} -\$1 ~/^1D1B[BCDEF]\$/ { - next -} -\$1 ~/^1D1C0\$/ { - next -} -## -# 3. Singleton Decompositions -## -\$1 ~/^034[01]\$/ { - next -} -\$1 ~/^037[4E]\$/ { - next -} -\$1 ~/^0387\$/ { - next -} -\$1 ~/^1F7[13579BD]\$/ { - next -} -\$1 ~/^1FB[BE]\$/ { - next -} -\$1 ~/^1FC[9B]\$/ { - next -} -\$1 ~/^1FD[3B]\$/ { - next -} -\$1 ~/^1FE[3BEF]\$/ { - next -} -\$1 ~/^1FF[9BD]\$/ { - next -} -\$1 ~/^200[01]\$/ { - next -} -\$1 ~/^212[6AB]\$/ { - next -} -\$1 ~/^232[9A]\$/ { - next -} -\$1 ~/^F9[0-9A-F][0-9A-F]\$/ { - next -} -\$1 ~/^FA0[0-9A-D]\$/ { - next -} -\$1 ~/^FA1[025-9A-E]\$/ { - next -} -\$1 ~/^FA2[0256A-D]\$/ { - next -} -\$1 ~/^FA[3-5][0-9A-F]\$/ { - next -} -\$1 ~/^FA6[0-9A-D]\$/ { - next -} -\$1 ~/^FA[7-9A-C][0-9A-F]\$/ { - next -} -\$1 ~/^FAD[0-9]\$/ { - next -} -\$1 ~/^2F[89][0-9A-F][0-9A-F]\$/ { - next -} -\$1 ~/^2FA0[0-9A-F]\$/ { - next -} -\$1 ~/^2FA1[0-9A-D]\$/ { - next -} -## -# 4. Non-Starter Decompositions -## -\$1 ~/^0344\$/ { - next -} -\$1 ~/^0F7[35]\$/ { - next -} -\$1 ~/^0F81\$/ { - next -} -# -# Output combinations for NFD ==> NFC. -# -\$6 ~/^[0-9A-F]+ [0-9A-F]+\$/ { - split(\$6, cp, " ") - if (length(\$1) == 4) - print "0"cp[1], "0"cp[2], "0"\$1 | cmd - else - print cp[1], cp[2], \$1 | cmd - # NFC ==> NFD table. - if (length(\$1) == 4) - print "0"\$1, "0"cp[1], "0"cp[2] >>nfdtbl - else - print \$1, cp[1], cp[2] >>nfdtbl -} -AWK_END -################################################################################# -# awk script -# -################################################################################# -cat > ${pickout2} <> ${outfile} -awk -f ${pickout2} ${nfdtmp} >> ${outfile} -echo "#endif /* ARCHIVE_STRING_COMPOSITION_H_INCLUDED */" >> ${outfile} -echo "" >> ${outfile} -# -# Remove awk the script. -rm ${pickout} -rm ${pickout2} -rm ${nfdtmp} diff --git a/build/version b/build/version deleted file mode 100644 index 937b126a2ede..000000000000 --- a/build/version +++ /dev/null @@ -1 +0,0 @@ -3001002 diff --git a/configure.ac b/configure.ac deleted file mode 100644 index 73944d3e0754..000000000000 --- a/configure.ac +++ /dev/null @@ -1,788 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -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.1.2]) -m4_define([LIBARCHIVE_VERSION_N],[3001002]) - -dnl bsdtar and bsdcpio versioning tracks libarchive -m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) -m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S()) - -AC_PREREQ(2.65) - -# -# Now starts the "real" configure script. -# - -AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[libarchive-discuss@googlegroups.com]) -# Make sure the srcdir contains "libarchive" directory -AC_CONFIG_SRCDIR([libarchive]) -# Use auxiliary subscripts from this subdirectory (cleans up root) -AC_CONFIG_AUX_DIR([build/autoconf]) -# M4 scripts -AC_CONFIG_MACRO_DIR([build/autoconf]) -# Must follow AC_CONFIG macros above... -AM_INIT_AUTOMAKE() -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -# Libtool's "interface version" can be computed from the libarchive version. - -# Libtool interface version bumps on any API change, so increments -# whenever libarchive minor version does. -ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 )) -# Libarchive 2.7 == libtool interface 9 = 2 + 7 -# Libarchive 2.8 == libtool interface 10 = 2 + 8 -# Libarchive 2.9 == libtool interface 11 = 2 + 8 -# Libarchive 3.0 == libtool interface 12 -# Libarchive 3.1 == libtool interface 13 -ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))` -# Libarchive revision is bumped on any source change === libtool revision -ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 )) -# Libarchive minor is bumped on any interface addition === libtool age -ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR - -# Stick the version numbers into config.h -AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()", - [Version number of libarchive]) -AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()", - [Version number of libarchive as a single integer]) -AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()", - [Version number of bsdcpio]) -AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()", - [Version number of bsdtar]) - -# The shell variables here must be the same as the AC_SUBST() variables -# below, but the shell variable names apparently cannot be the same as -# the m4 macro names above. Why? Ask autoconf. -BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S() -BSDTAR_VERSION_STRING=BSDTAR_VERSION_S() -LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S() -LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N() - -# Substitute the above version numbers into the various files below. -# Yes, I believe this is the fourth time we define what are essentially -# the same symbols. Why? Ask autoconf. -AC_SUBST(ARCHIVE_LIBTOOL_VERSION) -AC_SUBST(BSDCPIO_VERSION_STRING) -AC_SUBST(BSDTAR_VERSION_STRING) -AC_SUBST(LIBARCHIVE_VERSION_STRING) -AC_SUBST(LIBARCHIVE_VERSION_NUMBER) - -AC_CONFIG_HEADERS([config.h]) -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([build/pkgconfig/libarchive.pc]) - -# Check for host type -AC_CANONICAL_HOST - -dnl Compilation on mingw and Cygwin needs special Makefile rules -inc_windows_files=no -inc_cygwin_files=no -case "$host_os" in - *mingw* ) inc_windows_files=yes ;; - *cygwin*) inc_cygwin_files=yes ;; -esac -AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes]) -AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes]) - -dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc) -PLATFORMCPPFLAGS= -case "$host_os" in - *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;; -esac -AC_SUBST(PLATFORMCPPFLAGS) - -# Checks for programs. -AC_PROG_CC -AM_PROG_CC_C_O -AC_USE_SYSTEM_EXTENSIONS -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL -AC_CHECK_TOOL([STRIP],[strip]) - -# -# Options for building bsdtar. -# -# Default is to build bsdtar, but allow people to override that. -# -AC_ARG_ENABLE([bsdtar], - [AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)]) - AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar]) - AS_HELP_STRING([--enable-bsdtar=shared], [force dynamic build of bsdtar]) -AS_HELP_STRING([--disable-bsdtar], [disable build of bsdtar])], - [], [enable_bsdtar=yes]) - -case "$enable_bsdtar" in -yes) - if test "$enable_static" = "no"; then - static_bsdtar=no - else - static_bsdtar=yes - fi - build_bsdtar=yes - ;; -dynamic|shared) - if test "$enable_shared" = "no"; then - AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive]) - fi - build_bsdtar=yes - static_bsdtar=no - ;; -static) - build_bsdtar=yes - static_bsdtar=yes - ;; -no) - build_bsdtar=no - static_bsdtar=no - ;; -*) - AC_MSG_FAILURE([Unsupported value for --enable-bsdtar]) - ;; -esac - -AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ]) -AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ]) - -# -# Options for building bsdcpio. -# -# Default is not to build bsdcpio, but that can be overridden. -# -AC_ARG_ENABLE([bsdcpio], - [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)]) - AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio]) - AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio]) -AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])], - [], [enable_bsdcpio=yes]) - -case "$enable_bsdcpio" in -yes) - if test "$enable_static" = "no"; then - static_bsdcpio=no - else - static_bsdcpio=yes - fi - build_bsdcpio=yes - ;; -dynamic|shared) - if test "$enabled_shared" = "no"; then - AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive]) - fi - build_bsdcpio=yes - ;; -static) - build_bsdcpio=yes - static_bsdcpio=yes - ;; -no) - build_bsdcpio=no - static_bsdcpio=no - ;; -*) - AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio]) - ;; -esac - -AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ]) -AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ]) - -# Set up defines needed before including any headers -case $host in - *mingw* | *cygwin* ) - AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.]) - AC_DEFINE([WINVER], 0x0500, [Define to '0x0500' for Windows 2000 APIs.]) - ;; -esac - -# Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_SYS_WAIT -AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h copyfile.h ctype.h]) -AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h grp.h]) - -AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable], - [ac_cv_have_decl_EXT2_IOC_GETFLAGS], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include -@%:@include ], - [int x = EXT2_IOC_GETFLAGS])], - [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes])], - [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [no])])]) - -AS_VAR_IF([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes], - [AC_DEFINE_UNQUOTED([HAVE_WORKING_EXT2_IOC_GETFLAGS], [1], - [Define to 1 if you have a working EXT2_IOC_GETFLAGS])]) - -AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h]) -AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h linux/types.h]) -AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.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/extattr.h]) -AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h]) -AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/statfs.h sys/statvfs.h]) -AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h]) -AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h]) -AC_CHECK_HEADERS([windows.h]) -# check windows.h first; the other headers require it. -AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[], -[[#ifdef HAVE_WINDOWS_H -# include -#endif -]]) - -# Checks for libraries. -AC_ARG_WITH([zlib], - AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib])) - -if test "x$with_zlib" != "xno"; then - AC_CHECK_HEADERS([zlib.h]) - AC_CHECK_LIB(z,inflate) -fi - -AC_ARG_WITH([bz2lib], - AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib])) - -if test "x$with_bz2lib" != "xno"; then - AC_CHECK_HEADERS([bzlib.h]) - case "$host_os" in - *mingw* | *cygwin*) - dnl AC_CHECK_LIB cannot be used on the Windows port of libbz2, therefore - dnl use AC_LINK_IFELSE. - AC_MSG_CHECKING([for BZ2_bzDecompressInit in -lbz2]) - old_LIBS="$LIBS" - LIBS="-lbz2 $LIBS" - AC_LINK_IFELSE( - [AC_LANG_SOURCE(#include - int main() { return BZ2_bzDecompressInit(NULL, 0, 0); })], - [ac_cv_lib_bz2_BZ2_bzDecompressInit=yes], - [ac_cv_lib_bz2_BZ2_bzDecompressInit=no]) - LIBS="$old_LIBS" - AC_MSG_RESULT($ac_cv_lib_bz2_BZ2_bzDecompressInit) - if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then - AC_DEFINE([HAVE_LIBBZ2], [1], [Define to 1 if you have the `bz2' library (-lbz2).]) - LIBS="-lbz2 $LIBS" - fi - ;; - *) - AC_CHECK_LIB(bz2,BZ2_bzDecompressInit) - ;; - esac -fi - -AC_ARG_WITH([lzmadec], - AS_HELP_STRING([--without-lzmadec], [Don't build support for lzma through lzmadec])) - -if test "x$with_lzmadec" != "xno"; then - AC_CHECK_HEADERS([lzmadec.h]) - AC_CHECK_LIB(lzmadec,lzmadec_decode) -fi - -AC_ARG_WITH([iconv], - AS_HELP_STRING([--without-iconv], [Don't try to link against iconv])) - -if test "x$with_iconv" != "xno"; then - AM_ICONV - AC_CHECK_HEADERS([iconv.h],[],[],[#include ]) - if test "x$am_cv_func_iconv" = "xyes"; then - AC_CHECK_HEADERS([localcharset.h]) - am_save_LIBS="$LIBS" - LIBS="${LIBS} ${LIBICONV}" - AC_CHECK_FUNCS([locale_charset]) - LIBS="${am_save_LIBS}" - if test "x$ac_cv_func_locale_charset" != "xyes"; then - # If locale_charset() is not in libiconv, we have to find libcharset. - AC_CHECK_LIB(charset,locale_charset) - fi - fi -fi - -AC_ARG_WITH([lzma], - AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma])) - -if test "x$with_lzma" != "xno"; then - AC_CHECK_HEADERS([lzma.h]) - AC_CHECK_LIB(lzma,lzma_stream_decoder) -fi - -AC_ARG_WITH([lzo2], - AS_HELP_STRING([--without-lzo2], [Don't build support for lzop through liblzo2])) - -if test "x$with_lzo2" != "xno"; then - AC_CHECK_HEADERS([lzo/lzoconf.h lzo/lzo1x.h]) - AC_CHECK_LIB(lzo2,lzo1x_decompress_safe) -fi - -AC_ARG_WITH([nettle], - AS_HELP_STRING([--without-nettle], [Don't build with crypto support from Nettle])) -AC_ARG_WITH([openssl], - AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl])) -case "$host_os" in - *darwin* ) with_openssl=no ;; -esac - -AC_ARG_WITH([xml2], - AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2])) -AC_ARG_WITH([expat], - AS_HELP_STRING([--without-expat], [Don't build support for xar through expat])) - -if test "x$with_xml2" != "xno"; then - AC_PATH_PROG([XML2_CONFIG], [xml2-config],, [${PATH}]) - if test "x$XML2_CONFIG" != "x"; then - CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`" - LIBS="${LIBS} `${XML2_CONFIG} --libs`" - AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library)) - else - AC_CHECK_LIB(xml2,xmlInitParser) - fi - AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h]) -fi -if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then - if test "x$with_expat" != "xno"; then - AC_CHECK_HEADERS([expat.h]) - AC_CHECK_LIB(expat,XML_ParserCreate) - fi -fi - -AC_ARG_ENABLE([posix-regex-lib], - [AS_HELP_STRING([--enable-posix-regex-lib], - [choose what library to use for POSIX regular expression support (default: auto)]) - AS_HELP_STRING([--enable-posix-regex-lib=libc], [use libc POSIX regular expression support]) - AS_HELP_STRING([--enable-posix-regex-lib=libregex], [use libregex POSIX regular expression support]) - AS_HELP_STRING([--enable-posix-regex-lib=libpcreposix], [use libpcreposix POSIX regular expression support]) - AS_HELP_STRING([--disable-posix-regex-lib], [don't enable POSIX regular expression support])], - [], [enable_posix_regex_lib=auto]) - -posix_regex_lib_found= -if test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libc" || test "$enable_posix_regex_lib" = "libregex"; then - AC_CHECK_HEADERS([regex.h]) - if test "x$ac_cv_header_regex_h" != "xno"; then - AC_CHECK_FUNC(regcomp) - if test "x$ac_cv_func_regcomp" = xyes; then - posix_regex_lib_found=1 - else - AC_CHECK_LIB(regex,regcomp) - if test "x$ac_cv_lib_regex_regcomp" = xyes; then - posix_regex_lib_found=1 - fi - fi - fi -fi -if test -z $posix_regex_lib_found && (test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libpcreposix"); then - AC_CHECK_HEADERS([pcreposix.h]) - AC_CHECK_LIB(pcreposix,regcomp) - if test "x$ac_cv_lib_pcreposix_regcomp" != xyes; then - AC_MSG_NOTICE(trying libpcreposix check again with libpcre) - unset ac_cv_lib_pcreposix_regcomp - AC_CHECK_LIB(pcre,pcre_exec) - AC_CHECK_LIB(pcreposix,regcomp) - if test "x$ac_cv_lib_pcre_pcre_exec" = xyes && test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then - AC_MSG_CHECKING(if PCRE_STATIC needs to be defined) - AC_LINK_IFELSE( - [AC_LANG_SOURCE(#include - int main() { return regcomp(NULL, NULL, 0); })], - [without_pcre_static=yes], - [without_pcre_static=no]) - AC_LINK_IFELSE( - [AC_LANG_SOURCE(#define PCRE_STATIC - #include - int main() { return regcomp(NULL, NULL, 0); })], - [with_pcre_static=yes], - [with_pcre_static=no]) - if test "x$without_pcre_static" != xyes && test "x$with_pcre_static" = xyes; then - AC_MSG_RESULT(yes) - AC_DEFINE([PCRE_STATIC], [1], [Define to 1 if PCRE_STATIC needs to be defined.]) - elif test "x$without_pcre_static" = xyes || test "x$with_pcre_static" = xyes; then - AC_MSG_RESULT(no) - fi - posix_regex_lib_found=1 - fi - else - posix_regex_lib_found=1 - fi -fi - -# TODO: Give the user the option of using a pre-existing system -# libarchive. This will define HAVE_LIBARCHIVE which will cause -# bsdtar_platform.h to use #include <...> for the libarchive headers. -# Need to include Makefile.am magic to link against system -# -larchive in that case. -#AC_CHECK_LIB(archive,archive_version) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -# AC_TYPE_UID_T defaults to "int", which is incorrect for MinGW -# and MSVC. Use a customized version. -la_TYPE_UID_T -AC_TYPE_MODE_T -# AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on -# most systems... default to "long long" instead. -AC_CHECK_TYPE(off_t, [long long]) -AC_TYPE_SIZE_T -AC_CHECK_TYPE(id_t, [unsigned long]) -AC_CHECK_TYPE(uintptr_t, [unsigned int]) - -# Check for tm_gmtoff in struct tm -AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,, -[ -#include -]) - -# Check for f_namemax in struct statfs -AC_CHECK_MEMBERS([struct statfs.f_namemax],,, -[ -#include -#include -]) - -# Check for f_iosize in struct statvfs -AC_CHECK_MEMBERS([struct statvfs.f_iosize],,, -[ -#include -]) - -# Check for birthtime in struct stat -AC_CHECK_MEMBERS([struct stat.st_birthtime]) - -# Check for high-resolution timestamps in struct stat -AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec]) -AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec]) -AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) -AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX -AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64 -AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd -# Check for block size support in struct stat -AC_CHECK_MEMBERS([struct stat.st_blksize]) -# Check for st_flags in struct stat (BSD fflags) -AC_CHECK_MEMBERS([struct stat.st_flags]) - -# If you have uintmax_t, we assume printf supports %ju -# If you have unsigned long long, we assume printf supports %llu -# TODO: Check for %ju and %llu support directly. -AC_CHECK_TYPES([uintmax_t, unsigned long long]) - -# We use C99-style integer types -# Declare them if the local platform doesn't already do so. -AC_TYPE_INTMAX_T -AC_TYPE_UINTMAX_T -AC_TYPE_INT64_T -AC_TYPE_UINT64_T -AC_TYPE_INT32_T -AC_TYPE_UINT32_T -AC_TYPE_INT16_T -AC_TYPE_UINT16_T -AC_TYPE_UINT8_T - -AC_CHECK_DECLS([SIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) - -AC_CHECK_DECL([SSIZE_MAX], - [AC_DEFINE(HAVE_DECL_SSIZE_MAX, 1, [Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you don't.])], - [], - [#include ]) - -AC_CHECK_DECL([EFTYPE], - [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])], - [], - [#include ]) -AC_CHECK_DECL([EILSEQ], - [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])], - [], - [#include ]) -AC_CHECK_TYPE([wchar_t], - [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl - AC_CHECK_SIZEOF([wchar_t])], - []) - -AC_HEADER_TIME - -# Checks for library functions. -AC_PROG_GCC_TRADITIONAL -AC_HEADER_MAJOR -AC_FUNC_FSEEKO -AC_FUNC_MEMCMP -AC_FUNC_LSTAT -AC_FUNC_STAT -AC_FUNC_STRERROR_R -AC_FUNC_STRFTIME -AC_FUNC_VPRINTF -# check for: -# CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES) -# To avoid necessity for including windows.h or special forward declaration -# workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *' -AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *]) -AC_CHECK_FUNCS([chflags chown chroot ctime_r dirfd]) -AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fork]) -AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate]) -AC_CHECK_FUNCS([futimens futimes futimesat]) -AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r]) -AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r]) -AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat lutimes]) -AC_CHECK_FUNCS([mbrtowc memmove memset]) -AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp]) -AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat]) -AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs]) -AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm]) -AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork]) -AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy]) -AC_CHECK_FUNCS([_ctime64_s _fseeki64]) -AC_CHECK_FUNCS([_get_timezone _localtime64_s _mkgmtime64]) -# detects cygwin-1.7, as opposed to older versions -AC_CHECK_FUNCS([cygwin_conv_path]) - -# There are several variants of readdir_r around; we only -# accept the POSIX-compliant version. -AC_COMPILE_IFELSE( - [AC_LANG_PROGRAM([[#include ]], - [[DIR *dir; struct dirent e, *r; - return(readdir_r(dir, &e, &r));]])], - [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])] -) - -# FreeBSD's nl_langinfo supports an option to specify whether the -# current locale uses month/day or day/month ordering. It makes the -# output a little prettier... -AC_CHECK_DECL([D_MD_ORDER], -[AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])], -[], -[#if HAVE_LANGINFO_H -#include -#endif -]) - -# Check for dirent.d_namlen field explicitly -# (This is a bit more straightforward than, if not quite as portable as, -# the recipe given by the autoconf maintainers.) -AC_CHECK_MEMBER(struct dirent.d_namlen,,, -[#if HAVE_DIRENT_H -#include -#endif -]) - -# Check for Extended Attributes support -AC_ARG_ENABLE([xattr], - AS_HELP_STRING([--disable-xattr], - [Enable Extended Attributes support (default: check)])) - -if test "x$enable_xattr" != "xno"; then - AC_CHECK_HEADERS([attr/xattr.h]) - AC_CHECK_HEADERS([sys/xattr.h sys/ea.h]) - AC_CHECK_LIB(attr,setxattr) - AC_CHECK_FUNCS([extattr_get_file extattr_list_file]) - AC_CHECK_FUNCS([extattr_set_fd extattr_set_file]) - AC_CHECK_FUNCS([fgetxattr flistxattr fsetxattr getxattr]) - AC_CHECK_FUNCS([lgetxattr listxattr llistxattr lsetxattr]) - AC_CHECK_FUNCS([fgetea flistea fsetea getea]) - AC_CHECK_FUNCS([lgetea listea llistea lsetea]) - AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include -#include -]) -fi - -# Check for ACL support -# -# The ACL support in libarchive is written against the POSIX1e draft, -# which was never officially approved and varies quite a bit across -# platforms. Worse, some systems have completely non-POSIX acl functions, -# which makes the following checks rather more complex than I would like. -# -AC_ARG_ENABLE([acl], - AS_HELP_STRING([--disable-acl], - [Enable ACL support (default: check)])) - -if test "x$enable_acl" != "xno"; then - AC_CHECK_HEADERS([sys/acl.h]) - AC_CHECK_LIB([acl],[acl_get_file]) - AC_CHECK_FUNCS([acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file]) - - AC_CHECK_TYPES(acl_permset_t,,, - [#if HAVE_SYS_TYPES_H - #include - #endif - #if HAVE_SYS_ACL_H - #include - #endif - ]) - - # The "acl_get_perm()" function was omitted from the POSIX draft. - # (It's a pretty obvious oversight; otherwise, there's no way to - # test for specific permissions in a permset.) Linux uses the obvious - # name, FreeBSD adds _np to mark it as "non-Posix extension." - # Test for both as a double-check that we really have POSIX-style ACL support. - AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm acl_get_link acl_get_link_np,,, - [#if HAVE_SYS_TYPES_H - #include - #endif - #if HAVE_SYS_ACL_H - #include - #endif - ]) - - # MacOS has an acl.h that isn't POSIX. It can be detected by - # checking for ACL_USER - AC_CHECK_DECL([ACL_USER], - [AC_DEFINE(HAVE_ACL_USER, 1, [True for systems with POSIX ACL support])], - [], - [#include ]) -fi - -# Additional requirements -AC_SYS_LARGEFILE - -dnl NOTE: Crypto checks must run last. -AC_DEFUN([CRYPTO_CHECK], [ - if test "$found_$1" != yes; then - saved_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" - touch "check_crypto_md.h" - AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_$2]) - AC_LINK_IFELSE([AC_LANG_SOURCE([ -#define ARCHIVE_$1_COMPILE_TEST -#define ARCHIVE_CRYPTO_$1_$2 -#define PLATFORM_CONFIG_H "check_crypto_md.h" - -$(cat "$srcdir/libarchive/archive_crypto.c") - -int -main(int argc, char **argv) -{ - archive_$3_ctx ctx; - archive_$3_init(&ctx); - archive_$3_update(&ctx, *argv, argc); - archive_$3_final(&ctx, NULL); - return 0; -} -])], - [ AC_MSG_RESULT([yes]) - found_$1=yes - found_$2=yes - AC_DEFINE(ARCHIVE_CRYPTO_$1_$2, 1, [ $1 via ARCHIVE_CRYPTO_$1_$2 supported.]) - ], - [ AC_MSG_RESULT([no])]) - CPPFLAGS="$saved_CPPFLAGS" - rm "check_crypto_md.h" - fi -]) - -AC_DEFUN([CRYPTO_CHECK_WIN], [ - if test "$found_$1" != yes; then - AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_WIN]) - AC_LINK_IFELSE([AC_LANG_SOURCE([ -#define ARCHIVE_$1_COMPILE_TEST -#include -#include - -int -main(int argc, char **argv) -{ - (void)argc; - (void)argv; - - return ($2); -} -])], - [ AC_MSG_RESULT([yes]) - found_$1=yes - found_WIN=yes - AC_DEFINE(ARCHIVE_CRYPTO_$1_WIN, 1, [ $1 via ARCHIVE_CRYPTO_$1_WIN supported.]) - ], - [ AC_MSG_RESULT([no])]) - fi -]) - -case "$host_os" in - *mingw* | *cygwin*) - ;; - *) - CRYPTO_CHECK(MD5, LIBC, md5) - CRYPTO_CHECK(MD5, LIBSYSTEM, md5) - CRYPTO_CHECK(RMD160, LIBC, rmd160) - CRYPTO_CHECK(SHA1, LIBC, sha1) - CRYPTO_CHECK(SHA1, LIBSYSTEM, sha1) - CRYPTO_CHECK(SHA256, LIBC, sha256) - CRYPTO_CHECK(SHA256, LIBC2, sha256) - CRYPTO_CHECK(SHA256, LIBC3, sha256) - CRYPTO_CHECK(SHA256, LIBSYSTEM, sha256) - CRYPTO_CHECK(SHA384, LIBC, sha384) - CRYPTO_CHECK(SHA384, LIBC2, sha384) - CRYPTO_CHECK(SHA384, LIBC3, sha384) - CRYPTO_CHECK(SHA384, LIBSYSTEM, sha384) - CRYPTO_CHECK(SHA512, LIBC, sha512) - CRYPTO_CHECK(SHA512, LIBC2, sha512) - CRYPTO_CHECK(SHA512, LIBC3, sha512) - CRYPTO_CHECK(SHA512, LIBSYSTEM, sha512) - ;; -esac - -if test "x$with_nettle" != "xno"; then - AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h]) - saved_LIBS=$LIBS - AC_CHECK_LIB(nettle,main) - CRYPTO_CHECK(MD5, NETTLE, md5) - CRYPTO_CHECK(RMD160, NETTLE, rmd160) - CRYPTO_CHECK(SHA1, NETTLE, sha1) - CRYPTO_CHECK(SHA256, NETTLE, sha256) - CRYPTO_CHECK(SHA384, NETTLE, sha384) - CRYPTO_CHECK(SHA512, NETTLE, sha512) - if test "x$found_NETTLE" != "xyes"; then - LIBS=$saved_LIBS - fi -fi -if test "x$with_openssl" != "xno"; then - AC_CHECK_HEADERS([openssl/evp.h]) - saved_LIBS=$LIBS - case "$host_os" in - *mingw* | *cygwin*) - case "$host_cpu" in - x86_64) - AC_CHECK_LIB(eay64,main) - if test "x$ac_cv_lib_eay64_main" != "xyes"; then - AC_CHECK_LIB(eay32,main) - fi - ;; - *) - AC_CHECK_LIB(eay32,main) - ;; - esac - ;; - *) - AC_CHECK_LIB(crypto,main) - ;; - esac - CRYPTO_CHECK(MD5, OPENSSL, md5) - CRYPTO_CHECK(RMD160, OPENSSL, rmd160) - CRYPTO_CHECK(SHA1, OPENSSL, sha1) - CRYPTO_CHECK(SHA256, OPENSSL, sha256) - CRYPTO_CHECK(SHA384, OPENSSL, sha384) - CRYPTO_CHECK(SHA512, OPENSSL, sha512) - if test "x$found_OPENSSL" != "xyes"; then - LIBS=$saved_LIBS - fi -fi - -# Probe libmd AFTER OpenSSL/libcrypto. -# The two are incompatible and OpenSSL is more complete. -AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h]) -saved_LIBS=$LIBS -AC_CHECK_LIB(md,main) -CRYPTO_CHECK(MD5, LIBMD, md5) -CRYPTO_CHECK(RMD160, LIBMD, rmd160) -CRYPTO_CHECK(SHA1, LIBMD, sha1) -CRYPTO_CHECK(SHA256, LIBMD, sha256) -CRYPTO_CHECK(SHA512, LIBMD, sha512) -if test "x$found_LIBMD" != "xyes"; then - LIBS=$saved_LIBS -fi - -case "$host_os" in - *mingw* | *cygwin*) - CRYPTO_CHECK_WIN(MD5, CALG_MD5) - CRYPTO_CHECK_WIN(SHA1, CALG_SHA1) - CRYPTO_CHECK_WIN(SHA256, CALG_SHA_256) - CRYPTO_CHECK_WIN(SHA384, CALG_SHA_384) - CRYPTO_CHECK_WIN(SHA512, CALG_SHA_512) - ;; -esac - -AC_OUTPUT diff --git a/contrib/README b/contrib/README deleted file mode 100644 index 8ad352a30204..000000000000 --- a/contrib/README +++ /dev/null @@ -1,59 +0,0 @@ -Many people have graciously sent me configuration -files, small programs that use libarchive, and other -useful and interesting tidbits. - -I do not support or use any of these; but if you can use them, enjoy! - -====================================================================== - -From: Andre Stechert - -libarchive_autodetect-st_lib_archive.m4 - -M4 macros for use with autoconf to detect whether a suitable -version of libarchive is installed on this system. - - -====================================================================== - -libarchive.spec - -An RPM ".spec" file for building libarchive on most systems. -This apparently was originally developed by a group at pld-linux.org. -Several people have sent me different versions of this file. - -====================================================================== - -From: Robert Meier - -libarchive.1aix53.spec - -As above, for use on AIX5.3. - -====================================================================== - -psota-benchmark - -Some scripts used by Jan Psota in benchmarking -various tar implementations. - -I've edited his results slightly to correctly reflect that -bsdtar does not support a "compare" operation. - -====================================================================== - -shar - -A simple shar program written on top of libarchive. - -====================================================================== - -untar.c - -A very simple and very portable standalone program that can -extract basic ustar archives. -This does not use libarchive and so can be used to extract -the libarchive distribution on any system that has a C compiler -but does not have a tar program. - -====================================================================== diff --git a/contrib/libarchive.1aix53.spec b/contrib/libarchive.1aix53.spec deleted file mode 100644 index fe81d147e03e..000000000000 --- a/contrib/libarchive.1aix53.spec +++ /dev/null @@ -1,160 +0,0 @@ -# $LastChangedRevision$, $LastChangedDate$ -Summary: Library to create and read several different archive formats -Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów -Name: libarchive -Version: 2.0a3 -Release: 1aix53 -License: BSD -Group: Libraries -Source0: http://people.freebsd.org/~kientzle/libarchive/src/%{name}-%{version}.tar.gz -Patch: %{name}-0123457890.patch -URL: http://people.freebsd.org/~kientzle/libarchive/ -Requires: glibc -Requires: zlib -Requires: bzip2 -BuildRequires: gcc -BuildRequires: gcc-c++ -BuildRequires: gawk -BuildRequires: zlib-devel -BuildRequires: bzip2 -BuildRoot: %{_tmppath}/%{name}-%{version}-build - -%description -Libarchive is a programming library that can create and read several -different streaming archive formats, including most popular TAR -variants and several CPIO formats. It can also write SHAR archives. - -%description -l pl -Libarchive jest bibliotek± s³u¿ac± to tworzenia i odczytu wielu -ró¿nych strumieniowych formatów archiwów, w³±czaj±c w to popularne -odmiany TAR oraz wiele formatów CPIO. Biblioteka ta potrafi tak¿e -zapisywaæ archiwa SHAR. - -%package devel -Summary: Header files for libarchive library -Summary(pl): Pliki nag³ówkowe biblioteki libarchive -Group: Development/Libraries -Requires: %{name} = %{version}-%{release} - -%description devel -Header files for libarchive library. - -%description devel -l pl -Pliki nag³ówkowe biblioteki libarchive. - -%package static -Summary: Static libarchive library -Summary(pl): Statyczna biblioteka libarchive -Group: Development/Libraries -Requires: %{name}-devel = %{version}-%{release} - -%description static -Static libarchive library. - -%description static -l pl -Statyczna biblioteka libarchive. - -%package -n bsdtar -Summary: bsdtar - tar(1) implementation based on libarchive -Summary(pl): bsdtar - implementacja programu tar(1) oparta na libarchive -Group: Applications/Archiving -Requires: %{name} = %{version}-%{release} - -%description -n bsdtar -bsdtar - tar(1) implementation based on libarchive. - -%description -n bsdtar -l pl -bsdtar - implementacja programu tar(1), oparta na libarchive. - -%prep -%setup -q -%patch0 -p1 - -%build -# Specify paths to avoid use of vacpp -# -maix64 - required to use large files with aix-5.3 -# -static - required for interoperability without copying libraries -# -D_BSD - required to include definition of makedev -# -X64 - required to assemble 64-bit COFF files -mkdir -p %{buildroot} -PATH=/opt/freeware/libexec:/opt/freeware/bin:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:. \ -CPATH=/opt/freeware/include:/usr/local/include \ -LIBPATH=/opt/freeware/lib:/usr/local/lib:/usr/share/lib \ -LD_LIBRARY_PATH=/opt/freeware/lib:/usr/local/lib:/usr/share/lib \ -CFLAGS="$RPM_OPT_FLAGS -maix64 -static -D_BSD" \ -CXXFLAGS="$RPM_OPT_FLAGS -maix64 -static -D_BSD" \ -AR="ar -X64" \ -./configure \ ---prefix=%{_prefix} \ ---libexecdir=%{_libexecdir} \ ---mandir=%{_mandir} \ ---infodir=%{_infodir} \ ---enable-shared=yes \ ---enable-static=yes \ -| tee %{buildroot}/config.log -make | tee %{buildroot}/make.log - -%install -[ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot; -make DESTDIR=%buildroot install -# original install builds, but does install bsdtar -cp .libs/%{name}.a %{buildroot}%{_libdir} -cp bsdtar %{buildroot}%{_bindir} -cp tar/bsdtar.1 %{buildroot}%{_mandir}/man1 - -%clean -rm -fr %buildroot - -%files -%defattr(644,root,root,755) -%{_libdir}/libarchive.a - -%files devel -%defattr(644,root,root,755) -%{_libdir}/libarchive.la -%{_includedir}/*.h -%doc %{_mandir}/man3/* -%doc %{_mandir}/man5/* - -%files -n bsdtar -%defattr(644,root,root,755) -%attr(755,root,root) %{_bindir}/bsdtar -%doc %{_mandir}/man1/bsdtar.1* - -%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`) -%changelog -* %{date} PLD Team -All persons listed below can be reached at @pld-linux.org - -$Log: libarchive.spec,v $ -Release 1aix53 2006/12/12 rm1023@dcx.com -- tweak for aix-5.3 -- added libarchive-0123457890.patch for "0123457890" error -- replaced libarchive-1.3.1.tar.gz with libarchive-2.0a3.tar.gz -- removed obsolete -CVE-2006-5680.patch and -man_progname.patch - -Revision 1.6 2006/11/15 10:41:28 qboosh -- BR: acl-devel,attr-devel -- devel deps - -Revision 1.5 2006/11/08 22:22:25 twittner -- up to 1.3.1 -- added BR: e2fsprogs-devel -- added -CVE-2006-5680.patch against entering an infinite -loop in corrupt archives -- added bsdtar package (bsdtar is included now in libarchive -sources) -- rel. 0.1 for testing - -Revision 1.4 2005/12/15 18:26:36 twittner -- up to 1.2.37 -- removed -shared.patch (no longer needed) - -Revision 1.3 2005/10/05 17:00:12 arekm -- up to 1.02.034 - -Revision 1.2 2005/07/27 20:17:21 qboosh -- typo - -Revision 1.1 2005/07/27 08:36:03 adamg -- new diff --git a/contrib/libarchive.spec b/contrib/libarchive.spec deleted file mode 100644 index b5b658a874b1..000000000000 --- a/contrib/libarchive.spec +++ /dev/null @@ -1,147 +0,0 @@ -# $LastChangedRevision$, $LastChangedDate$ -Summary: Library to create and read several different archive formats -Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów -Name: libarchive -Version: 2.0a3 -Release: 1 -License: BSD -Group: Libraries -Source0: http://people.freebsd.org/~kientzle/libarchive/src/%{name}-%{version}.tar.gz -Patch: %{name}-0123457890.patch -URL: http://people.freebsd.org/~kientzle/libarchive/ -Requires: glibc -Requires: zlib -Requires: bzip2 -BuildRequires: gcc -BuildRequires: gcc-c++ -BuildRequires: gawk -BuildRequires: zlib-devel -BuildRequires: bzip2 -BuildRoot: %{_tmppath}/%{name}-%{version}-build - -%description -Libarchive is a programming library that can create and read several -different streaming archive formats, including most popular TAR -variants and several CPIO formats. It can also write SHAR archives. - -%description -l pl -Libarchive jest bibliotek± s³u¿ac± to tworzenia i odczytu wielu -ró¿nych strumieniowych formatów archiwów, w³±czaj±c w to popularne -odmiany TAR oraz wiele formatów CPIO. Biblioteka ta potrafi tak¿e -zapisywaæ archiwa SHAR. - -%package devel -Summary: Header files for libarchive library -Summary(pl): Pliki nag³ówkowe biblioteki libarchive -Group: Development/Libraries -Requires: %{name} = %{version}-%{release} - -%description devel -Header files for libarchive library. - -%description devel -l pl -Pliki nag³ówkowe biblioteki libarchive. - -%package static -Summary: Static libarchive library -Summary(pl): Statyczna biblioteka libarchive -Group: Development/Libraries -Requires: %{name}-devel = %{version}-%{release} - -%description static -Static libarchive library. - -%description static -l pl -Statyczna biblioteka libarchive. - -%package -n bsdtar -Summary: bsdtar - tar(1) implementation based on libarchive -Summary(pl): bsdtar - implementacja programu tar(1) oparta na libarchive -Group: Applications/Archiving -Requires: %{name} = %{version}-%{release} - -%description -n bsdtar -bsdtar - tar(1) implementation based on libarchive. - -%description -n bsdtar -l pl -bsdtar - implementacja programu tar(1), oparta na libarchive. - -%prep -%setup -q -%patch0 -p1 - -%build -mkdir -p %{buildroot} -./configure \ ---prefix=%{_prefix} \ ---libexecdir=%{_libexecdir} \ ---mandir=%{_mandir} \ ---infodir=%{_infodir} \ ---enable-shared=yes \ ---enable-static=yes \ -| tee %{buildroot}/config.log -make | tee %{buildroot}/make.log - -%install -[ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot; -make DESTDIR=%buildroot install -# original install builds, but does install bsdtar -cp .libs/%{name}.a %{buildroot}%{_libdir} -cp bsdtar %{buildroot}%{_bindir} -cp tar/bsdtar.1 %{buildroot}%{_mandir}/man1 - -%clean -rm -fr %buildroot - -%files -%defattr(644,root,root,755) -%{_libdir}/libarchive.a - -%files devel -%defattr(644,root,root,755) -%{_libdir}/libarchive.la -%{_includedir}/*.h -%doc %{_mandir}/man3/* -%doc %{_mandir}/man5/* - -%files -n bsdtar -%defattr(644,root,root,755) -%attr(755,root,root) %{_bindir}/bsdtar -%doc %{_mandir}/man1/bsdtar.1* - -%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`) -%changelog -* %{date} PLD Team -All persons listed below can be reached at @pld-linux.org - -$Log: libarchive.spec,v $ -Release 1 2006/12/12 rm1023@dcx.com -- added libarchive-0123457890.patch for "0123457890" error -- replaced libarchive-1.3.1.tar.gz with libarchive-2.0a3.tar.gz -- removed obsolete -CVE-2006-5680.patch and -man_progname.patch - -Revision 1.6 2006/11/15 10:41:28 qboosh -- BR: acl-devel,attr-devel -- devel deps - -Revision 1.5 2006/11/08 22:22:25 twittner -- up to 1.3.1 -- added BR: e2fsprogs-devel -- added -CVE-2006-5680.patch against entering an infinite -loop in corrupt archives -- added bsdtar package (bsdtar is included now in libarchive -sources) -- rel. 0.1 for testing - -Revision 1.4 2005/12/15 18:26:36 twittner -- up to 1.2.37 -- removed -shared.patch (no longer needed) - -Revision 1.3 2005/10/05 17:00:12 arekm -- up to 1.02.034 - -Revision 1.2 2005/07/27 20:17:21 qboosh -- typo - -Revision 1.1 2005/07/27 08:36:03 adamg -- new diff --git a/contrib/libarchive_autodetect-st_lib_archive.m4 b/contrib/libarchive_autodetect-st_lib_archive.m4 deleted file mode 100644 index 4419e888f240..000000000000 --- a/contrib/libarchive_autodetect-st_lib_archive.m4 +++ /dev/null @@ -1,154 +0,0 @@ -dnl -dnl @synopsis ST_LIB_ARCHIVE([ENABLED-DEFAULT]) -dnl -dnl This macro figures out what's necessary to link a program against an -dnl instance of the BSD libarchive package by Tim Kientzle. -dnl -dnl See http://people.freebsd.org/~kientzle/libarchive/ for more info. -dnl -dnl It exports and substitutes the variables LIBARCHIVE_LIBS, LIBARCHIVE_LDFLAGS, -dnl and LIBARCHIVE_CPPFLAGS to appropriate values for the identified instance of -dnl libarchive. The values are AC_SUBST'd, so a user could, for example, simply -dnl include @LIBARCHIVE_CPPFLAGS@ in the definition of AM_CPPFLAGS in a Makefile.am. -dnl -dnl ENABLED-DEFAULT is either "yes" or "no" and determines whether the default value -dnl is --with-libarchive or --without-libarchive. It is not possible to specify a -dnl default directory. More simply, any reasonable choice for a default should just -dnl go into the auto-detect list. -dnl -dnl The macro defines the symbol HAVE_LIBARCHIVE if the library is found. You -dnl should use autoheader to include a definition for this symbol in a config.h -dnl file. Sample usage in a C/C++ source is as follows: -dnl -dnl #ifdef HAVE_LIBARCHIVE -dnl #include -dnl #endif /* HAVE_LIBARCHIVE */ -dnl -dnl @category InstalledPackages -dnl @author Andre Stechert -dnl @version 2006-04-20 -dnl @license GPLWithACException - -AC_DEFUN([ST_LIB_ARCHIVE], -[ -# -# Handle input from the configurer and blend with the requirements from the maintainer. -# We go through the trouble of creating a second set of variables other than the with_foo -# variables in order to be sure that error/corner cases have been cleaned up. -# -# After this statement, three trusted variable are defined. -# -# st_lib_archive_ENABLED will be either "yes" or "no". its value determines whether -# or not we bother with the rest of the checks and whether or not we export a -# bunch of variables. -# -# st_lib_archive_LOCATION will be either "auto" or "defined". if it is "auto", then -# we try a bunch of standard locations. if it is "defined", then we just try the value -# provided in st_lib_archive_DIR. -# -# st_lib_archive_DIR will contain the string provided by the user, provided that it's -# actually a directory. -# -AC_MSG_CHECKING([if libarchive is wanted]) -AC_ARG_WITH([libarchive], - AS_HELP_STRING([--with-libarchive=DIR], [libarchive installation directory]), - [if test "x$with_libarchive" = "xno" ; then - st_lib_archive_ENABLED=no - elif test "x$with_libarchive" = "xyes" ; then - st_lib_archive_ENABLED=yes - st_lib_archive_LOCATION=auto - else - st_lib_archive_ENABLED=yes - st_lib_archive_LOCATION=defined - if test -d "$with_libarchive" ; then - st_lib_archive_DIR="$with_libarchive" - else - AC_MSG_ERROR([$with_libarchive is not a directory]) - fi - fi], - [if test "x$1" = "xno" ; then - st_lib_archive_ENABLED=no - elif test "x$1" = "xyes" ; then - st_lib_archive_ENABLED=yes - else - st_lib_archive_ENABLED=yes - fi]) - -if test "$st_lib_archive_ENABLED" = "yes" ; then - AC_MSG_RESULT([yes]) -# -# After this statement, one trusted variable is defined. -# -# st_lib_archive_LIB will be either "lib" or "lib64", depending on whether the configurer -# specified 32, 64. The default is "lib". -# - AC_MSG_CHECKING([whether to use lib or lib64]) - AC_ARG_WITH([libarchive-bits], - AS_HELP_STRING([--with-libarchive-bits=32/64], [if 64, look in /lib64 on hybrid systems]), - [if test "x$with_libarchive_bits" = "x32" ; then - st_lib_archive_LIB=lib - elif test "x$with_libarchive_bits" = "x64" ; then - st_lib_archive_LIB=lib64 - else - AC_MSG_ERROR([the argument must be either 32 or 64]) - fi], - [st_lib_archive_LIB=lib]) - AC_MSG_RESULT($st_lib_archive_LIB) -# -# Save the environment before verifying libarchive availability -# - st_lib_archive_SAVECPPFLAGS="$CPPFLAGS" - st_lib_archive_SAVELDFLAGS="$LDFLAGS" - AC_LANG_SAVE - AC_LANG_C - - if test "x$st_lib_archive_LOCATION" = "xdefined" ; then - CPPFLAGS="-I$st_lib_archive_DIR/include $st_lib_archive_SAVECPPFLAGS" - LDFLAGS="-L$st_lib_archive_DIR/$st_lib_archive_LIB $st_lib_archive_SAVELDFLAGS" - AC_CHECK_LIB(archive, archive_read_new, [st_lib_archive_found_lib=yes], [st_lib_archive_found_lib=no]) - AC_CHECK_HEADER(archive.h, [st_lib_archive_found_hdr=yes], [st_lib_archive_found_hdr=no]) - if test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes"; then - LIBARCHIVE_CPPFLAGS="-I$dir/include" - LIBARCHIVE_LDFLAGS="-L$dir/$st_lib_archive_LIB" - else - AC_MSG_ERROR([could not find libarchive in the requested location]) - fi - else - # - # These are the common install directories for Linux, FreeBSD, Solaris, and Mac. - # - for dir in /usr /usr/local /usr/sfw /opt/csw /opt/local /sw - do - if test -d "$dir" ; then - CPPFLAGS="-I$dir/include $st_lib_archive_SAVECPPFLAGS" - LDFLAGS="-L$dir/$st_lib_archive_LIB $st_lib_archive_SAVELDFLAGS" - AC_CHECK_LIB(archive, archive_read_new, [st_lib_archive_found_lib=yes], [st_lib_archive_found_lib=no]) - AC_CHECK_HEADER(archive.h, [st_lib_archive_found_hdr=yes], [st_lib_archive_found_hdr=no]) - if test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes"; then - LIBARCHIVE_CPPFLAGS="-I$dir/include" - LIBARCHIVE_LDFLAGS="-L$dir/$st_lib_archive_LIB" - break - fi - fi - done - fi - - if test "x$st_lib_archive_found_hdr" = "xyes" && test "x$st_lib_archive_found_lib" = "xyes" ; then - LIBARCHIVE_LIBS="-larchive" - AC_DEFINE([HAVE_LIBARCHIVE], [1], [Defined to 1 if libarchive is available for use.]) - AC_SUBST(LIBARCHIVE_LIBS) - AC_SUBST(LIBARCHIVE_CPPFLAGS) - AC_SUBST(LIBARCHIVE_LDFLAGS) - fi - -# -# Restore the environment now that we're done. -# - AC_LANG_RESTORE - CPPFLAGS="$st_lib_archive_SAVECPPFLAGS" - LDFLAGS="$st_lib_archive_SAVELDFLAGS" -else - AC_MSG_RESULT([no]) -fi -AM_CONDITIONAL(LIBARCHIVE, test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes") -]) diff --git a/contrib/psota-benchmark/results.txt b/contrib/psota-benchmark/results.txt deleted file mode 100644 index 2d364c5558dd..000000000000 --- a/contrib/psota-benchmark/results.txt +++ /dev/null @@ -1,136 +0,0 @@ -ODP: [Bug-tar] GNU tar, star and BSD tar speed comparison +new script - -Jan Psota -Thu, 25 Oct 2007 06:51:13 -0700 - -Latest TCP script at the bottom (3180 bytes). -4 tests: 64bit dual core Athlon tmpfs / disk (reiserfs) - 60MB/s, - 32bit Athlon tmpfs / disk (reiserfs) - 55MB/s -Both machines were idle -- used for testing only. -Tarball and extracted files were on different physical devices. -Test data: linux 2.6.22/3 kernel sources for memory operations, -for the other data average file size should bring enough info. - -2 x [...] processor means 1 processor with 2 cores (2 entries in cpuinfo). -Archive format is set to pax (Joerg). -Let's end with it. I only wanted to send You a new version of TCP script :-). - --- -Jan Psota - -TCP, version 2007-10-25 -Linux 2.6.22-suspend2-r2 / Gentoo Base System release 2.0.0_rc5 -2012MB of memory, 2 x AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ 2211.348 -512 KB 4426.24 bmips -gcc (GCC) 4.2.2 (Gentoo 4.2.2 p1.0) -CFLAGS="-O2 -march=k8 -pipe" - -bsdtar: bsdtar 2.3.4 - libarchive 2.3.4 -gnutar: tar (GNU tar) 1.19 -star: star: star 1.5a85 (x86_64-unknown-linux-gnu) - -best time of 5 repetitions, - src=linux-2.6.23, 291M in 23867 files, avg 13KB/file, - archive=/tmp/tcp.tar, extract to /tmp/tcptmp -program operation real user system %CPU speed -bsdtar create 0.764 0.232 0.532 99.96 370308 KB/s -gnutar create 0.743 0.200 0.512 95.87 380775 KB/s -star create 0.587 0.040 0.820 100.00 441247 KB/s - -bsdtar list 0.164 0.096 0.068 99.84 1579341 KB/s -gnutar list 0.218 0.064 0.152 98.92 1188128 KB/s -star list 0.359 0.044 0.240 79.09 721481 KB/s - -bsdtar extract 0.733 0.200 0.504 96.02 353358 KB/s -gnutar extract 0.625 0.092 0.508 96.02 414419 KB/s -star extract 0.875 0.096 0.980 100.00 296013 KB/s - -bsdtar compare 0.001 0.000 0.000 0.00 259012000 KB/s -gnutar compare 0.719 0.288 0.400 95.66 360239 KB/s -star compare 0.695 0.224 0.636 100.00 372679 KB/s - -[...] -best time of 3 repetitions, - src=/home, 3.2G in 7447 files, avg 554KB/file, - archive=/var/tcp.tar, extract to /mnt/a/tcptmp -program operation real user system %CPU speed -bsdtar create 184.680 0.552 13.365 7.53 17958 KB/s -gnutar create 159.240 0.256 12.417 7.95 20827 KB/s -star create 181.779 0.140 14.789 8.21 18203 KB/s - -bsdtar list 0.053 0.032 0.016 91.41 62435471 KB/s -gnutar list 56.535 0.136 3.764 6.89 58531 KB/s -star list 56.652 0.080 5.236 9.38 58410 KB/s - -bsdtar extract 78.914 0.820 15.149 20.23 41932 KB/s -gnutar extract 78.480 0.196 14.197 18.33 42164 KB/s -star extract 79.439 0.132 12.973 16.49 41655 KB/s - -bsdtar compare 0.001 0.000 0.000 0.00 3309080000 KB/s -gnutar compare 61.771 3.464 8.905 20.02 53570 KB/s -star compare 57.561 1.728 9.897 20.19 57488 KB/s - - -Linux 2.6.22-suspend2-smp / Gentoo Base System release 2.0.0_rc5 -504MB of memory, 1 x AMD Athlon(tm) Processor 1500.033 256 KB 3002.55 bmips -gcc (GCC) 4.2.2 (Gentoo 4.2.2 p1.0) -CFLAGS="-O2 -march=athlon-xp -mfpmath=sse -frename-registers -pipe" - -bsdtar: bsdtar 2.3.4 - libarchive 2.3.4 -gnutar: tar (GNU tar) 1.19 -star: star: star 1.5a85 (i686-pc-linux-gnu) - -best time of 3 repetitions, - src=/usr/src/linux-2.6.22-suspend2/drivers, 119M in 5900 files, - avg 21KB/file, archive=/tmp/tcp.tar, extract to /tmp/tcptmp -program operation real user system %CPU speed -bsdtar create 1.329 0.192 1.132 99.63 89784 KB/s -gnutar create 1.223 0.124 1.092 99.46 97566 KB/s -star create 1.848 0.036 1.708 94.36 61372 KB/s - -bsdtar list 0.167 0.060 0.108 100.00 679137 KB/s -gnutar list 0.161 0.040 0.124 100.00 704447 KB/s -star list 0.859 0.044 0.716 88.51 132032 KB/s - -bsdtar extract 1.186 0.172 1.012 99.87 95629 KB/s -gnutar extract 1.064 0.056 1.004 99.63 106593 KB/s -star extract 1.920 0.088 1.724 94.40 59070 KB/s - -bsdtar compare 0.002 0.000 0.000 0.00 56708000 KB/s -gnutar compare 0.925 0.232 0.692 99.90 122611 KB/s -star compare 1.569 0.376 1.096 93.79 72285 KB/s - -[...] -best time of 3 repetitions, - src=/home/jasiu, 2.1G in 8416 files, avg 277KB/file, - archive=/home/j2/tcp.tar, extract to /mnt/a/tar/tcptmp -program operation real user system %CPU speed -bsdtar create 182.171 1.692 29.130 16.91 11584 KB/s -gnutar create 174.999 0.632 27.450 16.04 12059 KB/s -star create 180.004 0.360 41.795 23.41 11677 KB/s - -bsdtar list 0.214 0.076 0.136 99.04 9822294 KB/s -gnutar list 0.210 0.076 0.136 100.00 10009385 KB/s -star list 43.462 0.148 18.109 42.00 48363 KB/s - -bsdtar extract 94.912 4.476 31.574 37.98 22146 KB/s -gnutar extract 94.657 0.396 29.462 31.54 22206 KB/s -star extract 100.814 0.400 39.906 39.98 20849 KB/s - -bsdtar compare 0.003 0.000 0.004 100.00 700657000 KB/s -gnutar compare 80.174 3.932 20.365 30.30 26217 KB/s -star compare 73.911 8.341 27.670 48.72 28439 KB/s - -============================================================= - -Note by Tim Kientzle: The "bsdtar compare" results here are -invalid since bsdtar does not support that operation. -For the list numbers, note that libarchive automatically optimizes -list operations on uncompressed tar archives on disk by using lseek() -to skip over the bodies of entries. GNU tar added an option to -provide the same feature. - -The biggest problem with these tests is that they only -cover uncompressed archives stored on disk. The results for -compressed archives and/or archives stored on tape are -likely quite different. diff --git a/contrib/psota-benchmark/tcp.sh b/contrib/psota-benchmark/tcp.sh deleted file mode 100644 index 3f630732be7c..000000000000 --- a/contrib/psota-benchmark/tcp.sh +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/sh -# tar comparison program -# 2007-10-25 Jan Psota - -n=3 # number of repetitions -TAR="bsdtar gnutar star" # Tape archivers to compare -OPT=("" "--seek" "-no-fsync") -pax="--format=pax" # comment out for defaults -OPN=(create list extract compare) # operations -version="2007-10-25" -TIMEFORMAT=$'%R\t%U\t%S\t%P' -LC_ALL=C - -test $# -ge 2 || { - echo -e "usage:\t$0 source_dir where_to_place_archive -[where_to_extract_it] - -TCP, version $version -TCP stands for Tar Comparison Program here. -It currently compares: BSD tar (bsdtar), GNU tar (gnutar) and star in archive -creation, listing, extraction and archive-to-extracted comparison. -Tcp prints out best time of n=$n repetitions. - -Tcp creates temporary archive named tcp.tar with $pax and some native -(--seek/-no-fsync) options and extracts it to [\$3]/tcptmp/. -If unset, third argument defaults to [\$2]. -After normal exit tcp removes tarball and extracted files. -Tcp does not check filesystems destination directories are on for free space, -so make sure there is enough space (a bit more than source_dir uses) for both: -archive and extracted files. -Do not use white space in arguments. - Jan Psota, $version" - exit 0 -} -src=$1 -dst=$2/tcp.tar -dst_path=${3:-$2}/tcptmp -test -e $dst -o -e /tmp/tcp \ - && { echo "$dst or /tmp/tcp exists, exiting"; exit 1; } -mkdir $dst_path || exit 2 - -use_times () -{ - awk -F"\t" -vN=$n -vL="`du -k $dst`" -vOFS="\t" -vORS="" ' - { if (NF==4) { printf "\t%s\t%10.1d KB/s\n", $0, ($1+0>0 ? -(L+0)/($1+0) : 0) } }' \ - /tmp/tcp | sort | head -1 - > /tmp/tcp -} - -test -d $src || { echo "'$src' is not a directory"; exit 3; } - -# system information: type, release, memory, cpu(s), compiler and flags -echo -e "TCP, version $version\n"`uname -sr`" / "`head -1 /etc/*-release` -free -m | awk '/^Mem/ { printf "%dMB of memory, ", $2 }' -test -e /proc/cpuinfo \ - && awk -F: '/name|cache size|MHz|mips/ { if (!a) b=b $2 } - /^$/ { a++ } END { print a" x"b" bmips" }' /proc/cpuinfo -test -e /etc/gentoo-release \ - && gcc --version | head -1 && grep ^CFLAGS /etc/make.conf - -# tar versions -t= -echo -for tar in $TAR; do - if which $tar &> /dev/null; then - t="$t $tar"; - echo -ne "$tar:\t"; $tar --version | head -1; - fi -done - -TAR="$t" - -echo -e "\nbest time of $n repetitions,\n"\ -" src=$src, "\ -`du -sh $src | awk '{print $1}'`" in "`find $src | wc -l`" files, "\ -"avg "$((`du -sk $src | awk '{print $1}'`/`find $src -type f | wc -l`))"KB/file,\n"\ -" archive=$dst, extract to $dst_path" - -echo -e "program\toperation\treal\tuser\tsystem\t%CPU\t speed" -> /tmp/tcp -let op_num=0 -for op in "cf $dst $pax -C $src ." "tf $dst" "xf $dst -C $dst_path" \ - "f $dst -C $dst_path --diff"; do - let tar_num=0 - for tar in $TAR; do - echo -en "$tar\t${OPN[op_num]}\t" - for ((i=1; i<=$n; i++)); do - echo $op | grep -q ^cf && rm -f $dst - echo $op | grep -q ^xf && - { chmod -R u+w $dst_path - rm -rf $dst_path; mkdir $dst_path; } - sync - if echo $op | grep -q ^f; then # op == compare - time $tar $op ${OPT[$tar_num]} > /dev/null - else # op in (create | list | extract) - time $tar $op ${OPT[$tar_num]} > /dev/null \ - || break 3 - fi 2>> /tmp/tcp - done - use_times - let tar_num++ - done - let op_num++ - echo -done -rm -rf $dst_path $dst -echo -cat /tmp/tcp -rm -f /tmp/tcp diff --git a/contrib/shar/Makefile b/contrib/shar/Makefile deleted file mode 100644 index 3bd94d4192cb..000000000000 --- a/contrib/shar/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $FreeBSD$ - -PROG= shar -SRCS= shar.c tree.c - -WARNS?= 6 - -DPADD= ${LIBARCHIVE} -LDADD= -larchive - -LINKS= ${BINDIR}/shar -MLINKS= shar.1 - -.include diff --git a/contrib/shar/shar.1 b/contrib/shar/shar.1 deleted file mode 100644 index e3152f299ebe..000000000000 --- a/contrib/shar/shar.1 +++ /dev/null @@ -1,128 +0,0 @@ -.\" Copyright (c) 1990, 1993 -.\" The Regents of the University of California. 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. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. -.\" -.\" @(#)shar.1 8.1 (Berkeley) 6/6/93 -.\" $FreeBSD$ -.\" -.Dd April 17, 2008 -.Dt SHAR 1 -.Os -.Sh NAME -.Nm shar -.Nd create a shell archive of files -.Sh SYNOPSIS -.Nm -.Op Fl br -.Op Fl o Ar archive-file -.Ar -.Sh DESCRIPTION -The -.Nm -command writes a -.Xr sh 1 -shell script which will recreate the file hierarchy specified by the command -line operands. -.Pp -The -.Nm -command is normally used for distributing files by -.Xr ftp 1 -or -.Xr mail 1 . -.Pp -The following options are available: -.Bl -tag -width indent -.It Fl b -Use an alternative binary format. Content of files will be uuencoded. -This option should be used to archive binary files correctly. -In this mode also file permissions will be stored to the archive. -uudecode(1) is needed to extract archives created with this option. -.It Fl o Ar archive-file -Redirect output to -.Ar archive-file . -.It Fl r -If -.Ar file -given on command line is a directory the entire subtree will be archived. -Symbolic links given on command line are followed. Other symbolic links will -be archived as such. -.El -.Sh EXAMPLES -To create a shell archive of the program -.Xr ls 1 -and mail it to Rick: -.Bd -literal -offset indent -cd ls -shar -r . \&| mail -s "ls source" rick -.Ed -.Pp -To recreate the program directory: -.Bd -literal -offset indent -mkdir ls -cd ls -\&... - -\&... -sh archive -.Ed -.Sh SEE ALSO -.Xr compress 1 , -.Xr mail 1 , -.Xr tar 1 , -.Xr uuencode 1 , -.Xr uuencode 5 -.Sh HISTORY -The -.Nm -command appeared in -.Bx 4.4 . -This is a re-implementation based on the libarchive(3) library. -.Sh BUGS -The -.Nm -command makes no provisions for hard links. -.Pp -Files containing magic characters or files without a newline ('\\n') as the -last character are not handled correctly with the default format. Use the -b -option for binary files. -.Pp -It is easy to insert trojan horses into -.Nm -files. -It is strongly recommended that all shell archive files be examined -before running them through -.Xr sh 1 . -Archives produced using this implementation of -.Nm -may be easily examined with the command: -.Bd -literal -offset indent -egrep -v '^[X#]' shar.file -.Ed diff --git a/contrib/shar/shar.c b/contrib/shar/shar.c deleted file mode 100644 index 6d5c206e2a51..000000000000 --- a/contrib/shar/shar.c +++ /dev/null @@ -1,314 +0,0 @@ -/*- - * Copyright (c) 2008 Jaakko Heinonen - * 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 -#ifdef __FBSDID -__FBSDID("$FreeBSD$"); -#endif - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "tree.h" - -/* command line options */ -static int b_opt; /* use alternative shar binary format */ -static int r_opt; /* recurse into subdirectories */ -static char *o_arg; /* output file name */ - -static void -usage(void) -{ - fprintf(stderr, "Usage: shar [-br] [-o filename] file ...\n"); - exit(EX_USAGE); -} - -/* - * Initialize archive structure and create a shar archive. - */ -static struct archive * -shar_create(void) -{ - struct archive *a; - - if ((a = archive_write_new()) == NULL) - errx(EXIT_FAILURE, "%s", archive_error_string(a)); - - if (b_opt) - archive_write_set_format_shar_dump(a); - else - archive_write_set_format_shar(a); - archive_write_set_compression_none(a); - - if (archive_write_open_filename(a, o_arg) != ARCHIVE_OK) - errx(EX_CANTCREAT, "%s", archive_error_string(a)); - - return (a); -} - -/* buffer for file data */ -static char buffer[32768]; - -/* - * Write file data to an archive entry. - */ -static int -shar_write_entry_data(struct archive *a, const int fd) -{ - ssize_t bytes_read, bytes_written; - - assert(a != NULL); - assert(fd >= 0); - - bytes_read = read(fd, buffer, sizeof(buffer)); - while (bytes_read != 0) { - if (bytes_read < 0) { - archive_set_error(a, errno, "Read failed"); - return (ARCHIVE_WARN); - } - bytes_written = archive_write_data(a, buffer, bytes_read); - if (bytes_written < 0) - return (ARCHIVE_WARN); - bytes_read = read(fd, buffer, sizeof(buffer)); - } - - return (ARCHIVE_OK); -} - -/* - * Write a file to the archive. We have special handling for symbolic links. - */ -static int -shar_write_entry(struct archive *a, const char *pathname, const char *accpath, - const struct stat *st) -{ - struct archive_entry *entry; - int fd = -1; - int ret = ARCHIVE_OK; - - assert(a != NULL); - assert(pathname != NULL); - assert(accpath != NULL); - assert(st != NULL); - - entry = archive_entry_new(); - - if (S_ISREG(st->st_mode) && st->st_size > 0) { - /* regular file */ - if ((fd = open(accpath, O_RDONLY)) == -1) { - warn("%s", accpath); - ret = ARCHIVE_WARN; - goto out; - } - } else if (S_ISLNK(st->st_mode)) { - /* symbolic link */ - char lnkbuff[PATH_MAX + 1]; - int lnklen; - if ((lnklen = readlink(accpath, lnkbuff, PATH_MAX)) == -1) { - warn("%s", accpath); - ret = ARCHIVE_WARN; - goto out; - } - lnkbuff[lnklen] = '\0'; - archive_entry_set_symlink(entry, lnkbuff); - } - archive_entry_copy_stat(entry, st); - archive_entry_set_pathname(entry, pathname); - if (!S_ISREG(st->st_mode) || st->st_size == 0) - archive_entry_set_size(entry, 0); - if (archive_write_header(a, entry) != ARCHIVE_OK) { - warnx("%s: %s", pathname, archive_error_string(a)); - ret = ARCHIVE_WARN; - goto out; - } - if (fd >= 0) { - if ((ret = shar_write_entry_data(a, fd)) != ARCHIVE_OK) - warnx("%s: %s", accpath, archive_error_string(a)); - } -out: - archive_entry_free(entry); - if (fd >= 0) - close(fd); - - return (ret); -} - -/* - * Write singe path to the archive. The path can be a regular file, directory - * or device. Symbolic links are followed. - */ -static int -shar_write_path(struct archive *a, const char *pathname) -{ - struct stat st; - - assert(a != NULL); - assert(pathname != NULL); - - if ((stat(pathname, &st)) == -1) { - warn("%s", pathname); - return (ARCHIVE_WARN); - } - - return (shar_write_entry(a, pathname, pathname, &st)); -} - -/* - * Write tree to the archive. If pathname is a symbolic link it will be - * followed. Other symbolic links are stored as such to the archive. - */ -static int -shar_write_tree(struct archive *a, const char *pathname) -{ - struct tree *t; - const struct stat *lst, *st; - int error = 0; - int tree_ret; - int first; - - assert(a != NULL); - assert(pathname != NULL); - - t = tree_open(pathname); - for (first = 1; (tree_ret = tree_next(t)); first = 0) { - if (tree_ret == TREE_ERROR_DIR) { - warnx("%s: %s", tree_current_path(t), - strerror(tree_errno(t))); - error = 1; - continue; - } else if (tree_ret != TREE_REGULAR) - continue; - if ((lst = tree_current_lstat(t)) == NULL) { - warn("%s", tree_current_path(t)); - error = 1; - continue; - } - /* - * If the symlink was given on command line then - * follow it rather than write it as symlink. - */ - if (first && S_ISLNK(lst->st_mode)) { - if ((st = tree_current_stat(t)) == NULL) { - warn("%s", tree_current_path(t)); - error = 1; - continue; - } - } else - st = lst; - - if (shar_write_entry(a, tree_current_path(t), - tree_current_access_path(t), st) != ARCHIVE_OK) - error = 1; - - tree_descend(t); - } - - tree_close(t); - - return ((error != 0) ? ARCHIVE_WARN : ARCHIVE_OK); -} - -/* - * Create a shar archive and write files/trees into it. - */ -static int -shar_write(char **fn, size_t nfn) -{ - struct archive *a; - size_t i; - int error = 0; - - assert(fn != NULL); - assert(nfn > 0); - - a = shar_create(); - - for (i = 0; i < nfn; i++) { - if (r_opt) { - if (shar_write_tree(a, fn[i]) != ARCHIVE_OK) - error = 1; - } else { - if (shar_write_path(a, fn[i]) != ARCHIVE_OK) - error = 1; - } - } - - if (archive_write_free(a) != ARCHIVE_OK) - errx(EXIT_FAILURE, "%s", archive_error_string(a)); - - if (error != 0) - warnx("Error exit delayed from previous errors."); - - return (error); -} - -int -main(int argc, char **argv) -{ - int opt; - - while ((opt = getopt(argc, argv, "bro:")) != -1) { - switch (opt) { - case 'b': - b_opt = 1; - break; - case 'o': - o_arg = optarg; - break; - case 'r': - r_opt = 1; - break; - default: - usage(); - /* NOTREACHED */ - } - } - argc -= optind; - argv += optind; - - if(argc < 1) - usage(); - - if (shar_write(argv, argc) != 0) - exit(EXIT_FAILURE); - else - exit(EXIT_SUCCESS); - /* NOTREACHED */ -} - diff --git a/contrib/shar/tree.c b/contrib/shar/tree.c deleted file mode 100644 index d5a04abf5f4b..000000000000 --- a/contrib/shar/tree.c +++ /dev/null @@ -1,542 +0,0 @@ -/*- - * 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. - */ - -/*- - * This is a new directory-walking system that addresses a number - * of problems I've had with fts(3). In particular, it has no - * pathname-length limits (other than the size of 'int'), handles - * deep logical traversals, uses considerably less memory, and has - * an opaque interface (easier to modify in the future). - * - * Internally, it keeps a single list of "tree_entry" items that - * represent filesystem objects that require further attention. - * Non-directories are not kept in memory: they are pulled from - * readdir(), returned to the client, then freed as soon as possible. - * Any directory entry to be traversed gets pushed onto the stack. - * - * There is surprisingly little information that needs to be kept for - * each item on the stack. Just the name, depth (represented here as the - * string length of the parent directory's pathname), and some markers - * indicating how to get back to the parent (via chdir("..") for a - * regular dir or via fchdir(2) for a symlink). - */ -#include "tree_config.h" -__FBSDID("$FreeBSD$"); - -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_DIRENT_H -#include -#endif -#ifdef HAVE_ERRNO_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif - -#include "tree.h" - -/* - * TODO: - * 1) Loop checking. - * 3) Arbitrary logical traversals by closing/reopening intermediate fds. - */ - -struct tree_entry { - struct tree_entry *next; - struct tree_entry *parent; - char *name; - size_t dirname_length; - dev_t dev; - ino_t ino; - int fd; - int flags; -}; - -/* Definitions for tree_entry.flags bitmap. */ -#define isDir 1 /* This entry is a regular directory. */ -#define isDirLink 2 /* This entry is a symbolic link to a directory. */ -#define needsPreVisit 4 /* This entry needs to be previsited. */ -#define needsPostVisit 8 /* This entry needs to be postvisited. */ - -/* - * Local data for this package. - */ -struct tree { - struct tree_entry *stack; - struct tree_entry *current; - DIR *d; - int initialDirFd; - int flags; - int visit_type; - int tree_errno; /* Error code from last failed operation. */ - - char *buff; - const char *basename; - size_t buff_length; - size_t path_length; - size_t dirname_length; - - int depth; - int openCount; - int maxOpenCount; - - struct stat lst; - struct stat st; -}; - -/* Definitions for tree.flags bitmap. */ -#define needsReturn 8 /* Marks first entry as not having been returned yet. */ -#define hasStat 16 /* The st entry is set. */ -#define hasLstat 32 /* The lst entry is set. */ - - -#ifdef HAVE_DIRENT_D_NAMLEN -/* BSD extension; avoids need for a strlen() call. */ -#define D_NAMELEN(dp) (dp)->d_namlen -#else -#define D_NAMELEN(dp) (strlen((dp)->d_name)) -#endif - -#if 0 -#include -void -tree_dump(struct tree *t, FILE *out) -{ - struct tree_entry *te; - - fprintf(out, "\tdepth: %d\n", t->depth); - fprintf(out, "\tbuff: %s\n", t->buff); - fprintf(out, "\tpwd: "); fflush(stdout); system("pwd"); - fprintf(out, "\taccess: %s\n", t->basename); - fprintf(out, "\tstack:\n"); - for (te = t->stack; te != NULL; te = te->next) { - fprintf(out, "\t\tte->name: %s%s%s\n", te->name, - te->flags & needsPreVisit ? "" : " *", - t->current == te ? " (current)" : ""); - } -} -#endif - -/* - * Add a directory path to the current stack. - */ -static void -tree_push(struct tree *t, const char *path) -{ - struct tree_entry *te; - - te = malloc(sizeof(*te)); - memset(te, 0, sizeof(*te)); - te->next = t->stack; - t->stack = te; - te->fd = -1; - te->name = strdup(path); - te->flags = needsPreVisit | needsPostVisit; - te->dirname_length = t->dirname_length; -} - -/* - * Append a name to the current path. - */ -static void -tree_append(struct tree *t, const char *name, size_t name_length) -{ - char *p; - - if (t->buff != NULL) - t->buff[t->dirname_length] = '\0'; - /* Strip trailing '/' from name, unless entire name is "/". */ - while (name_length > 1 && name[name_length - 1] == '/') - name_length--; - - /* Resize pathname buffer as needed. */ - while (name_length + 1 + t->dirname_length >= t->buff_length) { - t->buff_length *= 2; - if (t->buff_length < 1024) - t->buff_length = 1024; - t->buff = realloc(t->buff, t->buff_length); - } - p = t->buff + t->dirname_length; - t->path_length = t->dirname_length + name_length; - /* Add a separating '/' if it's needed. */ - if (t->dirname_length > 0 && p[-1] != '/') { - *p++ = '/'; - t->path_length ++; - } - strncpy(p, name, name_length); - p[name_length] = '\0'; - t->basename = p; -} - -/* - * Open a directory tree for traversal. - */ -struct tree * -tree_open(const char *path) -{ - struct tree *t; - - t = malloc(sizeof(*t)); - memset(t, 0, sizeof(*t)); - tree_append(t, path, strlen(path)); - t->initialDirFd = open(".", O_RDONLY); - /* - * During most of the traversal, items are set up and then - * returned immediately from tree_next(). That doesn't work - * for the very first entry, so we set a flag for this special - * case. - */ - t->flags = needsReturn; - return (t); -} - -/* - * We've finished a directory; ascend back to the parent. - */ -static void -tree_ascend(struct tree *t) -{ - struct tree_entry *te; - - te = t->stack; - t->depth--; - if (te->flags & isDirLink) { - fchdir(te->fd); - close(te->fd); - t->openCount--; - } else { - chdir(".."); - } -} - -/* - * Pop the working stack. - */ -static void -tree_pop(struct tree *t) -{ - struct tree_entry *te; - - t->buff[t->dirname_length] = '\0'; - if (t->stack == t->current && t->current != NULL) - t->current = t->current->parent; - te = t->stack; - t->stack = te->next; - t->dirname_length = te->dirname_length; - t->basename = t->buff + t->dirname_length; - /* Special case: starting dir doesn't skip leading '/'. */ - if (t->dirname_length > 0) - t->basename++; - free(te->name); - free(te); -} - -/* - * Get the next item in the tree traversal. - */ -int -tree_next(struct tree *t) -{ - struct dirent *de = NULL; - - /* Handle the startup case by returning the initial entry. */ - if (t->flags & needsReturn) { - t->flags &= ~needsReturn; - return (t->visit_type = TREE_REGULAR); - } - - while (t->stack != NULL) { - /* If there's an open dir, get the next entry from there. */ - while (t->d != NULL) { - de = readdir(t->d); - if (de == NULL) { - closedir(t->d); - t->d = NULL; - } else if (de->d_name[0] == '.' - && de->d_name[1] == '\0') { - /* Skip '.' */ - } else if (de->d_name[0] == '.' - && de->d_name[1] == '.' - && de->d_name[2] == '\0') { - /* Skip '..' */ - } else { - /* - * Append the path to the current path - * and return it. - */ - tree_append(t, de->d_name, D_NAMELEN(de)); - t->flags &= ~hasLstat; - t->flags &= ~hasStat; - return (t->visit_type = TREE_REGULAR); - } - } - - /* If the current dir needs to be visited, set it up. */ - if (t->stack->flags & needsPreVisit) { - t->current = t->stack; - tree_append(t, t->stack->name, strlen(t->stack->name)); - t->stack->flags &= ~needsPreVisit; - /* If it is a link, set up fd for the ascent. */ - if (t->stack->flags & isDirLink) { - t->stack->fd = open(".", O_RDONLY); - t->openCount++; - if (t->openCount > t->maxOpenCount) - t->maxOpenCount = t->openCount; - } - t->dirname_length = t->path_length; - if (chdir(t->stack->name) != 0) { - /* chdir() failed; return error */ - tree_pop(t); - t->tree_errno = errno; - return (t->visit_type = TREE_ERROR_DIR); - } - t->depth++; - t->d = opendir("."); - if (t->d == NULL) { - tree_ascend(t); /* Undo "chdir" */ - tree_pop(t); - t->tree_errno = errno; - return (t->visit_type = TREE_ERROR_DIR); - } - t->flags &= ~hasLstat; - t->flags &= ~hasStat; - t->basename = "."; - return (t->visit_type = TREE_POSTDESCENT); - } - - /* We've done everything necessary for the top stack entry. */ - if (t->stack->flags & needsPostVisit) { - tree_ascend(t); - tree_pop(t); - t->flags &= ~hasLstat; - t->flags &= ~hasStat; - return (t->visit_type = TREE_POSTASCENT); - } - } - return (t->visit_type = 0); -} - -/* - * Return error code. - */ -int -tree_errno(struct tree *t) -{ - return (t->tree_errno); -} - -/* - * Called by the client to mark the directory just returned from - * tree_next() as needing to be visited. - */ -void -tree_descend(struct tree *t) -{ - if (t->visit_type != TREE_REGULAR) - return; - - if (tree_current_is_physical_dir(t)) { - tree_push(t, t->basename); - t->stack->flags |= isDir; - } else if (tree_current_is_dir(t)) { - tree_push(t, t->basename); - t->stack->flags |= isDirLink; - } -} - -/* - * Get the stat() data for the entry just returned from tree_next(). - */ -const struct stat * -tree_current_stat(struct tree *t) -{ - if (!(t->flags & hasStat)) { - if (stat(t->basename, &t->st) != 0) - return NULL; - t->flags |= hasStat; - } - return (&t->st); -} - -/* - * Get the lstat() data for the entry just returned from tree_next(). - */ -const struct stat * -tree_current_lstat(struct tree *t) -{ - if (!(t->flags & hasLstat)) { - if (lstat(t->basename, &t->lst) != 0) - return NULL; - t->flags |= hasLstat; - } - return (&t->lst); -} - -/* - * Test whether current entry is a dir or link to a dir. - */ -int -tree_current_is_dir(struct tree *t) -{ - const struct stat *st; - - /* - * If we already have lstat() info, then try some - * cheap tests to determine if this is a dir. - */ - if (t->flags & hasLstat) { - /* If lstat() says it's a dir, it must be a dir. */ - if (S_ISDIR(tree_current_lstat(t)->st_mode)) - return 1; - /* Not a dir; might be a link to a dir. */ - /* If it's not a link, then it's not a link to a dir. */ - if (!S_ISLNK(tree_current_lstat(t)->st_mode)) - return 0; - /* - * It's a link, but we don't know what it's a link to, - * so we'll have to use stat(). - */ - } - - st = tree_current_stat(t); - /* If we can't stat it, it's not a dir. */ - if (st == NULL) - return 0; - /* Use the definitive test. Hopefully this is cached. */ - return (S_ISDIR(st->st_mode)); -} - -/* - * Test whether current entry is a physical directory. Usually, we - * already have at least one of stat() or lstat() in memory, so we - * use tricks to try to avoid an extra trip to the disk. - */ -int -tree_current_is_physical_dir(struct tree *t) -{ - const struct stat *st; - - /* - * If stat() says it isn't a dir, then it's not a dir. - * If stat() data is cached, this check is free, so do it first. - */ - if ((t->flags & hasStat) - && (!S_ISDIR(tree_current_stat(t)->st_mode))) - return 0; - - /* - * Either stat() said it was a dir (in which case, we have - * to determine whether it's really a link to a dir) or - * stat() info wasn't available. So we use lstat(), which - * hopefully is already cached. - */ - - st = tree_current_lstat(t); - /* If we can't stat it, it's not a dir. */ - if (st == NULL) - return 0; - /* Use the definitive test. Hopefully this is cached. */ - return (S_ISDIR(st->st_mode)); -} - -/* - * Test whether current entry is a symbolic link. - */ -int -tree_current_is_physical_link(struct tree *t) -{ - const struct stat *st = tree_current_lstat(t); - if (st == NULL) - return 0; - return (S_ISLNK(st->st_mode)); -} - -/* - * Return the access path for the entry just returned from tree_next(). - */ -const char * -tree_current_access_path(struct tree *t) -{ - return (t->basename); -} - -/* - * Return the full path for the entry just returned from tree_next(). - */ -const char * -tree_current_path(struct tree *t) -{ - return (t->buff); -} - -/* - * Return the length of the path for the entry just returned from tree_next(). - */ -size_t -tree_current_pathlen(struct tree *t) -{ - return (t->path_length); -} - -/* - * Return the nesting depth of the entry just returned from tree_next(). - */ -int -tree_current_depth(struct tree *t) -{ - return (t->depth); -} - -/* - * Terminate the traversal and release any resources. - */ -void -tree_close(struct tree *t) -{ - /* Release anything remaining in the stack. */ - while (t->stack != NULL) - tree_pop(t); - if (t->buff) - free(t->buff); - /* chdir() back to where we started. */ - if (t->initialDirFd >= 0) { - fchdir(t->initialDirFd); - close(t->initialDirFd); - t->initialDirFd = -1; - } - free(t); -} diff --git a/contrib/shar/tree.h b/contrib/shar/tree.h deleted file mode 100644 index ff38f5346c1c..000000000000 --- a/contrib/shar/tree.h +++ /dev/null @@ -1,115 +0,0 @@ -/*- - * 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$ - */ - -/*- - * A set of routines for traversing directory trees. - * Similar in concept to the fts library, but with a few - * important differences: - * * Uses less memory. In particular, fts stores an entire directory - * in memory at a time. This package only keeps enough subdirectory - * information in memory to track the traversal. Information - * about non-directories is discarded as soon as possible. - * * Supports very deep logical traversals. The fts package - * uses "non-chdir" approach for logical traversals. This - * package does use a chdir approach for logical traversals - * and can therefore handle pathnames much longer than - * PATH_MAX. - * * Supports deep physical traversals "out of the box." - * Due to the memory optimizations above, there's no need to - * limit dir names to 32k. - */ - -#include -#include - -struct tree; - -/* Initiate/terminate a tree traversal. */ -struct tree *tree_open(const char * /* pathname */); -void tree_close(struct tree *); - -/* - * tree_next() returns Zero if there is no next entry, non-zero if there is. - * Note that directories are potentially visited three times. The first - * time as "regular" file. If tree_descend() is invoked at that time, - * the directory is added to a work list and will be visited two more - * times: once just after descending into the directory and again - * just after ascending back to the parent. - * - * TREE_ERROR is returned if the descent failed (because the - * directory couldn't be opened, for instance). This is returned - * instead of TREE_PREVISIT/TREE_POSTVISIT. - */ -#define TREE_REGULAR 1 -#define TREE_POSTDESCENT 2 -#define TREE_POSTASCENT 3 -#define TREE_ERROR_DIR -1 -int tree_next(struct tree *); - -int tree_errno(struct tree *); - -/* - * Request that current entry be visited. If you invoke it on every - * directory, you'll get a physical traversal. This is ignored if the - * current entry isn't a directory or a link to a directory. So, if - * you invoke this on every returned path, you'll get a full logical - * traversal. - */ -void tree_descend(struct tree *); - -/* - * Return information about the current entry. - */ - -int tree_current_depth(struct tree *); -/* - * The current full pathname, length of the full pathname, - * and a name that can be used to access the file. - * Because tree does use chdir extensively, the access path is - * almost never the same as the full current path. - */ -const char *tree_current_path(struct tree *); -size_t tree_current_pathlen(struct tree *); -const char *tree_current_access_path(struct tree *); -/* - * Request the lstat() or stat() data for the current path. Since the - * tree package needs to do some of this anyway, and caches the - * results, you should take advantage of it here if you need it rather - * than make a redundant stat() or lstat() call of your own. - */ -const struct stat *tree_current_stat(struct tree *); -const struct stat *tree_current_lstat(struct tree *); -/* The following tests may use mechanisms much faster than stat()/lstat(). */ -/* "is_physical_dir" is equivalent to S_ISDIR(tree_current_lstat()->st_mode) */ -int tree_current_is_physical_dir(struct tree *); -/* "is_physical_link" is equivalent to S_ISLNK(tree_current_lstat()->st_mode) */ -int tree_current_is_physical_link(struct tree *); -/* "is_dir" is equivalent to S_ISDIR(tree_current_stat()->st_mode) */ -int tree_current_is_dir(struct tree *); - -/* For testing/debugging: Dump the internal status to the given filehandle. */ -void tree_dump(struct tree *, FILE *); diff --git a/contrib/shar/tree_config.h b/contrib/shar/tree_config.h deleted file mode 100644 index 8dfd90baf685..000000000000 --- a/contrib/shar/tree_config.h +++ /dev/null @@ -1,78 +0,0 @@ -/*- - * 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$ - */ -#ifndef TREE_CONFIG_H_INCLUDED -#define TREE_CONFIG_H_INCLUDED - -#if defined(PLATFORM_CONFIG_H) -/* - * Use hand-built config.h in environments that need it. - */ -#include PLATFORM_CONFIG_H -#elif defined(HAVE_CONFIG_H) -/* - * Most POSIX platforms use the 'configure' script to build config.h - */ -#include "../config.h" -#elif defined(__FreeBSD__) -/* - * Built-in definitions for FreeBSD. - */ -#define HAVE_DIRENT_D_NAMLEN 1 -#define HAVE_DIRENT_H 1 -#define HAVE_ERRNO_H 1 -#define HAVE_FCNTL_H 1 -#define HAVE_LIBARCHIVE 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_UNISTD_H 1 -#else -/* - * Warn if there's no platform configuration. - */ -#error Oops: No config.h and no built-in configuration in bsdtar_platform.h. -#endif /* !HAVE_CONFIG_H */ - -/* No non-FreeBSD platform will have __FBSDID, so just define it here. */ -#ifdef __FreeBSD__ -#include /* For __FBSDID */ -#else -/* Just leaving this macro replacement empty leads to a dangling semicolon. */ -#define __FBSDID(a) struct _undefined_hack -#endif - -#ifdef HAVE_LIBARCHIVE -/* If we're using the platform libarchive, include system headers. */ -#include -#include -#else -/* Otherwise, include user headers. */ -#include "archive.h" -#include "archive_entry.h" -#endif - -#endif /* !TREE_CONFIG_H_INCLUDED */ diff --git a/contrib/untar.c b/contrib/untar.c deleted file mode 100644 index c4cc2bf9bea2..000000000000 --- a/contrib/untar.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * "untar" is an extremely simple tar extractor: - * * A single C source file, so it should be easy to compile - * and run on any system with a C compiler. - * * Extremely portable standard C. The only non-ANSI function - * used is mkdir(). - * * Reads basic ustar tar archives. - * * Does not require libarchive or any other special library. - * - * To compile: cc -o untar untar.c - * - * Usage: untar - * - * In particular, this program should be sufficient to extract the - * distribution for libarchive, allowing people to bootstrap - * libarchive on systems that do not already have a tar program. - * - * To unpack libarchive-x.y.z.tar.gz: - * * gunzip libarchive-x.y.z.tar.gz - * * untar libarchive-x.y.z.tar - * - * Written by Tim Kientzle, March 2009. - * - * Released into the public domain. - */ - -/* These are all highly standard and portable headers. */ -#include -#include -#include - -/* This is for mkdir(); this may need to be changed for some platforms. */ -#include /* For mkdir() */ - -/* Parse an octal number, ignoring leading and trailing nonsense. */ -static int -parseoct(const char *p, size_t n) -{ - int i = 0; - - while ((*p < '0' || *p > '7') && n > 0) { - ++p; - --n; - } - while (*p >= '0' && *p <= '7' && n > 0) { - i *= 8; - i += *p - '0'; - ++p; - --n; - } - return (i); -} - -/* Returns true if this is 512 zero bytes. */ -static int -is_end_of_archive(const char *p) -{ - int n; - for (n = 511; n >= 0; --n) - if (p[n] != '\0') - return (0); - return (1); -} - -/* Create a directory, including parent directories as necessary. */ -static void -create_dir(char *pathname, int mode) -{ - char *p; - int r; - - /* Strip trailing '/' */ - if (pathname[strlen(pathname) - 1] == '/') - pathname[strlen(pathname) - 1] = '\0'; - - /* Try creating the directory. */ - r = mkdir(pathname, mode); - - if (r != 0) { - /* On failure, try creating parent directory. */ - p = strrchr(pathname, '/'); - if (p != NULL) { - *p = '\0'; - create_dir(pathname, 0755); - *p = '/'; - r = mkdir(pathname, mode); - } - } - if (r != 0) - fprintf(stderr, "Could not create directory %s\n", pathname); -} - -/* Create a file, including parent directory as necessary. */ -static FILE * -create_file(char *pathname, int mode) -{ - FILE *f; - f = fopen(pathname, "w+"); - if (f == NULL) { - /* Try creating parent dir and then creating file. */ - char *p = strrchr(pathname, '/'); - if (p != NULL) { - *p = '\0'; - create_dir(pathname, 0755); - *p = '/'; - f = fopen(pathname, "w+"); - } - } - return (f); -} - -/* Verify the tar checksum. */ -static int -verify_checksum(const char *p) -{ - int n, u = 0; - for (n = 0; n < 512; ++n) { - if (n < 148 || n > 155) - /* Standard tar checksum adds unsigned bytes. */ - u += ((unsigned char *)p)[n]; - else - u += 0x20; - - } - return (u == parseoct(p + 148, 8)); -} - -/* Extract a tar archive. */ -static void -untar(FILE *a, const char *path) -{ - char buff[512]; - FILE *f = NULL; - size_t bytes_read; - int filesize; - - printf("Extracting from %s\n", path); - for (;;) { - bytes_read = fread(buff, 1, 512, a); - if (bytes_read < 512) { - fprintf(stderr, - "Short read on %s: expected 512, got %d\n", - path, (int)bytes_read); - return; - } - if (is_end_of_archive(buff)) { - printf("End of %s\n", path); - return; - } - if (!verify_checksum(buff)) { - fprintf(stderr, "Checksum failure\n"); - return; - } - filesize = parseoct(buff + 124, 12); - switch (buff[156]) { - case '1': - printf(" Ignoring hardlink %s\n", buff); - break; - case '2': - printf(" Ignoring symlink %s\n", buff); - break; - case '3': - printf(" Ignoring character device %s\n", buff); - break; - case '4': - printf(" Ignoring block device %s\n", buff); - break; - case '5': - printf(" Extracting dir %s\n", buff); - create_dir(buff, parseoct(buff + 100, 8)); - filesize = 0; - break; - case '6': - printf(" Ignoring FIFO %s\n", buff); - break; - default: - printf(" Extracting file %s\n", buff); - f = create_file(buff, parseoct(buff + 100, 8)); - break; - } - while (filesize > 0) { - bytes_read = fread(buff, 1, 512, a); - if (bytes_read < 512) { - fprintf(stderr, - "Short read on %s: Expected 512, got %d\n", - path, (int)bytes_read); - return; - } - if (filesize < 512) - bytes_read = filesize; - if (f != NULL) { - if (fwrite(buff, 1, bytes_read, f) - != bytes_read) - { - fprintf(stderr, "Failed write\n"); - fclose(f); - f = NULL; - } - } - filesize -= bytes_read; - } - if (f != NULL) { - fclose(f); - f = NULL; - } - } -} - -int -main(int argc, char **argv) -{ - FILE *a; - - ++argv; /* Skip program name */ - for ( ;*argv != NULL; ++argv) { - a = fopen(*argv, "r"); - if (a == NULL) - fprintf(stderr, "Unable to open %s\n", *argv); - else { - untar(a, *argv); - fclose(a); - } - } - return (0); -} diff --git a/cpio/CMakeLists.txt b/cpio/CMakeLists.txt deleted file mode 100644 index cc4aa14cb54b..000000000000 --- a/cpio/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -############################################ -# -# How to build bsdcpio -# -############################################ -IF(ENABLE_CPIO) - - SET(bsdcpio_SOURCES - cmdline.c - cpio.c - cpio.h - cpio_platform.h - ../libarchive_fe/err.c - ../libarchive_fe/err.h - ../libarchive_fe/lafe_platform.h - ../libarchive_fe/line_reader.c - ../libarchive_fe/line_reader.h - ) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe) - IF(WIN32 AND NOT CYGWIN) - LIST(APPEND bsdcpio_SOURCES cpio_windows.c) - LIST(APPEND bsdcpio_SOURCES cpio_windows.h) - ENDIF(WIN32 AND NOT CYGWIN) - - # bsdcpio documentation - SET(bsdcpio_MANS bsdcpio.1) - - # How to build bsdcpio - ADD_EXECUTABLE(bsdcpio ${bsdcpio_SOURCES}) - IF(ENABLE_CPIO_SHARED) - TARGET_LINK_LIBRARIES(bsdcpio archive ${ADDITIONAL_LIBS}) - ELSE(ENABLE_CPIO_SHARED) - TARGET_LINK_LIBRARIES(bsdcpio archive_static ${ADDITIONAL_LIBS}) - SET_TARGET_PROPERTIES(bsdcpio PROPERTIES COMPILE_DEFINITIONS - LIBARCHIVE_STATIC) - ENDIF(ENABLE_CPIO_SHARED) - # Full path to the compiled executable (used by test suite) - GET_TARGET_PROPERTY(BSDCPIO bsdcpio LOCATION) - - # Installation rules - INSTALL(TARGETS bsdcpio RUNTIME DESTINATION bin) - INSTALL_MAN(${bsdcpio_MANS}) - -ENDIF(ENABLE_CPIO) - -# Test suite -add_subdirectory(test) diff --git a/cpio/config_freebsd.h b/cpio/config_freebsd.h deleted file mode 100644 index 00c4c737f737..000000000000 --- a/cpio/config_freebsd.h +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * 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/cpio/config_freebsd.h,v 1.3 2008/12/06 07:30:40 kientzle Exp $ - */ - -/* A hand-tooled configuration for FreeBSD. */ - -#include /* __FreeBSD_version */ - -#define HAVE_DIRENT_H 1 -#define HAVE_ERRNO_H 1 -#define HAVE_FCNTL_H 1 -#define HAVE_FUTIMES 1 -#define HAVE_GRP_H 1 -#define HAVE_LIBARCHIVE 1 -#define HAVE_LINK 1 -#define HAVE_LSTAT 1 -#define HAVE_LUTIMES 1 -#define HAVE_PWD_H 1 -#define HAVE_READLINK 1 -#define HAVE_STDARG_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#define HAVE_SYMLINK 1 -#define HAVE_SYS_CDEFS_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TIME_H 1 -#define HAVE_TIME_H 1 -#define HAVE_UINTMAX_T 1 -#define HAVE_UNISTD_H 1 -#define HAVE_UNSIGNED_LONG_LONG 1 -#define HAVE_UTIME_H 1 -#define HAVE_UTIMES 1 - diff --git a/cpio/cpio_windows.c b/cpio/cpio_windows.c deleted file mode 100644 index 63f6df0397d2..000000000000 --- a/cpio/cpio_windows.c +++ /dev/null @@ -1,338 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * 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$ - */ - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#include "cpio_platform.h" -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_UTIME_H -#include -#endif -#include -#include -#include -#include -#include -#include - -#include "cpio.h" -#include "err.h" - -#define EPOC_TIME (116444736000000000ULL) - -static void cpio_dosmaperr(unsigned long); - -/* - * Prepend "\\?\" to the path name and convert it to unicode to permit - * an extended-length path for a maximum total path length of 32767 - * characters. - * see also http://msdn.microsoft.com/en-us/library/aa365247.aspx - */ -static wchar_t * -permissive_name(const char *name) -{ - wchar_t *wn, *wnp; - wchar_t *ws, *wsp; - DWORD l, len, slen, alloclen; - int unc; - - len = (DWORD)strlen(name); - wn = malloc((len + 1) * sizeof(wchar_t)); - if (wn == NULL) - return (NULL); - l = MultiByteToWideChar(CP_ACP, 0, name, len, wn, len); - if (l == 0) { - free(wn); - return (NULL); - } - wn[l] = L'\0'; - - /* Get a full path names */ - l = GetFullPathNameW(wn, 0, NULL, NULL); - if (l == 0) { - free(wn); - return (NULL); - } - wnp = malloc(l * sizeof(wchar_t)); - if (wnp == NULL) { - free(wn); - return (NULL); - } - len = GetFullPathNameW(wn, l, wnp, NULL); - free(wn); - wn = wnp; - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'?' && wnp[3] == L'\\') - /* We have already permissive names. */ - return (wn); - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'.' && wnp[3] == L'\\') { - /* Device names */ - if (((wnp[4] >= L'a' && wnp[4] <= L'z') || - (wnp[4] >= L'A' && wnp[4] <= L'Z')) && - wnp[5] == L':' && wnp[6] == L'\\') - wnp[2] = L'?';/* Not device names. */ - return (wn); - } - - unc = 0; - if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') { - wchar_t *p = &wnp[2]; - - /* Skip server-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\') { - wchar_t *rp = ++p; - /* Skip share-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\' && p != rp) { - /* Now, match patterns such as - * "\\server-name\share-name\" */ - wnp += 2; - len -= 2; - unc = 1; - } - } - } - - alloclen = slen = 4 + (unc * 4) + len + 1; - ws = wsp = malloc(slen * sizeof(wchar_t)); - if (ws == NULL) { - free(wn); - return (NULL); - } - /* prepend "\\?\" */ - wcsncpy(wsp, L"\\\\?\\", 4); - wsp += 4; - slen -= 4; - if (unc) { - /* append "UNC\" ---> "\\?\UNC\" */ - wcsncpy(wsp, L"UNC\\", 4); - wsp += 4; - slen -= 4; - } - wcsncpy(wsp, wnp, slen); - free(wn); - ws[alloclen - 1] = L'\0'; - return (ws); -} - -static HANDLE -cpio_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode, - LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, - DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) -{ - wchar_t *wpath; - HANDLE handle; - - handle = CreateFileA(path, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, - hTemplateFile); - if (handle != INVALID_HANDLE_VALUE) - return (handle); - if (GetLastError() != ERROR_PATH_NOT_FOUND) - return (handle); - wpath = permissive_name(path); - if (wpath == NULL) - return (handle); - handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, - hTemplateFile); - free(wpath); - return (handle); -} - -#define WINTIME(sec, usec) ((Int32x32To64(sec, 10000000) + EPOC_TIME) + (usec * 10)) -static int -__hutimes(HANDLE handle, const struct __timeval *times) -{ - ULARGE_INTEGER wintm; - FILETIME fatime, fmtime; - - wintm.QuadPart = WINTIME(times[0].tv_sec, times[0].tv_usec); - fatime.dwLowDateTime = wintm.LowPart; - fatime.dwHighDateTime = wintm.HighPart; - wintm.QuadPart = WINTIME(times[1].tv_sec, times[1].tv_usec); - fmtime.dwLowDateTime = wintm.LowPart; - fmtime.dwHighDateTime = wintm.HighPart; - if (SetFileTime(handle, NULL, &fatime, &fmtime) == 0) { - errno = EINVAL; - return (-1); - } - return (0); -} - -int -futimes(int fd, const struct __timeval *times) -{ - - return (__hutimes((HANDLE)_get_osfhandle(fd), times)); -} - -int -utimes(const char *name, const struct __timeval *times) -{ - int ret; - HANDLE handle; - - handle = cpio_CreateFile(name, GENERIC_READ | GENERIC_WRITE, - FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, NULL); - if (handle == INVALID_HANDLE_VALUE) { - cpio_dosmaperr(GetLastError()); - return (-1); - } - ret = __hutimes(handle, times); - CloseHandle(handle); - return (ret); -} - -/* - * The following function was modified from PostgreSQL sources and is - * subject to the copyright below. - */ -/*------------------------------------------------------------------------- - * - * win32error.c - * Map win32 error codes to errno values - * - * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - * - * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/win32error.c,v 1.4 2008/01/01 19:46:00 momjian Exp $ - * - *------------------------------------------------------------------------- - */ -/* -PostgreSQL Database Management System -(formerly known as Postgres, then as Postgres95) - -Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - -Portions Copyright (c) 1994, The Regents of the University of California - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose, without fee, and without a written agreement -is hereby granted, provided that the above copyright notice and this -paragraph and the following two paragraphs appear in all copies. - -IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR -DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING -LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS -DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO -PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -*/ - -static const struct { - DWORD winerr; - int doserr; -} doserrors[] = -{ - { ERROR_INVALID_FUNCTION, EINVAL }, - { ERROR_FILE_NOT_FOUND, ENOENT }, - { ERROR_PATH_NOT_FOUND, ENOENT }, - { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, - { ERROR_ACCESS_DENIED, EACCES }, - { ERROR_INVALID_HANDLE, EBADF }, - { ERROR_ARENA_TRASHED, ENOMEM }, - { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, - { ERROR_INVALID_BLOCK, ENOMEM }, - { ERROR_BAD_ENVIRONMENT, E2BIG }, - { ERROR_BAD_FORMAT, ENOEXEC }, - { ERROR_INVALID_ACCESS, EINVAL }, - { ERROR_INVALID_DATA, EINVAL }, - { ERROR_INVALID_DRIVE, ENOENT }, - { ERROR_CURRENT_DIRECTORY, EACCES }, - { ERROR_NOT_SAME_DEVICE, EXDEV }, - { ERROR_NO_MORE_FILES, ENOENT }, - { ERROR_LOCK_VIOLATION, EACCES }, - { ERROR_SHARING_VIOLATION, EACCES }, - { ERROR_BAD_NETPATH, ENOENT }, - { ERROR_NETWORK_ACCESS_DENIED, EACCES }, - { ERROR_BAD_NET_NAME, ENOENT }, - { ERROR_FILE_EXISTS, EEXIST }, - { ERROR_CANNOT_MAKE, EACCES }, - { ERROR_FAIL_I24, EACCES }, - { ERROR_INVALID_PARAMETER, EINVAL }, - { ERROR_NO_PROC_SLOTS, EAGAIN }, - { ERROR_DRIVE_LOCKED, EACCES }, - { ERROR_BROKEN_PIPE, EPIPE }, - { ERROR_DISK_FULL, ENOSPC }, - { ERROR_INVALID_TARGET_HANDLE, EBADF }, - { ERROR_INVALID_HANDLE, EINVAL }, - { ERROR_WAIT_NO_CHILDREN, ECHILD }, - { ERROR_CHILD_NOT_COMPLETE, ECHILD }, - { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, - { ERROR_NEGATIVE_SEEK, EINVAL }, - { ERROR_SEEK_ON_DEVICE, EACCES }, - { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, - { ERROR_NOT_LOCKED, EACCES }, - { ERROR_BAD_PATHNAME, ENOENT }, - { ERROR_MAX_THRDS_REACHED, EAGAIN }, - { ERROR_LOCK_FAILED, EACCES }, - { ERROR_ALREADY_EXISTS, EEXIST }, - { ERROR_FILENAME_EXCED_RANGE, ENOENT }, - { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, - { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } -}; - -static void -cpio_dosmaperr(unsigned long e) -{ - int i; - - if (e == 0) { - errno = 0; - return; - } - - for (i = 0; i < (int)sizeof(doserrors); i++) { - if (doserrors[i].winerr == e) { - errno = doserrors[i].doserr; - return; - } - } - - /* fprintf(stderr, "unrecognized win32 error code: %lu", e); */ - errno = EINVAL; - return; -} -#endif diff --git a/cpio/cpio_windows.h b/cpio/cpio_windows.h deleted file mode 100644 index 105bf69991de..000000000000 --- a/cpio/cpio_windows.h +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ -#ifndef CPIO_WINDOWS_H -#define CPIO_WINDOWS_H 1 - -#include -#include - -#define getgrgid(id) NULL -#define getgrnam(name) NULL -#define getpwnam(name) NULL -#define getpwuid(id) NULL - -#ifdef _MSC_VER -#define snprintf sprintf_s -#define strdup _strdup -#define open _open -#define read _read -#define close _close -#endif - -struct passwd { - char *pw_name; - uid_t pw_uid; - gid_t pw_gid; -}; - -struct group { - char *gr_name; - gid_t gr_gid; -}; - -struct _timeval64i32 { - time_t tv_sec; - long tv_usec; -}; -#define __timeval _timeval64i32 - -extern int futimes(int fd, const struct __timeval *times); -#ifndef HAVE_FUTIMES -#define HAVE_FUTIMES 1 -#endif -extern int utimes(const char *name, const struct __timeval *times); -#ifndef HAVE_UTIMES -#define HAVE_UTIMES 1 -#endif - -#endif /* CPIO_WINDOWS_H */ diff --git a/cpio/test/CMakeLists.txt b/cpio/test/CMakeLists.txt deleted file mode 100644 index 09ca2c7d96b3..000000000000 --- a/cpio/test/CMakeLists.txt +++ /dev/null @@ -1,93 +0,0 @@ -############################################ -# -# How to build bsdcpio_test -# -############################################ -IF(ENABLE_CPIO AND ENABLE_TEST) - SET(bsdcpio_test_SOURCES - ../cmdline.c - ../../libarchive_fe/err.c - ../../test_utils/test_utils.c - main.c - test.h - test_0.c - test_basic.c - test_cmdline.c - test_extract_cpio_Z - test_extract_cpio_bz2 - test_extract_cpio_grz - test_extract_cpio_gz - test_extract_cpio_lrz - test_extract_cpio_lz - test_extract_cpio_lzma - test_extract_cpio_lzo - test_extract_cpio_xz - test_format_newc.c - test_gcpio_compat.c - test_option_0.c - test_option_B_upper.c - test_option_C_upper.c - test_option_J_upper.c - test_option_L_upper.c - test_option_Z_upper.c - test_option_a.c - test_option_b64encode.c - test_option_c.c - test_option_d.c - test_option_f.c - test_option_grzip.c - test_option_help.c - test_option_l.c - test_option_lrzip.c - test_option_lzma.c - test_option_lzop.c - test_option_m.c - test_option_t.c - test_option_u.c - test_option_uuencode.c - test_option_version.c - test_option_xz.c - test_option_y.c - test_option_z.c - test_owner_parse.c - test_passthrough_dotdot.c - test_passthrough_reverse.c - ) - - # - # Register target - # - ADD_EXECUTABLE(bsdcpio_test ${bsdcpio_test_SOURCES}) - SET_PROPERTY(TARGET bsdcpio_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} ${bsdcpio_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 bsdcpio_${_testname} - COMMAND bsdcpio_test -vv - -p $ - -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(${CMAKE_SOURCE_DIR}/test_utils) - - # Experimental new test handling - ADD_CUSTOM_TARGET(run_bsdcpio_test - COMMAND bsdcpio_test -p ${BSDCPIO} -r ${CMAKE_CURRENT_SOURCE_DIR}) - ADD_DEPENDENCIES(run_bsdcpio_test bsdcpio) - ADD_DEPENDENCIES(run_all_tests run_bsdcpio_test) -ENDIF(ENABLE_CPIO AND ENABLE_TEST) - diff --git a/doc/html/.ignore_me b/doc/html/.ignore_me deleted file mode 100644 index d285484d4fee..000000000000 --- a/doc/html/.ignore_me +++ /dev/null @@ -1,2 +0,0 @@ -*** PLEASE DO NOT DELETE THIS FILE! *** -This file is used to track an otherwise empty directory in git. diff --git a/doc/man/.ignore_me b/doc/man/.ignore_me deleted file mode 100644 index d285484d4fee..000000000000 --- a/doc/man/.ignore_me +++ /dev/null @@ -1,2 +0,0 @@ -*** PLEASE DO NOT DELETE THIS FILE! *** -This file is used to track an otherwise empty directory in git. diff --git a/doc/mdoc2man.awk b/doc/mdoc2man.awk deleted file mode 100644 index 726f628c0d3f..000000000000 --- a/doc/mdoc2man.awk +++ /dev/null @@ -1,391 +0,0 @@ -#!/usr/bin/awk -# -# Copyright (c) 2003 Peter Stuge -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -# Dramatically overhauled by Tim Kientzle. This version almost -# handles library-style pages with Fn, Ft, etc commands. Still -# a lot of problems... - -BEGIN { - displaylines = 0 - trailer = "" - out = "" - sep = "" - nextsep = " " -} - -# Add a word with appropriate preceding whitespace -# Maintain a short queue of the expected upcoming word separators. -function add(str) { - out=out sep str - sep = nextsep - nextsep = " " -} - -# Add a word with no following whitespace -# Use for opening punctuation such as '(' -function addopen(str) { - add(str) - sep = "" -} - -# Add a word with no preceding whitespace -# Use for closing punctuation such as ')' or '.' -function addclose(str) { - sep = "" - add(str) -} - -# Add a word with no space before or after -# Use for separating punctuation such as '=' -function addpunct(str) { - sep = "" - add(str) - sep = "" -} - -# Emit the current line so far -function endline() { - addclose(trailer) - trailer = "" - if(length(out) > 0) { - print out - out="" - } - if(displaylines > 0) { - displaylines = displaylines - 1 - if (displaylines == 0) - dispend() - } - # First word on next line has no preceding whitespace - sep = "" -} - -function linecmd(cmd) { - endline() - add(cmd) - endline() -} - -function breakline() { - linecmd(".br") -} - -# Start an indented display -function dispstart() { - linecmd(".RS 4") -} - -# End an indented display -function dispend() { - linecmd(".RE") -} - -# Collect rest of input line -function wtail() { - retval="" - while(w 0) { - sub("^[ \t]*", "", l) - if (match(l, "^\"")) { - l = substr(l, 2) - o = index(l, "\"") - if (o > 0) { - w = substr(l, 1, o-1) - l = substr(l, o+1) - dest[n++] = w - } else { - dest[n++] = l - l = "" - } - } else { - o = match(l, "[ \t]") - if (o > 0) { - w = substr(l, 1, o-1) - l = substr(l, o+1) - dest[n++] = w - } else { - dest[n++] = l - l = "" - } - } - } - return n-1 -} - -! /^\./ { - out = $0 - endline() - next -} - -/^\.\\"/ { next } - -{ - sub("^\\.","") - nwords=splitwords($0, words) - # TODO: Instead of iterating 'w' over the array, have a separate - # function that returns 'next word' and use that. This will allow - # proper handling of double-quoted arguments as well. - for(w=1;w<=nwords;w++) { - if(match(words[w],"^Li$")) { # Literal; rest of line is unformatted - dispstart() - displaylines = 1 - } else if(match(words[w],"^Dl$")) { # Display literal - dispstart() - displaylines = 1 - } else if(match(words[w],"^Bd$")) { # Begin display - if(match(words[w+1],"-literal")) { - dispstart() - linecmd(".nf") - displaylines=10000 - w=nwords - } - } else if(match(words[w],"^Ed$")) { # End display - displaylines = 0 - dispend() - } else if(match(words[w],"^Ns$")) { # Suppress space after next word - nextsep = "" - } else if(match(words[w],"^No$")) { # Normal text - add(words[++w]) - } else if(match(words[w],"^Dq$")) { # Quote - addopen("``") - add(words[++w]) - while(w") - } else if(match(words[w],"^Dd$")) { - date=wtail() - next - } else if(match(words[w],"^Dt$")) { - id=wtail() - next - } else if(match(words[w],"^Ox$")) { - add("OpenBSD") - } else if(match(words[w],"^Fx$")) { - add("FreeBSD") - } else if(match(words[w],"^Nx$")) { - add("NetBSD") - } else if(match(words[w],"^St$")) { - if (match(words[w+1], "^-p1003.1$")) { - w++ - add("IEEE Std 1003.1 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-96$")) { - w++ - add("ISO/IEC 9945-1:1996 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-88$")) { - w++ - add("IEEE Std 1003.1-1988 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-2001$")) { - w++ - add("IEEE Std 1003.1-2001 (``POSIX.1'')") - } else if(match(words[w+1], "^-susv2$")) { - w++ - add("Version 2 of the Single UNIX Specification (``SUSv2'')") - } - } else if(match(words[w],"^Ex$")) { - if (match(words[w+1], "^-std$")) { - w++ - add("The \\fB" name "\\fP utility exits 0 on success, and >0 if an error occurs.") - } - } else if(match(words[w],"^Os$")) { - add(".TH " id " \"" date "\" \"" wtail() "\"") - } else if(match(words[w],"^Sh$")) { - section=wtail() - add(".SH " section) - linecmd(".ad l") - } else if(match(words[w],"^Xr$")) { - add("\\fB" words[++w] "\\fP(" words[++w] ")" words[++w]) - } else if(match(words[w],"^Nm$")) { - if(match(section,"SYNOPSIS")) - breakline() - if(w >= nwords) - n=name - else if (match(words[w+1], "^[A-Z][a-z]$")) - n=name - else if (match(words[w+1], "^[.,;:]$")) - n=name - else { - n=words[++w] - if(!length(name)) - name=n - } - if(!length(n)) - n=name - add("\\fB\\%" n "\\fP") - } else if(match(words[w],"^Nd$")) { - add("\\- " wtail()) - } else if(match(words[w],"^Fl$")) { - add("\\fB\\-" words[++w] "\\fP") - } else if(match(words[w],"^Ar$")) { - addopen("\\fI") - if(w==nwords) - add("file ...\\fP") - else - add(words[++w] "\\fP") - } else if(match(words[w],"^Cm$")) { - add("\\fB" words[++w] "\\fP") - } else if(match(words[w],"^Op$")) { - addopen("[") - option=1 - trailer="]" trailer - } else if(match(words[w],"^Pp$")) { - linecmd(".PP") - } else if(match(words[w],"^An$")) { - endline() - } else if(match(words[w],"^Ss$")) { - add(".SS") - } else if(match(words[w],"^Ft$")) { - if (match(section, "SYNOPSIS")) { - breakline() - } - add("\\fI" wtail() "\\fP") - if (match(section, "SYNOPSIS")) { - breakline() - } - } else if(match(words[w],"^Fn$")) { - ++w - F = "\\fB\\%" words[w] "\\fP(" - Fsep = "" - while(w\\fP") - } else if(match(words[w],"^Pa$")) { - addopen("\\fI") - w++ - if(match(words[w],"^\\.")) - add("\\&") - add(words[w] "\\fP") - } else if(match(words[w],"^Dv$")) { - add(".BR") - } else if(match(words[w],"^Em|Ev$")) { - add(".IR") - } else if(match(words[w],"^Pq$")) { - addopen("(") - trailer=")" trailer - } else if(match(words[w],"^Aq$")) { - addopen("\\%<") - trailer=">" trailer - } else if(match(words[w],"^Brq$")) { - addopen("{") - trailer="}" trailer - } else if(match(words[w],"^S[xy]$")) { - add(".B " wtail()) - } else if(match(words[w],"^Ic$")) { - add("\\fB") - trailer="\\fP" trailer - } else if(match(words[w],"^Bl$")) { - oldoptlist=optlist - linecmd(".RS 5") - if(match(words[w+1],"-bullet")) - optlist=1 - else if(match(words[w+1],"-enum")) { - optlist=2 - enum=0 - } else if(match(words[w+1],"-tag")) - optlist=3 - else if(match(words[w+1],"-item")) - optlist=4 - else if(match(words[w+1],"-bullet")) - optlist=1 - w=nwords - } else if(match(words[w],"^El$")) { - linecmd(".RE") - optlist=oldoptlist - } else if(match(words[w],"^It$")&&optlist) { - if(optlist==1) - add(".IP \\(bu") - else if(optlist==2) - add(".IP " ++enum ".") - else if(optlist==3) { - add(".TP") - endline() - if(match(words[w+1],"^Pa$|^Ev$")) { - add(".B") - w++ - } - } else if(optlist==4) - add(".IP") - } else if(match(words[w],"^Xo$")) { - # TODO: Figure out how to handle this - } else if(match(words[w],"^Xc$")) { - # TODO: Figure out how to handle this - } else if(match(words[w],"^[=]$")) { - addpunct(words[w]) - } else if(match(words[w],"^[[{(]$")) { - addopen(words[w]) - } else if(match(words[w],"^[\\])}.,;:]$")) { - addclose(words[w]) - } else { - add(words[w]) - } - } - if(match(out,"^\\.[^a-zA-Z]")) - sub("^\\.","",out) - endline() -} diff --git a/doc/mdoc2wiki.awk b/doc/mdoc2wiki.awk deleted file mode 100644 index 5fee29c32952..000000000000 --- a/doc/mdoc2wiki.awk +++ /dev/null @@ -1,451 +0,0 @@ -#!/usr/bin/awk -# -# Copyright (c) 2003 Peter Stuge -# -# Permission to use, copy, modify, and distribute this software for any -# purpose with or without fee is hereby granted, provided that the above -# copyright notice and this permission notice appear in all copies. -# -# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -# Dramatically overhauled by Tim Kientzle. This version almost -# handles library-style pages with Fn, Ft, etc commands. Still -# a lot of problems... - -BEGIN { - displaylines = 0 - listdepth = 0 - trailer = "" - out = "" - sep = "" - nextsep = " " - spaces = " " - - NORMAL_STATE = 0 - PRETAG_STATE = 1 - STATE = NORMAL_STATE -} - -# Add a word with appropriate preceding whitespace -# Maintain a short queue of the expected upcoming word separators. -function add(str) { - out=out sep str - sep = nextsep - nextsep = " " -} - -# Add a word with no following whitespace -# Use for opening punctuation such as '(' -function addopen(str) { - add(str) - sep = "" -} - -# Add a word with no preceding whitespace -# Use for closing punctuation such as ')' or '.' -function addclose(str) { - sep = "" - add(str) -} - -# Add a word with no space before or after -# Use for separating punctuation such as '=' -function addpunct(str) { - sep = "" - add(str) - sep = "" -} - -# Emit the current line so far -function endline() { - addclose(trailer) - trailer = "" - if(length(out) > 0) { - if (STATE == PRETAG_STATE) { - print out - } else { - print out " " - } - out="" - } - if(displaylines > 0) { - displaylines = displaylines - 1 - if (displaylines == 0) - dispend() - } - # First word on next line has no preceding whitespace - sep = "" -} - -function linecmd(cmd) { - endline() - add(cmd) - endline() -} - -function breakline() { - linecmd("
") -} - -# Start an indented display -function dispstart() { - linecmd("```text") -} - -# End an indented display -function dispend() { - linecmd("```") -} - -# Collect rest of input line -function wtail() { - retval="" - while(w 0) { - sub("^[ \t]*", "", l) - if (match(l, "^\"")) { - l = substr(l, 2) - o = index(l, "\"") - if (o > 0) { - w = substr(l, 1, o-1) - l = substr(l, o+1) - dest[n++] = w - } else { - dest[n++] = l - l = "" - } - } else { - o = match(l, "[ \t]") - if (o > 0) { - w = substr(l, 1, o-1) - l = substr(l, o+1) - dest[n++] = w - } else { - dest[n++] = l - l = "" - } - } - } - return n-1 -} - -! /^\./ { - out = $0 - endline() - next -} - -/^\.\\"/ { next } - -{ - sub("^\\.","") - nwords=splitwords($0, words) - # TODO: Instead of iterating 'w' over the array, have a separate - # function that returns 'next word' and use that. This will allow - # proper handling of double-quoted arguments as well. - for(w=1;w<=nwords;w++) { - if(match(words[w],"^Li$")) { # Literal; rest of line is unformatted - dispstart() - displaylines = 1 - } else if(match(words[w],"^Dl$")) { # Display literal - dispstart() - displaylines = 1 - } else if(match(words[w],"^Bd$")) { # Begin display - STATE = PRETAG_STATE - if(match(words[w+1],"-literal")) { - dispstart() - displaylines=10000 - w=nwords - } - } else if(match(words[w],"^Ed$")) { # End display - displaylines = 0 - dispend() - STATE = NORMAL_STATE - } else if(match(words[w],"^Ns$")) { # Suppress space before next word - sep="" - } else if(match(words[w],"^No$")) { # Normal text - add(words[++w]) - } else if(match(words[w],"^Dq$")) { # Quote - addopen("\"") - add(words[++w]) - while(w[") - } else if(match(words[w],"^Oc$")) { - addclose("]") - } else if(match(words[w],"^Ao$")) { - addopen("<") - } else if(match(words[w],"^Ac$")) { - addclose(">") - } else if(match(words[w],"^Dd$")) { - date=wtail() - next - } else if(match(words[w],"^Dt$")) { - id=words[++w] "(" words[++w] ")" - next - } else if(match(words[w],"^Ox$")) { - add("OpenBSD") - } else if(match(words[w],"^Fx$")) { - add("FreeBSD") - } else if(match(words[w],"^Bx$")) { - add("BSD") - } else if(match(words[w],"^Nx$")) { - add("NetBSD") - } else if(match(words[w],"^St$")) { - if (match(words[w+1], "^-p1003.1$")) { - w++ - add("IEEE Std 1003.1 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-96$")) { - w++ - add("ISO/IEC 9945-1:1996 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-88$")) { - w++ - add("IEEE Std 1003.1-1988 (``POSIX.1'')") - } else if(match(words[w+1], "^-p1003.1-2001$")) { - w++ - add("IEEE Std 1003.1-2001 (``POSIX.1'')") - } else if(match(words[w+1], "^-susv2$")) { - w++ - add("Version 2 of the Single UNIX Specification (``SUSv2'')") - } - } else if(match(words[w],"^Ex$")) { - if (match(words[w+1], "^-std$")) { - w++ - add("The '''" name "''' utility exits 0 on success, and >0 if an error occurs.") - } - } else if(match(words[w],"^Os$")) { - add(id " manual page") - } else if(match(words[w],"^Sh$")) { - section=wtail() - linecmd("== " section " ==") - } else if(match(words[w],"^Xr$")) { - add("'''" words[++w] "'''(" words[++w] ")" words[++w]) - } else if(match(words[w],"^Nm$")) { - if(match(section,"SYNOPSIS")) - breakline() - if(w >= nwords) - n=name - else if (match(words[w+1], "^[A-Z][a-z]$")) - n=name - else if (match(words[w+1], "^[.,;:]$")) - n=name - else { - n=words[++w] - if(!length(name)) - name=n - } - if(!length(n)) - n=name - if (displaylines == 0) - add("'''" n "'''") - else - add(n) - } else if(match(words[w],"^Nd$")) { - add("- " wtail()) - } else if(match(words[w],"^Fl$")) { - addopen("-") - } else if(match(words[w],"^Ar$")) { - if(w==nwords) - add("''file ...''") - else { - ++w - gsub("<", "<", words[w]) - add("''" words[w] "''") - } - } else if(match(words[w],"^Cm$")) { - ++w - if (displaylines == 0) { - add("'''" words[w] "'''") - } else - add(words[w]) - } else if(match(words[w],"^Op$")) { - addopen("[") - option=1 - trailer="]" trailer - } else if(match(words[w],"^Pp$")) { - ++w - endline() - print "" - } else if(match(words[w],"^An$")) { - if (match(words[w+1],"-nosplit")) - ++w - endline() - } else if(match(words[w],"^Ss$")) { - add("===") - trailer="===" - } else if(match(words[w],"^Ft$")) { - if (match(section, "SYNOPSIS")) { - breakline() - } - l = wtail() - add("'''" l "'''") - if (match(section, "SYNOPSIS")) { - breakline() - } - } else if(match(words[w],"^Fn$")) { - ++w - F = "'''" words[w] "'''(" - Fsep = "" - while(w#include <" words[w] ">'''") - } else if(match(words[w],"^Pa$")) { - w++ -# if(match(words[w],"^\\.")) -# add("\\&") - if (displaylines == 0) - add("''" words[w] "''") - else - add(words[w]) - } else if(match(words[w],"^Dv$")) { - linecmd() - } else if(match(words[w],"^Em|Ev$")) { - add(".IR") - } else if(match(words[w],"^Pq$")) { - addopen("(") - trailer=")" trailer - } else if(match(words[w],"^Aq$")) { - addopen(" <") - trailer=">" trailer - } else if(match(words[w],"^Brq$")) { - addopen("{") - trailer="}" trailer - } else if(match(words[w],"^S[xy]$")) { - add(".B " wtail()) - } else if(match(words[w],"^Tn$")) { - n=wtail() - add("'''" n "'''") - } else if(match(words[w],"^Ic$")) { - add("''") - trailer="''" trailer - } else if(match(words[w],"^Bl$")) { - ++listdepth - listnext[listdepth]="" - if(match(words[w+1],"-bullet")) { - optlist[listdepth]=1 - addopen("
    ") - listclose[listdepth]="
" - } else if(match(words[w+1],"-enum")) { - optlist[listdepth]=2 - enum=0 - addopen("
    ") - listclose[listdepth]="
" - } else if(match(words[w+1],"-tag")) { - optlist[listdepth]=3 - addopen("
") - listclose[listdepth]="
" - } else if(match(words[w+1],"-item")) { - optlist[listdepth]=4 - addopen("
    ") - listclose[listdepth]="
" - } - w=nwords - } else if(match(words[w],"^El$")) { - addclose(listnext[listdepth]) - addclose(listclose[listdepth]) - listclose[listdepth]="" - listdepth-- - } else if(match(words[w],"^It$")) { - addclose(listnext[listdepth]) - if(optlist[listdepth]==1) { - addpunct("
  • ") - listnext[listdepth] = "
  • " - } else if(optlist[listdepth]==2) { - addpunct("
  • ") - listnext[listdepth] = "
  • " - } else if(optlist[listdepth]==3) { - addpunct("
    ") - listnext[listdepth] = "
    " - if(match(words[w+1],"^Xo$")) { - # Suppress trailer - w++ - } else if(match(words[w+1],"^Pa$|^Ev$")) { - addopen("'''") - w++ - add(words[++w] "'''") - } else { - trailer = listnext[listdepth] "
    " trailer - listnext[listdepth] = "
    " - } - } else if(optlist[listdepth]==4) { - addpunct("
  • ") - listnext[listdepth] = "
  • " - } - } else if(match(words[w], "^Vt$")) { - w++ - add("''" words[w] "''") - } else if(match(words[w],"^Xo$")) { - # TODO: Figure out how to handle this - } else if(match(words[w],"^Xc$")) { - # TODO: Figure out how to handle this - if (optlist[listdepth] == 3) { - addclose(listnext[listdepth]) - addopen("
    ") - listnext[listdepth] = "
    " - } - } else if(match(words[w],"^[=]$")) { - addpunct(words[w]) - } else if(match(words[w],"^[[{(]$")) { - addopen(words[w]) - } else if(match(words[w],"^[\\])}.,;:]$")) { - addclose(words[w]) - } else { - sub("\\\\&", "", words[w]) - add(words[w]) - } - } - if(match(out,"^\\.[^a-zA-Z]")) - sub("^\\.","",out) - endline() -} diff --git a/doc/pdf/.ignore_me b/doc/pdf/.ignore_me deleted file mode 100644 index d285484d4fee..000000000000 --- a/doc/pdf/.ignore_me +++ /dev/null @@ -1,2 +0,0 @@ -*** PLEASE DO NOT DELETE THIS FILE! *** -This file is used to track an otherwise empty directory in git. diff --git a/doc/text/.ignore_me b/doc/text/.ignore_me deleted file mode 100644 index d285484d4fee..000000000000 --- a/doc/text/.ignore_me +++ /dev/null @@ -1,2 +0,0 @@ -*** PLEASE DO NOT DELETE THIS FILE! *** -This file is used to track an otherwise empty directory in git. diff --git a/doc/update.sh b/doc/update.sh deleted file mode 100644 index 1038da133f77..000000000000 --- a/doc/update.sh +++ /dev/null @@ -1,119 +0,0 @@ -#!/bin/sh - -set -e - -# -# Simple script to repopulate the 'doc' tree from -# the mdoc man pages stored in each project. -# - -# Collect list of man pages, relative to my subdirs -test -d man || mkdir man -cd man -MANPAGES=`for d in libarchive tar cpio;do ls ../../$d/*.[135];done | grep -v '\.so\.'` -cd .. - -# Build Makefile in 'man' directory -cd man -chmod +w . -rm -f *.[135] Makefile -echo > Makefile -echo "default: all" >>Makefile -echo >>Makefile -all="all:" -for f in $MANPAGES; do - outname="`basename $f`" - echo >> Makefile - echo $outname: ../mdoc2man.awk $f >> Makefile - echo " awk -f ../mdoc2man.awk < $f > $outname" >> Makefile - all="$all $outname" -done -echo $all >>Makefile -cd .. - -# Rebuild Makefile in 'text' directory -test -d text || mkdir text -cd text -chmod +w . -rm -f *.txt Makefile -echo > Makefile -echo "default: all" >>Makefile -echo >>Makefile -all="all:" -for f in $MANPAGES; do - outname="`basename $f`.txt" - echo >> Makefile - echo $outname: $f >> Makefile - echo " nroff -mdoc $f | col -b > $outname" >> Makefile - all="$all $outname" -done -echo $all >>Makefile -cd .. - -# Rebuild Makefile in 'pdf' directory -test -d pdf || mkdir pdf -cd pdf -chmod +w . -rm -f *.pdf Makefile -echo > Makefile -echo "default: all" >>Makefile -echo >>Makefile -all="all:" -for f in $MANPAGES; do - outname="`basename $f`.pdf" - echo >> Makefile - echo $outname: $f >> Makefile - echo " groff -mdoc -T ps $f | ps2pdf - - > $outname" >> Makefile - all="$all $outname" -done -echo $all >>Makefile -cd .. - -# Build Makefile in 'html' directory -test -d html || mkdir html -cd html -chmod +w . -rm -f *.html Makefile -echo > Makefile -echo "default: all" >>Makefile -echo >>Makefile -all="all:" -for f in $MANPAGES; do - outname="`basename $f`.html" - echo >> Makefile - echo $outname: $f >> Makefile - echo " groff -mdoc -T html $f > $outname" >> Makefile - all="$all $outname" -done -echo $all >>Makefile -cd .. - -# Build Makefile in 'wiki' directory -test -d wiki || mkdir wiki -cd wiki -chmod +w . -rm -f *.wiki Makefile -echo > Makefile -echo "default: all" >>Makefile -echo >>Makefile -all="all:" -for f in $MANPAGES; do - outname="`basename $f | awk '{ac=split($0,a,"[_.-]");o="ManPage";for(w=0;w<=ac;++w){o=o toupper(substr(a[w],1,1)) substr(a[w],2)};print o}'`.wiki" - echo >> Makefile - echo $outname: ../mdoc2wiki.awk $f >> Makefile - echo " awk -f ../mdoc2wiki.awk < $f > $outname" >> Makefile - all="$all $outname" -done -echo $all >>Makefile -cd .. - -# Convert all of the manpages to -man format -(cd man && make) -# Format all of the manpages to text -(cd text && make) -# Format all of the manpages to PDF -(cd pdf && make) -# Format all of the manpages to HTML -(cd html && make) -# Format all of the manpages to wiki syntax -(cd wiki && make) diff --git a/doc/wiki/.ignore_me b/doc/wiki/.ignore_me deleted file mode 100644 index d285484d4fee..000000000000 --- a/doc/wiki/.ignore_me +++ /dev/null @@ -1,2 +0,0 @@ -*** PLEASE DO NOT DELETE THIS FILE! *** -This file is used to track an otherwise empty directory in git. diff --git a/examples/minitar/Makefile b/examples/minitar/Makefile deleted file mode 100644 index 1ec4593df66b..000000000000 --- a/examples/minitar/Makefile +++ /dev/null @@ -1,26 +0,0 @@ - -# -# Adjust the following to control which options minitar gets -# built with. See comments in minitar.c for details. -# -CFLAGS= \ - -DNO_BZIP2_CREATE \ - -I../../libarchive \ - -g - -# How to link against libarchive. -LIBARCHIVE= ../../libarchive/libarchive.a - -all: minitar - -minitar: minitar.o - cc -g -o minitar minitar.o $(LIBARCHIVE) -lz -lbz2 - strip minitar - ls -l minitar - -minitar.o: minitar.c - -clean:: - rm -f *.o - rm -f minitar - rm -f *~ diff --git a/examples/minitar/README b/examples/minitar/README deleted file mode 100644 index 83f646cdb313..000000000000 --- a/examples/minitar/README +++ /dev/null @@ -1,12 +0,0 @@ -"minitar" is a minimal example of a program that uses libarchive to -read/write various archive formats. It's a more ambitious version of -'untar.c' that includes compile-time options to enable/disable various -features, including non-tar formats, archive creation, and automatic -decompression support. - -I use this as a test bed to check for "link pollution," ensuring that -a program using libarchive does not pull in unnecessary code. - -The "minitar" program is also a good starting point for anyone who -wants to use libarchive for their own purposes, as it demonstrates -basic usage of the library. diff --git a/examples/minitar/minitar.c b/examples/minitar/minitar.c deleted file mode 100644 index 0ff6263ebf84..000000000000 --- a/examples/minitar/minitar.c +++ /dev/null @@ -1,458 +0,0 @@ -/*- - * This file is in the public domain. - * Do with it as you will. - */ - -/*- - * This is a compact "tar" program whose primary goal is small size. - * Statically linked, it can be very small indeed. This serves a number - * of goals: - * o a testbed for libarchive (to check for link pollution), - * o a useful tool for space-constrained systems (boot floppies, etc), - * o a place to experiment with new implementation ideas for bsdtar, - * o a small program to demonstrate libarchive usage. - * - * Use the following macros to suppress features: - * NO_BZIP2 - Implies NO_BZIP2_CREATE and NO_BZIP2_EXTRACT - * NO_BZIP2_CREATE - Suppress bzip2 compression support. - * NO_BZIP2_EXTRACT - Suppress bzip2 auto-detection and decompression. - * NO_COMPRESS - Implies NO_COMPRESS_CREATE and NO_COMPRESS_EXTRACT - * NO_COMPRESS_CREATE - Suppress compress(1) compression support - * NO_COMPRESS_EXTRACT - Suppress compress(1) auto-detect and decompression. - * NO_CREATE - Suppress all archive creation support. - * NO_CPIO_EXTRACT - Suppress auto-detect and dearchiving of cpio archives. - * NO_GZIP - Implies NO_GZIP_CREATE and NO_GZIP_EXTRACT - * NO_GZIP_CREATE - Suppress gzip compression support. - * NO_GZIP_EXTRACT - Suppress gzip auto-detection and decompression. - * NO_LOOKUP - Try to avoid getpw/getgr routines, which can be very large - * NO_TAR_EXTRACT - Suppress tar extraction - * - * With all of the above macros defined (except NO_TAR_EXTRACT), you - * get a very small program that can recognize and extract essentially - * any uncompressed tar archive. On FreeBSD 5.1, this minimal program - * is under 64k, statically linked, which compares rather favorably to - * main(){printf("hello, world");} - * which is over 60k statically linked on the same operating system. - * Without any of the above macros, you get a static executable of - * about 180k with a lot of very sophisticated modern features. - * Obviously, it's trivial to add support for ISO, Zip, mtree, - * lzma/xz, etc. Just fill in the appropriate setup calls. - */ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -/* - * NO_CREATE implies NO_BZIP2_CREATE and NO_GZIP_CREATE and NO_COMPRESS_CREATE. - */ -#ifdef NO_CREATE -#undef NO_BZIP2_CREATE -#define NO_BZIP2_CREATE -#undef NO_COMPRESS_CREATE -#define NO_COMPRESS_CREATE -#undef NO_GZIP_CREATE -#define NO_GZIP_CREATE -#endif - -/* - * The combination of NO_BZIP2_CREATE and NO_BZIP2_EXTRACT is - * equivalent to NO_BZIP2. - */ -#ifdef NO_BZIP2_CREATE -#ifdef NO_BZIP2_EXTRACT -#undef NO_BZIP2 -#define NO_BZIP2 -#endif -#endif - -#ifdef NO_BZIP2 -#undef NO_BZIP2_EXTRACT -#define NO_BZIP2_EXTRACT -#undef NO_BZIP2_CREATE -#define NO_BZIP2_CREATE -#endif - -/* - * The combination of NO_COMPRESS_CREATE and NO_COMPRESS_EXTRACT is - * equivalent to NO_COMPRESS. - */ -#ifdef NO_COMPRESS_CREATE -#ifdef NO_COMPRESS_EXTRACT -#undef NO_COMPRESS -#define NO_COMPRESS -#endif -#endif - -#ifdef NO_COMPRESS -#undef NO_COMPRESS_EXTRACT -#define NO_COMPRESS_EXTRACT -#undef NO_COMPRESS_CREATE -#define NO_COMPRESS_CREATE -#endif - -/* - * The combination of NO_GZIP_CREATE and NO_GZIP_EXTRACT is - * equivalent to NO_GZIP. - */ -#ifdef NO_GZIP_CREATE -#ifdef NO_GZIP_EXTRACT -#undef NO_GZIP -#define NO_GZIP -#endif -#endif - -#ifdef NO_GZIP -#undef NO_GZIP_EXTRACT -#define NO_GZIP_EXTRACT -#undef NO_GZIP_CREATE -#define NO_GZIP_CREATE -#endif - -#ifndef NO_CREATE -static void create(const char *filename, int compress, const char **argv); -#endif -static void errmsg(const char *); -static void extract(const char *filename, int do_extract, int flags); -static int copy_data(struct archive *, struct archive *); -static void msg(const char *); -static void usage(void); - -static int verbose = 0; - -int -main(int argc, const char **argv) -{ - const char *filename = NULL; - int compress, flags, mode, opt; - - (void)argc; - mode = 'x'; - verbose = 0; - compress = '\0'; - flags = ARCHIVE_EXTRACT_TIME; - - /* Among other sins, getopt(3) pulls in printf(3). */ - while (*++argv != NULL && **argv == '-') { - const char *p = *argv + 1; - - while ((opt = *p++) != '\0') { - switch (opt) { -#ifndef NO_CREATE - case 'c': - mode = opt; - break; -#endif - case 'f': - if (*p != '\0') - filename = p; - else - filename = *++argv; - p += strlen(p); - break; -#ifndef NO_BZIP2_CREATE - case 'j': - compress = opt; - break; -#endif - case 'p': - flags |= ARCHIVE_EXTRACT_PERM; - flags |= ARCHIVE_EXTRACT_ACL; - flags |= ARCHIVE_EXTRACT_FFLAGS; - break; - case 't': - mode = opt; - break; - case 'v': - verbose++; - break; - case 'x': - mode = opt; - break; -#ifndef NO_BZIP2_CREATE - case 'y': - compress = opt; - break; -#endif -#ifndef NO_COMPRESS_CREATE - case 'Z': - compress = opt; - break; -#endif -#ifndef NO_GZIP_CREATE - case 'z': - compress = opt; - break; -#endif - default: - usage(); - } - } - } - - switch (mode) { -#ifndef NO_CREATE - case 'c': - create(filename, compress, argv); - break; -#endif - case 't': - extract(filename, 0, flags); - break; - case 'x': - extract(filename, 1, flags); - break; - } - - return (0); -} - - -#ifndef NO_CREATE -static char buff[16384]; - -static void -create(const char *filename, int compress, const char **argv) -{ - struct archive *a; - struct archive *disk; - struct archive_entry *entry; - ssize_t len; - int fd; - - a = archive_write_new(); - switch (compress) { -#ifndef NO_BZIP2_CREATE - case 'j': case 'y': - archive_write_add_filter_bzip2(a); - break; -#endif -#ifndef NO_COMPRESS_CREATE - case 'Z': - archive_write_add_filter_compress(a); - break; -#endif -#ifndef NO_GZIP_CREATE - case 'z': - archive_write_add_filter_gzip(a); - break; -#endif - default: - archive_write_add_filter_none(a); - break; - } - archive_write_set_format_ustar(a); - if (strcmp(filename, "-") == 0) - filename = NULL; - archive_write_open_filename(a, filename); - - disk = archive_read_disk_new(); -#ifndef NO_LOOKUP - archive_read_disk_set_standard_lookup(disk); -#endif - while (*argv != NULL) { - struct archive *disk = archive_read_disk_new(); - int r; - - r = archive_read_disk_open(disk, *argv); - if (r != ARCHIVE_OK) { - errmsg(archive_error_string(disk)); - errmsg("\n"); - exit(1); - } - - for (;;) { - int needcr = 0; - - entry = archive_entry_new(); - r = archive_read_next_header2(disk, entry); - if (r == ARCHIVE_EOF) - break; - if (r != ARCHIVE_OK) { - errmsg(archive_error_string(disk)); - errmsg("\n"); - exit(1); - } - archive_read_disk_descend(disk); - if (verbose) { - msg("a "); - msg(archive_entry_pathname(entry)); - needcr = 1; - } - r = archive_write_header(a, entry); - if (r < ARCHIVE_OK) { - errmsg(": "); - errmsg(archive_error_string(a)); - needcr = 1; - } - if (r == ARCHIVE_FATAL) - exit(1); - if (r > ARCHIVE_FAILED) { -#if 0 - /* Ideally, we would be able to use - * the same code to copy a body from - * an archive_read_disk to an - * archive_write that we use for - * copying data from an archive_read - * to an archive_write_disk. - * Unfortunately, this doesn't quite - * work yet. */ - copy_data(disk, a); -#else - /* For now, we use a simpler loop to copy data - * into the target archive. */ - fd = open(archive_entry_sourcepath(entry), O_RDONLY); - len = read(fd, buff, sizeof(buff)); - while (len > 0) { - archive_write_data(a, buff, len); - len = read(fd, buff, sizeof(buff)); - } - close(fd); -#endif - } - archive_entry_free(entry); - if (needcr) - msg("\n"); - } - archive_read_close(disk); - archive_read_free(disk); - argv++; - } - archive_write_close(a); - archive_write_free(a); -} -#endif - -static void -extract(const char *filename, int do_extract, int flags) -{ - struct archive *a; - struct archive *ext; - struct archive_entry *entry; - int r; - - a = archive_read_new(); - ext = archive_write_disk_new(); - archive_write_disk_set_options(ext, flags); -#ifndef NO_BZIP2_EXTRACT - archive_read_support_filter_bzip2(a); -#endif -#ifndef NO_GZIP_EXTRACT - archive_read_support_filter_gzip(a); -#endif -#ifndef NO_COMPRESS_EXTRACT - archive_read_support_filter_compress(a); -#endif -#ifndef NO_TAR_EXTRACT - archive_read_support_format_tar(a); -#endif -#ifndef NO_CPIO_EXTRACT - archive_read_support_format_cpio(a); -#endif -#ifndef NO_LOOKUP - archive_write_disk_set_standard_lookup(ext); -#endif - if (filename != NULL && strcmp(filename, "-") == 0) - filename = NULL; - if ((r = archive_read_open_filename(a, filename, 10240))) { - errmsg(archive_error_string(a)); - errmsg("\n"); - exit(r); - } - for (;;) { - r = archive_read_next_header(a, &entry); - if (r == ARCHIVE_EOF) - break; - if (r != ARCHIVE_OK) { - errmsg(archive_error_string(a)); - errmsg("\n"); - exit(1); - } - if (verbose && do_extract) - msg("x "); - if (verbose || !do_extract) - msg(archive_entry_pathname(entry)); - if (do_extract) { - r = archive_write_header(ext, entry); - if (r != ARCHIVE_OK) - errmsg(archive_error_string(a)); - else - copy_data(a, ext); - } - if (verbose || !do_extract) - msg("\n"); - } - archive_read_close(a); - archive_read_free(a); - exit(0); -} - -static int -copy_data(struct archive *ar, struct archive *aw) -{ - int r; - const void *buff; - size_t size; - off_t offset; - - for (;;) { - r = archive_read_data_block(ar, &buff, &size, &offset); - if (r == ARCHIVE_EOF) { - errmsg(archive_error_string(ar)); - return (ARCHIVE_OK); - } - if (r != ARCHIVE_OK) - return (r); - r = archive_write_data_block(aw, buff, size, offset); - if (r != ARCHIVE_OK) { - errmsg(archive_error_string(ar)); - return (r); - } - } -} - -static void -msg(const char *m) -{ - write(1, m, strlen(m)); -} - -static void -errmsg(const char *m) -{ - write(2, m, strlen(m)); -} - -static void -usage(void) -{ -/* Many program options depend on compile options. */ - const char *m = "Usage: minitar [-" -#ifndef NO_CREATE - "c" -#endif -#ifndef NO_BZIP2 - "j" -#endif - "tvx" -#ifndef NO_BZIP2 - "y" -#endif -#ifndef NO_COMPRESS - "Z" -#endif -#ifndef NO_GZIP - "z" -#endif - "] [-f file] [file]\n"; - - errmsg(m); - exit(1); -} diff --git a/examples/tarfilter.c b/examples/tarfilter.c deleted file mode 100644 index 0d323e1cb2cb..000000000000 --- a/examples/tarfilter.c +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is in the public domain. - * - * Feel free to use it as you wish. - */ - -/* - * This example program reads an archive from stdin (which can be in - * any format recognized by libarchive) and writes certain entries to - * an uncompressed ustar archive on stdout. This is a template for - * many kinds of archive manipulation: converting formats, resetting - * ownership, inserting entries, removing entries, etc. - * - * To compile: - * gcc -Wall -o tarfilter tarfilter.c -larchive -lz -lbz2 - */ - -#include -#include -#include -#include -#include -#include - -static void -die(char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - vfprintf(stderr, fmt, ap); - va_end(ap); - fprintf(stderr, "\n"); - exit(1); -} - -int -main(int argc, char **argv) -{ - char buff[8192]; - ssize_t len; - int r; - mode_t m; - struct archive *ina; - struct archive *outa; - struct archive_entry *entry; - - /* Read an archive from stdin, with automatic format detection. */ - ina = archive_read_new(); - if (ina == NULL) - die("Couldn't create archive reader."); - if (archive_read_support_filter_all(ina) != ARCHIVE_OK) - die("Couldn't enable decompression"); - if (archive_read_support_format_all(ina) != ARCHIVE_OK) - die("Couldn't enable read formats"); - if (archive_read_open_fd(ina, 0, 10240) != ARCHIVE_OK) - die("Couldn't open input archive"); - - /* Write an uncompressed ustar archive to stdout. */ - outa = archive_write_new(); - if (outa == NULL) - die("Couldn't create archive writer."); - if (archive_write_set_compression_none(outa) != ARCHIVE_OK) - die("Couldn't enable compression"); - if (archive_write_set_format_ustar(outa) != ARCHIVE_OK) - die("Couldn't set output format"); - if (archive_write_open_fd(outa, 1) != ARCHIVE_OK) - die("Couldn't open output archive"); - - /* Examine each entry in the input archive. */ - while ((r = archive_read_next_header(ina, &entry)) == ARCHIVE_OK) { - fprintf(stderr, "%s: ", archive_entry_pathname(entry)); - - /* Skip anything that isn't a regular file. */ - if (!S_ISREG(archive_entry_mode(entry))) { - fprintf(stderr, "skipped\n"); - continue; - } - - /* Make everything owned by root/wheel. */ - archive_entry_set_uid(entry, 0); - archive_entry_set_uname(entry, "root"); - archive_entry_set_gid(entry, 0); - archive_entry_set_gname(entry, "wheel"); - - /* Make everything permission 0744, strip SUID, etc. */ - m = archive_entry_mode(entry); - archive_entry_set_mode(entry, (m & ~07777) | 0744); - - /* Copy input entries to output archive. */ - if (archive_write_header(outa, entry) != ARCHIVE_OK) - die("Error writing output archive"); - if (archive_entry_size(entry) > 0) { - len = archive_read_data(ina, buff, sizeof(buff)); - while (len > 0) { - if (archive_write_data(outa, buff, len) != len) - die("Error writing output archive"); - len = archive_read_data(ina, buff, sizeof(buff)); - } - if (len < 0) - die("Error reading input archive"); - } - fprintf(stderr, "copied\n"); - } - if (r != ARCHIVE_EOF) - die("Error reading archive"); - /* Close the archives. */ - if (archive_read_free(ina) != ARCHIVE_OK) - die("Error closing input archive"); - if (archive_write_free(outa) != ARCHIVE_OK) - die("Error closing output archive"); - return (0); -} diff --git a/examples/untar.c b/examples/untar.c deleted file mode 100644 index b22d8361a012..000000000000 --- a/examples/untar.c +++ /dev/null @@ -1,266 +0,0 @@ -/* - * This file is in the public domain. - * Use it as you wish. - */ - -/* - * This is a compact tar extraction program using libarchive whose - * primary goal is small executable size. Statically linked, it can - * be very small, depending in large part on how cleanly factored your - * system libraries are. Note that this uses the standard libarchive, - * without any special recompilation. The only functional concession - * is that this program uses the uid/gid from the archive instead of - * doing uname/gname lookups. (Add a call to - * archive_write_disk_set_standard_lookup() to enable uname/gname - * lookups, but be aware that this can add 500k or more to a static - * executable, depending on the system libraries, since user/group - * lookups frequently pull in password, YP/LDAP, networking, and DNS - * resolver libraries.) - * - * To build: - * $ gcc -static -Wall -o untar untar.c -larchive - * $ strip untar - * - * NOTE: On some systems, you may need to add additional flags - * to ensure that untar.c is compiled the same way as libarchive - * was compiled. In particular, Linux users will probably - * have to add -D_FILE_OFFSET_BITS=64 to the command line above. - * - * For fun, statically compile the following simple hello.c program - * using the same flags as for untar and compare the size: - * - * #include - * int main(int argc, char **argv) { - * printf("hello, world\n"); - * return(0); - * } - * - * You may be even more surprised by the compiled size of true.c listed here: - * - * int main(int argc, char **argv) { - * return (0); - * } - * - * On a slightly customized FreeBSD 5 system that I used around - * 2005, hello above compiled to 89k compared to untar of 69k. So at - * that time, libarchive's tar reader and extract-to-disk routines - * compiled to less code than printf(). - * - * On my FreeBSD development system today (August, 2009): - * hello: 195024 bytes - * true: 194912 bytes - * untar: 259924 bytes - */ - -#include -__FBSDID("$FreeBSD$"); - -#include - -#include -#include -#include -#include -#include -#include -#include - -static void errmsg(const char *); -static void extract(const char *filename, int do_extract, int flags); -static void fail(const char *, const char *, int); -static int copy_data(struct archive *, struct archive *); -static void msg(const char *); -static void usage(void); -static void warn(const char *, const char *); - -static int verbose = 0; - -int -main(int argc, const char **argv) -{ - const char *filename = NULL; - int compress, flags, mode, opt; - - (void)argc; - mode = 'x'; - verbose = 0; - compress = '\0'; - flags = ARCHIVE_EXTRACT_TIME; - - /* Among other sins, getopt(3) pulls in printf(3). */ - while (*++argv != NULL && **argv == '-') { - const char *p = *argv + 1; - - while ((opt = *p++) != '\0') { - switch (opt) { - case 'f': - if (*p != '\0') - filename = p; - else - filename = *++argv; - p += strlen(p); - break; - case 'p': - flags |= ARCHIVE_EXTRACT_PERM; - flags |= ARCHIVE_EXTRACT_ACL; - flags |= ARCHIVE_EXTRACT_FFLAGS; - break; - case 't': - mode = opt; - break; - case 'v': - verbose++; - break; - case 'x': - mode = opt; - break; - default: - usage(); - } - } - } - - switch (mode) { - case 't': - extract(filename, 0, flags); - break; - case 'x': - extract(filename, 1, flags); - break; - } - - return (0); -} - - -static void -extract(const char *filename, int do_extract, int flags) -{ - struct archive *a; - struct archive *ext; - struct archive_entry *entry; - int r; - - a = archive_read_new(); - ext = archive_write_disk_new(); - archive_write_disk_set_options(ext, flags); - /* - * Note: archive_write_disk_set_standard_lookup() is useful - * here, but it requires library routines that can add 500k or - * more to a static executable. - */ - archive_read_support_format_tar(a); - /* - * On my system, enabling other archive formats adds 20k-30k - * each. Enabling gzip decompression adds about 20k. - * Enabling bzip2 is more expensive because the libbz2 library - * isn't very well factored. - */ - if (filename != NULL && strcmp(filename, "-") == 0) - filename = NULL; - if ((r = archive_read_open_filename(a, filename, 10240))) - fail("archive_read_open_filename()", - archive_error_string(a), r); - for (;;) { - r = archive_read_next_header(a, &entry); - if (r == ARCHIVE_EOF) - break; - if (r != ARCHIVE_OK) - fail("archive_read_next_header()", - archive_error_string(a), 1); - if (verbose && do_extract) - msg("x "); - if (verbose || !do_extract) - msg(archive_entry_pathname(entry)); - if (do_extract) { - r = archive_write_header(ext, entry); - if (r != ARCHIVE_OK) - warn("archive_write_header()", - archive_error_string(ext)); - else { - copy_data(a, ext); - r = archive_write_finish_entry(ext); - if (r != ARCHIVE_OK) - fail("archive_write_finish_entry()", - archive_error_string(ext), 1); - } - - } - if (verbose || !do_extract) - msg("\n"); - } - archive_read_close(a); - archive_read_free(a); - exit(0); -} - -static int -copy_data(struct archive *ar, struct archive *aw) -{ - int r; - const void *buff; - size_t size; -#if ARCHIVE_VERSION >= 3000000 - int64_t offset; -#else - off_t offset; -#endif - - for (;;) { - r = archive_read_data_block(ar, &buff, &size, &offset); - if (r == ARCHIVE_EOF) - return (ARCHIVE_OK); - if (r != ARCHIVE_OK) - return (r); - r = archive_write_data_block(aw, buff, size, offset); - if (r != ARCHIVE_OK) { - warn("archive_write_data_block()", - archive_error_string(aw)); - return (r); - } - } -} - -/* - * These reporting functions use low-level I/O; on some systems, this - * is a significant code reduction. Of course, on many server and - * desktop operating systems, malloc() and even crt rely on printf(), - * which in turn pulls in most of the rest of stdio, so this is not an - * optimization at all there. (If you're going to pay 100k or more - * for printf() anyway, you may as well use it!) - */ -static void -msg(const char *m) -{ - write(1, m, strlen(m)); -} - -static void -errmsg(const char *m) -{ - write(2, m, strlen(m)); -} - -static void -warn(const char *f, const char *m) -{ - errmsg(f); - errmsg(" failed: "); - errmsg(m); - errmsg("\n"); -} - -static void -fail(const char *f, const char *m, int r) -{ - warn(f, m); - exit(r); -} - -static void -usage(void) -{ - const char *m = "Usage: untar [-tvx] [-f file] [file]\n"; - errmsg(m); - exit(1); -} diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt deleted file mode 100644 index ecb0409bd9d8..000000000000 --- a/libarchive/CMakeLists.txt +++ /dev/null @@ -1,193 +0,0 @@ - -############################################ -# -# How to build libarchive -# -############################################ - -# Public headers -SET(include_HEADERS - archive.h - archive_entry.h -) - -# Sources and private headers -SET(libarchive_SOURCES - archive_acl.c - archive_check_magic.c - archive_cmdline.c - archive_cmdline_private.h - archive_crc32.h - archive_crypto.c - archive_crypto_private.h - archive_endian.h - archive_entry.c - archive_entry.h - archive_entry_copy_stat.c - archive_entry_link_resolver.c - archive_entry_locale.h - archive_entry_private.h - archive_entry_sparse.c - archive_entry_stat.c - archive_entry_strmode.c - archive_entry_xattr.c - archive_getdate.c - archive_match.c - archive_options.c - archive_options_private.h - archive_pathmatch.c - archive_pathmatch.h - archive_platform.h - archive_ppmd_private.h - archive_ppmd7.c - archive_ppmd7_private.h - archive_private.h - archive_rb.c - archive_rb.h - archive_read.c - archive_read_append_filter.c - archive_read_data_into_fd.c - archive_read_disk_entry_from_file.c - archive_read_disk_posix.c - archive_read_disk_private.h - archive_read_disk_set_standard_lookup.c - archive_read_extract.c - archive_read_open_fd.c - archive_read_open_file.c - archive_read_open_filename.c - archive_read_open_memory.c - archive_read_private.h - archive_read_set_format.c - archive_read_set_options.c - archive_read_support_filter_all.c - archive_read_support_filter_bzip2.c - archive_read_support_filter_compress.c - archive_read_support_filter_gzip.c - archive_read_support_filter_grzip.c - archive_read_support_filter_lrzip.c - archive_read_support_filter_lzop.c - archive_read_support_filter_none.c - archive_read_support_filter_program.c - archive_read_support_filter_rpm.c - archive_read_support_filter_uu.c - archive_read_support_filter_xz.c - archive_read_support_format_7zip.c - archive_read_support_format_all.c - archive_read_support_format_ar.c - archive_read_support_format_by_code.c - archive_read_support_format_cab.c - archive_read_support_format_cpio.c - archive_read_support_format_empty.c - archive_read_support_format_iso9660.c - archive_read_support_format_lha.c - archive_read_support_format_mtree.c - archive_read_support_format_rar.c - archive_read_support_format_raw.c - archive_read_support_format_tar.c - archive_read_support_format_xar.c - archive_read_support_format_zip.c - archive_string.c - archive_string.h - archive_string_composition.h - archive_string_sprintf.c - archive_util.c - archive_virtual.c - archive_write.c - archive_write_disk_acl.c - archive_write_disk_posix.c - archive_write_disk_private.h - archive_write_disk_set_standard_lookup.c - archive_write_private.h - archive_write_open_fd.c - archive_write_open_file.c - archive_write_open_filename.c - archive_write_open_memory.c - archive_write_add_filter.c - archive_write_add_filter_b64encode.c - archive_write_add_filter_by_name.c - archive_write_add_filter_bzip2.c - archive_write_add_filter_compress.c - archive_write_add_filter_grzip.c - archive_write_add_filter_gzip.c - archive_write_add_filter_lrzip.c - archive_write_add_filter_lzop.c - archive_write_add_filter_none.c - archive_write_add_filter_program.c - archive_write_add_filter_uuencode.c - archive_write_add_filter_xz.c - archive_write_set_format.c - archive_write_set_format_7zip.c - archive_write_set_format_ar.c - archive_write_set_format_by_name.c - archive_write_set_format_cpio.c - archive_write_set_format_cpio_newc.c - archive_write_set_format_gnutar.c - archive_write_set_format_iso9660.c - archive_write_set_format_mtree.c - archive_write_set_format_pax.c - archive_write_set_format_shar.c - archive_write_set_format_ustar.c - archive_write_set_format_v7tar.c - archive_write_set_format_xar.c - archive_write_set_format_zip.c - archive_write_set_options.c - filter_fork_posix.c - filter_fork.h -) - -# Man pages -SET(libarchive_MANS - archive_entry.3 - archive_entry_acl.3 - archive_entry_linkify.3 - archive_entry_paths.3 - archive_entry_perms.3 - archive_entry_stat.3 - archive_entry_time.3 - archive_read.3 - archive_read_disk.3 - archive_read_set_options.3 - archive_util.3 - archive_write.3 - archive_write_disk.3 - archive_write_set_options.3 - cpio.5 - libarchive.3 - libarchive_internals.3 - libarchive-formats.5 - mtree.5 - tar.5 -) - -IF(WIN32 AND NOT CYGWIN) - LIST(APPEND libarchive_SOURCES archive_entry_copy_bhfi.c) - LIST(APPEND libarchive_SOURCES archive_read_disk_windows.c) - LIST(APPEND libarchive_SOURCES archive_windows.c) - LIST(APPEND libarchive_SOURCES archive_windows.h) - LIST(APPEND libarchive_SOURCES archive_write_disk_windows.c) - LIST(APPEND libarchive_SOURCES filter_fork_windows.c) -ENDIF(WIN32 AND NOT CYGWIN) - -# Libarchive is a shared library -ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) -TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) -SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) - -# archive_static is a static library -ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) -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) - SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) -ENDIF(NOT WIN32 OR CYGWIN) - -# How to install the libraries -INSTALL(TARGETS archive archive_static - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) -INSTALL_MAN(${libarchive_MANS}) -INSTALL(FILES ${include_HEADERS} DESTINATION include) - -add_subdirectory(test) diff --git a/libarchive/archive_entry_copy_bhfi.c b/libarchive/archive_entry_copy_bhfi.c deleted file mode 100644 index 77bf38e450f2..000000000000 --- a/libarchive/archive_entry_copy_bhfi.c +++ /dev/null @@ -1,75 +0,0 @@ -/*- - * 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 "archive_platform.h" -__FBSDID("$FreeBSD$"); - -#include "archive_private.h" -#include "archive_entry.h" - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000) - -__inline static void -fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns) -{ - ULARGE_INTEGER utc; - - utc.HighPart = filetime->dwHighDateTime; - utc.LowPart = filetime->dwLowDateTime; - if (utc.QuadPart >= EPOC_TIME) { - utc.QuadPart -= EPOC_TIME; - *t = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */ - *ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */ - } else { - *t = 0; - *ns = 0; - } -} - -void -archive_entry_copy_bhfi(struct archive_entry *entry, - BY_HANDLE_FILE_INFORMATION *bhfi) -{ - time_t secs; - long nsecs; - - fileTimeToUtc(&bhfi->ftLastAccessTime, &secs, &nsecs); - archive_entry_set_atime(entry, secs, nsecs); - fileTimeToUtc(&bhfi->ftLastWriteTime, &secs, &nsecs); - archive_entry_set_mtime(entry, secs, nsecs); - fileTimeToUtc(&bhfi->ftCreationTime, &secs, &nsecs); - archive_entry_set_birthtime(entry, secs, nsecs); - archive_entry_set_ctime(entry, secs, nsecs); - archive_entry_set_dev(entry, bhfi->dwVolumeSerialNumber); - archive_entry_set_ino64(entry, (((int64_t)bhfi->nFileIndexHigh) << 32) - + bhfi->nFileIndexLow); - archive_entry_set_nlink(entry, bhfi->nNumberOfLinks); - archive_entry_set_size(entry, (((int64_t)bhfi->nFileSizeHigh) << 32) - + bhfi->nFileSizeLow); - /* archive_entry_set_mode(entry, st->st_mode); */ -} -#endif diff --git a/libarchive/archive_read_disk_windows.c b/libarchive/archive_read_disk_windows.c deleted file mode 100644 index 9c5420d80e77..000000000000 --- a/libarchive/archive_read_disk_windows.c +++ /dev/null @@ -1,2296 +0,0 @@ -/*- - * Copyright (c) 2003-2009 Tim Kientzle - * Copyright (c) 2010-2012 Michihiro NAKAJIMA - * 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 "archive_platform.h" -__FBSDID("$FreeBSD$"); - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#ifdef HAVE_ERRNO_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#include - -#include "archive.h" -#include "archive_string.h" -#include "archive_entry.h" -#include "archive_private.h" -#include "archive_read_disk_private.h" - -#ifndef O_BINARY -#define O_BINARY 0 -#endif -#ifndef IO_REPARSE_TAG_SYMLINK -/* Old SDKs do not provide IO_REPARSE_TAG_SYMLINK */ -#define IO_REPARSE_TAG_SYMLINK 0xA000000CL -#endif - -/*- - * This is a new directory-walking system that addresses a number - * of problems I've had with fts(3). In particular, it has no - * pathname-length limits (other than the size of 'int'), handles - * deep logical traversals, uses considerably less memory, and has - * an opaque interface (easier to modify in the future). - * - * Internally, it keeps a single list of "tree_entry" items that - * represent filesystem objects that require further attention. - * Non-directories are not kept in memory: they are pulled from - * readdir(), returned to the client, then freed as soon as possible. - * Any directory entry to be traversed gets pushed onto the stack. - * - * There is surprisingly little information that needs to be kept for - * each item on the stack. Just the name, depth (represented here as the - * string length of the parent directory's pathname), and some markers - * indicating how to get back to the parent (via chdir("..") for a - * regular dir or via fchdir(2) for a symlink). - */ - -struct restore_time { - const wchar_t *full_path; - FILETIME lastWriteTime; - FILETIME lastAccessTime; - mode_t filetype; -}; - -struct tree_entry { - int depth; - struct tree_entry *next; - struct tree_entry *parent; - size_t full_path_dir_length; - struct archive_wstring name; - struct archive_wstring full_path; - size_t dirname_length; - int64_t dev; - int64_t ino; - int flags; - int filesystem_id; - /* How to restore time of a directory. */ - struct restore_time restore_time; -}; - -struct filesystem { - int64_t dev; - int synthetic; - int remote; - DWORD bytesPerSector; -}; - -/* Definitions for tree_entry.flags bitmap. */ -#define isDir 1 /* This entry is a regular directory. */ -#define isDirLink 2 /* This entry is a symbolic link to a directory. */ -#define needsFirstVisit 4 /* This is an initial entry. */ -#define needsDescent 8 /* This entry needs to be previsited. */ -#define needsOpen 16 /* This is a directory that needs to be opened. */ -#define needsAscent 32 /* This entry needs to be postvisited. */ - -/* - * On Windows, "first visit" is handled as a pattern to be handed to - * _findfirst(). This is consistent with Windows conventions that - * file patterns are handled within the application. On Posix, - * "first visit" is just returned to the client. - */ - -#define MAX_OVERLAPPED 8 -#define BUFFER_SIZE (1024 * 8) -#define DIRECT_IO 0/* Disabled */ -#define ASYNC_IO 1/* Enabled */ - -/* - * Local data for this package. - */ -struct tree { - struct tree_entry *stack; - struct tree_entry *current; - HANDLE d; - WIN32_FIND_DATAW _findData; - WIN32_FIND_DATAW *findData; - int flags; - int visit_type; - /* Error code from last failed operation. */ - int tree_errno; - - /* A full path with "\\?\" prefix. */ - struct archive_wstring full_path; - size_t full_path_dir_length; - /* Dynamically-sized buffer for holding path */ - struct archive_wstring path; - - /* Last path element */ - const wchar_t *basename; - /* Leading dir length */ - size_t dirname_length; - - int depth; - - BY_HANDLE_FILE_INFORMATION lst; - BY_HANDLE_FILE_INFORMATION st; - int descend; - /* How to restore time of a file. */ - struct restore_time restore_time; - - struct entry_sparse { - int64_t length; - int64_t offset; - } *sparse_list, *current_sparse; - int sparse_count; - int sparse_list_size; - - char initial_symlink_mode; - char symlink_mode; - struct filesystem *current_filesystem; - struct filesystem *filesystem_table; - int initial_filesystem_id; - int current_filesystem_id; - int max_filesystem_id; - int allocated_filesytem; - - HANDLE entry_fh; - int entry_eof; - int64_t entry_remaining_bytes; - int64_t entry_total; - - int ol_idx_doing; - int ol_idx_done; - int ol_num_doing; - int ol_num_done; - int64_t ol_remaining_bytes; - int64_t ol_total; - struct la_overlapped { - OVERLAPPED ol; - struct archive * _a; - unsigned char *buff; - size_t buff_size; - int64_t offset; - size_t bytes_expected; - size_t bytes_transferred; - } ol[MAX_OVERLAPPED]; - int direct_io; - int async_io; -}; - -#define bhfi_dev(bhfi) ((bhfi)->dwVolumeSerialNumber) -/* Treat FileIndex as i-node. We should remove a sequence number - * which is high-16-bits of nFileIndexHigh. */ -#define bhfi_ino(bhfi) \ - ((((int64_t)((bhfi)->nFileIndexHigh & 0x0000FFFFUL)) << 32) \ - + (bhfi)->nFileIndexLow) - -/* Definitions for tree.flags bitmap. */ -#define hasStat 16 /* The st entry is valid. */ -#define hasLstat 32 /* The lst entry is valid. */ -#define needsRestoreTimes 128 - -static int -tree_dir_next_windows(struct tree *t, const wchar_t *pattern); - -/* Initiate/terminate a tree traversal. */ -static struct tree *tree_open(const wchar_t *, int, int); -static struct tree *tree_reopen(struct tree *, const wchar_t *, int); -static void tree_close(struct tree *); -static void tree_free(struct tree *); -static void tree_push(struct tree *, const wchar_t *, const wchar_t *, - int, int64_t, int64_t, struct restore_time *); - -/* - * tree_next() returns Zero if there is no next entry, non-zero if - * there is. Note that directories are visited three times. - * Directories are always visited first as part of enumerating their - * parent; that is a "regular" visit. If tree_descend() is invoked at - * that time, the directory is added to a work list and will - * subsequently be visited two more times: once just after descending - * into the directory ("postdescent") and again just after ascending - * back to the parent ("postascent"). - * - * TREE_ERROR_DIR is returned if the descent failed (because the - * directory couldn't be opened, for instance). This is returned - * instead of TREE_POSTDESCENT/TREE_POSTASCENT. TREE_ERROR_DIR is not a - * fatal error, but it does imply that the relevant subtree won't be - * visited. TREE_ERROR_FATAL is returned for an error that left the - * traversal completely hosed. Right now, this is only returned for - * chdir() failures during ascent. - */ -#define TREE_REGULAR 1 -#define TREE_POSTDESCENT 2 -#define TREE_POSTASCENT 3 -#define TREE_ERROR_DIR -1 -#define TREE_ERROR_FATAL -2 - -static int tree_next(struct tree *); - -/* - * Return information about the current entry. - */ - -/* - * The current full pathname, length of the full pathname, and a name - * that can be used to access the file. Because tree does use chdir - * extensively, the access path is almost never the same as the full - * current path. - * - */ -static const wchar_t *tree_current_path(struct tree *); -static const wchar_t *tree_current_access_path(struct tree *); - -/* - * Request the lstat() or stat() data for the current path. Since the - * tree package needs to do some of this anyway, and caches the - * results, you should take advantage of it here if you need it rather - * than make a redundant stat() or lstat() call of your own. - */ -static const BY_HANDLE_FILE_INFORMATION *tree_current_stat(struct tree *); -static const BY_HANDLE_FILE_INFORMATION *tree_current_lstat(struct tree *); - -/* The following functions use tricks to avoid a certain number of - * stat()/lstat() calls. */ -/* "is_physical_dir" is equivalent to S_ISDIR(tree_current_lstat()->st_mode) */ -static int tree_current_is_physical_dir(struct tree *); -/* "is_physical_link" is equivalent to S_ISLNK(tree_current_lstat()->st_mode) */ -static int tree_current_is_physical_link(struct tree *); -/* Instead of archive_entry_copy_stat for BY_HANDLE_FILE_INFORMATION */ -static void tree_archive_entry_copy_bhfi(struct archive_entry *, - struct tree *, const BY_HANDLE_FILE_INFORMATION *); -/* "is_dir" is equivalent to S_ISDIR(tree_current_stat()->st_mode) */ -static int tree_current_is_dir(struct tree *); -static int update_current_filesystem(struct archive_read_disk *a, - int64_t dev); -static int setup_current_filesystem(struct archive_read_disk *); -static int tree_target_is_same_as_parent(struct tree *, - const BY_HANDLE_FILE_INFORMATION *); - -static int _archive_read_disk_open_w(struct archive *, const wchar_t *); -static int _archive_read_free(struct archive *); -static int _archive_read_close(struct archive *); -static int _archive_read_data_block(struct archive *, - const void **, size_t *, int64_t *); -static int _archive_read_next_header2(struct archive *, - struct archive_entry *); -static const char *trivial_lookup_gname(void *, int64_t gid); -static const char *trivial_lookup_uname(void *, int64_t uid); -static int setup_sparse(struct archive_read_disk *, struct archive_entry *); -static int close_and_restore_time(HANDLE, struct tree *, - struct restore_time *); -static int setup_sparse_from_disk(struct archive_read_disk *, - struct archive_entry *, HANDLE); - - - -static struct archive_vtable * -archive_read_disk_vtable(void) -{ - static struct archive_vtable av; - static int inited = 0; - - if (!inited) { - av.archive_free = _archive_read_free; - av.archive_close = _archive_read_close; - av.archive_read_data_block = _archive_read_data_block; - av.archive_read_next_header2 = _archive_read_next_header2; - inited = 1; - } - return (&av); -} - -const char * -archive_read_disk_gname(struct archive *_a, int64_t gid) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_read_disk_gname")) - return (NULL); - if (a->lookup_gname == NULL) - return (NULL); - return ((*a->lookup_gname)(a->lookup_gname_data, gid)); -} - -const char * -archive_read_disk_uname(struct archive *_a, int64_t uid) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_read_disk_uname")) - return (NULL); - if (a->lookup_uname == NULL) - return (NULL); - return ((*a->lookup_uname)(a->lookup_uname_data, uid)); -} - -int -archive_read_disk_set_gname_lookup(struct archive *_a, - void *private_data, - const char * (*lookup_gname)(void *private, int64_t gid), - void (*cleanup_gname)(void *private)) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - archive_check_magic(&a->archive, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_read_disk_set_gname_lookup"); - - if (a->cleanup_gname != NULL && a->lookup_gname_data != NULL) - (a->cleanup_gname)(a->lookup_gname_data); - - a->lookup_gname = lookup_gname; - a->cleanup_gname = cleanup_gname; - a->lookup_gname_data = private_data; - return (ARCHIVE_OK); -} - -int -archive_read_disk_set_uname_lookup(struct archive *_a, - void *private_data, - const char * (*lookup_uname)(void *private, int64_t uid), - void (*cleanup_uname)(void *private)) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - archive_check_magic(&a->archive, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_read_disk_set_uname_lookup"); - - if (a->cleanup_uname != NULL && a->lookup_uname_data != NULL) - (a->cleanup_uname)(a->lookup_uname_data); - - a->lookup_uname = lookup_uname; - a->cleanup_uname = cleanup_uname; - a->lookup_uname_data = private_data; - return (ARCHIVE_OK); -} - -/* - * Create a new archive_read_disk object and initialize it with global state. - */ -struct archive * -archive_read_disk_new(void) -{ - struct archive_read_disk *a; - - a = (struct archive_read_disk *)malloc(sizeof(*a)); - if (a == NULL) - return (NULL); - memset(a, 0, sizeof(*a)); - a->archive.magic = ARCHIVE_READ_DISK_MAGIC; - a->archive.state = ARCHIVE_STATE_NEW; - a->archive.vtable = archive_read_disk_vtable(); - a->lookup_uname = trivial_lookup_uname; - a->lookup_gname = trivial_lookup_gname; - a->enable_copyfile = 1; - a->traverse_mount_points = 1; - return (&a->archive); -} - -static int -_archive_read_free(struct archive *_a) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - int r; - - if (_a == NULL) - return (ARCHIVE_OK); - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_read_free"); - - if (a->archive.state != ARCHIVE_STATE_CLOSED) - r = _archive_read_close(&a->archive); - else - r = ARCHIVE_OK; - - tree_free(a->tree); - if (a->cleanup_gname != NULL && a->lookup_gname_data != NULL) - (a->cleanup_gname)(a->lookup_gname_data); - if (a->cleanup_uname != NULL && a->lookup_uname_data != NULL) - (a->cleanup_uname)(a->lookup_uname_data); - archive_string_free(&a->archive.error_string); - a->archive.magic = 0; - free(a); - return (r); -} - -static int -_archive_read_close(struct archive *_a) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_read_close"); - - if (a->archive.state != ARCHIVE_STATE_FATAL) - a->archive.state = ARCHIVE_STATE_CLOSED; - - tree_close(a->tree); - - return (ARCHIVE_OK); -} - -static void -setup_symlink_mode(struct archive_read_disk *a, char symlink_mode, - int follow_symlinks) -{ - a->symlink_mode = symlink_mode; - a->follow_symlinks = follow_symlinks; - if (a->tree != NULL) { - a->tree->initial_symlink_mode = a->symlink_mode; - a->tree->symlink_mode = a->symlink_mode; - } -} - -int -archive_read_disk_set_symlink_logical(struct archive *_a) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_read_disk_set_symlink_logical"); - setup_symlink_mode(a, 'L', 1); - return (ARCHIVE_OK); -} - -int -archive_read_disk_set_symlink_physical(struct archive *_a) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_read_disk_set_symlink_physical"); - setup_symlink_mode(a, 'P', 0); - return (ARCHIVE_OK); -} - -int -archive_read_disk_set_symlink_hybrid(struct archive *_a) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_read_disk_set_symlink_hybrid"); - setup_symlink_mode(a, 'H', 1);/* Follow symlinks initially. */ - return (ARCHIVE_OK); -} - -int -archive_read_disk_set_atime_restored(struct archive *_a) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_read_disk_restore_atime"); - a->restore_time = 1; - if (a->tree != NULL) - a->tree->flags |= needsRestoreTimes; - return (ARCHIVE_OK); -} - -int -archive_read_disk_set_behavior(struct archive *_a, int flags) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - int r = ARCHIVE_OK; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_read_disk_honor_nodump"); - - if (flags & ARCHIVE_READDISK_RESTORE_ATIME) - r = archive_read_disk_set_atime_restored(_a); - else { - a->restore_time = 0; - if (a->tree != NULL) - a->tree->flags &= ~needsRestoreTimes; - } - if (flags & ARCHIVE_READDISK_HONOR_NODUMP) - a->honor_nodump = 1; - else - a->honor_nodump = 0; - if (flags & ARCHIVE_READDISK_MAC_COPYFILE) - a->enable_copyfile = 1; - else - a->enable_copyfile = 0; - if (flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS) - a->traverse_mount_points = 0; - else - a->traverse_mount_points = 1; - return (r); -} - -/* - * Trivial implementations of gname/uname lookup functions. - * These are normally overridden by the client, but these stub - * versions ensure that we always have something that works. - */ -static const char * -trivial_lookup_gname(void *private_data, int64_t gid) -{ - (void)private_data; /* UNUSED */ - (void)gid; /* UNUSED */ - return (NULL); -} - -static const char * -trivial_lookup_uname(void *private_data, int64_t uid) -{ - (void)private_data; /* UNUSED */ - (void)uid; /* UNUSED */ - return (NULL); -} - -static int64_t -align_num_per_sector(struct tree *t, int64_t size) -{ - int64_t surplus; - - size += t->current_filesystem->bytesPerSector -1; - surplus = size % t->current_filesystem->bytesPerSector; - size -= surplus; - return (size); -} - -static int -start_next_async_read(struct archive_read_disk *a, struct tree *t) -{ - struct la_overlapped *olp; - DWORD buffbytes, rbytes; - - if (t->ol_remaining_bytes == 0) - return (ARCHIVE_EOF); - - olp = &(t->ol[t->ol_idx_doing]); - t->ol_idx_doing = (t->ol_idx_doing + 1) % MAX_OVERLAPPED; - - /* Allocate read buffer. */ - if (olp->buff == NULL) { - void *p; - size_t s = (size_t)align_num_per_sector(t, BUFFER_SIZE); - p = VirtualAlloc(NULL, s, MEM_COMMIT, PAGE_READWRITE); - if (p == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Couldn't allocate memory"); - a->archive.state = ARCHIVE_STATE_FATAL; - return (ARCHIVE_FATAL); - } - olp->buff = p; - olp->buff_size = s; - olp->_a = &a->archive; - olp->ol.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); - if (olp->ol.hEvent == NULL) { - la_dosmaperr(GetLastError()); - archive_set_error(&a->archive, errno, - "CreateEvent failed"); - a->archive.state = ARCHIVE_STATE_FATAL; - return (ARCHIVE_FATAL); - } - } else - ResetEvent(olp->ol.hEvent); - - buffbytes = (DWORD)olp->buff_size; - if (buffbytes > t->current_sparse->length) - buffbytes = (DWORD)t->current_sparse->length; - - /* Skip hole. */ - if (t->current_sparse->offset > t->ol_total) { - t->ol_remaining_bytes -= - t->current_sparse->offset - t->ol_total; - } - - olp->offset = t->current_sparse->offset; - olp->ol.Offset = (DWORD)(olp->offset & 0xffffffff); - olp->ol.OffsetHigh = (DWORD)(olp->offset >> 32); - - if (t->ol_remaining_bytes > buffbytes) { - olp->bytes_expected = buffbytes; - t->ol_remaining_bytes -= buffbytes; - } else { - olp->bytes_expected = (size_t)t->ol_remaining_bytes; - t->ol_remaining_bytes = 0; - } - olp->bytes_transferred = 0; - t->current_sparse->offset += buffbytes; - t->current_sparse->length -= buffbytes; - t->ol_total = t->current_sparse->offset; - if (t->current_sparse->length == 0 && t->ol_remaining_bytes > 0) - t->current_sparse++; - - if (!ReadFile(t->entry_fh, olp->buff, buffbytes, &rbytes, &(olp->ol))) { - DWORD lasterr; - - lasterr = GetLastError(); - if (lasterr == ERROR_HANDLE_EOF) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Reading file truncated"); - a->archive.state = ARCHIVE_STATE_FATAL; - return (ARCHIVE_FATAL); - } else if (lasterr != ERROR_IO_PENDING) { - if (lasterr == ERROR_NO_DATA) - errno = EAGAIN; - else if (lasterr == ERROR_ACCESS_DENIED) - errno = EBADF; - else - la_dosmaperr(lasterr); - archive_set_error(&a->archive, errno, "Read error"); - a->archive.state = ARCHIVE_STATE_FATAL; - return (ARCHIVE_FATAL); - } - } else - olp->bytes_transferred = rbytes; - t->ol_num_doing++; - - return (t->ol_remaining_bytes == 0)? ARCHIVE_EOF: ARCHIVE_OK; -} - -static void -cancel_async(struct tree *t) -{ - if (t->ol_num_doing != t->ol_num_done) { - CancelIo(t->entry_fh); - t->ol_num_doing = t->ol_num_done = 0; - } -} - -static int -_archive_read_data_block(struct archive *_a, const void **buff, - size_t *size, int64_t *offset) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - struct tree *t = a->tree; - struct la_overlapped *olp; - DWORD bytes_transferred; - int r = ARCHIVE_FATAL; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_DATA, - "archive_read_data_block"); - - if (t->entry_eof || t->entry_remaining_bytes <= 0) { - r = ARCHIVE_EOF; - goto abort_read_data; - } - - /* - * Make a request to read the file in asynchronous. - */ - if (t->ol_num_doing == 0) { - do { - r = start_next_async_read(a, t); - if (r == ARCHIVE_FATAL) - goto abort_read_data; - if (!t->async_io) - break; - } while (r == ARCHIVE_OK && t->ol_num_doing < MAX_OVERLAPPED); - } else { - if (start_next_async_read(a, t) == ARCHIVE_FATAL) - goto abort_read_data; - } - - olp = &(t->ol[t->ol_idx_done]); - t->ol_idx_done = (t->ol_idx_done + 1) % MAX_OVERLAPPED; - if (olp->bytes_transferred) - bytes_transferred = (DWORD)olp->bytes_transferred; - else if (!GetOverlappedResult(t->entry_fh, &(olp->ol), - &bytes_transferred, TRUE)) { - la_dosmaperr(GetLastError()); - archive_set_error(&a->archive, errno, - "GetOverlappedResult failed"); - a->archive.state = ARCHIVE_STATE_FATAL; - r = ARCHIVE_FATAL; - goto abort_read_data; - } - t->ol_num_done++; - - if (bytes_transferred == 0 || - olp->bytes_expected != bytes_transferred) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Reading file truncated"); - a->archive.state = ARCHIVE_STATE_FATAL; - r = ARCHIVE_FATAL; - goto abort_read_data; - } - - *buff = olp->buff; - *size = bytes_transferred; - *offset = olp->offset; - if (olp->offset > t->entry_total) - t->entry_remaining_bytes -= olp->offset - t->entry_total; - t->entry_total = olp->offset + *size; - t->entry_remaining_bytes -= *size; - if (t->entry_remaining_bytes == 0) { - /* Close the current file descriptor */ - close_and_restore_time(t->entry_fh, t, &t->restore_time); - t->entry_fh = INVALID_HANDLE_VALUE; - t->entry_eof = 1; - } - return (ARCHIVE_OK); - -abort_read_data: - *buff = NULL; - *size = 0; - *offset = t->entry_total; - if (t->entry_fh != INVALID_HANDLE_VALUE) { - cancel_async(t); - /* Close the current file descriptor */ - close_and_restore_time(t->entry_fh, t, &t->restore_time); - t->entry_fh = INVALID_HANDLE_VALUE; - } - return (r); -} - -static int -next_entry(struct archive_read_disk *a, struct tree *t, - struct archive_entry *entry) -{ - const BY_HANDLE_FILE_INFORMATION *st; - const BY_HANDLE_FILE_INFORMATION *lst; - const char*name; - int descend, r; - - st = NULL; - lst = NULL; - t->descend = 0; - do { - switch (tree_next(t)) { - case TREE_ERROR_FATAL: - archive_set_error(&a->archive, t->tree_errno, - "%ls: Unable to continue traversing directory tree", - tree_current_path(t)); - a->archive.state = ARCHIVE_STATE_FATAL; - return (ARCHIVE_FATAL); - case TREE_ERROR_DIR: - archive_set_error(&a->archive, t->tree_errno, - "%ls: Couldn't visit directory", - tree_current_path(t)); - return (ARCHIVE_FAILED); - case 0: - return (ARCHIVE_EOF); - case TREE_POSTDESCENT: - case TREE_POSTASCENT: - break; - case TREE_REGULAR: - lst = tree_current_lstat(t); - if (lst == NULL) { - archive_set_error(&a->archive, t->tree_errno, - "%ls: Cannot stat", - tree_current_path(t)); - return (ARCHIVE_FAILED); - } - break; - } - } while (lst == NULL); - - archive_entry_copy_pathname_w(entry, tree_current_path(t)); - - /* - * Perform path matching. - */ - if (a->matching) { - r = archive_match_path_excluded(a->matching, entry); - if (r < 0) { - archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); - return (r); - } - if (r) { - if (a->excluded_cb_func) - a->excluded_cb_func(&(a->archive), - a->excluded_cb_data, entry); - return (ARCHIVE_RETRY); - } - } - - /* - * Distinguish 'L'/'P'/'H' symlink following. - */ - switch(t->symlink_mode) { - case 'H': - /* 'H': After the first item, rest like 'P'. */ - t->symlink_mode = 'P'; - /* 'H': First item (from command line) like 'L'. */ - /* FALLTHROUGH */ - case 'L': - /* 'L': Do descend through a symlink to dir. */ - descend = tree_current_is_dir(t); - /* 'L': Follow symlinks to files. */ - a->symlink_mode = 'L'; - a->follow_symlinks = 1; - /* 'L': Archive symlinks as targets, if we can. */ - st = tree_current_stat(t); - if (st != NULL && !tree_target_is_same_as_parent(t, st)) - break; - /* If stat fails, we have a broken symlink; - * in that case, don't follow the link. */ - /* FALLTHROUGH */ - default: - /* 'P': Don't descend through a symlink to dir. */ - descend = tree_current_is_physical_dir(t); - /* 'P': Don't follow symlinks to files. */ - a->symlink_mode = 'P'; - a->follow_symlinks = 0; - /* 'P': Archive symlinks as symlinks. */ - st = lst; - break; - } - - if (update_current_filesystem(a, bhfi_dev(st)) != ARCHIVE_OK) { - a->archive.state = ARCHIVE_STATE_FATAL; - return (ARCHIVE_FATAL); - } - if (t->initial_filesystem_id == -1) - t->initial_filesystem_id = t->current_filesystem_id; - if (!a->traverse_mount_points) { - if (t->initial_filesystem_id != t->current_filesystem_id) - return (ARCHIVE_RETRY); - } - t->descend = descend; - - tree_archive_entry_copy_bhfi(entry, t, st); - - /* Save the times to be restored. This must be in before - * calling archive_read_disk_descend() or any chance of it, - * especially, invokng a callback. */ - t->restore_time.lastWriteTime = st->ftLastWriteTime; - t->restore_time.lastAccessTime = st->ftLastAccessTime; - t->restore_time.filetype = archive_entry_filetype(entry); - - /* - * Perform time matching. - */ - if (a->matching) { - r = archive_match_time_excluded(a->matching, entry); - if (r < 0) { - archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); - return (r); - } - if (r) { - if (a->excluded_cb_func) - a->excluded_cb_func(&(a->archive), - a->excluded_cb_data, entry); - return (ARCHIVE_RETRY); - } - } - - /* Lookup uname/gname */ - name = archive_read_disk_uname(&(a->archive), archive_entry_uid(entry)); - if (name != NULL) - archive_entry_copy_uname(entry, name); - name = archive_read_disk_gname(&(a->archive), archive_entry_gid(entry)); - if (name != NULL) - archive_entry_copy_gname(entry, name); - - /* - * Perform owner matching. - */ - if (a->matching) { - r = archive_match_owner_excluded(a->matching, entry); - if (r < 0) { - archive_set_error(&(a->archive), errno, - "Faild : %s", archive_error_string(a->matching)); - return (r); - } - if (r) { - if (a->excluded_cb_func) - a->excluded_cb_func(&(a->archive), - a->excluded_cb_data, entry); - return (ARCHIVE_RETRY); - } - } - - /* - * Invoke a meta data filter callback. - */ - if (a->metadata_filter_func) { - if (!a->metadata_filter_func(&(a->archive), - a->metadata_filter_data, entry)) - return (ARCHIVE_RETRY); - } - - archive_entry_copy_sourcepath_w(entry, tree_current_access_path(t)); - - r = ARCHIVE_OK; - if (archive_entry_filetype(entry) == AE_IFREG && - archive_entry_size(entry) > 0) { - DWORD flags = FILE_FLAG_BACKUP_SEMANTICS; - if (t->async_io) - flags |= FILE_FLAG_OVERLAPPED; - if (t->direct_io) - flags |= FILE_FLAG_NO_BUFFERING; - else - flags |= FILE_FLAG_SEQUENTIAL_SCAN; - t->entry_fh = CreateFileW(tree_current_access_path(t), - GENERIC_READ, 0, NULL, OPEN_EXISTING, flags, NULL); - if (t->entry_fh == INVALID_HANDLE_VALUE) { - archive_set_error(&a->archive, errno, - "Couldn't open %ls", tree_current_path(a->tree)); - return (ARCHIVE_FAILED); - } - - /* Find sparse data from the disk. */ - if (archive_entry_hardlink(entry) == NULL && - (st->dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) != 0) - r = setup_sparse_from_disk(a, entry, t->entry_fh); - } - return (r); -} - -static int -_archive_read_next_header2(struct archive *_a, struct archive_entry *entry) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - struct tree *t; - int r; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, - "archive_read_next_header2"); - - t = a->tree; - if (t->entry_fh != INVALID_HANDLE_VALUE) { - cancel_async(t); - close_and_restore_time(t->entry_fh, t, &t->restore_time); - t->entry_fh = INVALID_HANDLE_VALUE; - } - - while ((r = next_entry(a, t, entry)) == ARCHIVE_RETRY) - archive_entry_clear(entry); - - /* - * EOF and FATAL are persistent at this layer. By - * modifying the state, we guarantee that future calls to - * read a header or read data will fail. - */ - switch (r) { - case ARCHIVE_EOF: - a->archive.state = ARCHIVE_STATE_EOF; - break; - case ARCHIVE_OK: - case ARCHIVE_WARN: - t->entry_total = 0; - if (archive_entry_filetype(entry) == AE_IFREG) { - t->entry_remaining_bytes = archive_entry_size(entry); - t->entry_eof = (t->entry_remaining_bytes == 0)? 1: 0; - if (!t->entry_eof && - setup_sparse(a, entry) != ARCHIVE_OK) - return (ARCHIVE_FATAL); - } else { - t->entry_remaining_bytes = 0; - t->entry_eof = 1; - } - t->ol_idx_doing = t->ol_idx_done = 0; - t->ol_num_doing = t->ol_num_done = 0; - t->ol_remaining_bytes = t->entry_remaining_bytes; - t->ol_total = 0; - a->archive.state = ARCHIVE_STATE_DATA; - break; - case ARCHIVE_RETRY: - break; - case ARCHIVE_FATAL: - a->archive.state = ARCHIVE_STATE_FATAL; - break; - } - - return (r); -} - -static int -setup_sparse(struct archive_read_disk *a, struct archive_entry *entry) -{ - struct tree *t = a->tree; - int64_t aligned, length, offset; - int i; - - t->sparse_count = archive_entry_sparse_reset(entry); - if (t->sparse_count+1 > t->sparse_list_size) { - free(t->sparse_list); - t->sparse_list_size = t->sparse_count + 1; - t->sparse_list = malloc(sizeof(t->sparse_list[0]) * - t->sparse_list_size); - if (t->sparse_list == NULL) { - t->sparse_list_size = 0; - archive_set_error(&a->archive, ENOMEM, - "Can't allocate data"); - a->archive.state = ARCHIVE_STATE_FATAL; - return (ARCHIVE_FATAL); - } - } - /* - * Get sparse list and make sure those offsets and lengths are - * aligned by a sector size. - */ - for (i = 0; i < t->sparse_count; i++) { - archive_entry_sparse_next(entry, &offset, &length); - aligned = align_num_per_sector(t, offset); - if (aligned != offset) { - aligned -= t->current_filesystem->bytesPerSector; - length += offset - aligned; - } - t->sparse_list[i].offset = aligned; - aligned = align_num_per_sector(t, length); - t->sparse_list[i].length = aligned; - } - - aligned = align_num_per_sector(t, archive_entry_size(entry)); - if (i == 0) { - t->sparse_list[i].offset = 0; - t->sparse_list[i].length = aligned; - } else { - int j, last = i; - - t->sparse_list[i].offset = aligned; - t->sparse_list[i].length = 0; - for (i = 0; i < last; i++) { - if ((t->sparse_list[i].offset + - t->sparse_list[i].length) <= - t->sparse_list[i+1].offset) - continue; - /* - * Now sparse_list[i+1] is overlapped by sparse_list[i]. - * Merge those two. - */ - length = t->sparse_list[i+1].offset - - t->sparse_list[i].offset; - t->sparse_list[i+1].offset = t->sparse_list[i].offset; - t->sparse_list[i+1].length += length; - /* Remove sparse_list[i]. */ - for (j = i; j < last; j++) { - t->sparse_list[j].offset = - t->sparse_list[j+1].offset; - t->sparse_list[j].length = - t->sparse_list[j+1].length; - } - last--; - } - } - t->current_sparse = t->sparse_list; - - return (ARCHIVE_OK); -} - -int -archive_read_disk_set_matching(struct archive *_a, struct archive *_ma, - void (*_excluded_func)(struct archive *, void *, struct archive_entry *), - void *_client_data) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_read_disk_set_matching"); - a->matching = _ma; - a->excluded_cb_func = _excluded_func; - a->excluded_cb_data = _client_data; - return (ARCHIVE_OK); -} - -int -archive_read_disk_set_metadata_filter_callback(struct archive *_a, - int (*_metadata_filter_func)(struct archive *, void *, - struct archive_entry *), void *_client_data) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_ANY, - "archive_read_disk_set_metadata_filter_callback"); - - a->metadata_filter_func = _metadata_filter_func; - a->metadata_filter_data = _client_data; - return (ARCHIVE_OK); -} - -int -archive_read_disk_can_descend(struct archive *_a) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - struct tree *t = a->tree; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, - "archive_read_disk_can_descend"); - - return (t->visit_type == TREE_REGULAR && t->descend); -} - -/* - * Called by the client to mark the directory just returned from - * tree_next() as needing to be visited. - */ -int -archive_read_disk_descend(struct archive *_a) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - struct tree *t = a->tree; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, - "archive_read_disk_descend"); - - if (t->visit_type != TREE_REGULAR || !t->descend) - return (ARCHIVE_OK); - - if (tree_current_is_physical_dir(t)) { - tree_push(t, t->basename, t->full_path.s, - t->current_filesystem_id, - bhfi_dev(&(t->lst)), bhfi_ino(&(t->lst)), - &t->restore_time); - t->stack->flags |= isDir; - } else if (tree_current_is_dir(t)) { - tree_push(t, t->basename, t->full_path.s, - t->current_filesystem_id, - bhfi_dev(&(t->st)), bhfi_ino(&(t->st)), - &t->restore_time); - t->stack->flags |= isDirLink; - } - t->descend = 0; - return (ARCHIVE_OK); -} - -int -archive_read_disk_open(struct archive *_a, const char *pathname) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - struct archive_wstring wpath; - int ret; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_NEW | ARCHIVE_STATE_CLOSED, - "archive_read_disk_open"); - archive_clear_error(&a->archive); - - /* Make a wchar_t string from a char string. */ - archive_string_init(&wpath); - if (archive_wstring_append_from_mbs(&wpath, pathname, - strlen(pathname)) != 0) { - if (errno == ENOMEM) - archive_set_error(&a->archive, ENOMEM, - "Can't allocate memory"); - else - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Can't convert a path to a wchar_t string"); - a->archive.state = ARCHIVE_STATE_FATAL; - ret = ARCHIVE_FATAL; - } else - ret = _archive_read_disk_open_w(_a, wpath.s); - - archive_wstring_free(&wpath); - return (ret); -} - -int -archive_read_disk_open_w(struct archive *_a, const wchar_t *pathname) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, - ARCHIVE_STATE_NEW | ARCHIVE_STATE_CLOSED, - "archive_read_disk_open_w"); - archive_clear_error(&a->archive); - - return (_archive_read_disk_open_w(_a, pathname)); -} - -static int -_archive_read_disk_open_w(struct archive *_a, const wchar_t *pathname) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - - if (a->tree != NULL) - a->tree = tree_reopen(a->tree, pathname, a->restore_time); - else - a->tree = tree_open(pathname, a->symlink_mode, a->restore_time); - if (a->tree == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate directory traversal data"); - a->archive.state = ARCHIVE_STATE_FATAL; - return (ARCHIVE_FATAL); - } - a->archive.state = ARCHIVE_STATE_HEADER; - - return (ARCHIVE_OK); -} - -/* - * Return a current filesystem ID which is index of the filesystem entry - * you've visited through archive_read_disk. - */ -int -archive_read_disk_current_filesystem(struct archive *_a) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_DATA, - "archive_read_disk_current_filesystem"); - - return (a->tree->current_filesystem_id); -} - -static int -update_current_filesystem(struct archive_read_disk *a, int64_t dev) -{ - struct tree *t = a->tree; - int i, fid; - - if (t->current_filesystem != NULL && - t->current_filesystem->dev == dev) - return (ARCHIVE_OK); - - for (i = 0; i < t->max_filesystem_id; i++) { - if (t->filesystem_table[i].dev == dev) { - /* There is the filesytem ID we've already generated. */ - t->current_filesystem_id = i; - t->current_filesystem = &(t->filesystem_table[i]); - return (ARCHIVE_OK); - } - } - - /* - * There is a new filesytem, we generate a new ID for. - */ - fid = t->max_filesystem_id++; - if (t->max_filesystem_id > t->allocated_filesytem) { - size_t s; - void *p; - - s = t->max_filesystem_id * 2; - p = realloc(t->filesystem_table, - s * sizeof(*t->filesystem_table)); - if (p == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate tar data"); - return (ARCHIVE_FATAL); - } - t->filesystem_table = (struct filesystem *)p; - t->allocated_filesytem = (int)s; - } - t->current_filesystem_id = fid; - t->current_filesystem = &(t->filesystem_table[fid]); - t->current_filesystem->dev = dev; - - return (setup_current_filesystem(a)); -} - -/* - * Returns 1 if current filesystem is generated filesystem, 0 if it is not - * or -1 if it is unknown. - */ -int -archive_read_disk_current_filesystem_is_synthetic(struct archive *_a) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_DATA, - "archive_read_disk_current_filesystem"); - - return (a->tree->current_filesystem->synthetic); -} - -/* - * Returns 1 if current filesystem is remote filesystem, 0 if it is not - * or -1 if it is unknown. - */ -int -archive_read_disk_current_filesystem_is_remote(struct archive *_a) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - - archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_DATA, - "archive_read_disk_current_filesystem"); - - return (a->tree->current_filesystem->remote); -} - -/* - * If symlink is broken, statfs or statvfs will fail. - * Use its directory path instead. - */ -static wchar_t * -safe_path_for_statfs(struct tree *t) -{ - const wchar_t *path; - wchar_t *cp, *p = NULL; - - path = tree_current_access_path(t); - if (tree_current_stat(t) == NULL) { - p = _wcsdup(path); - cp = wcsrchr(p, '/'); - if (cp != NULL && wcslen(cp) >= 2) { - cp[1] = '.'; - cp[2] = '\0'; - path = p; - } - } else - p = _wcsdup(path); - return (p); -} - -/* - * Get conditions of synthetic and remote on Windows - */ -static int -setup_current_filesystem(struct archive_read_disk *a) -{ - struct tree *t = a->tree; - wchar_t vol[256]; - wchar_t *path; - - t->current_filesystem->synthetic = -1;/* Not supported */ - path = safe_path_for_statfs(t); - if (!GetVolumePathNameW(path, vol, sizeof(vol)/sizeof(vol[0]))) { - free(path); - t->current_filesystem->remote = -1; - t->current_filesystem->bytesPerSector = 0; - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "GetVolumePathName failed: %d", (int)GetLastError()); - return (ARCHIVE_FAILED); - } - free(path); - switch (GetDriveTypeW(vol)) { - case DRIVE_UNKNOWN: - case DRIVE_NO_ROOT_DIR: - t->current_filesystem->remote = -1; - break; - case DRIVE_REMOTE: - t->current_filesystem->remote = 1; - break; - default: - t->current_filesystem->remote = 0; - break; - } - - if (!GetDiskFreeSpaceW(vol, NULL, - &(t->current_filesystem->bytesPerSector), NULL, NULL)) { - t->current_filesystem->bytesPerSector = 0; - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "GetDiskFreeSpace failed: %d", (int)GetLastError()); - return (ARCHIVE_FAILED); - } - - return (ARCHIVE_OK); -} - -static int -close_and_restore_time(HANDLE h, struct tree *t, struct restore_time *rt) -{ - HANDLE handle; - int r = 0; - - if (h == INVALID_HANDLE_VALUE && AE_IFLNK == rt->filetype) - return (0); - - /* Close a file descritor. - * It will not be used for SetFileTime() because it has been opened - * by a read only mode. - */ - if (h != INVALID_HANDLE_VALUE) - CloseHandle(h); - if ((t->flags & needsRestoreTimes) == 0) - return (r); - - handle = CreateFileW(rt->full_path, FILE_WRITE_ATTRIBUTES, - 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); - if (handle == INVALID_HANDLE_VALUE) { - errno = EINVAL; - return (-1); - } - - if (SetFileTime(handle, NULL, &rt->lastAccessTime, - &rt->lastWriteTime) == 0) { - errno = EINVAL; - r = -1; - } else - r = 0; - CloseHandle(handle); - return (r); -} - -/* - * Add a directory path to the current stack. - */ -static void -tree_push(struct tree *t, const wchar_t *path, const wchar_t *full_path, - int filesystem_id, int64_t dev, int64_t ino, struct restore_time *rt) -{ - struct tree_entry *te; - - te = malloc(sizeof(*te)); - memset(te, 0, sizeof(*te)); - te->next = t->stack; - te->parent = t->current; - if (te->parent) - te->depth = te->parent->depth + 1; - t->stack = te; - archive_string_init(&te->name); - archive_wstrcpy(&te->name, path); - archive_string_init(&te->full_path); - archive_wstrcpy(&te->full_path, full_path); - te->flags = needsDescent | needsOpen | needsAscent; - te->filesystem_id = filesystem_id; - te->dev = dev; - te->ino = ino; - te->dirname_length = t->dirname_length; - te->full_path_dir_length = t->full_path_dir_length; - te->restore_time.full_path = te->full_path.s; - if (rt != NULL) { - te->restore_time.lastWriteTime = rt->lastWriteTime; - te->restore_time.lastAccessTime = rt->lastAccessTime; - te->restore_time.filetype = rt->filetype; - } -} - -/* - * Append a name to the current dir path. - */ -static void -tree_append(struct tree *t, const wchar_t *name, size_t name_length) -{ - size_t size_needed; - - t->path.s[t->dirname_length] = L'\0'; - t->path.length = t->dirname_length; - /* Strip trailing '/' from name, unless entire name is "/". */ - while (name_length > 1 && name[name_length - 1] == L'/') - name_length--; - - /* Resize pathname buffer as needed. */ - size_needed = name_length + t->dirname_length + 2; - archive_wstring_ensure(&t->path, size_needed); - /* Add a separating '/' if it's needed. */ - if (t->dirname_length > 0 && - t->path.s[archive_strlen(&t->path)-1] != L'/') - archive_wstrappend_wchar(&t->path, L'/'); - t->basename = t->path.s + archive_strlen(&t->path); - archive_wstrncat(&t->path, name, name_length); - t->restore_time.full_path = t->basename; - if (t->full_path_dir_length > 0) { - t->full_path.s[t->full_path_dir_length] = L'\0'; - t->full_path.length = t->full_path_dir_length; - size_needed = name_length + t->full_path_dir_length + 2; - archive_wstring_ensure(&t->full_path, size_needed); - /* Add a separating '\' if it's needed. */ - if (t->full_path.s[archive_strlen(&t->full_path)-1] != L'\\') - archive_wstrappend_wchar(&t->full_path, L'\\'); - archive_wstrncat(&t->full_path, name, name_length); - t->restore_time.full_path = t->full_path.s; - } -} - -/* - * Open a directory tree for traversal. - */ -static struct tree * -tree_open(const wchar_t *path, int symlink_mode, int restore_time) -{ - struct tree *t; - - t = malloc(sizeof(*t)); - memset(t, 0, sizeof(*t)); - archive_string_init(&(t->full_path)); - archive_string_init(&t->path); - archive_wstring_ensure(&t->path, 15); - t->initial_symlink_mode = symlink_mode; - return (tree_reopen(t, path, restore_time)); -} - -static struct tree * -tree_reopen(struct tree *t, const wchar_t *path, int restore_time) -{ - struct archive_wstring ws; - wchar_t *pathname, *p, *base; - - t->flags = (restore_time)?needsRestoreTimes:0; - t->visit_type = 0; - t->tree_errno = 0; - t->full_path_dir_length = 0; - t->dirname_length = 0; - t->depth = 0; - t->descend = 0; - t->current = NULL; - t->d = INVALID_HANDLE_VALUE; - t->symlink_mode = t->initial_symlink_mode; - archive_string_empty(&(t->full_path)); - archive_string_empty(&t->path); - t->entry_fh = INVALID_HANDLE_VALUE; - t->entry_eof = 0; - t->entry_remaining_bytes = 0; - t->initial_filesystem_id = -1; - - /* Get wchar_t strings from char strings. */ - archive_string_init(&ws); - archive_wstrcpy(&ws, path); - pathname = ws.s; - /* Get a full-path-name. */ - p = __la_win_permissive_name_w(pathname); - if (p == NULL) - goto failed; - archive_wstrcpy(&(t->full_path), p); - free(p); - - /* Convert path separators from '\' to '/' */ - for (p = pathname; *p != L'\0'; ++p) { - if (*p == L'\\') - *p = L'/'; - } - base = pathname; - - /* First item is set up a lot like a symlink traversal. */ - /* printf("Looking for wildcard in %s\n", path); */ - if ((base[0] == L'/' && base[1] == L'/' && - base[2] == L'?' && base[3] == L'/' && - (wcschr(base+4, L'*') || wcschr(base+4, L'?'))) || - (!(base[0] == L'/' && base[1] == L'/' && - base[2] == L'?' && base[3] == L'/') && - (wcschr(base, L'*') || wcschr(base, L'?')))) { - // It has a wildcard in it... - // Separate the last element. - p = wcsrchr(base, L'/'); - if (p != NULL) { - *p = L'\0'; - tree_append(t, base, p - base); - t->dirname_length = archive_strlen(&t->path); - base = p + 1; - } - p = wcsrchr(t->full_path.s, L'\\'); - if (p != NULL) { - *p = L'\0'; - t->full_path.length = wcslen(t->full_path.s); - t->full_path_dir_length = archive_strlen(&t->full_path); - } - } - tree_push(t, base, t->full_path.s, 0, 0, 0, NULL); - archive_wstring_free(&ws); - t->stack->flags = needsFirstVisit; - /* - * Debug flag for Direct IO(No buffering) or Async IO. - * Those dependant on environment variable switches - * will be removed until next release. - */ - { - const char *e; - if ((e = getenv("LIBARCHIVE_DIRECT_IO")) != NULL) { - if (e[0] == '0') - t->direct_io = 0; - else - t->direct_io = 1; - fprintf(stderr, "LIBARCHIVE_DIRECT_IO=%s\n", - (t->direct_io)?"Enabled":"Disabled"); - } else - t->direct_io = DIRECT_IO; - if ((e = getenv("LIBARCHIVE_ASYNC_IO")) != NULL) { - if (e[0] == '0') - t->async_io = 0; - else - t->async_io = 1; - fprintf(stderr, "LIBARCHIVE_ASYNC_IO=%s\n", - (t->async_io)?"Enabled":"Disabled"); - } else - t->async_io = ASYNC_IO; - } - return (t); -failed: - archive_wstring_free(&ws); - tree_free(t); - return (NULL); -} - -static int -tree_descent(struct tree *t) -{ - t->dirname_length = archive_strlen(&t->path); - t->full_path_dir_length = archive_strlen(&t->full_path); - t->depth++; - return (0); -} - -/* - * We've finished a directory; ascend back to the parent. - */ -static int -tree_ascend(struct tree *t) -{ - struct tree_entry *te; - - te = t->stack; - t->depth--; - close_and_restore_time(INVALID_HANDLE_VALUE, t, &te->restore_time); - return (0); -} - -/* - * Pop the working stack. - */ -static void -tree_pop(struct tree *t) -{ - struct tree_entry *te; - - t->full_path.s[t->full_path_dir_length] = L'\0'; - t->full_path.length = t->full_path_dir_length; - t->path.s[t->dirname_length] = L'\0'; - t->path.length = t->dirname_length; - if (t->stack == t->current && t->current != NULL) - t->current = t->current->parent; - te = t->stack; - t->stack = te->next; - t->dirname_length = te->dirname_length; - t->basename = t->path.s + t->dirname_length; - t->full_path_dir_length = te->full_path_dir_length; - while (t->basename[0] == L'/') - t->basename++; - archive_wstring_free(&te->name); - archive_wstring_free(&te->full_path); - free(te); -} - -/* - * Get the next item in the tree traversal. - */ -static int -tree_next(struct tree *t) -{ - int r; - - while (t->stack != NULL) { - /* If there's an open dir, get the next entry from there. */ - if (t->d != INVALID_HANDLE_VALUE) { - r = tree_dir_next_windows(t, NULL); - if (r == 0) - continue; - return (r); - } - - if (t->stack->flags & needsFirstVisit) { - wchar_t *d = t->stack->name.s; - t->stack->flags &= ~needsFirstVisit; - if (!(d[0] == L'/' && d[1] == L'/' && - d[2] == L'?' && d[3] == L'/') && - (wcschr(d, L'*') || wcschr(d, L'?'))) { - r = tree_dir_next_windows(t, d); - if (r == 0) - continue; - return (r); - } else { - HANDLE h = FindFirstFileW(d, &t->_findData); - if (h == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - t->tree_errno = errno; - t->visit_type = TREE_ERROR_DIR; - return (t->visit_type); - } - t->findData = &t->_findData; - FindClose(h); - } - /* Top stack item needs a regular visit. */ - t->current = t->stack; - tree_append(t, t->stack->name.s, - archive_strlen(&(t->stack->name))); - //t->dirname_length = t->path_length; - //tree_pop(t); - t->stack->flags &= ~needsFirstVisit; - return (t->visit_type = TREE_REGULAR); - } else if (t->stack->flags & needsDescent) { - /* Top stack item is dir to descend into. */ - t->current = t->stack; - tree_append(t, t->stack->name.s, - archive_strlen(&(t->stack->name))); - t->stack->flags &= ~needsDescent; - r = tree_descent(t); - if (r != 0) { - tree_pop(t); - t->visit_type = r; - } else - t->visit_type = TREE_POSTDESCENT; - return (t->visit_type); - } else if (t->stack->flags & needsOpen) { - t->stack->flags &= ~needsOpen; - r = tree_dir_next_windows(t, L"*"); - if (r == 0) - continue; - return (r); - } else if (t->stack->flags & needsAscent) { - /* Top stack item is dir and we're done with it. */ - r = tree_ascend(t); - tree_pop(t); - t->visit_type = r != 0 ? r : TREE_POSTASCENT; - return (t->visit_type); - } else { - /* Top item on stack is dead. */ - tree_pop(t); - t->flags &= ~hasLstat; - t->flags &= ~hasStat; - } - } - return (t->visit_type = 0); -} - -static int -tree_dir_next_windows(struct tree *t, const wchar_t *pattern) -{ - const wchar_t *name; - size_t namelen; - int r; - - for (;;) { - if (pattern != NULL) { - struct archive_wstring pt; - - archive_string_init(&pt); - archive_wstring_ensure(&pt, - archive_strlen(&(t->full_path)) - + 2 + wcslen(pattern)); - archive_wstring_copy(&pt, &(t->full_path)); - archive_wstrappend_wchar(&pt, L'\\'); - archive_wstrcat(&pt, pattern); - t->d = FindFirstFileW(pt.s, &t->_findData); - archive_wstring_free(&pt); - if (t->d == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - t->tree_errno = errno; - r = tree_ascend(t); /* Undo "chdir" */ - tree_pop(t); - t->visit_type = r != 0 ? r : TREE_ERROR_DIR; - return (t->visit_type); - } - t->findData = &t->_findData; - pattern = NULL; - } else if (!FindNextFileW(t->d, &t->_findData)) { - FindClose(t->d); - t->d = INVALID_HANDLE_VALUE; - t->findData = NULL; - return (0); - } - name = t->findData->cFileName; - namelen = wcslen(name); - t->flags &= ~hasLstat; - t->flags &= ~hasStat; - if (name[0] == L'.' && name[1] == L'\0') - continue; - if (name[0] == L'.' && name[1] == L'.' && name[2] == L'\0') - continue; - tree_append(t, name, namelen); - return (t->visit_type = TREE_REGULAR); - } -} - -#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000) -static void -fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns) -{ - ULARGE_INTEGER utc; - - utc.HighPart = filetime->dwHighDateTime; - utc.LowPart = filetime->dwLowDateTime; - if (utc.QuadPart >= EPOC_TIME) { - utc.QuadPart -= EPOC_TIME; - /* milli seconds base */ - *t = (time_t)(utc.QuadPart / 10000000); - /* nano seconds base */ - *ns = (long)(utc.QuadPart % 10000000) * 100; - } else { - *t = 0; - *ns = 0; - } -} - -static void -entry_copy_bhfi(struct archive_entry *entry, const wchar_t *path, - const WIN32_FIND_DATAW *findData, - const BY_HANDLE_FILE_INFORMATION *bhfi) -{ - time_t secs; - long nsecs; - mode_t mode; - - fileTimeToUtc(&bhfi->ftLastAccessTime, &secs, &nsecs); - archive_entry_set_atime(entry, secs, nsecs); - fileTimeToUtc(&bhfi->ftLastWriteTime, &secs, &nsecs); - archive_entry_set_mtime(entry, secs, nsecs); - fileTimeToUtc(&bhfi->ftCreationTime, &secs, &nsecs); - archive_entry_set_birthtime(entry, secs, nsecs); - archive_entry_set_ctime(entry, secs, nsecs); - archive_entry_set_dev(entry, bhfi_dev(bhfi)); - archive_entry_set_ino64(entry, bhfi_ino(bhfi)); - if (bhfi->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - archive_entry_set_nlink(entry, bhfi->nNumberOfLinks + 1); - else - archive_entry_set_nlink(entry, bhfi->nNumberOfLinks); - archive_entry_set_size(entry, - (((int64_t)bhfi->nFileSizeHigh) << 32) - + bhfi->nFileSizeLow); - archive_entry_set_uid(entry, 0); - archive_entry_set_gid(entry, 0); - archive_entry_set_rdev(entry, 0); - - mode = S_IRUSR | S_IRGRP | S_IROTH; - if ((bhfi->dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0) - mode |= S_IWUSR | S_IWGRP | S_IWOTH; - if ((bhfi->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && - findData != NULL && - findData->dwReserved0 == IO_REPARSE_TAG_SYMLINK) - mode |= S_IFLNK; - else if (bhfi->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH; - else { - const wchar_t *p; - - mode |= S_IFREG; - p = wcsrchr(path, L'.'); - if (p != NULL && wcslen(p) == 4) { - switch (p[1]) { - case L'B': case L'b': - if ((p[2] == L'A' || p[2] == L'a' ) && - (p[3] == L'T' || p[3] == L't' )) - mode |= S_IXUSR | S_IXGRP | S_IXOTH; - break; - case L'C': case L'c': - if (((p[2] == L'M' || p[2] == L'm' ) && - (p[3] == L'D' || p[3] == L'd' )) || - ((p[2] == L'M' || p[2] == L'm' ) && - (p[3] == L'D' || p[3] == L'd' ))) - mode |= S_IXUSR | S_IXGRP | S_IXOTH; - break; - case L'E': case L'e': - if ((p[2] == L'X' || p[2] == L'x' ) && - (p[3] == L'E' || p[3] == L'e' )) - mode |= S_IXUSR | S_IXGRP | S_IXOTH; - break; - default: - break; - } - } - } - archive_entry_set_mode(entry, mode); -} - -static void -tree_archive_entry_copy_bhfi(struct archive_entry *entry, struct tree *t, - const BY_HANDLE_FILE_INFORMATION *bhfi) -{ - entry_copy_bhfi(entry, tree_current_path(t), t->findData, bhfi); -} - -static int -tree_current_file_information(struct tree *t, BY_HANDLE_FILE_INFORMATION *st, - int sim_lstat) -{ - HANDLE h; - int r; - DWORD flag = FILE_FLAG_BACKUP_SEMANTICS; - - if (sim_lstat && tree_current_is_physical_link(t)) - flag |= FILE_FLAG_OPEN_REPARSE_POINT; - h = CreateFileW(tree_current_access_path(t), 0, 0, NULL, - OPEN_EXISTING, flag, NULL); - if (h == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - t->tree_errno = errno; - return (0); - } - r = GetFileInformationByHandle(h, st); - CloseHandle(h); - return (r); -} - -/* - * Get the stat() data for the entry just returned from tree_next(). - */ -static const BY_HANDLE_FILE_INFORMATION * -tree_current_stat(struct tree *t) -{ - if (!(t->flags & hasStat)) { - if (!tree_current_file_information(t, &t->st, 0)) - return NULL; - t->flags |= hasStat; - } - return (&t->st); -} - -/* - * Get the lstat() data for the entry just returned from tree_next(). - */ -static const BY_HANDLE_FILE_INFORMATION * -tree_current_lstat(struct tree *t) -{ - if (!(t->flags & hasLstat)) { - if (!tree_current_file_information(t, &t->lst, 1)) - return NULL; - t->flags |= hasLstat; - } - return (&t->lst); -} - -/* - * Test whether current entry is a dir or link to a dir. - */ -static int -tree_current_is_dir(struct tree *t) -{ - if (t->findData) - return (t->findData->dwFileAttributes - & FILE_ATTRIBUTE_DIRECTORY); - return (0); -} - -/* - * Test whether current entry is a physical directory. Usually, we - * already have at least one of stat() or lstat() in memory, so we - * use tricks to try to avoid an extra trip to the disk. - */ -static int -tree_current_is_physical_dir(struct tree *t) -{ - if (tree_current_is_physical_link(t)) - return (0); - return (tree_current_is_dir(t)); -} - -/* - * Test whether current entry is a symbolic link. - */ -static int -tree_current_is_physical_link(struct tree *t) -{ - if (t->findData) - return ((t->findData->dwFileAttributes - & FILE_ATTRIBUTE_REPARSE_POINT) && - (t->findData->dwReserved0 - == IO_REPARSE_TAG_SYMLINK)); - return (0); -} - -/* - * Test whether the same file has been in the tree as its parent. - */ -static int -tree_target_is_same_as_parent(struct tree *t, - const BY_HANDLE_FILE_INFORMATION *st) -{ - struct tree_entry *te; - int64_t dev = bhfi_dev(st); - int64_t ino = bhfi_ino(st); - - for (te = t->current->parent; te != NULL; te = te->parent) { - if (te->dev == dev && te->ino == ino) - return (1); - } - return (0); -} - -/* - * Return the access path for the entry just returned from tree_next(). - */ -static const wchar_t * -tree_current_access_path(struct tree *t) -{ - return (t->full_path.s); -} - -/* - * Return the full path for the entry just returned from tree_next(). - */ -static const wchar_t * -tree_current_path(struct tree *t) -{ - return (t->path.s); -} - -/* - * Terminate the traversal. - */ -static void -tree_close(struct tree *t) -{ - - if (t == NULL) - return; - if (t->entry_fh != INVALID_HANDLE_VALUE) { - cancel_async(t); - close_and_restore_time(t->entry_fh, t, &t->restore_time); - t->entry_fh = INVALID_HANDLE_VALUE; - } - /* Close the handle of FindFirstFileW */ - if (t->d != INVALID_HANDLE_VALUE) { - FindClose(t->d); - t->d = INVALID_HANDLE_VALUE; - t->findData = NULL; - } - /* Release anything remaining in the stack. */ - while (t->stack != NULL) - tree_pop(t); -} - -/* - * Release any resources. - */ -static void -tree_free(struct tree *t) -{ - int i; - - if (t == NULL) - return; - archive_wstring_free(&t->path); - archive_wstring_free(&t->full_path); - free(t->sparse_list); - free(t->filesystem_table); - for (i = 0; i < MAX_OVERLAPPED; i++) { - if (t->ol[i].buff) - VirtualFree(t->ol[i].buff, 0, MEM_RELEASE); - CloseHandle(t->ol[i].ol.hEvent); - } - free(t); -} - - -/* - * Populate the archive_entry with metadata from the disk. - */ -int -archive_read_disk_entry_from_file(struct archive *_a, - struct archive_entry *entry, int fd, const struct stat *st) -{ - struct archive_read_disk *a = (struct archive_read_disk *)_a; - const wchar_t *path; - const wchar_t *wname; - const char *name; - HANDLE h; - BY_HANDLE_FILE_INFORMATION bhfi; - DWORD fileAttributes = 0; - int r; - - archive_clear_error(_a); - wname = archive_entry_sourcepath_w(entry); - if (wname == NULL) - wname = archive_entry_pathname_w(entry); - if (wname == NULL) { - archive_set_error(&a->archive, EINVAL, - "Can't get a wide character version of the path"); - return (ARCHIVE_FAILED); - } - path = __la_win_permissive_name_w(wname); - - if (st == NULL) { - /* - * Get metadata through GetFileInformationByHandle(). - */ - if (fd >= 0) { - h = (HANDLE)_get_osfhandle(fd); - r = GetFileInformationByHandle(h, &bhfi); - if (r == 0) { - la_dosmaperr(GetLastError()); - archive_set_error(&a->archive, errno, - "Can't GetFileInformationByHandle"); - return (ARCHIVE_FAILED); - } - entry_copy_bhfi(entry, path, NULL, &bhfi); - } else { - WIN32_FIND_DATAW findData; - DWORD flag, desiredAccess; - - h = FindFirstFileW(path, &findData); - if (h == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - archive_set_error(&a->archive, errno, - "Can't FindFirstFileW"); - return (ARCHIVE_FAILED); - } - FindClose(h); - - flag = FILE_FLAG_BACKUP_SEMANTICS; - if (!a->follow_symlinks && - (findData.dwFileAttributes - & FILE_ATTRIBUTE_REPARSE_POINT) && - (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) { - flag |= FILE_FLAG_OPEN_REPARSE_POINT; - desiredAccess = 0; - } else if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { - desiredAccess = 0; - } else - desiredAccess = GENERIC_READ; - - h = CreateFileW(path, desiredAccess, 0, NULL, - OPEN_EXISTING, flag, NULL); - if (h == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - archive_set_error(&a->archive, errno, - "Can't CreateFileW"); - return (ARCHIVE_FAILED); - } - r = GetFileInformationByHandle(h, &bhfi); - if (r == 0) { - la_dosmaperr(GetLastError()); - archive_set_error(&a->archive, errno, - "Can't GetFileInformationByHandle"); - CloseHandle(h); - return (ARCHIVE_FAILED); - } - entry_copy_bhfi(entry, path, &findData, &bhfi); - } - fileAttributes = bhfi.dwFileAttributes; - } else { - archive_entry_copy_stat(entry, st); - h = INVALID_HANDLE_VALUE; - } - - /* Lookup uname/gname */ - name = archive_read_disk_uname(_a, archive_entry_uid(entry)); - if (name != NULL) - archive_entry_copy_uname(entry, name); - name = archive_read_disk_gname(_a, archive_entry_gid(entry)); - if (name != NULL) - archive_entry_copy_gname(entry, name); - - /* - * Can this file be sparse file ? - */ - if (archive_entry_filetype(entry) != AE_IFREG - || archive_entry_size(entry) <= 0 - || archive_entry_hardlink(entry) != NULL) { - if (h != INVALID_HANDLE_VALUE && fd < 0) - CloseHandle(h); - return (ARCHIVE_OK); - } - - if (h == INVALID_HANDLE_VALUE) { - if (fd >= 0) { - h = (HANDLE)_get_osfhandle(fd); - } else { - h = CreateFileW(path, GENERIC_READ, 0, NULL, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); - if (h == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - archive_set_error(&a->archive, errno, - "Can't CreateFileW"); - return (ARCHIVE_FAILED); - } - } - r = GetFileInformationByHandle(h, &bhfi); - if (r == 0) { - la_dosmaperr(GetLastError()); - archive_set_error(&a->archive, errno, - "Can't GetFileInformationByHandle"); - if (h != INVALID_HANDLE_VALUE && fd < 0) - CloseHandle(h); - return (ARCHIVE_FAILED); - } - fileAttributes = bhfi.dwFileAttributes; - } - - /* Sparse file must be set a mark, FILE_ATTRIBUTE_SPARSE_FILE */ - if ((fileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) == 0) { - if (fd < 0) - CloseHandle(h); - return (ARCHIVE_OK); - } - - r = setup_sparse_from_disk(a, entry, h); - if (fd < 0) - CloseHandle(h); - - return (r); -} - -/* - * Windows sparse interface. - */ -#if defined(__MINGW32__) && !defined(FSCTL_QUERY_ALLOCATED_RANGES) -#define FSCTL_QUERY_ALLOCATED_RANGES 0x940CF -typedef struct { - LARGE_INTEGER FileOffset; - LARGE_INTEGER Length; -} FILE_ALLOCATED_RANGE_BUFFER; -#endif - -static int -setup_sparse_from_disk(struct archive_read_disk *a, - struct archive_entry *entry, HANDLE handle) -{ - FILE_ALLOCATED_RANGE_BUFFER range, *outranges = NULL; - size_t outranges_size; - int64_t entry_size = archive_entry_size(entry); - int exit_sts = ARCHIVE_OK; - - range.FileOffset.QuadPart = 0; - range.Length.QuadPart = entry_size; - outranges_size = 2048; - outranges = (FILE_ALLOCATED_RANGE_BUFFER *)malloc(outranges_size); - if (outranges == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Couldn't allocate memory"); - exit_sts = ARCHIVE_FATAL; - goto exit_setup_sparse; - } - - for (;;) { - DWORD retbytes; - BOOL ret; - - for (;;) { - ret = DeviceIoControl(handle, - FSCTL_QUERY_ALLOCATED_RANGES, - &range, sizeof(range), outranges, - (DWORD)outranges_size, &retbytes, NULL); - if (ret == 0 && GetLastError() == ERROR_MORE_DATA) { - free(outranges); - outranges_size *= 2; - outranges = (FILE_ALLOCATED_RANGE_BUFFER *) - malloc(outranges_size); - if (outranges == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Couldn't allocate memory"); - exit_sts = ARCHIVE_FATAL; - goto exit_setup_sparse; - } - continue; - } else - break; - } - if (ret != 0) { - if (retbytes > 0) { - DWORD i, n; - - n = retbytes / sizeof(outranges[0]); - if (n == 1 && - outranges[0].FileOffset.QuadPart == 0 && - outranges[0].Length.QuadPart == entry_size) - break;/* This is not sparse. */ - for (i = 0; i < n; i++) - archive_entry_sparse_add_entry(entry, - outranges[i].FileOffset.QuadPart, - outranges[i].Length.QuadPart); - range.FileOffset.QuadPart = - outranges[n-1].FileOffset.QuadPart - + outranges[n-1].Length.QuadPart; - range.Length.QuadPart = - entry_size - range.FileOffset.QuadPart; - if (range.Length.QuadPart > 0) - continue; - } else { - /* The remaining data is hole. */ - archive_entry_sparse_add_entry(entry, - range.FileOffset.QuadPart, - range.Length.QuadPart); - } - break; - } else { - la_dosmaperr(GetLastError()); - archive_set_error(&a->archive, errno, - "DeviceIoControl Failed: %lu", GetLastError()); - exit_sts = ARCHIVE_FAILED; - goto exit_setup_sparse; - } - } -exit_setup_sparse: - free(outranges); - - return (exit_sts); -} - -#endif diff --git a/libarchive/archive_windows.c b/libarchive/archive_windows.c deleted file mode 100644 index d3bf758bb39e..000000000000 --- a/libarchive/archive_windows.c +++ /dev/null @@ -1,908 +0,0 @@ -/*- - * Copyright (c) 2009-2011 Michihiro NAKAJIMA - * Copyright (c) 2003-2007 Kees Zeelenberg - * 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$ - */ - -/* - * A set of compatibility glue for building libarchive on Windows platforms. - * - * Originally created as "libarchive-nonposix.c" by Kees Zeelenberg - * for the GnuWin32 project, trimmed significantly by Tim Kientzle. - * - * Much of the original file was unnecessary for libarchive, because - * many of the features it emulated were not strictly necessary for - * libarchive. I hope for this to shrink further as libarchive - * internals are gradually reworked to sit more naturally on both - * POSIX and Windows. Any ideas for this are greatly appreciated. - * - * The biggest remaining issue is the dev/ino emulation; libarchive - * has a couple of public APIs that rely on dev/ino uniquely - * identifying a file. This doesn't match well with Windows. I'm - * considering alternative APIs. - */ - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#include "archive_platform.h" -#include "archive_private.h" -#include "archive_entry.h" -#include -#include -#include -#ifdef HAVE_SYS_UTIME_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include - -#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000) - -#if defined(__LA_LSEEK_NEEDED) -static BOOL SetFilePointerEx_perso(HANDLE hFile, - LARGE_INTEGER liDistanceToMove, - PLARGE_INTEGER lpNewFilePointer, - DWORD dwMoveMethod) -{ - LARGE_INTEGER li; - li.QuadPart = liDistanceToMove.QuadPart; - li.LowPart = SetFilePointer( - hFile, li.LowPart, &li.HighPart, dwMoveMethod); - if(lpNewFilePointer) { - lpNewFilePointer->QuadPart = li.QuadPart; - } - return li.LowPart != -1 || GetLastError() == NO_ERROR; -} -#endif - -struct ustat { - int64_t st_atime; - uint32_t st_atime_nsec; - int64_t st_ctime; - uint32_t st_ctime_nsec; - int64_t st_mtime; - uint32_t st_mtime_nsec; - gid_t st_gid; - /* 64bits ino */ - int64_t st_ino; - mode_t st_mode; - uint32_t st_nlink; - uint64_t st_size; - uid_t st_uid; - dev_t st_dev; - dev_t st_rdev; -}; - -/* Transform 64-bits ino into 32-bits by hashing. - * You do not forget that really unique number size is 64-bits. - */ -#define INOSIZE (8*sizeof(ino_t)) /* 32 */ -static __inline ino_t -getino(struct ustat *ub) -{ - ULARGE_INTEGER ino64; - ino64.QuadPart = ub->st_ino; - /* I don't know this hashing is correct way */ - return ((ino_t)(ino64.LowPart ^ (ino64.LowPart >> INOSIZE))); -} - -/* - * Prepend "\\?\" to the path name and convert it to unicode to permit - * an extended-length path for a maximum total path length of 32767 - * characters. - * see also http://msdn.microsoft.com/en-us/library/aa365247.aspx - */ -wchar_t * -__la_win_permissive_name(const char *name) -{ - wchar_t *wn; - wchar_t *ws; - size_t ll; - - ll = strlen(name); - wn = malloc((ll + 1) * sizeof(wchar_t)); - if (wn == NULL) - return (NULL); - ll = mbstowcs(wn, name, ll); - if (ll == (size_t)-1) { - free(wn); - return (NULL); - } - wn[ll] = L'\0'; - ws = __la_win_permissive_name_w(wn); - free(wn); - return (ws); -} - -wchar_t * -__la_win_permissive_name_w(const wchar_t *wname) -{ - wchar_t *wn, *wnp; - wchar_t *ws, *wsp; - DWORD l, len, slen; - int unc; - - /* Get a full-pathname. */ - l = GetFullPathNameW(wname, 0, NULL, NULL); - if (l == 0) - return (NULL); - /* NOTE: GetFullPathNameW has a bug that if the length of the file - * name is just 1 then it returns incomplete buffer size. Thus, we - * have to add three to the size to allocate a sufficient buffer - * size for the full-pathname of the file name. */ - l += 3; - wnp = malloc(l * sizeof(wchar_t)); - if (wnp == NULL) - return (NULL); - len = GetFullPathNameW(wname, l, wnp, NULL); - wn = wnp; - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'?' && wnp[3] == L'\\') - /* We have already a permissive name. */ - return (wn); - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'.' && wnp[3] == L'\\') { - /* This is a device name */ - if (((wnp[4] >= L'a' && wnp[4] <= L'z') || - (wnp[4] >= L'A' && wnp[4] <= L'Z')) && - wnp[5] == L':' && wnp[6] == L'\\') - wnp[2] = L'?';/* Not device name. */ - return (wn); - } - - unc = 0; - if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') { - wchar_t *p = &wnp[2]; - - /* Skip server-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\') { - wchar_t *rp = ++p; - /* Skip share-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\' && p != rp) { - /* Now, match patterns such as - * "\\server-name\share-name\" */ - wnp += 2; - len -= 2; - unc = 1; - } - } - } - - slen = 4 + (unc * 4) + len + 1; - ws = wsp = malloc(slen * sizeof(wchar_t)); - if (ws == NULL) { - free(wn); - return (NULL); - } - /* prepend "\\?\" */ - wcsncpy(wsp, L"\\\\?\\", 4); - wsp += 4; - slen -= 4; - if (unc) { - /* append "UNC\" ---> "\\?\UNC\" */ - wcsncpy(wsp, L"UNC\\", 4); - wsp += 4; - slen -= 4; - } - wcsncpy(wsp, wnp, slen); - wsp[slen - 1] = L'\0'; /* Ensure null termination. */ - free(wn); - return (ws); -} - -/* - * Create a file handle. - * This can exceed MAX_PATH limitation. - */ -static HANDLE -la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode, - LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, - DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) -{ - wchar_t *wpath; - HANDLE handle; - - handle = CreateFileA(path, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, - hTemplateFile); - if (handle != INVALID_HANDLE_VALUE) - return (handle); - if (GetLastError() != ERROR_PATH_NOT_FOUND) - return (handle); - wpath = __la_win_permissive_name(path); - if (wpath == NULL) - return (handle); - handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, - hTemplateFile); - free(wpath); - return (handle); -} - -#if defined(__LA_LSEEK_NEEDED) -__int64 -__la_lseek(int fd, __int64 offset, int whence) -{ - LARGE_INTEGER distance; - LARGE_INTEGER newpointer; - HANDLE handle; - - if (fd < 0) { - errno = EBADF; - return (-1); - } - handle = (HANDLE)_get_osfhandle(fd); - if (GetFileType(handle) != FILE_TYPE_DISK) { - errno = EBADF; - return (-1); - } - distance.QuadPart = offset; - if (!SetFilePointerEx_perso(handle, distance, &newpointer, whence)) { - DWORD lasterr; - - lasterr = GetLastError(); - if (lasterr == ERROR_BROKEN_PIPE) - return (0); - if (lasterr == ERROR_ACCESS_DENIED) - errno = EBADF; - else - la_dosmaperr(lasterr); - return (-1); - } - return (newpointer.QuadPart); -} -#endif - -/* This can exceed MAX_PATH limitation. */ -int -__la_open(const char *path, int flags, ...) -{ - va_list ap; - wchar_t *ws; - int r, pmode; - DWORD attr; - - va_start(ap, flags); - pmode = va_arg(ap, int); - va_end(ap); - ws = NULL; - if ((flags & ~O_BINARY) == O_RDONLY) { - /* - * When we open a directory, _open function returns - * "Permission denied" error. - */ - attr = GetFileAttributesA(path); - if (attr == (DWORD)-1 && GetLastError() == ERROR_PATH_NOT_FOUND) { - ws = __la_win_permissive_name(path); - if (ws == NULL) { - errno = EINVAL; - return (-1); - } - attr = GetFileAttributesW(ws); - } - if (attr == (DWORD)-1) { - la_dosmaperr(GetLastError()); - free(ws); - return (-1); - } - if (attr & FILE_ATTRIBUTE_DIRECTORY) { - HANDLE handle; - - if (ws != NULL) - handle = CreateFileW(ws, 0, 0, NULL, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS | - FILE_ATTRIBUTE_READONLY, - NULL); - else - handle = CreateFileA(path, 0, 0, NULL, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS | - FILE_ATTRIBUTE_READONLY, - NULL); - free(ws); - if (handle == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - return (-1); - } - r = _open_osfhandle((intptr_t)handle, _O_RDONLY); - return (r); - } - } - if (ws == NULL) { -#if defined(__BORLANDC__) - /* Borland has no mode argument. - TODO: Fix mode of new file. */ - r = _open(path, flags); -#else - r = _open(path, flags, pmode); -#endif - if (r < 0 && errno == EACCES && (flags & O_CREAT) != 0) { - /* Simulate other POSIX system action to pass our test suite. */ - attr = GetFileAttributesA(path); - if (attr == (DWORD)-1) - la_dosmaperr(GetLastError()); - else if (attr & FILE_ATTRIBUTE_DIRECTORY) - errno = EISDIR; - else - errno = EACCES; - return (-1); - } - if (r >= 0 || errno != ENOENT) - return (r); - ws = __la_win_permissive_name(path); - if (ws == NULL) { - errno = EINVAL; - return (-1); - } - } - r = _wopen(ws, flags, pmode); - if (r < 0 && errno == EACCES && (flags & O_CREAT) != 0) { - /* Simulate other POSIX system action to pass our test suite. */ - attr = GetFileAttributesW(ws); - if (attr == (DWORD)-1) - la_dosmaperr(GetLastError()); - else if (attr & FILE_ATTRIBUTE_DIRECTORY) - errno = EISDIR; - else - errno = EACCES; - } - free(ws); - return (r); -} - -ssize_t -__la_read(int fd, void *buf, size_t nbytes) -{ - HANDLE handle; - DWORD bytes_read, lasterr; - int r; - -#ifdef _WIN64 - if (nbytes > UINT32_MAX) - nbytes = UINT32_MAX; -#endif - if (fd < 0) { - errno = EBADF; - return (-1); - } - /* Do not pass 0 to third parameter of ReadFile(), read bytes. - * This will not return to application side. */ - if (nbytes == 0) - return (0); - handle = (HANDLE)_get_osfhandle(fd); - r = ReadFile(handle, buf, (uint32_t)nbytes, - &bytes_read, NULL); - if (r == 0) { - lasterr = GetLastError(); - if (lasterr == ERROR_NO_DATA) { - errno = EAGAIN; - return (-1); - } - if (lasterr == ERROR_BROKEN_PIPE) - return (0); - if (lasterr == ERROR_ACCESS_DENIED) - errno = EBADF; - else - la_dosmaperr(lasterr); - return (-1); - } - return ((ssize_t)bytes_read); -} - -/* Convert Windows FILETIME to UTC */ -__inline static void -fileTimeToUTC(const FILETIME *filetime, time_t *t, long *ns) -{ - ULARGE_INTEGER utc; - - utc.HighPart = filetime->dwHighDateTime; - utc.LowPart = filetime->dwLowDateTime; - if (utc.QuadPart >= EPOC_TIME) { - utc.QuadPart -= EPOC_TIME; - *t = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */ - *ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */ - } else { - *t = 0; - *ns = 0; - } -} - -/* Stat by handle - * Windows' stat() does not accept the path added "\\?\" especially "?" - * character. - * It means we cannot access the long name path longer than MAX_PATH. - * So I've implemented simular Windows' stat() to access the long name path. - * And I've added some feature. - * 1. set st_ino by nFileIndexHigh and nFileIndexLow of - * BY_HANDLE_FILE_INFORMATION. - * 2. set st_nlink by nNumberOfLinks of BY_HANDLE_FILE_INFORMATION. - * 3. set st_dev by dwVolumeSerialNumber by BY_HANDLE_FILE_INFORMATION. - */ -static int -__hstat(HANDLE handle, struct ustat *st) -{ - BY_HANDLE_FILE_INFORMATION info; - ULARGE_INTEGER ino64; - DWORD ftype; - mode_t mode; - time_t t; - long ns; - - switch (ftype = GetFileType(handle)) { - case FILE_TYPE_UNKNOWN: - errno = EBADF; - return (-1); - case FILE_TYPE_CHAR: - case FILE_TYPE_PIPE: - if (ftype == FILE_TYPE_CHAR) { - st->st_mode = S_IFCHR; - st->st_size = 0; - } else { - DWORD avail; - - st->st_mode = S_IFIFO; - if (PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL)) - st->st_size = avail; - else - st->st_size = 0; - } - st->st_atime = 0; - st->st_atime_nsec = 0; - st->st_mtime = 0; - st->st_mtime_nsec = 0; - st->st_ctime = 0; - st->st_ctime_nsec = 0; - st->st_ino = 0; - st->st_nlink = 1; - st->st_uid = 0; - st->st_gid = 0; - st->st_rdev = 0; - st->st_dev = 0; - return (0); - case FILE_TYPE_DISK: - break; - default: - /* This ftype is undocumented type. */ - la_dosmaperr(GetLastError()); - return (-1); - } - - ZeroMemory(&info, sizeof(info)); - if (!GetFileInformationByHandle (handle, &info)) { - la_dosmaperr(GetLastError()); - return (-1); - } - - mode = S_IRUSR | S_IRGRP | S_IROTH; - if ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0) - mode |= S_IWUSR | S_IWGRP | S_IWOTH; - if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH; - else - mode |= S_IFREG; - st->st_mode = mode; - - fileTimeToUTC(&info.ftLastAccessTime, &t, &ns); - st->st_atime = t; - st->st_atime_nsec = ns; - fileTimeToUTC(&info.ftLastWriteTime, &t, &ns); - st->st_mtime = t; - st->st_mtime_nsec = ns; - fileTimeToUTC(&info.ftCreationTime, &t, &ns); - st->st_ctime = t; - st->st_ctime_nsec = ns; - st->st_size = - ((int64_t)(info.nFileSizeHigh) * ((int64_t)MAXDWORD + 1)) - + (int64_t)(info.nFileSizeLow); -#ifdef SIMULATE_WIN_STAT - st->st_ino = 0; - st->st_nlink = 1; - st->st_dev = 0; -#else - /* Getting FileIndex as i-node. We should remove a sequence which - * is high-16-bits of nFileIndexHigh. */ - ino64.HighPart = info.nFileIndexHigh & 0x0000FFFFUL; - ino64.LowPart = info.nFileIndexLow; - st->st_ino = ino64.QuadPart; - st->st_nlink = info.nNumberOfLinks; - if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - ++st->st_nlink;/* Add parent directory. */ - st->st_dev = info.dwVolumeSerialNumber; -#endif - st->st_uid = 0; - st->st_gid = 0; - st->st_rdev = 0; - return (0); -} - -static void -copy_stat(struct stat *st, struct ustat *us) -{ - st->st_atime = us->st_atime; - st->st_ctime = us->st_ctime; - st->st_mtime = us->st_mtime; - st->st_gid = us->st_gid; - st->st_ino = getino(us); - st->st_mode = us->st_mode; - st->st_nlink = us->st_nlink; - st->st_size = (off_t)us->st_size; - st->st_uid = us->st_uid; - st->st_dev = us->st_dev; - st->st_rdev = us->st_rdev; -} - -/* - * TODO: Remove a use of __la_fstat and __la_stat. - * We should use GetFileInformationByHandle in place - * where We still use the *stat functions. - */ -int -__la_fstat(int fd, struct stat *st) -{ - struct ustat u; - int ret; - - if (fd < 0) { - errno = EBADF; - return (-1); - } - ret = __hstat((HANDLE)_get_osfhandle(fd), &u); - if (ret >= 0) { - copy_stat(st, &u); - if (u.st_mode & (S_IFCHR | S_IFIFO)) { - st->st_dev = fd; - st->st_rdev = fd; - } - } - return (ret); -} - -/* This can exceed MAX_PATH limitation. */ -int -__la_stat(const char *path, struct stat *st) -{ - HANDLE handle; - struct ustat u; - int ret; - - handle = la_CreateFile(path, 0, 0, NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, - NULL); - if (handle == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - return (-1); - } - ret = __hstat(handle, &u); - CloseHandle(handle); - if (ret >= 0) { - char *p; - - copy_stat(st, &u); - p = strrchr(path, '.'); - if (p != NULL && strlen(p) == 4) { - char exttype[4]; - - ++ p; - exttype[0] = toupper(*p++); - exttype[1] = toupper(*p++); - exttype[2] = toupper(*p++); - exttype[3] = '\0'; - if (!strcmp(exttype, "EXE") || !strcmp(exttype, "CMD") || - !strcmp(exttype, "BAT") || !strcmp(exttype, "COM")) - st->st_mode |= S_IXUSR | S_IXGRP | S_IXOTH; - } - } - return (ret); -} - -/* - * This waitpid is limited implementation. - */ -pid_t -__la_waitpid(HANDLE child, int *status, int option) -{ - DWORD cs; - - (void)option;/* UNUSED */ - do { - if (GetExitCodeProcess(child, &cs) == 0) { - CloseHandle(child); - la_dosmaperr(GetLastError()); - *status = 0; - return (-1); - } - } while (cs == STILL_ACTIVE); - - *status = (int)(cs & 0xff); - return (0); -} - -ssize_t -__la_write(int fd, const void *buf, size_t nbytes) -{ - DWORD bytes_written; - -#ifdef _WIN64 - if (nbytes > UINT32_MAX) - nbytes = UINT32_MAX; -#endif - if (fd < 0) { - errno = EBADF; - return (-1); - } - if (!WriteFile((HANDLE)_get_osfhandle(fd), buf, (uint32_t)nbytes, - &bytes_written, NULL)) { - DWORD lasterr; - - lasterr = GetLastError(); - if (lasterr == ERROR_ACCESS_DENIED) - errno = EBADF; - else - la_dosmaperr(lasterr); - return (-1); - } - return (bytes_written); -} - -/* - * Replace the Windows path separator '\' with '/'. - */ -static int -replace_pathseparator(struct archive_wstring *ws, const wchar_t *wp) -{ - wchar_t *w; - size_t path_length; - - if (wp == NULL) - return(0); - if (wcschr(wp, L'\\') == NULL) - return(0); - path_length = wcslen(wp); - if (archive_wstring_ensure(ws, path_length) == NULL) - return(-1); - archive_wstrncpy(ws, wp, path_length); - for (w = ws->s; *w; w++) { - if (*w == L'\\') - *w = L'/'; - } - return(1); -} - -static int -fix_pathseparator(struct archive_entry *entry) -{ - struct archive_wstring ws; - const wchar_t *wp; - int ret = ARCHIVE_OK; - - archive_string_init(&ws); - wp = archive_entry_pathname_w(entry); - switch (replace_pathseparator(&ws, wp)) { - case 0: /* Not replaced. */ - break; - case 1: /* Replaced. */ - archive_entry_copy_pathname_w(entry, ws.s); - break; - default: - ret = ARCHIVE_FAILED; - } - wp = archive_entry_hardlink_w(entry); - switch (replace_pathseparator(&ws, wp)) { - case 0: /* Not replaced. */ - break; - case 1: /* Replaced. */ - archive_entry_copy_hardlink_w(entry, ws.s); - break; - default: - ret = ARCHIVE_FAILED; - } - wp = archive_entry_symlink_w(entry); - switch (replace_pathseparator(&ws, wp)) { - case 0: /* Not replaced. */ - break; - case 1: /* Replaced. */ - archive_entry_copy_symlink_w(entry, ws.s); - break; - default: - ret = ARCHIVE_FAILED; - } - archive_wstring_free(&ws); - return(ret); -} - -struct archive_entry * -__la_win_entry_in_posix_pathseparator(struct archive_entry *entry) -{ - struct archive_entry *entry_main; - const wchar_t *wp; - int has_backslash = 0; - int ret; - - wp = archive_entry_pathname_w(entry); - if (wp != NULL && wcschr(wp, L'\\') != NULL) - has_backslash = 1; - if (!has_backslash) { - wp = archive_entry_hardlink_w(entry); - if (wp != NULL && wcschr(wp, L'\\') != NULL) - has_backslash = 1; - } - if (!has_backslash) { - wp = archive_entry_symlink_w(entry); - if (wp != NULL && wcschr(wp, L'\\') != NULL) - has_backslash = 1; - } - /* - * If there is no backslach chars, return the original. - */ - if (!has_backslash) - return (entry); - - /* Copy entry so we can modify it as needed. */ - entry_main = archive_entry_clone(entry); - if (entry_main == NULL) - return (NULL); - /* Replace the Windows path-separator '\' with '/'. */ - ret = fix_pathseparator(entry_main); - if (ret < ARCHIVE_WARN) { - archive_entry_free(entry_main); - return (NULL); - } - return (entry_main); -} - - -/* - * The following function was modified from PostgreSQL sources and is - * subject to the copyright below. - */ -/*------------------------------------------------------------------------- - * - * win32error.c - * Map win32 error codes to errno values - * - * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - * - * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/win32error.c,v 1.4 2008/01/01 19:46:00 momjian Exp $ - * - *------------------------------------------------------------------------- - */ -/* -PostgreSQL Database Management System -(formerly known as Postgres, then as Postgres95) - -Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - -Portions Copyright (c) 1994, The Regents of the University of California - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose, without fee, and without a written agreement -is hereby granted, provided that the above copyright notice and this -paragraph and the following two paragraphs appear in all copies. - -IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR -DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING -LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS -DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO -PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -*/ - -static const struct { - DWORD winerr; - int doserr; -} doserrors[] = -{ - { ERROR_INVALID_FUNCTION, EINVAL }, - { ERROR_FILE_NOT_FOUND, ENOENT }, - { ERROR_PATH_NOT_FOUND, ENOENT }, - { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, - { ERROR_ACCESS_DENIED, EACCES }, - { ERROR_INVALID_HANDLE, EBADF }, - { ERROR_ARENA_TRASHED, ENOMEM }, - { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, - { ERROR_INVALID_BLOCK, ENOMEM }, - { ERROR_BAD_ENVIRONMENT, E2BIG }, - { ERROR_BAD_FORMAT, ENOEXEC }, - { ERROR_INVALID_ACCESS, EINVAL }, - { ERROR_INVALID_DATA, EINVAL }, - { ERROR_INVALID_DRIVE, ENOENT }, - { ERROR_CURRENT_DIRECTORY, EACCES }, - { ERROR_NOT_SAME_DEVICE, EXDEV }, - { ERROR_NO_MORE_FILES, ENOENT }, - { ERROR_LOCK_VIOLATION, EACCES }, - { ERROR_SHARING_VIOLATION, EACCES }, - { ERROR_BAD_NETPATH, ENOENT }, - { ERROR_NETWORK_ACCESS_DENIED, EACCES }, - { ERROR_BAD_NET_NAME, ENOENT }, - { ERROR_FILE_EXISTS, EEXIST }, - { ERROR_CANNOT_MAKE, EACCES }, - { ERROR_FAIL_I24, EACCES }, - { ERROR_INVALID_PARAMETER, EINVAL }, - { ERROR_NO_PROC_SLOTS, EAGAIN }, - { ERROR_DRIVE_LOCKED, EACCES }, - { ERROR_BROKEN_PIPE, EPIPE }, - { ERROR_DISK_FULL, ENOSPC }, - { ERROR_INVALID_TARGET_HANDLE, EBADF }, - { ERROR_INVALID_HANDLE, EINVAL }, - { ERROR_WAIT_NO_CHILDREN, ECHILD }, - { ERROR_CHILD_NOT_COMPLETE, ECHILD }, - { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, - { ERROR_NEGATIVE_SEEK, EINVAL }, - { ERROR_SEEK_ON_DEVICE, EACCES }, - { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, - { ERROR_NOT_LOCKED, EACCES }, - { ERROR_BAD_PATHNAME, ENOENT }, - { ERROR_MAX_THRDS_REACHED, EAGAIN }, - { ERROR_LOCK_FAILED, EACCES }, - { ERROR_ALREADY_EXISTS, EEXIST }, - { ERROR_FILENAME_EXCED_RANGE, ENOENT }, - { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, - { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } -}; - -void -__la_dosmaperr(unsigned long e) -{ - int i; - - if (e == 0) - { - errno = 0; - return; - } - - for (i = 0; i < (int)sizeof(doserrors); i++) - { - if (doserrors[i].winerr == e) - { - errno = doserrors[i].doserr; - return; - } - } - - /* fprintf(stderr, "unrecognized win32 error code: %lu", e); */ - errno = EINVAL; - return; -} - -#endif /* _WIN32 && !__CYGWIN__ */ diff --git a/libarchive/archive_windows.h b/libarchive/archive_windows.h deleted file mode 100644 index c6f5bc510513..000000000000 --- a/libarchive/archive_windows.h +++ /dev/null @@ -1,306 +0,0 @@ -/*- - * Copyright (c) 2009-2011 Michihiro NAKAJIMA - * Copyright (c) 2003-2006 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 - * 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. - * - * $FreeBSD$ - */ - -#ifndef __LIBARCHIVE_BUILD -#error This header is only to be used internally to libarchive. -#endif - -/* - * TODO: A lot of stuff in here isn't actually used by libarchive and - * can be trimmed out. Note that this file is used by libarchive and - * libarchive_test but nowhere else. (But note that it gets compiled - * with many different Windows environments, including MinGW, Visual - * Studio, and Cygwin. Significant changes should be tested in all three.) - */ - -/* - * TODO: Don't use off_t in here. Use __int64 instead. Note that - * Visual Studio and the Windows SDK define off_t as 32 bits; Win32's - * more modern file handling APIs all use __int64 instead of off_t. - */ - -#ifndef LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED -#define LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED - -/* Start of configuration for native Win32 */ -#ifndef MINGW_HAS_SECURE_API -#define MINGW_HAS_SECURE_API 1 -#endif - -#include -#define set_errno(val) ((errno)=val) -#include -#include //brings in NULL -#if defined(HAVE_STDINT_H) -#include -#endif -#include -#include -#include -#include -#include -#if defined(__MINGW32__) && defined(HAVE_UNISTD_H) -/* Prevent build error from a type mismatch of ftruncate(). - * This unistd.h defines it as ftruncate(int, off_t). */ -#include -#endif -#define NOCRYPT -#include -//#define EFTYPE 7 - -#if defined(__BORLANDC__) -#pragma warn -8068 /* Constant out of range in comparison. */ -#pragma warn -8072 /* Suspicious pointer arithmetic. */ -#endif - -#ifndef NULL -#ifdef __cplusplus -#define NULL 0 -#else -#define NULL ((void *)0) -#endif -#endif - -/* Alias the Windows _function to the POSIX equivalent. */ -#define close _close -#define fcntl(fd, cmd, flg) /* No operation. */ -#ifndef fileno -#define fileno _fileno -#endif -#ifdef fstat -#undef fstat -#endif -#define fstat __la_fstat -#if !defined(__BORLANDC__) -#ifdef lseek -#undef lseek -#endif -#define lseek _lseeki64 -#else -#define lseek __la_lseek -#define __LA_LSEEK_NEEDED -#endif -#define lstat __la_stat -#define open __la_open -#define read __la_read -#if !defined(__BORLANDC__) -#define setmode _setmode -#endif -#ifdef stat -#undef stat -#endif -#define stat(path,stref) __la_stat(path,stref) -#if !defined(__BORLANDC__) -#define strdup _strdup -#endif -#define tzset _tzset -#if !defined(__BORLANDC__) -#define umask _umask -#endif -#define waitpid __la_waitpid -#define write __la_write - -#ifndef O_RDONLY -#define O_RDONLY _O_RDONLY -#define O_WRONLY _O_WRONLY -#define O_TRUNC _O_TRUNC -#define O_CREAT _O_CREAT -#define O_EXCL _O_EXCL -#define O_BINARY _O_BINARY -#endif - -#ifndef _S_IFIFO - #define _S_IFIFO 0010000 /* pipe */ -#endif -#ifndef _S_IFCHR - #define _S_IFCHR 0020000 /* character special */ -#endif -#ifndef _S_IFDIR - #define _S_IFDIR 0040000 /* directory */ -#endif -#ifndef _S_IFBLK - #define _S_IFBLK 0060000 /* block special */ -#endif -#ifndef _S_IFLNK - #define _S_IFLNK 0120000 /* symbolic link */ -#endif -#ifndef _S_IFSOCK - #define _S_IFSOCK 0140000 /* socket */ -#endif -#ifndef _S_IFREG - #define _S_IFREG 0100000 /* regular */ -#endif -#ifndef _S_IFMT - #define _S_IFMT 0170000 /* file type mask */ -#endif - -#ifndef S_IFIFO -#define S_IFIFO _S_IFIFO -#endif -//#define S_IFCHR _S_IFCHR -//#define S_IFDIR _S_IFDIR -#ifndef S_IFBLK -#define S_IFBLK _S_IFBLK -#endif -#ifndef S_IFLNK -#define S_IFLNK _S_IFLNK -#endif -#ifndef S_IFSOCK -#define S_IFSOCK _S_IFSOCK -#endif -//#define S_IFREG _S_IFREG -//#define S_IFMT _S_IFMT - -#ifndef S_ISBLK -#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* block special */ -#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo or socket */ -#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */ -#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */ -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */ -#endif -#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* Symbolic link */ -#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* Socket */ - -#define _S_ISUID 0004000 /* set user id on execution */ -#define _S_ISGID 0002000 /* set group id on execution */ -#define _S_ISVTX 0001000 /* save swapped text even after use */ - -#define S_ISUID _S_ISUID -#define S_ISGID _S_ISGID -#define S_ISVTX _S_ISVTX - -#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) -#define _S_IXUSR _S_IEXEC /* read permission, user */ -#define _S_IWUSR _S_IWRITE /* write permission, user */ -#define _S_IRUSR _S_IREAD /* execute/search permission, user */ -#define _S_IRWXG (_S_IRWXU >> 3) -#define _S_IXGRP (_S_IXUSR >> 3) /* read permission, group */ -#define _S_IWGRP (_S_IWUSR >> 3) /* write permission, group */ -#define _S_IRGRP (_S_IRUSR >> 3) /* execute/search permission, group */ -#define _S_IRWXO (_S_IRWXG >> 3) -#define _S_IXOTH (_S_IXGRP >> 3) /* read permission, other */ -#define _S_IWOTH (_S_IWGRP >> 3) /* write permission, other */ -#define _S_IROTH (_S_IRGRP >> 3) /* execute/search permission, other */ - -#ifndef S_IRWXU -#define S_IRWXU _S_IRWXU -#define S_IXUSR _S_IXUSR -#define S_IWUSR _S_IWUSR -#define S_IRUSR _S_IRUSR -#endif -#define S_IRWXG _S_IRWXG -#define S_IXGRP _S_IXGRP -#define S_IWGRP _S_IWGRP -#define S_IRGRP _S_IRGRP -#define S_IRWXO _S_IRWXO -#define S_IXOTH _S_IXOTH -#define S_IWOTH _S_IWOTH -#define S_IROTH _S_IROTH - -#define F_DUPFD 0 /* Duplicate file descriptor. */ -#define F_GETFD 1 /* Get file descriptor flags. */ -#define F_SETFD 2 /* Set file descriptor flags. */ -#define F_GETFL 3 /* Get file status flags. */ -#define F_SETFL 4 /* Set file status flags. */ -#define F_GETOWN 5 /* Get owner (receiver of SIGIO). */ -#define F_SETOWN 6 /* Set owner (receiver of SIGIO). */ -#define F_GETLK 7 /* Get record locking info. */ -#define F_SETLK 8 /* Set record locking info (non-blocking). */ -#define F_SETLKW 9 /* Set record locking info (blocking). */ - -/* XXX missing */ -#define F_GETLK64 7 /* Get record locking info. */ -#define F_SETLK64 8 /* Set record locking info (non-blocking). */ -#define F_SETLKW64 9 /* Set record locking info (blocking). */ - -/* File descriptor flags used with F_GETFD and F_SETFD. */ -#define FD_CLOEXEC 1 /* Close on exec. */ - -//NOT SURE IF O_NONBLOCK is OK here but at least the 0x0004 flag is not used by anything else... -#define O_NONBLOCK 0x0004 /* Non-blocking I/O. */ -//#define O_NDELAY O_NONBLOCK - -/* Symbolic constants for the access() function */ -#if !defined(F_OK) - #define R_OK 4 /* Test for read permission */ - #define W_OK 2 /* Test for write permission */ - #define X_OK 1 /* Test for execute permission */ - #define F_OK 0 /* Test for existence of file */ -#endif - - -/* Replacement POSIX function */ -extern int __la_fstat(int fd, struct stat *st); -extern int __la_lstat(const char *path, struct stat *st); -#if defined(__LA_LSEEK_NEEDED) -extern __int64 __la_lseek(int fd, __int64 offset, int whence); -#endif -extern int __la_open(const char *path, int flags, ...); -extern ssize_t __la_read(int fd, void *buf, size_t nbytes); -extern int __la_stat(const char *path, struct stat *st); -extern pid_t __la_waitpid(HANDLE child, int *status, int option); -extern ssize_t __la_write(int fd, const void *buf, size_t nbytes); - -#define _stat64i32(path, st) __la_stat(path, st) -#define _stat64(path, st) __la_stat(path, st) -/* for status returned by la_waitpid */ -#define WIFEXITED(sts) ((sts & 0x100) == 0) -#define WEXITSTATUS(sts) (sts & 0x0FF) - -extern wchar_t *__la_win_permissive_name(const char *name); -extern wchar_t *__la_win_permissive_name_w(const wchar_t *wname); -extern void __la_dosmaperr(unsigned long e); -#define la_dosmaperr(e) __la_dosmaperr(e) -extern struct archive_entry *__la_win_entry_in_posix_pathseparator( - struct archive_entry *); - -#if defined(HAVE_WCRTOMB) && defined(__BORLANDC__) -typedef int mbstate_t; -size_t wcrtomb(char *, wchar_t, mbstate_t *); -#endif - -#if defined(_MSC_VER) && _MSC_VER < 1300 -WINBASEAPI BOOL WINAPI GetVolumePathNameW( - LPCWSTR lpszFileName, - LPWSTR lpszVolumePathName, - DWORD cchBufferLength - ); -# if _WIN32_WINNT < 0x0500 /* windows.h not providing 0x500 API */ -typedef struct _FILE_ALLOCATED_RANGE_BUFFER { - LARGE_INTEGER FileOffset; - LARGE_INTEGER Length; -} FILE_ALLOCATED_RANGE_BUFFER, *PFILE_ALLOCATED_RANGE_BUFFER; -# define FSCTL_SET_SPARSE \ - CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_WRITE_DATA) -# define FSCTL_QUERY_ALLOCATED_RANGES \ - CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51, METHOD_NEITHER, FILE_READ_DATA) -# endif -#endif - -#endif /* LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED */ diff --git a/libarchive/archive_write_disk_windows.c b/libarchive/archive_write_disk_windows.c deleted file mode 100644 index 0f0780a8e47e..000000000000 --- a/libarchive/archive_write_disk_windows.c +++ /dev/null @@ -1,2502 +0,0 @@ -/*- - * Copyright (c) 2003-2010 Tim Kientzle - * Copyright (c) 2011-2012 Michihiro NAKAJIMA - * 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 "archive_platform.h" -__FBSDID("$FreeBSD$"); - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_SYS_UTIME_H -#include -#endif -#ifdef HAVE_ERRNO_H -#include -#endif -#ifdef HAVE_FCNTL_H -#include -#endif -#ifdef HAVE_LIMITS_H -#include -#endif -#ifdef HAVE_STDLIB_H -#include -#endif -#include - -/* TODO: Support Mac OS 'quarantine' feature. This is really just a - * standard tag to mark files that have been downloaded as "tainted". - * On Mac OS, we should mark the extracted files as tainted if the - * archive being read was tainted. Windows has a similar feature; we - * should investigate ways to support this generically. */ - -#include "archive.h" -#include "archive_acl_private.h" -#include "archive_string.h" -#include "archive_entry.h" -#include "archive_private.h" - -#ifndef O_BINARY -#define O_BINARY 0 -#endif -#ifndef IO_REPARSE_TAG_SYMLINK -/* Old SDKs do not provide IO_REPARSE_TAG_SYMLINK */ -#define IO_REPARSE_TAG_SYMLINK 0xA000000CL -#endif - -static BOOL SetFilePointerEx_perso(HANDLE hFile, - LARGE_INTEGER liDistanceToMove, - PLARGE_INTEGER lpNewFilePointer, - DWORD dwMoveMethod) -{ - LARGE_INTEGER li; - li.QuadPart = liDistanceToMove.QuadPart; - li.LowPart = SetFilePointer( - hFile, li.LowPart, &li.HighPart, dwMoveMethod); - if(lpNewFilePointer) { - lpNewFilePointer->QuadPart = li.QuadPart; - } - return li.LowPart != (DWORD)-1 || GetLastError() == NO_ERROR; -} - -struct fixup_entry { - struct fixup_entry *next; - struct archive_acl acl; - mode_t mode; - int64_t atime; - int64_t birthtime; - int64_t mtime; - int64_t ctime; - unsigned long atime_nanos; - unsigned long birthtime_nanos; - unsigned long mtime_nanos; - unsigned long ctime_nanos; - unsigned long fflags_set; - int fixup; /* bitmask of what needs fixing */ - wchar_t *name; -}; - -/* - * We use a bitmask to track which operations remain to be done for - * this file. In particular, this helps us avoid unnecessary - * operations when it's possible to take care of one step as a - * side-effect of another. For example, mkdir() can specify the mode - * for the newly-created object but symlink() cannot. This means we - * can skip chmod() if mkdir() succeeded, but we must explicitly - * chmod() if we're trying to create a directory that already exists - * (mkdir() failed) or if we're restoring a symlink. Similarly, we - * need to verify UID/GID before trying to restore SUID/SGID bits; - * that verification can occur explicitly through a stat() call or - * implicitly because of a successful chown() call. - */ -#define TODO_MODE_FORCE 0x40000000 -#define TODO_MODE_BASE 0x20000000 -#define TODO_SUID 0x10000000 -#define TODO_SUID_CHECK 0x08000000 -#define TODO_SGID 0x04000000 -#define TODO_SGID_CHECK 0x02000000 -#define TODO_MODE (TODO_MODE_BASE|TODO_SUID|TODO_SGID) -#define TODO_TIMES ARCHIVE_EXTRACT_TIME -#define TODO_OWNER ARCHIVE_EXTRACT_OWNER -#define TODO_FFLAGS ARCHIVE_EXTRACT_FFLAGS -#define TODO_ACLS ARCHIVE_EXTRACT_ACL -#define TODO_XATTR ARCHIVE_EXTRACT_XATTR -#define TODO_MAC_METADATA ARCHIVE_EXTRACT_MAC_METADATA - -struct archive_write_disk { - struct archive archive; - - mode_t user_umask; - struct fixup_entry *fixup_list; - struct fixup_entry *current_fixup; - int64_t user_uid; - int skip_file_set; - int64_t skip_file_dev; - int64_t skip_file_ino; - time_t start_time; - - int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid); - void (*cleanup_gid)(void *private); - void *lookup_gid_data; - int64_t (*lookup_uid)(void *private, const char *uname, int64_t uid); - void (*cleanup_uid)(void *private); - void *lookup_uid_data; - - /* - * Full path of last file to satisfy symlink checks. - */ - struct archive_wstring path_safe; - - /* - * Cached stat data from disk for the current entry. - * If this is valid, pst points to st. Otherwise, - * pst is null. - */ - BY_HANDLE_FILE_INFORMATION st; - BY_HANDLE_FILE_INFORMATION *pst; - - /* Information about the object being restored right now. */ - struct archive_entry *entry; /* Entry being extracted. */ - wchar_t *name; /* Name of entry, possibly edited. */ - struct archive_wstring _name_data; /* backing store for 'name' */ - /* Tasks remaining for this object. */ - int todo; - /* Tasks deferred until end-of-archive. */ - int deferred; - /* Options requested by the client. */ - int flags; - /* Handle for the file we're restoring. */ - HANDLE fh; - /* Current offset for writing data to the file. */ - int64_t offset; - /* Last offset actually written to disk. */ - int64_t fd_offset; - /* Total bytes actually written to files. */ - int64_t total_bytes_written; - /* Maximum size of file, -1 if unknown. */ - int64_t filesize; - /* Dir we were in before this restore; only for deep paths. */ - int restore_pwd; - /* Mode we should use for this entry; affected by _PERM and umask. */ - mode_t mode; - /* UID/GID to use in restoring this entry. */ - int64_t uid; - int64_t gid; -}; - -/* - * Default mode for dirs created automatically (will be modified by umask). - * Note that POSIX specifies 0777 for implicity-created dirs, "modified - * by the process' file creation mask." - */ -#define DEFAULT_DIR_MODE 0777 -/* - * Dir modes are restored in two steps: During the extraction, the permissions - * in the archive are modified to match the following limits. During - * the post-extract fixup pass, the permissions from the archive are - * applied. - */ -#define MINIMUM_DIR_MODE 0700 -#define MAXIMUM_DIR_MODE 0775 - -static int check_symlinks(struct archive_write_disk *); -static int create_filesystem_object(struct archive_write_disk *); -static struct fixup_entry *current_fixup(struct archive_write_disk *, - const wchar_t *pathname); -static int cleanup_pathname(struct archive_write_disk *); -static int create_dir(struct archive_write_disk *, wchar_t *); -static int create_parent_dir(struct archive_write_disk *, wchar_t *); -static int la_chmod(const wchar_t *, mode_t); -static int older(BY_HANDLE_FILE_INFORMATION *, struct archive_entry *); -static int permissive_name_w(struct archive_write_disk *); -static int restore_entry(struct archive_write_disk *); -static int set_acls(struct archive_write_disk *, HANDLE h, - const wchar_t *, struct archive_acl *); -static int set_xattrs(struct archive_write_disk *); -static int set_fflags(struct archive_write_disk *); -static int set_ownership(struct archive_write_disk *); -static int set_mode(struct archive_write_disk *, int mode); -static int set_times(struct archive_write_disk *, HANDLE, int, - const wchar_t *, time_t, long, time_t, long, time_t, - long, time_t, long); -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 struct archive_vtable *archive_write_disk_vtable(void); - -static int _archive_write_disk_close(struct archive *); -static int _archive_write_disk_free(struct archive *); -static int _archive_write_disk_header(struct archive *, - struct archive_entry *); -static int64_t _archive_write_disk_filter_bytes(struct archive *, int); -static int _archive_write_disk_finish_entry(struct archive *); -static ssize_t _archive_write_disk_data(struct archive *, const void *, - size_t); -static ssize_t _archive_write_disk_data_block(struct archive *, const void *, - size_t, int64_t); - -#define bhfi_dev(bhfi) ((bhfi)->dwVolumeSerialNumber) -/* Treat FileIndex as i-node. We should remove a sequence number - * which is high-16-bits of nFileIndexHigh. */ -#define bhfi_ino(bhfi) \ - ((((int64_t)((bhfi)->nFileIndexHigh & 0x0000FFFFUL)) << 32) \ - + (bhfi)->nFileIndexLow) -#define bhfi_size(bhfi) \ - ((((int64_t)(bhfi)->nFileSizeHigh) << 32) + (bhfi)->nFileSizeLow) - -static int -file_information(struct archive_write_disk *a, wchar_t *path, - BY_HANDLE_FILE_INFORMATION *st, mode_t *mode, int sim_lstat) -{ - HANDLE h; - int r; - DWORD flag = FILE_FLAG_BACKUP_SEMANTICS; - WIN32_FIND_DATAW findData; - - if (sim_lstat || mode != NULL) { - h = FindFirstFileW(path, &findData); - if (h == INVALID_HANDLE_VALUE && - GetLastError() == ERROR_INVALID_NAME) { - wchar_t *full; - full = __la_win_permissive_name_w(path); - h = FindFirstFileW(full, &findData); - free(full); - } - if (h == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - return (-1); - } - FindClose(h); - } - - /* Is symlink file ? */ - if (sim_lstat && - ((findData.dwFileAttributes - & FILE_ATTRIBUTE_REPARSE_POINT) && - (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK))) - flag |= FILE_FLAG_OPEN_REPARSE_POINT; - - h = CreateFileW(a->name, 0, 0, NULL, - OPEN_EXISTING, flag, NULL); - if (h == INVALID_HANDLE_VALUE && - GetLastError() == ERROR_INVALID_NAME) { - wchar_t *full; - full = __la_win_permissive_name_w(path); - h = CreateFileW(full, 0, 0, NULL, - OPEN_EXISTING, flag, NULL); - free(full); - } - if (h == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - return (-1); - } - r = GetFileInformationByHandle(h, st); - CloseHandle(h); - if (r == 0) { - la_dosmaperr(GetLastError()); - return (-1); - } - - if (mode == NULL) - return (0); - - *mode = S_IRUSR | S_IRGRP | S_IROTH; - if ((st->dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0) - *mode |= S_IWUSR | S_IWGRP | S_IWOTH; - if ((st->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && - findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK) - *mode |= S_IFLNK; - else if (st->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - *mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH; - else { - const wchar_t *p; - - *mode |= S_IFREG; - p = wcsrchr(path, L'.'); - if (p != NULL && wcslen(p) == 4) { - switch (p[1]) { - case L'B': case L'b': - if ((p[2] == L'A' || p[2] == L'a' ) && - (p[3] == L'T' || p[3] == L't' )) - *mode |= S_IXUSR | S_IXGRP | S_IXOTH; - break; - case L'C': case L'c': - if (((p[2] == L'M' || p[2] == L'm' ) && - (p[3] == L'D' || p[3] == L'd' )) || - ((p[2] == L'M' || p[2] == L'm' ) && - (p[3] == L'D' || p[3] == L'd' ))) - *mode |= S_IXUSR | S_IXGRP | S_IXOTH; - break; - case L'E': case L'e': - if ((p[2] == L'X' || p[2] == L'x' ) && - (p[3] == L'E' || p[3] == L'e' )) - *mode |= S_IXUSR | S_IXGRP | S_IXOTH; - break; - default: - break; - } - } - } - return (0); -} - -/* - * Note: The path, for example, "aa/a/../b../c" will be converted to "aa/c" - * by GetFullPathNameW() W32 API, which __la_win_permissive_name_w uses. - * It means we cannot handle multiple dirs in one archive_entry. - * So we have to make the full-pathname in another way, which does not - * break "../" path string. - */ -static int -permissive_name_w(struct archive_write_disk *a) -{ - wchar_t *wn, *wnp; - wchar_t *ws, *wsp; - DWORD l; - - wnp = a->name; - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'?' && wnp[3] == L'\\') - /* We have already a permissive name. */ - return (0); - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'.' && wnp[3] == L'\\') { - /* This is a device name */ - if (((wnp[4] >= L'a' && wnp[4] <= L'z') || - (wnp[4] >= L'A' && wnp[4] <= L'Z')) && - wnp[5] == L':' && wnp[6] == L'\\') { - wnp[2] = L'?';/* Not device name. */ - return (0); - } - } - - /* - * A full-pathname starting with a drive name like "C:\abc". - */ - if (((wnp[0] >= L'a' && wnp[0] <= L'z') || - (wnp[0] >= L'A' && wnp[0] <= L'Z')) && - wnp[1] == L':' && wnp[2] == L'\\') { - wn = _wcsdup(wnp); - if (wn == NULL) - return (-1); - archive_wstring_ensure(&(a->_name_data), 4 + wcslen(wn) + 1); - a->name = a->_name_data.s; - /* Prepend "\\?\" */ - archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4); - archive_wstrcat(&(a->_name_data), wn); - free(wn); - return (0); - } - - /* - * A full-pathname pointig a network drive - * like "\\\\file". - */ - if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') { - const wchar_t *p = &wnp[2]; - - /* Skip server-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\') { - const wchar_t *rp = ++p; - /* Skip share-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\' && p != rp) { - /* Now, match patterns such as - * "\\server-name\share-name\" */ - wn = _wcsdup(wnp); - if (wn == NULL) - return (-1); - archive_wstring_ensure(&(a->_name_data), - 8 + wcslen(wn) + 1); - a->name = a->_name_data.s; - /* Prepend "\\?\UNC\" */ - archive_wstrncpy(&(a->_name_data), - L"\\\\?\\UNC\\", 8); - archive_wstrcat(&(a->_name_data), wn+2); - free(wn); - return (0); - } - } - return (0); - } - - /* - * Get current working directory. - */ - l = GetCurrentDirectoryW(0, NULL); - if (l == 0) - return (-1); - ws = malloc(l * sizeof(wchar_t)); - l = GetCurrentDirectoryW(l, ws); - if (l == 0) { - free(ws); - return (-1); - } - wsp = ws; - - /* - * A full-pathname starting without a drive name like "\abc". - */ - if (wnp[0] == L'\\') { - wn = _wcsdup(wnp); - if (wn == NULL) - return (-1); - archive_wstring_ensure(&(a->_name_data), - 4 + 2 + wcslen(wn) + 1); - a->name = a->_name_data.s; - /* Prepend "\\?\" and drive name. */ - archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4); - archive_wstrncat(&(a->_name_data), wsp, 2); - archive_wstrcat(&(a->_name_data), wn); - free(wsp); - free(wn); - return (0); - } - - wn = _wcsdup(wnp); - if (wn == NULL) - return (-1); - archive_wstring_ensure(&(a->_name_data), 4 + l + 1 + wcslen(wn) + 1); - a->name = a->_name_data.s; - /* Prepend "\\?\" and drive name. */ - archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4); - archive_wstrncat(&(a->_name_data), wsp, l); - archive_wstrncat(&(a->_name_data), L"\\", 1); - archive_wstrcat(&(a->_name_data), wn); - a->name = a->_name_data.s; - free(wsp); - free(wn); - return (0); -} - -static int -la_chmod(const wchar_t *path, mode_t mode) -{ - DWORD attr; - BOOL r; - wchar_t *fullname; - int ret = 0; - - fullname = NULL; - attr = GetFileAttributesW(path); - if (attr == (DWORD)-1 && - GetLastError() == ERROR_INVALID_NAME) { - fullname = __la_win_permissive_name_w(path); - attr = GetFileAttributesW(fullname); - } - if (attr == (DWORD)-1) { - la_dosmaperr(GetLastError()); - ret = -1; - goto exit_chmode; - } - if (mode & _S_IWRITE) - attr &= ~FILE_ATTRIBUTE_READONLY; - else - attr |= FILE_ATTRIBUTE_READONLY; - if (fullname != NULL) - r = SetFileAttributesW(fullname, attr); - else - r = SetFileAttributesW(path, attr); - if (r == 0) { - la_dosmaperr(GetLastError()); - ret = -1; - } -exit_chmode: - free(fullname); - return (ret); -} - -static void * -la_GetFunctionKernel32(const char *name) -{ - static HINSTANCE lib; - static int set; - if (!set) { - set = 1; - lib = LoadLibrary("kernel32.dll"); - } - if (lib == NULL) { - fprintf(stderr, "Can't load kernel32.dll?!\n"); - exit(1); - } - return (void *)GetProcAddress(lib, name); -} - -static int -la_CreateHardLinkW(wchar_t *linkname, wchar_t *target) -{ - static BOOLEAN (WINAPI *f)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES); - static int set; - BOOL ret; - - if (!set) { - set = 1; - f = la_GetFunctionKernel32("CreateHardLinkW"); - } - if (!f) - return (0); - ret = (*f)(linkname, target, NULL); - if (!ret) { - /* Under windows 2000, it is necessary to remove - * the "\\?\" prefix. */ -#define IS_UNC(name) ((name[0] == L'U' || name[0] == L'u') && \ - (name[1] == L'N' || name[1] == L'n') && \ - (name[2] == L'C' || name[2] == L'c') && \ - name[3] == L'\\') - if (!wcsncmp(linkname,L"\\\\?\\", 4)) { - linkname += 4; - if (IS_UNC(linkname)) - linkname += 4; - } - if (!wcsncmp(target,L"\\\\?\\", 4)) { - target += 4; - if (IS_UNC(target)) - target += 4; - } -#undef IS_UNC - ret = (*f)(linkname, target, NULL); - } - return (ret); -} - -static int -la_ftruncate(HANDLE handle, int64_t length) -{ - LARGE_INTEGER distance; - - if (GetFileType(handle) != FILE_TYPE_DISK) { - errno = EBADF; - return (-1); - } - distance.QuadPart = length; - if (!SetFilePointerEx_perso(handle, distance, NULL, FILE_BEGIN)) { - la_dosmaperr(GetLastError()); - return (-1); - } - if (!SetEndOfFile(handle)) { - la_dosmaperr(GetLastError()); - return (-1); - } - return (0); -} - -static int -lazy_stat(struct archive_write_disk *a) -{ - if (a->pst != NULL) { - /* Already have stat() data available. */ - return (ARCHIVE_OK); - } - if (a->fh != INVALID_HANDLE_VALUE && - GetFileInformationByHandle(a->fh, &a->st) == 0) { - a->pst = &a->st; - return (ARCHIVE_OK); - } - - /* - * XXX At this point, symlinks should not be hit, otherwise - * XXX a race occurred. Do we want to check explicitly for that? - */ - if (file_information(a, a->name, &a->st, NULL, 1) == 0) { - a->pst = &a->st; - return (ARCHIVE_OK); - } - archive_set_error(&a->archive, errno, "Couldn't stat file"); - return (ARCHIVE_WARN); -} - -static struct archive_vtable * -archive_write_disk_vtable(void) -{ - static struct archive_vtable av; - static int inited = 0; - - if (!inited) { - av.archive_close = _archive_write_disk_close; - av.archive_filter_bytes = _archive_write_disk_filter_bytes; - av.archive_free = _archive_write_disk_free; - av.archive_write_header = _archive_write_disk_header; - av.archive_write_finish_entry - = _archive_write_disk_finish_entry; - av.archive_write_data = _archive_write_disk_data; - av.archive_write_data_block = _archive_write_disk_data_block; - inited = 1; - } - return (&av); -} - -static int64_t -_archive_write_disk_filter_bytes(struct archive *_a, int n) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - (void)n; /* UNUSED */ - if (n == -1 || n == 0) - return (a->total_bytes_written); - return (-1); -} - - -int -archive_write_disk_set_options(struct archive *_a, int flags) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - - a->flags = flags; - return (ARCHIVE_OK); -} - - -/* - * Extract this entry to disk. - * - * TODO: Validate hardlinks. According to the standards, we're - * supposed to check each extracted hardlink and squawk if it refers - * to a file that we didn't restore. I'm not entirely convinced this - * is a good idea, but more importantly: Is there any way to validate - * hardlinks without keeping a complete list of filenames from the - * entire archive?? Ugh. - * - */ -static int -_archive_write_disk_header(struct archive *_a, struct archive_entry *entry) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - struct fixup_entry *fe; - int ret, r; - - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, - "archive_write_disk_header"); - archive_clear_error(&a->archive); - if (a->archive.state & ARCHIVE_STATE_DATA) { - r = _archive_write_disk_finish_entry(&a->archive); - if (r == ARCHIVE_FATAL) - return (r); - } - - /* Set up for this particular entry. */ - a->pst = NULL; - a->current_fixup = NULL; - a->deferred = 0; - if (a->entry) { - archive_entry_free(a->entry); - a->entry = NULL; - } - a->entry = archive_entry_clone(entry); - a->fh = INVALID_HANDLE_VALUE; - a->fd_offset = 0; - a->offset = 0; - a->restore_pwd = -1; - a->uid = a->user_uid; - a->mode = archive_entry_mode(a->entry); - if (archive_entry_size_is_set(a->entry)) - a->filesize = archive_entry_size(a->entry); - else - a->filesize = -1; - archive_wstrcpy(&(a->_name_data), archive_entry_pathname_w(a->entry)); - a->name = a->_name_data.s; - archive_clear_error(&a->archive); - - /* - * Clean up the requested path. This is necessary for correct - * dir restores; the dir restore logic otherwise gets messed - * up by nonsense like "dir/.". - */ - ret = cleanup_pathname(a); - if (ret != ARCHIVE_OK) - return (ret); - - /* - * Generate a full-pathname and use it from here. - */ - if (permissive_name_w(a) < 0) { - errno = EINVAL; - return (ARCHIVE_FAILED); - } - - /* - * Query the umask so we get predictable mode settings. - * This gets done on every call to _write_header in case the - * user edits their umask during the extraction for some - * reason. - */ - umask(a->user_umask = umask(0)); - - /* Figure out what we need to do for this entry. */ - a->todo = TODO_MODE_BASE; - if (a->flags & ARCHIVE_EXTRACT_PERM) { - a->todo |= TODO_MODE_FORCE; /* Be pushy about permissions. */ - /* - * SGID requires an extra "check" step because we - * cannot easily predict the GID that the system will - * assign. (Different systems assign GIDs to files - * based on a variety of criteria, including process - * credentials and the gid of the enclosing - * directory.) We can only restore the SGID bit if - * the file has the right GID, and we only know the - * GID if we either set it (see set_ownership) or if - * we've actually called stat() on the file after it - * was restored. Since there are several places at - * which we might verify the GID, we need a TODO bit - * to keep track. - */ - if (a->mode & S_ISGID) - a->todo |= TODO_SGID | TODO_SGID_CHECK; - /* - * Verifying the SUID is simpler, but can still be - * done in multiple ways, hence the separate "check" bit. - */ - if (a->mode & S_ISUID) - a->todo |= TODO_SUID | TODO_SUID_CHECK; - } else { - /* - * User didn't request full permissions, so don't - * restore SUID, SGID bits and obey umask. - */ - a->mode &= ~S_ISUID; - a->mode &= ~S_ISGID; - a->mode &= ~S_ISVTX; - a->mode &= ~a->user_umask; - } -#if 0 - if (a->flags & ARCHIVE_EXTRACT_OWNER) - a->todo |= TODO_OWNER; -#endif - if (a->flags & ARCHIVE_EXTRACT_TIME) - a->todo |= TODO_TIMES; - if (a->flags & ARCHIVE_EXTRACT_ACL) { - if (archive_entry_filetype(a->entry) == AE_IFDIR) - a->deferred |= TODO_ACLS; - else - a->todo |= TODO_ACLS; - } - if (a->flags & ARCHIVE_EXTRACT_XATTR) - a->todo |= TODO_XATTR; - if (a->flags & ARCHIVE_EXTRACT_FFLAGS) - a->todo |= TODO_FFLAGS; - if (a->flags & ARCHIVE_EXTRACT_SECURE_SYMLINKS) { - ret = check_symlinks(a); - if (ret != ARCHIVE_OK) - return (ret); - } - - ret = restore_entry(a); - - /* - * TODO: There are rumours that some extended attributes must - * be restored before file data is written. If this is true, - * then we either need to write all extended attributes both - * before and after restoring the data, or find some rule for - * determining which must go first and which last. Due to the - * many ways people are using xattrs, this may prove to be an - * intractable problem. - */ - - /* - * Fixup uses the unedited pathname from archive_entry_pathname(), - * because it is relative to the base dir and the edited path - * might be relative to some intermediate dir as a result of the - * deep restore logic. - */ - if (a->deferred & TODO_MODE) { - fe = current_fixup(a, archive_entry_pathname_w(entry)); - fe->fixup |= TODO_MODE_BASE; - fe->mode = a->mode; - } - - if ((a->deferred & TODO_TIMES) - && (archive_entry_mtime_is_set(entry) - || archive_entry_atime_is_set(entry))) { - fe = current_fixup(a, archive_entry_pathname_w(entry)); - fe->mode = a->mode; - fe->fixup |= TODO_TIMES; - if (archive_entry_atime_is_set(entry)) { - fe->atime = archive_entry_atime(entry); - fe->atime_nanos = archive_entry_atime_nsec(entry); - } else { - /* If atime is unset, use start time. */ - fe->atime = a->start_time; - fe->atime_nanos = 0; - } - if (archive_entry_mtime_is_set(entry)) { - fe->mtime = archive_entry_mtime(entry); - fe->mtime_nanos = archive_entry_mtime_nsec(entry); - } else { - /* If mtime is unset, use start time. */ - fe->mtime = a->start_time; - fe->mtime_nanos = 0; - } - if (archive_entry_birthtime_is_set(entry)) { - fe->birthtime = archive_entry_birthtime(entry); - fe->birthtime_nanos = archive_entry_birthtime_nsec(entry); - } else { - /* If birthtime is unset, use mtime. */ - fe->birthtime = fe->mtime; - fe->birthtime_nanos = fe->mtime_nanos; - } - } - - if (a->deferred & TODO_ACLS) { - fe = current_fixup(a, archive_entry_pathname_w(entry)); - archive_acl_copy(&fe->acl, archive_entry_acl(entry)); - } - - if (a->deferred & TODO_FFLAGS) { - fe = current_fixup(a, archive_entry_pathname_w(entry)); - fe->fixup |= TODO_FFLAGS; - /* TODO: Complete this.. defer fflags from below. */ - } - - /* - * On Windows, A creating sparse file requires a special mark. - */ - if (a->fh != INVALID_HANDLE_VALUE && - archive_entry_sparse_count(entry) > 0) { - int64_t base = 0, offset, length; - int i, cnt = archive_entry_sparse_reset(entry); - int sparse = 0; - - for (i = 0; i < cnt; i++) { - archive_entry_sparse_next(entry, &offset, &length); - if (offset - base >= 4096) { - sparse = 1;/* we have a hole. */ - break; - } - base = offset + length; - } - if (sparse) { - DWORD dmy; - /* Mark this file as sparse. */ - DeviceIoControl(a->fh, FSCTL_SET_SPARSE, - NULL, 0, NULL, 0, &dmy, NULL); - } - } - - /* We've created the object and are ready to pour data into it. */ - if (ret >= ARCHIVE_WARN) - a->archive.state = ARCHIVE_STATE_DATA; - /* - * If it's not open, tell our client not to try writing. - * In particular, dirs, links, etc, don't get written to. - */ - if (a->fh == INVALID_HANDLE_VALUE) { - archive_entry_set_size(entry, 0); - a->filesize = 0; - } - - return (ret); -} - -int -archive_write_disk_set_skip_file(struct archive *_a, int64_t d, int64_t i) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_write_disk_set_skip_file"); - a->skip_file_set = 1; - a->skip_file_dev = d; - a->skip_file_ino = i; - return (ARCHIVE_OK); -} - -static ssize_t -write_data_block(struct archive_write_disk *a, const char *buff, size_t size) -{ - OVERLAPPED ol; - uint64_t start_size = size; - DWORD bytes_written = 0; - ssize_t block_size = 0, bytes_to_write; - - if (size == 0) - return (ARCHIVE_OK); - - if (a->filesize == 0 || a->fh == INVALID_HANDLE_VALUE) { - archive_set_error(&a->archive, 0, - "Attempt to write to an empty file"); - return (ARCHIVE_WARN); - } - - if (a->flags & ARCHIVE_EXTRACT_SPARSE) { - /* XXX TODO XXX Is there a more appropriate choice here ? */ - /* This needn't match the filesystem allocation size. */ - block_size = 16*1024; - } - - /* If this write would run beyond the file size, truncate it. */ - if (a->filesize >= 0 && (int64_t)(a->offset + size) > a->filesize) - start_size = size = (size_t)(a->filesize - a->offset); - - /* Write the data. */ - while (size > 0) { - if (block_size == 0) { - bytes_to_write = size; - } else { - /* We're sparsifying the file. */ - const char *p, *end; - int64_t block_end; - - /* Skip leading zero bytes. */ - for (p = buff, end = buff + size; p < end; ++p) { - if (*p != '\0') - break; - } - a->offset += p - buff; - size -= p - buff; - buff = p; - if (size == 0) - break; - - /* Calculate next block boundary after offset. */ - block_end - = (a->offset / block_size + 1) * block_size; - - /* If the adjusted write would cross block boundary, - * truncate it to the block boundary. */ - bytes_to_write = size; - if (a->offset + bytes_to_write > block_end) - bytes_to_write = (DWORD)(block_end - a->offset); - } - memset(&ol, 0, sizeof(ol)); - ol.Offset = (DWORD)(a->offset & 0xFFFFFFFF); - ol.OffsetHigh = (DWORD)(a->offset >> 32); - if (!WriteFile(a->fh, buff, (uint32_t)bytes_to_write, - &bytes_written, &ol)) { - DWORD lasterr; - - lasterr = GetLastError(); - if (lasterr == ERROR_ACCESS_DENIED) - errno = EBADF; - else - la_dosmaperr(lasterr); - archive_set_error(&a->archive, errno, "Write failed"); - return (ARCHIVE_WARN); - } - buff += bytes_written; - size -= bytes_written; - a->total_bytes_written += bytes_written; - a->offset += bytes_written; - a->fd_offset = a->offset; - } - return ((ssize_t)(start_size - size)); -} - -static ssize_t -_archive_write_disk_data_block(struct archive *_a, - const void *buff, size_t size, int64_t offset) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - ssize_t r; - - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_DATA, "archive_write_data_block"); - - a->offset = offset; - r = write_data_block(a, buff, size); - if (r < ARCHIVE_OK) - return (r); - if ((size_t)r < size) { - archive_set_error(&a->archive, 0, - "Write request too large"); - return (ARCHIVE_WARN); - } - return (ARCHIVE_OK); -} - -static ssize_t -_archive_write_disk_data(struct archive *_a, const void *buff, size_t size) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_DATA, "archive_write_data"); - - return (write_data_block(a, buff, size)); -} - -static int -_archive_write_disk_finish_entry(struct archive *_a) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - int ret = ARCHIVE_OK; - - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, - "archive_write_finish_entry"); - if (a->archive.state & ARCHIVE_STATE_HEADER) - return (ARCHIVE_OK); - archive_clear_error(&a->archive); - - /* Pad or truncate file to the right size. */ - if (a->fh == INVALID_HANDLE_VALUE) { - /* There's no file. */ - } else if (a->filesize < 0) { - /* File size is unknown, so we can't set the size. */ - } else if (a->fd_offset == a->filesize) { - /* Last write ended at exactly the filesize; we're done. */ - /* Hopefully, this is the common case. */ - } else { - if (la_ftruncate(a->fh, a->filesize) == -1) { - archive_set_error(&a->archive, errno, - "File size could not be restored"); - return (ARCHIVE_FAILED); - } - } - - /* Restore metadata. */ - - /* - * Look up the "real" UID only if we're going to need it. - * TODO: the TODO_SGID condition can be dropped here, can't it? - */ - if (a->todo & (TODO_OWNER | TODO_SUID | TODO_SGID)) { - a->uid = archive_write_disk_uid(&a->archive, - archive_entry_uname(a->entry), - archive_entry_uid(a->entry)); - } - /* Look up the "real" GID only if we're going to need it. */ - /* TODO: the TODO_SUID condition can be dropped here, can't it? */ - if (a->todo & (TODO_OWNER | TODO_SGID | TODO_SUID)) { - a->gid = archive_write_disk_gid(&a->archive, - archive_entry_gname(a->entry), - archive_entry_gid(a->entry)); - } - - /* - * Restore ownership before set_mode tries to restore suid/sgid - * bits. If we set the owner, we know what it is and can skip - * a stat() call to examine the ownership of the file on disk. - */ - if (a->todo & TODO_OWNER) - ret = set_ownership(a); - - /* - * set_mode must precede ACLs on systems such as Solaris and - * FreeBSD where setting the mode implicitly clears extended ACLs - */ - if (a->todo & TODO_MODE) { - int r2 = set_mode(a, a->mode); - if (r2 < ret) ret = r2; - } - - /* - * Security-related extended attributes (such as - * security.capability on Linux) have to be restored last, - * since they're implicitly removed by other file changes. - */ - if (a->todo & TODO_XATTR) { - int r2 = set_xattrs(a); - if (r2 < ret) ret = r2; - } - - /* - * Some flags prevent file modification; they must be restored after - * file contents are written. - */ - if (a->todo & TODO_FFLAGS) { - int r2 = set_fflags(a); - if (r2 < ret) ret = r2; - } - - /* - * Time must follow most other metadata; - * otherwise atime will get changed. - */ - if (a->todo & TODO_TIMES) { - int r2 = set_times_from_entry(a); - if (r2 < ret) ret = r2; - } - - /* - * ACLs must be restored after timestamps because there are - * ACLs that prevent attribute changes (including time). - */ - if (a->todo & TODO_ACLS) { - int r2 = set_acls(a, a->fh, - archive_entry_pathname_w(a->entry), - archive_entry_acl(a->entry)); - if (r2 < ret) ret = r2; - } - - /* If there's an fd, we can close it now. */ - if (a->fh != INVALID_HANDLE_VALUE) { - CloseHandle(a->fh); - a->fh = INVALID_HANDLE_VALUE; - } - /* If there's an entry, we can release it now. */ - if (a->entry) { - archive_entry_free(a->entry); - a->entry = NULL; - } - a->archive.state = ARCHIVE_STATE_HEADER; - return (ret); -} - -int -archive_write_disk_set_group_lookup(struct archive *_a, - void *private_data, - int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid), - void (*cleanup_gid)(void *private)) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_write_disk_set_group_lookup"); - - if (a->cleanup_gid != NULL && a->lookup_gid_data != NULL) - (a->cleanup_gid)(a->lookup_gid_data); - - a->lookup_gid = lookup_gid; - a->cleanup_gid = cleanup_gid; - a->lookup_gid_data = private_data; - return (ARCHIVE_OK); -} - -int -archive_write_disk_set_user_lookup(struct archive *_a, - void *private_data, - int64_t (*lookup_uid)(void *private, const char *uname, int64_t uid), - void (*cleanup_uid)(void *private)) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_write_disk_set_user_lookup"); - - if (a->cleanup_uid != NULL && a->lookup_uid_data != NULL) - (a->cleanup_uid)(a->lookup_uid_data); - - a->lookup_uid = lookup_uid; - a->cleanup_uid = cleanup_uid; - a->lookup_uid_data = private_data; - return (ARCHIVE_OK); -} - -int64_t -archive_write_disk_gid(struct archive *_a, const char *name, int64_t id) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_write_disk_gid"); - if (a->lookup_gid) - return (a->lookup_gid)(a->lookup_gid_data, name, id); - return (id); -} - -int64_t -archive_write_disk_uid(struct archive *_a, const char *name, int64_t id) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_ANY, "archive_write_disk_uid"); - if (a->lookup_uid) - return (a->lookup_uid)(a->lookup_uid_data, name, id); - return (id); -} - -/* - * Create a new archive_write_disk object and initialize it with global state. - */ -struct archive * -archive_write_disk_new(void) -{ - struct archive_write_disk *a; - - a = (struct archive_write_disk *)malloc(sizeof(*a)); - if (a == NULL) - return (NULL); - memset(a, 0, sizeof(*a)); - a->archive.magic = ARCHIVE_WRITE_DISK_MAGIC; - /* We're ready to write a header immediately. */ - a->archive.state = ARCHIVE_STATE_HEADER; - a->archive.vtable = archive_write_disk_vtable(); - a->start_time = time(NULL); - /* Query and restore the umask. */ - umask(a->user_umask = umask(0)); - if (archive_wstring_ensure(&a->path_safe, 512) == NULL) { - free(a); - return (NULL); - } - return (&a->archive); -} - -static int -disk_unlink(wchar_t *path) -{ - wchar_t *fullname; - int r; - - r = _wunlink(path); - if (r != 0 && GetLastError() == ERROR_INVALID_NAME) { - fullname = __la_win_permissive_name_w(path); - r = _wunlink(fullname); - free(fullname); - } - return (r); -} - -static int -disk_rmdir(wchar_t *path) -{ - wchar_t *fullname; - int r; - - r = _wrmdir(path); - if (r != 0 && GetLastError() == ERROR_INVALID_NAME) { - fullname = __la_win_permissive_name_w(path); - r = _wrmdir(fullname); - free(fullname); - } - return (r); -} - -/* - * The main restore function. - */ -static int -restore_entry(struct archive_write_disk *a) -{ - int ret = ARCHIVE_OK, en; - - if (a->flags & ARCHIVE_EXTRACT_UNLINK && !S_ISDIR(a->mode)) { - /* - * TODO: Fix this. Apparently, there are platforms - * that still allow root to hose the entire filesystem - * by unlinking a dir. The S_ISDIR() test above - * prevents us from using unlink() here if the new - * object is a dir, but that doesn't mean the old - * object isn't a dir. - */ - if (disk_unlink(a->name) == 0) { - /* We removed it, reset cached stat. */ - a->pst = NULL; - } else if (errno == ENOENT) { - /* File didn't exist, that's just as good. */ - } else if (disk_rmdir(a->name) == 0) { - /* It was a dir, but now it's gone. */ - a->pst = NULL; - } else { - /* We tried, but couldn't get rid of it. */ - archive_set_error(&a->archive, errno, - "Could not unlink"); - return(ARCHIVE_FAILED); - } - } - - /* Try creating it first; if this fails, we'll try to recover. */ - en = create_filesystem_object(a); - - if ((en == ENOTDIR || en == ENOENT) - && !(a->flags & ARCHIVE_EXTRACT_NO_AUTODIR)) { - wchar_t *full; - /* If the parent dir doesn't exist, try creating it. */ - create_parent_dir(a, a->name); - /* Now try to create the object again. */ - full = __la_win_permissive_name_w(a->name); - if (full == NULL) { - en = EINVAL; - } else { - /* Remove multiple directories such as "a/../b../c" */ - archive_wstrcpy(&(a->_name_data), full); - a->name = a->_name_data.s; - free(full); - en = create_filesystem_object(a); - } - } - - if ((en == EISDIR || en == EEXIST) - && (a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) { - /* If we're not overwriting, we're done. */ - archive_entry_unset_size(a->entry); - return (ARCHIVE_OK); - } - - /* - * Some platforms return EISDIR if you call - * open(O_WRONLY | O_EXCL | O_CREAT) on a directory, some - * return EEXIST. POSIX is ambiguous, requiring EISDIR - * for open(O_WRONLY) on a dir and EEXIST for open(O_EXCL | O_CREAT) - * on an existing item. - */ - if (en == EISDIR) { - /* A dir is in the way of a non-dir, rmdir it. */ - if (disk_rmdir(a->name) != 0) { - archive_set_error(&a->archive, errno, - "Can't remove already-existing dir"); - return (ARCHIVE_FAILED); - } - a->pst = NULL; - /* Try again. */ - en = create_filesystem_object(a); - } else if (en == EEXIST) { - mode_t st_mode; - /* - * We know something is in the way, but we don't know what; - * we need to find out before we go any further. - */ - int r = 0; - /* - * The SECURE_SYMLINK logic has already removed a - * symlink to a dir if the client wants that. So - * follow the symlink if we're creating a dir. - */ - if (S_ISDIR(a->mode)) - r = file_information(a, a->name, &a->st, &st_mode, 0); - /* - * If it's not a dir (or it's a broken symlink), - * then don't follow it. - */ - if (r != 0 || !S_ISDIR(a->mode)) - r = file_information(a, a->name, &a->st, &st_mode, 1); - if (r != 0) { - archive_set_error(&a->archive, errno, - "Can't stat existing object"); - return (ARCHIVE_FAILED); - } - - /* - * NO_OVERWRITE_NEWER doesn't apply to directories. - */ - if ((a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER) - && !S_ISDIR(st_mode)) { - if (!older(&(a->st), a->entry)) { - archive_entry_unset_size(a->entry); - return (ARCHIVE_OK); - } - } - - /* If it's our archive, we're done. */ - if (a->skip_file_set && - bhfi_dev(&a->st) == a->skip_file_dev && - bhfi_ino(&a->st) == a->skip_file_ino) { - archive_set_error(&a->archive, 0, - "Refusing to overwrite archive"); - return (ARCHIVE_FAILED); - } - - if (!S_ISDIR(st_mode)) { - /* A non-dir is in the way, unlink it. */ - if (disk_unlink(a->name) != 0) { - archive_set_error(&a->archive, errno, - "Can't unlink already-existing object"); - return (ARCHIVE_FAILED); - } - a->pst = NULL; - /* Try again. */ - en = create_filesystem_object(a); - } else if (!S_ISDIR(a->mode)) { - /* A dir is in the way of a non-dir, rmdir it. */ - if (disk_rmdir(a->name) != 0) { - archive_set_error(&a->archive, errno, - "Can't remove already-existing dir"); - return (ARCHIVE_FAILED); - } - /* Try again. */ - en = create_filesystem_object(a); - } else { - /* - * There's a dir in the way of a dir. Don't - * waste time with rmdir()/mkdir(), just fix - * up the permissions on the existing dir. - * Note that we don't change perms on existing - * dirs unless _EXTRACT_PERM is specified. - */ - if ((a->mode != st_mode) - && (a->todo & TODO_MODE_FORCE)) - a->deferred |= (a->todo & TODO_MODE); - /* Ownership doesn't need deferred fixup. */ - en = 0; /* Forget the EEXIST. */ - } - } - - if (en) { - /* Everything failed; give up here. */ - archive_set_error(&a->archive, en, "Can't create '%ls'", - a->name); - return (ARCHIVE_FAILED); - } - - a->pst = NULL; /* Cached stat data no longer valid. */ - return (ret); -} - -/* - * Returns 0 if creation succeeds, or else returns errno value from - * the failed system call. Note: This function should only ever perform - * a single system call. - */ -static int -create_filesystem_object(struct archive_write_disk *a) -{ - /* Create the entry. */ - const wchar_t *linkname; - wchar_t *fullname; - mode_t final_mode, mode; - int r; - - /* We identify hard/symlinks according to the link names. */ - /* Since link(2) and symlink(2) don't handle modes, we're done here. */ - linkname = archive_entry_hardlink_w(a->entry); - if (linkname != NULL) { - wchar_t *linkfull, *namefull; - - linkfull = __la_win_permissive_name_w(linkname); - namefull = __la_win_permissive_name_w(a->name); - if (linkfull == NULL || namefull == NULL) { - errno = EINVAL; - r = -1; - } else { - r = la_CreateHardLinkW(namefull, linkfull); - if (r == 0) { - la_dosmaperr(GetLastError()); - r = errno; - } else - r = 0; - } - /* - * New cpio and pax formats allow hardlink entries - * to carry data, so we may have to open the file - * for hardlink entries. - * - * If the hardlink was successfully created and - * the archive doesn't have carry data for it, - * consider it to be non-authoritative for meta data. - * This is consistent with GNU tar and BSD pax. - * If the hardlink does carry data, let the last - * archive entry decide ownership. - */ - if (r == 0 && a->filesize <= 0) { - a->todo = 0; - a->deferred = 0; - } else if (r == 0 && a->filesize > 0) { - a->fh = CreateFileW(namefull, GENERIC_WRITE, 0, NULL, - TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); - if (a->fh == INVALID_HANDLE_VALUE) { - la_dosmaperr(GetLastError()); - r = errno; - } - } - free(linkfull); - free(namefull); - return (r); - } - linkname = archive_entry_symlink_w(a->entry); - if (linkname != NULL) { -#if HAVE_SYMLINK - return symlink(linkname, a->name) ? errno : 0; -#else - return (EPERM); -#endif - } - - /* - * The remaining system calls all set permissions, so let's - * try to take advantage of that to avoid an extra chmod() - * call. (Recall that umask is set to zero right now!) - */ - - /* Mode we want for the final restored object (w/o file type bits). */ - final_mode = a->mode & 07777; - /* - * The mode that will actually be restored in this step. Note - * that SUID, SGID, etc, require additional work to ensure - * security, so we never restore them at this point. - */ - mode = final_mode & 0777 & ~a->user_umask; - - switch (a->mode & AE_IFMT) { - default: - /* POSIX requires that we fall through here. */ - /* FALLTHROUGH */ - case AE_IFREG: - fullname = a->name; - /* O_WRONLY | O_CREAT | O_EXCL */ - a->fh = CreateFileW(fullname, GENERIC_WRITE, 0, NULL, - CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - if (a->fh == INVALID_HANDLE_VALUE && - GetLastError() == ERROR_INVALID_NAME && - fullname == a->name) { - fullname = __la_win_permissive_name_w(a->name); - a->fh = CreateFileW(fullname, GENERIC_WRITE, 0, NULL, - CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - } - if (a->fh == INVALID_HANDLE_VALUE) { - if (GetLastError() == ERROR_ACCESS_DENIED) { - DWORD attr; - /* Simulate an errno of POSIX system. */ - attr = GetFileAttributesW(fullname); - if (attr == (DWORD)-1) - la_dosmaperr(GetLastError()); - else if (attr & FILE_ATTRIBUTE_DIRECTORY) - errno = EISDIR; - else - errno = EACCES; - } else - la_dosmaperr(GetLastError()); - r = 1; - } else - r = 0; - if (fullname != a->name) - free(fullname); - break; - case AE_IFCHR: - case AE_IFBLK: - /* TODO: Find a better way to warn about our inability - * to restore a block device node. */ - return (EINVAL); - case AE_IFDIR: - mode = (mode | MINIMUM_DIR_MODE) & MAXIMUM_DIR_MODE; - fullname = a->name; - r = CreateDirectoryW(fullname, NULL); - if (r == 0 && GetLastError() == ERROR_INVALID_NAME && - fullname == a->name) { - fullname = __la_win_permissive_name_w(a->name); - r = CreateDirectoryW(fullname, NULL); - } - if (r != 0) { - r = 0; - /* Defer setting dir times. */ - a->deferred |= (a->todo & TODO_TIMES); - a->todo &= ~TODO_TIMES; - /* Never use an immediate chmod(). */ - /* We can't avoid the chmod() entirely if EXTRACT_PERM - * because of SysV SGID inheritance. */ - if ((mode != final_mode) - || (a->flags & ARCHIVE_EXTRACT_PERM)) - a->deferred |= (a->todo & TODO_MODE); - a->todo &= ~TODO_MODE; - } else { - la_dosmaperr(GetLastError()); - r = -1; - } - if (fullname != a->name) - free(fullname); - break; - case AE_IFIFO: - /* TODO: Find a better way to warn about our inability - * to restore a fifo. */ - return (EINVAL); - } - - /* All the system calls above set errno on failure. */ - if (r) - return (errno); - - /* If we managed to set the final mode, we've avoided a chmod(). */ - if (mode == final_mode) - a->todo &= ~TODO_MODE; - return (0); -} - -/* - * Cleanup function for archive_extract. Mostly, this involves processing - * the fixup list, which is used to address a number of problems: - * * Dir permissions might prevent us from restoring a file in that - * dir, so we restore the dir with minimum 0700 permissions first, - * then correct the mode at the end. - * * Similarly, the act of restoring a file touches the directory - * and changes the timestamp on the dir, so we have to touch-up dir - * timestamps at the end as well. - * * Some file flags can interfere with the restore by, for example, - * preventing the creation of hardlinks to those files. - * * Mac OS extended metadata includes ACLs, so must be deferred on dirs. - * - * Note that tar/cpio do not require that archives be in a particular - * order; there is no way to know when the last file has been restored - * within a directory, so there's no way to optimize the memory usage - * here by fixing up the directory any earlier than the - * end-of-archive. - * - * XXX TODO: Directory ACLs should be restored here, for the same - * reason we set directory perms here. XXX - */ -static int -_archive_write_disk_close(struct archive *_a) -{ - struct archive_write_disk *a = (struct archive_write_disk *)_a; - struct fixup_entry *next, *p; - int ret; - - archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, - "archive_write_disk_close"); - ret = _archive_write_disk_finish_entry(&a->archive); - - /* Sort dir list so directories are fixed up in depth-first order. */ - p = sort_dir_list(a->fixup_list); - - while (p != NULL) { - a->pst = NULL; /* Mark stat cache as out-of-date. */ - if (p->fixup & TODO_TIMES) { - set_times(a, INVALID_HANDLE_VALUE, p->mode, p->name, - p->atime, p->atime_nanos, - p->birthtime, p->birthtime_nanos, - p->mtime, p->mtime_nanos, - p->ctime, p->ctime_nanos); - } - if (p->fixup & TODO_MODE_BASE) - la_chmod(p->name, p->mode); - if (p->fixup & TODO_ACLS) - set_acls(a, INVALID_HANDLE_VALUE, p->name, &p->acl); - next = p->next; - archive_acl_clear(&p->acl); - free(p->name); - free(p); - p = next; - } - a->fixup_list = NULL; - return (ret); -} - -static int -_archive_write_disk_free(struct archive *_a) -{ - struct archive_write_disk *a; - int ret; - if (_a == NULL) - return (ARCHIVE_OK); - archive_check_magic(_a, ARCHIVE_WRITE_DISK_MAGIC, - ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_write_disk_free"); - a = (struct archive_write_disk *)_a; - ret = _archive_write_disk_close(&a->archive); - archive_write_disk_set_group_lookup(&a->archive, NULL, NULL, NULL); - archive_write_disk_set_user_lookup(&a->archive, NULL, NULL, NULL); - if (a->entry) - archive_entry_free(a->entry); - archive_wstring_free(&a->_name_data); - archive_string_free(&a->archive.error_string); - archive_wstring_free(&a->path_safe); - a->archive.magic = 0; - __archive_clean(&a->archive); - free(a); - return (ret); -} - -/* - * Simple O(n log n) merge sort to order the fixup list. In - * particular, we want to restore dir timestamps depth-first. - */ -static struct fixup_entry * -sort_dir_list(struct fixup_entry *p) -{ - struct fixup_entry *a, *b, *t; - - if (p == NULL) - return (NULL); - /* A one-item list is already sorted. */ - if (p->next == NULL) - return (p); - - /* Step 1: split the list. */ - t = p; - a = p->next->next; - while (a != NULL) { - /* Step a twice, t once. */ - a = a->next; - if (a != NULL) - a = a->next; - t = t->next; - } - /* Now, t is at the mid-point, so break the list here. */ - b = t->next; - t->next = NULL; - a = p; - - /* Step 2: Recursively sort the two sub-lists. */ - a = sort_dir_list(a); - b = sort_dir_list(b); - - /* Step 3: Merge the returned lists. */ - /* Pick the first element for the merged list. */ - if (wcscmp(a->name, b->name) > 0) { - t = p = a; - a = a->next; - } else { - t = p = b; - b = b->next; - } - - /* Always put the later element on the list first. */ - while (a != NULL && b != NULL) { - if (wcscmp(a->name, b->name) > 0) { - t->next = a; - a = a->next; - } else { - t->next = b; - b = b->next; - } - t = t->next; - } - - /* Only one list is non-empty, so just splice it on. */ - if (a != NULL) - t->next = a; - if (b != NULL) - t->next = b; - - return (p); -} - -/* - * Returns a new, initialized fixup entry. - * - * TODO: Reduce the memory requirements for this list by using a tree - * structure rather than a simple list of names. - */ -static struct fixup_entry * -new_fixup(struct archive_write_disk *a, const wchar_t *pathname) -{ - struct fixup_entry *fe; - - fe = (struct fixup_entry *)calloc(1, sizeof(struct fixup_entry)); - if (fe == NULL) - return (NULL); - fe->next = a->fixup_list; - a->fixup_list = fe; - fe->fixup = 0; - fe->name = _wcsdup(pathname); - return (fe); -} - -/* - * Returns a fixup structure for the current entry. - */ -static struct fixup_entry * -current_fixup(struct archive_write_disk *a, const wchar_t *pathname) -{ - if (a->current_fixup == NULL) - a->current_fixup = new_fixup(a, pathname); - return (a->current_fixup); -} - -/* TODO: Make this work. */ -/* - * TODO: The deep-directory support bypasses this; disable deep directory - * support if we're doing symlink checks. - */ -/* - * TODO: Someday, integrate this with the deep dir support; they both - * scan the path and both can be optimized by comparing against other - * recent paths. - */ -/* TODO: Extend this to support symlinks on Windows Vista and later. */ -static int -check_symlinks(struct archive_write_disk *a) -{ - wchar_t *pn, *p; - wchar_t c; - int r; - BY_HANDLE_FILE_INFORMATION st; - mode_t st_mode; - - /* - * Guard against symlink tricks. Reject any archive entry whose - * destination would be altered by a symlink. - */ - /* Whatever we checked last time doesn't need to be re-checked. */ - pn = a->name; - p = a->path_safe.s; - while ((*pn != '\0') && (*p == *pn)) - ++p, ++pn; - c = pn[0]; - /* Keep going until we've checked the entire name. */ - while (pn[0] != '\0' && (pn[0] != '\\' || pn[1] != '\0')) { - /* Skip the next path element. */ - while (*pn != '\0' && *pn != '\\') - ++pn; - c = pn[0]; - pn[0] = '\0'; - /* Check that we haven't hit a symlink. */ - r = file_information(a, a->name, &st, &st_mode, 1); - if (r != 0) { - /* We've hit a dir that doesn't exist; stop now. */ - if (errno == ENOENT) - break; - } else if (S_ISLNK(st_mode)) { - if (c == '\0') { - /* - * Last element is symlink; remove it - * so we can overwrite it with the - * item being extracted. - */ - if (disk_unlink(a->name)) { - archive_set_error(&a->archive, errno, - "Could not remove symlink %ls", - a->name); - pn[0] = c; - return (ARCHIVE_FAILED); - } - a->pst = NULL; - /* - * Even if we did remove it, a warning - * is in order. The warning is silly, - * though, if we're just replacing one - * symlink with another symlink. - */ - if (!S_ISLNK(a->mode)) { - archive_set_error(&a->archive, 0, - "Removing symlink %ls", - a->name); - } - /* Symlink gone. No more problem! */ - pn[0] = c; - return (0); - } else if (a->flags & ARCHIVE_EXTRACT_UNLINK) { - /* User asked us to remove problems. */ - if (disk_unlink(a->name) != 0) { - archive_set_error(&a->archive, 0, - "Cannot remove intervening " - "symlink %ls", a->name); - pn[0] = c; - return (ARCHIVE_FAILED); - } - a->pst = NULL; - } else { - archive_set_error(&a->archive, 0, - "Cannot extract through symlink %ls", - a->name); - pn[0] = c; - return (ARCHIVE_FAILED); - } - } - } - pn[0] = c; - /* We've checked and/or cleaned the whole path, so remember it. */ - archive_wstrcpy(&a->path_safe, a->name); - return (ARCHIVE_OK); -} - -static int -guidword(wchar_t *p, int n) -{ - int i; - - for (i = 0; i < n; i++) { - if ((*p >= L'0' && *p <= L'9') || - (*p >= L'a' && *p <= L'f') || - (*p >= L'A' && *p <= L'F')) - p++; - else - return (-1); - } - return (0); -} - -/* - * Canonicalize the pathname. In particular, this strips duplicate - * '\' characters, '.' elements, and trailing '\'. It also raises an - * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is - * set) any '..' in the path. - */ -static int -cleanup_pathname(struct archive_write_disk *a) -{ - wchar_t *dest, *src, *p, *top; - wchar_t separator = L'\0'; - - p = a->name; - if (*p == L'\0') { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Invalid empty pathname"); - return (ARCHIVE_FAILED); - } - - /* Replace '/' by '\' */ - for (; *p != L'\0'; p++) { - if (*p == L'/') - *p = L'\\'; - } - p = a->name; - - /* Skip leading "\\.\" or "\\?\" or "\\?\UNC\" or - * "\\?\Volume{GUID}\" - * (absolute path prefixes used by Windows API) */ - if (p[0] == L'\\' && p[1] == L'\\' && - (p[2] == L'.' || p[2] == L'?') && p[3] == L'\\') - { - /* A path begin with "\\?\UNC\" */ - if (p[2] == L'?' && - (p[4] == L'U' || p[4] == L'u') && - (p[5] == L'N' || p[5] == L'n') && - (p[6] == L'C' || p[6] == L'c') && - p[7] == L'\\') - p += 8; - /* A path begin with "\\?\Volume{GUID}\" */ - else if (p[2] == L'?' && - (p[4] == L'V' || p[4] == L'v') && - (p[5] == L'O' || p[5] == L'o') && - (p[6] == L'L' || p[6] == L'l') && - (p[7] == L'U' || p[7] == L'u') && - (p[8] == L'M' || p[8] == L'm') && - (p[9] == L'E' || p[9] == L'e') && - p[10] == L'{') { - if (guidword(p+11, 8) == 0 && p[19] == L'-' && - guidword(p+20, 4) == 0 && p[24] == L'-' && - guidword(p+25, 4) == 0 && p[29] == L'-' && - guidword(p+30, 4) == 0 && p[34] == L'-' && - guidword(p+35, 12) == 0 && p[47] == L'}' && - p[48] == L'\\') - p += 49; - else - p += 4; - /* A path begin with "\\.\PhysicalDriveX" */ - } else if (p[2] == L'.' && - (p[4] == L'P' || p[4] == L'p') && - (p[5] == L'H' || p[5] == L'h') && - (p[6] == L'Y' || p[6] == L'y') && - (p[7] == L'S' || p[7] == L's') && - (p[8] == L'I' || p[8] == L'i') && - (p[9] == L'C' || p[9] == L'c') && - (p[9] == L'A' || p[9] == L'a') && - (p[9] == L'L' || p[9] == L'l') && - (p[9] == L'D' || p[9] == L'd') && - (p[9] == L'R' || p[9] == L'r') && - (p[9] == L'I' || p[9] == L'i') && - (p[9] == L'V' || p[9] == L'v') && - (p[9] == L'E' || p[9] == L'e') && - (p[10] >= L'0' && p[10] <= L'9') && - p[11] == L'\0') { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Path is a physical drive name"); - return (ARCHIVE_FAILED); - } else - p += 4; - } - - /* Skip leading drive letter from archives created - * on Windows. */ - if (((p[0] >= L'a' && p[0] <= L'z') || - (p[0] >= L'A' && p[0] <= L'Z')) && - p[1] == L':') { - if (p[2] == L'\0') { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Path is a drive name"); - return (ARCHIVE_FAILED); - } - if (p[2] == L'\\') - p += 2; - } - - top = dest = src = p; - /* Rewrite the path name if its character is a unusable. */ - for (; *p != L'\0'; p++) { - if (*p == L':' || *p == L'*' || *p == L'?' || *p == L'"' || - *p == L'<' || *p == L'>' || *p == L'|') - *p = L'_'; - } - /* Skip leading '\'. */ - if (*src == L'\\') - separator = *src++; - - /* Scan the pathname one element at a time. */ - for (;;) { - /* src points to first char after '\' */ - if (src[0] == L'\0') { - break; - } else if (src[0] == L'\\') { - /* Found '\\'('//'), ignore second one. */ - src++; - continue; - } else if (src[0] == L'.') { - if (src[1] == L'\0') { - /* Ignore trailing '.' */ - break; - } else if (src[1] == L'\\') { - /* Skip '.\'. */ - src += 2; - continue; - } else if (src[1] == L'.') { - if (src[2] == L'\\' || src[2] == L'\0') { - /* Conditionally warn about '..' */ - if (a->flags & - ARCHIVE_EXTRACT_SECURE_NODOTDOT) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_MISC, - "Path contains '..'"); - return (ARCHIVE_FAILED); - } - } - /* - * Note: Under no circumstances do we - * remove '..' elements. In - * particular, restoring - * '\foo\..\bar\' should create the - * 'foo' dir as a side-effect. - */ - } - } - - /* Copy current element, including leading '\'. */ - if (separator) - *dest++ = L'\\'; - while (*src != L'\0' && *src != L'\\') { - *dest++ = *src++; - } - - if (*src == L'\0') - break; - - /* Skip '\' separator. */ - separator = *src++; - } - /* - * We've just copied zero or more path elements, not including the - * final '\'. - */ - if (dest == top) { - /* - * Nothing got copied. The path must have been something - * like '.' or '\' or './' or '/././././/./'. - */ - if (separator) - *dest++ = L'\\'; - else - *dest++ = L'.'; - } - /* Terminate the result. */ - *dest = L'\0'; - return (ARCHIVE_OK); -} - -/* - * Create the parent directory of the specified path, assuming path - * is already in mutable storage. - */ -static int -create_parent_dir(struct archive_write_disk *a, wchar_t *path) -{ - wchar_t *slash; - int r; - - /* Remove tail element to obtain parent name. */ - slash = wcsrchr(path, L'\\'); - if (slash == NULL) - return (ARCHIVE_OK); - *slash = L'\0'; - r = create_dir(a, path); - *slash = L'\\'; - return (r); -} - -/* - * Create the specified dir, recursing to create parents as necessary. - * - * Returns ARCHIVE_OK if the path exists when we're done here. - * Otherwise, returns ARCHIVE_FAILED. - * Assumes path is in mutable storage; path is unchanged on exit. - */ -static int -create_dir(struct archive_write_disk *a, wchar_t *path) -{ - BY_HANDLE_FILE_INFORMATION st; - struct fixup_entry *le; - wchar_t *slash, *base, *full; - mode_t mode_final, mode, st_mode; - int r; - - /* Check for special names and just skip them. */ - slash = wcsrchr(path, L'\\'); - if (slash == NULL) - base = path; - else - base = slash + 1; - - if (base[0] == L'\0' || - (base[0] == L'.' && base[1] == L'\0') || - (base[0] == L'.' && base[1] == L'.' && base[2] == L'\0')) { - /* Don't bother trying to create null path, '.', or '..'. */ - if (slash != NULL) { - *slash = L'\0'; - r = create_dir(a, path); - *slash = L'\\'; - return (r); - } - return (ARCHIVE_OK); - } - - /* - * Yes, this should be stat() and not lstat(). Using lstat() - * here loses the ability to extract through symlinks. Also note - * that this should not use the a->st cache. - */ - if (file_information(a, path, &st, &st_mode, 0) == 0) { - if (S_ISDIR(st_mode)) - return (ARCHIVE_OK); - if ((a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) { - archive_set_error(&a->archive, EEXIST, - "Can't create directory '%ls'", path); - return (ARCHIVE_FAILED); - } - if (disk_unlink(path) != 0) { - archive_set_error(&a->archive, errno, - "Can't create directory '%ls': " - "Conflicting file cannot be removed", - path); - return (ARCHIVE_FAILED); - } - } else if (errno != ENOENT && errno != ENOTDIR) { - /* Stat failed? */ - archive_set_error(&a->archive, errno, - "Can't test directory '%ls'", path); - return (ARCHIVE_FAILED); - } else if (slash != NULL) { - *slash = '\0'; - r = create_dir(a, path); - *slash = '\\'; - if (r != ARCHIVE_OK) - return (r); - } - - /* - * Mode we want for the final restored directory. Per POSIX, - * implicitly-created dirs must be created obeying the umask. - * There's no mention whether this is different for privileged - * restores (which the rest of this code handles by pretending - * umask=0). I've chosen here to always obey the user's umask for - * implicit dirs, even if _EXTRACT_PERM was specified. - */ - mode_final = DEFAULT_DIR_MODE & ~a->user_umask; - /* Mode we want on disk during the restore process. */ - mode = mode_final; - mode |= MINIMUM_DIR_MODE; - mode &= MAXIMUM_DIR_MODE; - /* - * Apply __la_win_permissive_name_w to path in order to - * remove '../' path string. - */ - full = __la_win_permissive_name_w(path); - if (full == NULL) - errno = EINVAL; - else if (CreateDirectoryW(full, NULL) != 0) { - if (mode != mode_final) { - le = new_fixup(a, path); - le->fixup |=TODO_MODE_BASE; - le->mode = mode_final; - } - free(full); - return (ARCHIVE_OK); - } else { - la_dosmaperr(GetLastError()); - } - free(full); - - /* - * Without the following check, a/b/../b/c/d fails at the - * second visit to 'b', so 'd' can't be created. Note that we - * don't add it to the fixup list here, as it's already been - * added. - */ - if (file_information(a, path, &st, &st_mode, 0) == 0 && - S_ISDIR(st_mode)) - return (ARCHIVE_OK); - - archive_set_error(&a->archive, errno, "Failed to create dir '%ls'", - path); - return (ARCHIVE_FAILED); -} - -/* - * Note: Although we can skip setting the user id if the desired user - * id matches the current user, we cannot skip setting the group, as - * many systems set the gid based on the containing directory. So - * we have to perform a chown syscall if we want to set the SGID - * bit. (The alternative is to stat() and then possibly chown(); it's - * more efficient to skip the stat() and just always chown().) Note - * that a successful chown() here clears the TODO_SGID_CHECK bit, which - * allows set_mode to skip the stat() check for the GID. - */ -static int -set_ownership(struct archive_write_disk *a) -{ -/* unfortunately, on win32 there is no 'root' user with uid 0, - so we just have to try the chown and see if it works */ - - /* If we know we can't change it, don't bother trying. */ - if (a->user_uid != 0 && a->user_uid != a->uid) { - archive_set_error(&a->archive, errno, - "Can't set UID=%jd", (intmax_t)a->uid); - return (ARCHIVE_WARN); - } - - archive_set_error(&a->archive, errno, - "Can't set user=%jd/group=%jd for %ls", - (intmax_t)a->uid, (intmax_t)a->gid, a->name); - return (ARCHIVE_WARN); -} - -static int -set_times(struct archive_write_disk *a, - HANDLE h, int mode, const wchar_t *name, - time_t atime, long atime_nanos, - time_t birthtime, long birthtime_nanos, - time_t mtime, long mtime_nanos, - time_t ctime_sec, long ctime_nanos) -{ -#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000) -#define WINTIME(sec, nsec) ((Int32x32To64(sec, 10000000) + EPOC_TIME)\ - + (((nsec)/1000)*10)) - - HANDLE hw = 0; - ULARGE_INTEGER wintm; - FILETIME *pfbtime; - FILETIME fatime, fbtime, fmtime; - - (void)ctime_sec; /* UNUSED */ - (void)ctime_nanos; /* UNUSED */ - - if (h != INVALID_HANDLE_VALUE) { - hw = NULL; - } else { - wchar_t *ws; - - if (S_ISLNK(mode)) - return (ARCHIVE_OK); - ws = __la_win_permissive_name_w(name); - if (ws == NULL) - goto settimes_failed; - hw = CreateFileW(ws, FILE_WRITE_ATTRIBUTES, - 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); - free(ws); - if (hw == INVALID_HANDLE_VALUE) - goto settimes_failed; - h = hw; - } - - wintm.QuadPart = WINTIME(atime, atime_nanos); - fatime.dwLowDateTime = wintm.LowPart; - fatime.dwHighDateTime = wintm.HighPart; - wintm.QuadPart = WINTIME(mtime, mtime_nanos); - fmtime.dwLowDateTime = wintm.LowPart; - fmtime.dwHighDateTime = wintm.HighPart; - /* - * SetFileTime() supports birthtime. - */ - if (birthtime > 0 || birthtime_nanos > 0) { - wintm.QuadPart = WINTIME(birthtime, birthtime_nanos); - fbtime.dwLowDateTime = wintm.LowPart; - fbtime.dwHighDateTime = wintm.HighPart; - pfbtime = &fbtime; - } else - pfbtime = NULL; - if (SetFileTime(h, pfbtime, &fatime, &fmtime) == 0) - goto settimes_failed; - CloseHandle(hw); - return (ARCHIVE_OK); - -settimes_failed: - CloseHandle(hw); - archive_set_error(&a->archive, EINVAL, "Can't restore time"); - return (ARCHIVE_WARN); -} - -static int -set_times_from_entry(struct archive_write_disk *a) -{ - time_t atime, birthtime, mtime, ctime_sec; - long atime_nsec, birthtime_nsec, mtime_nsec, ctime_nsec; - - /* Suitable defaults. */ - atime = birthtime = mtime = ctime_sec = a->start_time; - atime_nsec = birthtime_nsec = mtime_nsec = ctime_nsec = 0; - - /* If no time was provided, we're done. */ - if (!archive_entry_atime_is_set(a->entry) - && !archive_entry_birthtime_is_set(a->entry) - && !archive_entry_mtime_is_set(a->entry)) - return (ARCHIVE_OK); - - if (archive_entry_atime_is_set(a->entry)) { - atime = archive_entry_atime(a->entry); - atime_nsec = archive_entry_atime_nsec(a->entry); - } - if (archive_entry_birthtime_is_set(a->entry)) { - birthtime = archive_entry_birthtime(a->entry); - birthtime_nsec = archive_entry_birthtime_nsec(a->entry); - } - if (archive_entry_mtime_is_set(a->entry)) { - mtime = archive_entry_mtime(a->entry); - mtime_nsec = archive_entry_mtime_nsec(a->entry); - } - if (archive_entry_ctime_is_set(a->entry)) { - ctime_sec = archive_entry_ctime(a->entry); - ctime_nsec = archive_entry_ctime_nsec(a->entry); - } - - return set_times(a, a->fh, a->mode, a->name, - atime, atime_nsec, - birthtime, birthtime_nsec, - mtime, mtime_nsec, - ctime_sec, ctime_nsec); -} - -static int -set_mode(struct archive_write_disk *a, int mode) -{ - int r = ARCHIVE_OK; - mode &= 07777; /* Strip off file type bits. */ - - if (a->todo & TODO_SGID_CHECK) { - /* - * If we don't know the GID is right, we must stat() - * to verify it. We can't just check the GID of this - * process, since systems sometimes set GID from - * the enclosing dir or based on ACLs. - */ - if ((r = lazy_stat(a)) != ARCHIVE_OK) - return (r); - if (0 != a->gid) { - mode &= ~ S_ISGID; - } - /* While we're here, double-check the UID. */ - if (0 != a->uid - && (a->todo & TODO_SUID)) { - mode &= ~ S_ISUID; - } - a->todo &= ~TODO_SGID_CHECK; - a->todo &= ~TODO_SUID_CHECK; - } else if (a->todo & TODO_SUID_CHECK) { - /* - * If we don't know the UID is right, we can just check - * the user, since all systems set the file UID from - * the process UID. - */ - if (a->user_uid != a->uid) { - mode &= ~ S_ISUID; - } - a->todo &= ~TODO_SUID_CHECK; - } - - if (S_ISLNK(a->mode)) { -#ifdef HAVE_LCHMOD - /* - * If this is a symlink, use lchmod(). If the - * platform doesn't support lchmod(), just skip it. A - * platform that doesn't provide a way to set - * permissions on symlinks probably ignores - * permissions on symlinks, so a failure here has no - * impact. - */ - if (lchmod(a->name, mode) != 0) { - archive_set_error(&a->archive, errno, - "Can't set permissions to 0%o", (int)mode); - r = ARCHIVE_WARN; - } -#endif - } else if (!S_ISDIR(a->mode)) { - /* - * If it's not a symlink and not a dir, then use - * fchmod() or chmod(), depending on whether we have - * an fd. Dirs get their perms set during the - * post-extract fixup, which is handled elsewhere. - */ -#ifdef HAVE_FCHMOD - if (a->fd >= 0) { - if (fchmod(a->fd, mode) != 0) { - archive_set_error(&a->archive, errno, - "Can't set permissions to 0%o", (int)mode); - r = ARCHIVE_WARN; - } - } else -#endif - /* If this platform lacks fchmod(), then - * we'll just use chmod(). */ - if (la_chmod(a->name, mode) != 0) { - archive_set_error(&a->archive, errno, - "Can't set permissions to 0%o", (int)mode); - r = ARCHIVE_WARN; - } - } - return (r); -} - -static int -set_fflags(struct archive_write_disk *a) -{ - (void)a; /* UNUSED */ - return (ARCHIVE_OK); -} - -/* Default empty function body to satisfy mainline code. */ -static int -set_acls(struct archive_write_disk *a, HANDLE h, const wchar_t *name, - struct archive_acl *acl) -{ - (void)a; /* UNUSED */ - (void)h; /* UNUSED */ - (void)name; /* UNUSED */ - (void)acl; /* UNUSED */ - return (ARCHIVE_OK); -} - -/* - * Restore extended attributes - stub implementation for unsupported systems - */ -static int -set_xattrs(struct archive_write_disk *a) -{ - static int warning_done = 0; - - /* If there aren't any extended attributes, then it's okay not - * to extract them, otherwise, issue a single warning. */ - if (archive_entry_xattr_count(a->entry) != 0 && !warning_done) { - warning_done = 1; - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Cannot restore extended attributes on this system"); - return (ARCHIVE_WARN); - } - /* Warning was already emitted; suppress further warnings. */ - return (ARCHIVE_OK); -} - -static void -fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns) -{ - ULARGE_INTEGER utc; - - utc.HighPart = filetime->dwHighDateTime; - utc.LowPart = filetime->dwLowDateTime; - if (utc.QuadPart >= EPOC_TIME) { - utc.QuadPart -= EPOC_TIME; - /* milli seconds base */ - *t = (time_t)(utc.QuadPart / 10000000); - /* nano seconds base */ - *ns = (long)(utc.QuadPart % 10000000) * 100; - } else { - *t = 0; - *ns = 0; - } -} -/* - * Test if file on disk is older than entry. - */ -static int -older(BY_HANDLE_FILE_INFORMATION *st, struct archive_entry *entry) -{ - time_t sec; - long nsec; - - fileTimeToUtc(&st->ftLastWriteTime, &sec, &nsec); - /* First, test the seconds and return if we have a definite answer. */ - /* Definitely older. */ - if (sec < archive_entry_mtime(entry)) - return (1); - /* Definitely younger. */ - if (sec > archive_entry_mtime(entry)) - return (0); - if (nsec < archive_entry_mtime_nsec(entry)) - return (1); - /* Same age or newer, so not older. */ - return (0); -} - -#endif /* _WIN32 && !__CYGWIN__ */ - diff --git a/libarchive/config_freebsd.h b/libarchive/config_freebsd.h deleted file mode 100644 index 2073431635e9..000000000000 --- a/libarchive/config_freebsd.h +++ /dev/null @@ -1,160 +0,0 @@ -/*- - * 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: head/lib/libarchive/config_freebsd.h 201079 2009-12-28 02:01:42Z kientzle $ - */ - -/* FreeBSD 5.0 and later have ACL and extattr support. */ -#if __FreeBSD__ > 4 -#define HAVE_ACL_CREATE_ENTRY 1 -#define HAVE_ACL_GET_LINK_NP 1 -#define HAVE_ACL_GET_PERM_NP 1 -#define HAVE_ACL_INIT 1 -#define HAVE_ACL_SET_FD 1 -#define HAVE_ACL_SET_FD_NP 1 -#define HAVE_ACL_SET_FILE 1 -#define HAVE_ACL_USER 1 -#define HAVE_EXTATTR_GET_FILE 1 -#define HAVE_EXTATTR_LIST_FILE 1 -#define HAVE_EXTATTR_SET_FD 1 -#define HAVE_EXTATTR_SET_FILE 1 -#define HAVE_SYS_ACL_H 1 -#define HAVE_SYS_EXTATTR_H 1 -#endif - -#ifdef WITH_OPENSSL -#define HAVE_OPENSSL_MD5_H 1 -#define HAVE_OPENSSL_RIPEMD_H 1 -#define HAVE_OPENSSL_SHA_H 1 -#define HAVE_SHA384 1 -#define HAVE_SHA512 1 -#endif - -#define HAVE_BSDXML_H 1 -#define HAVE_BZLIB_H 1 -#define HAVE_CHFLAGS 1 -#define HAVE_CHOWN 1 -#define HAVE_DECL_INT64_MAX 1 -#define HAVE_DECL_INT64_MIN 1 -#define HAVE_DECL_SIZE_MAX 1 -#define HAVE_DECL_SSIZE_MAX 1 -#define HAVE_DECL_STRERROR_R 1 -#define HAVE_DECL_UINT32_MAX 1 -#define HAVE_DECL_UINT64_MAX 1 -#define HAVE_DIRENT_H 1 -#define HAVE_EFTYPE 1 -#define HAVE_EILSEQ 1 -#define HAVE_ERRNO_H 1 -#define HAVE_FCHDIR 1 -#define HAVE_FCHFLAGS 1 -#define HAVE_FCHMOD 1 -#define HAVE_FCHOWN 1 -#define HAVE_FCNTL 1 -#define HAVE_FCNTL_H 1 -#define HAVE_FSEEKO 1 -#define HAVE_FSTAT 1 -#define HAVE_FTRUNCATE 1 -#define HAVE_FUTIMES 1 -#define HAVE_GETEUID 1 -#define HAVE_GETGRGID_R 1 -#define HAVE_GETPID 1 -#define HAVE_GETPWUID_R 1 -#define HAVE_GRP_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_LCHFLAGS 1 -#define HAVE_LCHMOD 1 -#define HAVE_LCHOWN 1 -#define HAVE_LIMITS_H 1 -#define HAVE_LINK 1 -#define HAVE_LSTAT 1 -#define HAVE_LUTIMES 1 -#define HAVE_MALLOC 1 -#define HAVE_MD5 1 -#define HAVE_MD5_H 1 -#define HAVE_MEMMOVE 1 -#define HAVE_MKDIR 1 -#define HAVE_MKFIFO 1 -#define HAVE_MKNOD 1 -#define HAVE_PIPE 1 -#define HAVE_POLL 1 -#define HAVE_POLL_H 1 -#define HAVE_PWD_H 1 -#define HAVE_READLINK 1 -#define HAVE_RMD160 1 -#define HAVE_SELECT 1 -#define HAVE_SETENV 1 -#define HAVE_SHA_H 1 -#define HAVE_SHA1 1 -#define HAVE_SHA256 1 -#define HAVE_SHA256_H 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDINT_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRCHR 1 -#define HAVE_STRDUP 1 -#define HAVE_STRERROR 1 -#define HAVE_STRERROR_R 1 -#define HAVE_STRINGS_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRRCHR 1 -#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 -#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 -#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 -#define HAVE_STRUCT_STAT_ST_FLAGS 1 -#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 -#define HAVE_STRUCT_TM_TM_GMTOFF 1 -#define HAVE_SYMLINK 1 -#define HAVE_SYS_CDEFS_H 1 -#define HAVE_SYS_IOCTL_H 1 -#define HAVE_SYS_MOUNT_H 1 -#define HAVE_SYS_PARAM_H 1 -#define HAVE_SYS_SELECT_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_SYS_TIME_H 1 -#define HAVE_SYS_TYPES_H 1 -#undef HAVE_SYS_UTIME_H -#define HAVE_SYS_UTSNAME_H 1 -#define HAVE_SYS_WAIT_H 1 -#define HAVE_TIMEGM 1 -#define HAVE_TZSET 1 -#define HAVE_UNISTD_H 1 -#define HAVE_UNSETENV 1 -#define HAVE_UTIME 1 -#define HAVE_UTIMES 1 -#define HAVE_UTIME_H 1 -#define HAVE_VFORK 1 -#define HAVE_WCHAR_H 1 -#define HAVE_WCSCPY 1 -#define HAVE_WCSLEN 1 -#define HAVE_WCTOMB 1 -#define HAVE_WMEMCMP 1 -#define HAVE_WMEMCPY 1 -#define HAVE_ZLIB_H 1 -#define TIME_WITH_SYS_TIME 1 - -/* FreeBSD 4 and earlier lack intmax_t/uintmax_t */ -#if __FreeBSD__ < 5 -#define intmax_t int64_t -#define uintmax_t uint64_t -#endif diff --git a/libarchive/filter_fork_windows.c b/libarchive/filter_fork_windows.c deleted file mode 100644 index fa59cc9e90ce..000000000000 --- a/libarchive/filter_fork_windows.c +++ /dev/null @@ -1,190 +0,0 @@ -/*- - * Copyright (c) 2009-2012 Michihiro NAKAJIMA - * 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 "archive_platform.h" - -#if defined(_WIN32) && !defined(__CYGWIN__) -#include "archive_cmdline_private.h" -#include "archive_string.h" - -#include "filter_fork.h" - -pid_t -__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout) -{ - HANDLE childStdout[2], childStdin[2],childStderr; - SECURITY_ATTRIBUTES secAtts; - STARTUPINFO staInfo; - PROCESS_INFORMATION childInfo; - struct archive_string cmdline; - struct archive_string fullpath; - struct archive_cmdline *acmd; - char *arg0, *ext; - int i, l; - DWORD fl, fl_old; - - childStdout[0] = childStdout[1] = INVALID_HANDLE_VALUE; - childStdin[0] = childStdin[1] = INVALID_HANDLE_VALUE; - childStderr = INVALID_HANDLE_VALUE; - archive_string_init(&cmdline); - archive_string_init(&fullpath); - - acmd = __archive_cmdline_allocate(); - if (acmd == NULL) - goto fail; - if (__archive_cmdline_parse(acmd, cmd) != ARCHIVE_OK) - goto fail; - - /* - * Search the full path of 'path'. - * NOTE: This does not need if we give CreateProcessA 'path' as - * a part of the cmdline and give CreateProcessA NULL as first - * parameter, but I do not like that way. - */ - ext = strrchr(acmd->path, '.'); - if (ext == NULL || strlen(ext) > 4) - /* 'path' does not have a proper extension, so we have to - * give SearchPath() ".exe" as the extension. */ - ext = ".exe"; - else - ext = NULL;/* 'path' has an extension. */ - - fl = MAX_PATH; - do { - if (archive_string_ensure(&fullpath, fl) == NULL) - goto fail; - fl_old = fl; - fl = SearchPathA(NULL, acmd->path, ext, fl, fullpath.s, - &arg0); - } while (fl != 0 && fl > fl_old); - if (fl == 0) - goto fail; - - /* - * Make a command line. - */ - for (l = 0, i = 0; acmd->argv[i] != NULL; i++) { - if (i == 0) - continue; - l += (int)strlen(acmd->argv[i]) + 1; - } - if (archive_string_ensure(&cmdline, l + 1) == NULL) - goto fail; - for (i = 0; acmd->argv[i] != NULL; i++) { - if (i == 0) { - const char *p, *sp; - - if ((p = strchr(acmd->argv[i], '/')) != NULL || - (p = strchr(acmd->argv[i], '\\')) != NULL) - p++; - else - p = acmd->argv[i]; - if ((sp = strchr(p, ' ')) != NULL) - archive_strappend_char(&cmdline, '"'); - archive_strcat(&cmdline, p); - if (sp != NULL) - archive_strappend_char(&cmdline, '"'); - } else { - archive_strappend_char(&cmdline, ' '); - archive_strcat(&cmdline, acmd->argv[i]); - } - } - if (i <= 1) { - const char *sp; - - if ((sp = strchr(arg0, ' ')) != NULL) - archive_strappend_char(&cmdline, '"'); - archive_strcat(&cmdline, arg0); - if (sp != NULL) - archive_strappend_char(&cmdline, '"'); - } - - secAtts.nLength = sizeof(SECURITY_ATTRIBUTES); - secAtts.bInheritHandle = TRUE; - secAtts.lpSecurityDescriptor = NULL; - if (CreatePipe(&childStdout[0], &childStdout[1], &secAtts, 0) == 0) - goto fail; - if (!SetHandleInformation(childStdout[0], HANDLE_FLAG_INHERIT, 0)) - goto fail; - if (CreatePipe(&childStdin[0], &childStdin[1], &secAtts, 0) == 0) - goto fail; - if (!SetHandleInformation(childStdin[1], HANDLE_FLAG_INHERIT, 0)) - goto fail; - if (DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_ERROR_HANDLE), - GetCurrentProcess(), &childStderr, 0, TRUE, - DUPLICATE_SAME_ACCESS) == 0) - goto fail; - - memset(&staInfo, 0, sizeof(staInfo)); - staInfo.cb = sizeof(staInfo); - staInfo.hStdError = childStderr; - staInfo.hStdOutput = childStdout[1]; - staInfo.hStdInput = childStdin[0]; - staInfo.wShowWindow = SW_HIDE; - staInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; - if (CreateProcessA(fullpath.s, cmdline.s, NULL, NULL, TRUE, 0, - NULL, NULL, &staInfo, &childInfo) == 0) - goto fail; - WaitForInputIdle(childInfo.hProcess, INFINITE); - CloseHandle(childInfo.hProcess); - CloseHandle(childInfo.hThread); - - *child_stdout = _open_osfhandle((intptr_t)childStdout[0], _O_RDONLY); - *child_stdin = _open_osfhandle((intptr_t)childStdin[1], _O_WRONLY); - - CloseHandle(childStdout[1]); - CloseHandle(childStdin[0]); - - archive_string_free(&cmdline); - archive_string_free(&fullpath); - __archive_cmdline_free(acmd); - return (childInfo.dwProcessId); - -fail: - if (childStdout[0] != INVALID_HANDLE_VALUE) - CloseHandle(childStdout[0]); - if (childStdout[1] != INVALID_HANDLE_VALUE) - CloseHandle(childStdout[1]); - if (childStdin[0] != INVALID_HANDLE_VALUE) - CloseHandle(childStdin[0]); - if (childStdin[1] != INVALID_HANDLE_VALUE) - CloseHandle(childStdin[1]); - if (childStderr != INVALID_HANDLE_VALUE) - CloseHandle(childStderr); - archive_string_free(&cmdline); - archive_string_free(&fullpath); - __archive_cmdline_free(acmd); - return (-1); -} - -void -__archive_check_child(int in, int out) -{ - (void)in; /* UNUSED */ - (void)out; /* UNUSED */ - Sleep(100); -} - -#endif /* _WIN32 && !__CYGWIN__ */ diff --git a/libarchive/mtree.5 b/libarchive/mtree.5 deleted file mode 100644 index 983fff723891..000000000000 --- a/libarchive/mtree.5 +++ /dev/null @@ -1,269 +0,0 @@ -.\" Copyright (c) 1989, 1990, 1993 -.\" The Regents of the University of California. 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. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. -.\" -.\" From: @(#)mtree.8 8.2 (Berkeley) 12/11/93 -.\" $FreeBSD$ -.\" -.Dd May 6, 2008 -.Dt MTREE 5 -.Os -.Sh NAME -.Nm mtree -.Nd format of mtree dir hierarchy files -.Sh DESCRIPTION -The -.Nm -format is a textual format that describes a collection of filesystem objects. -Such files are typically used to create or verify directory hierarchies. -.Ss General Format -An -.Nm -file consists of a series of lines, each providing information -about a single filesystem object. -Leading whitespace is always ignored. -.Pp -When encoding file or pathnames, any backslash character or -character outside of the 95 printable ASCII characters must be -encoded as a a backslash followed by three -octal digits. -When reading mtree files, any appearance of a backslash -followed by three octal digits should be converted into the -corresponding character. -.Pp -Each line is interpreted independently as one of the following types: -.Bl -tag -width Cm -.It Signature -The first line of any mtree file must begin with -.Dq #mtree . -If a file contains any full path entries, the first line should -begin with -.Dq #mtree v2.0 , -otherwise, the first line should begin with -.Dq #mtree v1.0 . -.It Blank -Blank lines are ignored. -.It Comment -Lines beginning with -.Cm # -are ignored. -.It Special -Lines beginning with -.Cm / -are special commands that influence -the interpretation of later lines. -.It Relative -If the first whitespace-delimited word has no -.Cm / -characters, -it is the name of a file in the current directory. -Any relative entry that describes a directory changes the -current directory. -.It dot-dot -As a special case, a relative entry with the filename -.Pa .. -changes the current directory to the parent directory. -Options on dot-dot entries are always ignored. -.It Full -If the first whitespace-delimited word has a -.Cm / -character after -the first character, it is the pathname of a file relative to the -starting directory. -There can be multiple full entries describing the same file. -.El -.Pp -Some tools that process -.Nm -files may require that multiple lines describing the same file -occur consecutively. -It is not permitted for the same file to be mentioned using -both a relative and a full file specification. -.Ss Special commands -Two special commands are currently defined: -.Bl -tag -width Cm -.It Cm /set -This command defines default values for one or more keywords. -It is followed on the same line by one or more whitespace-separated -keyword definitions. -These definitions apply to all following files that do not specify -a value for that keyword. -.It Cm /unset -This command removes any default value set by a previous -.Cm /set -command. -It is followed on the same line by one or more keywords -separated by whitespace. -.El -.Ss Keywords -After the filename, a full or relative entry consists of zero -or more whitespace-separated keyword definitions. -Each such definition consists of a key from the following -list immediately followed by an '=' sign -and a value. -Software programs reading mtree files should warn about -unrecognized keywords. -.Pp -Currently supported keywords are as follows: -.Bl -tag -width Cm -.It Cm cksum -The checksum of the file using the default algorithm specified by -the -.Xr cksum 1 -utility. -.It Cm contents -The full pathname of a file that holds the contents of this file. -.It Cm flags -The file flags as a symbolic name. -See -.Xr chflags 1 -for information on these names. -If no flags are to be set the string -.Dq none -may be used to override the current default. -.It Cm gid -The file group as a numeric value. -.It Cm gname -The file group as a symbolic name. -.It Cm ignore -Ignore any file hierarchy below this file. -.It Cm link -The target of the symbolic link when type=link. -.It Cm md5 -The MD5 message digest of the file. -.It Cm md5digest -A synonym for -.Cm md5 . -.It Cm mode -The current file's permissions as a numeric (octal) or symbolic -value. -.It Cm nlink -The number of hard links the file is expected to have. -.It Cm nochange -Make sure this file or directory exists but otherwise ignore all attributes. -.It Cm ripemd160digest -The -.Tn RIPEMD160 -message digest of the file. -.It Cm rmd160 -A synonym for -.Cm ripemd160digest . -.It Cm rmd160digest -A synonym for -.Cm ripemd160digest . -.It Cm sha1 -The -.Tn FIPS -160-1 -.Pq Dq Tn SHA-1 -message digest of the file. -.It Cm sha1digest -A synonym for -.Cm sha1 . -.It Cm sha256 -The -.Tn FIPS -180-2 -.Pq Dq Tn SHA-256 -message digest of the file. -.It Cm sha256digest -A synonym for -.Cm sha256 . -.It Cm size -The size, in bytes, of the file. -.It Cm time -The last modification time of the file. -.It Cm type -The type of the file; may be set to any one of the following: -.Pp -.Bl -tag -width Cm -compact -.It Cm block -block special device -.It Cm char -character special device -.It Cm dir -directory -.It Cm fifo -fifo -.It Cm file -regular file -.It Cm link -symbolic link -.It Cm socket -socket -.El -.It Cm uid -The file owner as a numeric value. -.It Cm uname -The file owner as a symbolic name. -.El -.Pp -.Sh SEE ALSO -.Xr cksum 1 , -.Xr find 1 , -.Xr mtree 8 -.Sh BUGS -The -.Fx -implementation of mtree does not currently support -the -.Nm -2.0 -format. -The requirement for a -.Dq #mtree -signature line is new and not yet widely implemented. -.Sh HISTORY -The -.Nm -utility appeared in -.Bx 4.3 Reno . -The -.Tn MD5 -digest capability was added in -.Fx 2.1 , -in response to the widespread use of programs which can spoof -.Xr cksum 1 . -The -.Tn SHA-1 -and -.Tn RIPEMD160 -digests were added in -.Fx 4.0 , -as new attacks have demonstrated weaknesses in -.Tn MD5 . -The -.Tn SHA-256 -digest was added in -.Fx 6.0 . -Support for file flags was added in -.Fx 4.0 , -and mostly comes from -.Nx . -The -.Dq full -entry format was added by -.Nx . diff --git a/libarchive/test/.cvsignore b/libarchive/test/.cvsignore deleted file mode 100644 index b71f5a0dbd62..000000000000 --- a/libarchive/test/.cvsignore +++ /dev/null @@ -1,10 +0,0 @@ -*.tar -*.tar.gz -*.tgz -*.zip -.depend -.deps -.dirstamp -archive.h -libarchive_test -list.h diff --git a/libarchive/test/CMakeLists.txt b/libarchive/test/CMakeLists.txt deleted file mode 100644 index ff73c770b554..000000000000 --- a/libarchive/test/CMakeLists.txt +++ /dev/null @@ -1,257 +0,0 @@ -############################################ -# -# How to build libarchive_test -# -############################################ -IF(ENABLE_TEST) - SET(libarchive_test_SOURCES - ../../test_utils/test_utils.c - main.c - read_open_memory.c - test.h - test_acl_freebsd_posix1e.c - test_acl_freebsd_nfs4.c - test_acl_nfs4.c - test_acl_pax.c - test_acl_posix1e.c - test_archive_api_feature.c - test_archive_clear_error.c - test_archive_cmdline.c - test_archive_crypto.c - test_archive_getdate.c - test_archive_match_owner.c - test_archive_match_path.c - test_archive_match_time.c - test_archive_pathmatch.c - test_archive_read_close_twice.c - test_archive_read_close_twice_open_fd.c - test_archive_read_close_twice_open_filename.c - test_archive_read_multiple_data_objects.c - test_archive_read_next_header_empty.c - test_archive_read_next_header_raw.c - test_archive_read_open2.c - test_archive_read_set_filter_option.c - test_archive_read_set_format_option.c - test_archive_read_set_option.c - test_archive_read_set_options.c - test_archive_read_support.c - test_archive_set_error.c - test_archive_string.c - test_archive_string_conversion.c - test_archive_write_add_filter_by_name.c - test_archive_write_set_filter_option.c - test_archive_write_set_format_by_name.c - test_archive_write_set_format_option.c - test_archive_write_set_option.c - test_archive_write_set_options.c - test_bad_fd.c - test_compat_bzip2.c - test_compat_cpio.c - test_compat_gtar.c - test_compat_gzip.c - test_compat_lzip.c - test_compat_lzma.c - test_compat_lzop.c - test_compat_mac.c - test_compat_pax_libarchive_2x.c - test_compat_solaris_tar_acl.c - test_compat_solaris_pax_sparse.c - test_compat_tar_hardlink.c - test_compat_uudecode.c - test_compat_xz.c - test_compat_zip.c - test_empty_write.c - test_entry.c - test_entry_strmode.c - test_extattr_freebsd.c - test_filter_count.c - test_fuzz.c - test_gnutar_filename_encoding.c - test_link_resolver.c - test_open_failure.c - test_open_fd.c - test_open_file.c - test_open_filename.c - test_pax_filename_encoding.c - test_read_data_large.c - test_read_disk.c - test_read_disk_directory_traversals.c - test_read_disk_entry_from_file.c - test_read_extract.c - test_read_file_nonexistent.c - test_read_filter_grzip.c - test_read_filter_lrzip.c - test_read_filter_lzop.c - test_read_filter_lzop_multiple_parts.c - test_read_filter_program.c - test_read_filter_program_signature.c - test_read_filter_uudecode.c - test_read_format_7zip.c - test_read_format_ar.c - test_read_format_cab.c - test_read_format_cab_filename.c - test_read_format_cpio_afio.c - test_read_format_cpio_bin.c - test_read_format_cpio_bin_Z.c - test_read_format_cpio_bin_be.c - test_read_format_cpio_bin_bz2.c - test_read_format_cpio_bin_gz.c - test_read_format_cpio_bin_lzip.c - test_read_format_cpio_bin_lzma.c - test_read_format_cpio_bin_xz.c - test_read_format_cpio_filename.c - test_read_format_cpio_odc.c - test_read_format_cpio_svr4_bzip2_rpm.c - test_read_format_cpio_svr4_gzip.c - test_read_format_cpio_svr4_gzip_rpm.c - test_read_format_cpio_svr4c_Z.c - test_read_format_empty.c - test_read_format_gtar_filename.c - test_read_format_gtar_gz.c - test_read_format_gtar_lzma.c - test_read_format_gtar_sparse.c - test_read_format_gtar_sparse_skip_entry.c - test_read_format_iso_Z.c - test_read_format_iso_multi_extent.c - test_read_format_iso_xorriso.c - test_read_format_isojoliet_bz2.c - test_read_format_isojoliet_long.c - test_read_format_isojoliet_rr.c - test_read_format_isojoliet_versioned.c - test_read_format_isorr_bz2.c - test_read_format_isorr_ce.c - test_read_format_isorr_new_bz2.c - test_read_format_isorr_rr_moved.c - test_read_format_isozisofs_bz2.c - test_read_format_lha.c - test_read_format_lha_filename.c - test_read_format_mtree.c - test_read_format_pax_bz2.c - test_read_format_rar.c - test_read_format_raw.c - test_read_format_tar.c - test_read_format_tar_empty_filename.c - test_read_format_tar_filename.c - test_read_format_tbz.c - test_read_format_tgz.c - test_read_format_tlz.c - test_read_format_txz.c - test_read_format_tz.c - test_read_format_ustar_filename.c - test_read_format_xar.c - test_read_format_zip.c - test_read_format_zip_comment_stored.c - test_read_format_zip_filename.c - test_read_format_zip_mac_metadata.c - test_read_format_zip_sfx.c - test_read_large.c - test_read_pax_truncated.c - test_read_position.c - test_read_set_format.c - test_read_truncated.c - test_read_truncated_filter.c - test_sparse_basic.c - test_tar_filenames.c - test_tar_large.c - test_ustar_filenames.c - test_ustar_filename_encoding.c - test_write_disk.c - test_write_disk_appledouble.c - test_write_disk_failures.c - test_write_disk_hardlink.c - test_write_disk_hfs_compression.c - test_write_disk_lookup.c - test_write_disk_mac_metadata.c - test_write_disk_no_hfs_compression.c - test_write_disk_perms.c - test_write_disk_secure.c - test_write_disk_sparse.c - test_write_disk_symlink.c - test_write_disk_times.c - test_write_filter_b64encode.c - test_write_filter_bzip2.c - test_write_filter_compress.c - test_write_filter_gzip.c - test_write_filter_gzip_timestamp.c - test_write_filter_lrzip.c - test_write_filter_lzip.c - test_write_filter_lzma.c - test_write_filter_lzop.c - test_write_filter_program.c - test_write_filter_uuencode.c - test_write_filter_xz.c - test_write_format_7zip.c - test_write_format_7zip_empty.c - test_write_format_7zip_large.c - test_write_format_ar.c - test_write_format_cpio.c - test_write_format_cpio_empty.c - test_write_format_cpio_newc.c - test_write_format_cpio_odc.c - test_write_format_gnutar.c - test_write_format_iso9660.c - test_write_format_iso9660_boot.c - test_write_format_iso9660_empty.c - test_write_format_iso9660_filename.c - test_write_format_iso9660_zisofs.c - test_write_format_mtree.c - test_write_format_mtree_absolute_path.c - test_write_format_mtree_classic.c - test_write_format_mtree_classic_indent.c - test_write_format_mtree_fflags.c - test_write_format_mtree_no_separator.c - test_write_format_mtree_quoted_filename.c - test_write_format_pax.c - test_write_format_shar_empty.c - test_write_format_tar.c - test_write_format_tar_empty.c - test_write_format_tar_sparse.c - test_write_format_tar_ustar.c - test_write_format_tar_v7tar.c - test_write_format_xar.c - test_write_format_xar_empty.c - test_write_format_zip.c - test_write_format_zip_empty.c - test_write_format_zip_no_compression.c - test_write_zip_set_compression_store.c - test_write_open_memory.c - test_zip_filename_encoding.c - ) - - # - # Register target - # - ADD_EXECUTABLE(libarchive_test ${libarchive_test_SOURCES}) - TARGET_LINK_LIBRARIES(libarchive_test archive_static ${ADDITIONAL_LIBS}) - SET_PROPERTY(TARGET libarchive_test PROPERTY COMPILE_DEFINITIONS - LIBARCHIVE_STATIC 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} ${libarchive_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 libarchive_${_testname} - COMMAND libarchive_test -vv - -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(${CMAKE_SOURCE_DIR}/test_utils) - - # Experimental new test handling - ADD_CUSTOM_TARGET(run_libarchive_test - COMMAND libarchive_test -r ${CMAKE_CURRENT_SOURCE_DIR}) - ADD_DEPENDENCIES(run_all_tests run_libarchive_test) -ENDIF(ENABLE_TEST) - diff --git a/tar/CMakeLists.txt b/tar/CMakeLists.txt deleted file mode 100644 index 46ce58b02e2e..000000000000 --- a/tar/CMakeLists.txt +++ /dev/null @@ -1,49 +0,0 @@ -############################################ -# -# How to build bsdtar -# -############################################ -IF(ENABLE_TAR) - - SET(bsdtar_SOURCES - bsdtar.c - bsdtar.h - bsdtar_platform.h - cmdline.c - creation_set.c - read.c - subst.c - util.c - write.c - ../libarchive_fe/err.c - ../libarchive_fe/err.h - ../libarchive_fe/lafe_platform.h - ../libarchive_fe/line_reader.c - ../libarchive_fe/line_reader.h - ) - INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe) - IF(WIN32 AND NOT CYGWIN) - LIST(APPEND bsdtar_SOURCES bsdtar_windows.c) - LIST(APPEND bsdtar_SOURCES bsdtar_windows.h) - ENDIF(WIN32 AND NOT CYGWIN) - - # bsdtar documentation - SET(bsdtar_MANS bsdtar.1) - - # How to build bsdtar - ADD_EXECUTABLE(bsdtar ${bsdtar_SOURCES}) - IF(ENABLE_TAR_SHARED) - TARGET_LINK_LIBRARIES(bsdtar archive ${ADDITIONAL_LIBS}) - ELSE(ENABLE_TAR_SHARED) - TARGET_LINK_LIBRARIES(bsdtar archive_static ${ADDITIONAL_LIBS}) - SET_TARGET_PROPERTIES(bsdtar PROPERTIES COMPILE_DEFINITIONS - LIBARCHIVE_STATIC) - ENDIF(ENABLE_TAR_SHARED) - GET_TARGET_PROPERTY(BSDTAR bsdtar LOCATION) - - # Installation rules - INSTALL(TARGETS bsdtar RUNTIME DESTINATION bin) - INSTALL_MAN(${bsdtar_MANS}) -ENDIF(ENABLE_TAR) - -add_subdirectory(test) diff --git a/tar/bsdtar_windows.c b/tar/bsdtar_windows.c deleted file mode 100644 index 41ce6eb78c8b..000000000000 --- a/tar/bsdtar_windows.c +++ /dev/null @@ -1,298 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * 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$ - */ - -#if defined(_WIN32) && !defined(__CYGWIN__) - -#include "bsdtar_platform.h" -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_UTIME_H -#include -#endif -#include -#include -#include -#include -#include -#include - -#include "bsdtar.h" -#include "err.h" - -/* This may actually not be needed anymore. - * TODO: Review the error handling for chdir() failures and - * simply dump this if it's not really needed. */ -static void __tar_dosmaperr(unsigned long); - -/* - * Prepend "\\?\" to the path name and convert it to unicode to permit - * an extended-length path for a maximum total path length of 32767 - * characters. - * see also http://msdn.microsoft.com/en-us/library/aa365247.aspx - */ -static wchar_t * -permissive_name(const char *name) -{ - wchar_t *wn, *wnp; - wchar_t *ws, *wsp; - DWORD l, len, slen, alloclen; - int unc; - - len = (DWORD)strlen(name); - wn = malloc((len + 1) * sizeof(wchar_t)); - if (wn == NULL) - return (NULL); - l = MultiByteToWideChar(CP_ACP, 0, name, len, wn, len); - if (l == 0) { - free(wn); - return (NULL); - } - wn[l] = L'\0'; - - /* Get a full path names */ - l = GetFullPathNameW(wn, 0, NULL, NULL); - if (l == 0) { - free(wn); - return (NULL); - } - wnp = malloc(l * sizeof(wchar_t)); - if (wnp == NULL) { - free(wn); - return (NULL); - } - len = GetFullPathNameW(wn, l, wnp, NULL); - free(wn); - wn = wnp; - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'?' && wnp[3] == L'\\') - /* We have already permissive names. */ - return (wn); - - if (wnp[0] == L'\\' && wnp[1] == L'\\' && - wnp[2] == L'.' && wnp[3] == L'\\') { - /* Device names */ - if (((wnp[4] >= L'a' && wnp[4] <= L'z') || - (wnp[4] >= L'A' && wnp[4] <= L'Z')) && - wnp[5] == L':' && wnp[6] == L'\\') - wnp[2] = L'?';/* Not device names. */ - return (wn); - } - - unc = 0; - if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') { - wchar_t *p = &wnp[2]; - - /* Skip server-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\') { - wchar_t *rp = ++p; - /* Skip share-name letters. */ - while (*p != L'\\' && *p != L'\0') - ++p; - if (*p == L'\\' && p != rp) { - /* Now, match patterns such as - * "\\server-name\share-name\" */ - wnp += 2; - len -= 2; - unc = 1; - } - } - } - - alloclen = slen = 4 + (unc * 4) + len + 1; - ws = wsp = malloc(slen * sizeof(wchar_t)); - if (ws == NULL) { - free(wn); - return (NULL); - } - /* prepend "\\?\" */ - wcsncpy(wsp, L"\\\\?\\", 4); - wsp += 4; - slen -= 4; - if (unc) { - /* append "UNC\" ---> "\\?\UNC\" */ - wcsncpy(wsp, L"UNC\\", 4); - wsp += 4; - slen -= 4; - } - wcsncpy(wsp, wnp, slen); - free(wn); - ws[alloclen - 1] = L'\0'; - return (ws); -} - -int -__tar_chdir(const char *path) -{ - wchar_t *ws; - int r; - - r = SetCurrentDirectoryA(path); - if (r == 0) { - if (GetLastError() != ERROR_FILE_NOT_FOUND) { - __tar_dosmaperr(GetLastError()); - return (-1); - } - } else - return (0); - ws = permissive_name(path); - if (ws == NULL) { - errno = EINVAL; - return (-1); - } - r = SetCurrentDirectoryW(ws); - free(ws); - if (r == 0) { - __tar_dosmaperr(GetLastError()); - return (-1); - } - return (0); -} - -/* - * The following function was modified from PostgreSQL sources and is - * subject to the copyright below. - */ -/*------------------------------------------------------------------------- - * - * win32error.c - * Map win32 error codes to errno values - * - * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - * - * IDENTIFICATION - * $PostgreSQL: pgsql/src/port/win32error.c,v 1.4 2008/01/01 19:46:00 momjian Exp $ - * - *------------------------------------------------------------------------- - */ -/* -PostgreSQL Database Management System -(formerly known as Postgres, then as Postgres95) - -Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group - -Portions Copyright (c) 1994, The Regents of the University of California - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose, without fee, and without a written agreement -is hereby granted, provided that the above copyright notice and this -paragraph and the following two paragraphs appear in all copies. - -IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR -DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING -LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS -DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - -THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS -ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO -PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. -*/ - -static const struct { - DWORD winerr; - int doserr; -} doserrors[] = -{ - { ERROR_INVALID_FUNCTION, EINVAL }, - { ERROR_FILE_NOT_FOUND, ENOENT }, - { ERROR_PATH_NOT_FOUND, ENOENT }, - { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, - { ERROR_ACCESS_DENIED, EACCES }, - { ERROR_INVALID_HANDLE, EBADF }, - { ERROR_ARENA_TRASHED, ENOMEM }, - { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, - { ERROR_INVALID_BLOCK, ENOMEM }, - { ERROR_BAD_ENVIRONMENT, E2BIG }, - { ERROR_BAD_FORMAT, ENOEXEC }, - { ERROR_INVALID_ACCESS, EINVAL }, - { ERROR_INVALID_DATA, EINVAL }, - { ERROR_INVALID_DRIVE, ENOENT }, - { ERROR_CURRENT_DIRECTORY, EACCES }, - { ERROR_NOT_SAME_DEVICE, EXDEV }, - { ERROR_NO_MORE_FILES, ENOENT }, - { ERROR_LOCK_VIOLATION, EACCES }, - { ERROR_SHARING_VIOLATION, EACCES }, - { ERROR_BAD_NETPATH, ENOENT }, - { ERROR_NETWORK_ACCESS_DENIED, EACCES }, - { ERROR_BAD_NET_NAME, ENOENT }, - { ERROR_FILE_EXISTS, EEXIST }, - { ERROR_CANNOT_MAKE, EACCES }, - { ERROR_FAIL_I24, EACCES }, - { ERROR_INVALID_PARAMETER, EINVAL }, - { ERROR_NO_PROC_SLOTS, EAGAIN }, - { ERROR_DRIVE_LOCKED, EACCES }, - { ERROR_BROKEN_PIPE, EPIPE }, - { ERROR_DISK_FULL, ENOSPC }, - { ERROR_INVALID_TARGET_HANDLE, EBADF }, - { ERROR_INVALID_HANDLE, EINVAL }, - { ERROR_WAIT_NO_CHILDREN, ECHILD }, - { ERROR_CHILD_NOT_COMPLETE, ECHILD }, - { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, - { ERROR_NEGATIVE_SEEK, EINVAL }, - { ERROR_SEEK_ON_DEVICE, EACCES }, - { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, - { ERROR_NOT_LOCKED, EACCES }, - { ERROR_BAD_PATHNAME, ENOENT }, - { ERROR_MAX_THRDS_REACHED, EAGAIN }, - { ERROR_LOCK_FAILED, EACCES }, - { ERROR_ALREADY_EXISTS, EEXIST }, - { ERROR_FILENAME_EXCED_RANGE, ENOENT }, - { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, - { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } -}; - -static void -__tar_dosmaperr(unsigned long e) -{ - int i; - - if (e == 0) { - errno = 0; - return; - } - - for (i = 0; i < (int)sizeof(doserrors); i++) { - if (doserrors[i].winerr == e) { - errno = doserrors[i].doserr; - return; - } - } - - /* fprintf(stderr, "unrecognized win32 error code: %lu", e); */ - errno = EINVAL; - return; -} - -#endif diff --git a/tar/bsdtar_windows.h b/tar/bsdtar_windows.h deleted file mode 100644 index f0611d79abdc..000000000000 --- a/tar/bsdtar_windows.h +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $FreeBSD$ - */ - -#ifndef BSDTAR_WINDOWS_H -#define BSDTAR_WINDOWS_H 1 -#include -#include - -#ifndef PRId64 -#define PRId64 "I64" -#endif -#define geteuid() 0 - -#ifndef S_IFIFO -#define S_IFIFO 0010000 /* pipe */ -#endif - -#include /* Must include before redefining 'strdup' */ -#if !defined(__BORLANDC__) -#define strdup _strdup -#endif -#if !defined(__BORLANDC__) -#define getcwd _getcwd -#endif - -#define chdir __tar_chdir -int __tar_chdir(const char *); - -#ifndef S_ISREG -#define S_ISREG(a) (a & _S_IFREG) -#endif -#ifndef S_ISBLK -#define S_ISBLK(a) (0) -#endif - -#endif /* BSDTAR_WINDOWS_H */ diff --git a/tar/config_freebsd.h b/tar/config_freebsd.h deleted file mode 100644 index 37aa9dcae172..000000000000 --- a/tar/config_freebsd.h +++ /dev/null @@ -1,84 +0,0 @@ -/*- - * 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/config_freebsd.h,v 1.8 2008/11/29 20:06:53 kientzle Exp $ - */ - -/* A default configuration for FreeBSD, used if there is no config.h. */ - -#include /* __FreeBSD_version */ - -#undef HAVE_ATTR_XATTR_H -#define HAVE_CHROOT 1 -#define HAVE_DIRENT_D_NAMLEN 1 -#define HAVE_DIRENT_H 1 -#define HAVE_D_MD_ORDER 1 -#define HAVE_ERRNO_H 1 -#undef HAVE_EXT2FS_EXT2_FS_H -#define HAVE_FCHDIR 1 -#define HAVE_FCNTL_H 1 -#define HAVE_GRP_H 1 -#define HAVE_LANGINFO_H 1 -#undef HAVE_LIBACL -#define HAVE_LIBARCHIVE 1 -#define HAVE_LIMITS_H 1 -#define HAVE_LINK 1 -#undef HAVE_LINUX_EXT2_FS_H -#undef HAVE_LINUX_FS_H -#define HAVE_LOCALE_H 1 -#define HAVE_MBTOWC 1 -#undef HAVE_NDIR_H -#if __FreeBSD_version >= 450002 /* nl_langinfo introduced */ -#define HAVE_NL_LANGINFO 1 -#endif -#define HAVE_PATHS_H 1 -#define HAVE_PWD_H 1 -#define HAVE_READLINK 1 -#define HAVE_REGEX_H 1 -#define HAVE_SETLOCALE 1 -#define HAVE_SIGNAL_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRUCT_STAT_ST_FLAGS 1 -#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC -#undef HAVE_STRUCT_STAT_ST_MTIME_N -#undef HAVE_STRUCT_STAT_ST_MTIME_USEC -#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 -#undef HAVE_STRUCT_STAT_ST_UMTIME -#define HAVE_SYMLINK 1 -#define HAVE_SYS_CDEFS_H 1 -#undef HAVE_SYS_DIR_H -#define HAVE_SYS_IOCTL_H 1 -#undef HAVE_SYS_NDIR_H -#define HAVE_SYS_PARAM_H 1 -#define HAVE_SYS_STAT_H 1 -#define HAVE_TIME_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_UINTMAX_T 1 -#define HAVE_UNISTD_H 1 -#define HAVE_UNSIGNED_LONG_LONG -#define HAVE_WCTYPE_H 1 -#define HAVE_ZLIB_H 1 -#undef MAJOR_IN_MKDEV diff --git a/tar/test/CMakeLists.txt b/tar/test/CMakeLists.txt deleted file mode 100644 index 98f49e29298b..000000000000 --- a/tar/test/CMakeLists.txt +++ /dev/null @@ -1,101 +0,0 @@ -############################################ -# -# How to build bsdtar_test -# -############################################ -IF(ENABLE_TAR AND ENABLE_TEST) - SET(bsdtar_test_SOURCES - ../../test_utils/test_utils.c - main.c - test.h - test_0.c - test_basic.c - test_copy.c - test_empty_mtree.c - test_extract_tar_Z.c - test_extract_tar_bz2.c - test_extract_tar_grz.c - test_extract_tar_gz.c - test_extract_tar_lrz.c - test_extract_tar_lz.c - test_extract_tar_lzma.c - test_extract_tar_lzo.c - test_extract_tar_xz.c - test_format_newc.c - test_help.c - test_option_C_upper.c - test_option_H_upper.c - test_option_L_upper.c - test_option_O_upper.c - test_option_T_upper.c - test_option_U_upper.c - test_option_X_upper.c - test_option_a.c - test_option_b.c - test_option_b64encode.c - test_option_exclude.c - test_option_gid_gname.c - test_option_grzip.c - test_option_j.c - test_option_k.c - test_option_keep_newer_files.c - test_option_lrzip.c - test_option_lzma.c - test_option_lzop.c - test_option_n.c - test_option_newer_than.c - test_option_nodump.c - test_option_older_than.c - test_option_q.c - test_option_r.c - test_option_s.c - test_option_uid_uname.c - test_option_uuencode.c - test_option_xz.c - test_option_z.c - test_patterns.c - test_print_longpath.c - test_stdio.c - test_strip_components.c - test_symlink_dir.c - test_version.c - test_windows.c - ) - - # - # Register target - # - ADD_EXECUTABLE(bsdtar_test ${bsdtar_test_SOURCES}) - SET_PROPERTY(TARGET bsdtar_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} ${bsdtar_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 bsdtar_${_testname} - COMMAND bsdtar_test -vv - -p $ - -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(${CMAKE_SOURCE_DIR}/test_utils) - - # Experimental new test handling - ADD_CUSTOM_TARGET(run_bsdtar_test - COMMAND bsdtar_test -p ${BSDTAR} -r ${CMAKE_CURRENT_SOURCE_DIR}) - ADD_DEPENDENCIES(run_bsdtar_test bsdtar) - ADD_DEPENDENCIES(run_all_tests run_bsdtar_test) - -ENDIF(ENABLE_TAR AND ENABLE_TEST) diff --git a/tar/test/test_windows.c b/tar/test/test_windows.c deleted file mode 100644 index 1977ec644e68..000000000000 --- a/tar/test/test_windows.c +++ /dev/null @@ -1,324 +0,0 @@ -/*- - * Copyright (c) 2009 Michihiro NAKAJIMA - * 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" - -#if defined(_WIN32) && !defined(__CYGWIN__) -#include -#include - -static void -mkfile(const char *name) -{ - FILE *f; - - f = fopen(name, "wb"); - assert(f != NULL); - assertEqualInt(5, fwrite("01234", 1, 5, f)); - fclose(f); -} - -static void -mkfullpath(char **path1, char **path2, const char *tpath, int type) -{ - char *fp1 = NULL, *fp2 = NULL, *p1 = NULL, *p2 = NULL; - size_t l; - - /* - * Get full path name of "tpath" - */ - l = GetFullPathNameA(tpath, 0, NULL, NULL); - assert(0 != l); - fp1 = malloc(l); - assert(NULL != fp1); - fp2 = malloc(l*2); - assert(NULL != fp2); - l = GetFullPathNameA(tpath, (DWORD)l, fp1, NULL); - if ((type & 0x01) == 0) { - for (p1 = fp1; *p1 != '\0'; p1++) - if (*p1 == '\\') - *p1 = '/'; - } - - switch(type) { - case 0: /* start with "/" */ - case 1: /* start with "\" */ - /* strip "c:" */ - memmove(fp1, fp1 + 2, l - 2); - fp1[l -2] = '\0'; - p1 = fp1 + 1; - break; - case 2: /* start with "c:/" */ - case 3: /* start with "c:\" */ - p1 = fp1 + 3; - break; - case 4: /* start with "//./c:/" */ - case 5: /* start with "\\.\c:\" */ - case 6: /* start with "//?/c:/" */ - case 7: /* start with "\\?\c:\" */ - p1 = malloc(l + 4 + 1); - assert(NULL != p1); - if (type & 0x1) - memcpy(p1, "\\\\.\\", 4); - else - memcpy(p1, "//./", 4); - if (type == 6 || type == 7) - p1[2] = '?'; - memcpy(p1 + 4, fp1, l); - p1[l + 4] = '\0'; - free(fp1); - fp1 = p1; - p1 = fp1 + 7; - break; - } - - /* - * Strip leading drive names and converting "\" to "\\" - */ - p2 = fp2; - while (*p1 != '\0') { - if (*p1 == '\\') - *p2 = '/'; - else - *p2 = *p1; - ++p1; - ++p2; - } - *p2++ = '\r'; - *p2++ = '\n'; - *p2 = '\0'; - - *path1 = fp1; - *path2 = fp2; -} - -static const char *list1[] = {"aaa/", "aaa/file1", "aaa/xxa/", "aaa/xxb/", - "aaa/zzc/", "aaa/zzc/file1", "aaa/xxb/file1", "aaa/xxa/file1", - "aab/", "aac/", "abb/", "abc/", "abd/", NULL}; -static const char *list2[] = {"bbb/", "bbb/file1", "bbb/xxa/", "bbb/xxb/", - "bbb/zzc/", "bbb/zzc/file1", "bbb/xxb/file1", "bbb/xxa/file1", "bbc/", - "bbd/", "bcc/", "bcd/", "bce/", NULL}; -static const char *list3[] = {"aac/", "abc/", "bbc/", "bcc/", "ccc/", NULL}; -static const char *list4[] = {"fff/abca", "fff/acca", NULL}; -static const char *list5[] = {"aaa/file1", "aaa/xxa/", "aaa/xxa/file1", - "aaa/xxb/", "aaa/xxb/file1", "aaa/zzc/", "aaa/zzc/file1", NULL}; -static const char *list6[] = {"fff/abca", "fff/acca", "aaa/xxa/", - "aaa/xxa/file1", "aaa/xxb/", "aaa/xxb/file1", NULL}; -#endif /* _WIN32 && !__CYGWIN__ */ - -DEFINE_TEST(test_windows) -{ -#if defined(_WIN32) && !defined(__CYGWIN__) - char *fp1, *fp2; - - /* - * Preparre tests. - * Create directories and files. - */ - assertMakeDir("tmp", 0775); - assertChdir("tmp"); - - assertMakeDir("aaa", 0775); - assertMakeDir("aaa/xxa", 0775); - assertMakeDir("aaa/xxb", 0775); - assertMakeDir("aaa/zzc", 0775); - mkfile("aaa/file1"); - mkfile("aaa/xxa/file1"); - mkfile("aaa/xxb/file1"); - mkfile("aaa/zzc/file1"); - assertMakeDir("aab", 0775); - assertMakeDir("aac", 0775); - assertMakeDir("abb", 0775); - assertMakeDir("abc", 0775); - assertMakeDir("abd", 0775); - assertMakeDir("bbb", 0775); - assertMakeDir("bbb/xxa", 0775); - assertMakeDir("bbb/xxb", 0775); - assertMakeDir("bbb/zzc", 0775); - mkfile("bbb/file1"); - mkfile("bbb/xxa/file1"); - mkfile("bbb/xxb/file1"); - mkfile("bbb/zzc/file1"); - assertMakeDir("bbc", 0775); - assertMakeDir("bbd", 0775); - assertMakeDir("bcc", 0775); - assertMakeDir("bcd", 0775); - assertEqualInt(0, _mkdir("bce")); - assertEqualInt(0, _mkdir("ccc")); - assertEqualInt(0, _mkdir("fff")); - mkfile("fff/aaaa"); - mkfile("fff/abba"); - mkfile("fff/abca"); - mkfile("fff/acba"); - mkfile("fff/acca"); - - /* - * Test1: Command line pattern matching. - */ - assertEqualInt(0, - systemf("%s -cf ../archive1.tar a*", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive1.tar > ../list1", testprog)); - assertFileContainsLinesAnyOrder("../list1", list1); - - assertEqualInt(0, - systemf("%s -cf ../archive2.tar b*", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive2.tar > ../list2", testprog)); - assertFileContainsLinesAnyOrder("../list2", list2); - - assertEqualInt(0, - systemf("%s -cf ../archive3.tar ??c", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive3.tar > ../list3", testprog)); - assertFileContainsLinesAnyOrder("../list3", list3); - - assertEqualInt(0, - systemf("%s -cf ../archive3b.tar *c", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive3b.tar > ../list3b", testprog)); - assertFileContainsLinesAnyOrder("../list3b", list3); - - assertEqualInt(0, - systemf("%s -cf ../archive4.tar fff/a?ca", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive4.tar > ../list4", testprog)); - assertFileContainsLinesAnyOrder("../list4", list4); - - assertEqualInt(0, - systemf("%s -cf ../archive5.tar aaa\\*", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive5.tar > ../list5", testprog)); - assertFileContainsLinesAnyOrder("../list5", list5); - - assertEqualInt(0, - systemf("%s -cf ../archive6.tar fff\\a?ca aaa\\xx*", testprog)); - assertEqualInt(0, - systemf("%s -tf ../archive6.tar > ../list6", testprog)); - assertFileContainsLinesAnyOrder("../list6", list6); - - /* - * Test2: Archive the file start with drive letters. - */ - /* Test2a: start with "/" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 0); - assertEqualInt(0, - systemf("%s -cf ../archive10.tar %s > ../out10 2> ../err10", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive10.tar > ../list10", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, (int)strlen(fp2), "../list10"); - free(fp1); - free(fp2); - - /* Test2b: start with "\" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 1); - assertEqualInt(0, - systemf("%s -cf ../archive11.tar %s > ../out11 2> ../err11", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive11.tar > ../list11", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, (int)strlen(fp2), "../list11"); - free(fp1); - free(fp2); - - /* Test2c: start with "c:/" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 2); - assertEqualInt(0, - systemf("%s -cf ../archive12.tar %s > ../out12 2> ../err12", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive12.tar > ../list12", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, (int)strlen(fp2), "../list12"); - free(fp1); - free(fp2); - - /* Test2d: start with "c:\" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 3); - assertEqualInt(0, - systemf("%s -cf ../archive13.tar %s > ../out13 2> ../err13", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive13.tar > ../list13", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, (int)strlen(fp2), "../list13"); - free(fp1); - free(fp2); - - /* Test2e: start with "//./c:/" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 4); - assertEqualInt(0, - systemf("%s -cf ../archive14.tar %s > ../out14 2> ../err14", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive14.tar > ../list14", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, (int)strlen(fp2), "../list14"); - free(fp1); - free(fp2); - - /* Test2f: start with "\\.\c:\" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 5); - assertEqualInt(0, - systemf("%s -cf ../archive15.tar %s > ../out15 2> ../err15", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive15.tar > ../list15", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, (int)strlen(fp2), "../list15"); - free(fp1); - free(fp2); - - /* Test2g: start with "//?/c:/" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 6); - failure("fp1=%s, fp2=%s", fp1, fp2); - assertEqualInt(0, - systemf("%s -cf ../archive16.tar %s > ../out16 2> ../err16", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive16.tar > ../list16", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, (int)strlen(fp2), "../list16"); - free(fp1); - free(fp2); - - /* Test2h: start with "\\?\c:\" */ - mkfullpath(&fp1, &fp2, "aaa/file1", 7); - failure("fp1=%s, fp2=%s", fp1, fp2); - assertEqualInt(0, - systemf("%s -cf ../archive17.tar %s > ../out17 2> ../err17", - testprog, fp1)); - assertEqualInt(0, - systemf("%s -tf ../archive17.tar > ../list17", testprog)); - /* Check drive letters have been stripped. */ - assertFileContents(fp2, (int)strlen(fp2), "../list17"); - free(fp1); - free(fp2); -#else - skipping("Windows specific test"); -#endif /* _WIN32 && !__CYGWIN__ */ -} From 8c8f03ca5b7f1f0d07c23e7c354a45b7c95335f0 Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Wed, 11 May 2016 10:10:11 +0000 Subject: [PATCH 2/3] Keep full libarchive distribution in vendor branch (prep for 3.2.0 update) --- .gitattributes | 4 + .gitignore | 84 + CMakeLists.txt | 1525 ++++++++++ CTestConfig.cmake | 11 + INSTALL | 35 + Makefile.am | 1012 +++++++ build/README.txt | 35 + build/autoconf/check_stdcall_func.m4 | 51 + build/autoconf/config.rpath | 696 +++++ build/autoconf/iconv.m4 | 268 ++ build/autoconf/la_uid_t.m4 | 20 + build/autoconf/lib-ld.m4 | 109 + build/autoconf/lib-link.m4 | 777 +++++ build/autoconf/lib-prefix.m4 | 224 ++ build/autogen.sh | 67 + build/bump-version.sh | 36 + build/clean.sh | 97 + build/cmake/CheckFileOffsetBits.c | 14 + build/cmake/CheckFileOffsetBits.cmake | 44 + build/cmake/CheckFuncs.cmake | 49 + build/cmake/CheckFuncs_stub.c.in | 16 + build/cmake/CheckHeaderDirent.cmake | 32 + build/cmake/CheckStructMember.cmake | 43 + build/cmake/CheckTypeExists.cmake | 42 + build/cmake/FindLZMA.cmake | 48 + build/cmake/FindLibGCC.cmake | 22 + build/cmake/FindNettle.cmake | 23 + build/cmake/FindPCREPOSIX.cmake | 34 + .../LibarchiveCheckCSourceCompiles.cmake | 106 + build/cmake/LibarchiveCheckCSourceRuns.cmake | 102 + build/cmake/config.h.in | 1143 ++++++++ build/makerelease.sh | 58 + build/pkgconfig/libarchive.pc.in | 11 + .../utils/gen_archive_string_composition_h.sh | 455 +++ build/version | 1 + configure.ac | 788 ++++++ contrib/README | 59 + contrib/libarchive.1aix53.spec | 160 ++ contrib/libarchive.spec | 147 + .../libarchive_autodetect-st_lib_archive.m4 | 154 + contrib/psota-benchmark/results.txt | 136 + contrib/psota-benchmark/tcp.sh | 110 + contrib/shar/Makefile | 14 + contrib/shar/shar.1 | 128 + contrib/shar/shar.c | 314 +++ contrib/shar/tree.c | 542 ++++ contrib/shar/tree.h | 115 + contrib/shar/tree_config.h | 78 + contrib/untar.c | 225 ++ cpio/CMakeLists.txt | 47 + cpio/config_freebsd.h | 56 + cpio/cpio_windows.c | 338 +++ cpio/cpio_windows.h | 72 + cpio/test/CMakeLists.txt | 93 + doc/html/.ignore_me | 2 + doc/man/.ignore_me | 2 + doc/mdoc2man.awk | 391 +++ doc/mdoc2wiki.awk | 451 +++ doc/pdf/.ignore_me | 2 + doc/text/.ignore_me | 2 + doc/update.sh | 119 + doc/wiki/.ignore_me | 2 + examples/minitar/Makefile | 26 + examples/minitar/README | 12 + examples/minitar/minitar.c | 458 +++ examples/tarfilter.c | 113 + examples/untar.c | 266 ++ libarchive/CMakeLists.txt | 193 ++ libarchive/archive_entry_copy_bhfi.c | 75 + libarchive/archive_read_disk_windows.c | 2296 +++++++++++++++ libarchive/archive_windows.c | 908 ++++++ libarchive/archive_windows.h | 306 ++ libarchive/archive_write_disk_windows.c | 2502 +++++++++++++++++ libarchive/config_freebsd.h | 160 ++ libarchive/filter_fork_windows.c | 190 ++ libarchive/mtree.5 | 269 ++ libarchive/test/.cvsignore | 10 + libarchive/test/CMakeLists.txt | 256 ++ tar/CMakeLists.txt | 49 + tar/bsdtar_windows.c | 298 ++ tar/bsdtar_windows.h | 60 + tar/config_freebsd.h | 84 + tar/test/CMakeLists.txt | 101 + tar/test/test_windows.c | 324 +++ 84 files changed, 20797 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 CTestConfig.cmake create mode 100644 INSTALL create mode 100644 Makefile.am create mode 100644 build/README.txt create mode 100644 build/autoconf/check_stdcall_func.m4 create mode 100755 build/autoconf/config.rpath create mode 100644 build/autoconf/iconv.m4 create mode 100644 build/autoconf/la_uid_t.m4 create mode 100644 build/autoconf/lib-ld.m4 create mode 100644 build/autoconf/lib-link.m4 create mode 100644 build/autoconf/lib-prefix.m4 create mode 100755 build/autogen.sh create mode 100755 build/bump-version.sh create mode 100755 build/clean.sh create mode 100644 build/cmake/CheckFileOffsetBits.c create mode 100644 build/cmake/CheckFileOffsetBits.cmake create mode 100644 build/cmake/CheckFuncs.cmake create mode 100644 build/cmake/CheckFuncs_stub.c.in create mode 100644 build/cmake/CheckHeaderDirent.cmake create mode 100644 build/cmake/CheckStructMember.cmake create mode 100644 build/cmake/CheckTypeExists.cmake create mode 100644 build/cmake/FindLZMA.cmake create mode 100644 build/cmake/FindLibGCC.cmake create mode 100644 build/cmake/FindNettle.cmake create mode 100644 build/cmake/FindPCREPOSIX.cmake create mode 100644 build/cmake/LibarchiveCheckCSourceCompiles.cmake create mode 100644 build/cmake/LibarchiveCheckCSourceRuns.cmake create mode 100644 build/cmake/config.h.in create mode 100755 build/makerelease.sh create mode 100644 build/pkgconfig/libarchive.pc.in create mode 100755 build/utils/gen_archive_string_composition_h.sh create mode 100644 build/version create mode 100644 configure.ac create mode 100644 contrib/README create mode 100644 contrib/libarchive.1aix53.spec create mode 100644 contrib/libarchive.spec create mode 100644 contrib/libarchive_autodetect-st_lib_archive.m4 create mode 100644 contrib/psota-benchmark/results.txt create mode 100755 contrib/psota-benchmark/tcp.sh create mode 100644 contrib/shar/Makefile create mode 100644 contrib/shar/shar.1 create mode 100644 contrib/shar/shar.c create mode 100644 contrib/shar/tree.c create mode 100644 contrib/shar/tree.h create mode 100644 contrib/shar/tree_config.h create mode 100644 contrib/untar.c create mode 100644 cpio/CMakeLists.txt create mode 100644 cpio/config_freebsd.h create mode 100644 cpio/cpio_windows.c create mode 100644 cpio/cpio_windows.h create mode 100644 cpio/test/CMakeLists.txt create mode 100644 doc/html/.ignore_me create mode 100644 doc/man/.ignore_me create mode 100755 doc/mdoc2man.awk create mode 100755 doc/mdoc2wiki.awk create mode 100644 doc/pdf/.ignore_me create mode 100644 doc/text/.ignore_me create mode 100755 doc/update.sh create mode 100644 doc/wiki/.ignore_me create mode 100644 examples/minitar/Makefile create mode 100644 examples/minitar/README create mode 100644 examples/minitar/minitar.c create mode 100644 examples/tarfilter.c create mode 100644 examples/untar.c create mode 100644 libarchive/CMakeLists.txt create mode 100644 libarchive/archive_entry_copy_bhfi.c create mode 100644 libarchive/archive_read_disk_windows.c create mode 100644 libarchive/archive_windows.c create mode 100644 libarchive/archive_windows.h create mode 100644 libarchive/archive_write_disk_windows.c create mode 100644 libarchive/config_freebsd.h create mode 100644 libarchive/filter_fork_windows.c create mode 100644 libarchive/mtree.5 create mode 100644 libarchive/test/.cvsignore create mode 100644 libarchive/test/CMakeLists.txt create mode 100644 tar/CMakeLists.txt create mode 100644 tar/bsdtar_windows.c create mode 100644 tar/bsdtar_windows.h create mode 100644 tar/config_freebsd.h create mode 100644 tar/test/CMakeLists.txt create mode 100644 tar/test/test_windows.c diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000000..496519561edf --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +.git* export-ignore + +*.sh crlf=input +config.rpath crlf=input diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..3609145920ca --- /dev/null +++ b/.gitignore @@ -0,0 +1,84 @@ +*.o +*.exe +*.lo +*.cmake +.libs/ +Makefile +Makefile.in +aclocal.m4 +autom4te.cache/ +bsdcpio +bsdcpio_test +bsdtar +bsdtar_test +build/autoconf/compile +build/autoconf/config.guess +build/autoconf/config.sub +build/autoconf/depcomp +build/autoconf/install-sh +build/autoconf/libtool.m4 +build/autoconf/ltmain.sh +build/autoconf/ltoptions.m4 +build/autoconf/ltsugar.m4 +build/autoconf/ltversion.m4 +build/autoconf/lt~obsolete.m4 +build/autoconf/missing +build/pkgconfig/libarchive.pc +config.h +config.h.in +config.h.in~ +config.log +config.status +configure +cpio/.deps/ +cpio/.dirstamp +cpio/test/.deps/ +cpio/test/.dirstamp +cpio/test/list.h +libarchive.la +libarchive/.deps/ +libarchive/.dirstamp +libarchive/test/.deps/ +libarchive/test/.dirstamp +libarchive/test/list.h +libarchive_fe.la +libarchive_fe/.deps/ +libarchive_fe/.dirstamp +libarchive_test +libtool +stamp-h1 +tar/.deps/ +tar/.dirstamp +tar/test/.deps/ +tar/test/.dirstamp +tar/test/list.h +CMakeCache.txt +CMakeFiles/ +DartConfiguration.tcl +cmake.tmp/ +cpio/CMakeFiles/ +cpio/test/CMakeFiles/ +libarchive/CMakeFiles/ +libarchive/test/CMakeFiles/ +tar/CMakeFiles/ +tar/test/CMakeFiles/ +test_utils/.deps/ +test_utils/.dirstamp + +doc/html/*.html +doc/man/*.1 +doc/man/*.3 +doc/man/*.5 +doc/pdf/*.pdf +doc/text/*.txt +doc/wiki/*.wiki + +libarchive-*.tar.gz +libarchive-*.zip + +Testing/ +libarchive/libarchive.a +libarchive/libarchive.so +libarchive/libarchive.so.* + +.DS_Store diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000000..2cdb9fb48585 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,1525 @@ +# +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6 FATAL_ERROR) +# +PROJECT(libarchive C) +# +SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") +if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) +endif() +# +# Set the Build type for make based generators. +# You can choose following types: +# Debug : Debug build +# Release : Release build +# RelWithDebInfo : Release build with Debug Info +# MinSizeRel : Release Min Size build +IF(NOT CMAKE_BUILD_TYPE) + 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". +GET_PROPERTY(cached_type CACHE CMAKE_BUILD_TYPE PROPERTY TYPE) +IF("${cached_type}" STREQUAL "UNINITIALIZED") + SET(CMAKE_BUILD_TYPE "${CMAKE_BUILD_TYPE}" CACHE STRING "Build Type" FORCE) +ENDIF("${cached_type}" STREQUAL "UNINITIALIZED") +# Check the Build Type. +IF(NOT "${CMAKE_BUILD_TYPE}" + MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)\$") + MESSAGE(FATAL_ERROR + "Unknown keyword for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}\n" + "Acceptable keywords: Debug,Release,RelWithDebInfo,MinSizeRel") +ENDIF(NOT "${CMAKE_BUILD_TYPE}" + MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)\$") + +# On MacOS, prefer MacPorts libraries to system libraries. +# I haven't come up with a compelling argument for this to be conditional. +list(APPEND CMAKE_PREFIX_PATH /opt/local) + +# +# Version - read from 'version' file. +# +FILE(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/build/version _version) +STRING(REGEX REPLACE + "^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]?$" "\\1" _major ${_version}) +STRING(REGEX REPLACE + "^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]?$" "\\1" _minor ${_version}) +STRING(REGEX REPLACE + "^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]?$" "\\1" _revision ${_version}) +STRING(REGEX REPLACE + "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]?)$" "\\1" _quality ${_version}) +SET(_version_number ${_major}${_minor}${_revision}) +STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_minor ${_minor}) +STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_revision ${_revision}) +# +SET(VERSION "${_major}.${_trimmed_minor}.${_trimmed_revision}${_quality}") +SET(BSDCPIO_VERSION_STRING "${VERSION}") +SET(BSDTAR_VERSION_STRING "${VERSION}") +SET(LIBARCHIVE_VERSION_NUMBER "${_version_number}") +SET(LIBARCHIVE_VERSION_STRING "${VERSION}") + +# INTERFACE_VERSION increments with every release +# libarchive 2.7 == interface version 9 = 2 + 7 +# libarchive 2.8 == interface version 10 = 2 + 8 +# libarchive 2.9 == interface version 11 = 2 + 9 +# libarchive 3.0 == interface version 12 +# libarchive 3.1 == interface version 13 +math(EXPR INTERFACE_VERSION "13 + ${_minor}") + +# Set SOVERSION == Interface version +# ?? Should there be more here ?? +SET(SOVERSION "${INTERFACE_VERSION}") + +# Enalbe CMAKE_PUSH_CHECK_STATE() and CMAKE_POP_CHECK_STATE() macros +# saving and restoring the state of the variables. +INCLUDE(CMakePushCheckState) + +# Initialize the state of the variables. This initialization is not +# necessary but this shows you what value the variables initially have. +SET(CMAKE_REQUIRED_DEFINITIONS) +SET(CMAKE_REQUIRED_INCLUDES) +SET(CMAKE_REQUIRED_LIBRARIES) +SET(CMAKE_REQUIRED_FLAGS) + +# Especially for early development, we want to be a little +# aggressive about diagnosing build problems; this can get +# relaxed somewhat in final shipping versions. +IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") + ################################################################# + # Set compile flags for all build types. + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wformat -Wformat-security") + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror -Wextra -Wunused") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") +ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") +IF (MSVC) + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" + # Enable level 4 C4061: The enumerate has no associated handler in a switch + # statement. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4061") + # Enable level 4 C4254: A larger bit field was assigned to a smaller bit + # field. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4254") + # Enable level 4 C4295: An array was initialized but the last character in + # the array is not a null; accessing the array may + # produce unexpected results. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4295") + # Enable level 4 C4296: An unsigned variable was used in a comparison + # operation with zero. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4296") + # Enable level 4 C4389: An operation involved signed and unsigned variables. + # This could result in a loss of data. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4389") + # Enable level 4 C4505: The given function is local and not referenced in + # the body of the module; therefore, the function is + # dead code. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4505") + # Enable level 4 C4514: The optimizer removed an inline function that is not + # called. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4514") + # Enable level 4 C4702: Unreachable code. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4702") + # Enable level 4 C4706: The test value in a conditional expression was the + # result of an assignment. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4706") + # /WX option is the same as gcc's -Werror option. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /WX") + # /Oi option enables built-in functions. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Oi") + ################################################################# + # Set compile flags for release build. + SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Oi") +ENDIF (MSVC) + +# Enable CTest/CDash support +include(CTest) + +OPTION(ENABLE_NETTLE "Enable use of Nettle" ON) +OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON) +OPTION(ENABLE_TAR "Enable tar building" ON) +OPTION(ENABLE_TAR_SHARED "Enable dynamic build of tar" FALSE) +OPTION(ENABLE_CPIO "Enable cpio building" ON) +OPTION(ENABLE_CPIO_SHARED "Enable dynamic build of cpio" FALSE) +OPTION(ENABLE_XATTR "Enable extended attribute support" ON) +OPTION(ENABLE_ACL "Enable ACL support" ON) +OPTION(ENABLE_ICONV "Enable iconv support" ON) +OPTION(ENABLE_TEST "Enable unit and regression tests" ON) +SET(POSIX_REGEX_LIB "AUTO" CACHE STRING "Choose what library should provide POSIX regular expression support") +SET(ENABLE_SAFESEH "AUTO" CACHE STRING "Enable use of /SAFESEH linker flag (MSVC only)") +SET(WINDOWS_VERSION "" CACHE STRING "Set Windows version to use (Windows only)") + +IF(ENABLE_TEST) + ENABLE_TESTING() +ENDIF(ENABLE_TEST) + +IF(WIN32) + IF(WINDOWS_VERSION STREQUAL "WIN8") + SET(WINVER 0x0602) + ELSEIF(WINDOWS_VERSION STREQUAL "WIN7") + SET(WINVER 0x0601) + ELSEIF(WINDOWS_VERSION STREQUAL "WS08") + SET(WINVER 0x0600) + ELSEIF(WINDOWS_VERSION STREQUAL "VISTA") + SET(WINVER 0x0600) + ELSEIF(WINDOWS_VERSION STREQUAL "WS03") + SET(WINVER 0x0502) + ELSEIF(WINDOWS_VERSION STREQUAL "WINXP") + SET(WINVER 0x0501) + ELSE(WINDOWS_VERSION STREQUAL "WIN8") + # The default is to use Windows 2000 API. + SET(WINVER 0x0500) + ENDIF(WINDOWS_VERSION STREQUAL "WIN8") + SET(_WIN32_WINNT ${WINVER}) +ENDIF(WIN32) + +IF(MSVC) + IF(ENABLE_SAFESEH STREQUAL "YES") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH") + SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH") + SET(CMAKE_REQUIRED_LINKER_FLAGS "/SAFESEH") + ELSEIF(ENABLE_SAFESEH STREQUAL "NO") + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") + SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") + SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO") + SET(CMAKE_REQUIRED_LINKER_FLAGS "/SAFESEH:NO") + ENDIF(ENABLE_SAFESEH STREQUAL "YES") +ENDIF(MSVC) + +IF("${CMAKE_C_PLATFORM_ID}" MATCHES "^(HP-UX)$") + ADD_DEFINITIONS(-D_XOPEN_SOURCE=500) # Ask wchar.h for mbstate_t +ENDIF() + +# +INCLUDE(LibarchiveCheckCSourceCompiles) +INCLUDE(LibarchiveCheckCSourceRuns) +INCLUDE(CheckFileOffsetBits) +INCLUDE(CheckFuncs) +INCLUDE(CheckHeaderDirent) +INCLUDE(CheckIncludeFile) +INCLUDE(CheckIncludeFiles) +INCLUDE(CheckLibraryExists) +INCLUDE(CheckStructMember) +INCLUDE(CheckSymbolExists) +INCLUDE(CheckTypeExists) +INCLUDE(CheckTypeSize) + +# +# Generate list.h +# +MACRO (GENERATE_LIST_H _listfile _cmlist __list_sources) + SET(_argv ${ARGV}) + # Remove _listfile and _cmlist from _argv + LIST(REMOVE_AT _argv 0 1) + IF (NOT EXISTS "${_listfile}" OR + ${_cmlist} IS_NEWER_THAN "${_listfile}") + + MESSAGE(STATUS "Generating ${_listfile}") + FILE(WRITE ${_listfile} "") + FOREACH (testfile ${_argv}) + IF (testfile MATCHES "^test_[^/]+[.]c$") + FILE(STRINGS ${testfile} testvar REGEX "^DEFINE_TEST") + FOREACH (deftest ${testvar}) + FILE(APPEND ${_listfile} "${deftest}\n") + ENDFOREACH (deftest) + ENDIF (testfile MATCHES "^test_[^/]+[.]c$") + ENDFOREACH (testfile) + + ENDIF (NOT EXISTS "${_listfile}" OR + ${_cmlist} IS_NEWER_THAN "${_listfile}") +ENDMACRO (GENERATE_LIST_H) +# +# Generate installation rules for man pages. +# +MACRO (INSTALL_MAN __mans) + FOREACH (_man ${ARGV}) + STRING(REGEX REPLACE "^.+[.]([1-9])" "\\1" _mansect ${_man}) + INSTALL(FILES ${_man} DESTINATION "share/man/man${_mansect}") + ENDFOREACH (_man) +ENDMACRO (INSTALL_MAN __mans) +# +# Find out what macro is needed to use libraries on Windows. +# +MACRO (TRY_MACRO_FOR_LIBRARY INCLUDES LIBRARIES + TRY_TYPE SAMPLE_SOURCE MACRO_LIST) + IF(WIN32 AND NOT CYGWIN) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + SET(CMAKE_REQUIRED_INCLUDES ${INCLUDES}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBRARIES}) + FOREACH(VAR ${MACRO_LIST}) + # Clear ${VAR} from CACHE If the libraries which ${VAR} was + # checked with are changed. + SET(VAR_WITH_LIB "${VAR}_WITH_LIB") + GET_PROPERTY(PREV_VAR_WITH_LIB VARIABLE PROPERTY ${VAR_WITH_LIB}) + IF(NOT "${PREV_VAR_WITH_LIB}" STREQUAL "${LIBRARIES}") + UNSET(${VAR} CACHE) + ENDIF(NOT "${PREV_VAR_WITH_LIB}" STREQUAL "${LIBRARIES}") + # Check if the library can be used with the macro. + IF("${TRY_TYPE}" MATCHES "COMPILES") + LIBARCHIVE_CHECK_C_SOURCE_COMPILES("${SAMPLE_SOURCE}" ${VAR}) + ELSEIF("${TRY_TYPE}" MATCHES "RUNS") + LIBARCHIVE_CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR}) + ELSE("${TRY_TYPE}" MATCHES "COMPILES") + MESSAGE(FATAL_ERROR "UNKNOWN KEYWORD \"${TRY_TYPE}\" FOR TRY_TYPE") + ENDIF("${TRY_TYPE}" MATCHES "COMPILES") + # Save the libraries which ${VAR} is checked with. + SET(${VAR_WITH_LIB} "${LIBRARIES}" CACHE INTERNAL + "Macro ${VAR} is checked with") + ENDFOREACH(VAR) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + ENDIF(WIN32 AND NOT CYGWIN) +ENDMACRO (TRY_MACRO_FOR_LIBRARY) +# +# Check compress/decompress libraries +# +IF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN) + # GnuWin32 is only for Win32, not Win64. + SET(__GNUWIN32PATH "C:/Program Files/GnuWin32") +ENDIF(WIN32 AND NOT CMAKE_CL_64 AND NOT CYGWIN) +IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") + # You have to add a path availabel DLL file into PATH environment variable. + # Maybe DLL path is "C:/Program Files/GnuWin32/bin". + # The zlib and the bzip2 Setup program have installed programs and DLLs into + # "C:/Program Files/GnuWin32" by default. + # This is convenience setting for Windows. + SET(CMAKE_PREFIX_PATH ${__GNUWIN32PATH} $(CMAKE_PREFIX_PATH)) + # + # If you didn't use Setup program or installed into nonstandard path, + # cmake cannot find out your zlib or bzip2 libraries and include files, + # you should execute cmake with -DCMAKE_PREFIX_PATH option. + # e.g. + # cmake -DCMAKE_PREFIX_PATH= + # + # If compiling error occured in zconf.h, You may need patch to zconf.h. + #--- zconf.h.orig 2005-07-21 00:40:26.000000000 + #+++ zconf.h 2009-01-19 11:39:10.093750000 + #@@ -286,7 +286,7 @@ + # + # #if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */ + # # include /* for off_t */ + #-# include /* for SEEK_* and off_t */ + #+# include /* for SEEK_* and off_t */ + # # ifdef VMS + # # include /* for off_t */ + # # endif +ENDIF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") + +SET(ADDITIONAL_LIBS "") +# +# Find ZLIB +# +FIND_PACKAGE(ZLIB) +IF(ZLIB_FOUND) + SET(HAVE_LIBZ 1) + SET(HAVE_ZLIB_H 1) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) + IF(WIN32 AND NOT CYGWIN) + # + # Test if ZLIB_WINAPI macro is needed to use. + # + TRY_MACRO_FOR_LIBRARY( + "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" + RUNS + "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" + ZLIB_WINAPI) + IF(ZLIB_WINAPI) + ADD_DEFINITIONS(-DZLIB_WINAPI) + ELSE(ZLIB_WINAPI) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" + COMPILES + "#include \nint main() {return zlibVersion()?1:0; }" + "ZLIB_DLL;WITHOUT_ZLIB_DLL") + IF(ZLIB_DLL) + ADD_DEFINITIONS(-DZLIB_DLL) + ENDIF(ZLIB_DLL) + ENDIF(ZLIB_WINAPI) + ENDIF(WIN32 AND NOT CYGWIN) +ENDIF(ZLIB_FOUND) +MARK_AS_ADVANCED(CLEAR ZLIB_INCLUDE_DIR) +MARK_AS_ADVANCED(CLEAR ZLIB_LIBRARY) +# +# Find BZip2 +# +FIND_PACKAGE(BZip2) +IF(BZIP2_FOUND) + SET(HAVE_LIBBZ2 1) + SET(HAVE_BZLIB_H 1) + INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${BZIP2_LIBRARIES}) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${BZIP2_INCLUDE_DIR}" "${BZIP2_LIBRARIES}" + COMPILES + "#include \nint main() {return BZ2_bzlibVersion()?1:0; }" + "USE_BZIP2_DLL;USE_BZIP2_STATIC") + IF(USE_BZIP2_DLL) + ADD_DEFINITIONS(-DUSE_BZIP2_DLL) + ELSEIF(USE_BZIP2_STATIC) + ADD_DEFINITIONS(-DUSE_BZIP2_STATIC) + ENDIF(USE_BZIP2_DLL) +ENDIF(BZIP2_FOUND) +MARK_AS_ADVANCED(CLEAR BZIP2_INCLUDE_DIR) +MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARIES) +# +# Find LZMA +# +FIND_PACKAGE(LZMA) +IF(LZMA_FOUND) + SET(HAVE_LIBLZMA 1) + SET(HAVE_LZMA_H 1) + INCLUDE_DIRECTORIES(${LZMA_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${LZMA_LIBRARIES}) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${LZMA_INCLUDE_DIR}" "${LZMA_LIBRARIES}" + COMPILES + "#include \nint main() {return (int)lzma_version_number(); }" + "WITHOUT_LZMA_API_STATIC;LZMA_API_STATIC") + 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) +ELSEIF(LZMADEC_FOUND) + SET(HAVE_LIBLZMADEC 1) + SET(HAVE_LZMADEC_H 1) + INCLUDE_DIRECTORIES(${LZMADEC_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${LZMADEC_LIBRARIES}) +ENDIF(LZMA_FOUND) +# +# Find LZO2 +# +IF (LZO2_INCLUDE_DIR) + # Already in cache, be silent + SET(LZO2_FIND_QUIETLY TRUE) +ENDIF (LZO2_INCLUDE_DIR) + +FIND_PATH(LZO2_INCLUDE_DIR lzo/lzoconf.h) +FIND_LIBRARY(LZO2_LIBRARY NAMES lzo2 liblzo2) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZO2 DEFAULT_MSG LZO2_LIBRARY LZO2_INCLUDE_DIR) +IF(LZO2_FOUND) + SET(HAVE_LIBLZO2 1) + SET(HAVE_LZO_LZOCONF_H 1) + SET(HAVE_LZO_LZO1X_H 1) + INCLUDE_DIRECTORIES(${LZO2_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${LZO2_LIBRARY}) + # + # TODO: test for static library. + # +ENDIF(LZO2_FOUND) +MARK_AS_ADVANCED(CLEAR LZO2_INCLUDE_DIR) +MARK_AS_ADVANCED(CLEAR LZO2_LIBRARY) + +# +# Check headers +# +CHECK_HEADER_DIRENT() + +SET(INCLUDES "") +MACRO (LA_CHECK_INCLUDE_FILE header var) + CHECK_INCLUDE_FILES("${INCLUDES};${header}" ${var}) + IF (${var}) + SET(INCLUDES ${INCLUDES} ${header}) + ENDIF (${var}) +ENDMACRO (LA_CHECK_INCLUDE_FILE) + +# Some FreeBSD headers assume sys/types.h was already included. +LA_CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H) + +# Alphabetize the rest unless there's a compelling reason +LA_CHECK_INCLUDE_FILE("acl/libacl.h" HAVE_ACL_LIBACL_H) +LA_CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H) +LA_CHECK_INCLUDE_FILE("copyfile.h" HAVE_COPYFILE_H) +LA_CHECK_INCLUDE_FILE("direct.h" HAVE_DIRECT_H) +LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H) +LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H) +LA_CHECK_INCLUDE_FILE("ext2fs/ext2_fs.h" HAVE_EXT2FS_EXT2_FS_H) + +LIBARCHIVE_CHECK_C_SOURCE_COMPILES("#include +#include +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("grp.h" HAVE_GRP_H) +LA_CHECK_INCLUDE_FILE("inttypes.h" HAVE_INTTYPES_H) +LA_CHECK_INCLUDE_FILE("io.h" HAVE_IO_H) +LA_CHECK_INCLUDE_FILE("langinfo.h" HAVE_LANGINFO_H) +LA_CHECK_INCLUDE_FILE("limits.h" HAVE_LIMITS_H) +LA_CHECK_INCLUDE_FILE("linux/types.h" HAVE_LINUX_TYPES_H) +LA_CHECK_INCLUDE_FILE("linux/fiemap.h" HAVE_LINUX_FIEMAP_H) +LA_CHECK_INCLUDE_FILE("linux/fs.h" HAVE_LINUX_FS_H) +LA_CHECK_INCLUDE_FILE("linux/magic.h" HAVE_LINUX_MAGIC_H) +LA_CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H) +LA_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H) +LA_CHECK_INCLUDE_FILE("paths.h" HAVE_PATHS_H) +LA_CHECK_INCLUDE_FILE("poll.h" HAVE_POLL_H) +LA_CHECK_INCLUDE_FILE("process.h" HAVE_PROCESS_H) +LA_CHECK_INCLUDE_FILE("pwd.h" HAVE_PWD_H) +LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H) +LA_CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H) +LA_CHECK_INCLUDE_FILE("spawn.h" HAVE_SPAWN_H) +LA_CHECK_INCLUDE_FILE("stdarg.h" HAVE_STDARG_H) +LA_CHECK_INCLUDE_FILE("stdint.h" HAVE_STDINT_H) +LA_CHECK_INCLUDE_FILE("stdlib.h" HAVE_STDLIB_H) +LA_CHECK_INCLUDE_FILE("string.h" HAVE_STRING_H) +LA_CHECK_INCLUDE_FILE("strings.h" HAVE_STRINGS_H) +LA_CHECK_INCLUDE_FILE("sys/acl.h" HAVE_SYS_ACL_H) +LA_CHECK_INCLUDE_FILE("sys/cdefs.h" HAVE_SYS_CDEFS_H) +LA_CHECK_INCLUDE_FILE("sys/ioctl.h" HAVE_SYS_IOCTL_H) +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/select.h" HAVE_SYS_SELECT_H) +LA_CHECK_INCLUDE_FILE("sys/stat.h" HAVE_SYS_STAT_H) +LA_CHECK_INCLUDE_FILE("sys/statfs.h" HAVE_SYS_STATFS_H) +LA_CHECK_INCLUDE_FILE("sys/statvfs.h" HAVE_SYS_STATVFS_H) +LA_CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H) +LA_CHECK_INCLUDE_FILE("sys/utime.h" HAVE_SYS_UTIME_H) +LA_CHECK_INCLUDE_FILE("sys/utsname.h" HAVE_SYS_UTSNAME_H) +LA_CHECK_INCLUDE_FILE("sys/vfs.h" HAVE_SYS_VFS_H) +LA_CHECK_INCLUDE_FILE("sys/wait.h" HAVE_SYS_WAIT_H) +LA_CHECK_INCLUDE_FILE("time.h" HAVE_TIME_H) +LA_CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) +LA_CHECK_INCLUDE_FILE("utime.h" HAVE_UTIME_H) +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) +# Following files need windwos.h, so we should test it after windows.h test. +LA_CHECK_INCLUDE_FILE("wincrypt.h" HAVE_WINCRYPT_H) +LA_CHECK_INCLUDE_FILE("winioctl.h" HAVE_WINIOCTL_H) + +# +# Check whether use of __EXTENSIONS__ is safe. +# We need some macro such as _GNU_SOURCE to use extension functions. +# +SET(_INCLUDE_FILES) +FOREACH (it ${_HEADER}) + SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") +ENDFOREACH (it) + +LIBARCHIVE_CHECK_C_SOURCE_COMPILES( + "#define __EXTENSIONS__ 1 + ${_INCLUDE_FILES} + int main() { return 0;}" + SAFE_TO_DEFINE_EXTENSIONS) + +# +# Find Nettle +# +IF(ENABLE_NETTLE) + FIND_PACKAGE(Nettle) + IF(NETTLE_FOUND) + SET(HAVE_LIBNETTLE 1) + SET(HAVE_NETTLE_MD5_H 1) + SET(HAVE_NETTLE_RIPEMD160_H 1) + SET(HAVE_NETTLE_SHA_H 1) + INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES}) + ENDIF(NETTLE_FOUND) + MARK_AS_ADVANCED(CLEAR NETTLE_INCLUDE_DIR) + MARK_AS_ADVANCED(CLEAR NETTLE_LIBRARIES) +ENDIF(ENABLE_NETTLE) + +# +# Find OpenSSL +# (Except on Mac, where OpenSSL is deprecated.) +# +IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") + FIND_PACKAGE(OpenSSL) +ELSE() + SET(OPENSSL_FOUND FALSE) # Override cached value +ENDIF() + +# FreeBSD libmd +IF(NOT OPENSSL_FOUND) + CHECK_LIBRARY_EXISTS(md "MD5Init" "" LIBMD_FOUND) + IF(LIBMD_FOUND) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + SET(CMAKE_REQUIRED_LIBRARIES "md") + FIND_LIBRARY(LIBMD_LIBRARY NAMES md) + LIST(APPEND ADDITIONAL_LIBS ${LIBMD_LIBRARY}) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + ENDIF(LIBMD_FOUND) +ENDIF(NOT OPENSSL_FOUND) + +# +# How to prove that CRYPTO functions, which have several names on various +# platforms, just see if archive_crypto.c can compile and link against +# required libraries. +# +MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + FOREACH(ALGORITHM ${ALGORITHMS}) + IF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) + STRING(TOLOWER "${ALGORITHM}" lower_algorithm) + STRING(TOUPPER "${ALGORITHM}" algorithm) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) + SET(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} FALSE) + ELSEIF("${IMPLEMENTATION}" MATCHES "^NETTLE$" AND NOT NETTLE_FOUND) + SET(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} FALSE) + ENDIF("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND NOT OPENSSL_FOUND) + + IF(NOT DEFINED ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + # Probe the local implementation for whether this + # crypto implementation is available on this platform. + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive;${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp") + SET(TRY_CRYPTO_REQUIRED_LIBS) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "${TRY_CRYPTO_REQUIRED_INCLUDES};${OPENSSL_INCLUDE_DIR}") + SET(TRY_CRYPTO_REQUIRED_LIBS + "-DLINK_LIBRARIES:STRING=${OPENSSL_LIBRARIES}") + ELSEIF("${IMPLEMENTATION}" MATCHES "^NETTLE$" AND NETTLE_FOUND) + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "${TRY_CRYPTO_REQUIRED_INCLUDES};${NETTLE_INCLUDE_DIR}") + SET(TRY_CRYPTO_REQUIRED_LIBS + "-DLINK_LIBRARIES:STRING=${NETTLE_LIBRARY}") + ELSEIF("${IMPLEMENTATION}" MATCHES "^LIBMD$" AND LIBMD_FOUND) + SET(TRY_CRYPTO_REQUIRED_LIBS + "-DLINK_LIBRARIES:STRING=${LIBMD_LIBRARY}") + ENDIF("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h) + FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h" + CONFDEFS_H) + FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/libarchive/archive_crypto.c" + ARCHIVE_CRYPTO_C) + + SET(SOURCE "${CONFDEFS_H} + +#define ARCHIVE_${algorithm}_COMPILE_TEST +#define ARCHIVE_CRYPTO_${algorithm}_${IMPLEMENTATION} +#define PLATFORM_CONFIG_H \"check_crypto_md.h\" + +${ARCHIVE_CRYPTO_C} + +int +main(int argc, char **argv) +{ + archive_${lower_algorithm}_ctx ctx; + archive_${lower_algorithm}_init(&ctx); + archive_${lower_algorithm}_update(&ctx, *argv, argc); + archive_${lower_algorithm}_final(&ctx, NULL); + return 0; +} +") + + FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.h" "") + FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c" "${SOURCE}") + MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}") + + IF(CMAKE_REQUIRED_LINKER_FLAGS) + SET(CHECK_CRYPTO_ADD_LINKER_FLAGS + "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") + ELSE(CMAKE_REQUIRED_LINKER_FLAGS) + SET(CHECK_CRYPTO_ADD_LINKER_FLAGS) + ENDIF(CMAKE_REQUIRED_LINKER_FLAGS) + TRY_COMPILE(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c + CMAKE_FLAGS ${CHECK_CRYPTO_ADD_LINKER_FLAGS} + "${TRY_CRYPTO_REQUIRED_LIBS}" + "${TRY_CRYPTO_REQUIRED_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + + # Inform user whether or not we found it; if not, log why we didn't. + IF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} -- found") + SET(ARCHIVE_CRYPTO_${ALGORITHM} 1) + ELSE (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} -- not found") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} failed with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + ENDIF(NOT DEFINED ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + + # Add appropriate libs/includes depending on whether the implementation + # was found on this platform. + IF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_LIBRARIES}) + LIST(REMOVE_DUPLICATES ADDITIONAL_LIBS) + ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) + ENDFOREACH(ALGORITHM ${ALGORITHMS}) +ENDMACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + +# +# CRYPTO functions on Windows is defined at archive_windows.c, thus we do not +# need the test what the functions can be mapped to archive_{crypto name}_init, +# archive_{crypto name}_update and archive_{crypto name}_final. +# The functions on Windows use CALG_{crypto name} macro to create a crypt object +# and then we need to know what CALG_{crypto name} macros is available to show +# ARCHIVE_CRYPTO_{crypto name}_WIN macros because Windows 2000 and earlier version +# of Windows XP do not support SHA256, SHA384 and SHA512. +# +MACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) + IF(WIN32 AND NOT CYGWIN) + FOREACH(CRYPTO ${CRYPTO_LIST}) + IF(NOT ARCHIVE_CRYPTO_${CRYPTO}) + IF(NOT DEFINED ARCHIVE_CRYPTO_${CRYPTO}_WIN) + STRING(TOUPPER "${CRYPTO}" crypto) + SET(ALGID "") + IF ("${CRYPTO}" MATCHES "^MD5$") + SET(ALGID "CALG_MD5") + ENDIF ("${CRYPTO}" MATCHES "^MD5$") + IF ("${CRYPTO}" MATCHES "^SHA1$") + SET(ALGID "CALG_SHA1") + ENDIF ("${CRYPTO}" MATCHES "^SHA1$") + IF ("${CRYPTO}" MATCHES "^SHA256$") + SET(ALGID "CALG_SHA_256") + ENDIF ("${CRYPTO}" MATCHES "^SHA256$") + IF ("${CRYPTO}" MATCHES "^SHA384$") + SET(ALGID "CALG_SHA_384") + ENDIF ("${CRYPTO}" MATCHES "^SHA384$") + IF ("${CRYPTO}" MATCHES "^SHA512$") + SET(ALGID "CALG_SHA_512") + ENDIF ("${CRYPTO}" MATCHES "^SHA512$") + + CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h) + FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h" + CONFDEFS_H) + + SET(SOURCE "${CONFDEFS_H} + +#define ${crypto}_COMPILE_TEST +#include +#include + +int +main(int argc, char **argv) +{ + return ${ALGID}; +} +") + SET(SOURCE_FILE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_win.c") + + FILE(WRITE "${SOURCE_FILE}" "${SOURCE}") + MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN") + + IF(CMAKE_REQUIRED_LINKER_FLAGS) + SET(CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS + "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") + ELSE(CMAKE_REQUIRED_LINKER_FLAGS) + SET(CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS) + ENDIF(CMAKE_REQUIRED_LINKER_FLAGS) + TRY_COMPILE(ARCHIVE_CRYPTO_${CRYPTO}_WIN + ${CMAKE_BINARY_DIR} + ${SOURCE_FILE} + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive" ${CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS} + OUTPUT_VARIABLE OUTPUT) + + IF (ARCHIVE_CRYPTO_${CRYPTO}_WIN) + MESSAGE(STATUS + "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN -- found") + SET(ARCHIVE_CRYPTO_${CRYPTO} 1) + ELSE (ARCHIVE_CRYPTO_${CRYPTO}_WIN) + MESSAGE(STATUS + "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN -- not found") + FILE(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN failed with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + ENDIF (ARCHIVE_CRYPTO_${CRYPTO}_WIN) + + ENDIF(NOT DEFINED ARCHIVE_CRYPTO_${CRYPTO}_WIN) + ENDIF(NOT ARCHIVE_CRYPTO_${CRYPTO}) + ENDFOREACH(CRYPTO) + ENDIF(WIN32 AND NOT CYGWIN) +ENDMACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) + +# +# Find iconv +# POSIX defines the second arg as const char ** +# and requires it to be in libc. But we can accept +# a non-const argument here and can support iconv() +# being in libiconv. +# +MACRO(CHECK_ICONV LIB TRY_ICONV_CONST) + IF(NOT HAVE_ICONV) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + # + # During checking iconv proto type, we should use -Werror to avoid the + # success of iconv detection with a warnig which success is a miss + # detection. So this needs for all build mode(even it's a release mode). + # + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") + ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + IF (MSVC) + # NOTE: /WX option is the same as gcc's -Werror option. + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /WX") + ENDIF (MSVC) + # + LIBARCHIVE_CHECK_C_SOURCE_COMPILES( + "#include + #include + int main() { + ${TRY_ICONV_CONST} char *ccp; + iconv_t cd = iconv_open(\"\", \"\"); + iconv(cd, &ccp, (size_t *)0, (char **)0, (size_t *)0); + iconv_close(cd); + return 0; + }" + HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) + IF(HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) + SET(HAVE_ICONV true) + SET(ICONV_CONST ${TRY_ICONV_CONST}) + ENDIF(HAVE_ICONV_${LIB}_${TRY_ICONV_CONST}) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + ENDIF(NOT HAVE_ICONV) +ENDMACRO(CHECK_ICONV TRY_ICONV_CONST) + +IF(ENABLE_ICONV) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + FIND_PATH(ICONV_INCLUDE_DIR iconv.h) + IF(ICONV_INCLUDE_DIR) + #SET(INCLUDES ${INCLUDES} "iconv.h") + SET(HAVE_ICONV_H 1) + INCLUDE_DIRECTORIES(${ICONV_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) + CHECK_ICONV("libc" "const") + CHECK_ICONV("libc" "") + + # If iconv isn't in libc and we have a libiconv, try that. + FIND_LIBRARY(LIBICONV_PATH NAMES iconv libiconv) + IF(NOT HAVE_ICONV AND LIBICONV_PATH) + LIST(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBICONV_PATH}) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${ICONV_INCLUDE_DIR}" "${LIBICONV_PATH}" + COMPILES + "#include \nint main() {return iconv_close((iconv_t)0);}" + "WITHOUT_LIBICONV_STATIC;LIBICONV_STATIC") + IF(NOT WITHOUT_LIBICONV_STATIC AND LIBICONV_STATIC) + ADD_DEFINITIONS(-DLIBICONV_STATIC) + ENDIF(NOT WITHOUT_LIBICONV_STATIC AND LIBICONV_STATIC) + # + # Set up CMAKE_REQUIRED_* for CHECK_ICONV + # + SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBICONV_PATH}) + IF(LIBICONV_STATIC) + # LIBICONV_STATIC is necessary for the success of CHECK_ICONV + # on Windows. + SET(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC") + ELSE(LIBICONV_STATIC) + SET(CMAKE_REQUIRED_DEFINITIONS) + ENDIF(LIBICONV_STATIC) + CHECK_ICONV("libiconv" "const") + CHECK_ICONV("libiconv" "") + IF (HAVE_ICONV) + LIST(APPEND ADDITIONAL_LIBS ${LIBICONV_PATH}) + ENDIF(HAVE_ICONV) + ENDIF(NOT HAVE_ICONV AND LIBICONV_PATH) + ENDIF(ICONV_INCLUDE_DIR) + # + # Find locale_charset() for libiconv. + # + IF(LIBICONV_PATH) + SET(CMAKE_REQUIRED_DEFINITIONS) + SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_LIBRARIES) + CHECK_INCLUDE_FILES("localcharset.h" HAVE_LOCALCHARSET_H) + FIND_LIBRARY(LIBCHARSET_PATH NAMES charset libcharset) + IF(LIBCHARSET_PATH) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBCHARSET_PATH}) + IF(WIN32 AND NOT CYGWIN) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${ICONV_INCLUDE_DIR}" "${LIBCHARSET_PATH}" + COMPILES + "#include \nint main() {return locale_charset()?1:0;}" + "WITHOUT_LIBCHARSET_STATIC;LIBCHARSET_STATIC") + IF(NOT WITHOUT_LIBCHARSET_STATIC AND LIBCHARSET_STATIC) + ADD_DEFINITIONS(-DLIBCHARSET_STATIC) + ENDIF(NOT WITHOUT_LIBCHARSET_STATIC AND LIBCHARSET_STATIC) + IF(WITHOUT_LIBCHARSET_STATIC OR LIBCHARSET_STATIC) + SET(HAVE_LOCALE_CHARSET ON CACHE INTERNAL + "Have function locale_charset") + ENDIF(WITHOUT_LIBCHARSET_STATIC OR LIBCHARSET_STATIC) + ELSE(WIN32 AND NOT CYGWIN) + CHECK_FUNCTION_EXISTS_GLIBC(locale_charset HAVE_LOCALE_CHARSET) + ENDIF(WIN32 AND NOT CYGWIN) + IF(HAVE_LOCALE_CHARSET) + LIST(APPEND ADDITIONAL_LIBS ${LIBCHARSET_PATH}) + ENDIF(HAVE_LOCALE_CHARSET) + ENDIF(LIBCHARSET_PATH) + ENDIF(LIBICONV_PATH) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables +ELSE(ENABLE_ICONV) + # Make sure ICONV variables are not in CACHE after ENABLE_ICONV disabled + # (once enabled). + UNSET(HAVE_LOCALE_CHARSET CACHE) + UNSET(HAVE_ICONV CACHE) + UNSET(HAVE_ICONV_libc_ CACHE) + UNSET(HAVE_ICONV_libc_const CACHE) + UNSET(HAVE_ICONV_libiconv_ CACHE) + UNSET(HAVE_ICONV_libiconv_const CACHE) + UNSET(ICONV_INCLUDE_DIR CACHE) + UNSET(LIBICONV_PATH CACHE) + UNSET(LIBICONV_DLL CACHE) + UNSET(LIBICONV_STATIC CACHE) + UNSET(LIBCHARSET_DLL CACHE) + UNSET(LIBCHARSET_STATIC CACHE) +ENDIF(ENABLE_ICONV) + +# +# Find Libxml2 +# +FIND_PACKAGE(LibXml2) +IF(LIBXML2_FOUND) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${LIBXML2_LIBRARIES}) + SET(HAVE_LIBXML2 1) + # libxml2's include files use iconv.h + SET(CMAKE_REQUIRED_INCLUDES ${ICONV_INCLUDE_DIR} ${LIBXML2_INCLUDE_DIR}) + CHECK_INCLUDE_FILES("libxml/xmlreader.h" HAVE_LIBXML_XMLREADER_H) + CHECK_INCLUDE_FILES("libxml/xmlwriter.h" HAVE_LIBXML_XMLWRITER_H) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${ICONV_INCLUDE_DIR};${LIBXML2_INCLUDE_DIR}" + "ws2_32.lib;${ZLIB_LIBRARIES};${LIBICONV_PATH};${LIBXML2_LIBRARIES}" + COMPILES + "#include \n#include \nint main() {return xmlTextReaderRead((xmlTextReaderPtr)(void *)0);}" + "WITHOUT_LIBXML_STATIC;LIBXML_STATIC") + IF(NOT WITHOUT_LIBXML_STATIC AND LIBXML_STATIC) + ADD_DEFINITIONS(-DLIBXML_STATIC) + ENDIF(NOT WITHOUT_LIBXML_STATIC AND LIBXML_STATIC) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables +ELSE(LIBXML2_FOUND) + # + # Find Expat + # + FIND_PACKAGE(EXPAT) + IF(EXPAT_FOUND) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${EXPAT_LIBRARIES}) + SET(HAVE_LIBEXPAT 1) + LA_CHECK_INCLUDE_FILE("expat.h" HAVE_EXPAT_H) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + ENDIF(EXPAT_FOUND) +ENDIF(LIBXML2_FOUND) +MARK_AS_ADVANCED(CLEAR LIBXML2_INCLUDE_DIR) +MARK_AS_ADVANCED(CLEAR LIBXML2_LIBRARIES) + +# +# POSIX Regular Expression support +# +IF(POSIX_REGEX_LIB MATCHES "^(AUTO|LIBC|LIBREGEX)$") + # + # If PCREPOSIX is not found or not requested, try using regex + # from libc or libregex + # + FIND_PATH(REGEX_INCLUDE_DIR regex.h) + IF(REGEX_INCLUDE_DIR) + CHECK_FUNCTION_EXISTS_GLIBC(regcomp HAVE_REGCOMP_LIBC) + # + # If libc does not provide regex, find libregex. + # + IF(NOT HAVE_REGCOMP_LIBC) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + FIND_LIBRARY(REGEX_LIBRARY regex) + IF(REGEX_LIBRARY) + SET(CMAKE_REQUIRED_LIBRARIES ${REGEX_LIBRARY}) + CHECK_FUNCTION_EXISTS_GLIBC(regcomp HAVE_REGCOMP_LIBREGEX) + IF(HAVE_REGCOMP_LIBREGEX) + LIST(APPEND ADDITIONAL_LIBS ${REGEX_LIBRARY}) + # + # If regex.h is not found, retry looking for regex.h at + # REGEX_INCLUDE_DIR + # + IF(NOT HAVE_REGEX_H) + UNSET(HAVE_REGEX_H CACHE) + INCLUDE_DIRECTORIES(${REGEX_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_INCLUDES ${REGEX_INCLUDE_DIR}) + LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H) + ENDIF(NOT HAVE_REGEX_H) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${REGEX_INCLUDE_DIR}" "${REGEX_LIBRARY}" + COMPILES + "#include \n#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" + "USE_REGEX_DLL;USE_REGEX_STATIC") + IF(USE_REGEX_DLL) + ADD_DEFINITIONS(-DUSE_REGEX_DLL) + ELSEIF(USE_REGEX_STATIC) + ADD_DEFINITIONS(-DUSE_REGEX_STATIC) + ENDIF(USE_REGEX_DLL) + ENDIF(HAVE_REGCOMP_LIBREGEX) + ENDIF(REGEX_LIBRARY) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + ENDIF(NOT HAVE_REGCOMP_LIBC) + ENDIF(REGEX_INCLUDE_DIR) + IF(HAVE_REGCOMP_LIBC OR HAVE_REGCOMP_LIBREGEX) + SET(FOUND_POSIX_REGEX_LIB 1) + ENDIF(HAVE_REGCOMP_LIBC OR HAVE_REGCOMP_LIBREGEX) +ENDIF(POSIX_REGEX_LIB MATCHES "^(AUTO|LIBC|LIBREGEX)$") + +IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$") + # + # If requested, try finding library for PCREPOSIX + # + FIND_PACKAGE(LibGCC) + FIND_PACKAGE(PCREPOSIX) + IF(PCREPOSIX_FOUND) + INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${PCREPOSIX_LIBRARIES}) + # Test if a macro is needed for the library. + TRY_MACRO_FOR_LIBRARY( + "${PCRE_INCLUDE_DIR}" "${PCREPOSIX_LIBRARIES}" + COMPILES + "#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" + "WITHOUT_PCRE_STATIC;PCRE_STATIC") + IF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) + ADD_DEFINITIONS(-DPCRE_STATIC) + ELSEIF(NOT WITHOUT_PCRE_STATIC AND NOT PCRE_STATIC AND PCRE_FOUND) + # Determine if pcre static libraries are to be used. + LIST(APPEND ADDITIONAL_LIBS ${PCRE_LIBRARIES}) + SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES}) + MESSAGE(STATUS "trying again with -lpcre included") + TRY_MACRO_FOR_LIBRARY( + "${PCRE_INCLUDE_DIR}" "${TMP_LIBRARIES}" + COMPILES + "#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" + "WITHOUT_PCRE_STATIC;PCRE_STATIC") + IF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) + ADD_DEFINITIONS(-DPCRE_STATIC) + ELSEIF(NOT WITHOUT_PCRE_STATIC AND NOT PCRE_STATIC AND MSVC AND LIBGCC_FOUND) + # When doing a Visual Studio build using pcre static libraries + # built using the mingw toolchain, -lgcc is needed to resolve + # ___chkstk_ms. + MESSAGE(STATUS "Visual Studio build detected, trying again with -lgcc included") + LIST(APPEND ADDITIONAL_LIBS ${LIBGCC_LIBRARIES}) + SET(TMP_LIBRARIES ${PCREPOSIX_LIBRARIES} ${PCRE_LIBRARIES} ${LIBGCC_LIBRARIES}) + TRY_MACRO_FOR_LIBRARY( + "${PCRE_INCLUDE_DIR}" "${TMP_LIBRARIES}" + COMPILES + "#include \nint main() {regex_t r;return regcomp(&r, \"\", 0);}" + "WITHOUT_PCRE_STATIC;PCRE_STATIC") + IF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) + ADD_DEFINITIONS(-DPCRE_STATIC) + ENDIF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) + ENDIF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) + ENDIF(NOT WITHOUT_PCRE_STATIC AND PCRE_STATIC) + ENDIF(PCREPOSIX_FOUND) + MARK_AS_ADVANCED(CLEAR PCRE_INCLUDE_DIR) + MARK_AS_ADVANCED(CLEAR PCREPOSIX_LIBRARIES) + MARK_AS_ADVANCED(CLEAR PCRE_LIBRARIES) + MARK_AS_ADVANCED(CLEAR LIBGCC_LIBRARIES) +ENDIF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$") + +# +# Check functions +# +CMAKE_PUSH_CHECK_STATE() # Save the state of the variables +IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + # + # During checking functions, we should use -fno-builtin to avoid the + # failure of function detection which failure is an error "conflicting + # types for built-in function" caused by using -Werror option. + # + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-builtin") +ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") +CHECK_SYMBOL_EXISTS(_CrtSetReportMode "crtdbg.h" HAVE__CrtSetReportMode) +CHECK_FUNCTION_EXISTS_GLIBC(chflags HAVE_CHFLAGS) +CHECK_FUNCTION_EXISTS_GLIBC(chown HAVE_CHOWN) +CHECK_FUNCTION_EXISTS_GLIBC(chroot HAVE_CHROOT) +CHECK_FUNCTION_EXISTS_GLIBC(ctime_r HAVE_CTIME_R) +CHECK_FUNCTION_EXISTS_GLIBC(dirfd HAVE_DIRFD) +CHECK_FUNCTION_EXISTS_GLIBC(fchdir HAVE_FCHDIR) +CHECK_FUNCTION_EXISTS_GLIBC(fchflags HAVE_FCHFLAGS) +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(fork HAVE_FORK) +CHECK_FUNCTION_EXISTS_GLIBC(fstat HAVE_FSTAT) +CHECK_FUNCTION_EXISTS_GLIBC(fstatat HAVE_FSTATAT) +CHECK_FUNCTION_EXISTS_GLIBC(fstatfs HAVE_FSTATFS) +CHECK_FUNCTION_EXISTS_GLIBC(fstatvfs HAVE_FSTATVFS) +CHECK_FUNCTION_EXISTS_GLIBC(ftruncate HAVE_FTRUNCATE) +CHECK_FUNCTION_EXISTS_GLIBC(futimens HAVE_FUTIMENS) +CHECK_FUNCTION_EXISTS_GLIBC(futimes HAVE_FUTIMES) +CHECK_FUNCTION_EXISTS_GLIBC(futimesat HAVE_FUTIMESAT) +CHECK_FUNCTION_EXISTS_GLIBC(geteuid HAVE_GETEUID) +CHECK_FUNCTION_EXISTS_GLIBC(getgrgid_r HAVE_GETGRGID_R) +CHECK_FUNCTION_EXISTS_GLIBC(getgrnam_r HAVE_GETGRNAM_R) +CHECK_FUNCTION_EXISTS_GLIBC(getpwnam_r HAVE_GETPWNAM_R) +CHECK_FUNCTION_EXISTS_GLIBC(getpwuid_r HAVE_GETPWUID_R) +CHECK_FUNCTION_EXISTS_GLIBC(getpid HAVE_GETPID) +CHECK_FUNCTION_EXISTS_GLIBC(getvfsbyname HAVE_GETVFSBYNAME) +CHECK_FUNCTION_EXISTS_GLIBC(gmtime_r HAVE_GMTIME_R) +CHECK_FUNCTION_EXISTS_GLIBC(lchflags HAVE_LCHFLAGS) +CHECK_FUNCTION_EXISTS_GLIBC(lchmod HAVE_LCHMOD) +CHECK_FUNCTION_EXISTS_GLIBC(lchown HAVE_LCHOWN) +CHECK_FUNCTION_EXISTS_GLIBC(link HAVE_LINK) +CHECK_FUNCTION_EXISTS_GLIBC(localtime_r HAVE_LOCALTIME_R) +CHECK_FUNCTION_EXISTS_GLIBC(lstat HAVE_LSTAT) +CHECK_FUNCTION_EXISTS_GLIBC(lutimes HAVE_LUTIMES) +CHECK_FUNCTION_EXISTS_GLIBC(mbrtowc HAVE_MBRTOWC) +CHECK_FUNCTION_EXISTS_GLIBC(memmove HAVE_MEMMOVE) +CHECK_FUNCTION_EXISTS_GLIBC(mkdir HAVE_MKDIR) +CHECK_FUNCTION_EXISTS_GLIBC(mkfifo HAVE_MKFIFO) +CHECK_FUNCTION_EXISTS_GLIBC(mknod HAVE_MKNOD) +CHECK_FUNCTION_EXISTS_GLIBC(mkstemp HAVE_MKSTEMP) +CHECK_FUNCTION_EXISTS_GLIBC(nl_langinfo HAVE_NL_LANGINFO) +CHECK_FUNCTION_EXISTS_GLIBC(openat HAVE_OPENAT) +CHECK_FUNCTION_EXISTS_GLIBC(pipe HAVE_PIPE) +CHECK_FUNCTION_EXISTS_GLIBC(poll HAVE_POLL) +CHECK_FUNCTION_EXISTS_GLIBC(posix_spawnp HAVE_POSIX_SPAWNP) +CHECK_FUNCTION_EXISTS_GLIBC(readlink HAVE_READLINK) +CHECK_FUNCTION_EXISTS_GLIBC(select HAVE_SELECT) +CHECK_FUNCTION_EXISTS_GLIBC(setenv HAVE_SETENV) +CHECK_FUNCTION_EXISTS_GLIBC(setlocale HAVE_SETLOCALE) +CHECK_FUNCTION_EXISTS_GLIBC(sigaction HAVE_SIGACTION) +CHECK_FUNCTION_EXISTS_GLIBC(statfs HAVE_STATFS) +CHECK_FUNCTION_EXISTS_GLIBC(statvfs HAVE_STATVFS) +CHECK_FUNCTION_EXISTS_GLIBC(strchr HAVE_STRCHR) +CHECK_FUNCTION_EXISTS_GLIBC(strdup HAVE_STRDUP) +CHECK_FUNCTION_EXISTS_GLIBC(strerror HAVE_STRERROR) +CHECK_FUNCTION_EXISTS_GLIBC(strncpy_s HAVE_STRNCPY_S) +CHECK_FUNCTION_EXISTS_GLIBC(strrchr HAVE_STRRCHR) +CHECK_FUNCTION_EXISTS_GLIBC(symlink HAVE_SYMLINK) +CHECK_FUNCTION_EXISTS_GLIBC(timegm HAVE_TIMEGM) +CHECK_FUNCTION_EXISTS_GLIBC(tzset HAVE_TZSET) +CHECK_FUNCTION_EXISTS_GLIBC(unsetenv HAVE_UNSETENV) +CHECK_FUNCTION_EXISTS_GLIBC(utime HAVE_UTIME) +CHECK_FUNCTION_EXISTS_GLIBC(utimes HAVE_UTIMES) +CHECK_FUNCTION_EXISTS_GLIBC(utimensat HAVE_UTIMENSAT) +CHECK_FUNCTION_EXISTS_GLIBC(vfork HAVE_VFORK) +CHECK_FUNCTION_EXISTS_GLIBC(wcrtomb HAVE_WCRTOMB) +CHECK_FUNCTION_EXISTS_GLIBC(wcscmp HAVE_WCSCMP) +CHECK_FUNCTION_EXISTS_GLIBC(wcscpy HAVE_WCSCPY) +CHECK_FUNCTION_EXISTS_GLIBC(wcslen HAVE_WCSLEN) +CHECK_FUNCTION_EXISTS_GLIBC(wctomb HAVE_WCTOMB) +CHECK_FUNCTION_EXISTS_GLIBC(_ctime64_s HAVE__CTIME64_S) +CHECK_FUNCTION_EXISTS_GLIBC(_fseeki64 HAVE__FSEEKI64) +CHECK_FUNCTION_EXISTS_GLIBC(_get_timezone HAVE__GET_TIMEZONE) +CHECK_FUNCTION_EXISTS_GLIBC(_localtime64_s HAVE__LOCALTIME64_S) +CHECK_FUNCTION_EXISTS_GLIBC(_mkgmtime64 HAVE__MKGMTIME64) + +SET(CMAKE_REQUIRED_LIBRARIES "") +CHECK_FUNCTION_EXISTS(cygwin_conv_path HAVE_CYGWIN_CONV_PATH) +CHECK_FUNCTION_EXISTS(fseeko HAVE_FSEEKO) +CHECK_FUNCTION_EXISTS(strerror_r HAVE_STRERROR_R) +CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) +CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) +CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) +CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) + +CMAKE_POP_CHECK_STATE() # Restore the state of the variables + +# Make sure we have the POSIX version of readdir_r, not the +# older 2-argument version. +LIBARCHIVE_CHECK_C_SOURCE_COMPILES( + "#include \nint main() {DIR *d = opendir(\".\"); struct dirent e,*r; return readdir_r(d,&e,&r);}" + HAVE_READDIR_R) + + +# Only detect readlinkat() if we also have AT_FDCWD in unistd.h. +# NOTE: linux requires fcntl.h for AT_FDCWD. +LIBARCHIVE_CHECK_C_SOURCE_COMPILES( + "#include \n#include \nint main() {char buf[10]; return readlinkat(AT_FDCWD, \"\", buf, 0);}" + HAVE_READLINKAT) + + +# To verify major(), we need to both include the header +# of interest and verify that the result can be linked. +# CHECK_FUNCTION_EXISTS doesn't accept a header argument, +# CHECK_SYMBOL_EXISTS doesn't test linkage. +LIBARCHIVE_CHECK_C_SOURCE_COMPILES( + "#include \nint main() { return major(256); }" + MAJOR_IN_MKDEV) +LIBARCHIVE_CHECK_C_SOURCE_COMPILES( + "#include \nint main() { return major(256); }" + MAJOR_IN_SYSMACROS) + +IF(HAVE_STRERROR_R) + SET(HAVE_DECL_STRERROR_R 1) +ENDIF(HAVE_STRERROR_R) + +# +# Check defines +# +SET(headers "limits.h") +IF(HAVE_STDINT_H) + LIST(APPEND headers "stdint.h") +ENDIF(HAVE_STDINT_H) +IF(HAVE_INTTYPES_H) + LIST(APPEND headers "inttypes.h") +ENDIF(HAVE_INTTYPES_H) +CHECK_SYMBOL_EXISTS(EFTYPE "errno.h" HAVE_EFTYPE) +CHECK_SYMBOL_EXISTS(EILSEQ "errno.h" HAVE_EILSEQ) +CHECK_SYMBOL_EXISTS(D_MD_ORDER "langinfo.h" HAVE_D_MD_ORDER) +CHECK_SYMBOL_EXISTS(INT64_MAX "${headers}" HAVE_DECL_INT64_MAX) +CHECK_SYMBOL_EXISTS(INT64_MIN "${headers}" HAVE_DECL_INT64_MIN) +CHECK_SYMBOL_EXISTS(UINT32_MAX "${headers}" HAVE_DECL_UINT32_MAX) +CHECK_SYMBOL_EXISTS(UINT64_MAX "${headers}" HAVE_DECL_UINT64_MAX) +CHECK_SYMBOL_EXISTS(SIZE_MAX "${headers}" HAVE_DECL_SIZE_MAX) +CHECK_SYMBOL_EXISTS(SSIZE_MAX "limits.h" HAVE_DECL_SSIZE_MAX) + +# +# Check struct members +# +# Check for tm_gmtoff in struct tm +CHECK_STRUCT_MEMBER("struct tm" tm_gmtoff + "time.h" HAVE_STRUCT_TM_TM_GMTOFF) +CHECK_STRUCT_MEMBER("struct tm" __tm_gmtoff + "time.h" HAVE_STRUCT_TM___TM_GMTOFF) + +# Check for f_namemax in struct statfs +CHECK_STRUCT_MEMBER("struct statfs" f_namemax + "sys/param.h;sys/mount.h" HAVE_STRUCT_STATFS_F_NAMEMAX) + +# Check for birthtime in struct stat +CHECK_STRUCT_MEMBER("struct stat" st_birthtime + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIME) + +# Check for high-resolution timestamps in struct stat +CHECK_STRUCT_MEMBER("struct stat" st_birthtimespec.tv_nsec + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC) +CHECK_STRUCT_MEMBER("struct stat" st_mtimespec.tv_nsec + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC) +CHECK_STRUCT_MEMBER("struct stat" st_mtim.tv_nsec + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC) +CHECK_STRUCT_MEMBER("struct stat" st_mtime_n + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_N) +CHECK_STRUCT_MEMBER("struct stat" st_umtime + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_UMTIME) +CHECK_STRUCT_MEMBER("struct stat" st_mtime_usec + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIME_USEC) +# Check for block size support in struct stat +CHECK_STRUCT_MEMBER("struct stat" st_blksize + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_BLKSIZE) +# Check for st_flags in struct stat (BSD fflags) +CHECK_STRUCT_MEMBER("struct stat" st_flags + "sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_FLAGS) + +IF(HAVE_SYS_STATVFS_H) + CHECK_STRUCT_MEMBER("struct statvfs" f_iosize + "sys/types.h;sys/statvfs.h" HAVE_STRUCT_STATVFS_F_IOSIZE) +ENDIF() + +# +# +CHECK_STRUCT_MEMBER("struct tm" tm_sec + "sys/types.h;sys/time.h;time.h" TIME_WITH_SYS_TIME) + +# +# Check for integer types +# +# +CHECK_TYPE_SIZE("short" SIZE_OF_SHORT) +CHECK_TYPE_SIZE("int" SIZE_OF_INT) +CHECK_TYPE_SIZE("long" SIZE_OF_LONG) +CHECK_TYPE_SIZE("long long" SIZE_OF_LONG_LONG) + +CHECK_TYPE_SIZE("unsigned short" SIZE_OF_UNSIGNED_SHORT) +CHECK_TYPE_SIZE("unsigned" SIZE_OF_UNSIGNED) +CHECK_TYPE_SIZE("unsigned long" SIZE_OF_UNSIGNED_LONG) +CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG) + +CHECK_TYPE_SIZE("__int64" __INT64) +CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64) + +CHECK_TYPE_SIZE(int16_t INT16_T) +CHECK_TYPE_SIZE(int32_t INT32_T) +CHECK_TYPE_SIZE(int64_t INT64_T) +CHECK_TYPE_SIZE(intmax_t INTMAX_T) +CHECK_TYPE_SIZE(uint8_t UINT8_T) +CHECK_TYPE_SIZE(uint16_t UINT16_T) +CHECK_TYPE_SIZE(uint32_t UINT32_T) +CHECK_TYPE_SIZE(uint64_t UINT64_T) +CHECK_TYPE_SIZE(uintmax_t UINTMAX_T) + +CHECK_TYPE_SIZE(dev_t DEV_T) +IF(NOT HAVE_DEV_T) + IF(MSVC) + SET(dev_t "unsigned int") + ENDIF(MSVC) +ENDIF(NOT HAVE_DEV_T) +# +CHECK_TYPE_SIZE(gid_t GID_T) +IF(NOT HAVE_GID_T) + IF(WIN32) + SET(gid_t "short") + ELSE(WIN32) + SET(gid_t "unsigned int") + ENDIF(WIN32) +ENDIF(NOT HAVE_GID_T) +# +CHECK_TYPE_SIZE(id_t ID_T) +IF(NOT HAVE_ID_T) + IF(WIN32) + SET(id_t "short") + ELSE(WIN32) + SET(id_t "unsigned int") + ENDIF(WIN32) +ENDIF(NOT HAVE_ID_T) +# +CHECK_TYPE_SIZE(mode_t MODE_T) +IF(NOT HAVE_MODE_T) + IF(WIN32) + SET(mode_t "unsigned short") + ELSE(WIN32) + SET(mode_t "int") + ENDIF(WIN32) +ENDIF(NOT HAVE_MODE_T) +# +CHECK_TYPE_SIZE(off_t OFF_T) +IF(NOT HAVE_OFF_T) + SET(off_t "__int64") +ENDIF(NOT HAVE_OFF_T) +# +CHECK_TYPE_SIZE(size_t SIZE_T) +IF(NOT HAVE_SIZE_T) + IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + SET(size_t "uint64_t") + ELSE("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + SET(size_t "uint32_t") + ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) +ENDIF(NOT HAVE_SIZE_T) +# +CHECK_TYPE_SIZE(ssize_t SSIZE_T) +IF(NOT HAVE_SSIZE_T) + IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + SET(ssize_t "int64_t") + ELSE("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + SET(ssize_t "long") + ENDIF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) +ENDIF(NOT HAVE_SSIZE_T) +# +CHECK_TYPE_SIZE(uid_t UID_T) +IF(NOT HAVE_UID_T) + IF(WIN32) + SET(uid_t "short") + ELSE(WIN32) + SET(uid_t "unsigned int") + ENDIF(WIN32) +ENDIF(NOT HAVE_UID_T) +# +CHECK_TYPE_SIZE(pid_t PID_T) +IF(NOT HAVE_PID_T) + IF(WIN32) + SET(pid_t "int") + ELSE(WIN32) + MESSAGE(FATAL_ERROR "pid_t doesn't exist on this platform?") + ENDIF(WIN32) +ENDIF(NOT HAVE_PID_T) +# +CHECK_TYPE_SIZE(intptr_t INTPTR_T) +IF(NOT HAVE_INTPTR_T) + IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + SET(intptr_t "int64_t") + ELSE() + SET(intptr_t "int32_t") + ENDIF() +ENDIF(NOT HAVE_INTPTR_T) +# +CHECK_TYPE_SIZE(uintptr_t UINTPTR_T) +IF(NOT HAVE_UINTPTR_T) + IF("${CMAKE_SIZEOF_VOID_P}" EQUAL 8) + SET(uintptr_t "uint64_t") + ELSE() + SET(uintptr_t "uint32_t") + ENDIF() +ENDIF(NOT HAVE_UINTPTR_T) +# +CHECK_TYPE_SIZE(wchar_t SIZEOF_WCHAR_T) +IF(HAVE_SIZEOF_WCHAR_T) + SET(HAVE_WCHAR_T 1) +ENDIF(HAVE_SIZEOF_WCHAR_T) +# +# Check if _FILE_OFFSET_BITS macro needed for large files +# +CHECK_FILE_OFFSET_BITS() + +# +# Check for Extended Attribute libraries, headers, and functions +# +IF(ENABLE_XATTR) + LA_CHECK_INCLUDE_FILE(attr/xattr.h HAVE_ATTR_XATTR_H) + LA_CHECK_INCLUDE_FILE(sys/xattr.h HAVE_SYS_XATTR_H) + LA_CHECK_INCLUDE_FILE(sys/extattr.h HAVE_SYS_EXTATTR_H) + CHECK_LIBRARY_EXISTS(attr "setxattr" "" HAVE_LIBATTR) + IF(HAVE_LIBATTR) + SET(CMAKE_REQUIRED_LIBRARIES "attr") + ENDIF(HAVE_LIBATTR) + CHECK_SYMBOL_EXISTS(EXTATTR_NAMESPACE_USER "sys/types.h;sys/extattr.h" HAVE_DECL_EXTATTR_NAMESPACE_USER) + CHECK_FUNCTION_EXISTS_GLIBC(extattr_get_file HAVE_EXTATTR_GET_FILE) + CHECK_FUNCTION_EXISTS_GLIBC(extattr_list_file HAVE_EXTATTR_LIST_FILE) + CHECK_FUNCTION_EXISTS_GLIBC(extattr_set_fd HAVE_EXTATTR_SET_FD) + CHECK_FUNCTION_EXISTS_GLIBC(extattr_set_file HAVE_EXTATTR_SET_FILE) + CHECK_FUNCTION_EXISTS_GLIBC(fgetxattr HAVE_FGETXATTR) + CHECK_FUNCTION_EXISTS_GLIBC(flistxattr HAVE_FLISTXATTR) + CHECK_FUNCTION_EXISTS_GLIBC(fsetxattr HAVE_FSETXATTR) + CHECK_FUNCTION_EXISTS_GLIBC(getxattr HAVE_GETXATTR) + CHECK_FUNCTION_EXISTS_GLIBC(lgetxattr HAVE_LGETXATTR) + CHECK_FUNCTION_EXISTS_GLIBC(listxattr HAVE_LISTXATTR) + CHECK_FUNCTION_EXISTS_GLIBC(llistxattr HAVE_LLISTXATTR) + CHECK_FUNCTION_EXISTS_GLIBC(lsetxattr HAVE_LSETXATTR) + CHECK_FUNCTION_EXISTS_GLIBC(fgetea HAVE_FGETEA) + CHECK_FUNCTION_EXISTS_GLIBC(flistea HAVE_FLISTEA) + CHECK_FUNCTION_EXISTS_GLIBC(fsetea HAVE_FSETEA) + CHECK_FUNCTION_EXISTS_GLIBC(getea HAVE_GETEA) + CHECK_FUNCTION_EXISTS_GLIBC(lgetea HAVE_LGETEA) + CHECK_FUNCTION_EXISTS_GLIBC(listea HAVE_LISTEA) + CHECK_FUNCTION_EXISTS_GLIBC(llistea HAVE_LLISTEA) + CHECK_FUNCTION_EXISTS_GLIBC(lsetea HAVE_LSETEA) +ELSE(ENABLE_XATTR) + SET(HAVE_ATTR_LIB FALSE) + SET(HAVE_ATTR_XATTR_H FALSE) + SET(HAVE_DECL_EXTATTR_NAMESPACE_USER FALSE) + SET(HAVE_EXTATTR_GET_FILE FALSE) + SET(HAVE_EXTATTR_LIST_FILE FALSE) + SET(HAVE_EXTATTR_SET_FD FALSE) + SET(HAVE_EXTATTR_SET_FILE FALSE) + SET(HAVE_FGETEA FALSE) + SET(HAVE_FGETXATTR FALSE) + SET(HAVE_FLISTEA FALSE) + SET(HAVE_FLISTXATTR FALSE) + SET(HAVE_FSETEA FALSE) + SET(HAVE_FSETXATTR FALSE) + SET(HAVE_GETEA FALSE) + SET(HAVE_GETXATTR FALSE) + SET(HAVE_LGETEA FALSE) + SET(HAVE_LGETXATTR FALSE) + SET(HAVE_LISTEA FALSE) + SET(HAVE_LISTXATTR FALSE) + SET(HAVE_LLISTEA FALSE) + SET(HAVE_LLISTXATTR FALSE) + SET(HAVE_LSETEA FALSE) + SET(HAVE_LSETXATTR FALSE) + SET(HAVE_SYS_EXTATTR_H FALSE) + SET(HAVE_SYS_XATTR_H FALSE) +ENDIF(ENABLE_XATTR) + +# +# Check for ACL libraries, headers, and functions +# +# The ACL support in libarchive is written against the POSIX1e draft, +# which was never officially approved and varies quite a bit across +# platforms. Worse, some systems have completely non-POSIX acl functions, +# which makes the following checks rather more complex than I would like. +# +IF(ENABLE_ACL) + CHECK_LIBRARY_EXISTS(acl "acl_get_file" "" HAVE_LIBACL) + IF(HAVE_LIBACL) + SET(CMAKE_REQUIRED_LIBRARIES "acl") + FIND_LIBRARY(ACL_LIBRARY NAMES acl) + LIST(APPEND ADDITIONAL_LIBS ${ACL_LIBRARY}) + ENDIF(HAVE_LIBACL) + # + CHECK_FUNCTION_EXISTS_GLIBC(acl_create_entry HAVE_ACL_CREATE_ENTRY) + CHECK_FUNCTION_EXISTS_GLIBC(acl_init HAVE_ACL_INIT) + CHECK_FUNCTION_EXISTS_GLIBC(acl_set_fd HAVE_ACL_SET_FD) + CHECK_FUNCTION_EXISTS_GLIBC(acl_set_fd_np HAVE_ACL_SET_FD_NP) + CHECK_FUNCTION_EXISTS_GLIBC(acl_set_file HAVE_ACL_SET_FILE) + CHECK_TYPE_EXISTS(acl_permset_t "${INCLUDES}" HAVE_ACL_PERMSET_T) + + # The "acl_get_perm()" function was omitted from the POSIX draft. + # (It's a pretty obvious oversight; otherwise, there's no way to + # test for specific permissions in a permset.) Linux uses the obvious + # name, FreeBSD adds _np to mark it as "non-Posix extension." + # Test for both as a double-check that we really have POSIX-style ACL support. + CHECK_FUNCTION_EXISTS(acl_get_perm HAVE_ACL_GET_PERM) + CHECK_FUNCTION_EXISTS(acl_get_perm_np HAVE_ACL_GET_PERM_NP) + CHECK_FUNCTION_EXISTS(acl_get_link HAVE_ACL_GET_LINK) + CHECK_FUNCTION_EXISTS(acl_get_link_np HAVE_ACL_GET_LINK_NP) + CHECK_FUNCTION_EXISTS(acl_is_trivial_np HAVE_ACL_IS_TRIVIAL_NP) + CHECK_FUNCTION_EXISTS(acl_set_link_np HAVE_ACL_SET_LINK_NP) + + # MacOS has an acl.h that isn't POSIX. It can be detected by + # checking for ACL_USER + CHECK_SYMBOL_EXISTS(ACL_USER "${INCLUDES}" HAVE_ACL_USER) +ELSE(ENABLE_ACL) + # If someone runs cmake, then disables ACL support, we need + # to forcibly override the cached values for these. + SET(HAVE_ACL_CREATE_ENTRY FALSE) + SET(HAVE_ACL_GET_LINK FALSE) + SET(HAVE_ACL_GET_LINK_NP FALSE) + SET(HAVE_ACL_GET_PERM FALSE) + SET(HAVE_ACL_GET_PERM_NP FALSE) + SET(HAVE_ACL_INIT FALSE) + SET(HAVE_ACL_LIB FALSE) + SET(HAVE_ACL_PERMSET_T FALSE) + SET(HAVE_ACL_SET_FD FALSE) + SET(HAVE_ACL_SET_FD_NP FALSE) + SET(HAVE_ACL_SET_FILE FALSE) + SET(HAVE_ACL_USER FALSE) +ENDIF(ENABLE_ACL) + +# +# Check MD5/RMD160/SHA support +# NOTE: Crypto checks must be run last before generating config.h +# +CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" LIBC) +CHECK_CRYPTO("SHA256;SHA384;SHA512" LIBC2) +CHECK_CRYPTO("SHA256;SHA384;SHA512" LIBC3) +CHECK_CRYPTO("MD5;SHA1;SHA256;SHA384;SHA512" LIBSYSTEM) +CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" NETTLE) +CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA384;SHA512" OPENSSL) + +# Libmd has to be probed after OpenSSL. +CHECK_CRYPTO("MD5;RMD160;SHA1;SHA256;SHA512" LIBMD) + +CHECK_CRYPTO_WIN("MD5;SHA1;SHA256;SHA384;SHA512") + +# Generate "config.h" from "build/cmake/config.h.in" +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/config.h) +INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) +ADD_DEFINITIONS(-DHAVE_CONFIG_H) + +# +# Register installation of PDF documents. +# +IF(WIN32 AND NOT CYGWIN) + # + # On Windows platform, It's better that we install PDF documents + # on one's computer. + # These PDF documents are available in the release package. + # + IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf) + INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf + DESTINATION share/man + FILES_MATCHING PATTERN "*.pdf" + ) + ENDIF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doc/pdf) +ENDIF(WIN32 AND NOT CYGWIN) +# +# +# +INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_SOURCE_DIR}/libarchive) +# +IF(MSVC) + ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE) +ENDIF(MSVC) + +IF(ENABLE_TEST) + ADD_CUSTOM_TARGET(run_all_tests) +ENDIF(ENABLE_TEST) + +add_subdirectory(libarchive) +add_subdirectory(tar) +add_subdirectory(cpio) diff --git a/CTestConfig.cmake b/CTestConfig.cmake new file mode 100644 index 000000000000..7a09742db098 --- /dev/null +++ b/CTestConfig.cmake @@ -0,0 +1,11 @@ +# TODO: This file should be moved into the build/cmake directory... + +# The libarchive CDash page appears at +# http://my.cdash.org/index.php?project=libarchive +set(CTEST_PROJECT_NAME "libarchive") +set(CTEST_NIGHTLY_START_TIME "01:00:00 UTC") + +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "my.cdash.org") +set(CTEST_DROP_LOCATION "/submit.php?project=libarchive") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/INSTALL b/INSTALL new file mode 100644 index 000000000000..33c58b7ed454 --- /dev/null +++ b/INSTALL @@ -0,0 +1,35 @@ +More complete build documentation is available on the libarchive +Wiki: http://libarchive.googlecode.com/ + +On most Unix-like systems, you should be able to install libarchive, +bsdtar, and bsdcpio using the following common steps: + ./configure + make + make install + +If you need to customize the target directories or otherwise adjust +the build setting, use + ./configure --help +to list the configure options. + +If you are developing libarchive and need to update the +configure script and other build files: + /bin/sh build/autogen.sh + +To create a distribution, please use the 'distcheck' target: + /bin/sh build/autogen.sh && ./configure && make distcheck + +On Unix-like and non-Unix-like systems, use the "cmake" utility (available from +http://cmake.org/) to generate suitable build files for your platform. +Cmake requires the name of the directory containing CmakeLists.txt and +the "generator" to use for your build environment. For example, to +build with Xcode on Mac OS, you can use the following command: + cmake -G "Xcode" ~/libarchive-download-dir/ +The result will be appropriate makefiles, solution files, or project +files that can be used with the corresponding development tool. +The default on Unix-like systems is to generate Makefiles, so you +can also use cmake instead of the configure script: + cmake ~/libarchive-download-dir/ + make + make install +See the libarchive Wiki or the cmake site for further documentation. diff --git a/Makefile.am b/Makefile.am new file mode 100644 index 000000000000..3fa2d22b6de6 --- /dev/null +++ b/Makefile.am @@ -0,0 +1,1012 @@ +## Process this file with automake to produce Makefile.in + +AUTOMAKE_OPTIONS= foreign subdir-objects +ACLOCAL_AMFLAGS = -I build/autoconf + +# +# What to build and install +# +lib_LTLIBRARIES= libarchive.la +noinst_LTLIBRARIES= libarchive_fe.la +bin_PROGRAMS= $(bsdtar_programs) $(bsdcpio_programs) +man_MANS= $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS) +BUILT_SOURCES= libarchive/test/list.h tar/test/list.h cpio/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) +TESTS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs) +TESTS_ENVIRONMENT= $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT) +# Always build and test both bsdtar and bsdcpio as part of 'distcheck' +DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio +COMMON_CFLAGS=-Wall -Wformat -Wformat-security +# The next line is commented out by default in shipping libarchive releases. +# It is uncommented by default in trunk. +# DEV_CFLAGS=-Werror -Wextra -Wunused -Wshadow -Wmissing-prototypes -Wcast-qual +AM_CFLAGS=$(COMMON_CFLAGS) $(DEV_CFLAGS) +PLATFORMCPPFLAGS = @PLATFORMCPPFLAGS@ +AM_CPPFLAGS=$(PLATFORMCPPFLAGS) + +# +# What to include in the distribution +# +EXTRA_DIST= \ + CMakeLists.txt \ + build/autogen.sh \ + build/bump-version.sh \ + build/clean.sh \ + build/cmake \ + build/version \ + contrib \ + doc \ + examples \ + $(libarchive_EXTRA_DIST) \ + $(libarchive_test_EXTRA_DIST) \ + $(bsdtar_EXTRA_DIST) \ + $(bsdtar_test_EXTRA_DIST) \ + $(bsdcpio_EXTRA_DIST) \ + $(bsdcpio_test_EXTRA_DIST) + +# a) Clean out some unneeded files and directories +# b) Collect all documentation and format it for distribution. +dist-hook: + rm -rf `find $(distdir) -name CVS -type d` + rm -rf `find $(distdir) -name .svn -type d` + rm -f `find $(distdir) -name '*~'` + rm -f `find $(distdir) -name '*.out'` + rm -f `find $(distdir) -name '*.core'` + -rm -f $(distdir)/*/Makefile $(distdir)/*/*/Makefile + cd $(distdir)/doc && /bin/sh update.sh + +# +# Extra rules for cleanup +# +DISTCLEANFILES= \ + libarchive/test/list.h \ + tar/test/list.h \ + cpio/test/list.h + +distclean-local: + -rm -rf .ref + -rm -rf autom4te.cache/ + -rm -f *~ + -[ -f libarchive/Makefile ] && cd libarchive && make clean + -[ -f libarchive/test/Makefile ] && cd libarchive/test && make clean + -[ -f tar/Makefile ] && cd tar && make clean + -[ -f tar/test/Makefile ] && cd tar/test && make clean + -[ -f cpio/Makefile ] && cd cpio && make clean + -[ -f cpio/test/Makefile ] && cd cpio/test && make clean + +# +# Libarchive headers, source, etc. +# +# + +include_HEADERS= libarchive/archive.h libarchive/archive_entry.h + +libarchive_la_SOURCES= \ + libarchive/archive_acl.c \ + libarchive/archive_acl_private.h \ + libarchive/archive_check_magic.c \ + libarchive/archive_cmdline.c \ + libarchive/archive_cmdline_private.h \ + libarchive/archive_crc32.h \ + libarchive/archive_crypto.c \ + libarchive/archive_crypto_private.h \ + libarchive/archive_endian.h \ + libarchive/archive_entry.c \ + libarchive/archive_entry.h \ + libarchive/archive_entry_copy_stat.c \ + libarchive/archive_entry_link_resolver.c \ + libarchive/archive_entry_locale.h \ + libarchive/archive_entry_private.h \ + libarchive/archive_entry_sparse.c \ + libarchive/archive_entry_stat.c \ + libarchive/archive_entry_strmode.c \ + libarchive/archive_entry_xattr.c \ + libarchive/archive_getdate.c \ + libarchive/archive_match.c \ + libarchive/archive_options.c \ + libarchive/archive_options_private.h \ + libarchive/archive_pathmatch.c \ + libarchive/archive_pathmatch.h \ + libarchive/archive_platform.h \ + libarchive/archive_ppmd_private.h \ + libarchive/archive_ppmd7.c \ + libarchive/archive_ppmd7_private.h \ + libarchive/archive_private.h \ + libarchive/archive_rb.c \ + libarchive/archive_rb.h \ + libarchive/archive_read.c \ + libarchive/archive_read_append_filter.c \ + libarchive/archive_read_data_into_fd.c \ + libarchive/archive_read_disk_entry_from_file.c \ + libarchive/archive_read_disk_posix.c \ + libarchive/archive_read_disk_private.h \ + libarchive/archive_read_disk_set_standard_lookup.c \ + libarchive/archive_read_extract.c \ + libarchive/archive_read_open_fd.c \ + libarchive/archive_read_open_file.c \ + libarchive/archive_read_open_filename.c \ + libarchive/archive_read_open_memory.c \ + libarchive/archive_read_private.h \ + libarchive/archive_read_set_format.c \ + libarchive/archive_read_set_options.c \ + libarchive/archive_read_support_filter_all.c \ + libarchive/archive_read_support_filter_bzip2.c \ + libarchive/archive_read_support_filter_compress.c \ + libarchive/archive_read_support_filter_grzip.c \ + libarchive/archive_read_support_filter_gzip.c \ + libarchive/archive_read_support_filter_lrzip.c \ + libarchive/archive_read_support_filter_lzop.c \ + libarchive/archive_read_support_filter_none.c \ + libarchive/archive_read_support_filter_program.c \ + libarchive/archive_read_support_filter_rpm.c \ + libarchive/archive_read_support_filter_uu.c \ + libarchive/archive_read_support_filter_xz.c \ + libarchive/archive_read_support_format_7zip.c \ + libarchive/archive_read_support_format_all.c \ + libarchive/archive_read_support_format_ar.c \ + libarchive/archive_read_support_format_by_code.c \ + libarchive/archive_read_support_format_cab.c \ + libarchive/archive_read_support_format_cpio.c \ + libarchive/archive_read_support_format_empty.c \ + libarchive/archive_read_support_format_iso9660.c \ + libarchive/archive_read_support_format_lha.c \ + libarchive/archive_read_support_format_mtree.c \ + libarchive/archive_read_support_format_rar.c \ + libarchive/archive_read_support_format_raw.c \ + libarchive/archive_read_support_format_tar.c \ + libarchive/archive_read_support_format_xar.c \ + libarchive/archive_read_support_format_zip.c \ + libarchive/archive_string.c \ + libarchive/archive_string.h \ + libarchive/archive_string_composition.h \ + libarchive/archive_string_sprintf.c \ + libarchive/archive_util.c \ + libarchive/archive_virtual.c \ + libarchive/archive_write.c \ + libarchive/archive_write_disk_acl.c \ + libarchive/archive_write_disk_posix.c \ + libarchive/archive_write_disk_private.h \ + libarchive/archive_write_disk_set_standard_lookup.c \ + libarchive/archive_write_open_fd.c \ + libarchive/archive_write_open_file.c \ + libarchive/archive_write_open_filename.c \ + libarchive/archive_write_open_memory.c \ + libarchive/archive_write_private.h \ + libarchive/archive_write_add_filter.c \ + libarchive/archive_write_add_filter_b64encode.c \ + libarchive/archive_write_add_filter_by_name.c \ + libarchive/archive_write_add_filter_bzip2.c \ + libarchive/archive_write_add_filter_compress.c \ + libarchive/archive_write_add_filter_grzip.c \ + libarchive/archive_write_add_filter_gzip.c \ + libarchive/archive_write_add_filter_lrzip.c \ + libarchive/archive_write_add_filter_lzop.c \ + libarchive/archive_write_add_filter_none.c \ + libarchive/archive_write_add_filter_program.c \ + libarchive/archive_write_add_filter_uuencode.c \ + libarchive/archive_write_add_filter_xz.c \ + libarchive/archive_write_set_format.c \ + libarchive/archive_write_set_format_7zip.c \ + libarchive/archive_write_set_format_ar.c \ + libarchive/archive_write_set_format_by_name.c \ + libarchive/archive_write_set_format_cpio.c \ + libarchive/archive_write_set_format_cpio_newc.c \ + libarchive/archive_write_set_format_iso9660.c \ + libarchive/archive_write_set_format_mtree.c \ + libarchive/archive_write_set_format_pax.c \ + libarchive/archive_write_set_format_shar.c \ + libarchive/archive_write_set_format_ustar.c \ + libarchive/archive_write_set_format_v7tar.c \ + libarchive/archive_write_set_format_gnutar.c \ + libarchive/archive_write_set_format_xar.c \ + libarchive/archive_write_set_format_zip.c \ + libarchive/archive_write_set_options.c \ + libarchive/config_freebsd.h \ + libarchive/filter_fork_posix.c \ + libarchive/filter_fork.h + +if INC_WINDOWS_FILES +libarchive_la_SOURCES+= \ + libarchive/archive_entry_copy_bhfi.c \ + libarchive/archive_read_disk_windows.c \ + libarchive/archive_windows.h \ + libarchive/archive_windows.c \ + libarchive/archive_write_disk_windows.c \ + libarchive/filter_fork_windows.c +endif + +# -no-undefined marks that libarchive doesn't rely on symbols +# defined in the application. This is mandatory for cygwin. +libarchive_la_LDFLAGS= -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION) +libarchive_la_LIBADD= $(LTLIBICONV) + +# Manpages to install +libarchive_man_MANS= \ + libarchive/archive_entry.3 \ + libarchive/archive_entry_acl.3 \ + libarchive/archive_entry_linkify.3 \ + libarchive/archive_entry_paths.3 \ + libarchive/archive_entry_perms.3 \ + libarchive/archive_entry_stat.3 \ + libarchive/archive_entry_time.3 \ + libarchive/archive_read.3 \ + libarchive/archive_read_data.3 \ + libarchive/archive_read_disk.3 \ + libarchive/archive_read_extract.3 \ + libarchive/archive_read_filter.3 \ + libarchive/archive_read_format.3 \ + libarchive/archive_read_free.3 \ + libarchive/archive_read_header.3 \ + libarchive/archive_read_new.3 \ + libarchive/archive_read_open.3 \ + libarchive/archive_read_set_options.3 \ + libarchive/archive_util.3 \ + libarchive/archive_write.3 \ + libarchive/archive_write_blocksize.3 \ + libarchive/archive_write_data.3 \ + libarchive/archive_write_disk.3 \ + libarchive/archive_write_filter.3 \ + libarchive/archive_write_finish_entry.3 \ + libarchive/archive_write_format.3 \ + libarchive/archive_write_free.3 \ + libarchive/archive_write_header.3 \ + libarchive/archive_write_new.3 \ + libarchive/archive_write_open.3 \ + libarchive/archive_write_set_options.3 \ + libarchive/cpio.5 \ + libarchive/libarchive.3 \ + libarchive/libarchive_changes.3 \ + libarchive/libarchive_internals.3 \ + libarchive/libarchive-formats.5 \ + libarchive/mtree.5 \ + libarchive/tar.5 + +# Additional libarchive files to include in the distribution +libarchive_EXTRA_DIST= \ + libarchive/archive_windows.c \ + libarchive/archive_windows.h \ + libarchive/filter_fork_windows.c \ + libarchive/CMakeLists.txt \ + $(libarchive_man_MANS) + +# pkgconfig +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = build/pkgconfig/libarchive.pc + +# Sources needed by all test programs +test_utils_SOURCES= \ + test_utils/test_utils.c \ + test_utils/test_utils.h + +# +# +# libarchive_test program +# +# +libarchive_test_SOURCES= \ + $(libarchive_la_SOURCES) \ + $(test_utils_SOURCES) \ + libarchive/test/main.c \ + libarchive/test/read_open_memory.c \ + libarchive/test/test.h \ + libarchive/test/test_acl_freebsd_posix1e.c \ + libarchive/test/test_acl_freebsd_nfs4.c \ + libarchive/test/test_acl_nfs4.c \ + libarchive/test/test_acl_pax.c \ + libarchive/test/test_acl_posix1e.c \ + libarchive/test/test_archive_api_feature.c \ + libarchive/test/test_archive_clear_error.c \ + libarchive/test/test_archive_cmdline.c \ + libarchive/test/test_archive_crypto.c \ + libarchive/test/test_archive_getdate.c \ + libarchive/test/test_archive_match_owner.c \ + libarchive/test/test_archive_match_path.c \ + libarchive/test/test_archive_match_time.c \ + libarchive/test/test_archive_pathmatch.c \ + libarchive/test/test_archive_read_close_twice.c \ + libarchive/test/test_archive_read_close_twice_open_fd.c \ + libarchive/test/test_archive_read_close_twice_open_filename.c \ + libarchive/test/test_archive_read_multiple_data_objects.c \ + libarchive/test/test_archive_read_next_header_empty.c \ + libarchive/test/test_archive_read_next_header_raw.c \ + libarchive/test/test_archive_read_open2.c \ + libarchive/test/test_archive_read_set_filter_option.c \ + libarchive/test/test_archive_read_set_format_option.c \ + libarchive/test/test_archive_read_set_option.c \ + libarchive/test/test_archive_read_set_options.c \ + libarchive/test/test_archive_read_support.c \ + libarchive/test/test_archive_set_error.c \ + libarchive/test/test_archive_string.c \ + libarchive/test/test_archive_string_conversion.c \ + libarchive/test/test_archive_write_add_filter_by_name.c \ + libarchive/test/test_archive_write_set_filter_option.c \ + libarchive/test/test_archive_write_set_format_by_name.c \ + libarchive/test/test_archive_write_set_format_option.c \ + libarchive/test/test_archive_write_set_option.c \ + libarchive/test/test_archive_write_set_options.c \ + libarchive/test/test_bad_fd.c \ + libarchive/test/test_compat_bzip2.c \ + libarchive/test/test_compat_cpio.c \ + libarchive/test/test_compat_gtar.c \ + libarchive/test/test_compat_gzip.c \ + libarchive/test/test_compat_lzip.c \ + libarchive/test/test_compat_lzma.c \ + libarchive/test/test_compat_lzop.c \ + libarchive/test/test_compat_mac.c \ + libarchive/test/test_compat_pax_libarchive_2x.c \ + libarchive/test/test_compat_solaris_tar_acl.c \ + libarchive/test/test_compat_solaris_pax_sparse.c \ + libarchive/test/test_compat_tar_hardlink.c \ + libarchive/test/test_compat_uudecode.c \ + libarchive/test/test_compat_xz.c \ + libarchive/test/test_compat_zip.c \ + libarchive/test/test_empty_write.c \ + libarchive/test/test_entry.c \ + libarchive/test/test_entry_strmode.c \ + libarchive/test/test_extattr_freebsd.c \ + libarchive/test/test_filter_count.c \ + libarchive/test/test_fuzz.c \ + libarchive/test/test_gnutar_filename_encoding.c \ + libarchive/test/test_link_resolver.c \ + libarchive/test/test_open_failure.c \ + libarchive/test/test_open_fd.c \ + libarchive/test/test_open_file.c \ + libarchive/test/test_open_filename.c \ + libarchive/test/test_pax_filename_encoding.c \ + libarchive/test/test_read_data_large.c \ + libarchive/test/test_read_disk.c \ + libarchive/test/test_read_disk_directory_traversals.c \ + libarchive/test/test_read_disk_entry_from_file.c \ + libarchive/test/test_read_extract.c \ + libarchive/test/test_read_file_nonexistent.c \ + libarchive/test/test_read_filter_grzip.c \ + libarchive/test/test_read_filter_lrzip.c \ + libarchive/test/test_read_filter_lzop.c \ + libarchive/test/test_read_filter_lzop_multiple_parts.c \ + libarchive/test/test_read_filter_program.c \ + libarchive/test/test_read_filter_program_signature.c \ + libarchive/test/test_read_filter_uudecode.c \ + libarchive/test/test_read_format_7zip.c \ + libarchive/test/test_read_format_ar.c \ + libarchive/test/test_read_format_cab.c \ + libarchive/test/test_read_format_cab_filename.c \ + libarchive/test/test_read_format_cpio_afio.c \ + libarchive/test/test_read_format_cpio_bin.c \ + libarchive/test/test_read_format_cpio_bin_Z.c \ + libarchive/test/test_read_format_cpio_bin_be.c \ + libarchive/test/test_read_format_cpio_bin_bz2.c \ + libarchive/test/test_read_format_cpio_bin_gz.c \ + libarchive/test/test_read_format_cpio_bin_lzip.c \ + libarchive/test/test_read_format_cpio_bin_lzma.c \ + libarchive/test/test_read_format_cpio_bin_xz.c \ + libarchive/test/test_read_format_cpio_filename.c \ + libarchive/test/test_read_format_cpio_odc.c \ + libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c \ + libarchive/test/test_read_format_cpio_svr4_gzip.c \ + libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c \ + libarchive/test/test_read_format_cpio_svr4c_Z.c \ + libarchive/test/test_read_format_empty.c \ + libarchive/test/test_read_format_gtar_filename.c \ + libarchive/test/test_read_format_gtar_gz.c \ + libarchive/test/test_read_format_gtar_lzma.c \ + libarchive/test/test_read_format_gtar_sparse.c \ + libarchive/test/test_read_format_iso_Z.c \ + libarchive/test/test_read_format_iso_multi_extent.c \ + libarchive/test/test_read_format_iso_xorriso.c \ + libarchive/test/test_read_format_isojoliet_bz2.c \ + libarchive/test/test_read_format_isojoliet_long.c \ + libarchive/test/test_read_format_isojoliet_rr.c \ + libarchive/test/test_read_format_isojoliet_versioned.c \ + libarchive/test/test_read_format_isorr_bz2.c \ + libarchive/test/test_read_format_isorr_ce.c \ + libarchive/test/test_read_format_isorr_new_bz2.c \ + libarchive/test/test_read_format_isorr_rr_moved.c \ + libarchive/test/test_read_format_isozisofs_bz2.c \ + libarchive/test/test_read_format_lha.c \ + libarchive/test/test_read_format_lha_filename.c \ + libarchive/test/test_read_format_mtree.c \ + libarchive/test/test_read_format_pax_bz2.c \ + libarchive/test/test_read_format_rar.c \ + libarchive/test/test_read_format_raw.c \ + libarchive/test/test_read_format_tar.c \ + libarchive/test/test_read_format_tar_empty_filename.c \ + libarchive/test/test_read_format_tar_filename.c \ + libarchive/test/test_read_format_tbz.c \ + libarchive/test/test_read_format_tgz.c \ + libarchive/test/test_read_format_tlz.c \ + libarchive/test/test_read_format_txz.c \ + libarchive/test/test_read_format_tz.c \ + libarchive/test/test_read_format_ustar_filename.c \ + libarchive/test/test_read_format_xar.c \ + libarchive/test/test_read_format_zip.c \ + libarchive/test/test_read_format_zip_comment_stored.c \ + libarchive/test/test_read_format_zip_filename.c \ + libarchive/test/test_read_format_zip_mac_metadata.c \ + libarchive/test/test_read_format_zip_sfx.c \ + libarchive/test/test_read_large.c \ + libarchive/test/test_read_pax_truncated.c \ + libarchive/test/test_read_position.c \ + libarchive/test/test_read_set_format.c \ + libarchive/test/test_read_truncated.c \ + libarchive/test/test_read_truncated_filter.c \ + libarchive/test/test_sparse_basic.c \ + libarchive/test/test_tar_filenames.c \ + libarchive/test/test_tar_large.c \ + libarchive/test/test_ustar_filenames.c \ + libarchive/test/test_ustar_filename_encoding.c \ + libarchive/test/test_write_disk.c \ + libarchive/test/test_write_disk_appledouble.c \ + libarchive/test/test_write_disk_failures.c \ + libarchive/test/test_write_disk_hardlink.c \ + libarchive/test/test_write_disk_hfs_compression.c \ + libarchive/test/test_write_disk_lookup.c \ + libarchive/test/test_write_disk_mac_metadata.c \ + libarchive/test/test_write_disk_no_hfs_compression.c \ + libarchive/test/test_write_disk_perms.c \ + libarchive/test/test_write_disk_secure.c \ + libarchive/test/test_write_disk_sparse.c \ + libarchive/test/test_write_disk_symlink.c \ + libarchive/test/test_write_disk_times.c \ + libarchive/test/test_write_filter_b64encode.c \ + libarchive/test/test_write_filter_bzip2.c \ + libarchive/test/test_write_filter_compress.c \ + libarchive/test/test_write_filter_gzip.c \ + libarchive/test/test_write_filter_gzip_timestamp.c \ + libarchive/test/test_write_filter_lrzip.c \ + libarchive/test/test_write_filter_lzip.c \ + libarchive/test/test_write_filter_lzma.c \ + libarchive/test/test_write_filter_lzop.c \ + libarchive/test/test_write_filter_program.c \ + libarchive/test/test_write_filter_uuencode.c \ + libarchive/test/test_write_filter_xz.c \ + libarchive/test/test_write_format_7zip.c \ + libarchive/test/test_write_format_7zip_empty.c \ + libarchive/test/test_write_format_7zip_large.c \ + libarchive/test/test_write_format_ar.c \ + libarchive/test/test_write_format_cpio.c \ + libarchive/test/test_write_format_cpio_empty.c \ + libarchive/test/test_write_format_cpio_newc.c \ + libarchive/test/test_write_format_cpio_odc.c \ + libarchive/test/test_write_format_gnutar.c \ + libarchive/test/test_write_format_iso9660.c \ + libarchive/test/test_write_format_iso9660_boot.c \ + libarchive/test/test_write_format_iso9660_empty.c \ + libarchive/test/test_write_format_iso9660_filename.c \ + libarchive/test/test_write_format_iso9660_zisofs.c \ + libarchive/test/test_write_format_mtree.c \ + libarchive/test/test_write_format_mtree_absolute_path.c \ + libarchive/test/test_write_format_mtree_classic.c \ + libarchive/test/test_write_format_mtree_classic_indent.c\ + libarchive/test/test_write_format_mtree_fflags.c \ + libarchive/test/test_write_format_mtree_no_separator.c \ + libarchive/test/test_write_format_mtree_quoted_filename.c\ + libarchive/test/test_write_format_pax.c \ + libarchive/test/test_write_format_shar_empty.c \ + libarchive/test/test_write_format_tar.c \ + libarchive/test/test_write_format_tar_empty.c \ + libarchive/test/test_write_format_tar_sparse.c \ + libarchive/test/test_write_format_tar_ustar.c \ + libarchive/test/test_write_format_tar_v7tar.c \ + libarchive/test/test_write_format_xar.c \ + libarchive/test/test_write_format_xar_empty.c \ + libarchive/test/test_write_format_zip.c \ + libarchive/test/test_write_format_zip_empty.c \ + libarchive/test/test_write_format_zip_no_compression.c \ + libarchive/test/test_write_open_memory.c \ + libarchive/test/test_write_zip_set_compression_store.c \ + libarchive/test/test_zip_filename_encoding.c + +libarchive_test_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/test_utils -I$(top_builddir)/libarchive/test -DLIBARCHIVE_STATIC $(PLATFORMCPPFLAGS) +libarchive_test_LDADD= $(LTLIBICONV) + +# The "list.h" file just lists all of the tests defined in all of the sources. +# Building it automatically provides a sanity-check on libarchive_test_SOURCES +# above. +libarchive/test/list.h: Makefile + cat $(top_srcdir)/libarchive/test/test_*.c | grep DEFINE_TEST > libarchive/test/list.h + +libarchive_TESTS_ENVIRONMENT= LIBARCHIVE_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/libarchive/test LRZIP=NOCONFIG + +libarchive_test_EXTRA_DIST=\ + libarchive/test/list.h \ + libarchive/test/test_acl_pax.tar.uu \ + libarchive/test/test_archive_string_conversion.txt.Z.uu \ + libarchive/test/test_compat_bzip2_1.tbz.uu \ + libarchive/test/test_compat_bzip2_2.tbz.uu \ + libarchive/test/test_compat_cpio_1.cpio.uu \ + libarchive/test/test_compat_gtar_1.tar.uu \ + libarchive/test/test_compat_gzip_1.tgz.uu \ + libarchive/test/test_compat_gzip_2.tgz.uu \ + libarchive/test/test_compat_lzip_1.tlz.uu \ + libarchive/test/test_compat_lzip_2.tlz.uu \ + libarchive/test/test_compat_lzma_1.tlz.uu \ + libarchive/test/test_compat_lzma_2.tlz.uu \ + libarchive/test/test_compat_lzma_3.tlz.uu \ + libarchive/test/test_compat_lzop_1.tar.lzo.uu \ + libarchive/test/test_compat_lzop_2.tar.lzo.uu \ + libarchive/test/test_compat_lzop_3.tar.lzo.uu \ + libarchive/test/test_compat_mac-1.tar.Z.uu \ + libarchive/test/test_compat_mac-2.tar.Z.uu \ + libarchive/test/test_compat_pax_libarchive_2x.tar.Z.uu \ + libarchive/test/test_compat_solaris_tar_acl.tar.uu \ + libarchive/test/test_compat_solaris_pax_sparse_1.pax.Z.uu \ + libarchive/test/test_compat_solaris_pax_sparse_2.pax.Z.uu \ + libarchive/test/test_compat_tar_hardlink_1.tar.uu \ + libarchive/test/test_compat_xz_1.txz.uu \ + libarchive/test/test_compat_zip_1.zip.uu \ + libarchive/test/test_compat_zip_2.zip.uu \ + libarchive/test/test_compat_zip_3.zip.uu \ + libarchive/test/test_compat_zip_4.zip.uu \ + libarchive/test/test_compat_zip_5.zip.uu \ + libarchive/test/test_compat_zip_6.zip.uu \ + libarchive/test/test_compat_zip_7.xps.uu \ + libarchive/test/test_fuzz_1.iso.Z.uu \ + libarchive/test/test_fuzz.cab.uu \ + libarchive/test/test_fuzz.lzh.uu \ + libarchive/test/test_pax_filename_encoding.tar.uu \ + libarchive/test/test_rar_multivolume_multiple_files.part1.rar.uu \ + libarchive/test/test_rar_multivolume_multiple_files.part2.rar.uu \ + libarchive/test/test_rar_multivolume_multiple_files.part3.rar.uu \ + libarchive/test/test_rar_multivolume_multiple_files.part4.rar.uu \ + libarchive/test/test_rar_multivolume_multiple_files.part5.rar.uu \ + libarchive/test/test_rar_multivolume_multiple_files.part6.rar.uu \ + libarchive/test/test_rar_multivolume_single_file.part1.rar.uu \ + libarchive/test/test_rar_multivolume_single_file.part2.rar.uu \ + libarchive/test/test_rar_multivolume_single_file.part3.rar.uu \ + libarchive/test/test_rar_multivolume_uncompressed_files.part01.rar.uu \ + libarchive/test/test_rar_multivolume_uncompressed_files.part02.rar.uu \ + libarchive/test/test_rar_multivolume_uncompressed_files.part03.rar.uu \ + libarchive/test/test_rar_multivolume_uncompressed_files.part04.rar.uu \ + libarchive/test/test_rar_multivolume_uncompressed_files.part05.rar.uu \ + libarchive/test/test_rar_multivolume_uncompressed_files.part06.rar.uu \ + libarchive/test/test_rar_multivolume_uncompressed_files.part07.rar.uu \ + libarchive/test/test_rar_multivolume_uncompressed_files.part08.rar.uu \ + libarchive/test/test_rar_multivolume_uncompressed_files.part09.rar.uu \ + libarchive/test/test_rar_multivolume_uncompressed_files.part10.rar.uu \ + libarchive/test/test_read_filter_grzip.tar.grz.uu \ + libarchive/test/test_read_filter_lrzip.tar.lrz.uu \ + libarchive/test/test_read_filter_lzop.tar.lzo.uu \ + libarchive/test/test_read_filter_lzop_multiple_parts.tar.lzo.uu \ + libarchive/test/test_read_format_7zip_bcj_bzip2.7z.uu \ + libarchive/test/test_read_format_7zip_bcj_copy.7z.uu \ + libarchive/test/test_read_format_7zip_bcj_deflate.7z.uu \ + libarchive/test/test_read_format_7zip_bcj_lzma1.7z.uu \ + libarchive/test/test_read_format_7zip_bcj_lzma2.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_bzip2.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_copy_1.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_copy_2.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_copy_lzma.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_deflate.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_lzma1_1.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_lzma1_2.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_lzma2_1.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_lzma2_2.7z.uu \ + libarchive/test/test_read_format_7zip_bzip2.7z.uu \ + 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_delta_lzma1.7z.uu \ + libarchive/test/test_read_format_7zip_delta_lzma2.7z.uu \ + libarchive/test/test_read_format_7zip_empty_archive.7z.uu \ + libarchive/test/test_read_format_7zip_empty_file.7z.uu \ + libarchive/test/test_read_format_7zip_lzma1.7z.uu \ + 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_ppmd.7z.uu \ + libarchive/test/test_read_format_7zip_symbolic_name.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 \ + libarchive/test/test_read_format_cab_3.cab.uu \ + libarchive/test/test_read_format_cab_filename_cp932.cab.uu \ + libarchive/test/test_read_format_cpio_bin_be.cpio.uu \ + libarchive/test/test_read_format_cpio_filename_cp866.cpio.uu \ + libarchive/test/test_read_format_cpio_filename_eucjp.cpio.uu \ + libarchive/test/test_read_format_cpio_filename_koi8r.cpio.uu \ + libarchive/test/test_read_format_cpio_filename_utf8_jp.cpio.uu \ + libarchive/test/test_read_format_cpio_filename_utf8_ru.cpio.uu \ + libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu \ + libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu \ + libarchive/test/test_read_format_gtar_filename_cp866.tar.Z.uu \ + libarchive/test/test_read_format_gtar_filename_eucjp.tar.Z.uu \ + libarchive/test/test_read_format_gtar_filename_koi8r.tar.Z.uu \ + libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu \ + libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu \ + libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu \ + libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu \ + libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu \ + libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu \ + libarchive/test/test_read_format_iso.iso.Z.uu \ + libarchive/test/test_read_format_iso_2.iso.Z.uu \ + libarchive/test/test_read_format_iso_joliet.iso.Z.uu \ + libarchive/test/test_read_format_iso_joliet_by_nero.iso.Z.uu \ + libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu \ + libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu \ + libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu \ + libarchive/test/test_read_format_iso_rockridge.iso.Z.uu \ + libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu \ + libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu \ + libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu\ + libarchive/test/test_read_format_iso_xorriso.iso.Z.uu \ + libarchive/test/test_read_format_iso_zisofs.iso.Z.uu \ + libarchive/test/test_read_format_lha_filename_cp932.lzh.uu \ + libarchive/test/test_read_format_lha_header0.lzh.uu \ + libarchive/test/test_read_format_lha_header1.lzh.uu \ + libarchive/test/test_read_format_lha_header2.lzh.uu \ + libarchive/test/test_read_format_lha_header3.lzh.uu \ + libarchive/test/test_read_format_lha_lh0.lzh.uu \ + libarchive/test/test_read_format_lha_lh6.lzh.uu \ + libarchive/test/test_read_format_lha_lh7.lzh.uu \ + libarchive/test/test_read_format_lha_withjunk.lzh.uu \ + libarchive/test/test_read_format_mtree.mtree.uu \ + libarchive/test/test_read_format_mtree_nomagic.mtree.uu \ + libarchive/test/test_read_format_mtree_nomagic2.mtree.uu \ + libarchive/test/test_read_format_mtree_nomagic3.mtree.uu \ + libarchive/test/test_read_format_rar.rar.uu \ + libarchive/test/test_read_format_rar_binary_data.rar.uu \ + libarchive/test/test_read_format_rar_compress_best.rar.uu \ + libarchive/test/test_read_format_rar_compress_normal.rar.uu \ + libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu \ + libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu\ + libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu\ + libarchive/test/test_read_format_rar_multivolume.part0003.rar.uu\ + libarchive/test/test_read_format_rar_multivolume.part0004.rar.uu\ + libarchive/test/test_read_format_rar_noeof.rar.uu \ + libarchive/test/test_read_format_rar_ppmd_lzss_conversion.rar.uu\ + libarchive/test/test_read_format_rar_sfx.exe.uu \ + libarchive/test/test_read_format_rar_subblock.rar.uu \ + libarchive/test/test_read_format_rar_unicode.rar.uu \ + libarchive/test/test_read_format_rar_windows.rar.uu \ + libarchive/test/test_read_format_raw.data.Z.uu \ + libarchive/test/test_read_format_raw.data.uu \ + libarchive/test/test_read_format_tar_empty_filename.tar.uu \ + libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu \ + libarchive/test/test_read_format_ustar_filename_cp866.tar.Z.uu \ + libarchive/test/test_read_format_ustar_filename_eucjp.tar.Z.uu \ + libarchive/test/test_read_format_ustar_filename_koi8r.tar.Z.uu \ + libarchive/test/test_read_format_zip.zip.uu \ + libarchive/test/test_read_format_zip_comment_stored_1.zip.uu \ + libarchive/test/test_read_format_zip_comment_stored_2.zip.uu \ + libarchive/test/test_read_format_zip_filename_cp866.zip.uu \ + libarchive/test/test_read_format_zip_filename_cp932.zip.uu \ + libarchive/test/test_read_format_zip_filename_koi8r.zip.uu \ + libarchive/test/test_read_format_zip_filename_utf8_jp.zip.uu \ + libarchive/test/test_read_format_zip_filename_utf8_ru2.zip.uu \ + libarchive/test/test_read_format_zip_filename_utf8_ru.zip.uu \ + libarchive/test/test_read_format_zip_length_at_end.zip.uu \ + libarchive/test/test_read_format_zip_mac_metadata.zip.uu \ + libarchive/test/test_read_format_zip_sfx.uu \ + libarchive/test/test_read_format_zip_symlink.zip.uu \ + libarchive/test/test_read_format_zip_ux.zip.uu \ + libarchive/test/test_read_large_splitted_rar_aa.uu \ + libarchive/test/test_read_large_splitted_rar_ab.uu \ + libarchive/test/test_read_large_splitted_rar_ac.uu \ + libarchive/test/test_read_large_splitted_rar_ad.uu \ + libarchive/test/test_read_large_splitted_rar_ae.uu \ + libarchive/test/test_read_splitted_rar_aa.uu \ + libarchive/test/test_read_splitted_rar_ab.uu \ + libarchive/test/test_read_splitted_rar_ac.uu \ + libarchive/test/test_read_splitted_rar_ad.uu \ + libarchive/test/test_splitted_rar_seek_support_aa.uu \ + libarchive/test/test_splitted_rar_seek_support_ab.uu \ + libarchive/test/test_splitted_rar_seek_support_ac.uu \ + libarchive/test/test_write_disk_appledouble.cpio.gz.uu \ + libarchive/test/test_write_disk_hfs_compression.tgz.uu \ + libarchive/test/test_write_disk_mac_metadata.tar.gz.uu \ + libarchive/test/test_write_disk_no_hfs_compression.tgz.uu \ + libarchive/test/CMakeLists.txt \ + libarchive/test/README + +# +# Common code for libarchive frontends (cpio, tar) +# +libarchive_fe_la_SOURCES= \ + libarchive_fe/err.c \ + libarchive_fe/err.h \ + libarchive_fe/lafe_platform.h \ + libarchive_fe/line_reader.c \ + libarchive_fe/line_reader.h + +libarchive_fe_la_CPPFLAGS= -I$(top_srcdir)/libarchive +# +# +# bsdtar source, docs, etc. +# +# + +bsdtar_SOURCES= \ + tar/bsdtar.c \ + tar/bsdtar.h \ + tar/bsdtar_platform.h \ + tar/cmdline.c \ + tar/creation_set.c \ + tar/read.c \ + tar/subst.c \ + tar/util.c \ + tar/write.c + +if INC_WINDOWS_FILES +bsdtar_SOURCES+= \ + tar/bsdtar_windows.h \ + tar/bsdtar_windows.c +endif + +bsdtar_DEPENDENCIES= libarchive.la libarchive_fe.la + +if STATIC_BSDTAR +bsdtar_ldstatic= -static +bsdtar_ccstatic= -DLIBARCHIVE_STATIC +else +bsdtar_ldstatic= +bsdtar_ccstatic= +endif + +bsdtar_LDADD= libarchive.la libarchive_fe.la $(LTLIBICONV) +bsdtar_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdtar_ccstatic) $(PLATFORMCPPFLAGS) +bsdtar_LDFLAGS= $(bsdtar_ldstatic) + +bsdtar_EXTRA_DIST= \ + tar/bsdtar.1 \ + tar/bsdtar_windows.h \ + tar/bsdtar_windows.c \ + tar/CMakeLists.txt \ + tar/config_freebsd.h + + +if BUILD_BSDTAR +bsdtar_man_MANS= tar/bsdtar.1 +bsdtar_programs= bsdtar +else +bsdtar_man_MANS= +bsdtar_programs= +endif + +# +# bsdtar_test +# + +bsdtar_test_SOURCES= \ + $(test_utils_SOURCES) \ + tar/test/main.c \ + tar/test/test.h \ + tar/test/test_0.c \ + tar/test/test_basic.c \ + tar/test/test_copy.c \ + tar/test/test_empty_mtree.c \ + tar/test/test_extract_tar_Z.c \ + tar/test/test_extract_tar_bz2.c \ + tar/test/test_extract_tar_grz.c \ + tar/test/test_extract_tar_gz.c \ + tar/test/test_extract_tar_lrz.c \ + tar/test/test_extract_tar_lz.c \ + tar/test/test_extract_tar_lzma.c \ + tar/test/test_extract_tar_lzo.c \ + tar/test/test_extract_tar_xz.c \ + tar/test/test_format_newc.c \ + tar/test/test_help.c \ + tar/test/test_option_C_upper.c \ + tar/test/test_option_H_upper.c \ + tar/test/test_option_L_upper.c \ + tar/test/test_option_O_upper.c \ + tar/test/test_option_T_upper.c \ + tar/test/test_option_U_upper.c \ + tar/test/test_option_X_upper.c \ + tar/test/test_option_a.c \ + tar/test/test_option_b.c \ + tar/test/test_option_b64encode.c \ + tar/test/test_option_exclude.c \ + tar/test/test_option_gid_gname.c \ + tar/test/test_option_grzip.c \ + tar/test/test_option_j.c \ + tar/test/test_option_k.c \ + tar/test/test_option_keep_newer_files.c \ + tar/test/test_option_lrzip.c \ + tar/test/test_option_lzma.c \ + tar/test/test_option_lzop.c \ + tar/test/test_option_n.c \ + tar/test/test_option_newer_than.c \ + tar/test/test_option_nodump.c \ + tar/test/test_option_older_than.c \ + tar/test/test_option_q.c \ + tar/test/test_option_r.c \ + tar/test/test_option_s.c \ + tar/test/test_option_uid_uname.c \ + tar/test/test_option_uuencode.c \ + tar/test/test_option_xz.c \ + tar/test/test_option_z.c \ + tar/test/test_patterns.c \ + tar/test/test_print_longpath.c \ + tar/test/test_stdio.c \ + tar/test/test_strip_components.c \ + tar/test/test_symlink_dir.c \ + tar/test/test_version.c \ + tar/test/test_windows.c + +bsdtar_test_CPPFLAGS=\ + -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \ + -I$(top_srcdir)/test_utils \ + -I$(top_srcdir)/tar -I$(top_builddir)/tar/test \ + $(PLATFORMCPPFLAGS) + +tar/test/list.h: Makefile + cat $(top_srcdir)/tar/test/test_*.c | grep DEFINE_TEST > tar/test/list.h + +if BUILD_BSDTAR +bsdtar_test_programs= bsdtar_test +bsdtar_TESTS_ENVIRONMENT= BSDTAR=`cd $(top_builddir);/bin/pwd`/bsdtar$(EXEEXT) BSDTAR_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/tar/test +else +bsdtar_test_programs= +bsdtar_TESTS_ENVIRONMENT= +endif + +bsdtar_test_EXTRA_DIST= \ + tar/test/list.h \ + tar/test/test_extract.tar.Z.uu \ + tar/test/test_extract.tar.bz2.uu \ + tar/test/test_extract.tar.grz.uu \ + tar/test/test_extract.tar.gz.uu \ + tar/test/test_extract.tar.lrz.uu \ + tar/test/test_extract.tar.lz.uu \ + tar/test/test_extract.tar.lzma.uu \ + tar/test/test_extract.tar.lzo.uu \ + tar/test/test_extract.tar.xz.uu \ + tar/test/test_option_keep_newer_files.tar.Z.uu \ + tar/test/test_option_s.tar.Z.uu \ + tar/test/test_patterns_2.tar.uu \ + tar/test/test_patterns_3.tar.uu \ + tar/test/test_patterns_4.tar.uu \ + tar/test/test_print_longpath.tar.Z.uu \ + tar/test/CMakeLists.txt + + +# +# +# bsdcpio source, docs, etc. +# +# + +bsdcpio_SOURCES= \ + cpio/cmdline.c \ + cpio/cpio.c \ + cpio/cpio.h \ + cpio/cpio_platform.h + +if INC_WINDOWS_FILES +bsdcpio_SOURCES+= \ + cpio/cpio_windows.h \ + cpio/cpio_windows.c +endif + +bsdcpio_DEPENDENCIES = libarchive.la libarchive_fe.la + + +if STATIC_BSDCPIO +bsdcpio_ldstatic= -static +bsdcpio_ccstatic= -DLIBARCHIVE_STATIC +else +bsdcpio_ldstatic= +bsdcpio_ccstatic= +endif + +bsdcpio_LDADD= libarchive_fe.la libarchive.la $(LTLIBICONV) +bsdcpio_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcpio_ccstatic) $(PLATFORMCPPFLAGS) +bsdcpio_LDFLAGS= $(bsdcpio_ldstatic) + +bsdcpio_EXTRA_DIST= \ + cpio/bsdcpio.1 \ + cpio/cpio_windows.h \ + cpio/cpio_windows.c \ + cpio/CMakeLists.txt \ + cpio/config_freebsd.h + + +if BUILD_BSDCPIO +# Manpages to install +bsdcpio_man_MANS= cpio/bsdcpio.1 +bsdcpio_programs= bsdcpio +else +bsdcpio_man_MANS= +bsdcpio_programs= +endif + +# +# bsdcpio_test +# + +bsdcpio_test_SOURCES= \ + $(test_utils_SOURCES) \ + cpio/cmdline.c \ + cpio/test/main.c \ + cpio/test/test.h \ + cpio/test/test_0.c \ + cpio/test/test_basic.c \ + cpio/test/test_cmdline.c \ + cpio/test/test_extract_cpio_Z.c \ + cpio/test/test_extract_cpio_bz2.c \ + cpio/test/test_extract_cpio_grz.c \ + cpio/test/test_extract_cpio_gz.c \ + cpio/test/test_extract_cpio_lrz.c \ + cpio/test/test_extract_cpio_lz.c \ + cpio/test/test_extract_cpio_lzma.c \ + cpio/test/test_extract_cpio_lzo.c \ + cpio/test/test_extract_cpio_xz.c \ + cpio/test/test_format_newc.c \ + cpio/test/test_gcpio_compat.c \ + cpio/test/test_option_0.c \ + cpio/test/test_option_B_upper.c \ + cpio/test/test_option_C_upper.c \ + cpio/test/test_option_J_upper.c \ + cpio/test/test_option_L_upper.c \ + cpio/test/test_option_Z_upper.c \ + cpio/test/test_option_a.c \ + cpio/test/test_option_b64encode.c \ + cpio/test/test_option_c.c \ + cpio/test/test_option_d.c \ + cpio/test/test_option_f.c \ + cpio/test/test_option_grzip.c \ + cpio/test/test_option_help.c \ + cpio/test/test_option_l.c \ + cpio/test/test_option_lrzip.c \ + cpio/test/test_option_lzma.c \ + cpio/test/test_option_lzop.c \ + cpio/test/test_option_m.c \ + cpio/test/test_option_t.c \ + cpio/test/test_option_u.c \ + cpio/test/test_option_uuencode.c \ + cpio/test/test_option_version.c \ + cpio/test/test_option_xz.c \ + cpio/test/test_option_y.c \ + cpio/test/test_option_z.c \ + cpio/test/test_owner_parse.c \ + cpio/test/test_passthrough_dotdot.c \ + cpio/test/test_passthrough_reverse.c + +bsdcpio_test_CPPFLAGS= \ + -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \ + -I$(top_srcdir)/test_utils \ + -I$(top_srcdir)/cpio -I$(top_builddir)/cpio/test \ + $(PLATFORMCPPFLAGS) +bsdcpio_test_LDADD=libarchive_fe.la + +cpio/test/list.h: Makefile + cat $(top_srcdir)/cpio/test/test_*.c | grep DEFINE_TEST > cpio/test/list.h + +if BUILD_BSDCPIO +bsdcpio_test_programs= bsdcpio_test +bsdcpio_TESTS_ENVIRONMENT= BSDCPIO=`cd $(top_builddir);/bin/pwd`/bsdcpio$(EXEEXT) BSDCPIO_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cpio/test +else +bsdcpio_test_programs= +bsdcpio_TESTS_ENVIRONMENT= +endif + +bsdcpio_test_EXTRA_DIST= \ + cpio/test/list.h \ + cpio/test/test_extract.cpio.Z.uu \ + cpio/test/test_extract.cpio.bz2.uu \ + cpio/test/test_extract.cpio.grz.uu \ + cpio/test/test_extract.cpio.gz.uu \ + cpio/test/test_extract.cpio.lrz.uu \ + cpio/test/test_extract.cpio.lz.uu \ + cpio/test/test_extract.cpio.lzma.uu \ + cpio/test/test_extract.cpio.lzo.uu \ + cpio/test/test_extract.cpio.xz.uu \ + cpio/test/test_gcpio_compat_ref.bin.uu \ + cpio/test/test_gcpio_compat_ref.crc.uu \ + cpio/test/test_gcpio_compat_ref.newc.uu \ + cpio/test/test_gcpio_compat_ref.ustar.uu \ + cpio/test/test_gcpio_compat_ref_nosym.bin.uu \ + cpio/test/test_gcpio_compat_ref_nosym.crc.uu \ + cpio/test/test_gcpio_compat_ref_nosym.newc.uu \ + cpio/test/test_gcpio_compat_ref_nosym.ustar.uu \ + cpio/test/test_option_f.cpio.uu \ + cpio/test/test_option_m.cpio.uu \ + cpio/test/test_option_t.cpio.uu \ + cpio/test/test_option_t.stdout.uu \ + cpio/test/test_option_tv.stdout.uu \ + cpio/test/CMakeLists.txt diff --git a/build/README.txt b/build/README.txt new file mode 100644 index 000000000000..ce8e1a32a577 --- /dev/null +++ b/build/README.txt @@ -0,0 +1,35 @@ +Notes on making a new release of libarchive +=========================================== + +The following serves as a guide for libarchive developers on the general +process to be followed when making a new release of libarchive. + +* Update build/version with the version number of the release to be made. +* If the library's ABI has changed, the library's soname major version *MUST* + be updated. Update configure.ac and CMakeLists.txt appropriately. + - For configure.ac, the variable ARCHIVE_INTERFACE needs to be updated. + - For CMakeLists.txt, the variable INTERFACE_VERSION needs to be updated. +* Update the entries in the NEWS file accordingly. +* Run `build/makerelease.sh` from the top source directory. Running this script + will do the following. + - Removes all Makefile.am development build specific CFLAGS from + Makefile.am. + - Update configure scripts and header files with the appropriate version + number from build/version. + - Rebuild the documentation directory. + - Runs a full cmake build and test. + - Runs a full autotools build and test. + - Builds the .tar.gz and .zip distribution files. +* Commit all changed files into git. + - This should be build/version, NEWS, and the files edited by running + build/makerelease.sh. +* Tag the release appropriately. The tag should also have an appropriate + message. + - The git command is as follows: + $ git tag -m "Libarchive " v + Replace with the version to be released. +* Copy all the generated wiki files and commit them into the libarchive.wiki + repository. Overwrite any preexisting files with the same name (these files + are always autogenerated from the libarchive release after every release). +* Update the libarchive.org website accordingly. +* Make an announcement to the libarchive-announce mailing list. diff --git a/build/autoconf/check_stdcall_func.m4 b/build/autoconf/check_stdcall_func.m4 new file mode 100644 index 000000000000..926b046c5330 --- /dev/null +++ b/build/autoconf/check_stdcall_func.m4 @@ -0,0 +1,51 @@ +# AC_LANG_STDCALL_FUNC_LINK_TRY(FUNCTION, SIGNATURE) +# ------------------------------- +# Produce a source which links correctly iff the FUNCTION exists. +AC_DEFUN([AC_LANG_STDCALL_FUNC_LINK_TRY], +[_AC_LANG_DISPATCH([$0], _AC_LANG, $@)]) + +# AC_CHECK_STDCALL_FUNC(FUNCTION, SIGNATURE, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# ----------------------------------------------------------------- +AC_DEFUN([AC_CHECK_STDCALL_FUNC], +[AS_VAR_PUSHDEF([ac_var], [ac_cv_func_$1])dnl +AC_CACHE_CHECK([for $1], ac_var, +[AC_LINK_IFELSE([AC_LANG_STDCALL_FUNC_LINK_TRY([$1],[$2])], + [AS_VAR_SET(ac_var, yes)], + [AS_VAR_SET(ac_var, no)])]) +AS_IF([test AS_VAR_GET(ac_var) = yes], [$3], [$4])dnl +AS_VAR_POPDEF([ac_var])dnl +])# AC_CHECK_FUNC + +# AC_LANG_STDCALL_FUNC_LINK_TRY(C)(FUNCTION, SIGNATURE) +# ---------------------------------- +# Don't include because on OSF/1 3.0 it includes +# which includes which contains a +# prototype for select. Similarly for bzero. +m4_define([AC_LANG_STDCALL_FUNC_LINK_TRY(C)], +[AC_LANG_PROGRAM( +[/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char __stdcall $1 ( $2 ) below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char __stdcall $1 ( $2 ); +char (*f) ( $2 ); +], +[/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$1) || defined (__stub___$1) +choke me +#else +f = $1; +#endif +])]) + +# AC_LANG_STDCALL_FUNC_LINK_TRY(C++)(FUNCTION) +# ------------------------------------ +m4_copy([AC_LANG_STDCALL_FUNC_LINK_TRY(C)], [AC_LANG_STDCALL_FUNC_LINK_TRY(C++)]) + diff --git a/build/autoconf/config.rpath b/build/autoconf/config.rpath new file mode 100755 index 000000000000..8a8cf8edec5e --- /dev/null +++ b/build/autoconf/config.rpath @@ -0,0 +1,696 @@ +#! /bin/sh +# +# NOTE: This file was brought from +# http://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/config.rpath +# You should sometimes check if the file is updated and bring it to +# our trunk and copy this note to the top of that file. +# +# Output a system dependent set of variables, describing how to set the +# run time search path of shared libraries in an executable. +# +# Copyright 1996-2011 Free Software Foundation, Inc. +# Taken from GNU libtool, 2001 +# Originally by Gordon Matzigkeit , 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# The first argument passed to this file is the canonical host specification, +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld +# should be set by the caller. +# +# The set of defined variables is at the end of this script. + +# Known limitations: +# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer +# than 256 bytes, otherwise the compiler driver will dump core. The only +# known workaround is to choose shorter directory names for the build +# directory and/or the installation directory. + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a +shrext=.so + +host="$1" +host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` +host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` +host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` + +# Code taken from libtool.m4's _LT_CC_BASENAME. + +for cc_temp in $CC""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` + +# Code taken from libtool.m4's _LT_COMPILER_PIC. + +wl= +if test "$GCC" = yes; then + wl='-Wl,' +else + case "$host_os" in + aix*) + wl='-Wl,' + ;; + mingw* | cygwin* | pw32* | os2* | cegcc*) + ;; + hpux9* | hpux10* | hpux11*) + wl='-Wl,' + ;; + irix5* | irix6* | nonstopux*) + wl='-Wl,' + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + ecc*) + wl='-Wl,' + ;; + icc* | ifort*) + wl='-Wl,' + ;; + lf95*) + wl='-Wl,' + ;; + nagfor*) + wl='-Wl,-Wl,,' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + wl='-Wl,' + ;; + ccc*) + wl='-Wl,' + ;; + xl* | bgxl* | bgf* | mpixl*) + wl='-Wl,' + ;; + como) + wl='-lopt=' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ F* | *Sun*Fortran*) + wl= + ;; + *Sun\ C*) + wl='-Wl,' + ;; + esac + ;; + esac + ;; + newsos6) + ;; + *nto* | *qnx*) + ;; + osf3* | osf4* | osf5*) + wl='-Wl,' + ;; + rdos*) + ;; + solaris*) + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + wl='-Qoption ld ' + ;; + *) + wl='-Wl,' + ;; + esac + ;; + sunos4*) + wl='-Qoption ld ' + ;; + sysv4 | sysv4.2uw2* | sysv4.3*) + wl='-Wl,' + ;; + sysv4*MP*) + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + wl='-Wl,' + ;; + unicos*) + wl='-Wl,' + ;; + uts4*) + ;; + esac +fi + +# Code taken from libtool.m4's _LT_LINKER_SHLIBS. + +hardcode_libdir_flag_spec= +hardcode_libdir_separator= +hardcode_direct=no +hardcode_minus_L=no + +case "$host_os" in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; +esac + +ld_shlibs=yes +if test "$with_gnu_ld" = yes; then + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + # Unlike libtool, we use -rpath here, not --rpath, since the documented + # option of GNU ld is called -rpath, not --rpath. + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + case "$host_os" in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + beos*) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + cygwin* | mingw* | pw32* | cegcc*) + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + haiku*) + ;; + interix[3-9]*) + hardcode_direct=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + netbsd*) + ;; + solaris*) + if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' + else + ld_shlibs=no + fi + ;; + esac + ;; + sunos4*) + hardcode_direct=yes + ;; + *) + if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then + : + else + ld_shlibs=no + fi + ;; + esac + if test "$ld_shlibs" = no; then + hardcode_libdir_flag_spec= + fi +else + case "$host_os" in + aix3*) + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + else + aix_use_runtimelinking=no + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + fi + hardcode_direct=yes + hardcode_libdir_separator=':' + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && \ + strings "$collect2name" | grep resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + fi + # Begin _LT_AC_SYS_LIBPATH_AIX. + echo 'int main () { return 0; }' > conftest.c + ${CC} ${LDFLAGS} conftest.c -o conftest + aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + if test -z "$aix_libpath"; then + aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } +}'` + fi + if test -z "$aix_libpath"; then + aix_libpath="/usr/lib:/lib" + fi + rm -f conftest.c conftest + # End _LT_AC_SYS_LIBPATH_AIX. + if test "$aix_use_runtimelinking" = yes; then + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + else + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + fi + fi + ;; + amigaos*) + case "$host_cpu" in + powerpc) + ;; + m68k) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + bsdi[45]*) + ;; + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + hardcode_libdir_flag_spec=' ' + libext=lib + ;; + darwin* | rhapsody*) + hardcode_direct=no + if { case $cc_basename in ifort*) true;; *) test "$GCC" = yes;; esac; }; then + : + else + ld_shlibs=no + fi + ;; + dgux*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + freebsd2.2*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + freebsd2*) + hardcode_direct=yes + hardcode_minus_L=yes + ;; + freebsd* | dragonfly*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + hpux9*) + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + hpux10*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + hpux11*) + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + ;; + *) + hardcode_direct=yes + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + irix5* | irix6* | nonstopux*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + netbsd*) + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + ;; + newsos6) + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + *nto* | *qnx*) + ;; + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + else + case "$host_os" in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + osf3*) + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + osf4* | osf5*) + if test "$GCC" = yes; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + # Both cc and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + hardcode_libdir_separator=: + ;; + solaris*) + hardcode_libdir_flag_spec='-R$libdir' + ;; + sunos4*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + ;; + sysv4) + case $host_vendor in + sni) + hardcode_direct=yes # is this really true??? + ;; + siemens) + hardcode_direct=no + ;; + motorola) + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + ;; + sysv4.3*) + ;; + sysv4*MP*) + if test -d /usr/nec; then + ld_shlibs=yes + fi + ;; + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + ;; + sysv5* | sco3.2v5* | sco5v6*) + hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' + hardcode_libdir_separator=':' + ;; + uts4*) + hardcode_libdir_flag_spec='-L$libdir' + ;; + *) + ld_shlibs=no + ;; + esac +fi + +# Check dynamic linker characteristics +# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER. +# Unlike libtool.m4, here we don't care about _all_ names of the library, but +# only about the one the linker finds when passed -lNAME. This is the last +# element of library_names_spec in libtool.m4, or possibly two of them if the +# linker has special search rules. +library_names_spec= # the last element of library_names_spec in libtool.m4 +libname_spec='lib$name' +case "$host_os" in + aix3*) + library_names_spec='$libname.a' + ;; + aix[4-9]*) + library_names_spec='$libname$shrext' + ;; + amigaos*) + case "$host_cpu" in + powerpc*) + library_names_spec='$libname$shrext' ;; + m68k) + library_names_spec='$libname.a' ;; + esac + ;; + beos*) + library_names_spec='$libname$shrext' + ;; + bsdi[45]*) + library_names_spec='$libname$shrext' + ;; + cygwin* | mingw* | pw32* | cegcc*) + shrext=.dll + library_names_spec='$libname.dll.a $libname.lib' + ;; + darwin* | rhapsody*) + shrext=.dylib + library_names_spec='$libname$shrext' + ;; + dgux*) + library_names_spec='$libname$shrext' + ;; + freebsd* | dragonfly*) + case "$host_os" in + freebsd[123]*) + library_names_spec='$libname$shrext$versuffix' ;; + *) + library_names_spec='$libname$shrext' ;; + esac + ;; + gnu*) + library_names_spec='$libname$shrext' + ;; + haiku*) + library_names_spec='$libname$shrext' + ;; + hpux9* | hpux10* | hpux11*) + case $host_cpu in + ia64*) + shrext=.so + ;; + hppa*64*) + shrext=.sl + ;; + *) + shrext=.sl + ;; + esac + library_names_spec='$libname$shrext' + ;; + interix[3-9]*) + library_names_spec='$libname$shrext' + ;; + irix5* | irix6* | nonstopux*) + library_names_spec='$libname$shrext' + case "$host_os" in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; + *) libsuff= shlibsuff= ;; + esac + ;; + esac + ;; + linux*oldld* | linux*aout* | linux*coff*) + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + library_names_spec='$libname$shrext' + ;; + knetbsd*-gnu) + library_names_spec='$libname$shrext' + ;; + netbsd*) + library_names_spec='$libname$shrext' + ;; + newsos6) + library_names_spec='$libname$shrext' + ;; + *nto* | *qnx*) + library_names_spec='$libname$shrext' + ;; + openbsd*) + library_names_spec='$libname$shrext$versuffix' + ;; + os2*) + libname_spec='$name' + shrext=.dll + library_names_spec='$libname.a' + ;; + osf3* | osf4* | osf5*) + library_names_spec='$libname$shrext' + ;; + rdos*) + ;; + solaris*) + library_names_spec='$libname$shrext' + ;; + sunos4*) + library_names_spec='$libname$shrext$versuffix' + ;; + sysv4 | sysv4.3*) + library_names_spec='$libname$shrext' + ;; + sysv4*MP*) + library_names_spec='$libname$shrext' + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + library_names_spec='$libname$shrext' + ;; + tpf*) + library_names_spec='$libname$shrext' + ;; + uts4*) + library_names_spec='$libname$shrext' + ;; +esac + +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' +escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` +shlibext=`echo "$shrext" | sed -e 's,^\.,,'` +escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` +escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` + +LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' < +#include + ]], + [[iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);]])], + [am_cv_func_iconv=yes]) + if test "$am_cv_func_iconv" != yes; then + am_save_LIBS="$LIBS" + LIBS="$LIBS $LIBICONV" + AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include + ]], + [[iconv_t cd = iconv_open("",""); + iconv(cd,NULL,NULL,NULL,NULL); + iconv_close(cd);]])], + [am_cv_lib_iconv=yes] + [am_cv_func_iconv=yes]) + LIBS="$am_save_LIBS" + fi + ]) + if test "$am_cv_func_iconv" = yes; then + AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [ + dnl This tests against bugs in AIX 5.1, AIX 6.1..7.1, HP-UX 11.11, + dnl Solaris 10. + am_save_LIBS="$LIBS" + if test $am_cv_lib_iconv = yes; then + LIBS="$LIBS $LIBICONV" + fi + AC_RUN_IFELSE( + [AC_LANG_SOURCE([[ +#include +#include +int main () +{ + int result = 0; + /* Test against AIX 5.1 bug: Failures are not distinguishable from successful + returns. */ + { + iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); + if (cd_utf8_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\342\202\254"; /* EURO SIGN */ + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_utf8_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 1; + iconv_close (cd_utf8_to_88591); + } + } + /* Test against Solaris 10 bug: Failures are not distinguishable from + successful returns. */ + { + iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); + if (cd_ascii_to_88591 != (iconv_t)(-1)) + { + static const char input[] = "\263"; + char buf[10]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_ascii_to_88591, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res == 0) + result |= 2; + iconv_close (cd_ascii_to_88591); + } + } + /* Test against AIX 6.1..7.1 bug: Buffer overrun. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304"; + static char buf[2] = { (char)0xDE, (char)0xAD }; + const char *inptr = input; + size_t inbytesleft = 1; + char *outptr = buf; + size_t outbytesleft = 1; + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) + result |= 4; + iconv_close (cd_88591_to_utf8); + } + } +#if 0 /* This bug could be worked around by the caller. */ + /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ + { + iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); + if (cd_88591_to_utf8 != (iconv_t)(-1)) + { + static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + char buf[50]; + const char *inptr = input; + size_t inbytesleft = strlen (input); + char *outptr = buf; + size_t outbytesleft = sizeof (buf); + size_t res = iconv (cd_88591_to_utf8, + (char **) &inptr, &inbytesleft, + &outptr, &outbytesleft); + if ((int)res > 0) + result |= 8; + iconv_close (cd_88591_to_utf8); + } + } +#endif + /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is + provided. */ + if (/* Try standardized names. */ + iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) + /* Try IRIX, OSF/1 names. */ + && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) + /* Try AIX names. */ + && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) + /* Try HP-UX names. */ + && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) + result |= 16; + return result; +}]])], + [am_cv_func_iconv_works=yes], + [am_cv_func_iconv_works=no], + [ +changequote(,)dnl + case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac +changequote([,])dnl + ]) + LIBS="$am_save_LIBS" + ]) + case "$am_cv_func_iconv_works" in + *no) am_func_iconv=no am_cv_lib_iconv=no ;; + *) am_func_iconv=yes ;; + esac + else + am_func_iconv=no am_cv_lib_iconv=no + fi + if test "$am_func_iconv" = yes; then + AC_DEFINE([HAVE_ICONV], [1], + [Define if you have the iconv() function and it works.]) + fi + if test "$am_cv_lib_iconv" = yes; then + AC_MSG_CHECKING([how to link with libiconv]) + AC_MSG_RESULT([$LIBICONV]) + else + dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV + dnl either. + CPPFLAGS="$am_save_CPPFLAGS" + LIBICONV= + LTLIBICONV= + fi + AC_SUBST([LIBICONV]) + AC_SUBST([LTLIBICONV]) +]) + +dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to +dnl avoid warnings like +dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". +dnl This is tricky because of the way 'aclocal' is implemented: +dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. +dnl Otherwise aclocal's initial scan pass would miss the macro definition. +dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. +dnl Otherwise aclocal would emit many "Use of uninitialized value $1" +dnl warnings. +m4_define([gl_iconv_AC_DEFUN], + m4_version_prereq([2.64], + [[AC_DEFUN_ONCE( + [$1], [$2])]], + [m4_ifdef([gl_00GNULIB], + [[AC_DEFUN_ONCE( + [$1], [$2])]], + [[AC_DEFUN( + [$1], [$2])]])])) +gl_iconv_AC_DEFUN([AM_ICONV], +[ + AM_ICONV_LINK + if test "$am_cv_func_iconv" = yes; then + AC_MSG_CHECKING([for iconv declaration]) + AC_CACHE_VAL([am_cv_proto_iconv], [ + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [[ +#include +#include +extern +#ifdef __cplusplus +"C" +#endif +#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus) +size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft); +#else +size_t iconv(); +#endif + ]], + [[]])], + [am_cv_proto_iconv_arg1=""], + [am_cv_proto_iconv_arg1="const"]) + am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"]) + am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'` + AC_MSG_RESULT([ + $am_cv_proto_iconv]) + AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1], + [Define as const if the declaration of iconv() needs const.]) + dnl Also substitute ICONV_CONST in the gnulib generated . + m4_ifdef([gl_ICONV_H_DEFAULTS], + [AC_REQUIRE([gl_ICONV_H_DEFAULTS]) + if test -n "$am_cv_proto_iconv_arg1"; then + ICONV_CONST="const" + fi + ]) + fi +]) diff --git a/build/autoconf/la_uid_t.m4 b/build/autoconf/la_uid_t.m4 new file mode 100644 index 000000000000..31eef5e96fcb --- /dev/null +++ b/build/autoconf/la_uid_t.m4 @@ -0,0 +1,20 @@ +# la_TYPE_UID_T +# ------------- +AC_DEFUN([la_TYPE_UID_T], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_CACHE_CHECK(for uid_t in sys/types.h, la_cv_type_uid_t, +[AC_EGREP_HEADER(uid_t, sys/types.h, + la_cv_type_uid_t=yes, la_cv_type_uid_t=no)]) +if test $la_cv_type_uid_t = no; then + case $host in + *mingw*) def_uid_t=short ;; + *) def_uid_t=int ;; + esac + AC_DEFINE_UNQUOTED(uid_t, [$def_uid_t], + [Define to match typeof st_uid field of struct stat if doesn't define.]) + AC_DEFINE_UNQUOTED(gid_t, [$def_uid_t], + [Define to match typeof st_gid field of struct stat if doesn't define.]) +fi +]) +AU_ALIAS([AC_TYPE_UID_T], [la_TYPE_UID_T]) + diff --git a/build/autoconf/lib-ld.m4 b/build/autoconf/lib-ld.m4 new file mode 100644 index 000000000000..ae003f7c5943 --- /dev/null +++ b/build/autoconf/lib-ld.m4 @@ -0,0 +1,109 @@ +# lib-ld.m4 serial 5 (gettext-0.18.2) +dnl Copyright (C) 1996-2003, 2009-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Subroutines of libtool.m4, +dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision +dnl with libtool.m4. + +dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no. +AC_DEFUN([AC_LIB_PROG_LD_GNU], +[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld], +[# I'd rather use --version here, but apparently some GNU ld's only accept -v. +case `$LD -v 2>&1 /dev/null 2>&1 \ + && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 \ + || PATH_SEPARATOR=';' + } +fi +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by GCC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]* | [A-Za-z]:[\\/]*)] + [re_direlt='/[^/][^/]*/\.\./'] + # Canonicalize the path of ld + ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` + while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do + ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL([acl_cv_path_LD], +[if test -z "$LD"; then + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" + for ac_dir in $PATH; do + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + acl_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some GNU ld's only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in + *GNU* | *'with BFD'*) + test "$with_gnu_ld" != no && break ;; + *) + test "$with_gnu_ld" != yes && break ;; + esac + fi + done + IFS="$ac_save_ifs" +else + acl_cv_path_LD="$LD" # Let the user override the test with a path. +fi]) +LD="$acl_cv_path_LD" +if test -n "$LD"; then + AC_MSG_RESULT([$LD]) +else + AC_MSG_RESULT([no]) +fi +test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH]) +AC_LIB_PROG_LD_GNU +]) diff --git a/build/autoconf/lib-link.m4 b/build/autoconf/lib-link.m4 new file mode 100644 index 000000000000..e7c9ba9d3d71 --- /dev/null +++ b/build/autoconf/lib-link.m4 @@ -0,0 +1,777 @@ +# lib-link.m4 serial 26 (gettext-0.18.2) +dnl Copyright (C) 2001-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +AC_PREREQ([2.54]) + +dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and +dnl augments the CPPFLAGS variable. +dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname +dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + pushdef([Name],[m4_translit([$1],[./+-], [____])]) + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [ + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + ac_cv_lib[]Name[]_libs="$LIB[]NAME" + ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME" + ac_cv_lib[]Name[]_cppflags="$INC[]NAME" + ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX" + ]) + LIB[]NAME="$ac_cv_lib[]Name[]_libs" + LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs" + INC[]NAME="$ac_cv_lib[]Name[]_cppflags" + LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + AC_SUBST([LIB]NAME[_PREFIX]) + dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the + dnl results of this search when this library appears as a dependency. + HAVE_LIB[]NAME=yes + popdef([NAME]) + popdef([Name]) +]) + +dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message]) +dnl searches for libname and the libraries corresponding to explicit and +dnl implicit dependencies, together with the specified include files and +dnl the ability to compile and link the specified testcode. The missing-message +dnl defaults to 'no' and may contain additional hints for the user. +dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME} +dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and +dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs +dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty. +dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname +dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_HAVE_LINKFLAGS], +[ + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + AC_REQUIRE([AC_LIB_RPATH]) + pushdef([Name],[m4_translit([$1],[./+-], [____])]) + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + + dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME + dnl accordingly. + AC_LIB_LINKFLAGS_BODY([$1], [$2]) + + dnl Add $INC[]NAME to CPPFLAGS before performing the following checks, + dnl because if the user has installed lib[]Name and not disabled its use + dnl via --without-lib[]Name-prefix, he wants to use it. + ac_save_CPPFLAGS="$CPPFLAGS" + AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME) + + AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [ + ac_save_LIBS="$LIBS" + dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS, + dnl because these -l options might require -L options that are present in + dnl LIBS. -l options benefit only from the -L options listed before it. + dnl Otherwise, add it to the front of LIBS, because it may be a static + dnl library that depends on another static library that is present in LIBS. + dnl Static libraries benefit only from the static libraries listed after + dnl it. + case " $LIB[]NAME" in + *" -l"*) LIBS="$LIBS $LIB[]NAME" ;; + *) LIBS="$LIB[]NAME $LIBS" ;; + esac + AC_LINK_IFELSE( + [AC_LANG_PROGRAM([[$3]], [[$4]])], + [ac_cv_lib[]Name=yes], + [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])']) + LIBS="$ac_save_LIBS" + ]) + if test "$ac_cv_lib[]Name" = yes; then + HAVE_LIB[]NAME=yes + AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.]) + AC_MSG_CHECKING([how to link with lib[]$1]) + AC_MSG_RESULT([$LIB[]NAME]) + else + HAVE_LIB[]NAME=no + dnl If $LIB[]NAME didn't lead to a usable library, we don't need + dnl $INC[]NAME either. + CPPFLAGS="$ac_save_CPPFLAGS" + LIB[]NAME= + LTLIB[]NAME= + LIB[]NAME[]_PREFIX= + fi + AC_SUBST([HAVE_LIB]NAME) + AC_SUBST([LIB]NAME) + AC_SUBST([LTLIB]NAME) + AC_SUBST([LIB]NAME[_PREFIX]) + popdef([NAME]) + popdef([Name]) +]) + +dnl Determine the platform dependent parameters needed to use rpath: +dnl acl_libext, +dnl acl_shlibext, +dnl acl_libname_spec, +dnl acl_library_names_spec, +dnl acl_hardcode_libdir_flag_spec, +dnl acl_hardcode_libdir_separator, +dnl acl_hardcode_direct, +dnl acl_hardcode_minus_L. +AC_DEFUN([AC_LIB_RPATH], +[ + dnl Tell automake >= 1.10 to complain if config.rpath is missing. + m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])]) + AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS + AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld + AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host + AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir + AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [ + CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ + ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh + . ./conftest.sh + rm -f ./conftest.sh + acl_cv_rpath=done + ]) + wl="$acl_cv_wl" + acl_libext="$acl_cv_libext" + acl_shlibext="$acl_cv_shlibext" + acl_libname_spec="$acl_cv_libname_spec" + acl_library_names_spec="$acl_cv_library_names_spec" + acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" + acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" + acl_hardcode_direct="$acl_cv_hardcode_direct" + acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" + dnl Determine whether the user wants rpath handling at all. + AC_ARG_ENABLE([rpath], + [ --disable-rpath do not hardcode runtime library paths], + :, enable_rpath=yes) +]) + +dnl AC_LIB_FROMPACKAGE(name, package) +dnl declares that libname comes from the given package. The configure file +dnl will then not have a --with-libname-prefix option but a +dnl --with-package-prefix option. Several libraries can come from the same +dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar +dnl macro call that searches for libname. +AC_DEFUN([AC_LIB_FROMPACKAGE], +[ + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + define([acl_frompackage_]NAME, [$2]) + popdef([NAME]) + pushdef([PACK],[$2]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + define([acl_libsinpackage_]PACKUP, + m4_ifdef([acl_libsinpackage_]PACKUP, [m4_defn([acl_libsinpackage_]PACKUP)[, ]],)[lib$1]) + popdef([PACKUP]) + popdef([PACK]) +]) + +dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and +dnl the libraries corresponding to explicit and implicit dependencies. +dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables. +dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found +dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem. +AC_DEFUN([AC_LIB_LINKFLAGS_BODY], +[ + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + pushdef([NAME],[m4_translit([$1],[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])]) + pushdef([PACKUP],[m4_translit(PACK,[abcdefghijklmnopqrstuvwxyz./+-], + [ABCDEFGHIJKLMNOPQRSTUVWXYZ____])]) + pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])]) + dnl Autoconf >= 2.61 supports dots in --with options. + pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[m4_translit(PACK,[.],[_])],PACK)]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_ARG_WITH(P_A_C_K[-prefix], +[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib + --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + if test "$acl_libdirstem2" != "$acl_libdirstem" \ + && ! test -d "$withval/$acl_libdirstem"; then + additional_libdir="$withval/$acl_libdirstem2" + fi + fi + fi +]) + dnl Search the library and its dependencies in $additional_libdir and + dnl $LDFLAGS. Using breadth-first-seach. + LIB[]NAME= + LTLIB[]NAME= + INC[]NAME= + LIB[]NAME[]_PREFIX= + dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been + dnl computed. So it has to be reset here. + HAVE_LIB[]NAME= + rpathdirs= + ltrpathdirs= + names_already_handled= + names_next_round='$1 $2' + while test -n "$names_next_round"; do + names_this_round="$names_next_round" + names_next_round= + for name in $names_this_round; do + already_handled= + for n in $names_already_handled; do + if test "$n" = "$name"; then + already_handled=yes + break + fi + done + if test -z "$already_handled"; then + names_already_handled="$names_already_handled $name" + dnl See if it was already located by an earlier AC_LIB_LINKFLAGS + dnl or AC_LIB_HAVE_LINKFLAGS call. + uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./+-|ABCDEFGHIJKLMNOPQRSTUVWXYZ____|'` + eval value=\"\$HAVE_LIB$uppername\" + if test -n "$value"; then + if test "$value" = yes; then + eval value=\"\$LIB$uppername\" + test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value" + eval value=\"\$LTLIB$uppername\" + test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value" + else + dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined + dnl that this library doesn't exist. So just drop it. + : + fi + else + dnl Search the library lib$name in $additional_libdir and $LDFLAGS + dnl and the already constructed $LIBNAME/$LTLIBNAME. + found_dir= + found_la= + found_so= + found_a= + eval libname=\"$acl_libname_spec\" # typically: libname=lib$name + if test -n "$acl_shlibext"; then + shrext=".$acl_shlibext" # typically: shrext=.so + else + shrext= + fi + if test $use_additional = yes; then + dir="$additional_libdir" + dnl The same code as in the loop below: + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + fi + if test "X$found_dir" = "X"; then + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + case "$x" in + -L*) + dir=`echo "X$x" | sed -e 's/^X-L//'` + dnl First look for a shared library. + if test -n "$acl_shlibext"; then + if test -f "$dir/$libname$shrext"; then + found_dir="$dir" + found_so="$dir/$libname$shrext" + else + if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then + ver=`(cd "$dir" && \ + for f in "$libname$shrext".*; do echo "$f"; done \ + | sed -e "s,^$libname$shrext\\\\.,," \ + | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ + | sed 1q ) 2>/dev/null` + if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then + found_dir="$dir" + found_so="$dir/$libname$shrext.$ver" + fi + else + eval library_names=\"$acl_library_names_spec\" + for f in $library_names; do + if test -f "$dir/$f"; then + found_dir="$dir" + found_so="$dir/$f" + break + fi + done + fi + fi + fi + dnl Then look for a static library. + if test "X$found_dir" = "X"; then + if test -f "$dir/$libname.$acl_libext"; then + found_dir="$dir" + found_a="$dir/$libname.$acl_libext" + fi + fi + if test "X$found_dir" != "X"; then + if test -f "$dir/$libname.la"; then + found_la="$dir/$libname.la" + fi + fi + ;; + esac + if test "X$found_dir" != "X"; then + break + fi + done + fi + if test "X$found_dir" != "X"; then + dnl Found the library. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name" + if test "X$found_so" != "X"; then + dnl Linking with a shared library. We attempt to hardcode its + dnl directory into the executable's runpath, unless it's the + dnl standard /usr/lib. + if test "$enable_rpath" = no \ + || test "X$found_dir" = "X/usr/$acl_libdirstem" \ + || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then + dnl No hardcoding is needed. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $found_dir" + fi + dnl The hardcoding into $LIBNAME is system dependent. + if test "$acl_hardcode_direct" = yes; then + dnl Using DIR/libNAME.so during linking hardcodes DIR into the + dnl resulting binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode DIR into the resulting + dnl binary. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $found_dir" + fi + else + dnl Rely on "-L$found_dir". + dnl But don't add it if it's already contained in the LDFLAGS + dnl or the already constructed $LIBNAME + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$found_dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir" + fi + if test "$acl_hardcode_minus_L" != no; then + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so" + else + dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH + dnl here, because this doesn't fit in flags passed to the + dnl compiler. So give up. No hardcoding. This affects only + dnl very old systems. + dnl FIXME: Not sure whether we should use + dnl "-L$found_dir -l$name" or "-L$found_dir $found_so" + dnl here. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + fi + fi + fi + fi + else + if test "X$found_a" != "X"; then + dnl Linking with a static library. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a" + else + dnl We shouldn't come here, but anyway it's good to have a + dnl fallback. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name" + fi + fi + dnl Assume the include files are nearby. + additional_includedir= + case "$found_dir" in + */$acl_libdirstem | */$acl_libdirstem/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + */$acl_libdirstem2 | */$acl_libdirstem2/) + basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` + if test "$name" = '$1'; then + LIB[]NAME[]_PREFIX="$basedir" + fi + additional_includedir="$basedir/include" + ;; + esac + if test "X$additional_includedir" != "X"; then + dnl Potentially add $additional_includedir to $INCNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's /usr/local/include and we are using GCC on Linux, + dnl 3. if it's already present in $CPPFLAGS or the already + dnl constructed $INCNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + for x in $CPPFLAGS $INC[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $INCNAME. + INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir" + fi + fi + fi + fi + fi + dnl Look for dependencies. + if test -n "$found_la"; then + dnl Read the .la file. It defines the variables + dnl dlname, library_names, old_library, dependency_libs, current, + dnl age, revision, installed, dlopen, dlpreopen, libdir. + save_libdir="$libdir" + case "$found_la" in + */* | *\\*) . "$found_la" ;; + *) . "./$found_la" ;; + esac + libdir="$save_libdir" + dnl We use only dependency_libs. + for dep in $dependency_libs; do + case "$dep" in + -L*) + additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` + dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's /usr/local/lib and we are using GCC on Linux, + dnl 3. if it's already present in $LDFLAGS or the already + dnl constructed $LIBNAME, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ + && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then + haveit= + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ + || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + haveit= + for x in $LDFLAGS $LIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LIBNAME. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir" + fi + fi + haveit= + for x in $LDFLAGS $LTLIB[]NAME; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LTLIBNAME. + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir" + fi + fi + fi + fi + ;; + -R*) + dir=`echo "X$dep" | sed -e 's/^X-R//'` + if test "$enable_rpath" != no; then + dnl Potentially add DIR to rpathdirs. + dnl The rpathdirs will be appended to $LIBNAME at the end. + haveit= + for x in $rpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + rpathdirs="$rpathdirs $dir" + fi + dnl Potentially add DIR to ltrpathdirs. + dnl The ltrpathdirs will be appended to $LTLIBNAME at the end. + haveit= + for x in $ltrpathdirs; do + if test "X$x" = "X$dir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + ltrpathdirs="$ltrpathdirs $dir" + fi + fi + ;; + -l*) + dnl Handle this in the next round. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` + ;; + *.la) + dnl Handle this in the next round. Throw away the .la's + dnl directory; it is already contained in a preceding -L + dnl option. + names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` + ;; + *) + dnl Most likely an immediate library name. + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep" + ;; + esac + done + fi + else + dnl Didn't find the library; assume it is in the system directories + dnl known to the linker and runtime loader. (All the system + dnl directories known to the linker should also be known to the + dnl runtime loader, otherwise the system is severely misconfigured.) + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name" + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name" + fi + fi + fi + done + done + if test "X$rpathdirs" != "X"; then + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user must + dnl pass all path elements in one option. We can arrange that for a + dnl single library, but not when more than one $LIBNAMEs are used. + alldirs= + for found_dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" + done + dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl. + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + else + dnl The -rpath options are cumulative. + for found_dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$found_dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag" + done + fi + fi + if test "X$ltrpathdirs" != "X"; then + dnl When using libtool, the option that works for both libraries and + dnl executables is -R. The -R options are cumulative. + for found_dir in $ltrpathdirs; do + LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir" + done + fi + popdef([P_A_C_K]) + popdef([PACKLIBS]) + popdef([PACKUP]) + popdef([PACK]) + popdef([NAME]) +]) + +dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR, +dnl unless already present in VAR. +dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes +dnl contains two or three consecutive elements that belong together. +AC_DEFUN([AC_LIB_APPENDTOVAR], +[ + for element in [$2]; do + haveit= + for x in $[$1]; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X$element"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + [$1]="${[$1]}${[$1]:+ }$element" + fi + done +]) + +dnl For those cases where a variable contains several -L and -l options +dnl referring to unknown libraries and directories, this macro determines the +dnl necessary additional linker options for the runtime path. +dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL]) +dnl sets LDADDVAR to linker options needed together with LIBSVALUE. +dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed, +dnl otherwise linking without libtool is assumed. +AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], +[ + AC_REQUIRE([AC_LIB_RPATH]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + $1= + if test "$enable_rpath" != no; then + if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then + dnl Use an explicit option to hardcode directories into the resulting + dnl binary. + rpathdirs= + next= + for opt in $2; do + if test -n "$next"; then + dir="$next" + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then + rpathdirs="$rpathdirs $dir" + fi + next= + else + case $opt in + -L) next=yes ;; + -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'` + dnl No need to hardcode the standard /usr/lib. + if test "X$dir" != "X/usr/$acl_libdirstem" \ + && test "X$dir" != "X/usr/$acl_libdirstem2"; then + rpathdirs="$rpathdirs $dir" + fi + next= ;; + *) next= ;; + esac + fi + done + if test "X$rpathdirs" != "X"; then + if test -n ""$3""; then + dnl libtool is used for linking. Use -R options. + for dir in $rpathdirs; do + $1="${$1}${$1:+ }-R$dir" + done + else + dnl The linker is used for linking directly. + if test -n "$acl_hardcode_libdir_separator"; then + dnl Weird platform: only the last -rpath option counts, the user + dnl must pass all path elements in one option. + alldirs= + for dir in $rpathdirs; do + alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir" + done + acl_save_libdir="$libdir" + libdir="$alldirs" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="$flag" + else + dnl The -rpath options are cumulative. + for dir in $rpathdirs; do + acl_save_libdir="$libdir" + libdir="$dir" + eval flag=\"$acl_hardcode_libdir_flag_spec\" + libdir="$acl_save_libdir" + $1="${$1}${$1:+ }$flag" + done + fi + fi + fi + fi + fi + AC_SUBST([$1]) +]) diff --git a/build/autoconf/lib-prefix.m4 b/build/autoconf/lib-prefix.m4 new file mode 100644 index 000000000000..7e5f0bde03d8 --- /dev/null +++ b/build/autoconf/lib-prefix.m4 @@ -0,0 +1,224 @@ +# lib-prefix.m4 serial 7 (gettext-0.18) +dnl Copyright (C) 2001-2005, 2008-2011 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl From Bruno Haible. + +dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and +dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't +dnl require excessive bracketing. +ifdef([AC_HELP_STRING], +[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])], +[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])]) + +dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed +dnl to access previously installed libraries. The basic assumption is that +dnl a user will want packages to use other packages he previously installed +dnl with the same --prefix option. +dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate +dnl libraries, but is otherwise very convenient. +AC_DEFUN([AC_LIB_PREFIX], +[ + AC_BEFORE([$0], [AC_LIB_LINKFLAGS]) + AC_REQUIRE([AC_PROG_CC]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([AC_LIB_PREPARE_MULTILIB]) + AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) + dnl By default, look in $includedir and $libdir. + use_additional=yes + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + AC_LIB_ARG_WITH([lib-prefix], +[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib + --without-lib-prefix don't search for libraries in includedir and libdir], +[ + if test "X$withval" = "Xno"; then + use_additional=no + else + if test "X$withval" = "X"; then + AC_LIB_WITH_FINAL_PREFIX([ + eval additional_includedir=\"$includedir\" + eval additional_libdir=\"$libdir\" + ]) + else + additional_includedir="$withval/include" + additional_libdir="$withval/$acl_libdirstem" + fi + fi +]) + if test $use_additional = yes; then + dnl Potentially add $additional_includedir to $CPPFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/include, + dnl 2. if it's already present in $CPPFLAGS, + dnl 3. if it's /usr/local/include and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_includedir" != "X/usr/include"; then + haveit= + for x in $CPPFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-I$additional_includedir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_includedir" = "X/usr/local/include"; then + if test -n "$GCC"; then + case $host_os in + linux* | gnu* | k*bsd*-gnu) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_includedir"; then + dnl Really add $additional_includedir to $CPPFLAGS. + CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir" + fi + fi + fi + fi + dnl Potentially add $additional_libdir to $LDFLAGS. + dnl But don't add it + dnl 1. if it's the standard /usr/lib, + dnl 2. if it's already present in $LDFLAGS, + dnl 3. if it's /usr/local/lib and we are using GCC on Linux, + dnl 4. if it doesn't exist as a directory. + if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then + haveit= + for x in $LDFLAGS; do + AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"]) + if test "X$x" = "X-L$additional_libdir"; then + haveit=yes + break + fi + done + if test -z "$haveit"; then + if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then + if test -n "$GCC"; then + case $host_os in + linux*) haveit=yes;; + esac + fi + fi + if test -z "$haveit"; then + if test -d "$additional_libdir"; then + dnl Really add $additional_libdir to $LDFLAGS. + LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir" + fi + fi + fi + fi + fi +]) + +dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix, +dnl acl_final_exec_prefix, containing the values to which $prefix and +dnl $exec_prefix will expand at the end of the configure script. +AC_DEFUN([AC_LIB_PREPARE_PREFIX], +[ + dnl Unfortunately, prefix and exec_prefix get only finally determined + dnl at the end of configure. + if test "X$prefix" = "XNONE"; then + acl_final_prefix="$ac_default_prefix" + else + acl_final_prefix="$prefix" + fi + if test "X$exec_prefix" = "XNONE"; then + acl_final_exec_prefix='${prefix}' + else + acl_final_exec_prefix="$exec_prefix" + fi + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the +dnl variables prefix and exec_prefix bound to the values they will have +dnl at the end of the configure script. +AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX], +[ + acl_save_prefix="$prefix" + prefix="$acl_final_prefix" + acl_save_exec_prefix="$exec_prefix" + exec_prefix="$acl_final_exec_prefix" + $1 + exec_prefix="$acl_save_exec_prefix" + prefix="$acl_save_prefix" +]) + +dnl AC_LIB_PREPARE_MULTILIB creates +dnl - a variable acl_libdirstem, containing the basename of the libdir, either +dnl "lib" or "lib64" or "lib/64", +dnl - a variable acl_libdirstem2, as a secondary possible value for +dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or +dnl "lib/amd64". +AC_DEFUN([AC_LIB_PREPARE_MULTILIB], +[ + dnl There is no formal standard regarding lib and lib64. + dnl On glibc systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine + dnl the compiler's default mode by looking at the compiler's library search + dnl path. If at least one of its elements ends in /lib64 or points to a + dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI. + dnl Otherwise we use the default, namely "lib". + dnl On Solaris systems, the current practice is that on a system supporting + dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under + dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or + dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib. + AC_REQUIRE([AC_CANONICAL_HOST]) + acl_libdirstem=lib + acl_libdirstem2= + case "$host_os" in + solaris*) + dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment + dnl . + dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link." + dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the + dnl symlink is missing, so we set acl_libdirstem2 too. + AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit], + [AC_EGREP_CPP([sixtyfour bits], [ +#ifdef _LP64 +sixtyfour bits +#endif + ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no]) + ]) + if test $gl_cv_solaris_64bit = yes; then + acl_libdirstem=lib/64 + case "$host_cpu" in + sparc*) acl_libdirstem2=lib/sparcv9 ;; + i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; + esac + fi + ;; + *) + searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` + if test -n "$searchpath"; then + acl_save_IFS="${IFS= }"; IFS=":" + for searchdir in $searchpath; do + if test -d "$searchdir"; then + case "$searchdir" in + */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; + */../ | */.. ) + # Better ignore directories of this form. They are misleading. + ;; + *) searchdir=`cd "$searchdir" && pwd` + case "$searchdir" in + */lib64 ) acl_libdirstem=lib64 ;; + esac ;; + esac + fi + done + IFS="$acl_save_IFS" + fi + ;; + esac + test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" +]) diff --git a/build/autogen.sh b/build/autogen.sh new file mode 100755 index 000000000000..e73162465d2a --- /dev/null +++ b/build/autogen.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +PATH=/usr/local/gnu-autotools/bin/:$PATH +export PATH + +# Start from one level above the build directory +if [ -f version ]; then + cd .. +fi + +if [ \! -f build/version ]; then + echo "Can't find source directory" + exit 1 +fi + +# BSD make's "OBJDIR" support freaks out the automake-generated +# Makefile. Effectively disable it. +export MAKEOBJDIRPREFIX=/junk + +# Start from the build directory, where the version file is located +if [ -f build/version ]; then + cd build +fi + +if [ \! -f version ]; then + echo "Can't find version file" + exit 1 +fi + +# Update the build number in the 'version' file. +# Separate number from additional alpha/beta/etc marker +MARKER=`cat version | sed 's/[0-9.]//g'` +# Bump the number +VN=`cat version | sed 's/[^0-9.]//g'` +# Build out the string. +VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER" + +cd .. + +# Clean up the source dir as much as we can. +/bin/sh build/clean.sh + +# Substitute the versions into Libarchive's archive.h and archive_entry.h +perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive.h +perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive_entry.h +perl -p -i -e "s/^(#define\tARCHIVE_VERSION_STRING).*/\$1 \"libarchive $VS\"/" libarchive/archive.h +# Substitute versions into configure.ac as well +perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_S\]),.*\)/$1,['"$VS"'])/' configure.ac +perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_N\]),.*\)/$1,['"$VN"'])/' configure.ac + +# Remove developer CFLAGS if a release build is being made +if [ -n "${MAKE_LIBARCHIVE_RELEASE}" ]; then + perl -p -i -e "s/^(DEV_CFLAGS.*)/# \$1/" Makefile.am +fi + +set -xe +aclocal -I build/autoconf + +# Note: --automake flag needed only for libtoolize from +# libtool 1.5.x; in libtool 2.2.x it is a synonym for --quiet +case `uname` in +Darwin) glibtoolize --automake -c;; +*) libtoolize --automake -c;; +esac +autoconf +autoheader +automake -a -c diff --git a/build/bump-version.sh b/build/bump-version.sh new file mode 100755 index 000000000000..eec42354fd47 --- /dev/null +++ b/build/bump-version.sh @@ -0,0 +1,36 @@ +#!/bin/sh +v + +# Start from the build directory, where the version file is located +if [ -f build/version ]; then + cd build +fi + +if [ \! -f version ]; then + echo "Can't find version file" + exit 1 +fi + +# Update the build number in the 'version' file. +# Separate number from additional alpha/beta/etc marker +MARKER=`cat version | sed 's/[0-9.]//g'` +# Bump the number +VN=`cat version | sed 's/[^0-9.]//g'` +# Reassemble and write back out +VN=$(($VN + 1)) +rm -f version.old +mv version version.old +chmod +w version.old +echo $VN$MARKER > version +VS="$(($VN/1000000)).$(( ($VN/1000)%1000 )).$(( $VN%1000 ))$MARKER" +cd .. + +ANNOUNCE=`date +"%b %d, %Y:"`" libarchive $VS released" + +echo $ANNOUNCE + +# Add a version notice to NEWS +mv NEWS NEWS.bak +chmod +w NEWS.bak +echo $ANNOUNCE >> NEWS +echo >> NEWS +cat NEWS.bak >> NEWS diff --git a/build/clean.sh b/build/clean.sh new file mode 100755 index 000000000000..e4465f8a786c --- /dev/null +++ b/build/clean.sh @@ -0,0 +1,97 @@ +#!/bin/sh + +# +# Attempt to remove as many generated files as we can. +# Ideally, a well-used development sandbox would look like +# a pristine checkout after running this script. +# + +if [ \! -f build/version ]; then + echo 'Must run the clean script from the top-level dir of the libarchive distribution' 1>&2 + exit 1 +fi + +# If we're on BSD, blow away the build dir under /usr/obj +rm -rf /usr/obj`pwd` + +# +# Try to clean up a bit more... +# + +find . -name '*.So' | xargs rm -f +find . -name '*.a' | xargs rm -f +find . -name '*.la' | xargs rm -f +find . -name '*.lo' | xargs rm -f +find . -name '*.o' | xargs rm -f +find . -name '*.orig' | xargs rm -f +find . -name '*.po' | xargs rm -f +find . -name '*.rej' | xargs rm -f +find . -name '*~' | xargs rm -f +find . -name '.depend' | xargs rm -f +find . -name '.deps' | xargs rm -rf +find . -name '.dirstamp' | xargs rm -f +find . -name '.libs' | xargs rm -rf +find . -name 'CMakeFiles' | xargs rm -rf +find . -name 'cmake_install.cmake' | xargs rm -f +find . -name 'CTestTestfile.cmake' | xargs rm -f + +rm -rf Testing +rm -rf autom4te.cache +rm -rf bin +rm -rf cmake.tmp +rm -rf libarchive/Testing + +rm -f CMakeCache.txt +rm -f DartConfiguration.tcl +rm -f Makefile +rm -f Makefile.in +rm -f aclocal.m4 +rm -f bsdcpio +rm -f bsdcpio_test +rm -f bsdtar +rm -f bsdtar_test +rm -f build/autoconf/compile +rm -f build/autoconf/config.guess +rm -f build/autoconf/config.sub +rm -f build/autoconf/depcomp +rm -f build/autoconf/install-sh +rm -f build/autoconf/libtool.m4 +rm -f build/autoconf/ltmain.sh +rm -f build/autoconf/ltoptions.m4 +rm -f build/autoconf/ltsugar.m4 +rm -f build/autoconf/ltversion.m4 +rm -f build/autoconf/lt~obsolete.m4 +rm -f build/autoconf/missing +rm -f build/pkgconfig/libarchive.pc +rm -f build/version.old +rm -f config.h +rm -f config.h.in +rm -f config.log +rm -f config.status +rm -f configure +rm -f cpio/*.1.gz +rm -f cpio/Makefile +rm -f cpio/bsdcpio +rm -f cpio/test/Makefile +rm -f cpio/test/bsdcpio_test +rm -f cpio/test/list.h +rm -f doc/html/* +rm -f doc/man/* +rm -f doc/pdf/* +rm -f doc/text/* +rm -f doc/wiki/* +rm -f libarchive/*.[35].gz +rm -f libarchive/Makefile +rm -f libarchive/libarchive.so* +rm -f libarchive/test/Makefile +rm -f libarchive/test/libarchive_test +rm -f libarchive/test/list.h +rm -f libarchive_test +rm -f libtool +rm -f stamp-h1 +rm -f tar/*.1.gz +rm -f tar/Makefile +rm -f tar/bsdtar +rm -f tar/test/Makefile +rm -f tar/test/bsdtar_test +rm -f tar/test/list.h diff --git a/build/cmake/CheckFileOffsetBits.c b/build/cmake/CheckFileOffsetBits.c new file mode 100644 index 000000000000..d948fecf2b4e --- /dev/null +++ b/build/cmake/CheckFileOffsetBits.c @@ -0,0 +1,14 @@ +#include + +#define KB ((off_t)1024) +#define MB ((off_t)1024 * KB) +#define GB ((off_t)1024 * MB) +#define TB ((off_t)1024 * GB) +int t2[(((64 * GB -1) % 671088649) == 268434537) + && (((TB - (64 * GB -1) + 255) % 1792151290) == 305159546)? 1: -1]; + +int main() +{ + ; + return 0; +} diff --git a/build/cmake/CheckFileOffsetBits.cmake b/build/cmake/CheckFileOffsetBits.cmake new file mode 100644 index 000000000000..b347c9366e4a --- /dev/null +++ b/build/cmake/CheckFileOffsetBits.cmake @@ -0,0 +1,44 @@ +# - Check if _FILE_OFFSET_BITS macro needed for large files +# CHECK_FILE_OFFSET_BITS () +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# Copyright (c) 2009, Michihiro NAKAJIMA +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +#INCLUDE(CheckCXXSourceCompiles) + +GET_FILENAME_COMPONENT(_selfdir_CheckFileOffsetBits + "${CMAKE_CURRENT_LIST_FILE}" PATH) + +MACRO (CHECK_FILE_OFFSET_BITS) + IF(NOT DEFINED _FILE_OFFSET_BITS) + MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files") + TRY_COMPILE(__WITHOUT_FILE_OFFSET_BITS_64 + ${CMAKE_CURRENT_BINARY_DIR} + ${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}) + IF(NOT __WITHOUT_FILE_OFFSET_BITS_64) + TRY_COMPILE(__WITH_FILE_OFFSET_BITS_64 + ${CMAKE_CURRENT_BINARY_DIR} + ${_selfdir_CheckFileOffsetBits}/CheckFileOffsetBits.c + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_FILE_OFFSET_BITS=64) + ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64) + + IF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64) + SET(_FILE_OFFSET_BITS 64 CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files") + MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - needed") + ELSE(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64) + SET(_FILE_OFFSET_BITS "" CACHE INTERNAL "_FILE_OFFSET_BITS macro needed for large files") + MESSAGE(STATUS "Checking _FILE_OFFSET_BITS for large files - not needed") + ENDIF(NOT __WITHOUT_FILE_OFFSET_BITS_64 AND __WITH_FILE_OFFSET_BITS_64) + ENDIF(NOT DEFINED _FILE_OFFSET_BITS) + +ENDMACRO (CHECK_FILE_OFFSET_BITS) + diff --git a/build/cmake/CheckFuncs.cmake b/build/cmake/CheckFuncs.cmake new file mode 100644 index 000000000000..0670df97f869 --- /dev/null +++ b/build/cmake/CheckFuncs.cmake @@ -0,0 +1,49 @@ +# Check if the system has the specified function; treat glibc "stub" +# functions as nonexistent: +# CHECK_FUNCTION_EXISTS_GLIBC (FUNCTION FUNCVAR) +# +# FUNCTION - the function(s) where the prototype should be declared +# FUNCVAR - variable to define if the function does exist +# +# In particular, this understands the glibc convention of +# defining macros __stub_XXXX or __stub___XXXX if the function +# does appear in the library but is merely a stub that does nothing. +# By detecting this case, we can select alternate behavior on +# platforms that don't support this functionality. +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# Copyright (c) 2009, Michihiro NAKAJIMA +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +INCLUDE(CheckFunctionExists) +GET_FILENAME_COMPONENT(_selfdir_CheckFunctionExistsGlibc + "${CMAKE_CURRENT_LIST_FILE}" PATH) + +MACRO (CHECK_FUNCTION_EXISTS_GLIBC _FUNC _FUNCVAR) + IF(NOT DEFINED ${_FUNCVAR}) + SET(CHECK_STUB_FUNC_1 "__stub_${_FUNC}") + SET(CHECK_STUB_FUNC_2 "__stub___${_FUNC}") + CONFIGURE_FILE( ${_selfdir_CheckFunctionExistsGlibc}/CheckFuncs_stub.c.in + ${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c IMMEDIATE) + TRY_COMPILE(__stub + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/cmake.tmp/CheckFuncs_stub.c + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS + -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_INCLUDE_FILE_FLAGS} + "${CHECK_INCLUDE_FILE_C_INCLUDE_DIRS}") + IF (__stub) + SET("${_FUNCVAR}" "" CACHE INTERNAL "Have function ${_FUNC}") + ELSE (__stub) + CHECK_FUNCTION_EXISTS("${_FUNC}" "${_FUNCVAR}") + ENDIF (__stub) + ENDIF(NOT DEFINED ${_FUNCVAR}) +ENDMACRO (CHECK_FUNCTION_EXISTS_GLIBC) + diff --git a/build/cmake/CheckFuncs_stub.c.in b/build/cmake/CheckFuncs_stub.c.in new file mode 100644 index 000000000000..50da414b5f51 --- /dev/null +++ b/build/cmake/CheckFuncs_stub.c.in @@ -0,0 +1,16 @@ +#ifdef __STDC__ +#include +#else +#include +#endif + +int +main() +{ +#if defined ${CHECK_STUB_FUNC_1} || defined ${CHECK_STUB_FUNC_2} + return 0; +#else +this system have stub + return 0; +#endif +} diff --git a/build/cmake/CheckHeaderDirent.cmake b/build/cmake/CheckHeaderDirent.cmake new file mode 100644 index 000000000000..e9a7ea855326 --- /dev/null +++ b/build/cmake/CheckHeaderDirent.cmake @@ -0,0 +1,32 @@ +# - Check if the system has the specified type +# CHECK_HEADER_DIRENT (HEADER1 HEARDER2 ...) +# +# HEADER - the header(s) where the prototype should be declared +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# Copyright (c) 2009, Michihiro NAKAJIMA +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +INCLUDE(CheckTypeExists) + +MACRO (CHECK_HEADER_DIRENT) + CHECK_TYPE_EXISTS("DIR *" dirent.h HAVE_DIRENT_H) + IF(NOT HAVE_DIRENT_H) + CHECK_TYPE_EXISTS("DIR *" sys/ndir.h HAVE_SYS_NDIR_H) + IF(NOT HAVE_SYS_NDIR_H) + CHECK_TYPE_EXISTS("DIR *" ndir.h HAVE_NDIR_H) + IF(NOT HAVE_NDIR_H) + CHECK_TYPE_EXISTS("DIR *" sys/dir.h HAVE_SYS_DIR_H) + ENDIF(NOT HAVE_NDIR_H) + ENDIF(NOT HAVE_SYS_NDIR_H) + ENDIF(NOT HAVE_DIRENT_H) +ENDMACRO (CHECK_HEADER_DIRENT) + diff --git a/build/cmake/CheckStructMember.cmake b/build/cmake/CheckStructMember.cmake new file mode 100644 index 000000000000..05ddb3a11f20 --- /dev/null +++ b/build/cmake/CheckStructMember.cmake @@ -0,0 +1,43 @@ +# - Check if the given struct or class has the specified member variable +# CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE) +# +# STRUCT - the name of the struct or class you are interested in +# MEMBER - the member which existence you want to check +# HEADER - the header(s) where the prototype should be declared +# VARIABLE - variable to store the result +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories + +# Copyright (c) 2006, Alexander Neundorf, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +INCLUDE(CheckCSourceCompiles) + +MACRO (CHECK_STRUCT_MEMBER _STRUCT _MEMBER _HEADER _RESULT) + SET(_INCLUDE_FILES) + FOREACH (it ${_HEADER}) + SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") + ENDFOREACH (it) + + SET(_CHECK_STRUCT_MEMBER_SOURCE_CODE " +${_INCLUDE_FILES} +int main() +{ + static ${_STRUCT} tmp; + if (sizeof(tmp.${_MEMBER})) + return 0; + return 0; +} +") + CHECK_C_SOURCE_COMPILES("${_CHECK_STRUCT_MEMBER_SOURCE_CODE}" ${_RESULT}) + +ENDMACRO (CHECK_STRUCT_MEMBER) + diff --git a/build/cmake/CheckTypeExists.cmake b/build/cmake/CheckTypeExists.cmake new file mode 100644 index 000000000000..b05234fd8753 --- /dev/null +++ b/build/cmake/CheckTypeExists.cmake @@ -0,0 +1,42 @@ +# - Check if the system has the specified type +# CHECK_TYPE_EXISTS (TYPE HEADER VARIABLE) +# +# TYPE - the name of the type or struct or class you are interested in +# HEADER - the header(s) where the prototype should be declared +# VARIABLE - variable to store the result +# +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# Copyright (c) 2009, Michihiro NAKAJIMA +# Copyright (c) 2006, Alexander Neundorf, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +INCLUDE(CheckCSourceCompiles) + +MACRO (CHECK_TYPE_EXISTS _TYPE _HEADER _RESULT) + SET(_INCLUDE_FILES) + FOREACH (it ${_HEADER}) + SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") + ENDFOREACH (it) + + SET(_CHECK_TYPE_EXISTS_SOURCE_CODE " +${_INCLUDE_FILES} +int main() +{ + static ${_TYPE} tmp; + if (sizeof(tmp)) + return 0; + return 0; +} +") + CHECK_C_SOURCE_COMPILES("${_CHECK_TYPE_EXISTS_SOURCE_CODE}" ${_RESULT}) + +ENDMACRO (CHECK_TYPE_EXISTS) + diff --git a/build/cmake/FindLZMA.cmake b/build/cmake/FindLZMA.cmake new file mode 100644 index 000000000000..0b46b2cdd125 --- /dev/null +++ b/build/cmake/FindLZMA.cmake @@ -0,0 +1,48 @@ +# - Find lzma and lzmadec +# Find the native LZMA includes and library +# +# LZMA_INCLUDE_DIR - where to find lzma.h, etc. +# LZMA_LIBRARIES - List of libraries when using liblzma. +# LZMA_FOUND - True if liblzma found. +# LZMADEC_INCLUDE_DIR - where to find lzmadec.h, etc. +# LZMADEC_LIBRARIES - List of libraries when using liblzmadec. +# LZMADEC_FOUND - True if liblzmadec found. + +IF (LZMA_INCLUDE_DIR) + # Already in cache, be silent + SET(LZMA_FIND_QUIETLY TRUE) +ENDIF (LZMA_INCLUDE_DIR) + +FIND_PATH(LZMA_INCLUDE_DIR lzma.h) +FIND_LIBRARY(LZMA_LIBRARY NAMES lzma liblzma) + +# handle the QUIETLY and REQUIRED arguments and set LZMA_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZMA DEFAULT_MSG LZMA_LIBRARY LZMA_INCLUDE_DIR) + +IF(LZMA_FOUND) + SET( LZMA_LIBRARIES ${LZMA_LIBRARY} ) +ELSE(LZMA_FOUND) + SET( LZMA_LIBRARIES ) + + IF (LZMADEC_INCLUDE_DIR) + # Already in cache, be silent + SET(LZMADEC_FIND_QUIETLY TRUE) + ENDIF (LZMADEC_INCLUDE_DIR) + + FIND_PATH(LZMADEC_INCLUDE_DIR lzmadec.h) + FIND_LIBRARY(LZMADEC_LIBRARY NAMES lzmadec ) + + # handle the QUIETLY and REQUIRED arguments and set LZMADEC_FOUND to TRUE if + # all listed variables are TRUE + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZMADEC DEFAULT_MSG LZMADEC_LIBRARY + LZMADEC_INCLUDE_DIR) + + IF(LZMADEC_FOUND) + SET( LZMADEC_LIBRARIES ${LZMADEC_LIBRARY} ) + ELSE(LZMADEC_FOUND) + SET( LZMADEC_LIBRARIES ) + ENDIF(LZMADEC_FOUND) +ENDIF(LZMA_FOUND) diff --git a/build/cmake/FindLibGCC.cmake b/build/cmake/FindLibGCC.cmake new file mode 100644 index 000000000000..5883ff802642 --- /dev/null +++ b/build/cmake/FindLibGCC.cmake @@ -0,0 +1,22 @@ +# - Find libgcc +# Find the libgcc library. +# +# LIBGCC_LIBRARIES - List of libraries when using libgcc +# LIBGCC_FOUND - True if libgcc found. + +IF (LIBGCC_LIBRARY) + # Already in cache, be silent + SET(LIBGCC_FIND_QUIETLY TRUE) +ENDIF (LIBGCC_LIBRARY) + +FIND_LIBRARY(LIBGCC_LIBRARY NAMES gcc libgcc) + +# handle the QUIETLY and REQUIRED arguments and set LIBGCC_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGCC DEFAULT_MSG LIBGCC_LIBRARY) + +IF(LIBGCC_FOUND) + SET(LIBGCC_LIBRARIES ${LIBGCC_LIBRARY}) + SET(HAVE_LIBGCC 1) +ENDIF(LIBGCC_FOUND) diff --git a/build/cmake/FindNettle.cmake b/build/cmake/FindNettle.cmake new file mode 100644 index 000000000000..54ec9f5d39b5 --- /dev/null +++ b/build/cmake/FindNettle.cmake @@ -0,0 +1,23 @@ +# - Find Nettle +# Find the Nettle include directory and library +# +# NETTLE_INCLUDE_DIR - where to find , etc. +# NETTLE_LIBRARIES - List of libraries when using libnettle. +# NETTLE_FOUND - True if libnettle found. + +IF (NETTLE_INCLUDE_DIR) + # Already in cache, be silent + SET(NETTLE_FIND_QUIETLY TRUE) +ENDIF (NETTLE_INCLUDE_DIR) + +FIND_PATH(NETTLE_INCLUDE_DIR nettle/md5.h nettle/ripemd160.h nettle/sha.h) +FIND_LIBRARY(NETTLE_LIBRARY NAMES nettle libnettle) + +# handle the QUIETLY and REQUIRED arguments and set NETTLE_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(NETTLE DEFAULT_MSG NETTLE_LIBRARY NETTLE_INCLUDE_DIR) + +IF(NETTLE_FOUND) + SET(NETTLE_LIBRARIES ${NETTLE_LIBRARY}) +ENDIF(NETTLE_FOUND) diff --git a/build/cmake/FindPCREPOSIX.cmake b/build/cmake/FindPCREPOSIX.cmake new file mode 100644 index 000000000000..56cc17eacb47 --- /dev/null +++ b/build/cmake/FindPCREPOSIX.cmake @@ -0,0 +1,34 @@ +# - Find pcreposix +# Find the native PCRE and PCREPOSIX include and libraries +# +# PCRE_INCLUDE_DIR - where to find pcreposix.h, etc. +# PCREPOSIX_LIBRARIES - List of libraries when using libpcreposix. +# PCRE_LIBRARIES - List of libraries when using libpcre. +# PCREPOSIX_FOUND - True if libpcreposix found. +# PCRE_FOUND - True if libpcre found. + +IF (PCRE_INCLUDE_DIR) + # Already in cache, be silent + SET(PCRE_FIND_QUIETLY TRUE) +ENDIF (PCRE_INCLUDE_DIR) + +FIND_PATH(PCRE_INCLUDE_DIR pcreposix.h) +FIND_LIBRARY(PCREPOSIX_LIBRARY NAMES pcreposix libpcreposix) +FIND_LIBRARY(PCRE_LIBRARY NAMES pcre libpcre) + +# handle the QUIETLY and REQUIRED arguments and set PCREPOSIX_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCREPOSIX DEFAULT_MSG PCREPOSIX_LIBRARY PCRE_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(PCRE DEFAULT_MSG PCRE_LIBRARY) + +IF(PCREPOSIX_FOUND) + SET(PCREPOSIX_LIBRARIES ${PCREPOSIX_LIBRARY}) + SET(HAVE_LIBPCREPOSIX 1) + SET(HAVE_PCREPOSIX_H 1) +ENDIF(PCREPOSIX_FOUND) + +IF(PCRE_FOUND) + SET(PCRE_LIBRARIES ${PCRE_LIBRARY}) + SET(HAVE_LIBPCRE 1) +ENDIF(PCRE_FOUND) diff --git a/build/cmake/LibarchiveCheckCSourceCompiles.cmake b/build/cmake/LibarchiveCheckCSourceCompiles.cmake new file mode 100644 index 000000000000..6b6f59334da4 --- /dev/null +++ b/build/cmake/LibarchiveCheckCSourceCompiles.cmake @@ -0,0 +1,106 @@ +# - Check if given C source compiles and links into an executable +# CHECK_C_SOURCE_COMPILES( [FAIL_REGEX ]) +# - source code to try to compile, must define 'main' +# - variable to store whether the source code compiled +# - fail if test output matches this regex +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link + +#============================================================================= +# Copyright 2005-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# +# Extra arguments added by libarchive +# CMAKE_REQUIRED_LINKER_FLAGS = string of linker command line flags +# + +include(CMakeExpandImportedTargets) + + +macro(LIBARCHIVE_CHECK_C_SOURCE_COMPILES SOURCE VAR) + if("${VAR}" MATCHES "^${VAR}$") + set(_FAIL_REGEX) + set(_key) + foreach(arg ${ARGN}) + if("${arg}" MATCHES "^(FAIL_REGEX)$") + set(_key "${arg}") + elseif(_key) + list(APPEND _${_key} "${arg}") + else() + message(FATAL_ERROR "Unknown argument:\n ${arg}\n") + endif() + endforeach() + set(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + if(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") + set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") + else() + set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else() + set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) + endif() + if(CMAKE_REQUIRED_LINKER_FLAGS) + set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS + "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") + else() + set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS) + endif() + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" + "${SOURCE}\n") + + message(STATUS "Performing Test ${VAR}") + try_compile(${VAR} + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} ${CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS} + "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" + "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" + OUTPUT_VARIABLE OUTPUT) + + foreach(_regex ${_FAIL_REGEX}) + if("${OUTPUT}" MATCHES "${_regex}") + set(${VAR} 0) + endif() + endforeach() + + if(${VAR}) + set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + message(STATUS "Performing Test ${VAR} - Success") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + else() + message(STATUS "Performing Test ${VAR} - Failed") + set(${VAR} "" CACHE INTERNAL "Test ${VAR}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" + "${OUTPUT}\n" + "Source file was:\n${SOURCE}\n") + endif() + endif() +endmacro() + diff --git a/build/cmake/LibarchiveCheckCSourceRuns.cmake b/build/cmake/LibarchiveCheckCSourceRuns.cmake new file mode 100644 index 000000000000..498f52265aca --- /dev/null +++ b/build/cmake/LibarchiveCheckCSourceRuns.cmake @@ -0,0 +1,102 @@ +# - Check if the given C source code compiles and runs. +# CHECK_C_SOURCE_RUNS( ) +# - source code to try to compile +# - variable to store the result +# (1 for success, empty for failure) +# The following variables may be set before calling this macro to +# modify the way the check is run: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link + +#============================================================================= +# Copyright 2006-2009 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# +# Extra arguments added by libarchive +# CMAKE_REQUIRED_LINKER_FLAGS = string of linker command line flags +# + +include(CMakeExpandImportedTargets) + + +macro(LIBARCHIVE_CHECK_C_SOURCE_RUNS SOURCE VAR) + if("${VAR}" MATCHES "^${VAR}$") + set(MACRO_CHECK_FUNCTION_DEFINITIONS + "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") + if(CMAKE_REQUIRED_LIBRARIES) + # this one translates potentially used imported library targets to their files on disk + CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") + set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES + "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") + else() + set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES + "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") + else() + set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) + endif() + if(CMAKE_REQUIRED_LINKER_FLAGS) + set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS + "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") + else() + set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS) + endif() + file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" + "${SOURCE}\n") + + message(STATUS "Performing Test ${VAR}") + try_run(${VAR}_EXITCODE ${VAR}_COMPILED + ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c + COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} ${CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS} + -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} + "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" + "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" + COMPILE_OUTPUT_VARIABLE OUTPUT) + # if it did not compile make the return value fail code of 1 + if(NOT ${VAR}_COMPILED) + set(${VAR}_EXITCODE 1) + endif() + # if the return value was 0 then it worked + if("${${VAR}_EXITCODE}" EQUAL 0) + set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") + message(STATUS "Performing Test ${VAR} - Success") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}}\n" + "Source file was:\n${SOURCE}\n") + else() + if(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") + set(${VAR} "${${VAR}_EXITCODE}") + else() + set(${VAR} "" CACHE INTERNAL "Test ${VAR}") + endif() + + message(STATUS "Performing Test ${VAR} - Failed") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" + "${OUTPUT}\n" + "Return value: ${${VAR}_EXITCODE}\n" + "Source file was:\n${SOURCE}\n") + + endif() + endif() +endmacro() + diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in new file mode 100644 index 000000000000..c04314ee5e32 --- /dev/null +++ b/build/cmake/config.h.in @@ -0,0 +1,1143 @@ +/* config.h. Generated from build/cmake/config.h.in by cmake configure */ + +/* + * Ensure we have C99-style int64_t, etc, all defined. + */ + +/* First, we need to know if the system has already defined them. */ +#cmakedefine HAVE_INT16_T +#cmakedefine HAVE_INT32_T +#cmakedefine HAVE_INT64_T +#cmakedefine HAVE_INTMAX_T + +#cmakedefine HAVE_UINT8_T +#cmakedefine HAVE_UINT16_T +#cmakedefine HAVE_UINT32_T +#cmakedefine HAVE_UINT64_T +#cmakedefine HAVE_UINTMAX_T + +/* We might have the types we want under other spellings. */ +#cmakedefine HAVE___INT64 +#cmakedefine HAVE_U_INT64_T +#cmakedefine HAVE_UNSIGNED___INT64 + +/* The sizes of various standard integer types. */ +@SIZE_OF_SHORT_CODE@ +@SIZE_OF_INT_CODE@ +@SIZE_OF_LONG_CODE@ +@SIZE_OF_LONG_LONG_CODE@ +@SIZE_OF_UNSIGNED_SHORT_CODE@ +@SIZE_OF_UNSIGNED_CODE@ +@SIZE_OF_UNSIGNED_LONG_CODE@ +@SIZE_OF_UNSIGNED_LONG_LONG_CODE@ + +/* + * If we lack int64_t, define it to the first of __int64, int, long, and long long + * that exists and is the right size. + */ +#if !defined(HAVE_INT64_T) && defined(HAVE___INT64) +typedef __int64 int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZE_OF_INT == 8 +typedef int int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZE_OF_LONG == 8 +typedef long int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) && SIZE_OF_LONG_LONG == 8 +typedef long long int64_t; +#define HAVE_INT64_T +#endif + +#if !defined(HAVE_INT64_T) +#error No 64-bit integer type was found. +#endif + +/* + * Similarly for int32_t + */ +#if !defined(HAVE_INT32_T) && SIZE_OF_INT == 4 +typedef long int32_t; +#define HAVE_INT32_T +#endif + +#if !defined(HAVE_INT32_T) && SIZE_OF_LONG == 4 +typedef long int32_t; +#define HAVE_INT32_T +#endif + +#if !defined(HAVE_INT32_T) +#error No 32-bit integer type was found. +#endif + +/* + * Similarly for int16_t + */ +#if !defined(HAVE_INT16_T) && SIZE_OF_INT == 2 +typedef int int16_t; +#define HAVE_INT16_T +#endif + +#if !defined(HAVE_INT16_T) && SIZE_OF_SHORT == 2 +typedef short int16_t; +#define HAVE_INT16_T +#endif + +#if !defined(HAVE_INT16_T) +#error No 16-bit integer type was found. +#endif + +/* + * Similarly for uint64_t + */ +#if !defined(HAVE_UINT64_T) && defined(HAVE_UNSIGNED___INT64) +typedef unsigned __int64 uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED == 8 +typedef unsigned uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG == 8 +typedef unsigned long uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) && SIZE_OF_UNSIGNED_LONG_LONG == 8 +typedef unsigned long long uint64_t; +#define HAVE_UINT64_T +#endif + +#if !defined(HAVE_UINT64_T) +#error No 64-bit unsigned integer type was found. +#endif + + +/* + * Similarly for uint32_t + */ +#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED == 4 +typedef unsigned uint32_t; +#define HAVE_UINT32_T +#endif + +#if !defined(HAVE_UINT32_T) && SIZE_OF_UNSIGNED_LONG == 4 +typedef unsigned long uint32_t; +#define HAVE_UINT32_T +#endif + +#if !defined(HAVE_UINT32_T) +#error No 32-bit unsigned integer type was found. +#endif + +/* + * Similarly for uint16_t + */ +#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED == 2 +typedef unsigned uint16_t; +#define HAVE_UINT16_T +#endif + +#if !defined(HAVE_UINT16_T) && SIZE_OF_UNSIGNED_SHORT == 2 +typedef unsigned short uint16_t; +#define HAVE_UINT16_T +#endif + +#if !defined(HAVE_UINT16_T) +#error No 16-bit unsigned integer type was found. +#endif + +/* + * Similarly for uint8_t + */ +#if !defined(HAVE_UINT8_T) +typedef unsigned char uint8_t; +#define HAVE_UINT8_T +#endif + +#if !defined(HAVE_UINT16_T) +#error No 8-bit unsigned integer type was found. +#endif + +/* Define intmax_t and uintmax_t if they are not already defined. */ +#if !defined(HAVE_INTMAX_T) +typedef int64_t intmax_t; +#define INTMAX_MIN INT64_MIN +#define INTMAX_MAX INT64_MAX +#endif + +#if !defined(HAVE_UINTMAX_T) +typedef uint64_t uintmax_t; +#endif + +/* Define ZLIB_WINAPI if zlib was built on Visual Studio. */ +#cmakedefine ZLIB_WINAPI 1 + +/* MD5 via ARCHIVE_CRYPTO_MD5_LIBC supported. */ +#cmakedefine ARCHIVE_CRYPTO_MD5_LIBC 1 + +/* MD5 via ARCHIVE_CRYPTO_MD5_LIBSYSTEM supported. */ +#cmakedefine ARCHIVE_CRYPTO_MD5_LIBSYSTEM 1 + +/* MD5 via ARCHIVE_CRYPTO_MD5_NETTLE supported. */ +#cmakedefine ARCHIVE_CRYPTO_MD5_NETTLE 1 + +/* MD5 via ARCHIVE_CRYPTO_MD5_OPENSSL supported. */ +#cmakedefine ARCHIVE_CRYPTO_MD5_OPENSSL 1 + +/* MD5 via ARCHIVE_CRYPTO_MD5_WIN supported. */ +#cmakedefine ARCHIVE_CRYPTO_MD5_WIN 1 + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_LIBC supported. */ +#cmakedefine ARCHIVE_CRYPTO_RMD160_LIBC 1 + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_NETTLE supported. */ +#cmakedefine ARCHIVE_CRYPTO_RMD160_NETTLE 1 + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_OPENSSL supported. */ +#cmakedefine ARCHIVE_CRYPTO_RMD160_OPENSSL 1 + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBC supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA1_LIBC 1 + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBSYSTEM supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA1_LIBSYSTEM 1 + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_NETTLE supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA1_NETTLE 1 + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_OPENSSL supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA1_OPENSSL 1 + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_WIN supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA1_WIN 1 + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBC 1 + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC2 supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBC2 1 + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC3 supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBC3 1 + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBSYSTEM supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA256_LIBSYSTEM 1 + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_NETTLE supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA256_NETTLE 1 + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_OPENSSL supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA256_OPENSSL 1 + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_WIN supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA256_WIN 1 + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBC 1 + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC2 supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBC2 1 + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC3 supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBC3 1 + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBSYSTEM supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA384_LIBSYSTEM 1 + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_NETTLE supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA384_NETTLE 1 + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_OPENSSL supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA384_OPENSSL 1 + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_WIN supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA384_WIN 1 + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBC 1 + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC2 supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBC2 1 + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC3 supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBC3 1 + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBSYSTEM supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA512_LIBSYSTEM 1 + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_NETTLE supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA512_NETTLE 1 + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_OPENSSL supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA512_OPENSSL 1 + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_WIN supported. */ +#cmakedefine ARCHIVE_CRYPTO_SHA512_WIN 1 + +/* Version number of bsdcpio */ +#cmakedefine BSDCPIO_VERSION_STRING "${BSDCPIO_VERSION_STRING}" + +/* Version number of bsdtar */ +#cmakedefine BSDTAR_VERSION_STRING "${BSDTAR_VERSION_STRING}" + +/* Define to 1 if you have the `acl_create_entry' function. */ +#cmakedefine HAVE_ACL_CREATE_ENTRY 1 + +/* Define to 1 if you have the `acl_get_link' function. */ +#cmakedefine HAVE_ACL_GET_LINK 1 + +/* Define to 1 if you have the `acl_get_link_np' function. */ +#cmakedefine HAVE_ACL_GET_LINK_NP 1 + +/* Define to 1 if you have the `acl_get_perm' function. */ +#cmakedefine HAVE_ACL_GET_PERM 1 + +/* Define to 1 if you have the `acl_get_perm_np' function. */ +#cmakedefine HAVE_ACL_GET_PERM_NP 1 + +/* Define to 1 if you have the `acl_init' function. */ +#cmakedefine HAVE_ACL_INIT 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ACL_LIBACL_H 1 + +/* Define to 1 if the system has the type `acl_permset_t'. */ +#cmakedefine HAVE_ACL_PERMSET_T 1 + +/* Define to 1 if you have the `acl_set_fd' function. */ +#cmakedefine HAVE_ACL_SET_FD 1 + +/* Define to 1 if you have the `acl_set_fd_np' function. */ +#cmakedefine HAVE_ACL_SET_FD_NP 1 + +/* Define to 1 if you have the `acl_set_file' function. */ +#cmakedefine HAVE_ACL_SET_FILE 1 + +/* True for systems with POSIX ACL support */ +#cmakedefine HAVE_ACL_USER 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ATTR_XATTR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_BSDXML_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_BZLIB_H 1 + +/* Define to 1 if you have the `chflags' function. */ +#cmakedefine HAVE_CHFLAGS 1 + +/* Define to 1 if you have the `chown' function. */ +#cmakedefine HAVE_CHOWN 1 + +/* Define to 1 if you have the `chroot' function. */ +#cmakedefine HAVE_CHROOT 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_COPYFILE_H 1 + +/* Define to 1 if you have the `ctime_r' function. */ +#cmakedefine HAVE_CTIME_R 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_CTYPE_H 1 + +/* Define to 1 if you have the `cygwin_conv_path' function. */ +#cmakedefine HAVE_CYGWIN_CONV_PATH 1 + +/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_INT64_MAX 1 + +/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_INT64_MIN 1 + +/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_SIZE_MAX 1 + +/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_SSIZE_MAX 1 + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_STRERROR_R 1 + +/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_UINT32_MAX 1 + +/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_UINT64_MAX 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DIRECT_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_DIRENT_H 1 + +/* Define to 1 if you have the `dirfd' function. */ +#cmakedefine HAVE_DIRFD 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H 1 + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +#cmakedefine HAVE_DOPRNT 1 + +/* Define to 1 if nl_langinfo supports D_MD_ORDER */ +#cmakedefine HAVE_D_MD_ORDER 1 + +/* A possible errno value for invalid file format errors */ +#cmakedefine HAVE_EFTYPE 1 + +/* A possible errno value for invalid file format errors */ +#cmakedefine HAVE_EILSEQ 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_EXPAT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_EXT2FS_EXT2_FS_H 1 + +/* Define to 1 if you have the `extattr_get_file' function. */ +#cmakedefine HAVE_EXTATTR_GET_FILE 1 + +/* Define to 1 if you have the `extattr_list_file' function. */ +#cmakedefine HAVE_EXTATTR_LIST_FILE 1 + +/* Define to 1 if you have the `extattr_set_fd' function. */ +#cmakedefine HAVE_EXTATTR_SET_FD 1 + +/* Define to 1 if you have the `extattr_set_file' function. */ +#cmakedefine HAVE_EXTATTR_SET_FILE 1 + +/* Define to 1 if EXTATTR_NAMESPACE_USER is defined in sys/extattr.h. */ +#cmakedefine HAVE_DECL_EXTATTR_NAMESPACE_USER 1 + +/* Define to 1 if you have the `fchdir' function. */ +#cmakedefine HAVE_FCHDIR 1 + +/* Define to 1 if you have the `fchflags' function. */ +#cmakedefine HAVE_FCHFLAGS 1 + +/* Define to 1 if you have the `fchmod' function. */ +#cmakedefine HAVE_FCHMOD 1 + +/* Define to 1 if you have the `fchown' function. */ +#cmakedefine HAVE_FCHOWN 1 + +/* Define to 1 if you have the `fcntl' function. */ +#cmakedefine HAVE_FCNTL 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fdopendir' function. */ +#cmakedefine HAVE_FDOPENDIR 1 + +/* Define to 1 if you have the `fgetea' function. */ +#cmakedefine HAVE_FGETEA 1 + +/* Define to 1 if you have the `fgetxattr' function. */ +#cmakedefine HAVE_FGETXATTR 1 + +/* Define to 1 if you have the `flistea' function. */ +#cmakedefine HAVE_FLISTEA 1 + +/* Define to 1 if you have the `flistxattr' function. */ +#cmakedefine HAVE_FLISTXATTR 1 + +/* Define to 1 if you have the `fork' function. */ +#cmakedefine HAVE_FORK 1 + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#cmakedefine HAVE_FSEEKO 1 + +/* Define to 1 if you have the `fsetea' function. */ +#cmakedefine HAVE_FSETEA 1 + +/* Define to 1 if you have the `fsetxattr' function. */ +#cmakedefine HAVE_FSETXATTR 1 + +/* Define to 1 if you have the `fstat' function. */ +#cmakedefine HAVE_FSTAT 1 + +/* Define to 1 if you have the `fstatat' function. */ +#cmakedefine HAVE_FSTATAT 1 + +/* Define to 1 if you have the `fstatfs' function. */ +#cmakedefine HAVE_FSTATFS 1 + +/* Define to 1 if you have the `fstatvfs' function. */ +#cmakedefine HAVE_FSTATVFS 1 + +/* Define to 1 if you have the `ftruncate' function. */ +#cmakedefine HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the `futimens' function. */ +#cmakedefine HAVE_FUTIMENS 1 + +/* Define to 1 if you have the `futimes' function. */ +#cmakedefine HAVE_FUTIMES 1 + +/* Define to 1 if you have the `futimesat' function. */ +#cmakedefine HAVE_FUTIMESAT 1 + +/* Define to 1 if you have the `getea' function. */ +#cmakedefine HAVE_GETEA 1 + +/* Define to 1 if you have the `geteuid' function. */ +#cmakedefine HAVE_GETEUID 1 + +/* Define to 1 if you have the `getgrgid_r' function. */ +#cmakedefine HAVE_GETGRGID_R 1 + +/* Define to 1 if you have the `getgrnam_r' function. */ +#cmakedefine HAVE_GETGRNAM_R 1 + +/* Define to 1 if you have the `getpid' function. */ +#cmakedefine HAVE_GETPID 1 + +/* Define to 1 if you have the `getpwnam_r' function. */ +#cmakedefine HAVE_GETPWNAM_R 1 + +/* Define to 1 if you have the `getpwuid_r' function. */ +#cmakedefine HAVE_GETPWUID_R 1 + +/* Define to 1 if you have the `getvfsbyname' function. */ +#cmakedefine HAVE_GETVFSBYNAME 1 + +/* Define to 1 if you have the `getxattr' function. */ +#cmakedefine HAVE_GETXATTR 1 + +/* Define to 1 if you have the `gmtime_r' function. */ +#cmakedefine HAVE_GMTIME_R 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GRP_H 1 + +/* Define to 1 if you have the `iconv' function. */ +#cmakedefine HAVE_ICONV 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ICONV_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_IO_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LANGINFO_H 1 + +/* Define to 1 if you have the `lchflags' function. */ +#cmakedefine HAVE_LCHFLAGS 1 + +/* Define to 1 if you have the `lchmod' function. */ +#cmakedefine HAVE_LCHMOD 1 + +/* Define to 1 if you have the `lchown' function. */ +#cmakedefine HAVE_LCHOWN 1 + +/* Define to 1 if you have the `lgetea' function. */ +#cmakedefine HAVE_LGETEA 1 + +/* Define to 1 if you have the `lgetxattr' function. */ +#cmakedefine HAVE_LGETXATTR 1 + +/* Define to 1 if you have the `acl' library (-lacl). */ +#cmakedefine HAVE_LIBACL 1 + +/* Define to 1 if you have the `attr' library (-lattr). */ +#cmakedefine HAVE_LIBATTR 1 + +/* Define to 1 if you have the `bsdxml' library (-lbsdxml). */ +#cmakedefine HAVE_LIBBSDXML 1 + +/* Define to 1 if you have the `bz2' library (-lbz2). */ +#cmakedefine HAVE_LIBBZ2 1 + +/* Define to 1 if you have the `expat' library (-lexpat). */ +#cmakedefine HAVE_LIBEXPAT 1 + +/* Define to 1 if you have the `gcc' library (-lgcc). */ +#cmakedefine HAVE_LIBGCC 1 + +/* Define to 1 if you have the `lzma' library (-llzma). */ +#cmakedefine HAVE_LIBLZMA 1 + +/* Define to 1 if you have the `lzmadec' library (-llzmadec). */ +#cmakedefine HAVE_LIBLZMADEC 1 + +/* Define to 1 if you have the `lzo2' library (-llzo2). */ +#cmakedefine HAVE_LIBLZO2 1 + +/* Define to 1 if you have the `nettle' library (-lnettle). */ +#cmakedefine HAVE_LIBNETTLE 1 + +/* Define to 1 if you have the `pcre' library (-lpcre). */ +#cmakedefine HAVE_LIBPCRE 1 + +/* Define to 1 if you have the `pcreposix' library (-lpcreposix). */ +#cmakedefine HAVE_LIBPCREPOSIX 1 + +/* Define to 1 if you have the `xml2' library (-lxml2). */ +#cmakedefine HAVE_LIBXML2 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIBXML_XMLREADER_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIBXML_XMLWRITER_H 1 + +/* Define to 1 if you have the `z' library (-lz). */ +#cmakedefine HAVE_LIBZ 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `link' function. */ +#cmakedefine HAVE_LINK 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LINUX_FIEMAP_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LINUX_FS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LINUX_MAGIC_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LINUX_TYPES_H 1 + +/* Define to 1 if you have the `listea' function. */ +#cmakedefine HAVE_LISTEA 1 + +/* Define to 1 if you have the `listxattr' function. */ +#cmakedefine HAVE_LISTXATTR 1 + +/* Define to 1 if you have the `llistea' function. */ +#cmakedefine HAVE_LLISTEA 1 + +/* Define to 1 if you have the `llistxattr' function. */ +#cmakedefine HAVE_LLISTXATTR 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LOCALCHARSET_H 1 + +/* Define to 1 if you have the `locale_charset' function. */ +#cmakedefine HAVE_LOCALE_CHARSET 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#cmakedefine HAVE_LOCALTIME_R 1 + +/* Define to 1 if the system has the type `long long int'. */ +#cmakedefine HAVE_LONG_LONG_INT 1 + +/* Define to 1 if you have the `lsetea' function. */ +#cmakedefine HAVE_LSETEA 1 + +/* Define to 1 if you have the `lsetxattr' function. */ +#cmakedefine HAVE_LSETXATTR 1 + +/* Define to 1 if you have the `lstat' function. */ +#cmakedefine HAVE_LSTAT 1 + +/* Define to 1 if `lstat' has the bug that it succeeds when given the + zero-length file name argument. */ +#cmakedefine HAVE_LSTAT_EMPTY_STRING_BUG 1 + +/* Define to 1 if you have the `lutimes' function. */ +#cmakedefine HAVE_LUTIMES 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LZMADEC_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LZMA_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LZO_LZO1X_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LZO_LZOCONF_H 1 + +/* Define to 1 if you have the `mbrtowc' function. */ +#cmakedefine HAVE_MBRTOWC 1 + +/* Define to 1 if you have the `memmove' function. */ +#cmakedefine HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkdir' function. */ +#cmakedefine HAVE_MKDIR 1 + +/* Define to 1 if you have the `mkfifo' function. */ +#cmakedefine HAVE_MKFIFO 1 + +/* Define to 1 if you have the `mknod' function. */ +#cmakedefine HAVE_MKNOD 1 + +/* Define to 1 if you have the `mkstemp' function. */ +#cmakedefine HAVE_MKSTEMP 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +#cmakedefine HAVE_NDIR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETTLE_MD5_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETTLE_RIPEMD160_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETTLE_SHA_H 1 + +/* Define to 1 if you have the `nl_langinfo' function. */ +#cmakedefine HAVE_NL_LANGINFO 1 + +/* Define to 1 if you have the `openat' function. */ +#cmakedefine HAVE_OPENAT 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PATHS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PCREPOSIX_H 1 + +/* Define to 1 if you have the `pipe' function. */ +#cmakedefine HAVE_PIPE 1 + +/* Define to 1 if you have the `poll' function. */ +#cmakedefine HAVE_POLL 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_POLL_H 1 + +/* Define to 1 if you have the `posix_spawnp' function. */ +#cmakedefine HAVE_POSIX_SPAWNP 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PROCESS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PWD_H 1 + +/* Define to 1 if you have the `readdir_r' function. */ +#cmakedefine HAVE_READDIR_R 1 + +/* Define to 1 if you have the `readlink' function. */ +#cmakedefine HAVE_READLINK 1 + +/* Define to 1 if you have the `readlinkat' function. */ +#cmakedefine HAVE_READLINKAT 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_REGEX_H 1 + +/* Define to 1 if you have the `select' function. */ +#cmakedefine HAVE_SELECT 1 + +/* Define to 1 if you have the `setenv' function. */ +#cmakedefine HAVE_SETENV 1 + +/* Define to 1 if you have the `setlocale' function. */ +#cmakedefine HAVE_SETLOCALE 1 + +/* Define to 1 if you have the `sigaction' function. */ +#cmakedefine HAVE_SIGACTION 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SPAWN_H 1 + +/* Define to 1 if you have the `statfs' function. */ +#cmakedefine HAVE_STATFS 1 + +/* Define to 1 if you have the `statvfs' function. */ +#cmakedefine HAVE_STATVFS 1 + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +#cmakedefine HAVE_STAT_EMPTY_STRING_BUG 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#cmakedefine HAVE_STRCHR 1 + +/* Define to 1 if you have the `strdup' function. */ +#cmakedefine HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#cmakedefine HAVE_STRERROR 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#cmakedefine HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `strftime' function. */ +#cmakedefine HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRING_H 1 + +/* Define to 1 if you have the `strrchr' function. */ +#cmakedefine HAVE_STRRCHR 1 + +/* Define to 1 if `f_namemax' is a member of `struct statfs'. */ +#cmakedefine HAVE_STRUCT_STATFS_F_NAMEMAX 1 + +/* Define to 1 if `f_iosize' is a member of `struct statvfs'. */ +#cmakedefine HAVE_STRUCT_STATVFS_F_IOSIZE 1 + +/* Define to 1 if `st_birthtime' is a member of `struct stat'. */ +#cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIME 1 + +/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */ +#cmakedefine HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +#cmakedefine HAVE_STRUCT_STAT_ST_BLKSIZE 1 + +/* Define to 1 if `st_flags' is a member of `struct stat'. */ +#cmakedefine HAVE_STRUCT_STAT_ST_FLAGS 1 + +/* Define to 1 if `st_mtimespec.tv_nsec' is a member of `struct stat'. */ +#cmakedefine HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 + +/* Define to 1 if `st_mtime_n' is a member of `struct stat'. */ +#cmakedefine HAVE_STRUCT_STAT_ST_MTIME_N 1 + +/* Define to 1 if `st_mtime_usec' is a member of `struct stat'. */ +#cmakedefine HAVE_STRUCT_STAT_ST_MTIME_USEC 1 + +/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */ +#cmakedefine HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 + +/* Define to 1 if `st_umtime' is a member of `struct stat'. */ +#cmakedefine HAVE_STRUCT_STAT_ST_UMTIME 1 + +/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */ +#cmakedefine HAVE_STRUCT_TM_TM_GMTOFF 1 + +/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */ +#cmakedefine HAVE_STRUCT_TM___TM_GMTOFF 1 + +/* Define to 1 if you have the `symlink' function. */ +#cmakedefine HAVE_SYMLINK 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_ACL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_CDEFS_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_SYS_DIR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_EA_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_EXTATTR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_MKDEV_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_MOUNT_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#cmakedefine HAVE_SYS_NDIR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STATFS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STATVFS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UTIME_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UTSNAME_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_VFS_H 1 + +/* Define to 1 if you have that is POSIX.1 compatible. */ +#cmakedefine HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_XATTR_H 1 + +/* Define to 1 if you have the `timegm' function. */ +#cmakedefine HAVE_TIMEGM 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_TIME_H 1 + +/* Define to 1 if you have the `tzset' function. */ +#cmakedefine HAVE_TZSET 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unsetenv' function. */ +#cmakedefine HAVE_UNSETENV 1 + +/* Define to 1 if the system has the type `unsigned long long'. */ +#cmakedefine HAVE_UNSIGNED_LONG_LONG 1 + +/* Define to 1 if the system has the type `unsigned long long int'. */ +#cmakedefine HAVE_UNSIGNED_LONG_LONG_INT 1 + +/* Define to 1 if you have the `utime' function. */ +#cmakedefine HAVE_UTIME 1 + +/* Define to 1 if you have the `utimensat' function. */ +#cmakedefine HAVE_UTIMENSAT 1 + +/* Define to 1 if you have the `utimes' function. */ +#cmakedefine HAVE_UTIMES 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UTIME_H 1 + +/* Define to 1 if you have the `vfork' function. */ +#cmakedefine HAVE_VFORK 1 + +/* Define to 1 if you have the `vprintf' function. */ +#cmakedefine HAVE_VPRINTF 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WCHAR_H 1 + +/* Define to 1 if the system has the type `wchar_t'. */ +#cmakedefine HAVE_WCHAR_T 1 + +/* Define to 1 if you have the `wcrtomb' function. */ +#cmakedefine HAVE_WCRTOMB 1 + +/* Define to 1 if you have the `wcscmp' function. */ +#cmakedefine HAVE_WCSCMP 1 + +/* Define to 1 if you have the `wcscpy' function. */ +#cmakedefine HAVE_WCSCPY 1 + +/* Define to 1 if you have the `wcslen' function. */ +#cmakedefine HAVE_WCSLEN 1 + +/* Define to 1 if you have the `wctomb' function. */ +#cmakedefine HAVE_WCTOMB 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WCTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WINCRYPT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WINDOWS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WINIOCTL_H 1 + +/* Define to 1 if you have _CrtSetReportMode in */ +#cmakedefine HAVE__CrtSetReportMode 1 + +/* Define to 1 if you have the `wmemcmp' function. */ +#cmakedefine HAVE_WMEMCMP 1 + +/* Define to 1 if you have the `wmemcpy' function. */ +#cmakedefine HAVE_WMEMCPY 1 + +/* Define to 1 if you have a working EXT2_IOC_GETFLAGS */ +#cmakedefine HAVE_WORKING_EXT2_IOC_GETFLAGS 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ZLIB_H 1 + +/* Define to 1 if you have the `_ctime64_s' function. */ +#cmakedefine HAVE__CTIME64_S 1 + +/* Define to 1 if you have the `_fseeki64' function. */ +#cmakedefine HAVE__FSEEKI64 1 + +/* Define to 1 if you have the `_get_timezone' function. */ +#cmakedefine HAVE__GET_TIMEZONE 1 + +/* Define to 1 if you have the `_localtime64_s' function. */ +#cmakedefine HAVE__LOCALTIME64_S 1 + +/* Define to 1 if you have the `_mkgmtime64' function. */ +#cmakedefine HAVE__MKGMTIME64 1 + +/* Define as const if the declaration of iconv() needs const. */ +#define ICONV_CONST ${ICONV_CONST} + +/* Version number of libarchive as a single integer */ +#cmakedefine LIBARCHIVE_VERSION_NUMBER "${LIBARCHIVE_VERSION_NUMBER}" + +/* Version number of libarchive */ +#cmakedefine LIBARCHIVE_VERSION_STRING "${LIBARCHIVE_VERSION_STRING}" + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +#cmakedefine LSTAT_FOLLOWS_SLASHED_SYMLINK 1 + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +#cmakedefine MAJOR_IN_MKDEV 1 + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +#cmakedefine MAJOR_IN_SYSMACROS 1 + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#cmakedefine NO_MINUS_C_MINUS_O 1 + +/* The size of `wchar_t', as computed by sizeof. */ +#cmakedefine SIZEOF_WCHAR_T ${SIZEOF_WCHAR_T} + +/* Define to 1 if strerror_r returns char *. */ +#cmakedefine STRERROR_R_CHAR_P 1 + +/* Define to 1 if you can safely include both and . */ +#cmakedefine TIME_WITH_SYS_TIME 1 + +/* + * Some platform requires a macro to use extension functions. + */ +#cmakedefine SAFE_TO_DEFINE_EXTENSIONS 1 +#ifdef SAFE_TO_DEFINE_EXTENSIONS +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif +#endif /* SAFE_TO_DEFINE_EXTENSIONS */ + +/* Version number of package */ +#cmakedefine VERSION "${VERSION}" + +/* Number of bits in a file offset, on hosts where this is settable. */ +#cmakedefine _FILE_OFFSET_BITS ${_FILE_OFFSET_BITS} + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +#cmakedefine _LARGEFILE_SOURCE 1 + +/* Define for large files, on AIX-style hosts. */ +#cmakedefine _LARGE_FILES ${_LARGE_FILES} + +/* Define for Windows to use Windows 2000+ APIs. */ +#cmakedefine _WIN32_WINNT ${_WIN32_WINNT} +#cmakedefine WINVER ${WINVER} + +/* Define to empty if `const' does not conform to ANSI C. */ +#cmakedefine const ${const} + +/* Define to `int' if doesn't define. */ +#cmakedefine gid_t ${gid_t} + +/* Define to `unsigned long' if does not define. */ +#cmakedefine id_t ${id_t} + +/* Define to `int' if does not define. */ +#cmakedefine mode_t ${mode_t} + +/* Define to `long long' if does not define. */ +#cmakedefine off_t ${off_t} + +/* Define to `int' if doesn't define. */ +#cmakedefine pid_t ${pid_t} + +/* Define to `unsigned int' if does not define. */ +#cmakedefine size_t ${size_t} + +/* Define to `int' if does not define. */ +#cmakedefine ssize_t ${ssize_t} + +/* Define to `int' if doesn't define. */ +#cmakedefine uid_t ${uid_t} + +/* Define to `int' if does not define. */ +#cmakedefine intptr_t ${intptr_t} + +/* Define to `unsigned int' if does not define. */ +#cmakedefine uintptr_t ${uintptr_t} diff --git a/build/makerelease.sh b/build/makerelease.sh new file mode 100755 index 000000000000..f2869dfca5ed --- /dev/null +++ b/build/makerelease.sh @@ -0,0 +1,58 @@ +#!/bin/sh + +# +# This script exists primarily to document some of the +# steps needed when building an "official libarchive distribution". +# Feel free to hack it up as necessary to adjust to the peculiarities +# of a particular build environment. +# + +PATH=/usr/local/gnu-autotools/bin/:$PATH +export PATH + +# Start from one level above the build directory +if [ -f version ]; then + cd .. +fi + +if [ \! -f build/version ]; then + echo "Can't find source directory" + exit 1 +fi + +# BSD make's "OBJDIR" support freaks out the automake-generated +# Makefile. Effectively disable it. +export MAKEOBJDIRPREFIX=/junk + +set -ex + +# +# Scrub the local tree before running the build tests below. +# +/bin/sh build/clean.sh + +# +# Verify the CMake-generated build +# +mkdir -p _cmtest +cd _cmtest +cmake .. +make +make test +cd .. +rm -rf _cmtest +# TODO: Build distribution using cmake + +# +# Construct and verify the autoconf build system +# +export MAKE_LIBARCHIVE_RELEASE="1" +/bin/sh build/autogen.sh + +# Get the newest config.guess/config.sub from savannah.gnu.org +curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD' > build/autoconf/config.guess +curl 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD' > build/autoconf/config.sub + +./configure +make distcheck +make dist-zip diff --git a/build/pkgconfig/libarchive.pc.in b/build/pkgconfig/libarchive.pc.in new file mode 100644 index 000000000000..95d715951774 --- /dev/null +++ b/build/pkgconfig/libarchive.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libarchive +Description: library that can create and read several streaming archive formats +Version: @VERSION@ +Cflags: -I${includedir} +Libs: -L${libdir} -larchive +Libs.private: @LIBS@ diff --git a/build/utils/gen_archive_string_composition_h.sh b/build/utils/gen_archive_string_composition_h.sh new file mode 100755 index 000000000000..925de5c85e78 --- /dev/null +++ b/build/utils/gen_archive_string_composition_h.sh @@ -0,0 +1,455 @@ +#!/bin/sh +# +# This needs http://unicode.org/Public/6.0.0/ucd/UnicodeData.txt +# +inputfile="$1" # Expect UnicodeData.txt +outfile=archive_string_composition.h +pickout=/tmp/mk_unicode_composition_tbl$$.awk +pickout2=/tmp/mk_unicode_composition_tbl2$$.awk +#nfdtmp=/tmp/mk_unicode_decomposition_tmp$$.txt +nfdtmp="nfdtmpx" +################################################################################# +# +# Append the file header of "archive_string_composition.h" +# +################################################################################# +append_copyright() +{ +cat > ${outfile} < ${pickout} <>8) <= 0x%X && u_decomposable_blocks[(uc)>>8])\\n", highnum + printf "static const char u_decomposable_blocks[0x%X+1] = {\\n\\t", highnum + # + # Output blockmap + for (i = 0; i <= highnum; i++) { + if (i != 0 && i % 32 == 0) + printf "\\n\\t" + # Additionally Hangul[11XX(17), AC00(172) - D7FF(215)] is decomposable. + if (blockmap[i] || i == 17 || (i >= 172 && i <= 215)) + printf "1," + else + printf "0," + } + printf "\\n};\\n\\n" + # + # Output a macro to get a canonical combining class. + # + print "/* Get Canonical Combining Class(CCC). */" + printf "#define CCC(uc)\\t\\\\\n" + printf "\\t(((uc) > 0x%s)?0:\\\\\\n", max + printf "\\tccc_val[ccc_val_index[ccc_index[(uc)>>8]][((uc)>>4)&0x0F]][(uc)&0x0F])\\n" + print "" + # + # Output a canonical combining class value table. + # + midcnt = 0 + printf "/* The table of the value of Canonical Cimbining Class */\\n" + print "static const unsigned char ccc_val[][16] = {" + print " /* idx=0: XXXX0 - XXXXF */" + print " { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }," + for (h = 0; h <= highnum; h++) { + if (!blockmap[h]) + continue; + for (m = 0; m < 16; m++) { + if (!xx_blockmap[h, m]) + continue; + midcnt++ + printf " /* idx=%d: %03X%1X0 - %03X%1XF */\\n {", midcnt, h, m, h, m + for (l = 0; l < 15; l++) { + printf "%d, ", xxx_blockmap[h, m, l] + } + printf "%d },\n", xxx_blockmap[h, m, 15] + } + } + printf "};\n" + # + # Output the index table of the canonical combining class value table. + # + cnt = 0 + midcnt = 0 + printf "\\n/* The index table to ccc_val[*][16] */\\n" + print "static const unsigned char ccc_val_index[][16] = {" + print " /* idx=0: XXX00 - XXXFF */" + print " { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }," + for (h = 0; h <= highnum; h++) { + if (!blockmap[h]) + continue; + cnt++ + printf " /* idx=%d: %03X00 - %03XFF */\\n {", cnt, h, h + for (m = 0; m < 16; m++) { + if (m != 0) + printf "," + if (xx_blockmap[h, m]) { + midcnt++ + printf "%2d", midcnt + } else + printf " 0" + } + printf " },\\n" + } + printf "};\\n" + # + # Output the index table to the index table of the canonical combining + # class value table. + # + printf "\\n/* The index table to ccc_val_index[*][16] */\\n" + printf "static const unsigned char ccc_index[] = {\\n ", h + cnt = 0 + for (h = 0; h <= highnum; h++) { + if (h != 0 && h % 24 == 0) + printf "\\n " + if (blockmap[h]) { + cnt++; + printf "%2d,", cnt + } else + printf " 0," + } + print "};" + print "" +} +# +# +function hextoi(hex) +{ + dec = 0 + for (i=0; i < length(hex); i++) { + x = substr(hex, i+1, 1) + if (x ~/[0-9]/) + dec = dec * 16 + x; + else if (x == "A") + dec = dec * 16 + 10; + else if (x == "B") + dec = dec * 16 + 11; + else if (x == "C") + dec = dec * 16 + 12; + else if (x == "D") + dec = dec * 16 + 13; + else if (x == "E") + dec = dec * 16 + 14; + else if (x == "F") + dec = dec * 16 + 15; + } + return dec +} +# +# Collect Canonical Combining Class values. +# +\$4 ~/^[0-9A-F]+$/ { + if (\$4 !~/^0$/) { + if (min == "") { + min = \$1 + } + max = \$1 + high = substr(\$1, 1, length(\$1) -2) + highnum = hextoi(high) + mid = substr(\$1, length(\$1) -1, 1) + midnum = hextoi(mid) + low = substr(\$1, length(\$1), 1) + lownum = hextoi(low) + blockmap[highnum] = 1 + xx_blockmap[highnum, midnum] = 1 + xxx_blockmap[highnum, midnum, lownum] = \$4 + } +} +# +# Following code points are not decomposed in MAC OS. +# U+2000 - U+2FFF +# U+F900 - U+FAFF +# U+2F800 - U+2FAFF +# +#\$1 ~/^2[0-9A-F][0-9A-F][0-9A-F]\$/ { +# next +#} +#\$1 ~/^F[9A][0-9A-F][0-9A-F]\$/ { +# next +#} +#\$1 ~/^2F[89A][0-9A-F][0-9A-F]\$/ { +# next +#} +# +# Exclusion code points specified by +# http://unicode.org/Public/6.0.0/ucd/CompositionExclusions.txt +## +# 1. Script Specifices +## +\$1 ~/^095[89ABCDEF]\$/ { + next +} +\$1 ~/^09D[CDF]\$/ { + next +} +\$1 ~/^0A3[36]\$/ { + next +} +\$1 ~/^0A5[9ABE]\$/ { + next +} +\$1 ~/^0B5[CD]\$/ { + next +} +\$1 ~/^0F4[3D]\$/ { + next +} +\$1 ~/^0F5[27C]\$/ { + next +} +\$1 ~/^0F69\$/ { + next +} +\$1 ~/^0F7[68]\$/ { + next +} +\$1 ~/^0F9[3D]\$/ { + next +} +\$1 ~/^0FA[27C]\$/ { + next +} +\$1 ~/^0FB9\$/ { + next +} +\$1 ~/^FB1[DF]\$/ { + next +} +\$1 ~/^FB2[ABCDEF]\$/ { + next +} +\$1 ~/^FB3[012345689ABCE]\$/ { + next +} +\$1 ~/^FB4[01346789ABCDE]\$/ { + next +} +## +# 2. Post Composition Version precomposed characters +## +\$1 ~/^2ADC\$/ { + next +} +\$1 ~/^1D15[EF]\$/ { + next +} +\$1 ~/^1D16[01234]\$/ { + next +} +\$1 ~/^1D1B[BCDEF]\$/ { + next +} +\$1 ~/^1D1C0\$/ { + next +} +## +# 3. Singleton Decompositions +## +\$1 ~/^034[01]\$/ { + next +} +\$1 ~/^037[4E]\$/ { + next +} +\$1 ~/^0387\$/ { + next +} +\$1 ~/^1F7[13579BD]\$/ { + next +} +\$1 ~/^1FB[BE]\$/ { + next +} +\$1 ~/^1FC[9B]\$/ { + next +} +\$1 ~/^1FD[3B]\$/ { + next +} +\$1 ~/^1FE[3BEF]\$/ { + next +} +\$1 ~/^1FF[9BD]\$/ { + next +} +\$1 ~/^200[01]\$/ { + next +} +\$1 ~/^212[6AB]\$/ { + next +} +\$1 ~/^232[9A]\$/ { + next +} +\$1 ~/^F9[0-9A-F][0-9A-F]\$/ { + next +} +\$1 ~/^FA0[0-9A-D]\$/ { + next +} +\$1 ~/^FA1[025-9A-E]\$/ { + next +} +\$1 ~/^FA2[0256A-D]\$/ { + next +} +\$1 ~/^FA[3-5][0-9A-F]\$/ { + next +} +\$1 ~/^FA6[0-9A-D]\$/ { + next +} +\$1 ~/^FA[7-9A-C][0-9A-F]\$/ { + next +} +\$1 ~/^FAD[0-9]\$/ { + next +} +\$1 ~/^2F[89][0-9A-F][0-9A-F]\$/ { + next +} +\$1 ~/^2FA0[0-9A-F]\$/ { + next +} +\$1 ~/^2FA1[0-9A-D]\$/ { + next +} +## +# 4. Non-Starter Decompositions +## +\$1 ~/^0344\$/ { + next +} +\$1 ~/^0F7[35]\$/ { + next +} +\$1 ~/^0F81\$/ { + next +} +# +# Output combinations for NFD ==> NFC. +# +\$6 ~/^[0-9A-F]+ [0-9A-F]+\$/ { + split(\$6, cp, " ") + if (length(\$1) == 4) + print "0"cp[1], "0"cp[2], "0"\$1 | cmd + else + print cp[1], cp[2], \$1 | cmd + # NFC ==> NFD table. + if (length(\$1) == 4) + print "0"\$1, "0"cp[1], "0"cp[2] >>nfdtbl + else + print \$1, cp[1], cp[2] >>nfdtbl +} +AWK_END +################################################################################# +# awk script +# +################################################################################# +cat > ${pickout2} <> ${outfile} +awk -f ${pickout2} ${nfdtmp} >> ${outfile} +echo "#endif /* ARCHIVE_STRING_COMPOSITION_H_INCLUDED */" >> ${outfile} +echo "" >> ${outfile} +# +# Remove awk the script. +rm ${pickout} +rm ${pickout2} +rm ${nfdtmp} diff --git a/build/version b/build/version new file mode 100644 index 000000000000..937b126a2ede --- /dev/null +++ b/build/version @@ -0,0 +1 @@ +3001002 diff --git a/configure.ac b/configure.ac new file mode 100644 index 000000000000..73944d3e0754 --- /dev/null +++ b/configure.ac @@ -0,0 +1,788 @@ +dnl Process this file with autoconf to produce a configure script. + +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.1.2]) +m4_define([LIBARCHIVE_VERSION_N],[3001002]) + +dnl bsdtar and bsdcpio versioning tracks libarchive +m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) +m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S()) + +AC_PREREQ(2.65) + +# +# Now starts the "real" configure script. +# + +AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[libarchive-discuss@googlegroups.com]) +# Make sure the srcdir contains "libarchive" directory +AC_CONFIG_SRCDIR([libarchive]) +# Use auxiliary subscripts from this subdirectory (cleans up root) +AC_CONFIG_AUX_DIR([build/autoconf]) +# M4 scripts +AC_CONFIG_MACRO_DIR([build/autoconf]) +# Must follow AC_CONFIG macros above... +AM_INIT_AUTOMAKE() +m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) + +# Libtool's "interface version" can be computed from the libarchive version. + +# Libtool interface version bumps on any API change, so increments +# whenever libarchive minor version does. +ARCHIVE_MINOR=$(( (LIBARCHIVE_VERSION_N() / 1000) % 1000 )) +# Libarchive 2.7 == libtool interface 9 = 2 + 7 +# Libarchive 2.8 == libtool interface 10 = 2 + 8 +# Libarchive 2.9 == libtool interface 11 = 2 + 8 +# Libarchive 3.0 == libtool interface 12 +# Libarchive 3.1 == libtool interface 13 +ARCHIVE_INTERFACE=`echo $((13 + ${ARCHIVE_MINOR}))` +# Libarchive revision is bumped on any source change === libtool revision +ARCHIVE_REVISION=$(( LIBARCHIVE_VERSION_N() % 1000 )) +# Libarchive minor is bumped on any interface addition === libtool age +ARCHIVE_LIBTOOL_VERSION=$ARCHIVE_INTERFACE:$ARCHIVE_REVISION:$ARCHIVE_MINOR + +# Stick the version numbers into config.h +AC_DEFINE([LIBARCHIVE_VERSION_STRING],"LIBARCHIVE_VERSION_S()", + [Version number of libarchive]) +AC_DEFINE_UNQUOTED([LIBARCHIVE_VERSION_NUMBER],"LIBARCHIVE_VERSION_N()", + [Version number of libarchive as a single integer]) +AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()", + [Version number of bsdcpio]) +AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()", + [Version number of bsdtar]) + +# The shell variables here must be the same as the AC_SUBST() variables +# below, but the shell variable names apparently cannot be the same as +# the m4 macro names above. Why? Ask autoconf. +BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S() +BSDTAR_VERSION_STRING=BSDTAR_VERSION_S() +LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S() +LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N() + +# Substitute the above version numbers into the various files below. +# Yes, I believe this is the fourth time we define what are essentially +# the same symbols. Why? Ask autoconf. +AC_SUBST(ARCHIVE_LIBTOOL_VERSION) +AC_SUBST(BSDCPIO_VERSION_STRING) +AC_SUBST(BSDTAR_VERSION_STRING) +AC_SUBST(LIBARCHIVE_VERSION_STRING) +AC_SUBST(LIBARCHIVE_VERSION_NUMBER) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([build/pkgconfig/libarchive.pc]) + +# Check for host type +AC_CANONICAL_HOST + +dnl Compilation on mingw and Cygwin needs special Makefile rules +inc_windows_files=no +inc_cygwin_files=no +case "$host_os" in + *mingw* ) inc_windows_files=yes ;; + *cygwin*) inc_cygwin_files=yes ;; +esac +AM_CONDITIONAL([INC_WINDOWS_FILES], [test $inc_windows_files = yes]) +AM_CONDITIONAL([INC_CYGWIN_FILES], [test $inc_cygwin_files = yes]) + +dnl Defines that are required for specific platforms (e.g. -D_POSIX_SOURCE, etc) +PLATFORMCPPFLAGS= +case "$host_os" in + *mingw* ) PLATFORMCPPFLAGS=-D__USE_MINGW_ANSI_STDIO ;; +esac +AC_SUBST(PLATFORMCPPFLAGS) + +# Checks for programs. +AC_PROG_CC +AM_PROG_CC_C_O +AC_USE_SYSTEM_EXTENSIONS +AC_LIBTOOL_WIN32_DLL +AC_PROG_LIBTOOL +AC_CHECK_TOOL([STRIP],[strip]) + +# +# Options for building bsdtar. +# +# Default is to build bsdtar, but allow people to override that. +# +AC_ARG_ENABLE([bsdtar], + [AS_HELP_STRING([--enable-bsdtar], [enable build of bsdtar (default)]) + AS_HELP_STRING([--enable-bsdtar=static], [force static build of bsdtar]) + AS_HELP_STRING([--enable-bsdtar=shared], [force dynamic build of bsdtar]) +AS_HELP_STRING([--disable-bsdtar], [disable build of bsdtar])], + [], [enable_bsdtar=yes]) + +case "$enable_bsdtar" in +yes) + if test "$enable_static" = "no"; then + static_bsdtar=no + else + static_bsdtar=yes + fi + build_bsdtar=yes + ;; +dynamic|shared) + if test "$enable_shared" = "no"; then + AC_MSG_FAILURE([Shared linking of bsdtar requires shared libarchive]) + fi + build_bsdtar=yes + static_bsdtar=no + ;; +static) + build_bsdtar=yes + static_bsdtar=yes + ;; +no) + build_bsdtar=no + static_bsdtar=no + ;; +*) + AC_MSG_FAILURE([Unsupported value for --enable-bsdtar]) + ;; +esac + +AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ]) +AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ]) + +# +# Options for building bsdcpio. +# +# Default is not to build bsdcpio, but that can be overridden. +# +AC_ARG_ENABLE([bsdcpio], + [AS_HELP_STRING([--enable-bsdcpio], [enable build of bsdcpio (default)]) + AS_HELP_STRING([--enable-bsdcpio=static], [static build of bsdcpio]) + AS_HELP_STRING([--enable-bsdcpio=shared], [dynamic build of bsdcpio]) +AS_HELP_STRING([--disable-bsdcpio], [disable build of bsdcpio])], + [], [enable_bsdcpio=yes]) + +case "$enable_bsdcpio" in +yes) + if test "$enable_static" = "no"; then + static_bsdcpio=no + else + static_bsdcpio=yes + fi + build_bsdcpio=yes + ;; +dynamic|shared) + if test "$enabled_shared" = "no"; then + AC_MSG_FAILURE([Shared linking of bsdcpio requires shared libarchive]) + fi + build_bsdcpio=yes + ;; +static) + build_bsdcpio=yes + static_bsdcpio=yes + ;; +no) + build_bsdcpio=no + static_bsdcpio=no + ;; +*) + AC_MSG_FAILURE([Unsupported value for --enable-bsdcpio]) + ;; +esac + +AM_CONDITIONAL([BUILD_BSDCPIO], [ test "$build_bsdcpio" = yes ]) +AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ]) + +# Set up defines needed before including any headers +case $host in + *mingw* | *cygwin* ) + AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.]) + AC_DEFINE([WINVER], 0x0500, [Define to '0x0500' for Windows 2000 APIs.]) + ;; +esac + +# Checks for header files. +AC_HEADER_DIRENT +AC_HEADER_SYS_WAIT +AC_CHECK_HEADERS([acl/libacl.h attr/xattr.h copyfile.h ctype.h]) +AC_CHECK_HEADERS([errno.h ext2fs/ext2_fs.h fcntl.h grp.h]) + +AC_CACHE_CHECK([whether EXT2_IOC_GETFLAGS is usable], + [ac_cv_have_decl_EXT2_IOC_GETFLAGS], + [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([@%:@include +@%:@include ], + [int x = EXT2_IOC_GETFLAGS])], + [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes])], + [AS_VAR_SET([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [no])])]) + +AS_VAR_IF([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes], + [AC_DEFINE_UNQUOTED([HAVE_WORKING_EXT2_IOC_GETFLAGS], [1], + [Define to 1 if you have a working EXT2_IOC_GETFLAGS])]) + +AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h]) +AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h linux/types.h]) +AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.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/extattr.h]) +AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h]) +AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/statfs.h sys/statvfs.h]) +AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h]) +AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h]) +AC_CHECK_HEADERS([windows.h]) +# check windows.h first; the other headers require it. +AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[], +[[#ifdef HAVE_WINDOWS_H +# include +#endif +]]) + +# Checks for libraries. +AC_ARG_WITH([zlib], + AS_HELP_STRING([--without-zlib], [Don't build support for gzip through zlib])) + +if test "x$with_zlib" != "xno"; then + AC_CHECK_HEADERS([zlib.h]) + AC_CHECK_LIB(z,inflate) +fi + +AC_ARG_WITH([bz2lib], + AS_HELP_STRING([--without-bz2lib], [Don't build support for bzip2 through bz2lib])) + +if test "x$with_bz2lib" != "xno"; then + AC_CHECK_HEADERS([bzlib.h]) + case "$host_os" in + *mingw* | *cygwin*) + dnl AC_CHECK_LIB cannot be used on the Windows port of libbz2, therefore + dnl use AC_LINK_IFELSE. + AC_MSG_CHECKING([for BZ2_bzDecompressInit in -lbz2]) + old_LIBS="$LIBS" + LIBS="-lbz2 $LIBS" + AC_LINK_IFELSE( + [AC_LANG_SOURCE(#include + int main() { return BZ2_bzDecompressInit(NULL, 0, 0); })], + [ac_cv_lib_bz2_BZ2_bzDecompressInit=yes], + [ac_cv_lib_bz2_BZ2_bzDecompressInit=no]) + LIBS="$old_LIBS" + AC_MSG_RESULT($ac_cv_lib_bz2_BZ2_bzDecompressInit) + if test "x$ac_cv_lib_bz2_BZ2_bzDecompressInit" = xyes; then + AC_DEFINE([HAVE_LIBBZ2], [1], [Define to 1 if you have the `bz2' library (-lbz2).]) + LIBS="-lbz2 $LIBS" + fi + ;; + *) + AC_CHECK_LIB(bz2,BZ2_bzDecompressInit) + ;; + esac +fi + +AC_ARG_WITH([lzmadec], + AS_HELP_STRING([--without-lzmadec], [Don't build support for lzma through lzmadec])) + +if test "x$with_lzmadec" != "xno"; then + AC_CHECK_HEADERS([lzmadec.h]) + AC_CHECK_LIB(lzmadec,lzmadec_decode) +fi + +AC_ARG_WITH([iconv], + AS_HELP_STRING([--without-iconv], [Don't try to link against iconv])) + +if test "x$with_iconv" != "xno"; then + AM_ICONV + AC_CHECK_HEADERS([iconv.h],[],[],[#include ]) + if test "x$am_cv_func_iconv" = "xyes"; then + AC_CHECK_HEADERS([localcharset.h]) + am_save_LIBS="$LIBS" + LIBS="${LIBS} ${LIBICONV}" + AC_CHECK_FUNCS([locale_charset]) + LIBS="${am_save_LIBS}" + if test "x$ac_cv_func_locale_charset" != "xyes"; then + # If locale_charset() is not in libiconv, we have to find libcharset. + AC_CHECK_LIB(charset,locale_charset) + fi + fi +fi + +AC_ARG_WITH([lzma], + AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma])) + +if test "x$with_lzma" != "xno"; then + AC_CHECK_HEADERS([lzma.h]) + AC_CHECK_LIB(lzma,lzma_stream_decoder) +fi + +AC_ARG_WITH([lzo2], + AS_HELP_STRING([--without-lzo2], [Don't build support for lzop through liblzo2])) + +if test "x$with_lzo2" != "xno"; then + AC_CHECK_HEADERS([lzo/lzoconf.h lzo/lzo1x.h]) + AC_CHECK_LIB(lzo2,lzo1x_decompress_safe) +fi + +AC_ARG_WITH([nettle], + AS_HELP_STRING([--without-nettle], [Don't build with crypto support from Nettle])) +AC_ARG_WITH([openssl], + AS_HELP_STRING([--without-openssl], [Don't build support for mtree and xar hashes through openssl])) +case "$host_os" in + *darwin* ) with_openssl=no ;; +esac + +AC_ARG_WITH([xml2], + AS_HELP_STRING([--without-xml2], [Don't build support for xar through libxml2])) +AC_ARG_WITH([expat], + AS_HELP_STRING([--without-expat], [Don't build support for xar through expat])) + +if test "x$with_xml2" != "xno"; then + AC_PATH_PROG([XML2_CONFIG], [xml2-config],, [${PATH}]) + if test "x$XML2_CONFIG" != "x"; then + CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`" + LIBS="${LIBS} `${XML2_CONFIG} --libs`" + AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library)) + else + AC_CHECK_LIB(xml2,xmlInitParser) + fi + AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h]) +fi +if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then + if test "x$with_expat" != "xno"; then + AC_CHECK_HEADERS([expat.h]) + AC_CHECK_LIB(expat,XML_ParserCreate) + fi +fi + +AC_ARG_ENABLE([posix-regex-lib], + [AS_HELP_STRING([--enable-posix-regex-lib], + [choose what library to use for POSIX regular expression support (default: auto)]) + AS_HELP_STRING([--enable-posix-regex-lib=libc], [use libc POSIX regular expression support]) + AS_HELP_STRING([--enable-posix-regex-lib=libregex], [use libregex POSIX regular expression support]) + AS_HELP_STRING([--enable-posix-regex-lib=libpcreposix], [use libpcreposix POSIX regular expression support]) + AS_HELP_STRING([--disable-posix-regex-lib], [don't enable POSIX regular expression support])], + [], [enable_posix_regex_lib=auto]) + +posix_regex_lib_found= +if test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libc" || test "$enable_posix_regex_lib" = "libregex"; then + AC_CHECK_HEADERS([regex.h]) + if test "x$ac_cv_header_regex_h" != "xno"; then + AC_CHECK_FUNC(regcomp) + if test "x$ac_cv_func_regcomp" = xyes; then + posix_regex_lib_found=1 + else + AC_CHECK_LIB(regex,regcomp) + if test "x$ac_cv_lib_regex_regcomp" = xyes; then + posix_regex_lib_found=1 + fi + fi + fi +fi +if test -z $posix_regex_lib_found && (test "$enable_posix_regex_lib" = "auto" || test "$enable_posix_regex_lib" = "libpcreposix"); then + AC_CHECK_HEADERS([pcreposix.h]) + AC_CHECK_LIB(pcreposix,regcomp) + if test "x$ac_cv_lib_pcreposix_regcomp" != xyes; then + AC_MSG_NOTICE(trying libpcreposix check again with libpcre) + unset ac_cv_lib_pcreposix_regcomp + AC_CHECK_LIB(pcre,pcre_exec) + AC_CHECK_LIB(pcreposix,regcomp) + if test "x$ac_cv_lib_pcre_pcre_exec" = xyes && test "x$ac_cv_lib_pcreposix_regcomp" = xyes; then + AC_MSG_CHECKING(if PCRE_STATIC needs to be defined) + AC_LINK_IFELSE( + [AC_LANG_SOURCE(#include + int main() { return regcomp(NULL, NULL, 0); })], + [without_pcre_static=yes], + [without_pcre_static=no]) + AC_LINK_IFELSE( + [AC_LANG_SOURCE(#define PCRE_STATIC + #include + int main() { return regcomp(NULL, NULL, 0); })], + [with_pcre_static=yes], + [with_pcre_static=no]) + if test "x$without_pcre_static" != xyes && test "x$with_pcre_static" = xyes; then + AC_MSG_RESULT(yes) + AC_DEFINE([PCRE_STATIC], [1], [Define to 1 if PCRE_STATIC needs to be defined.]) + elif test "x$without_pcre_static" = xyes || test "x$with_pcre_static" = xyes; then + AC_MSG_RESULT(no) + fi + posix_regex_lib_found=1 + fi + else + posix_regex_lib_found=1 + fi +fi + +# TODO: Give the user the option of using a pre-existing system +# libarchive. This will define HAVE_LIBARCHIVE which will cause +# bsdtar_platform.h to use #include <...> for the libarchive headers. +# Need to include Makefile.am magic to link against system +# -larchive in that case. +#AC_CHECK_LIB(archive,archive_version) + +# Checks for typedefs, structures, and compiler characteristics. +AC_C_CONST +# AC_TYPE_UID_T defaults to "int", which is incorrect for MinGW +# and MSVC. Use a customized version. +la_TYPE_UID_T +AC_TYPE_MODE_T +# AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on +# most systems... default to "long long" instead. +AC_CHECK_TYPE(off_t, [long long]) +AC_TYPE_SIZE_T +AC_CHECK_TYPE(id_t, [unsigned long]) +AC_CHECK_TYPE(uintptr_t, [unsigned int]) + +# Check for tm_gmtoff in struct tm +AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,, +[ +#include +]) + +# Check for f_namemax in struct statfs +AC_CHECK_MEMBERS([struct statfs.f_namemax],,, +[ +#include +#include +]) + +# Check for f_iosize in struct statvfs +AC_CHECK_MEMBERS([struct statvfs.f_iosize],,, +[ +#include +]) + +# Check for birthtime in struct stat +AC_CHECK_MEMBERS([struct stat.st_birthtime]) + +# Check for high-resolution timestamps in struct stat +AC_CHECK_MEMBERS([struct stat.st_birthtimespec.tv_nsec]) +AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec]) +AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec]) +AC_CHECK_MEMBERS([struct stat.st_mtime_n]) # AIX +AC_CHECK_MEMBERS([struct stat.st_umtime]) # Tru64 +AC_CHECK_MEMBERS([struct stat.st_mtime_usec]) # Hurd +# Check for block size support in struct stat +AC_CHECK_MEMBERS([struct stat.st_blksize]) +# Check for st_flags in struct stat (BSD fflags) +AC_CHECK_MEMBERS([struct stat.st_flags]) + +# If you have uintmax_t, we assume printf supports %ju +# If you have unsigned long long, we assume printf supports %llu +# TODO: Check for %ju and %llu support directly. +AC_CHECK_TYPES([uintmax_t, unsigned long long]) + +# We use C99-style integer types +# Declare them if the local platform doesn't already do so. +AC_TYPE_INTMAX_T +AC_TYPE_UINTMAX_T +AC_TYPE_INT64_T +AC_TYPE_UINT64_T +AC_TYPE_INT32_T +AC_TYPE_UINT32_T +AC_TYPE_INT16_T +AC_TYPE_UINT16_T +AC_TYPE_UINT8_T + +AC_CHECK_DECLS([SIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) + +AC_CHECK_DECL([SSIZE_MAX], + [AC_DEFINE(HAVE_DECL_SSIZE_MAX, 1, [Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you don't.])], + [], + [#include ]) + +AC_CHECK_DECL([EFTYPE], + [AC_DEFINE(HAVE_EFTYPE, 1, [A possible errno value for invalid file format errors])], + [], + [#include ]) +AC_CHECK_DECL([EILSEQ], + [AC_DEFINE(HAVE_EILSEQ, 1, [A possible errno value for invalid file format errors])], + [], + [#include ]) +AC_CHECK_TYPE([wchar_t], + [AC_DEFINE_UNQUOTED(AS_TR_CPP(HAVE_[]wchar_t), 1, [Define to 1 if the system has the type `wchar_t'.])dnl + AC_CHECK_SIZEOF([wchar_t])], + []) + +AC_HEADER_TIME + +# Checks for library functions. +AC_PROG_GCC_TRADITIONAL +AC_HEADER_MAJOR +AC_FUNC_FSEEKO +AC_FUNC_MEMCMP +AC_FUNC_LSTAT +AC_FUNC_STAT +AC_FUNC_STRERROR_R +AC_FUNC_STRFTIME +AC_FUNC_VPRINTF +# check for: +# CreateHardLinkA(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES) +# To avoid necessity for including windows.h or special forward declaration +# workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *' +AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *]) +AC_CHECK_FUNCS([chflags chown chroot ctime_r dirfd]) +AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fork]) +AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate]) +AC_CHECK_FUNCS([futimens futimes futimesat]) +AC_CHECK_FUNCS([geteuid getpid getgrgid_r getgrnam_r]) +AC_CHECK_FUNCS([getpwnam_r getpwuid_r getvfsbyname gmtime_r]) +AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat lutimes]) +AC_CHECK_FUNCS([mbrtowc memmove memset]) +AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp]) +AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat]) +AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs]) +AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm]) +AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork]) +AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy]) +AC_CHECK_FUNCS([_ctime64_s _fseeki64]) +AC_CHECK_FUNCS([_get_timezone _localtime64_s _mkgmtime64]) +# detects cygwin-1.7, as opposed to older versions +AC_CHECK_FUNCS([cygwin_conv_path]) + +# There are several variants of readdir_r around; we only +# accept the POSIX-compliant version. +AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM([[#include ]], + [[DIR *dir; struct dirent e, *r; + return(readdir_r(dir, &e, &r));]])], + [AC_DEFINE(HAVE_READDIR_R,1,[Define to 1 if you have a POSIX compatible readdir_r])] +) + +# FreeBSD's nl_langinfo supports an option to specify whether the +# current locale uses month/day or day/month ordering. It makes the +# output a little prettier... +AC_CHECK_DECL([D_MD_ORDER], +[AC_DEFINE(HAVE_D_MD_ORDER, 1, [Define to 1 if nl_langinfo supports D_MD_ORDER])], +[], +[#if HAVE_LANGINFO_H +#include +#endif +]) + +# Check for dirent.d_namlen field explicitly +# (This is a bit more straightforward than, if not quite as portable as, +# the recipe given by the autoconf maintainers.) +AC_CHECK_MEMBER(struct dirent.d_namlen,,, +[#if HAVE_DIRENT_H +#include +#endif +]) + +# Check for Extended Attributes support +AC_ARG_ENABLE([xattr], + AS_HELP_STRING([--disable-xattr], + [Enable Extended Attributes support (default: check)])) + +if test "x$enable_xattr" != "xno"; then + AC_CHECK_HEADERS([attr/xattr.h]) + AC_CHECK_HEADERS([sys/xattr.h sys/ea.h]) + AC_CHECK_LIB(attr,setxattr) + AC_CHECK_FUNCS([extattr_get_file extattr_list_file]) + AC_CHECK_FUNCS([extattr_set_fd extattr_set_file]) + AC_CHECK_FUNCS([fgetxattr flistxattr fsetxattr getxattr]) + AC_CHECK_FUNCS([lgetxattr listxattr llistxattr lsetxattr]) + AC_CHECK_FUNCS([fgetea flistea fsetea getea]) + AC_CHECK_FUNCS([lgetea listea llistea lsetea]) + AC_CHECK_DECLS([EXTATTR_NAMESPACE_USER], [], [], [#include +#include +]) +fi + +# Check for ACL support +# +# The ACL support in libarchive is written against the POSIX1e draft, +# which was never officially approved and varies quite a bit across +# platforms. Worse, some systems have completely non-POSIX acl functions, +# which makes the following checks rather more complex than I would like. +# +AC_ARG_ENABLE([acl], + AS_HELP_STRING([--disable-acl], + [Enable ACL support (default: check)])) + +if test "x$enable_acl" != "xno"; then + AC_CHECK_HEADERS([sys/acl.h]) + AC_CHECK_LIB([acl],[acl_get_file]) + AC_CHECK_FUNCS([acl_create_entry acl_init acl_set_fd acl_set_fd_np acl_set_file]) + + AC_CHECK_TYPES(acl_permset_t,,, + [#if HAVE_SYS_TYPES_H + #include + #endif + #if HAVE_SYS_ACL_H + #include + #endif + ]) + + # The "acl_get_perm()" function was omitted from the POSIX draft. + # (It's a pretty obvious oversight; otherwise, there's no way to + # test for specific permissions in a permset.) Linux uses the obvious + # name, FreeBSD adds _np to mark it as "non-Posix extension." + # Test for both as a double-check that we really have POSIX-style ACL support. + AC_CHECK_FUNCS(acl_get_perm_np acl_get_perm acl_get_link acl_get_link_np,,, + [#if HAVE_SYS_TYPES_H + #include + #endif + #if HAVE_SYS_ACL_H + #include + #endif + ]) + + # MacOS has an acl.h that isn't POSIX. It can be detected by + # checking for ACL_USER + AC_CHECK_DECL([ACL_USER], + [AC_DEFINE(HAVE_ACL_USER, 1, [True for systems with POSIX ACL support])], + [], + [#include ]) +fi + +# Additional requirements +AC_SYS_LARGEFILE + +dnl NOTE: Crypto checks must run last. +AC_DEFUN([CRYPTO_CHECK], [ + if test "$found_$1" != yes; then + saved_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -I. -I$srcdir -I$srcdir/libarchive" + touch "check_crypto_md.h" + AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_$2]) + AC_LINK_IFELSE([AC_LANG_SOURCE([ +#define ARCHIVE_$1_COMPILE_TEST +#define ARCHIVE_CRYPTO_$1_$2 +#define PLATFORM_CONFIG_H "check_crypto_md.h" + +$(cat "$srcdir/libarchive/archive_crypto.c") + +int +main(int argc, char **argv) +{ + archive_$3_ctx ctx; + archive_$3_init(&ctx); + archive_$3_update(&ctx, *argv, argc); + archive_$3_final(&ctx, NULL); + return 0; +} +])], + [ AC_MSG_RESULT([yes]) + found_$1=yes + found_$2=yes + AC_DEFINE(ARCHIVE_CRYPTO_$1_$2, 1, [ $1 via ARCHIVE_CRYPTO_$1_$2 supported.]) + ], + [ AC_MSG_RESULT([no])]) + CPPFLAGS="$saved_CPPFLAGS" + rm "check_crypto_md.h" + fi +]) + +AC_DEFUN([CRYPTO_CHECK_WIN], [ + if test "$found_$1" != yes; then + AC_MSG_CHECKING([support for ARCHIVE_CRYPTO_$1_WIN]) + AC_LINK_IFELSE([AC_LANG_SOURCE([ +#define ARCHIVE_$1_COMPILE_TEST +#include +#include + +int +main(int argc, char **argv) +{ + (void)argc; + (void)argv; + + return ($2); +} +])], + [ AC_MSG_RESULT([yes]) + found_$1=yes + found_WIN=yes + AC_DEFINE(ARCHIVE_CRYPTO_$1_WIN, 1, [ $1 via ARCHIVE_CRYPTO_$1_WIN supported.]) + ], + [ AC_MSG_RESULT([no])]) + fi +]) + +case "$host_os" in + *mingw* | *cygwin*) + ;; + *) + CRYPTO_CHECK(MD5, LIBC, md5) + CRYPTO_CHECK(MD5, LIBSYSTEM, md5) + CRYPTO_CHECK(RMD160, LIBC, rmd160) + CRYPTO_CHECK(SHA1, LIBC, sha1) + CRYPTO_CHECK(SHA1, LIBSYSTEM, sha1) + CRYPTO_CHECK(SHA256, LIBC, sha256) + CRYPTO_CHECK(SHA256, LIBC2, sha256) + CRYPTO_CHECK(SHA256, LIBC3, sha256) + CRYPTO_CHECK(SHA256, LIBSYSTEM, sha256) + CRYPTO_CHECK(SHA384, LIBC, sha384) + CRYPTO_CHECK(SHA384, LIBC2, sha384) + CRYPTO_CHECK(SHA384, LIBC3, sha384) + CRYPTO_CHECK(SHA384, LIBSYSTEM, sha384) + CRYPTO_CHECK(SHA512, LIBC, sha512) + CRYPTO_CHECK(SHA512, LIBC2, sha512) + CRYPTO_CHECK(SHA512, LIBC3, sha512) + CRYPTO_CHECK(SHA512, LIBSYSTEM, sha512) + ;; +esac + +if test "x$with_nettle" != "xno"; then + AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h]) + saved_LIBS=$LIBS + AC_CHECK_LIB(nettle,main) + CRYPTO_CHECK(MD5, NETTLE, md5) + CRYPTO_CHECK(RMD160, NETTLE, rmd160) + CRYPTO_CHECK(SHA1, NETTLE, sha1) + CRYPTO_CHECK(SHA256, NETTLE, sha256) + CRYPTO_CHECK(SHA384, NETTLE, sha384) + CRYPTO_CHECK(SHA512, NETTLE, sha512) + if test "x$found_NETTLE" != "xyes"; then + LIBS=$saved_LIBS + fi +fi +if test "x$with_openssl" != "xno"; then + AC_CHECK_HEADERS([openssl/evp.h]) + saved_LIBS=$LIBS + case "$host_os" in + *mingw* | *cygwin*) + case "$host_cpu" in + x86_64) + AC_CHECK_LIB(eay64,main) + if test "x$ac_cv_lib_eay64_main" != "xyes"; then + AC_CHECK_LIB(eay32,main) + fi + ;; + *) + AC_CHECK_LIB(eay32,main) + ;; + esac + ;; + *) + AC_CHECK_LIB(crypto,main) + ;; + esac + CRYPTO_CHECK(MD5, OPENSSL, md5) + CRYPTO_CHECK(RMD160, OPENSSL, rmd160) + CRYPTO_CHECK(SHA1, OPENSSL, sha1) + CRYPTO_CHECK(SHA256, OPENSSL, sha256) + CRYPTO_CHECK(SHA384, OPENSSL, sha384) + CRYPTO_CHECK(SHA512, OPENSSL, sha512) + if test "x$found_OPENSSL" != "xyes"; then + LIBS=$saved_LIBS + fi +fi + +# Probe libmd AFTER OpenSSL/libcrypto. +# The two are incompatible and OpenSSL is more complete. +AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h]) +saved_LIBS=$LIBS +AC_CHECK_LIB(md,main) +CRYPTO_CHECK(MD5, LIBMD, md5) +CRYPTO_CHECK(RMD160, LIBMD, rmd160) +CRYPTO_CHECK(SHA1, LIBMD, sha1) +CRYPTO_CHECK(SHA256, LIBMD, sha256) +CRYPTO_CHECK(SHA512, LIBMD, sha512) +if test "x$found_LIBMD" != "xyes"; then + LIBS=$saved_LIBS +fi + +case "$host_os" in + *mingw* | *cygwin*) + CRYPTO_CHECK_WIN(MD5, CALG_MD5) + CRYPTO_CHECK_WIN(SHA1, CALG_SHA1) + CRYPTO_CHECK_WIN(SHA256, CALG_SHA_256) + CRYPTO_CHECK_WIN(SHA384, CALG_SHA_384) + CRYPTO_CHECK_WIN(SHA512, CALG_SHA_512) + ;; +esac + +AC_OUTPUT diff --git a/contrib/README b/contrib/README new file mode 100644 index 000000000000..8ad352a30204 --- /dev/null +++ b/contrib/README @@ -0,0 +1,59 @@ +Many people have graciously sent me configuration +files, small programs that use libarchive, and other +useful and interesting tidbits. + +I do not support or use any of these; but if you can use them, enjoy! + +====================================================================== + +From: Andre Stechert + +libarchive_autodetect-st_lib_archive.m4 + +M4 macros for use with autoconf to detect whether a suitable +version of libarchive is installed on this system. + + +====================================================================== + +libarchive.spec + +An RPM ".spec" file for building libarchive on most systems. +This apparently was originally developed by a group at pld-linux.org. +Several people have sent me different versions of this file. + +====================================================================== + +From: Robert Meier + +libarchive.1aix53.spec + +As above, for use on AIX5.3. + +====================================================================== + +psota-benchmark + +Some scripts used by Jan Psota in benchmarking +various tar implementations. + +I've edited his results slightly to correctly reflect that +bsdtar does not support a "compare" operation. + +====================================================================== + +shar + +A simple shar program written on top of libarchive. + +====================================================================== + +untar.c + +A very simple and very portable standalone program that can +extract basic ustar archives. +This does not use libarchive and so can be used to extract +the libarchive distribution on any system that has a C compiler +but does not have a tar program. + +====================================================================== diff --git a/contrib/libarchive.1aix53.spec b/contrib/libarchive.1aix53.spec new file mode 100644 index 000000000000..fe81d147e03e --- /dev/null +++ b/contrib/libarchive.1aix53.spec @@ -0,0 +1,160 @@ +# $LastChangedRevision$, $LastChangedDate$ +Summary: Library to create and read several different archive formats +Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów +Name: libarchive +Version: 2.0a3 +Release: 1aix53 +License: BSD +Group: Libraries +Source0: http://people.freebsd.org/~kientzle/libarchive/src/%{name}-%{version}.tar.gz +Patch: %{name}-0123457890.patch +URL: http://people.freebsd.org/~kientzle/libarchive/ +Requires: glibc +Requires: zlib +Requires: bzip2 +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: gawk +BuildRequires: zlib-devel +BuildRequires: bzip2 +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +Libarchive is a programming library that can create and read several +different streaming archive formats, including most popular TAR +variants and several CPIO formats. It can also write SHAR archives. + +%description -l pl +Libarchive jest bibliotek± s³u¿ac± to tworzenia i odczytu wielu +ró¿nych strumieniowych formatów archiwów, w³±czaj±c w to popularne +odmiany TAR oraz wiele formatów CPIO. Biblioteka ta potrafi tak¿e +zapisywaæ archiwa SHAR. + +%package devel +Summary: Header files for libarchive library +Summary(pl): Pliki nag³ówkowe biblioteki libarchive +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +Header files for libarchive library. + +%description devel -l pl +Pliki nag³ówkowe biblioteki libarchive. + +%package static +Summary: Static libarchive library +Summary(pl): Statyczna biblioteka libarchive +Group: Development/Libraries +Requires: %{name}-devel = %{version}-%{release} + +%description static +Static libarchive library. + +%description static -l pl +Statyczna biblioteka libarchive. + +%package -n bsdtar +Summary: bsdtar - tar(1) implementation based on libarchive +Summary(pl): bsdtar - implementacja programu tar(1) oparta na libarchive +Group: Applications/Archiving +Requires: %{name} = %{version}-%{release} + +%description -n bsdtar +bsdtar - tar(1) implementation based on libarchive. + +%description -n bsdtar -l pl +bsdtar - implementacja programu tar(1), oparta na libarchive. + +%prep +%setup -q +%patch0 -p1 + +%build +# Specify paths to avoid use of vacpp +# -maix64 - required to use large files with aix-5.3 +# -static - required for interoperability without copying libraries +# -D_BSD - required to include definition of makedev +# -X64 - required to assemble 64-bit COFF files +mkdir -p %{buildroot} +PATH=/opt/freeware/libexec:/opt/freeware/bin:/usr/local/bin:/usr/bin:/etc:/usr/sbin:/usr/ucb:/usr/bin/X11:/sbin:. \ +CPATH=/opt/freeware/include:/usr/local/include \ +LIBPATH=/opt/freeware/lib:/usr/local/lib:/usr/share/lib \ +LD_LIBRARY_PATH=/opt/freeware/lib:/usr/local/lib:/usr/share/lib \ +CFLAGS="$RPM_OPT_FLAGS -maix64 -static -D_BSD" \ +CXXFLAGS="$RPM_OPT_FLAGS -maix64 -static -D_BSD" \ +AR="ar -X64" \ +./configure \ +--prefix=%{_prefix} \ +--libexecdir=%{_libexecdir} \ +--mandir=%{_mandir} \ +--infodir=%{_infodir} \ +--enable-shared=yes \ +--enable-static=yes \ +| tee %{buildroot}/config.log +make | tee %{buildroot}/make.log + +%install +[ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot; +make DESTDIR=%buildroot install +# original install builds, but does install bsdtar +cp .libs/%{name}.a %{buildroot}%{_libdir} +cp bsdtar %{buildroot}%{_bindir} +cp tar/bsdtar.1 %{buildroot}%{_mandir}/man1 + +%clean +rm -fr %buildroot + +%files +%defattr(644,root,root,755) +%{_libdir}/libarchive.a + +%files devel +%defattr(644,root,root,755) +%{_libdir}/libarchive.la +%{_includedir}/*.h +%doc %{_mandir}/man3/* +%doc %{_mandir}/man5/* + +%files -n bsdtar +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/bsdtar +%doc %{_mandir}/man1/bsdtar.1* + +%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`) +%changelog +* %{date} PLD Team +All persons listed below can be reached at @pld-linux.org + +$Log: libarchive.spec,v $ +Release 1aix53 2006/12/12 rm1023@dcx.com +- tweak for aix-5.3 +- added libarchive-0123457890.patch for "0123457890" error +- replaced libarchive-1.3.1.tar.gz with libarchive-2.0a3.tar.gz +- removed obsolete -CVE-2006-5680.patch and -man_progname.patch + +Revision 1.6 2006/11/15 10:41:28 qboosh +- BR: acl-devel,attr-devel +- devel deps + +Revision 1.5 2006/11/08 22:22:25 twittner +- up to 1.3.1 +- added BR: e2fsprogs-devel +- added -CVE-2006-5680.patch against entering an infinite +loop in corrupt archives +- added bsdtar package (bsdtar is included now in libarchive +sources) +- rel. 0.1 for testing + +Revision 1.4 2005/12/15 18:26:36 twittner +- up to 1.2.37 +- removed -shared.patch (no longer needed) + +Revision 1.3 2005/10/05 17:00:12 arekm +- up to 1.02.034 + +Revision 1.2 2005/07/27 20:17:21 qboosh +- typo + +Revision 1.1 2005/07/27 08:36:03 adamg +- new diff --git a/contrib/libarchive.spec b/contrib/libarchive.spec new file mode 100644 index 000000000000..b5b658a874b1 --- /dev/null +++ b/contrib/libarchive.spec @@ -0,0 +1,147 @@ +# $LastChangedRevision$, $LastChangedDate$ +Summary: Library to create and read several different archive formats +Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów +Name: libarchive +Version: 2.0a3 +Release: 1 +License: BSD +Group: Libraries +Source0: http://people.freebsd.org/~kientzle/libarchive/src/%{name}-%{version}.tar.gz +Patch: %{name}-0123457890.patch +URL: http://people.freebsd.org/~kientzle/libarchive/ +Requires: glibc +Requires: zlib +Requires: bzip2 +BuildRequires: gcc +BuildRequires: gcc-c++ +BuildRequires: gawk +BuildRequires: zlib-devel +BuildRequires: bzip2 +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +Libarchive is a programming library that can create and read several +different streaming archive formats, including most popular TAR +variants and several CPIO formats. It can also write SHAR archives. + +%description -l pl +Libarchive jest bibliotek± s³u¿ac± to tworzenia i odczytu wielu +ró¿nych strumieniowych formatów archiwów, w³±czaj±c w to popularne +odmiany TAR oraz wiele formatów CPIO. Biblioteka ta potrafi tak¿e +zapisywaæ archiwa SHAR. + +%package devel +Summary: Header files for libarchive library +Summary(pl): Pliki nag³ówkowe biblioteki libarchive +Group: Development/Libraries +Requires: %{name} = %{version}-%{release} + +%description devel +Header files for libarchive library. + +%description devel -l pl +Pliki nag³ówkowe biblioteki libarchive. + +%package static +Summary: Static libarchive library +Summary(pl): Statyczna biblioteka libarchive +Group: Development/Libraries +Requires: %{name}-devel = %{version}-%{release} + +%description static +Static libarchive library. + +%description static -l pl +Statyczna biblioteka libarchive. + +%package -n bsdtar +Summary: bsdtar - tar(1) implementation based on libarchive +Summary(pl): bsdtar - implementacja programu tar(1) oparta na libarchive +Group: Applications/Archiving +Requires: %{name} = %{version}-%{release} + +%description -n bsdtar +bsdtar - tar(1) implementation based on libarchive. + +%description -n bsdtar -l pl +bsdtar - implementacja programu tar(1), oparta na libarchive. + +%prep +%setup -q +%patch0 -p1 + +%build +mkdir -p %{buildroot} +./configure \ +--prefix=%{_prefix} \ +--libexecdir=%{_libexecdir} \ +--mandir=%{_mandir} \ +--infodir=%{_infodir} \ +--enable-shared=yes \ +--enable-static=yes \ +| tee %{buildroot}/config.log +make | tee %{buildroot}/make.log + +%install +[ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot; +make DESTDIR=%buildroot install +# original install builds, but does install bsdtar +cp .libs/%{name}.a %{buildroot}%{_libdir} +cp bsdtar %{buildroot}%{_bindir} +cp tar/bsdtar.1 %{buildroot}%{_mandir}/man1 + +%clean +rm -fr %buildroot + +%files +%defattr(644,root,root,755) +%{_libdir}/libarchive.a + +%files devel +%defattr(644,root,root,755) +%{_libdir}/libarchive.la +%{_includedir}/*.h +%doc %{_mandir}/man3/* +%doc %{_mandir}/man5/* + +%files -n bsdtar +%defattr(644,root,root,755) +%attr(755,root,root) %{_bindir}/bsdtar +%doc %{_mandir}/man1/bsdtar.1* + +%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`) +%changelog +* %{date} PLD Team +All persons listed below can be reached at @pld-linux.org + +$Log: libarchive.spec,v $ +Release 1 2006/12/12 rm1023@dcx.com +- added libarchive-0123457890.patch for "0123457890" error +- replaced libarchive-1.3.1.tar.gz with libarchive-2.0a3.tar.gz +- removed obsolete -CVE-2006-5680.patch and -man_progname.patch + +Revision 1.6 2006/11/15 10:41:28 qboosh +- BR: acl-devel,attr-devel +- devel deps + +Revision 1.5 2006/11/08 22:22:25 twittner +- up to 1.3.1 +- added BR: e2fsprogs-devel +- added -CVE-2006-5680.patch against entering an infinite +loop in corrupt archives +- added bsdtar package (bsdtar is included now in libarchive +sources) +- rel. 0.1 for testing + +Revision 1.4 2005/12/15 18:26:36 twittner +- up to 1.2.37 +- removed -shared.patch (no longer needed) + +Revision 1.3 2005/10/05 17:00:12 arekm +- up to 1.02.034 + +Revision 1.2 2005/07/27 20:17:21 qboosh +- typo + +Revision 1.1 2005/07/27 08:36:03 adamg +- new diff --git a/contrib/libarchive_autodetect-st_lib_archive.m4 b/contrib/libarchive_autodetect-st_lib_archive.m4 new file mode 100644 index 000000000000..4419e888f240 --- /dev/null +++ b/contrib/libarchive_autodetect-st_lib_archive.m4 @@ -0,0 +1,154 @@ +dnl +dnl @synopsis ST_LIB_ARCHIVE([ENABLED-DEFAULT]) +dnl +dnl This macro figures out what's necessary to link a program against an +dnl instance of the BSD libarchive package by Tim Kientzle. +dnl +dnl See http://people.freebsd.org/~kientzle/libarchive/ for more info. +dnl +dnl It exports and substitutes the variables LIBARCHIVE_LIBS, LIBARCHIVE_LDFLAGS, +dnl and LIBARCHIVE_CPPFLAGS to appropriate values for the identified instance of +dnl libarchive. The values are AC_SUBST'd, so a user could, for example, simply +dnl include @LIBARCHIVE_CPPFLAGS@ in the definition of AM_CPPFLAGS in a Makefile.am. +dnl +dnl ENABLED-DEFAULT is either "yes" or "no" and determines whether the default value +dnl is --with-libarchive or --without-libarchive. It is not possible to specify a +dnl default directory. More simply, any reasonable choice for a default should just +dnl go into the auto-detect list. +dnl +dnl The macro defines the symbol HAVE_LIBARCHIVE if the library is found. You +dnl should use autoheader to include a definition for this symbol in a config.h +dnl file. Sample usage in a C/C++ source is as follows: +dnl +dnl #ifdef HAVE_LIBARCHIVE +dnl #include +dnl #endif /* HAVE_LIBARCHIVE */ +dnl +dnl @category InstalledPackages +dnl @author Andre Stechert +dnl @version 2006-04-20 +dnl @license GPLWithACException + +AC_DEFUN([ST_LIB_ARCHIVE], +[ +# +# Handle input from the configurer and blend with the requirements from the maintainer. +# We go through the trouble of creating a second set of variables other than the with_foo +# variables in order to be sure that error/corner cases have been cleaned up. +# +# After this statement, three trusted variable are defined. +# +# st_lib_archive_ENABLED will be either "yes" or "no". its value determines whether +# or not we bother with the rest of the checks and whether or not we export a +# bunch of variables. +# +# st_lib_archive_LOCATION will be either "auto" or "defined". if it is "auto", then +# we try a bunch of standard locations. if it is "defined", then we just try the value +# provided in st_lib_archive_DIR. +# +# st_lib_archive_DIR will contain the string provided by the user, provided that it's +# actually a directory. +# +AC_MSG_CHECKING([if libarchive is wanted]) +AC_ARG_WITH([libarchive], + AS_HELP_STRING([--with-libarchive=DIR], [libarchive installation directory]), + [if test "x$with_libarchive" = "xno" ; then + st_lib_archive_ENABLED=no + elif test "x$with_libarchive" = "xyes" ; then + st_lib_archive_ENABLED=yes + st_lib_archive_LOCATION=auto + else + st_lib_archive_ENABLED=yes + st_lib_archive_LOCATION=defined + if test -d "$with_libarchive" ; then + st_lib_archive_DIR="$with_libarchive" + else + AC_MSG_ERROR([$with_libarchive is not a directory]) + fi + fi], + [if test "x$1" = "xno" ; then + st_lib_archive_ENABLED=no + elif test "x$1" = "xyes" ; then + st_lib_archive_ENABLED=yes + else + st_lib_archive_ENABLED=yes + fi]) + +if test "$st_lib_archive_ENABLED" = "yes" ; then + AC_MSG_RESULT([yes]) +# +# After this statement, one trusted variable is defined. +# +# st_lib_archive_LIB will be either "lib" or "lib64", depending on whether the configurer +# specified 32, 64. The default is "lib". +# + AC_MSG_CHECKING([whether to use lib or lib64]) + AC_ARG_WITH([libarchive-bits], + AS_HELP_STRING([--with-libarchive-bits=32/64], [if 64, look in /lib64 on hybrid systems]), + [if test "x$with_libarchive_bits" = "x32" ; then + st_lib_archive_LIB=lib + elif test "x$with_libarchive_bits" = "x64" ; then + st_lib_archive_LIB=lib64 + else + AC_MSG_ERROR([the argument must be either 32 or 64]) + fi], + [st_lib_archive_LIB=lib]) + AC_MSG_RESULT($st_lib_archive_LIB) +# +# Save the environment before verifying libarchive availability +# + st_lib_archive_SAVECPPFLAGS="$CPPFLAGS" + st_lib_archive_SAVELDFLAGS="$LDFLAGS" + AC_LANG_SAVE + AC_LANG_C + + if test "x$st_lib_archive_LOCATION" = "xdefined" ; then + CPPFLAGS="-I$st_lib_archive_DIR/include $st_lib_archive_SAVECPPFLAGS" + LDFLAGS="-L$st_lib_archive_DIR/$st_lib_archive_LIB $st_lib_archive_SAVELDFLAGS" + AC_CHECK_LIB(archive, archive_read_new, [st_lib_archive_found_lib=yes], [st_lib_archive_found_lib=no]) + AC_CHECK_HEADER(archive.h, [st_lib_archive_found_hdr=yes], [st_lib_archive_found_hdr=no]) + if test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes"; then + LIBARCHIVE_CPPFLAGS="-I$dir/include" + LIBARCHIVE_LDFLAGS="-L$dir/$st_lib_archive_LIB" + else + AC_MSG_ERROR([could not find libarchive in the requested location]) + fi + else + # + # These are the common install directories for Linux, FreeBSD, Solaris, and Mac. + # + for dir in /usr /usr/local /usr/sfw /opt/csw /opt/local /sw + do + if test -d "$dir" ; then + CPPFLAGS="-I$dir/include $st_lib_archive_SAVECPPFLAGS" + LDFLAGS="-L$dir/$st_lib_archive_LIB $st_lib_archive_SAVELDFLAGS" + AC_CHECK_LIB(archive, archive_read_new, [st_lib_archive_found_lib=yes], [st_lib_archive_found_lib=no]) + AC_CHECK_HEADER(archive.h, [st_lib_archive_found_hdr=yes], [st_lib_archive_found_hdr=no]) + if test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes"; then + LIBARCHIVE_CPPFLAGS="-I$dir/include" + LIBARCHIVE_LDFLAGS="-L$dir/$st_lib_archive_LIB" + break + fi + fi + done + fi + + if test "x$st_lib_archive_found_hdr" = "xyes" && test "x$st_lib_archive_found_lib" = "xyes" ; then + LIBARCHIVE_LIBS="-larchive" + AC_DEFINE([HAVE_LIBARCHIVE], [1], [Defined to 1 if libarchive is available for use.]) + AC_SUBST(LIBARCHIVE_LIBS) + AC_SUBST(LIBARCHIVE_CPPFLAGS) + AC_SUBST(LIBARCHIVE_LDFLAGS) + fi + +# +# Restore the environment now that we're done. +# + AC_LANG_RESTORE + CPPFLAGS="$st_lib_archive_SAVECPPFLAGS" + LDFLAGS="$st_lib_archive_SAVELDFLAGS" +else + AC_MSG_RESULT([no]) +fi +AM_CONDITIONAL(LIBARCHIVE, test "x$st_lib_archive_found_lib" = "xyes" && test "x$st_lib_archive_found_hdr" = "xyes") +]) diff --git a/contrib/psota-benchmark/results.txt b/contrib/psota-benchmark/results.txt new file mode 100644 index 000000000000..2d364c5558dd --- /dev/null +++ b/contrib/psota-benchmark/results.txt @@ -0,0 +1,136 @@ +ODP: [Bug-tar] GNU tar, star and BSD tar speed comparison +new script + +Jan Psota +Thu, 25 Oct 2007 06:51:13 -0700 + +Latest TCP script at the bottom (3180 bytes). +4 tests: 64bit dual core Athlon tmpfs / disk (reiserfs) - 60MB/s, + 32bit Athlon tmpfs / disk (reiserfs) - 55MB/s +Both machines were idle -- used for testing only. +Tarball and extracted files were on different physical devices. +Test data: linux 2.6.22/3 kernel sources for memory operations, +for the other data average file size should bring enough info. + +2 x [...] processor means 1 processor with 2 cores (2 entries in cpuinfo). +Archive format is set to pax (Joerg). +Let's end with it. I only wanted to send You a new version of TCP script :-). + +-- +Jan Psota + +TCP, version 2007-10-25 +Linux 2.6.22-suspend2-r2 / Gentoo Base System release 2.0.0_rc5 +2012MB of memory, 2 x AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ 2211.348 +512 KB 4426.24 bmips +gcc (GCC) 4.2.2 (Gentoo 4.2.2 p1.0) +CFLAGS="-O2 -march=k8 -pipe" + +bsdtar: bsdtar 2.3.4 - libarchive 2.3.4 +gnutar: tar (GNU tar) 1.19 +star: star: star 1.5a85 (x86_64-unknown-linux-gnu) + +best time of 5 repetitions, + src=linux-2.6.23, 291M in 23867 files, avg 13KB/file, + archive=/tmp/tcp.tar, extract to /tmp/tcptmp +program operation real user system %CPU speed +bsdtar create 0.764 0.232 0.532 99.96 370308 KB/s +gnutar create 0.743 0.200 0.512 95.87 380775 KB/s +star create 0.587 0.040 0.820 100.00 441247 KB/s + +bsdtar list 0.164 0.096 0.068 99.84 1579341 KB/s +gnutar list 0.218 0.064 0.152 98.92 1188128 KB/s +star list 0.359 0.044 0.240 79.09 721481 KB/s + +bsdtar extract 0.733 0.200 0.504 96.02 353358 KB/s +gnutar extract 0.625 0.092 0.508 96.02 414419 KB/s +star extract 0.875 0.096 0.980 100.00 296013 KB/s + +bsdtar compare 0.001 0.000 0.000 0.00 259012000 KB/s +gnutar compare 0.719 0.288 0.400 95.66 360239 KB/s +star compare 0.695 0.224 0.636 100.00 372679 KB/s + +[...] +best time of 3 repetitions, + src=/home, 3.2G in 7447 files, avg 554KB/file, + archive=/var/tcp.tar, extract to /mnt/a/tcptmp +program operation real user system %CPU speed +bsdtar create 184.680 0.552 13.365 7.53 17958 KB/s +gnutar create 159.240 0.256 12.417 7.95 20827 KB/s +star create 181.779 0.140 14.789 8.21 18203 KB/s + +bsdtar list 0.053 0.032 0.016 91.41 62435471 KB/s +gnutar list 56.535 0.136 3.764 6.89 58531 KB/s +star list 56.652 0.080 5.236 9.38 58410 KB/s + +bsdtar extract 78.914 0.820 15.149 20.23 41932 KB/s +gnutar extract 78.480 0.196 14.197 18.33 42164 KB/s +star extract 79.439 0.132 12.973 16.49 41655 KB/s + +bsdtar compare 0.001 0.000 0.000 0.00 3309080000 KB/s +gnutar compare 61.771 3.464 8.905 20.02 53570 KB/s +star compare 57.561 1.728 9.897 20.19 57488 KB/s + + +Linux 2.6.22-suspend2-smp / Gentoo Base System release 2.0.0_rc5 +504MB of memory, 1 x AMD Athlon(tm) Processor 1500.033 256 KB 3002.55 bmips +gcc (GCC) 4.2.2 (Gentoo 4.2.2 p1.0) +CFLAGS="-O2 -march=athlon-xp -mfpmath=sse -frename-registers -pipe" + +bsdtar: bsdtar 2.3.4 - libarchive 2.3.4 +gnutar: tar (GNU tar) 1.19 +star: star: star 1.5a85 (i686-pc-linux-gnu) + +best time of 3 repetitions, + src=/usr/src/linux-2.6.22-suspend2/drivers, 119M in 5900 files, + avg 21KB/file, archive=/tmp/tcp.tar, extract to /tmp/tcptmp +program operation real user system %CPU speed +bsdtar create 1.329 0.192 1.132 99.63 89784 KB/s +gnutar create 1.223 0.124 1.092 99.46 97566 KB/s +star create 1.848 0.036 1.708 94.36 61372 KB/s + +bsdtar list 0.167 0.060 0.108 100.00 679137 KB/s +gnutar list 0.161 0.040 0.124 100.00 704447 KB/s +star list 0.859 0.044 0.716 88.51 132032 KB/s + +bsdtar extract 1.186 0.172 1.012 99.87 95629 KB/s +gnutar extract 1.064 0.056 1.004 99.63 106593 KB/s +star extract 1.920 0.088 1.724 94.40 59070 KB/s + +bsdtar compare 0.002 0.000 0.000 0.00 56708000 KB/s +gnutar compare 0.925 0.232 0.692 99.90 122611 KB/s +star compare 1.569 0.376 1.096 93.79 72285 KB/s + +[...] +best time of 3 repetitions, + src=/home/jasiu, 2.1G in 8416 files, avg 277KB/file, + archive=/home/j2/tcp.tar, extract to /mnt/a/tar/tcptmp +program operation real user system %CPU speed +bsdtar create 182.171 1.692 29.130 16.91 11584 KB/s +gnutar create 174.999 0.632 27.450 16.04 12059 KB/s +star create 180.004 0.360 41.795 23.41 11677 KB/s + +bsdtar list 0.214 0.076 0.136 99.04 9822294 KB/s +gnutar list 0.210 0.076 0.136 100.00 10009385 KB/s +star list 43.462 0.148 18.109 42.00 48363 KB/s + +bsdtar extract 94.912 4.476 31.574 37.98 22146 KB/s +gnutar extract 94.657 0.396 29.462 31.54 22206 KB/s +star extract 100.814 0.400 39.906 39.98 20849 KB/s + +bsdtar compare 0.003 0.000 0.004 100.00 700657000 KB/s +gnutar compare 80.174 3.932 20.365 30.30 26217 KB/s +star compare 73.911 8.341 27.670 48.72 28439 KB/s + +============================================================= + +Note by Tim Kientzle: The "bsdtar compare" results here are +invalid since bsdtar does not support that operation. +For the list numbers, note that libarchive automatically optimizes +list operations on uncompressed tar archives on disk by using lseek() +to skip over the bodies of entries. GNU tar added an option to +provide the same feature. + +The biggest problem with these tests is that they only +cover uncompressed archives stored on disk. The results for +compressed archives and/or archives stored on tape are +likely quite different. diff --git a/contrib/psota-benchmark/tcp.sh b/contrib/psota-benchmark/tcp.sh new file mode 100755 index 000000000000..3f630732be7c --- /dev/null +++ b/contrib/psota-benchmark/tcp.sh @@ -0,0 +1,110 @@ +#!/bin/sh +# tar comparison program +# 2007-10-25 Jan Psota + +n=3 # number of repetitions +TAR="bsdtar gnutar star" # Tape archivers to compare +OPT=("" "--seek" "-no-fsync") +pax="--format=pax" # comment out for defaults +OPN=(create list extract compare) # operations +version="2007-10-25" +TIMEFORMAT=$'%R\t%U\t%S\t%P' +LC_ALL=C + +test $# -ge 2 || { + echo -e "usage:\t$0 source_dir where_to_place_archive +[where_to_extract_it] + +TCP, version $version +TCP stands for Tar Comparison Program here. +It currently compares: BSD tar (bsdtar), GNU tar (gnutar) and star in archive +creation, listing, extraction and archive-to-extracted comparison. +Tcp prints out best time of n=$n repetitions. + +Tcp creates temporary archive named tcp.tar with $pax and some native +(--seek/-no-fsync) options and extracts it to [\$3]/tcptmp/. +If unset, third argument defaults to [\$2]. +After normal exit tcp removes tarball and extracted files. +Tcp does not check filesystems destination directories are on for free space, +so make sure there is enough space (a bit more than source_dir uses) for both: +archive and extracted files. +Do not use white space in arguments. + Jan Psota, $version" + exit 0 +} +src=$1 +dst=$2/tcp.tar +dst_path=${3:-$2}/tcptmp +test -e $dst -o -e /tmp/tcp \ + && { echo "$dst or /tmp/tcp exists, exiting"; exit 1; } +mkdir $dst_path || exit 2 + +use_times () +{ + awk -F"\t" -vN=$n -vL="`du -k $dst`" -vOFS="\t" -vORS="" ' + { if (NF==4) { printf "\t%s\t%10.1d KB/s\n", $0, ($1+0>0 ? +(L+0)/($1+0) : 0) } }' \ + /tmp/tcp | sort | head -1 + > /tmp/tcp +} + +test -d $src || { echo "'$src' is not a directory"; exit 3; } + +# system information: type, release, memory, cpu(s), compiler and flags +echo -e "TCP, version $version\n"`uname -sr`" / "`head -1 /etc/*-release` +free -m | awk '/^Mem/ { printf "%dMB of memory, ", $2 }' +test -e /proc/cpuinfo \ + && awk -F: '/name|cache size|MHz|mips/ { if (!a) b=b $2 } + /^$/ { a++ } END { print a" x"b" bmips" }' /proc/cpuinfo +test -e /etc/gentoo-release \ + && gcc --version | head -1 && grep ^CFLAGS /etc/make.conf + +# tar versions +t= +echo +for tar in $TAR; do + if which $tar &> /dev/null; then + t="$t $tar"; + echo -ne "$tar:\t"; $tar --version | head -1; + fi +done + +TAR="$t" + +echo -e "\nbest time of $n repetitions,\n"\ +" src=$src, "\ +`du -sh $src | awk '{print $1}'`" in "`find $src | wc -l`" files, "\ +"avg "$((`du -sk $src | awk '{print $1}'`/`find $src -type f | wc -l`))"KB/file,\n"\ +" archive=$dst, extract to $dst_path" + +echo -e "program\toperation\treal\tuser\tsystem\t%CPU\t speed" +> /tmp/tcp +let op_num=0 +for op in "cf $dst $pax -C $src ." "tf $dst" "xf $dst -C $dst_path" \ + "f $dst -C $dst_path --diff"; do + let tar_num=0 + for tar in $TAR; do + echo -en "$tar\t${OPN[op_num]}\t" + for ((i=1; i<=$n; i++)); do + echo $op | grep -q ^cf && rm -f $dst + echo $op | grep -q ^xf && + { chmod -R u+w $dst_path + rm -rf $dst_path; mkdir $dst_path; } + sync + if echo $op | grep -q ^f; then # op == compare + time $tar $op ${OPT[$tar_num]} > /dev/null + else # op in (create | list | extract) + time $tar $op ${OPT[$tar_num]} > /dev/null \ + || break 3 + fi 2>> /tmp/tcp + done + use_times + let tar_num++ + done + let op_num++ + echo +done +rm -rf $dst_path $dst +echo +cat /tmp/tcp +rm -f /tmp/tcp diff --git a/contrib/shar/Makefile b/contrib/shar/Makefile new file mode 100644 index 000000000000..3bd94d4192cb --- /dev/null +++ b/contrib/shar/Makefile @@ -0,0 +1,14 @@ +# $FreeBSD$ + +PROG= shar +SRCS= shar.c tree.c + +WARNS?= 6 + +DPADD= ${LIBARCHIVE} +LDADD= -larchive + +LINKS= ${BINDIR}/shar +MLINKS= shar.1 + +.include diff --git a/contrib/shar/shar.1 b/contrib/shar/shar.1 new file mode 100644 index 000000000000..e3152f299ebe --- /dev/null +++ b/contrib/shar/shar.1 @@ -0,0 +1,128 @@ +.\" Copyright (c) 1990, 1993 +.\" The Regents of the University of California. 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. +.\" 3. All advertising materials mentioning features or use of this software +.\" must display the following acknowledgement: +.\" This product includes software developed by the University of +.\" California, Berkeley and its contributors. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. +.\" +.\" @(#)shar.1 8.1 (Berkeley) 6/6/93 +.\" $FreeBSD$ +.\" +.Dd April 17, 2008 +.Dt SHAR 1 +.Os +.Sh NAME +.Nm shar +.Nd create a shell archive of files +.Sh SYNOPSIS +.Nm +.Op Fl br +.Op Fl o Ar archive-file +.Ar +.Sh DESCRIPTION +The +.Nm +command writes a +.Xr sh 1 +shell script which will recreate the file hierarchy specified by the command +line operands. +.Pp +The +.Nm +command is normally used for distributing files by +.Xr ftp 1 +or +.Xr mail 1 . +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl b +Use an alternative binary format. Content of files will be uuencoded. +This option should be used to archive binary files correctly. +In this mode also file permissions will be stored to the archive. +uudecode(1) is needed to extract archives created with this option. +.It Fl o Ar archive-file +Redirect output to +.Ar archive-file . +.It Fl r +If +.Ar file +given on command line is a directory the entire subtree will be archived. +Symbolic links given on command line are followed. Other symbolic links will +be archived as such. +.El +.Sh EXAMPLES +To create a shell archive of the program +.Xr ls 1 +and mail it to Rick: +.Bd -literal -offset indent +cd ls +shar -r . \&| mail -s "ls source" rick +.Ed +.Pp +To recreate the program directory: +.Bd -literal -offset indent +mkdir ls +cd ls +\&... + +\&... +sh archive +.Ed +.Sh SEE ALSO +.Xr compress 1 , +.Xr mail 1 , +.Xr tar 1 , +.Xr uuencode 1 , +.Xr uuencode 5 +.Sh HISTORY +The +.Nm +command appeared in +.Bx 4.4 . +This is a re-implementation based on the libarchive(3) library. +.Sh BUGS +The +.Nm +command makes no provisions for hard links. +.Pp +Files containing magic characters or files without a newline ('\\n') as the +last character are not handled correctly with the default format. Use the -b +option for binary files. +.Pp +It is easy to insert trojan horses into +.Nm +files. +It is strongly recommended that all shell archive files be examined +before running them through +.Xr sh 1 . +Archives produced using this implementation of +.Nm +may be easily examined with the command: +.Bd -literal -offset indent +egrep -v '^[X#]' shar.file +.Ed diff --git a/contrib/shar/shar.c b/contrib/shar/shar.c new file mode 100644 index 000000000000..6d5c206e2a51 --- /dev/null +++ b/contrib/shar/shar.c @@ -0,0 +1,314 @@ +/*- + * Copyright (c) 2008 Jaakko Heinonen + * 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 +#ifdef __FBSDID +__FBSDID("$FreeBSD$"); +#endif + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "tree.h" + +/* command line options */ +static int b_opt; /* use alternative shar binary format */ +static int r_opt; /* recurse into subdirectories */ +static char *o_arg; /* output file name */ + +static void +usage(void) +{ + fprintf(stderr, "Usage: shar [-br] [-o filename] file ...\n"); + exit(EX_USAGE); +} + +/* + * Initialize archive structure and create a shar archive. + */ +static struct archive * +shar_create(void) +{ + struct archive *a; + + if ((a = archive_write_new()) == NULL) + errx(EXIT_FAILURE, "%s", archive_error_string(a)); + + if (b_opt) + archive_write_set_format_shar_dump(a); + else + archive_write_set_format_shar(a); + archive_write_set_compression_none(a); + + if (archive_write_open_filename(a, o_arg) != ARCHIVE_OK) + errx(EX_CANTCREAT, "%s", archive_error_string(a)); + + return (a); +} + +/* buffer for file data */ +static char buffer[32768]; + +/* + * Write file data to an archive entry. + */ +static int +shar_write_entry_data(struct archive *a, const int fd) +{ + ssize_t bytes_read, bytes_written; + + assert(a != NULL); + assert(fd >= 0); + + bytes_read = read(fd, buffer, sizeof(buffer)); + while (bytes_read != 0) { + if (bytes_read < 0) { + archive_set_error(a, errno, "Read failed"); + return (ARCHIVE_WARN); + } + bytes_written = archive_write_data(a, buffer, bytes_read); + if (bytes_written < 0) + return (ARCHIVE_WARN); + bytes_read = read(fd, buffer, sizeof(buffer)); + } + + return (ARCHIVE_OK); +} + +/* + * Write a file to the archive. We have special handling for symbolic links. + */ +static int +shar_write_entry(struct archive *a, const char *pathname, const char *accpath, + const struct stat *st) +{ + struct archive_entry *entry; + int fd = -1; + int ret = ARCHIVE_OK; + + assert(a != NULL); + assert(pathname != NULL); + assert(accpath != NULL); + assert(st != NULL); + + entry = archive_entry_new(); + + if (S_ISREG(st->st_mode) && st->st_size > 0) { + /* regular file */ + if ((fd = open(accpath, O_RDONLY)) == -1) { + warn("%s", accpath); + ret = ARCHIVE_WARN; + goto out; + } + } else if (S_ISLNK(st->st_mode)) { + /* symbolic link */ + char lnkbuff[PATH_MAX + 1]; + int lnklen; + if ((lnklen = readlink(accpath, lnkbuff, PATH_MAX)) == -1) { + warn("%s", accpath); + ret = ARCHIVE_WARN; + goto out; + } + lnkbuff[lnklen] = '\0'; + archive_entry_set_symlink(entry, lnkbuff); + } + archive_entry_copy_stat(entry, st); + archive_entry_set_pathname(entry, pathname); + if (!S_ISREG(st->st_mode) || st->st_size == 0) + archive_entry_set_size(entry, 0); + if (archive_write_header(a, entry) != ARCHIVE_OK) { + warnx("%s: %s", pathname, archive_error_string(a)); + ret = ARCHIVE_WARN; + goto out; + } + if (fd >= 0) { + if ((ret = shar_write_entry_data(a, fd)) != ARCHIVE_OK) + warnx("%s: %s", accpath, archive_error_string(a)); + } +out: + archive_entry_free(entry); + if (fd >= 0) + close(fd); + + return (ret); +} + +/* + * Write singe path to the archive. The path can be a regular file, directory + * or device. Symbolic links are followed. + */ +static int +shar_write_path(struct archive *a, const char *pathname) +{ + struct stat st; + + assert(a != NULL); + assert(pathname != NULL); + + if ((stat(pathname, &st)) == -1) { + warn("%s", pathname); + return (ARCHIVE_WARN); + } + + return (shar_write_entry(a, pathname, pathname, &st)); +} + +/* + * Write tree to the archive. If pathname is a symbolic link it will be + * followed. Other symbolic links are stored as such to the archive. + */ +static int +shar_write_tree(struct archive *a, const char *pathname) +{ + struct tree *t; + const struct stat *lst, *st; + int error = 0; + int tree_ret; + int first; + + assert(a != NULL); + assert(pathname != NULL); + + t = tree_open(pathname); + for (first = 1; (tree_ret = tree_next(t)); first = 0) { + if (tree_ret == TREE_ERROR_DIR) { + warnx("%s: %s", tree_current_path(t), + strerror(tree_errno(t))); + error = 1; + continue; + } else if (tree_ret != TREE_REGULAR) + continue; + if ((lst = tree_current_lstat(t)) == NULL) { + warn("%s", tree_current_path(t)); + error = 1; + continue; + } + /* + * If the symlink was given on command line then + * follow it rather than write it as symlink. + */ + if (first && S_ISLNK(lst->st_mode)) { + if ((st = tree_current_stat(t)) == NULL) { + warn("%s", tree_current_path(t)); + error = 1; + continue; + } + } else + st = lst; + + if (shar_write_entry(a, tree_current_path(t), + tree_current_access_path(t), st) != ARCHIVE_OK) + error = 1; + + tree_descend(t); + } + + tree_close(t); + + return ((error != 0) ? ARCHIVE_WARN : ARCHIVE_OK); +} + +/* + * Create a shar archive and write files/trees into it. + */ +static int +shar_write(char **fn, size_t nfn) +{ + struct archive *a; + size_t i; + int error = 0; + + assert(fn != NULL); + assert(nfn > 0); + + a = shar_create(); + + for (i = 0; i < nfn; i++) { + if (r_opt) { + if (shar_write_tree(a, fn[i]) != ARCHIVE_OK) + error = 1; + } else { + if (shar_write_path(a, fn[i]) != ARCHIVE_OK) + error = 1; + } + } + + if (archive_write_free(a) != ARCHIVE_OK) + errx(EXIT_FAILURE, "%s", archive_error_string(a)); + + if (error != 0) + warnx("Error exit delayed from previous errors."); + + return (error); +} + +int +main(int argc, char **argv) +{ + int opt; + + while ((opt = getopt(argc, argv, "bro:")) != -1) { + switch (opt) { + case 'b': + b_opt = 1; + break; + case 'o': + o_arg = optarg; + break; + case 'r': + r_opt = 1; + break; + default: + usage(); + /* NOTREACHED */ + } + } + argc -= optind; + argv += optind; + + if(argc < 1) + usage(); + + if (shar_write(argv, argc) != 0) + exit(EXIT_FAILURE); + else + exit(EXIT_SUCCESS); + /* NOTREACHED */ +} + diff --git a/contrib/shar/tree.c b/contrib/shar/tree.c new file mode 100644 index 000000000000..d5a04abf5f4b --- /dev/null +++ b/contrib/shar/tree.c @@ -0,0 +1,542 @@ +/*- + * 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. + */ + +/*- + * This is a new directory-walking system that addresses a number + * of problems I've had with fts(3). In particular, it has no + * pathname-length limits (other than the size of 'int'), handles + * deep logical traversals, uses considerably less memory, and has + * an opaque interface (easier to modify in the future). + * + * Internally, it keeps a single list of "tree_entry" items that + * represent filesystem objects that require further attention. + * Non-directories are not kept in memory: they are pulled from + * readdir(), returned to the client, then freed as soon as possible. + * Any directory entry to be traversed gets pushed onto the stack. + * + * There is surprisingly little information that needs to be kept for + * each item on the stack. Just the name, depth (represented here as the + * string length of the parent directory's pathname), and some markers + * indicating how to get back to the parent (via chdir("..") for a + * regular dir or via fchdir(2) for a symlink). + */ +#include "tree_config.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_DIRENT_H +#include +#endif +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + +#include "tree.h" + +/* + * TODO: + * 1) Loop checking. + * 3) Arbitrary logical traversals by closing/reopening intermediate fds. + */ + +struct tree_entry { + struct tree_entry *next; + struct tree_entry *parent; + char *name; + size_t dirname_length; + dev_t dev; + ino_t ino; + int fd; + int flags; +}; + +/* Definitions for tree_entry.flags bitmap. */ +#define isDir 1 /* This entry is a regular directory. */ +#define isDirLink 2 /* This entry is a symbolic link to a directory. */ +#define needsPreVisit 4 /* This entry needs to be previsited. */ +#define needsPostVisit 8 /* This entry needs to be postvisited. */ + +/* + * Local data for this package. + */ +struct tree { + struct tree_entry *stack; + struct tree_entry *current; + DIR *d; + int initialDirFd; + int flags; + int visit_type; + int tree_errno; /* Error code from last failed operation. */ + + char *buff; + const char *basename; + size_t buff_length; + size_t path_length; + size_t dirname_length; + + int depth; + int openCount; + int maxOpenCount; + + struct stat lst; + struct stat st; +}; + +/* Definitions for tree.flags bitmap. */ +#define needsReturn 8 /* Marks first entry as not having been returned yet. */ +#define hasStat 16 /* The st entry is set. */ +#define hasLstat 32 /* The lst entry is set. */ + + +#ifdef HAVE_DIRENT_D_NAMLEN +/* BSD extension; avoids need for a strlen() call. */ +#define D_NAMELEN(dp) (dp)->d_namlen +#else +#define D_NAMELEN(dp) (strlen((dp)->d_name)) +#endif + +#if 0 +#include +void +tree_dump(struct tree *t, FILE *out) +{ + struct tree_entry *te; + + fprintf(out, "\tdepth: %d\n", t->depth); + fprintf(out, "\tbuff: %s\n", t->buff); + fprintf(out, "\tpwd: "); fflush(stdout); system("pwd"); + fprintf(out, "\taccess: %s\n", t->basename); + fprintf(out, "\tstack:\n"); + for (te = t->stack; te != NULL; te = te->next) { + fprintf(out, "\t\tte->name: %s%s%s\n", te->name, + te->flags & needsPreVisit ? "" : " *", + t->current == te ? " (current)" : ""); + } +} +#endif + +/* + * Add a directory path to the current stack. + */ +static void +tree_push(struct tree *t, const char *path) +{ + struct tree_entry *te; + + te = malloc(sizeof(*te)); + memset(te, 0, sizeof(*te)); + te->next = t->stack; + t->stack = te; + te->fd = -1; + te->name = strdup(path); + te->flags = needsPreVisit | needsPostVisit; + te->dirname_length = t->dirname_length; +} + +/* + * Append a name to the current path. + */ +static void +tree_append(struct tree *t, const char *name, size_t name_length) +{ + char *p; + + if (t->buff != NULL) + t->buff[t->dirname_length] = '\0'; + /* Strip trailing '/' from name, unless entire name is "/". */ + while (name_length > 1 && name[name_length - 1] == '/') + name_length--; + + /* Resize pathname buffer as needed. */ + while (name_length + 1 + t->dirname_length >= t->buff_length) { + t->buff_length *= 2; + if (t->buff_length < 1024) + t->buff_length = 1024; + t->buff = realloc(t->buff, t->buff_length); + } + p = t->buff + t->dirname_length; + t->path_length = t->dirname_length + name_length; + /* Add a separating '/' if it's needed. */ + if (t->dirname_length > 0 && p[-1] != '/') { + *p++ = '/'; + t->path_length ++; + } + strncpy(p, name, name_length); + p[name_length] = '\0'; + t->basename = p; +} + +/* + * Open a directory tree for traversal. + */ +struct tree * +tree_open(const char *path) +{ + struct tree *t; + + t = malloc(sizeof(*t)); + memset(t, 0, sizeof(*t)); + tree_append(t, path, strlen(path)); + t->initialDirFd = open(".", O_RDONLY); + /* + * During most of the traversal, items are set up and then + * returned immediately from tree_next(). That doesn't work + * for the very first entry, so we set a flag for this special + * case. + */ + t->flags = needsReturn; + return (t); +} + +/* + * We've finished a directory; ascend back to the parent. + */ +static void +tree_ascend(struct tree *t) +{ + struct tree_entry *te; + + te = t->stack; + t->depth--; + if (te->flags & isDirLink) { + fchdir(te->fd); + close(te->fd); + t->openCount--; + } else { + chdir(".."); + } +} + +/* + * Pop the working stack. + */ +static void +tree_pop(struct tree *t) +{ + struct tree_entry *te; + + t->buff[t->dirname_length] = '\0'; + if (t->stack == t->current && t->current != NULL) + t->current = t->current->parent; + te = t->stack; + t->stack = te->next; + t->dirname_length = te->dirname_length; + t->basename = t->buff + t->dirname_length; + /* Special case: starting dir doesn't skip leading '/'. */ + if (t->dirname_length > 0) + t->basename++; + free(te->name); + free(te); +} + +/* + * Get the next item in the tree traversal. + */ +int +tree_next(struct tree *t) +{ + struct dirent *de = NULL; + + /* Handle the startup case by returning the initial entry. */ + if (t->flags & needsReturn) { + t->flags &= ~needsReturn; + return (t->visit_type = TREE_REGULAR); + } + + while (t->stack != NULL) { + /* If there's an open dir, get the next entry from there. */ + while (t->d != NULL) { + de = readdir(t->d); + if (de == NULL) { + closedir(t->d); + t->d = NULL; + } else if (de->d_name[0] == '.' + && de->d_name[1] == '\0') { + /* Skip '.' */ + } else if (de->d_name[0] == '.' + && de->d_name[1] == '.' + && de->d_name[2] == '\0') { + /* Skip '..' */ + } else { + /* + * Append the path to the current path + * and return it. + */ + tree_append(t, de->d_name, D_NAMELEN(de)); + t->flags &= ~hasLstat; + t->flags &= ~hasStat; + return (t->visit_type = TREE_REGULAR); + } + } + + /* If the current dir needs to be visited, set it up. */ + if (t->stack->flags & needsPreVisit) { + t->current = t->stack; + tree_append(t, t->stack->name, strlen(t->stack->name)); + t->stack->flags &= ~needsPreVisit; + /* If it is a link, set up fd for the ascent. */ + if (t->stack->flags & isDirLink) { + t->stack->fd = open(".", O_RDONLY); + t->openCount++; + if (t->openCount > t->maxOpenCount) + t->maxOpenCount = t->openCount; + } + t->dirname_length = t->path_length; + if (chdir(t->stack->name) != 0) { + /* chdir() failed; return error */ + tree_pop(t); + t->tree_errno = errno; + return (t->visit_type = TREE_ERROR_DIR); + } + t->depth++; + t->d = opendir("."); + if (t->d == NULL) { + tree_ascend(t); /* Undo "chdir" */ + tree_pop(t); + t->tree_errno = errno; + return (t->visit_type = TREE_ERROR_DIR); + } + t->flags &= ~hasLstat; + t->flags &= ~hasStat; + t->basename = "."; + return (t->visit_type = TREE_POSTDESCENT); + } + + /* We've done everything necessary for the top stack entry. */ + if (t->stack->flags & needsPostVisit) { + tree_ascend(t); + tree_pop(t); + t->flags &= ~hasLstat; + t->flags &= ~hasStat; + return (t->visit_type = TREE_POSTASCENT); + } + } + return (t->visit_type = 0); +} + +/* + * Return error code. + */ +int +tree_errno(struct tree *t) +{ + return (t->tree_errno); +} + +/* + * Called by the client to mark the directory just returned from + * tree_next() as needing to be visited. + */ +void +tree_descend(struct tree *t) +{ + if (t->visit_type != TREE_REGULAR) + return; + + if (tree_current_is_physical_dir(t)) { + tree_push(t, t->basename); + t->stack->flags |= isDir; + } else if (tree_current_is_dir(t)) { + tree_push(t, t->basename); + t->stack->flags |= isDirLink; + } +} + +/* + * Get the stat() data for the entry just returned from tree_next(). + */ +const struct stat * +tree_current_stat(struct tree *t) +{ + if (!(t->flags & hasStat)) { + if (stat(t->basename, &t->st) != 0) + return NULL; + t->flags |= hasStat; + } + return (&t->st); +} + +/* + * Get the lstat() data for the entry just returned from tree_next(). + */ +const struct stat * +tree_current_lstat(struct tree *t) +{ + if (!(t->flags & hasLstat)) { + if (lstat(t->basename, &t->lst) != 0) + return NULL; + t->flags |= hasLstat; + } + return (&t->lst); +} + +/* + * Test whether current entry is a dir or link to a dir. + */ +int +tree_current_is_dir(struct tree *t) +{ + const struct stat *st; + + /* + * If we already have lstat() info, then try some + * cheap tests to determine if this is a dir. + */ + if (t->flags & hasLstat) { + /* If lstat() says it's a dir, it must be a dir. */ + if (S_ISDIR(tree_current_lstat(t)->st_mode)) + return 1; + /* Not a dir; might be a link to a dir. */ + /* If it's not a link, then it's not a link to a dir. */ + if (!S_ISLNK(tree_current_lstat(t)->st_mode)) + return 0; + /* + * It's a link, but we don't know what it's a link to, + * so we'll have to use stat(). + */ + } + + st = tree_current_stat(t); + /* If we can't stat it, it's not a dir. */ + if (st == NULL) + return 0; + /* Use the definitive test. Hopefully this is cached. */ + return (S_ISDIR(st->st_mode)); +} + +/* + * Test whether current entry is a physical directory. Usually, we + * already have at least one of stat() or lstat() in memory, so we + * use tricks to try to avoid an extra trip to the disk. + */ +int +tree_current_is_physical_dir(struct tree *t) +{ + const struct stat *st; + + /* + * If stat() says it isn't a dir, then it's not a dir. + * If stat() data is cached, this check is free, so do it first. + */ + if ((t->flags & hasStat) + && (!S_ISDIR(tree_current_stat(t)->st_mode))) + return 0; + + /* + * Either stat() said it was a dir (in which case, we have + * to determine whether it's really a link to a dir) or + * stat() info wasn't available. So we use lstat(), which + * hopefully is already cached. + */ + + st = tree_current_lstat(t); + /* If we can't stat it, it's not a dir. */ + if (st == NULL) + return 0; + /* Use the definitive test. Hopefully this is cached. */ + return (S_ISDIR(st->st_mode)); +} + +/* + * Test whether current entry is a symbolic link. + */ +int +tree_current_is_physical_link(struct tree *t) +{ + const struct stat *st = tree_current_lstat(t); + if (st == NULL) + return 0; + return (S_ISLNK(st->st_mode)); +} + +/* + * Return the access path for the entry just returned from tree_next(). + */ +const char * +tree_current_access_path(struct tree *t) +{ + return (t->basename); +} + +/* + * Return the full path for the entry just returned from tree_next(). + */ +const char * +tree_current_path(struct tree *t) +{ + return (t->buff); +} + +/* + * Return the length of the path for the entry just returned from tree_next(). + */ +size_t +tree_current_pathlen(struct tree *t) +{ + return (t->path_length); +} + +/* + * Return the nesting depth of the entry just returned from tree_next(). + */ +int +tree_current_depth(struct tree *t) +{ + return (t->depth); +} + +/* + * Terminate the traversal and release any resources. + */ +void +tree_close(struct tree *t) +{ + /* Release anything remaining in the stack. */ + while (t->stack != NULL) + tree_pop(t); + if (t->buff) + free(t->buff); + /* chdir() back to where we started. */ + if (t->initialDirFd >= 0) { + fchdir(t->initialDirFd); + close(t->initialDirFd); + t->initialDirFd = -1; + } + free(t); +} diff --git a/contrib/shar/tree.h b/contrib/shar/tree.h new file mode 100644 index 000000000000..ff38f5346c1c --- /dev/null +++ b/contrib/shar/tree.h @@ -0,0 +1,115 @@ +/*- + * 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$ + */ + +/*- + * A set of routines for traversing directory trees. + * Similar in concept to the fts library, but with a few + * important differences: + * * Uses less memory. In particular, fts stores an entire directory + * in memory at a time. This package only keeps enough subdirectory + * information in memory to track the traversal. Information + * about non-directories is discarded as soon as possible. + * * Supports very deep logical traversals. The fts package + * uses "non-chdir" approach for logical traversals. This + * package does use a chdir approach for logical traversals + * and can therefore handle pathnames much longer than + * PATH_MAX. + * * Supports deep physical traversals "out of the box." + * Due to the memory optimizations above, there's no need to + * limit dir names to 32k. + */ + +#include +#include + +struct tree; + +/* Initiate/terminate a tree traversal. */ +struct tree *tree_open(const char * /* pathname */); +void tree_close(struct tree *); + +/* + * tree_next() returns Zero if there is no next entry, non-zero if there is. + * Note that directories are potentially visited three times. The first + * time as "regular" file. If tree_descend() is invoked at that time, + * the directory is added to a work list and will be visited two more + * times: once just after descending into the directory and again + * just after ascending back to the parent. + * + * TREE_ERROR is returned if the descent failed (because the + * directory couldn't be opened, for instance). This is returned + * instead of TREE_PREVISIT/TREE_POSTVISIT. + */ +#define TREE_REGULAR 1 +#define TREE_POSTDESCENT 2 +#define TREE_POSTASCENT 3 +#define TREE_ERROR_DIR -1 +int tree_next(struct tree *); + +int tree_errno(struct tree *); + +/* + * Request that current entry be visited. If you invoke it on every + * directory, you'll get a physical traversal. This is ignored if the + * current entry isn't a directory or a link to a directory. So, if + * you invoke this on every returned path, you'll get a full logical + * traversal. + */ +void tree_descend(struct tree *); + +/* + * Return information about the current entry. + */ + +int tree_current_depth(struct tree *); +/* + * The current full pathname, length of the full pathname, + * and a name that can be used to access the file. + * Because tree does use chdir extensively, the access path is + * almost never the same as the full current path. + */ +const char *tree_current_path(struct tree *); +size_t tree_current_pathlen(struct tree *); +const char *tree_current_access_path(struct tree *); +/* + * Request the lstat() or stat() data for the current path. Since the + * tree package needs to do some of this anyway, and caches the + * results, you should take advantage of it here if you need it rather + * than make a redundant stat() or lstat() call of your own. + */ +const struct stat *tree_current_stat(struct tree *); +const struct stat *tree_current_lstat(struct tree *); +/* The following tests may use mechanisms much faster than stat()/lstat(). */ +/* "is_physical_dir" is equivalent to S_ISDIR(tree_current_lstat()->st_mode) */ +int tree_current_is_physical_dir(struct tree *); +/* "is_physical_link" is equivalent to S_ISLNK(tree_current_lstat()->st_mode) */ +int tree_current_is_physical_link(struct tree *); +/* "is_dir" is equivalent to S_ISDIR(tree_current_stat()->st_mode) */ +int tree_current_is_dir(struct tree *); + +/* For testing/debugging: Dump the internal status to the given filehandle. */ +void tree_dump(struct tree *, FILE *); diff --git a/contrib/shar/tree_config.h b/contrib/shar/tree_config.h new file mode 100644 index 000000000000..8dfd90baf685 --- /dev/null +++ b/contrib/shar/tree_config.h @@ -0,0 +1,78 @@ +/*- + * 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$ + */ +#ifndef TREE_CONFIG_H_INCLUDED +#define TREE_CONFIG_H_INCLUDED + +#if defined(PLATFORM_CONFIG_H) +/* + * Use hand-built config.h in environments that need it. + */ +#include PLATFORM_CONFIG_H +#elif defined(HAVE_CONFIG_H) +/* + * Most POSIX platforms use the 'configure' script to build config.h + */ +#include "../config.h" +#elif defined(__FreeBSD__) +/* + * Built-in definitions for FreeBSD. + */ +#define HAVE_DIRENT_D_NAMLEN 1 +#define HAVE_DIRENT_H 1 +#define HAVE_ERRNO_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_LIBARCHIVE 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_UNISTD_H 1 +#else +/* + * Warn if there's no platform configuration. + */ +#error Oops: No config.h and no built-in configuration in bsdtar_platform.h. +#endif /* !HAVE_CONFIG_H */ + +/* No non-FreeBSD platform will have __FBSDID, so just define it here. */ +#ifdef __FreeBSD__ +#include /* For __FBSDID */ +#else +/* Just leaving this macro replacement empty leads to a dangling semicolon. */ +#define __FBSDID(a) struct _undefined_hack +#endif + +#ifdef HAVE_LIBARCHIVE +/* If we're using the platform libarchive, include system headers. */ +#include +#include +#else +/* Otherwise, include user headers. */ +#include "archive.h" +#include "archive_entry.h" +#endif + +#endif /* !TREE_CONFIG_H_INCLUDED */ diff --git a/contrib/untar.c b/contrib/untar.c new file mode 100644 index 000000000000..c4cc2bf9bea2 --- /dev/null +++ b/contrib/untar.c @@ -0,0 +1,225 @@ +/* + * "untar" is an extremely simple tar extractor: + * * A single C source file, so it should be easy to compile + * and run on any system with a C compiler. + * * Extremely portable standard C. The only non-ANSI function + * used is mkdir(). + * * Reads basic ustar tar archives. + * * Does not require libarchive or any other special library. + * + * To compile: cc -o untar untar.c + * + * Usage: untar + * + * In particular, this program should be sufficient to extract the + * distribution for libarchive, allowing people to bootstrap + * libarchive on systems that do not already have a tar program. + * + * To unpack libarchive-x.y.z.tar.gz: + * * gunzip libarchive-x.y.z.tar.gz + * * untar libarchive-x.y.z.tar + * + * Written by Tim Kientzle, March 2009. + * + * Released into the public domain. + */ + +/* These are all highly standard and portable headers. */ +#include +#include +#include + +/* This is for mkdir(); this may need to be changed for some platforms. */ +#include /* For mkdir() */ + +/* Parse an octal number, ignoring leading and trailing nonsense. */ +static int +parseoct(const char *p, size_t n) +{ + int i = 0; + + while ((*p < '0' || *p > '7') && n > 0) { + ++p; + --n; + } + while (*p >= '0' && *p <= '7' && n > 0) { + i *= 8; + i += *p - '0'; + ++p; + --n; + } + return (i); +} + +/* Returns true if this is 512 zero bytes. */ +static int +is_end_of_archive(const char *p) +{ + int n; + for (n = 511; n >= 0; --n) + if (p[n] != '\0') + return (0); + return (1); +} + +/* Create a directory, including parent directories as necessary. */ +static void +create_dir(char *pathname, int mode) +{ + char *p; + int r; + + /* Strip trailing '/' */ + if (pathname[strlen(pathname) - 1] == '/') + pathname[strlen(pathname) - 1] = '\0'; + + /* Try creating the directory. */ + r = mkdir(pathname, mode); + + if (r != 0) { + /* On failure, try creating parent directory. */ + p = strrchr(pathname, '/'); + if (p != NULL) { + *p = '\0'; + create_dir(pathname, 0755); + *p = '/'; + r = mkdir(pathname, mode); + } + } + if (r != 0) + fprintf(stderr, "Could not create directory %s\n", pathname); +} + +/* Create a file, including parent directory as necessary. */ +static FILE * +create_file(char *pathname, int mode) +{ + FILE *f; + f = fopen(pathname, "w+"); + if (f == NULL) { + /* Try creating parent dir and then creating file. */ + char *p = strrchr(pathname, '/'); + if (p != NULL) { + *p = '\0'; + create_dir(pathname, 0755); + *p = '/'; + f = fopen(pathname, "w+"); + } + } + return (f); +} + +/* Verify the tar checksum. */ +static int +verify_checksum(const char *p) +{ + int n, u = 0; + for (n = 0; n < 512; ++n) { + if (n < 148 || n > 155) + /* Standard tar checksum adds unsigned bytes. */ + u += ((unsigned char *)p)[n]; + else + u += 0x20; + + } + return (u == parseoct(p + 148, 8)); +} + +/* Extract a tar archive. */ +static void +untar(FILE *a, const char *path) +{ + char buff[512]; + FILE *f = NULL; + size_t bytes_read; + int filesize; + + printf("Extracting from %s\n", path); + for (;;) { + bytes_read = fread(buff, 1, 512, a); + if (bytes_read < 512) { + fprintf(stderr, + "Short read on %s: expected 512, got %d\n", + path, (int)bytes_read); + return; + } + if (is_end_of_archive(buff)) { + printf("End of %s\n", path); + return; + } + if (!verify_checksum(buff)) { + fprintf(stderr, "Checksum failure\n"); + return; + } + filesize = parseoct(buff + 124, 12); + switch (buff[156]) { + case '1': + printf(" Ignoring hardlink %s\n", buff); + break; + case '2': + printf(" Ignoring symlink %s\n", buff); + break; + case '3': + printf(" Ignoring character device %s\n", buff); + break; + case '4': + printf(" Ignoring block device %s\n", buff); + break; + case '5': + printf(" Extracting dir %s\n", buff); + create_dir(buff, parseoct(buff + 100, 8)); + filesize = 0; + break; + case '6': + printf(" Ignoring FIFO %s\n", buff); + break; + default: + printf(" Extracting file %s\n", buff); + f = create_file(buff, parseoct(buff + 100, 8)); + break; + } + while (filesize > 0) { + bytes_read = fread(buff, 1, 512, a); + if (bytes_read < 512) { + fprintf(stderr, + "Short read on %s: Expected 512, got %d\n", + path, (int)bytes_read); + return; + } + if (filesize < 512) + bytes_read = filesize; + if (f != NULL) { + if (fwrite(buff, 1, bytes_read, f) + != bytes_read) + { + fprintf(stderr, "Failed write\n"); + fclose(f); + f = NULL; + } + } + filesize -= bytes_read; + } + if (f != NULL) { + fclose(f); + f = NULL; + } + } +} + +int +main(int argc, char **argv) +{ + FILE *a; + + ++argv; /* Skip program name */ + for ( ;*argv != NULL; ++argv) { + a = fopen(*argv, "r"); + if (a == NULL) + fprintf(stderr, "Unable to open %s\n", *argv); + else { + untar(a, *argv); + fclose(a); + } + } + return (0); +} diff --git a/cpio/CMakeLists.txt b/cpio/CMakeLists.txt new file mode 100644 index 000000000000..cc4aa14cb54b --- /dev/null +++ b/cpio/CMakeLists.txt @@ -0,0 +1,47 @@ +############################################ +# +# How to build bsdcpio +# +############################################ +IF(ENABLE_CPIO) + + SET(bsdcpio_SOURCES + cmdline.c + cpio.c + cpio.h + cpio_platform.h + ../libarchive_fe/err.c + ../libarchive_fe/err.h + ../libarchive_fe/lafe_platform.h + ../libarchive_fe/line_reader.c + ../libarchive_fe/line_reader.h + ) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe) + IF(WIN32 AND NOT CYGWIN) + LIST(APPEND bsdcpio_SOURCES cpio_windows.c) + LIST(APPEND bsdcpio_SOURCES cpio_windows.h) + ENDIF(WIN32 AND NOT CYGWIN) + + # bsdcpio documentation + SET(bsdcpio_MANS bsdcpio.1) + + # How to build bsdcpio + ADD_EXECUTABLE(bsdcpio ${bsdcpio_SOURCES}) + IF(ENABLE_CPIO_SHARED) + TARGET_LINK_LIBRARIES(bsdcpio archive ${ADDITIONAL_LIBS}) + ELSE(ENABLE_CPIO_SHARED) + TARGET_LINK_LIBRARIES(bsdcpio archive_static ${ADDITIONAL_LIBS}) + SET_TARGET_PROPERTIES(bsdcpio PROPERTIES COMPILE_DEFINITIONS + LIBARCHIVE_STATIC) + ENDIF(ENABLE_CPIO_SHARED) + # Full path to the compiled executable (used by test suite) + GET_TARGET_PROPERTY(BSDCPIO bsdcpio LOCATION) + + # Installation rules + INSTALL(TARGETS bsdcpio RUNTIME DESTINATION bin) + INSTALL_MAN(${bsdcpio_MANS}) + +ENDIF(ENABLE_CPIO) + +# Test suite +add_subdirectory(test) diff --git a/cpio/config_freebsd.h b/cpio/config_freebsd.h new file mode 100644 index 000000000000..ec4e4416e37f --- /dev/null +++ b/cpio/config_freebsd.h @@ -0,0 +1,56 @@ +/*- + * 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$ + */ + +/* A hand-tooled configuration for FreeBSD. */ + +#include /* __FreeBSD_version */ + +#define HAVE_DIRENT_H 1 +#define HAVE_ERRNO_H 1 +#define HAVE_FCNTL_H 1 +#define HAVE_FUTIMES 1 +#define HAVE_GRP_H 1 +#define HAVE_LIBARCHIVE 1 +#define HAVE_LINK 1 +#define HAVE_LSTAT 1 +#define HAVE_LUTIMES 1 +#define HAVE_PWD_H 1 +#define HAVE_READLINK 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYMLINK 1 +#define HAVE_SYS_CDEFS_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_TIME_H 1 +#define HAVE_UINTMAX_T 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UNSIGNED_LONG_LONG 1 +#define HAVE_UTIME_H 1 +#define HAVE_UTIMES 1 + diff --git a/cpio/cpio_windows.c b/cpio/cpio_windows.c new file mode 100644 index 000000000000..63f6df0397d2 --- /dev/null +++ b/cpio/cpio_windows.c @@ -0,0 +1,338 @@ +/*- + * Copyright (c) 2009 Michihiro NAKAJIMA + * 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$ + */ + +#if defined(_WIN32) && !defined(__CYGWIN__) + +#include "cpio_platform.h" +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_UTIME_H +#include +#endif +#include +#include +#include +#include +#include +#include + +#include "cpio.h" +#include "err.h" + +#define EPOC_TIME (116444736000000000ULL) + +static void cpio_dosmaperr(unsigned long); + +/* + * Prepend "\\?\" to the path name and convert it to unicode to permit + * an extended-length path for a maximum total path length of 32767 + * characters. + * see also http://msdn.microsoft.com/en-us/library/aa365247.aspx + */ +static wchar_t * +permissive_name(const char *name) +{ + wchar_t *wn, *wnp; + wchar_t *ws, *wsp; + DWORD l, len, slen, alloclen; + int unc; + + len = (DWORD)strlen(name); + wn = malloc((len + 1) * sizeof(wchar_t)); + if (wn == NULL) + return (NULL); + l = MultiByteToWideChar(CP_ACP, 0, name, len, wn, len); + if (l == 0) { + free(wn); + return (NULL); + } + wn[l] = L'\0'; + + /* Get a full path names */ + l = GetFullPathNameW(wn, 0, NULL, NULL); + if (l == 0) { + free(wn); + return (NULL); + } + wnp = malloc(l * sizeof(wchar_t)); + if (wnp == NULL) { + free(wn); + return (NULL); + } + len = GetFullPathNameW(wn, l, wnp, NULL); + free(wn); + wn = wnp; + + if (wnp[0] == L'\\' && wnp[1] == L'\\' && + wnp[2] == L'?' && wnp[3] == L'\\') + /* We have already permissive names. */ + return (wn); + + if (wnp[0] == L'\\' && wnp[1] == L'\\' && + wnp[2] == L'.' && wnp[3] == L'\\') { + /* Device names */ + if (((wnp[4] >= L'a' && wnp[4] <= L'z') || + (wnp[4] >= L'A' && wnp[4] <= L'Z')) && + wnp[5] == L':' && wnp[6] == L'\\') + wnp[2] = L'?';/* Not device names. */ + return (wn); + } + + unc = 0; + if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') { + wchar_t *p = &wnp[2]; + + /* Skip server-name letters. */ + while (*p != L'\\' && *p != L'\0') + ++p; + if (*p == L'\\') { + wchar_t *rp = ++p; + /* Skip share-name letters. */ + while (*p != L'\\' && *p != L'\0') + ++p; + if (*p == L'\\' && p != rp) { + /* Now, match patterns such as + * "\\server-name\share-name\" */ + wnp += 2; + len -= 2; + unc = 1; + } + } + } + + alloclen = slen = 4 + (unc * 4) + len + 1; + ws = wsp = malloc(slen * sizeof(wchar_t)); + if (ws == NULL) { + free(wn); + return (NULL); + } + /* prepend "\\?\" */ + wcsncpy(wsp, L"\\\\?\\", 4); + wsp += 4; + slen -= 4; + if (unc) { + /* append "UNC\" ---> "\\?\UNC\" */ + wcsncpy(wsp, L"UNC\\", 4); + wsp += 4; + slen -= 4; + } + wcsncpy(wsp, wnp, slen); + free(wn); + ws[alloclen - 1] = L'\0'; + return (ws); +} + +static HANDLE +cpio_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, + DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) +{ + wchar_t *wpath; + HANDLE handle; + + handle = CreateFileA(path, dwDesiredAccess, dwShareMode, + lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, + hTemplateFile); + if (handle != INVALID_HANDLE_VALUE) + return (handle); + if (GetLastError() != ERROR_PATH_NOT_FOUND) + return (handle); + wpath = permissive_name(path); + if (wpath == NULL) + return (handle); + handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode, + lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, + hTemplateFile); + free(wpath); + return (handle); +} + +#define WINTIME(sec, usec) ((Int32x32To64(sec, 10000000) + EPOC_TIME) + (usec * 10)) +static int +__hutimes(HANDLE handle, const struct __timeval *times) +{ + ULARGE_INTEGER wintm; + FILETIME fatime, fmtime; + + wintm.QuadPart = WINTIME(times[0].tv_sec, times[0].tv_usec); + fatime.dwLowDateTime = wintm.LowPart; + fatime.dwHighDateTime = wintm.HighPart; + wintm.QuadPart = WINTIME(times[1].tv_sec, times[1].tv_usec); + fmtime.dwLowDateTime = wintm.LowPart; + fmtime.dwHighDateTime = wintm.HighPart; + if (SetFileTime(handle, NULL, &fatime, &fmtime) == 0) { + errno = EINVAL; + return (-1); + } + return (0); +} + +int +futimes(int fd, const struct __timeval *times) +{ + + return (__hutimes((HANDLE)_get_osfhandle(fd), times)); +} + +int +utimes(const char *name, const struct __timeval *times) +{ + int ret; + HANDLE handle; + + handle = cpio_CreateFile(name, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (handle == INVALID_HANDLE_VALUE) { + cpio_dosmaperr(GetLastError()); + return (-1); + } + ret = __hutimes(handle, times); + CloseHandle(handle); + return (ret); +} + +/* + * The following function was modified from PostgreSQL sources and is + * subject to the copyright below. + */ +/*------------------------------------------------------------------------- + * + * win32error.c + * Map win32 error codes to errno values + * + * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group + * + * IDENTIFICATION + * $PostgreSQL: pgsql/src/port/win32error.c,v 1.4 2008/01/01 19:46:00 momjian Exp $ + * + *------------------------------------------------------------------------- + */ +/* +PostgreSQL Database Management System +(formerly known as Postgres, then as Postgres95) + +Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group + +Portions Copyright (c) 1994, The Regents of the University of California + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose, without fee, and without a written agreement +is hereby granted, provided that the above copyright notice and this +paragraph and the following two paragraphs appear in all copies. + +IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING +LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +*/ + +static const struct { + DWORD winerr; + int doserr; +} doserrors[] = +{ + { ERROR_INVALID_FUNCTION, EINVAL }, + { ERROR_FILE_NOT_FOUND, ENOENT }, + { ERROR_PATH_NOT_FOUND, ENOENT }, + { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, + { ERROR_ACCESS_DENIED, EACCES }, + { ERROR_INVALID_HANDLE, EBADF }, + { ERROR_ARENA_TRASHED, ENOMEM }, + { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, + { ERROR_INVALID_BLOCK, ENOMEM }, + { ERROR_BAD_ENVIRONMENT, E2BIG }, + { ERROR_BAD_FORMAT, ENOEXEC }, + { ERROR_INVALID_ACCESS, EINVAL }, + { ERROR_INVALID_DATA, EINVAL }, + { ERROR_INVALID_DRIVE, ENOENT }, + { ERROR_CURRENT_DIRECTORY, EACCES }, + { ERROR_NOT_SAME_DEVICE, EXDEV }, + { ERROR_NO_MORE_FILES, ENOENT }, + { ERROR_LOCK_VIOLATION, EACCES }, + { ERROR_SHARING_VIOLATION, EACCES }, + { ERROR_BAD_NETPATH, ENOENT }, + { ERROR_NETWORK_ACCESS_DENIED, EACCES }, + { ERROR_BAD_NET_NAME, ENOENT }, + { ERROR_FILE_EXISTS, EEXIST }, + { ERROR_CANNOT_MAKE, EACCES }, + { ERROR_FAIL_I24, EACCES }, + { ERROR_INVALID_PARAMETER, EINVAL }, + { ERROR_NO_PROC_SLOTS, EAGAIN }, + { ERROR_DRIVE_LOCKED, EACCES }, + { ERROR_BROKEN_PIPE, EPIPE }, + { ERROR_DISK_FULL, ENOSPC }, + { ERROR_INVALID_TARGET_HANDLE, EBADF }, + { ERROR_INVALID_HANDLE, EINVAL }, + { ERROR_WAIT_NO_CHILDREN, ECHILD }, + { ERROR_CHILD_NOT_COMPLETE, ECHILD }, + { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, + { ERROR_NEGATIVE_SEEK, EINVAL }, + { ERROR_SEEK_ON_DEVICE, EACCES }, + { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, + { ERROR_NOT_LOCKED, EACCES }, + { ERROR_BAD_PATHNAME, ENOENT }, + { ERROR_MAX_THRDS_REACHED, EAGAIN }, + { ERROR_LOCK_FAILED, EACCES }, + { ERROR_ALREADY_EXISTS, EEXIST }, + { ERROR_FILENAME_EXCED_RANGE, ENOENT }, + { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, + { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } +}; + +static void +cpio_dosmaperr(unsigned long e) +{ + int i; + + if (e == 0) { + errno = 0; + return; + } + + for (i = 0; i < (int)sizeof(doserrors); i++) { + if (doserrors[i].winerr == e) { + errno = doserrors[i].doserr; + return; + } + } + + /* fprintf(stderr, "unrecognized win32 error code: %lu", e); */ + errno = EINVAL; + return; +} +#endif diff --git a/cpio/cpio_windows.h b/cpio/cpio_windows.h new file mode 100644 index 000000000000..105bf69991de --- /dev/null +++ b/cpio/cpio_windows.h @@ -0,0 +1,72 @@ +/*- + * Copyright (c) 2009 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ +#ifndef CPIO_WINDOWS_H +#define CPIO_WINDOWS_H 1 + +#include +#include + +#define getgrgid(id) NULL +#define getgrnam(name) NULL +#define getpwnam(name) NULL +#define getpwuid(id) NULL + +#ifdef _MSC_VER +#define snprintf sprintf_s +#define strdup _strdup +#define open _open +#define read _read +#define close _close +#endif + +struct passwd { + char *pw_name; + uid_t pw_uid; + gid_t pw_gid; +}; + +struct group { + char *gr_name; + gid_t gr_gid; +}; + +struct _timeval64i32 { + time_t tv_sec; + long tv_usec; +}; +#define __timeval _timeval64i32 + +extern int futimes(int fd, const struct __timeval *times); +#ifndef HAVE_FUTIMES +#define HAVE_FUTIMES 1 +#endif +extern int utimes(const char *name, const struct __timeval *times); +#ifndef HAVE_UTIMES +#define HAVE_UTIMES 1 +#endif + +#endif /* CPIO_WINDOWS_H */ diff --git a/cpio/test/CMakeLists.txt b/cpio/test/CMakeLists.txt new file mode 100644 index 000000000000..09ca2c7d96b3 --- /dev/null +++ b/cpio/test/CMakeLists.txt @@ -0,0 +1,93 @@ +############################################ +# +# How to build bsdcpio_test +# +############################################ +IF(ENABLE_CPIO AND ENABLE_TEST) + SET(bsdcpio_test_SOURCES + ../cmdline.c + ../../libarchive_fe/err.c + ../../test_utils/test_utils.c + main.c + test.h + test_0.c + test_basic.c + test_cmdline.c + test_extract_cpio_Z + test_extract_cpio_bz2 + test_extract_cpio_grz + test_extract_cpio_gz + test_extract_cpio_lrz + test_extract_cpio_lz + test_extract_cpio_lzma + test_extract_cpio_lzo + test_extract_cpio_xz + test_format_newc.c + test_gcpio_compat.c + test_option_0.c + test_option_B_upper.c + test_option_C_upper.c + test_option_J_upper.c + test_option_L_upper.c + test_option_Z_upper.c + test_option_a.c + test_option_b64encode.c + test_option_c.c + test_option_d.c + test_option_f.c + test_option_grzip.c + test_option_help.c + test_option_l.c + test_option_lrzip.c + test_option_lzma.c + test_option_lzop.c + test_option_m.c + test_option_t.c + test_option_u.c + test_option_uuencode.c + test_option_version.c + test_option_xz.c + test_option_y.c + test_option_z.c + test_owner_parse.c + test_passthrough_dotdot.c + test_passthrough_reverse.c + ) + + # + # Register target + # + ADD_EXECUTABLE(bsdcpio_test ${bsdcpio_test_SOURCES}) + SET_PROPERTY(TARGET bsdcpio_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} ${bsdcpio_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 bsdcpio_${_testname} + COMMAND bsdcpio_test -vv + -p $ + -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(${CMAKE_SOURCE_DIR}/test_utils) + + # Experimental new test handling + ADD_CUSTOM_TARGET(run_bsdcpio_test + COMMAND bsdcpio_test -p ${BSDCPIO} -r ${CMAKE_CURRENT_SOURCE_DIR}) + ADD_DEPENDENCIES(run_bsdcpio_test bsdcpio) + ADD_DEPENDENCIES(run_all_tests run_bsdcpio_test) +ENDIF(ENABLE_CPIO AND ENABLE_TEST) + diff --git a/doc/html/.ignore_me b/doc/html/.ignore_me new file mode 100644 index 000000000000..d285484d4fee --- /dev/null +++ b/doc/html/.ignore_me @@ -0,0 +1,2 @@ +*** PLEASE DO NOT DELETE THIS FILE! *** +This file is used to track an otherwise empty directory in git. diff --git a/doc/man/.ignore_me b/doc/man/.ignore_me new file mode 100644 index 000000000000..d285484d4fee --- /dev/null +++ b/doc/man/.ignore_me @@ -0,0 +1,2 @@ +*** PLEASE DO NOT DELETE THIS FILE! *** +This file is used to track an otherwise empty directory in git. diff --git a/doc/mdoc2man.awk b/doc/mdoc2man.awk new file mode 100755 index 000000000000..726f628c0d3f --- /dev/null +++ b/doc/mdoc2man.awk @@ -0,0 +1,391 @@ +#!/usr/bin/awk +# +# Copyright (c) 2003 Peter Stuge +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +# Dramatically overhauled by Tim Kientzle. This version almost +# handles library-style pages with Fn, Ft, etc commands. Still +# a lot of problems... + +BEGIN { + displaylines = 0 + trailer = "" + out = "" + sep = "" + nextsep = " " +} + +# Add a word with appropriate preceding whitespace +# Maintain a short queue of the expected upcoming word separators. +function add(str) { + out=out sep str + sep = nextsep + nextsep = " " +} + +# Add a word with no following whitespace +# Use for opening punctuation such as '(' +function addopen(str) { + add(str) + sep = "" +} + +# Add a word with no preceding whitespace +# Use for closing punctuation such as ')' or '.' +function addclose(str) { + sep = "" + add(str) +} + +# Add a word with no space before or after +# Use for separating punctuation such as '=' +function addpunct(str) { + sep = "" + add(str) + sep = "" +} + +# Emit the current line so far +function endline() { + addclose(trailer) + trailer = "" + if(length(out) > 0) { + print out + out="" + } + if(displaylines > 0) { + displaylines = displaylines - 1 + if (displaylines == 0) + dispend() + } + # First word on next line has no preceding whitespace + sep = "" +} + +function linecmd(cmd) { + endline() + add(cmd) + endline() +} + +function breakline() { + linecmd(".br") +} + +# Start an indented display +function dispstart() { + linecmd(".RS 4") +} + +# End an indented display +function dispend() { + linecmd(".RE") +} + +# Collect rest of input line +function wtail() { + retval="" + while(w 0) { + sub("^[ \t]*", "", l) + if (match(l, "^\"")) { + l = substr(l, 2) + o = index(l, "\"") + if (o > 0) { + w = substr(l, 1, o-1) + l = substr(l, o+1) + dest[n++] = w + } else { + dest[n++] = l + l = "" + } + } else { + o = match(l, "[ \t]") + if (o > 0) { + w = substr(l, 1, o-1) + l = substr(l, o+1) + dest[n++] = w + } else { + dest[n++] = l + l = "" + } + } + } + return n-1 +} + +! /^\./ { + out = $0 + endline() + next +} + +/^\.\\"/ { next } + +{ + sub("^\\.","") + nwords=splitwords($0, words) + # TODO: Instead of iterating 'w' over the array, have a separate + # function that returns 'next word' and use that. This will allow + # proper handling of double-quoted arguments as well. + for(w=1;w<=nwords;w++) { + if(match(words[w],"^Li$")) { # Literal; rest of line is unformatted + dispstart() + displaylines = 1 + } else if(match(words[w],"^Dl$")) { # Display literal + dispstart() + displaylines = 1 + } else if(match(words[w],"^Bd$")) { # Begin display + if(match(words[w+1],"-literal")) { + dispstart() + linecmd(".nf") + displaylines=10000 + w=nwords + } + } else if(match(words[w],"^Ed$")) { # End display + displaylines = 0 + dispend() + } else if(match(words[w],"^Ns$")) { # Suppress space after next word + nextsep = "" + } else if(match(words[w],"^No$")) { # Normal text + add(words[++w]) + } else if(match(words[w],"^Dq$")) { # Quote + addopen("``") + add(words[++w]) + while(w") + } else if(match(words[w],"^Dd$")) { + date=wtail() + next + } else if(match(words[w],"^Dt$")) { + id=wtail() + next + } else if(match(words[w],"^Ox$")) { + add("OpenBSD") + } else if(match(words[w],"^Fx$")) { + add("FreeBSD") + } else if(match(words[w],"^Nx$")) { + add("NetBSD") + } else if(match(words[w],"^St$")) { + if (match(words[w+1], "^-p1003.1$")) { + w++ + add("IEEE Std 1003.1 (``POSIX.1'')") + } else if(match(words[w+1], "^-p1003.1-96$")) { + w++ + add("ISO/IEC 9945-1:1996 (``POSIX.1'')") + } else if(match(words[w+1], "^-p1003.1-88$")) { + w++ + add("IEEE Std 1003.1-1988 (``POSIX.1'')") + } else if(match(words[w+1], "^-p1003.1-2001$")) { + w++ + add("IEEE Std 1003.1-2001 (``POSIX.1'')") + } else if(match(words[w+1], "^-susv2$")) { + w++ + add("Version 2 of the Single UNIX Specification (``SUSv2'')") + } + } else if(match(words[w],"^Ex$")) { + if (match(words[w+1], "^-std$")) { + w++ + add("The \\fB" name "\\fP utility exits 0 on success, and >0 if an error occurs.") + } + } else if(match(words[w],"^Os$")) { + add(".TH " id " \"" date "\" \"" wtail() "\"") + } else if(match(words[w],"^Sh$")) { + section=wtail() + add(".SH " section) + linecmd(".ad l") + } else if(match(words[w],"^Xr$")) { + add("\\fB" words[++w] "\\fP(" words[++w] ")" words[++w]) + } else if(match(words[w],"^Nm$")) { + if(match(section,"SYNOPSIS")) + breakline() + if(w >= nwords) + n=name + else if (match(words[w+1], "^[A-Z][a-z]$")) + n=name + else if (match(words[w+1], "^[.,;:]$")) + n=name + else { + n=words[++w] + if(!length(name)) + name=n + } + if(!length(n)) + n=name + add("\\fB\\%" n "\\fP") + } else if(match(words[w],"^Nd$")) { + add("\\- " wtail()) + } else if(match(words[w],"^Fl$")) { + add("\\fB\\-" words[++w] "\\fP") + } else if(match(words[w],"^Ar$")) { + addopen("\\fI") + if(w==nwords) + add("file ...\\fP") + else + add(words[++w] "\\fP") + } else if(match(words[w],"^Cm$")) { + add("\\fB" words[++w] "\\fP") + } else if(match(words[w],"^Op$")) { + addopen("[") + option=1 + trailer="]" trailer + } else if(match(words[w],"^Pp$")) { + linecmd(".PP") + } else if(match(words[w],"^An$")) { + endline() + } else if(match(words[w],"^Ss$")) { + add(".SS") + } else if(match(words[w],"^Ft$")) { + if (match(section, "SYNOPSIS")) { + breakline() + } + add("\\fI" wtail() "\\fP") + if (match(section, "SYNOPSIS")) { + breakline() + } + } else if(match(words[w],"^Fn$")) { + ++w + F = "\\fB\\%" words[w] "\\fP(" + Fsep = "" + while(w\\fP") + } else if(match(words[w],"^Pa$")) { + addopen("\\fI") + w++ + if(match(words[w],"^\\.")) + add("\\&") + add(words[w] "\\fP") + } else if(match(words[w],"^Dv$")) { + add(".BR") + } else if(match(words[w],"^Em|Ev$")) { + add(".IR") + } else if(match(words[w],"^Pq$")) { + addopen("(") + trailer=")" trailer + } else if(match(words[w],"^Aq$")) { + addopen("\\%<") + trailer=">" trailer + } else if(match(words[w],"^Brq$")) { + addopen("{") + trailer="}" trailer + } else if(match(words[w],"^S[xy]$")) { + add(".B " wtail()) + } else if(match(words[w],"^Ic$")) { + add("\\fB") + trailer="\\fP" trailer + } else if(match(words[w],"^Bl$")) { + oldoptlist=optlist + linecmd(".RS 5") + if(match(words[w+1],"-bullet")) + optlist=1 + else if(match(words[w+1],"-enum")) { + optlist=2 + enum=0 + } else if(match(words[w+1],"-tag")) + optlist=3 + else if(match(words[w+1],"-item")) + optlist=4 + else if(match(words[w+1],"-bullet")) + optlist=1 + w=nwords + } else if(match(words[w],"^El$")) { + linecmd(".RE") + optlist=oldoptlist + } else if(match(words[w],"^It$")&&optlist) { + if(optlist==1) + add(".IP \\(bu") + else if(optlist==2) + add(".IP " ++enum ".") + else if(optlist==3) { + add(".TP") + endline() + if(match(words[w+1],"^Pa$|^Ev$")) { + add(".B") + w++ + } + } else if(optlist==4) + add(".IP") + } else if(match(words[w],"^Xo$")) { + # TODO: Figure out how to handle this + } else if(match(words[w],"^Xc$")) { + # TODO: Figure out how to handle this + } else if(match(words[w],"^[=]$")) { + addpunct(words[w]) + } else if(match(words[w],"^[[{(]$")) { + addopen(words[w]) + } else if(match(words[w],"^[\\])}.,;:]$")) { + addclose(words[w]) + } else { + add(words[w]) + } + } + if(match(out,"^\\.[^a-zA-Z]")) + sub("^\\.","",out) + endline() +} diff --git a/doc/mdoc2wiki.awk b/doc/mdoc2wiki.awk new file mode 100755 index 000000000000..5fee29c32952 --- /dev/null +++ b/doc/mdoc2wiki.awk @@ -0,0 +1,451 @@ +#!/usr/bin/awk +# +# Copyright (c) 2003 Peter Stuge +# +# Permission to use, copy, modify, and distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +# Dramatically overhauled by Tim Kientzle. This version almost +# handles library-style pages with Fn, Ft, etc commands. Still +# a lot of problems... + +BEGIN { + displaylines = 0 + listdepth = 0 + trailer = "" + out = "" + sep = "" + nextsep = " " + spaces = " " + + NORMAL_STATE = 0 + PRETAG_STATE = 1 + STATE = NORMAL_STATE +} + +# Add a word with appropriate preceding whitespace +# Maintain a short queue of the expected upcoming word separators. +function add(str) { + out=out sep str + sep = nextsep + nextsep = " " +} + +# Add a word with no following whitespace +# Use for opening punctuation such as '(' +function addopen(str) { + add(str) + sep = "" +} + +# Add a word with no preceding whitespace +# Use for closing punctuation such as ')' or '.' +function addclose(str) { + sep = "" + add(str) +} + +# Add a word with no space before or after +# Use for separating punctuation such as '=' +function addpunct(str) { + sep = "" + add(str) + sep = "" +} + +# Emit the current line so far +function endline() { + addclose(trailer) + trailer = "" + if(length(out) > 0) { + if (STATE == PRETAG_STATE) { + print out + } else { + print out " " + } + out="" + } + if(displaylines > 0) { + displaylines = displaylines - 1 + if (displaylines == 0) + dispend() + } + # First word on next line has no preceding whitespace + sep = "" +} + +function linecmd(cmd) { + endline() + add(cmd) + endline() +} + +function breakline() { + linecmd("
    ") +} + +# Start an indented display +function dispstart() { + linecmd("```text") +} + +# End an indented display +function dispend() { + linecmd("```") +} + +# Collect rest of input line +function wtail() { + retval="" + while(w 0) { + sub("^[ \t]*", "", l) + if (match(l, "^\"")) { + l = substr(l, 2) + o = index(l, "\"") + if (o > 0) { + w = substr(l, 1, o-1) + l = substr(l, o+1) + dest[n++] = w + } else { + dest[n++] = l + l = "" + } + } else { + o = match(l, "[ \t]") + if (o > 0) { + w = substr(l, 1, o-1) + l = substr(l, o+1) + dest[n++] = w + } else { + dest[n++] = l + l = "" + } + } + } + return n-1 +} + +! /^\./ { + out = $0 + endline() + next +} + +/^\.\\"/ { next } + +{ + sub("^\\.","") + nwords=splitwords($0, words) + # TODO: Instead of iterating 'w' over the array, have a separate + # function that returns 'next word' and use that. This will allow + # proper handling of double-quoted arguments as well. + for(w=1;w<=nwords;w++) { + if(match(words[w],"^Li$")) { # Literal; rest of line is unformatted + dispstart() + displaylines = 1 + } else if(match(words[w],"^Dl$")) { # Display literal + dispstart() + displaylines = 1 + } else if(match(words[w],"^Bd$")) { # Begin display + STATE = PRETAG_STATE + if(match(words[w+1],"-literal")) { + dispstart() + displaylines=10000 + w=nwords + } + } else if(match(words[w],"^Ed$")) { # End display + displaylines = 0 + dispend() + STATE = NORMAL_STATE + } else if(match(words[w],"^Ns$")) { # Suppress space before next word + sep="" + } else if(match(words[w],"^No$")) { # Normal text + add(words[++w]) + } else if(match(words[w],"^Dq$")) { # Quote + addopen("\"") + add(words[++w]) + while(w[") + } else if(match(words[w],"^Oc$")) { + addclose("]") + } else if(match(words[w],"^Ao$")) { + addopen("<") + } else if(match(words[w],"^Ac$")) { + addclose(">") + } else if(match(words[w],"^Dd$")) { + date=wtail() + next + } else if(match(words[w],"^Dt$")) { + id=words[++w] "(" words[++w] ")" + next + } else if(match(words[w],"^Ox$")) { + add("OpenBSD") + } else if(match(words[w],"^Fx$")) { + add("FreeBSD") + } else if(match(words[w],"^Bx$")) { + add("BSD") + } else if(match(words[w],"^Nx$")) { + add("NetBSD") + } else if(match(words[w],"^St$")) { + if (match(words[w+1], "^-p1003.1$")) { + w++ + add("IEEE Std 1003.1 (``POSIX.1'')") + } else if(match(words[w+1], "^-p1003.1-96$")) { + w++ + add("ISO/IEC 9945-1:1996 (``POSIX.1'')") + } else if(match(words[w+1], "^-p1003.1-88$")) { + w++ + add("IEEE Std 1003.1-1988 (``POSIX.1'')") + } else if(match(words[w+1], "^-p1003.1-2001$")) { + w++ + add("IEEE Std 1003.1-2001 (``POSIX.1'')") + } else if(match(words[w+1], "^-susv2$")) { + w++ + add("Version 2 of the Single UNIX Specification (``SUSv2'')") + } + } else if(match(words[w],"^Ex$")) { + if (match(words[w+1], "^-std$")) { + w++ + add("The '''" name "''' utility exits 0 on success, and >0 if an error occurs.") + } + } else if(match(words[w],"^Os$")) { + add(id " manual page") + } else if(match(words[w],"^Sh$")) { + section=wtail() + linecmd("== " section " ==") + } else if(match(words[w],"^Xr$")) { + add("'''" words[++w] "'''(" words[++w] ")" words[++w]) + } else if(match(words[w],"^Nm$")) { + if(match(section,"SYNOPSIS")) + breakline() + if(w >= nwords) + n=name + else if (match(words[w+1], "^[A-Z][a-z]$")) + n=name + else if (match(words[w+1], "^[.,;:]$")) + n=name + else { + n=words[++w] + if(!length(name)) + name=n + } + if(!length(n)) + n=name + if (displaylines == 0) + add("'''" n "'''") + else + add(n) + } else if(match(words[w],"^Nd$")) { + add("- " wtail()) + } else if(match(words[w],"^Fl$")) { + addopen("-") + } else if(match(words[w],"^Ar$")) { + if(w==nwords) + add("''file ...''") + else { + ++w + gsub("<", "<", words[w]) + add("''" words[w] "''") + } + } else if(match(words[w],"^Cm$")) { + ++w + if (displaylines == 0) { + add("'''" words[w] "'''") + } else + add(words[w]) + } else if(match(words[w],"^Op$")) { + addopen("[") + option=1 + trailer="]" trailer + } else if(match(words[w],"^Pp$")) { + ++w + endline() + print "" + } else if(match(words[w],"^An$")) { + if (match(words[w+1],"-nosplit")) + ++w + endline() + } else if(match(words[w],"^Ss$")) { + add("===") + trailer="===" + } else if(match(words[w],"^Ft$")) { + if (match(section, "SYNOPSIS")) { + breakline() + } + l = wtail() + add("'''" l "'''") + if (match(section, "SYNOPSIS")) { + breakline() + } + } else if(match(words[w],"^Fn$")) { + ++w + F = "'''" words[w] "'''(" + Fsep = "" + while(w#include <" words[w] ">'''") + } else if(match(words[w],"^Pa$")) { + w++ +# if(match(words[w],"^\\.")) +# add("\\&") + if (displaylines == 0) + add("''" words[w] "''") + else + add(words[w]) + } else if(match(words[w],"^Dv$")) { + linecmd() + } else if(match(words[w],"^Em|Ev$")) { + add(".IR") + } else if(match(words[w],"^Pq$")) { + addopen("(") + trailer=")" trailer + } else if(match(words[w],"^Aq$")) { + addopen(" <") + trailer=">" trailer + } else if(match(words[w],"^Brq$")) { + addopen("{") + trailer="}" trailer + } else if(match(words[w],"^S[xy]$")) { + add(".B " wtail()) + } else if(match(words[w],"^Tn$")) { + n=wtail() + add("'''" n "'''") + } else if(match(words[w],"^Ic$")) { + add("''") + trailer="''" trailer + } else if(match(words[w],"^Bl$")) { + ++listdepth + listnext[listdepth]="" + if(match(words[w+1],"-bullet")) { + optlist[listdepth]=1 + addopen("
      ") + listclose[listdepth]="
    " + } else if(match(words[w+1],"-enum")) { + optlist[listdepth]=2 + enum=0 + addopen("
      ") + listclose[listdepth]="
    " + } else if(match(words[w+1],"-tag")) { + optlist[listdepth]=3 + addopen("
    ") + listclose[listdepth]="
    " + } else if(match(words[w+1],"-item")) { + optlist[listdepth]=4 + addopen("
      ") + listclose[listdepth]="
    " + } + w=nwords + } else if(match(words[w],"^El$")) { + addclose(listnext[listdepth]) + addclose(listclose[listdepth]) + listclose[listdepth]="" + listdepth-- + } else if(match(words[w],"^It$")) { + addclose(listnext[listdepth]) + if(optlist[listdepth]==1) { + addpunct("
  • ") + listnext[listdepth] = "
  • " + } else if(optlist[listdepth]==2) { + addpunct("
  • ") + listnext[listdepth] = "
  • " + } else if(optlist[listdepth]==3) { + addpunct("
    ") + listnext[listdepth] = "
    " + if(match(words[w+1],"^Xo$")) { + # Suppress trailer + w++ + } else if(match(words[w+1],"^Pa$|^Ev$")) { + addopen("'''") + w++ + add(words[++w] "'''") + } else { + trailer = listnext[listdepth] "
    " trailer + listnext[listdepth] = "
    " + } + } else if(optlist[listdepth]==4) { + addpunct("
  • ") + listnext[listdepth] = "
  • " + } + } else if(match(words[w], "^Vt$")) { + w++ + add("''" words[w] "''") + } else if(match(words[w],"^Xo$")) { + # TODO: Figure out how to handle this + } else if(match(words[w],"^Xc$")) { + # TODO: Figure out how to handle this + if (optlist[listdepth] == 3) { + addclose(listnext[listdepth]) + addopen("
    ") + listnext[listdepth] = "
    " + } + } else if(match(words[w],"^[=]$")) { + addpunct(words[w]) + } else if(match(words[w],"^[[{(]$")) { + addopen(words[w]) + } else if(match(words[w],"^[\\])}.,;:]$")) { + addclose(words[w]) + } else { + sub("\\\\&", "", words[w]) + add(words[w]) + } + } + if(match(out,"^\\.[^a-zA-Z]")) + sub("^\\.","",out) + endline() +} diff --git a/doc/pdf/.ignore_me b/doc/pdf/.ignore_me new file mode 100644 index 000000000000..d285484d4fee --- /dev/null +++ b/doc/pdf/.ignore_me @@ -0,0 +1,2 @@ +*** PLEASE DO NOT DELETE THIS FILE! *** +This file is used to track an otherwise empty directory in git. diff --git a/doc/text/.ignore_me b/doc/text/.ignore_me new file mode 100644 index 000000000000..d285484d4fee --- /dev/null +++ b/doc/text/.ignore_me @@ -0,0 +1,2 @@ +*** PLEASE DO NOT DELETE THIS FILE! *** +This file is used to track an otherwise empty directory in git. diff --git a/doc/update.sh b/doc/update.sh new file mode 100755 index 000000000000..1038da133f77 --- /dev/null +++ b/doc/update.sh @@ -0,0 +1,119 @@ +#!/bin/sh + +set -e + +# +# Simple script to repopulate the 'doc' tree from +# the mdoc man pages stored in each project. +# + +# Collect list of man pages, relative to my subdirs +test -d man || mkdir man +cd man +MANPAGES=`for d in libarchive tar cpio;do ls ../../$d/*.[135];done | grep -v '\.so\.'` +cd .. + +# Build Makefile in 'man' directory +cd man +chmod +w . +rm -f *.[135] Makefile +echo > Makefile +echo "default: all" >>Makefile +echo >>Makefile +all="all:" +for f in $MANPAGES; do + outname="`basename $f`" + echo >> Makefile + echo $outname: ../mdoc2man.awk $f >> Makefile + echo " awk -f ../mdoc2man.awk < $f > $outname" >> Makefile + all="$all $outname" +done +echo $all >>Makefile +cd .. + +# Rebuild Makefile in 'text' directory +test -d text || mkdir text +cd text +chmod +w . +rm -f *.txt Makefile +echo > Makefile +echo "default: all" >>Makefile +echo >>Makefile +all="all:" +for f in $MANPAGES; do + outname="`basename $f`.txt" + echo >> Makefile + echo $outname: $f >> Makefile + echo " nroff -mdoc $f | col -b > $outname" >> Makefile + all="$all $outname" +done +echo $all >>Makefile +cd .. + +# Rebuild Makefile in 'pdf' directory +test -d pdf || mkdir pdf +cd pdf +chmod +w . +rm -f *.pdf Makefile +echo > Makefile +echo "default: all" >>Makefile +echo >>Makefile +all="all:" +for f in $MANPAGES; do + outname="`basename $f`.pdf" + echo >> Makefile + echo $outname: $f >> Makefile + echo " groff -mdoc -T ps $f | ps2pdf - - > $outname" >> Makefile + all="$all $outname" +done +echo $all >>Makefile +cd .. + +# Build Makefile in 'html' directory +test -d html || mkdir html +cd html +chmod +w . +rm -f *.html Makefile +echo > Makefile +echo "default: all" >>Makefile +echo >>Makefile +all="all:" +for f in $MANPAGES; do + outname="`basename $f`.html" + echo >> Makefile + echo $outname: $f >> Makefile + echo " groff -mdoc -T html $f > $outname" >> Makefile + all="$all $outname" +done +echo $all >>Makefile +cd .. + +# Build Makefile in 'wiki' directory +test -d wiki || mkdir wiki +cd wiki +chmod +w . +rm -f *.wiki Makefile +echo > Makefile +echo "default: all" >>Makefile +echo >>Makefile +all="all:" +for f in $MANPAGES; do + outname="`basename $f | awk '{ac=split($0,a,"[_.-]");o="ManPage";for(w=0;w<=ac;++w){o=o toupper(substr(a[w],1,1)) substr(a[w],2)};print o}'`.wiki" + echo >> Makefile + echo $outname: ../mdoc2wiki.awk $f >> Makefile + echo " awk -f ../mdoc2wiki.awk < $f > $outname" >> Makefile + all="$all $outname" +done +echo $all >>Makefile +cd .. + +# Convert all of the manpages to -man format +(cd man && make) +# Format all of the manpages to text +(cd text && make) +# Format all of the manpages to PDF +(cd pdf && make) +# Format all of the manpages to HTML +(cd html && make) +# Format all of the manpages to wiki syntax +(cd wiki && make) diff --git a/doc/wiki/.ignore_me b/doc/wiki/.ignore_me new file mode 100644 index 000000000000..d285484d4fee --- /dev/null +++ b/doc/wiki/.ignore_me @@ -0,0 +1,2 @@ +*** PLEASE DO NOT DELETE THIS FILE! *** +This file is used to track an otherwise empty directory in git. diff --git a/examples/minitar/Makefile b/examples/minitar/Makefile new file mode 100644 index 000000000000..1ec4593df66b --- /dev/null +++ b/examples/minitar/Makefile @@ -0,0 +1,26 @@ + +# +# Adjust the following to control which options minitar gets +# built with. See comments in minitar.c for details. +# +CFLAGS= \ + -DNO_BZIP2_CREATE \ + -I../../libarchive \ + -g + +# How to link against libarchive. +LIBARCHIVE= ../../libarchive/libarchive.a + +all: minitar + +minitar: minitar.o + cc -g -o minitar minitar.o $(LIBARCHIVE) -lz -lbz2 + strip minitar + ls -l minitar + +minitar.o: minitar.c + +clean:: + rm -f *.o + rm -f minitar + rm -f *~ diff --git a/examples/minitar/README b/examples/minitar/README new file mode 100644 index 000000000000..83f646cdb313 --- /dev/null +++ b/examples/minitar/README @@ -0,0 +1,12 @@ +"minitar" is a minimal example of a program that uses libarchive to +read/write various archive formats. It's a more ambitious version of +'untar.c' that includes compile-time options to enable/disable various +features, including non-tar formats, archive creation, and automatic +decompression support. + +I use this as a test bed to check for "link pollution," ensuring that +a program using libarchive does not pull in unnecessary code. + +The "minitar" program is also a good starting point for anyone who +wants to use libarchive for their own purposes, as it demonstrates +basic usage of the library. diff --git a/examples/minitar/minitar.c b/examples/minitar/minitar.c new file mode 100644 index 000000000000..0ff6263ebf84 --- /dev/null +++ b/examples/minitar/minitar.c @@ -0,0 +1,458 @@ +/*- + * This file is in the public domain. + * Do with it as you will. + */ + +/*- + * This is a compact "tar" program whose primary goal is small size. + * Statically linked, it can be very small indeed. This serves a number + * of goals: + * o a testbed for libarchive (to check for link pollution), + * o a useful tool for space-constrained systems (boot floppies, etc), + * o a place to experiment with new implementation ideas for bsdtar, + * o a small program to demonstrate libarchive usage. + * + * Use the following macros to suppress features: + * NO_BZIP2 - Implies NO_BZIP2_CREATE and NO_BZIP2_EXTRACT + * NO_BZIP2_CREATE - Suppress bzip2 compression support. + * NO_BZIP2_EXTRACT - Suppress bzip2 auto-detection and decompression. + * NO_COMPRESS - Implies NO_COMPRESS_CREATE and NO_COMPRESS_EXTRACT + * NO_COMPRESS_CREATE - Suppress compress(1) compression support + * NO_COMPRESS_EXTRACT - Suppress compress(1) auto-detect and decompression. + * NO_CREATE - Suppress all archive creation support. + * NO_CPIO_EXTRACT - Suppress auto-detect and dearchiving of cpio archives. + * NO_GZIP - Implies NO_GZIP_CREATE and NO_GZIP_EXTRACT + * NO_GZIP_CREATE - Suppress gzip compression support. + * NO_GZIP_EXTRACT - Suppress gzip auto-detection and decompression. + * NO_LOOKUP - Try to avoid getpw/getgr routines, which can be very large + * NO_TAR_EXTRACT - Suppress tar extraction + * + * With all of the above macros defined (except NO_TAR_EXTRACT), you + * get a very small program that can recognize and extract essentially + * any uncompressed tar archive. On FreeBSD 5.1, this minimal program + * is under 64k, statically linked, which compares rather favorably to + * main(){printf("hello, world");} + * which is over 60k statically linked on the same operating system. + * Without any of the above macros, you get a static executable of + * about 180k with a lot of very sophisticated modern features. + * Obviously, it's trivial to add support for ISO, Zip, mtree, + * lzma/xz, etc. Just fill in the appropriate setup calls. + */ + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +/* + * NO_CREATE implies NO_BZIP2_CREATE and NO_GZIP_CREATE and NO_COMPRESS_CREATE. + */ +#ifdef NO_CREATE +#undef NO_BZIP2_CREATE +#define NO_BZIP2_CREATE +#undef NO_COMPRESS_CREATE +#define NO_COMPRESS_CREATE +#undef NO_GZIP_CREATE +#define NO_GZIP_CREATE +#endif + +/* + * The combination of NO_BZIP2_CREATE and NO_BZIP2_EXTRACT is + * equivalent to NO_BZIP2. + */ +#ifdef NO_BZIP2_CREATE +#ifdef NO_BZIP2_EXTRACT +#undef NO_BZIP2 +#define NO_BZIP2 +#endif +#endif + +#ifdef NO_BZIP2 +#undef NO_BZIP2_EXTRACT +#define NO_BZIP2_EXTRACT +#undef NO_BZIP2_CREATE +#define NO_BZIP2_CREATE +#endif + +/* + * The combination of NO_COMPRESS_CREATE and NO_COMPRESS_EXTRACT is + * equivalent to NO_COMPRESS. + */ +#ifdef NO_COMPRESS_CREATE +#ifdef NO_COMPRESS_EXTRACT +#undef NO_COMPRESS +#define NO_COMPRESS +#endif +#endif + +#ifdef NO_COMPRESS +#undef NO_COMPRESS_EXTRACT +#define NO_COMPRESS_EXTRACT +#undef NO_COMPRESS_CREATE +#define NO_COMPRESS_CREATE +#endif + +/* + * The combination of NO_GZIP_CREATE and NO_GZIP_EXTRACT is + * equivalent to NO_GZIP. + */ +#ifdef NO_GZIP_CREATE +#ifdef NO_GZIP_EXTRACT +#undef NO_GZIP +#define NO_GZIP +#endif +#endif + +#ifdef NO_GZIP +#undef NO_GZIP_EXTRACT +#define NO_GZIP_EXTRACT +#undef NO_GZIP_CREATE +#define NO_GZIP_CREATE +#endif + +#ifndef NO_CREATE +static void create(const char *filename, int compress, const char **argv); +#endif +static void errmsg(const char *); +static void extract(const char *filename, int do_extract, int flags); +static int copy_data(struct archive *, struct archive *); +static void msg(const char *); +static void usage(void); + +static int verbose = 0; + +int +main(int argc, const char **argv) +{ + const char *filename = NULL; + int compress, flags, mode, opt; + + (void)argc; + mode = 'x'; + verbose = 0; + compress = '\0'; + flags = ARCHIVE_EXTRACT_TIME; + + /* Among other sins, getopt(3) pulls in printf(3). */ + while (*++argv != NULL && **argv == '-') { + const char *p = *argv + 1; + + while ((opt = *p++) != '\0') { + switch (opt) { +#ifndef NO_CREATE + case 'c': + mode = opt; + break; +#endif + case 'f': + if (*p != '\0') + filename = p; + else + filename = *++argv; + p += strlen(p); + break; +#ifndef NO_BZIP2_CREATE + case 'j': + compress = opt; + break; +#endif + case 'p': + flags |= ARCHIVE_EXTRACT_PERM; + flags |= ARCHIVE_EXTRACT_ACL; + flags |= ARCHIVE_EXTRACT_FFLAGS; + break; + case 't': + mode = opt; + break; + case 'v': + verbose++; + break; + case 'x': + mode = opt; + break; +#ifndef NO_BZIP2_CREATE + case 'y': + compress = opt; + break; +#endif +#ifndef NO_COMPRESS_CREATE + case 'Z': + compress = opt; + break; +#endif +#ifndef NO_GZIP_CREATE + case 'z': + compress = opt; + break; +#endif + default: + usage(); + } + } + } + + switch (mode) { +#ifndef NO_CREATE + case 'c': + create(filename, compress, argv); + break; +#endif + case 't': + extract(filename, 0, flags); + break; + case 'x': + extract(filename, 1, flags); + break; + } + + return (0); +} + + +#ifndef NO_CREATE +static char buff[16384]; + +static void +create(const char *filename, int compress, const char **argv) +{ + struct archive *a; + struct archive *disk; + struct archive_entry *entry; + ssize_t len; + int fd; + + a = archive_write_new(); + switch (compress) { +#ifndef NO_BZIP2_CREATE + case 'j': case 'y': + archive_write_add_filter_bzip2(a); + break; +#endif +#ifndef NO_COMPRESS_CREATE + case 'Z': + archive_write_add_filter_compress(a); + break; +#endif +#ifndef NO_GZIP_CREATE + case 'z': + archive_write_add_filter_gzip(a); + break; +#endif + default: + archive_write_add_filter_none(a); + break; + } + archive_write_set_format_ustar(a); + if (strcmp(filename, "-") == 0) + filename = NULL; + archive_write_open_filename(a, filename); + + disk = archive_read_disk_new(); +#ifndef NO_LOOKUP + archive_read_disk_set_standard_lookup(disk); +#endif + while (*argv != NULL) { + struct archive *disk = archive_read_disk_new(); + int r; + + r = archive_read_disk_open(disk, *argv); + if (r != ARCHIVE_OK) { + errmsg(archive_error_string(disk)); + errmsg("\n"); + exit(1); + } + + for (;;) { + int needcr = 0; + + entry = archive_entry_new(); + r = archive_read_next_header2(disk, entry); + if (r == ARCHIVE_EOF) + break; + if (r != ARCHIVE_OK) { + errmsg(archive_error_string(disk)); + errmsg("\n"); + exit(1); + } + archive_read_disk_descend(disk); + if (verbose) { + msg("a "); + msg(archive_entry_pathname(entry)); + needcr = 1; + } + r = archive_write_header(a, entry); + if (r < ARCHIVE_OK) { + errmsg(": "); + errmsg(archive_error_string(a)); + needcr = 1; + } + if (r == ARCHIVE_FATAL) + exit(1); + if (r > ARCHIVE_FAILED) { +#if 0 + /* Ideally, we would be able to use + * the same code to copy a body from + * an archive_read_disk to an + * archive_write that we use for + * copying data from an archive_read + * to an archive_write_disk. + * Unfortunately, this doesn't quite + * work yet. */ + copy_data(disk, a); +#else + /* For now, we use a simpler loop to copy data + * into the target archive. */ + fd = open(archive_entry_sourcepath(entry), O_RDONLY); + len = read(fd, buff, sizeof(buff)); + while (len > 0) { + archive_write_data(a, buff, len); + len = read(fd, buff, sizeof(buff)); + } + close(fd); +#endif + } + archive_entry_free(entry); + if (needcr) + msg("\n"); + } + archive_read_close(disk); + archive_read_free(disk); + argv++; + } + archive_write_close(a); + archive_write_free(a); +} +#endif + +static void +extract(const char *filename, int do_extract, int flags) +{ + struct archive *a; + struct archive *ext; + struct archive_entry *entry; + int r; + + a = archive_read_new(); + ext = archive_write_disk_new(); + archive_write_disk_set_options(ext, flags); +#ifndef NO_BZIP2_EXTRACT + archive_read_support_filter_bzip2(a); +#endif +#ifndef NO_GZIP_EXTRACT + archive_read_support_filter_gzip(a); +#endif +#ifndef NO_COMPRESS_EXTRACT + archive_read_support_filter_compress(a); +#endif +#ifndef NO_TAR_EXTRACT + archive_read_support_format_tar(a); +#endif +#ifndef NO_CPIO_EXTRACT + archive_read_support_format_cpio(a); +#endif +#ifndef NO_LOOKUP + archive_write_disk_set_standard_lookup(ext); +#endif + if (filename != NULL && strcmp(filename, "-") == 0) + filename = NULL; + if ((r = archive_read_open_filename(a, filename, 10240))) { + errmsg(archive_error_string(a)); + errmsg("\n"); + exit(r); + } + for (;;) { + r = archive_read_next_header(a, &entry); + if (r == ARCHIVE_EOF) + break; + if (r != ARCHIVE_OK) { + errmsg(archive_error_string(a)); + errmsg("\n"); + exit(1); + } + if (verbose && do_extract) + msg("x "); + if (verbose || !do_extract) + msg(archive_entry_pathname(entry)); + if (do_extract) { + r = archive_write_header(ext, entry); + if (r != ARCHIVE_OK) + errmsg(archive_error_string(a)); + else + copy_data(a, ext); + } + if (verbose || !do_extract) + msg("\n"); + } + archive_read_close(a); + archive_read_free(a); + exit(0); +} + +static int +copy_data(struct archive *ar, struct archive *aw) +{ + int r; + const void *buff; + size_t size; + off_t offset; + + for (;;) { + r = archive_read_data_block(ar, &buff, &size, &offset); + if (r == ARCHIVE_EOF) { + errmsg(archive_error_string(ar)); + return (ARCHIVE_OK); + } + if (r != ARCHIVE_OK) + return (r); + r = archive_write_data_block(aw, buff, size, offset); + if (r != ARCHIVE_OK) { + errmsg(archive_error_string(ar)); + return (r); + } + } +} + +static void +msg(const char *m) +{ + write(1, m, strlen(m)); +} + +static void +errmsg(const char *m) +{ + write(2, m, strlen(m)); +} + +static void +usage(void) +{ +/* Many program options depend on compile options. */ + const char *m = "Usage: minitar [-" +#ifndef NO_CREATE + "c" +#endif +#ifndef NO_BZIP2 + "j" +#endif + "tvx" +#ifndef NO_BZIP2 + "y" +#endif +#ifndef NO_COMPRESS + "Z" +#endif +#ifndef NO_GZIP + "z" +#endif + "] [-f file] [file]\n"; + + errmsg(m); + exit(1); +} diff --git a/examples/tarfilter.c b/examples/tarfilter.c new file mode 100644 index 000000000000..0d323e1cb2cb --- /dev/null +++ b/examples/tarfilter.c @@ -0,0 +1,113 @@ +/* + * This file is in the public domain. + * + * Feel free to use it as you wish. + */ + +/* + * This example program reads an archive from stdin (which can be in + * any format recognized by libarchive) and writes certain entries to + * an uncompressed ustar archive on stdout. This is a template for + * many kinds of archive manipulation: converting formats, resetting + * ownership, inserting entries, removing entries, etc. + * + * To compile: + * gcc -Wall -o tarfilter tarfilter.c -larchive -lz -lbz2 + */ + +#include +#include +#include +#include +#include +#include + +static void +die(char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + vfprintf(stderr, fmt, ap); + va_end(ap); + fprintf(stderr, "\n"); + exit(1); +} + +int +main(int argc, char **argv) +{ + char buff[8192]; + ssize_t len; + int r; + mode_t m; + struct archive *ina; + struct archive *outa; + struct archive_entry *entry; + + /* Read an archive from stdin, with automatic format detection. */ + ina = archive_read_new(); + if (ina == NULL) + die("Couldn't create archive reader."); + if (archive_read_support_filter_all(ina) != ARCHIVE_OK) + die("Couldn't enable decompression"); + if (archive_read_support_format_all(ina) != ARCHIVE_OK) + die("Couldn't enable read formats"); + if (archive_read_open_fd(ina, 0, 10240) != ARCHIVE_OK) + die("Couldn't open input archive"); + + /* Write an uncompressed ustar archive to stdout. */ + outa = archive_write_new(); + if (outa == NULL) + die("Couldn't create archive writer."); + if (archive_write_set_compression_none(outa) != ARCHIVE_OK) + die("Couldn't enable compression"); + if (archive_write_set_format_ustar(outa) != ARCHIVE_OK) + die("Couldn't set output format"); + if (archive_write_open_fd(outa, 1) != ARCHIVE_OK) + die("Couldn't open output archive"); + + /* Examine each entry in the input archive. */ + while ((r = archive_read_next_header(ina, &entry)) == ARCHIVE_OK) { + fprintf(stderr, "%s: ", archive_entry_pathname(entry)); + + /* Skip anything that isn't a regular file. */ + if (!S_ISREG(archive_entry_mode(entry))) { + fprintf(stderr, "skipped\n"); + continue; + } + + /* Make everything owned by root/wheel. */ + archive_entry_set_uid(entry, 0); + archive_entry_set_uname(entry, "root"); + archive_entry_set_gid(entry, 0); + archive_entry_set_gname(entry, "wheel"); + + /* Make everything permission 0744, strip SUID, etc. */ + m = archive_entry_mode(entry); + archive_entry_set_mode(entry, (m & ~07777) | 0744); + + /* Copy input entries to output archive. */ + if (archive_write_header(outa, entry) != ARCHIVE_OK) + die("Error writing output archive"); + if (archive_entry_size(entry) > 0) { + len = archive_read_data(ina, buff, sizeof(buff)); + while (len > 0) { + if (archive_write_data(outa, buff, len) != len) + die("Error writing output archive"); + len = archive_read_data(ina, buff, sizeof(buff)); + } + if (len < 0) + die("Error reading input archive"); + } + fprintf(stderr, "copied\n"); + } + if (r != ARCHIVE_EOF) + die("Error reading archive"); + /* Close the archives. */ + if (archive_read_free(ina) != ARCHIVE_OK) + die("Error closing input archive"); + if (archive_write_free(outa) != ARCHIVE_OK) + die("Error closing output archive"); + return (0); +} diff --git a/examples/untar.c b/examples/untar.c new file mode 100644 index 000000000000..b22d8361a012 --- /dev/null +++ b/examples/untar.c @@ -0,0 +1,266 @@ +/* + * This file is in the public domain. + * Use it as you wish. + */ + +/* + * This is a compact tar extraction program using libarchive whose + * primary goal is small executable size. Statically linked, it can + * be very small, depending in large part on how cleanly factored your + * system libraries are. Note that this uses the standard libarchive, + * without any special recompilation. The only functional concession + * is that this program uses the uid/gid from the archive instead of + * doing uname/gname lookups. (Add a call to + * archive_write_disk_set_standard_lookup() to enable uname/gname + * lookups, but be aware that this can add 500k or more to a static + * executable, depending on the system libraries, since user/group + * lookups frequently pull in password, YP/LDAP, networking, and DNS + * resolver libraries.) + * + * To build: + * $ gcc -static -Wall -o untar untar.c -larchive + * $ strip untar + * + * NOTE: On some systems, you may need to add additional flags + * to ensure that untar.c is compiled the same way as libarchive + * was compiled. In particular, Linux users will probably + * have to add -D_FILE_OFFSET_BITS=64 to the command line above. + * + * For fun, statically compile the following simple hello.c program + * using the same flags as for untar and compare the size: + * + * #include + * int main(int argc, char **argv) { + * printf("hello, world\n"); + * return(0); + * } + * + * You may be even more surprised by the compiled size of true.c listed here: + * + * int main(int argc, char **argv) { + * return (0); + * } + * + * On a slightly customized FreeBSD 5 system that I used around + * 2005, hello above compiled to 89k compared to untar of 69k. So at + * that time, libarchive's tar reader and extract-to-disk routines + * compiled to less code than printf(). + * + * On my FreeBSD development system today (August, 2009): + * hello: 195024 bytes + * true: 194912 bytes + * untar: 259924 bytes + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include +#include +#include +#include +#include +#include + +static void errmsg(const char *); +static void extract(const char *filename, int do_extract, int flags); +static void fail(const char *, const char *, int); +static int copy_data(struct archive *, struct archive *); +static void msg(const char *); +static void usage(void); +static void warn(const char *, const char *); + +static int verbose = 0; + +int +main(int argc, const char **argv) +{ + const char *filename = NULL; + int compress, flags, mode, opt; + + (void)argc; + mode = 'x'; + verbose = 0; + compress = '\0'; + flags = ARCHIVE_EXTRACT_TIME; + + /* Among other sins, getopt(3) pulls in printf(3). */ + while (*++argv != NULL && **argv == '-') { + const char *p = *argv + 1; + + while ((opt = *p++) != '\0') { + switch (opt) { + case 'f': + if (*p != '\0') + filename = p; + else + filename = *++argv; + p += strlen(p); + break; + case 'p': + flags |= ARCHIVE_EXTRACT_PERM; + flags |= ARCHIVE_EXTRACT_ACL; + flags |= ARCHIVE_EXTRACT_FFLAGS; + break; + case 't': + mode = opt; + break; + case 'v': + verbose++; + break; + case 'x': + mode = opt; + break; + default: + usage(); + } + } + } + + switch (mode) { + case 't': + extract(filename, 0, flags); + break; + case 'x': + extract(filename, 1, flags); + break; + } + + return (0); +} + + +static void +extract(const char *filename, int do_extract, int flags) +{ + struct archive *a; + struct archive *ext; + struct archive_entry *entry; + int r; + + a = archive_read_new(); + ext = archive_write_disk_new(); + archive_write_disk_set_options(ext, flags); + /* + * Note: archive_write_disk_set_standard_lookup() is useful + * here, but it requires library routines that can add 500k or + * more to a static executable. + */ + archive_read_support_format_tar(a); + /* + * On my system, enabling other archive formats adds 20k-30k + * each. Enabling gzip decompression adds about 20k. + * Enabling bzip2 is more expensive because the libbz2 library + * isn't very well factored. + */ + if (filename != NULL && strcmp(filename, "-") == 0) + filename = NULL; + if ((r = archive_read_open_filename(a, filename, 10240))) + fail("archive_read_open_filename()", + archive_error_string(a), r); + for (;;) { + r = archive_read_next_header(a, &entry); + if (r == ARCHIVE_EOF) + break; + if (r != ARCHIVE_OK) + fail("archive_read_next_header()", + archive_error_string(a), 1); + if (verbose && do_extract) + msg("x "); + if (verbose || !do_extract) + msg(archive_entry_pathname(entry)); + if (do_extract) { + r = archive_write_header(ext, entry); + if (r != ARCHIVE_OK) + warn("archive_write_header()", + archive_error_string(ext)); + else { + copy_data(a, ext); + r = archive_write_finish_entry(ext); + if (r != ARCHIVE_OK) + fail("archive_write_finish_entry()", + archive_error_string(ext), 1); + } + + } + if (verbose || !do_extract) + msg("\n"); + } + archive_read_close(a); + archive_read_free(a); + exit(0); +} + +static int +copy_data(struct archive *ar, struct archive *aw) +{ + int r; + const void *buff; + size_t size; +#if ARCHIVE_VERSION >= 3000000 + int64_t offset; +#else + off_t offset; +#endif + + for (;;) { + r = archive_read_data_block(ar, &buff, &size, &offset); + if (r == ARCHIVE_EOF) + return (ARCHIVE_OK); + if (r != ARCHIVE_OK) + return (r); + r = archive_write_data_block(aw, buff, size, offset); + if (r != ARCHIVE_OK) { + warn("archive_write_data_block()", + archive_error_string(aw)); + return (r); + } + } +} + +/* + * These reporting functions use low-level I/O; on some systems, this + * is a significant code reduction. Of course, on many server and + * desktop operating systems, malloc() and even crt rely on printf(), + * which in turn pulls in most of the rest of stdio, so this is not an + * optimization at all there. (If you're going to pay 100k or more + * for printf() anyway, you may as well use it!) + */ +static void +msg(const char *m) +{ + write(1, m, strlen(m)); +} + +static void +errmsg(const char *m) +{ + write(2, m, strlen(m)); +} + +static void +warn(const char *f, const char *m) +{ + errmsg(f); + errmsg(" failed: "); + errmsg(m); + errmsg("\n"); +} + +static void +fail(const char *f, const char *m, int r) +{ + warn(f, m); + exit(r); +} + +static void +usage(void) +{ + const char *m = "Usage: untar [-tvx] [-f file] [file]\n"; + errmsg(m); + exit(1); +} diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt new file mode 100644 index 000000000000..ecb0409bd9d8 --- /dev/null +++ b/libarchive/CMakeLists.txt @@ -0,0 +1,193 @@ + +############################################ +# +# How to build libarchive +# +############################################ + +# Public headers +SET(include_HEADERS + archive.h + archive_entry.h +) + +# Sources and private headers +SET(libarchive_SOURCES + archive_acl.c + archive_check_magic.c + archive_cmdline.c + archive_cmdline_private.h + archive_crc32.h + archive_crypto.c + archive_crypto_private.h + archive_endian.h + archive_entry.c + archive_entry.h + archive_entry_copy_stat.c + archive_entry_link_resolver.c + archive_entry_locale.h + archive_entry_private.h + archive_entry_sparse.c + archive_entry_stat.c + archive_entry_strmode.c + archive_entry_xattr.c + archive_getdate.c + archive_match.c + archive_options.c + archive_options_private.h + archive_pathmatch.c + archive_pathmatch.h + archive_platform.h + archive_ppmd_private.h + archive_ppmd7.c + archive_ppmd7_private.h + archive_private.h + archive_rb.c + archive_rb.h + archive_read.c + archive_read_append_filter.c + archive_read_data_into_fd.c + archive_read_disk_entry_from_file.c + archive_read_disk_posix.c + archive_read_disk_private.h + archive_read_disk_set_standard_lookup.c + archive_read_extract.c + archive_read_open_fd.c + archive_read_open_file.c + archive_read_open_filename.c + archive_read_open_memory.c + archive_read_private.h + archive_read_set_format.c + archive_read_set_options.c + archive_read_support_filter_all.c + archive_read_support_filter_bzip2.c + archive_read_support_filter_compress.c + archive_read_support_filter_gzip.c + archive_read_support_filter_grzip.c + archive_read_support_filter_lrzip.c + archive_read_support_filter_lzop.c + archive_read_support_filter_none.c + archive_read_support_filter_program.c + archive_read_support_filter_rpm.c + archive_read_support_filter_uu.c + archive_read_support_filter_xz.c + archive_read_support_format_7zip.c + archive_read_support_format_all.c + archive_read_support_format_ar.c + archive_read_support_format_by_code.c + archive_read_support_format_cab.c + archive_read_support_format_cpio.c + archive_read_support_format_empty.c + archive_read_support_format_iso9660.c + archive_read_support_format_lha.c + archive_read_support_format_mtree.c + archive_read_support_format_rar.c + archive_read_support_format_raw.c + archive_read_support_format_tar.c + archive_read_support_format_xar.c + archive_read_support_format_zip.c + archive_string.c + archive_string.h + archive_string_composition.h + archive_string_sprintf.c + archive_util.c + archive_virtual.c + archive_write.c + archive_write_disk_acl.c + archive_write_disk_posix.c + archive_write_disk_private.h + archive_write_disk_set_standard_lookup.c + archive_write_private.h + archive_write_open_fd.c + archive_write_open_file.c + archive_write_open_filename.c + archive_write_open_memory.c + archive_write_add_filter.c + archive_write_add_filter_b64encode.c + archive_write_add_filter_by_name.c + archive_write_add_filter_bzip2.c + archive_write_add_filter_compress.c + archive_write_add_filter_grzip.c + archive_write_add_filter_gzip.c + archive_write_add_filter_lrzip.c + archive_write_add_filter_lzop.c + archive_write_add_filter_none.c + archive_write_add_filter_program.c + archive_write_add_filter_uuencode.c + archive_write_add_filter_xz.c + archive_write_set_format.c + archive_write_set_format_7zip.c + archive_write_set_format_ar.c + archive_write_set_format_by_name.c + archive_write_set_format_cpio.c + archive_write_set_format_cpio_newc.c + archive_write_set_format_gnutar.c + archive_write_set_format_iso9660.c + archive_write_set_format_mtree.c + archive_write_set_format_pax.c + archive_write_set_format_shar.c + archive_write_set_format_ustar.c + archive_write_set_format_v7tar.c + archive_write_set_format_xar.c + archive_write_set_format_zip.c + archive_write_set_options.c + filter_fork_posix.c + filter_fork.h +) + +# Man pages +SET(libarchive_MANS + archive_entry.3 + archive_entry_acl.3 + archive_entry_linkify.3 + archive_entry_paths.3 + archive_entry_perms.3 + archive_entry_stat.3 + archive_entry_time.3 + archive_read.3 + archive_read_disk.3 + archive_read_set_options.3 + archive_util.3 + archive_write.3 + archive_write_disk.3 + archive_write_set_options.3 + cpio.5 + libarchive.3 + libarchive_internals.3 + libarchive-formats.5 + mtree.5 + tar.5 +) + +IF(WIN32 AND NOT CYGWIN) + LIST(APPEND libarchive_SOURCES archive_entry_copy_bhfi.c) + LIST(APPEND libarchive_SOURCES archive_read_disk_windows.c) + LIST(APPEND libarchive_SOURCES archive_windows.c) + LIST(APPEND libarchive_SOURCES archive_windows.h) + LIST(APPEND libarchive_SOURCES archive_write_disk_windows.c) + LIST(APPEND libarchive_SOURCES filter_fork_windows.c) +ENDIF(WIN32 AND NOT CYGWIN) + +# Libarchive is a shared library +ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) +TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) +SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) + +# archive_static is a static library +ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) +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) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) +ENDIF(NOT WIN32 OR CYGWIN) + +# How to install the libraries +INSTALL(TARGETS archive archive_static + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +INSTALL_MAN(${libarchive_MANS}) +INSTALL(FILES ${include_HEADERS} DESTINATION include) + +add_subdirectory(test) diff --git a/libarchive/archive_entry_copy_bhfi.c b/libarchive/archive_entry_copy_bhfi.c new file mode 100644 index 000000000000..77bf38e450f2 --- /dev/null +++ b/libarchive/archive_entry_copy_bhfi.c @@ -0,0 +1,75 @@ +/*- + * 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#include "archive_private.h" +#include "archive_entry.h" + +#if defined(_WIN32) && !defined(__CYGWIN__) + +#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000) + +__inline static void +fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns) +{ + ULARGE_INTEGER utc; + + utc.HighPart = filetime->dwHighDateTime; + utc.LowPart = filetime->dwLowDateTime; + if (utc.QuadPart >= EPOC_TIME) { + utc.QuadPart -= EPOC_TIME; + *t = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */ + *ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */ + } else { + *t = 0; + *ns = 0; + } +} + +void +archive_entry_copy_bhfi(struct archive_entry *entry, + BY_HANDLE_FILE_INFORMATION *bhfi) +{ + time_t secs; + long nsecs; + + fileTimeToUtc(&bhfi->ftLastAccessTime, &secs, &nsecs); + archive_entry_set_atime(entry, secs, nsecs); + fileTimeToUtc(&bhfi->ftLastWriteTime, &secs, &nsecs); + archive_entry_set_mtime(entry, secs, nsecs); + fileTimeToUtc(&bhfi->ftCreationTime, &secs, &nsecs); + archive_entry_set_birthtime(entry, secs, nsecs); + archive_entry_set_ctime(entry, secs, nsecs); + archive_entry_set_dev(entry, bhfi->dwVolumeSerialNumber); + archive_entry_set_ino64(entry, (((int64_t)bhfi->nFileIndexHigh) << 32) + + bhfi->nFileIndexLow); + archive_entry_set_nlink(entry, bhfi->nNumberOfLinks); + archive_entry_set_size(entry, (((int64_t)bhfi->nFileSizeHigh) << 32) + + bhfi->nFileSizeLow); + /* archive_entry_set_mode(entry, st->st_mode); */ +} +#endif diff --git a/libarchive/archive_read_disk_windows.c b/libarchive/archive_read_disk_windows.c new file mode 100644 index 000000000000..9c5420d80e77 --- /dev/null +++ b/libarchive/archive_read_disk_windows.c @@ -0,0 +1,2296 @@ +/*- + * Copyright (c) 2003-2009 Tim Kientzle + * Copyright (c) 2010-2012 Michihiro NAKAJIMA + * 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#if defined(_WIN32) && !defined(__CYGWIN__) + +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#include + +#include "archive.h" +#include "archive_string.h" +#include "archive_entry.h" +#include "archive_private.h" +#include "archive_read_disk_private.h" + +#ifndef O_BINARY +#define O_BINARY 0 +#endif +#ifndef IO_REPARSE_TAG_SYMLINK +/* Old SDKs do not provide IO_REPARSE_TAG_SYMLINK */ +#define IO_REPARSE_TAG_SYMLINK 0xA000000CL +#endif + +/*- + * This is a new directory-walking system that addresses a number + * of problems I've had with fts(3). In particular, it has no + * pathname-length limits (other than the size of 'int'), handles + * deep logical traversals, uses considerably less memory, and has + * an opaque interface (easier to modify in the future). + * + * Internally, it keeps a single list of "tree_entry" items that + * represent filesystem objects that require further attention. + * Non-directories are not kept in memory: they are pulled from + * readdir(), returned to the client, then freed as soon as possible. + * Any directory entry to be traversed gets pushed onto the stack. + * + * There is surprisingly little information that needs to be kept for + * each item on the stack. Just the name, depth (represented here as the + * string length of the parent directory's pathname), and some markers + * indicating how to get back to the parent (via chdir("..") for a + * regular dir or via fchdir(2) for a symlink). + */ + +struct restore_time { + const wchar_t *full_path; + FILETIME lastWriteTime; + FILETIME lastAccessTime; + mode_t filetype; +}; + +struct tree_entry { + int depth; + struct tree_entry *next; + struct tree_entry *parent; + size_t full_path_dir_length; + struct archive_wstring name; + struct archive_wstring full_path; + size_t dirname_length; + int64_t dev; + int64_t ino; + int flags; + int filesystem_id; + /* How to restore time of a directory. */ + struct restore_time restore_time; +}; + +struct filesystem { + int64_t dev; + int synthetic; + int remote; + DWORD bytesPerSector; +}; + +/* Definitions for tree_entry.flags bitmap. */ +#define isDir 1 /* This entry is a regular directory. */ +#define isDirLink 2 /* This entry is a symbolic link to a directory. */ +#define needsFirstVisit 4 /* This is an initial entry. */ +#define needsDescent 8 /* This entry needs to be previsited. */ +#define needsOpen 16 /* This is a directory that needs to be opened. */ +#define needsAscent 32 /* This entry needs to be postvisited. */ + +/* + * On Windows, "first visit" is handled as a pattern to be handed to + * _findfirst(). This is consistent with Windows conventions that + * file patterns are handled within the application. On Posix, + * "first visit" is just returned to the client. + */ + +#define MAX_OVERLAPPED 8 +#define BUFFER_SIZE (1024 * 8) +#define DIRECT_IO 0/* Disabled */ +#define ASYNC_IO 1/* Enabled */ + +/* + * Local data for this package. + */ +struct tree { + struct tree_entry *stack; + struct tree_entry *current; + HANDLE d; + WIN32_FIND_DATAW _findData; + WIN32_FIND_DATAW *findData; + int flags; + int visit_type; + /* Error code from last failed operation. */ + int tree_errno; + + /* A full path with "\\?\" prefix. */ + struct archive_wstring full_path; + size_t full_path_dir_length; + /* Dynamically-sized buffer for holding path */ + struct archive_wstring path; + + /* Last path element */ + const wchar_t *basename; + /* Leading dir length */ + size_t dirname_length; + + int depth; + + BY_HANDLE_FILE_INFORMATION lst; + BY_HANDLE_FILE_INFORMATION st; + int descend; + /* How to restore time of a file. */ + struct restore_time restore_time; + + struct entry_sparse { + int64_t length; + int64_t offset; + } *sparse_list, *current_sparse; + int sparse_count; + int sparse_list_size; + + char initial_symlink_mode; + char symlink_mode; + struct filesystem *current_filesystem; + struct filesystem *filesystem_table; + int initial_filesystem_id; + int current_filesystem_id; + int max_filesystem_id; + int allocated_filesytem; + + HANDLE entry_fh; + int entry_eof; + int64_t entry_remaining_bytes; + int64_t entry_total; + + int ol_idx_doing; + int ol_idx_done; + int ol_num_doing; + int ol_num_done; + int64_t ol_remaining_bytes; + int64_t ol_total; + struct la_overlapped { + OVERLAPPED ol; + struct archive * _a; + unsigned char *buff; + size_t buff_size; + int64_t offset; + size_t bytes_expected; + size_t bytes_transferred; + } ol[MAX_OVERLAPPED]; + int direct_io; + int async_io; +}; + +#define bhfi_dev(bhfi) ((bhfi)->dwVolumeSerialNumber) +/* Treat FileIndex as i-node. We should remove a sequence number + * which is high-16-bits of nFileIndexHigh. */ +#define bhfi_ino(bhfi) \ + ((((int64_t)((bhfi)->nFileIndexHigh & 0x0000FFFFUL)) << 32) \ + + (bhfi)->nFileIndexLow) + +/* Definitions for tree.flags bitmap. */ +#define hasStat 16 /* The st entry is valid. */ +#define hasLstat 32 /* The lst entry is valid. */ +#define needsRestoreTimes 128 + +static int +tree_dir_next_windows(struct tree *t, const wchar_t *pattern); + +/* Initiate/terminate a tree traversal. */ +static struct tree *tree_open(const wchar_t *, int, int); +static struct tree *tree_reopen(struct tree *, const wchar_t *, int); +static void tree_close(struct tree *); +static void tree_free(struct tree *); +static void tree_push(struct tree *, const wchar_t *, const wchar_t *, + int, int64_t, int64_t, struct restore_time *); + +/* + * tree_next() returns Zero if there is no next entry, non-zero if + * there is. Note that directories are visited three times. + * Directories are always visited first as part of enumerating their + * parent; that is a "regular" visit. If tree_descend() is invoked at + * that time, the directory is added to a work list and will + * subsequently be visited two more times: once just after descending + * into the directory ("postdescent") and again just after ascending + * back to the parent ("postascent"). + * + * TREE_ERROR_DIR is returned if the descent failed (because the + * directory couldn't be opened, for instance). This is returned + * instead of TREE_POSTDESCENT/TREE_POSTASCENT. TREE_ERROR_DIR is not a + * fatal error, but it does imply that the relevant subtree won't be + * visited. TREE_ERROR_FATAL is returned for an error that left the + * traversal completely hosed. Right now, this is only returned for + * chdir() failures during ascent. + */ +#define TREE_REGULAR 1 +#define TREE_POSTDESCENT 2 +#define TREE_POSTASCENT 3 +#define TREE_ERROR_DIR -1 +#define TREE_ERROR_FATAL -2 + +static int tree_next(struct tree *); + +/* + * Return information about the current entry. + */ + +/* + * The current full pathname, length of the full pathname, and a name + * that can be used to access the file. Because tree does use chdir + * extensively, the access path is almost never the same as the full + * current path. + * + */ +static const wchar_t *tree_current_path(struct tree *); +static const wchar_t *tree_current_access_path(struct tree *); + +/* + * Request the lstat() or stat() data for the current path. Since the + * tree package needs to do some of this anyway, and caches the + * results, you should take advantage of it here if you need it rather + * than make a redundant stat() or lstat() call of your own. + */ +static const BY_HANDLE_FILE_INFORMATION *tree_current_stat(struct tree *); +static const BY_HANDLE_FILE_INFORMATION *tree_current_lstat(struct tree *); + +/* The following functions use tricks to avoid a certain number of + * stat()/lstat() calls. */ +/* "is_physical_dir" is equivalent to S_ISDIR(tree_current_lstat()->st_mode) */ +static int tree_current_is_physical_dir(struct tree *); +/* "is_physical_link" is equivalent to S_ISLNK(tree_current_lstat()->st_mode) */ +static int tree_current_is_physical_link(struct tree *); +/* Instead of archive_entry_copy_stat for BY_HANDLE_FILE_INFORMATION */ +static void tree_archive_entry_copy_bhfi(struct archive_entry *, + struct tree *, const BY_HANDLE_FILE_INFORMATION *); +/* "is_dir" is equivalent to S_ISDIR(tree_current_stat()->st_mode) */ +static int tree_current_is_dir(struct tree *); +static int update_current_filesystem(struct archive_read_disk *a, + int64_t dev); +static int setup_current_filesystem(struct archive_read_disk *); +static int tree_target_is_same_as_parent(struct tree *, + const BY_HANDLE_FILE_INFORMATION *); + +static int _archive_read_disk_open_w(struct archive *, const wchar_t *); +static int _archive_read_free(struct archive *); +static int _archive_read_close(struct archive *); +static int _archive_read_data_block(struct archive *, + const void **, size_t *, int64_t *); +static int _archive_read_next_header2(struct archive *, + struct archive_entry *); +static const char *trivial_lookup_gname(void *, int64_t gid); +static const char *trivial_lookup_uname(void *, int64_t uid); +static int setup_sparse(struct archive_read_disk *, struct archive_entry *); +static int close_and_restore_time(HANDLE, struct tree *, + struct restore_time *); +static int setup_sparse_from_disk(struct archive_read_disk *, + struct archive_entry *, HANDLE); + + + +static struct archive_vtable * +archive_read_disk_vtable(void) +{ + static struct archive_vtable av; + static int inited = 0; + + if (!inited) { + av.archive_free = _archive_read_free; + av.archive_close = _archive_read_close; + av.archive_read_data_block = _archive_read_data_block; + av.archive_read_next_header2 = _archive_read_next_header2; + inited = 1; + } + return (&av); +} + +const char * +archive_read_disk_gname(struct archive *_a, int64_t gid) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_gname")) + return (NULL); + if (a->lookup_gname == NULL) + return (NULL); + return ((*a->lookup_gname)(a->lookup_gname_data, gid)); +} + +const char * +archive_read_disk_uname(struct archive *_a, int64_t uid) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + if (ARCHIVE_OK != __archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_uname")) + return (NULL); + if (a->lookup_uname == NULL) + return (NULL); + return ((*a->lookup_uname)(a->lookup_uname_data, uid)); +} + +int +archive_read_disk_set_gname_lookup(struct archive *_a, + void *private_data, + const char * (*lookup_gname)(void *private, int64_t gid), + void (*cleanup_gname)(void *private)) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + archive_check_magic(&a->archive, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_set_gname_lookup"); + + if (a->cleanup_gname != NULL && a->lookup_gname_data != NULL) + (a->cleanup_gname)(a->lookup_gname_data); + + a->lookup_gname = lookup_gname; + a->cleanup_gname = cleanup_gname; + a->lookup_gname_data = private_data; + return (ARCHIVE_OK); +} + +int +archive_read_disk_set_uname_lookup(struct archive *_a, + void *private_data, + const char * (*lookup_uname)(void *private, int64_t uid), + void (*cleanup_uname)(void *private)) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + archive_check_magic(&a->archive, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_set_uname_lookup"); + + if (a->cleanup_uname != NULL && a->lookup_uname_data != NULL) + (a->cleanup_uname)(a->lookup_uname_data); + + a->lookup_uname = lookup_uname; + a->cleanup_uname = cleanup_uname; + a->lookup_uname_data = private_data; + return (ARCHIVE_OK); +} + +/* + * Create a new archive_read_disk object and initialize it with global state. + */ +struct archive * +archive_read_disk_new(void) +{ + struct archive_read_disk *a; + + a = (struct archive_read_disk *)malloc(sizeof(*a)); + if (a == NULL) + return (NULL); + memset(a, 0, sizeof(*a)); + a->archive.magic = ARCHIVE_READ_DISK_MAGIC; + a->archive.state = ARCHIVE_STATE_NEW; + a->archive.vtable = archive_read_disk_vtable(); + a->lookup_uname = trivial_lookup_uname; + a->lookup_gname = trivial_lookup_gname; + a->enable_copyfile = 1; + a->traverse_mount_points = 1; + return (&a->archive); +} + +static int +_archive_read_free(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + int r; + + if (_a == NULL) + return (ARCHIVE_OK); + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_read_free"); + + if (a->archive.state != ARCHIVE_STATE_CLOSED) + r = _archive_read_close(&a->archive); + else + r = ARCHIVE_OK; + + tree_free(a->tree); + if (a->cleanup_gname != NULL && a->lookup_gname_data != NULL) + (a->cleanup_gname)(a->lookup_gname_data); + if (a->cleanup_uname != NULL && a->lookup_uname_data != NULL) + (a->cleanup_uname)(a->lookup_uname_data); + archive_string_free(&a->archive.error_string); + a->archive.magic = 0; + free(a); + return (r); +} + +static int +_archive_read_close(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_read_close"); + + if (a->archive.state != ARCHIVE_STATE_FATAL) + a->archive.state = ARCHIVE_STATE_CLOSED; + + tree_close(a->tree); + + return (ARCHIVE_OK); +} + +static void +setup_symlink_mode(struct archive_read_disk *a, char symlink_mode, + int follow_symlinks) +{ + a->symlink_mode = symlink_mode; + a->follow_symlinks = follow_symlinks; + if (a->tree != NULL) { + a->tree->initial_symlink_mode = a->symlink_mode; + a->tree->symlink_mode = a->symlink_mode; + } +} + +int +archive_read_disk_set_symlink_logical(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_set_symlink_logical"); + setup_symlink_mode(a, 'L', 1); + return (ARCHIVE_OK); +} + +int +archive_read_disk_set_symlink_physical(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_set_symlink_physical"); + setup_symlink_mode(a, 'P', 0); + return (ARCHIVE_OK); +} + +int +archive_read_disk_set_symlink_hybrid(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_set_symlink_hybrid"); + setup_symlink_mode(a, 'H', 1);/* Follow symlinks initially. */ + return (ARCHIVE_OK); +} + +int +archive_read_disk_set_atime_restored(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_restore_atime"); + a->restore_time = 1; + if (a->tree != NULL) + a->tree->flags |= needsRestoreTimes; + return (ARCHIVE_OK); +} + +int +archive_read_disk_set_behavior(struct archive *_a, int flags) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + int r = ARCHIVE_OK; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_honor_nodump"); + + if (flags & ARCHIVE_READDISK_RESTORE_ATIME) + r = archive_read_disk_set_atime_restored(_a); + else { + a->restore_time = 0; + if (a->tree != NULL) + a->tree->flags &= ~needsRestoreTimes; + } + if (flags & ARCHIVE_READDISK_HONOR_NODUMP) + a->honor_nodump = 1; + else + a->honor_nodump = 0; + if (flags & ARCHIVE_READDISK_MAC_COPYFILE) + a->enable_copyfile = 1; + else + a->enable_copyfile = 0; + if (flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS) + a->traverse_mount_points = 0; + else + a->traverse_mount_points = 1; + return (r); +} + +/* + * Trivial implementations of gname/uname lookup functions. + * These are normally overridden by the client, but these stub + * versions ensure that we always have something that works. + */ +static const char * +trivial_lookup_gname(void *private_data, int64_t gid) +{ + (void)private_data; /* UNUSED */ + (void)gid; /* UNUSED */ + return (NULL); +} + +static const char * +trivial_lookup_uname(void *private_data, int64_t uid) +{ + (void)private_data; /* UNUSED */ + (void)uid; /* UNUSED */ + return (NULL); +} + +static int64_t +align_num_per_sector(struct tree *t, int64_t size) +{ + int64_t surplus; + + size += t->current_filesystem->bytesPerSector -1; + surplus = size % t->current_filesystem->bytesPerSector; + size -= surplus; + return (size); +} + +static int +start_next_async_read(struct archive_read_disk *a, struct tree *t) +{ + struct la_overlapped *olp; + DWORD buffbytes, rbytes; + + if (t->ol_remaining_bytes == 0) + return (ARCHIVE_EOF); + + olp = &(t->ol[t->ol_idx_doing]); + t->ol_idx_doing = (t->ol_idx_doing + 1) % MAX_OVERLAPPED; + + /* Allocate read buffer. */ + if (olp->buff == NULL) { + void *p; + size_t s = (size_t)align_num_per_sector(t, BUFFER_SIZE); + p = VirtualAlloc(NULL, s, MEM_COMMIT, PAGE_READWRITE); + if (p == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Couldn't allocate memory"); + a->archive.state = ARCHIVE_STATE_FATAL; + return (ARCHIVE_FATAL); + } + olp->buff = p; + olp->buff_size = s; + olp->_a = &a->archive; + olp->ol.hEvent = CreateEventW(NULL, TRUE, FALSE, NULL); + if (olp->ol.hEvent == NULL) { + la_dosmaperr(GetLastError()); + archive_set_error(&a->archive, errno, + "CreateEvent failed"); + a->archive.state = ARCHIVE_STATE_FATAL; + return (ARCHIVE_FATAL); + } + } else + ResetEvent(olp->ol.hEvent); + + buffbytes = (DWORD)olp->buff_size; + if (buffbytes > t->current_sparse->length) + buffbytes = (DWORD)t->current_sparse->length; + + /* Skip hole. */ + if (t->current_sparse->offset > t->ol_total) { + t->ol_remaining_bytes -= + t->current_sparse->offset - t->ol_total; + } + + olp->offset = t->current_sparse->offset; + olp->ol.Offset = (DWORD)(olp->offset & 0xffffffff); + olp->ol.OffsetHigh = (DWORD)(olp->offset >> 32); + + if (t->ol_remaining_bytes > buffbytes) { + olp->bytes_expected = buffbytes; + t->ol_remaining_bytes -= buffbytes; + } else { + olp->bytes_expected = (size_t)t->ol_remaining_bytes; + t->ol_remaining_bytes = 0; + } + olp->bytes_transferred = 0; + t->current_sparse->offset += buffbytes; + t->current_sparse->length -= buffbytes; + t->ol_total = t->current_sparse->offset; + if (t->current_sparse->length == 0 && t->ol_remaining_bytes > 0) + t->current_sparse++; + + if (!ReadFile(t->entry_fh, olp->buff, buffbytes, &rbytes, &(olp->ol))) { + DWORD lasterr; + + lasterr = GetLastError(); + if (lasterr == ERROR_HANDLE_EOF) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Reading file truncated"); + a->archive.state = ARCHIVE_STATE_FATAL; + return (ARCHIVE_FATAL); + } else if (lasterr != ERROR_IO_PENDING) { + if (lasterr == ERROR_NO_DATA) + errno = EAGAIN; + else if (lasterr == ERROR_ACCESS_DENIED) + errno = EBADF; + else + la_dosmaperr(lasterr); + archive_set_error(&a->archive, errno, "Read error"); + a->archive.state = ARCHIVE_STATE_FATAL; + return (ARCHIVE_FATAL); + } + } else + olp->bytes_transferred = rbytes; + t->ol_num_doing++; + + return (t->ol_remaining_bytes == 0)? ARCHIVE_EOF: ARCHIVE_OK; +} + +static void +cancel_async(struct tree *t) +{ + if (t->ol_num_doing != t->ol_num_done) { + CancelIo(t->entry_fh); + t->ol_num_doing = t->ol_num_done = 0; + } +} + +static int +_archive_read_data_block(struct archive *_a, const void **buff, + size_t *size, int64_t *offset) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + struct tree *t = a->tree; + struct la_overlapped *olp; + DWORD bytes_transferred; + int r = ARCHIVE_FATAL; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_DATA, + "archive_read_data_block"); + + if (t->entry_eof || t->entry_remaining_bytes <= 0) { + r = ARCHIVE_EOF; + goto abort_read_data; + } + + /* + * Make a request to read the file in asynchronous. + */ + if (t->ol_num_doing == 0) { + do { + r = start_next_async_read(a, t); + if (r == ARCHIVE_FATAL) + goto abort_read_data; + if (!t->async_io) + break; + } while (r == ARCHIVE_OK && t->ol_num_doing < MAX_OVERLAPPED); + } else { + if (start_next_async_read(a, t) == ARCHIVE_FATAL) + goto abort_read_data; + } + + olp = &(t->ol[t->ol_idx_done]); + t->ol_idx_done = (t->ol_idx_done + 1) % MAX_OVERLAPPED; + if (olp->bytes_transferred) + bytes_transferred = (DWORD)olp->bytes_transferred; + else if (!GetOverlappedResult(t->entry_fh, &(olp->ol), + &bytes_transferred, TRUE)) { + la_dosmaperr(GetLastError()); + archive_set_error(&a->archive, errno, + "GetOverlappedResult failed"); + a->archive.state = ARCHIVE_STATE_FATAL; + r = ARCHIVE_FATAL; + goto abort_read_data; + } + t->ol_num_done++; + + if (bytes_transferred == 0 || + olp->bytes_expected != bytes_transferred) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Reading file truncated"); + a->archive.state = ARCHIVE_STATE_FATAL; + r = ARCHIVE_FATAL; + goto abort_read_data; + } + + *buff = olp->buff; + *size = bytes_transferred; + *offset = olp->offset; + if (olp->offset > t->entry_total) + t->entry_remaining_bytes -= olp->offset - t->entry_total; + t->entry_total = olp->offset + *size; + t->entry_remaining_bytes -= *size; + if (t->entry_remaining_bytes == 0) { + /* Close the current file descriptor */ + close_and_restore_time(t->entry_fh, t, &t->restore_time); + t->entry_fh = INVALID_HANDLE_VALUE; + t->entry_eof = 1; + } + return (ARCHIVE_OK); + +abort_read_data: + *buff = NULL; + *size = 0; + *offset = t->entry_total; + if (t->entry_fh != INVALID_HANDLE_VALUE) { + cancel_async(t); + /* Close the current file descriptor */ + close_and_restore_time(t->entry_fh, t, &t->restore_time); + t->entry_fh = INVALID_HANDLE_VALUE; + } + return (r); +} + +static int +next_entry(struct archive_read_disk *a, struct tree *t, + struct archive_entry *entry) +{ + const BY_HANDLE_FILE_INFORMATION *st; + const BY_HANDLE_FILE_INFORMATION *lst; + const char*name; + int descend, r; + + st = NULL; + lst = NULL; + t->descend = 0; + do { + switch (tree_next(t)) { + case TREE_ERROR_FATAL: + archive_set_error(&a->archive, t->tree_errno, + "%ls: Unable to continue traversing directory tree", + tree_current_path(t)); + a->archive.state = ARCHIVE_STATE_FATAL; + return (ARCHIVE_FATAL); + case TREE_ERROR_DIR: + archive_set_error(&a->archive, t->tree_errno, + "%ls: Couldn't visit directory", + tree_current_path(t)); + return (ARCHIVE_FAILED); + case 0: + return (ARCHIVE_EOF); + case TREE_POSTDESCENT: + case TREE_POSTASCENT: + break; + case TREE_REGULAR: + lst = tree_current_lstat(t); + if (lst == NULL) { + archive_set_error(&a->archive, t->tree_errno, + "%ls: Cannot stat", + tree_current_path(t)); + return (ARCHIVE_FAILED); + } + break; + } + } while (lst == NULL); + + archive_entry_copy_pathname_w(entry, tree_current_path(t)); + + /* + * Perform path matching. + */ + if (a->matching) { + r = archive_match_path_excluded(a->matching, entry); + if (r < 0) { + archive_set_error(&(a->archive), errno, + "Faild : %s", archive_error_string(a->matching)); + return (r); + } + if (r) { + if (a->excluded_cb_func) + a->excluded_cb_func(&(a->archive), + a->excluded_cb_data, entry); + return (ARCHIVE_RETRY); + } + } + + /* + * Distinguish 'L'/'P'/'H' symlink following. + */ + switch(t->symlink_mode) { + case 'H': + /* 'H': After the first item, rest like 'P'. */ + t->symlink_mode = 'P'; + /* 'H': First item (from command line) like 'L'. */ + /* FALLTHROUGH */ + case 'L': + /* 'L': Do descend through a symlink to dir. */ + descend = tree_current_is_dir(t); + /* 'L': Follow symlinks to files. */ + a->symlink_mode = 'L'; + a->follow_symlinks = 1; + /* 'L': Archive symlinks as targets, if we can. */ + st = tree_current_stat(t); + if (st != NULL && !tree_target_is_same_as_parent(t, st)) + break; + /* If stat fails, we have a broken symlink; + * in that case, don't follow the link. */ + /* FALLTHROUGH */ + default: + /* 'P': Don't descend through a symlink to dir. */ + descend = tree_current_is_physical_dir(t); + /* 'P': Don't follow symlinks to files. */ + a->symlink_mode = 'P'; + a->follow_symlinks = 0; + /* 'P': Archive symlinks as symlinks. */ + st = lst; + break; + } + + if (update_current_filesystem(a, bhfi_dev(st)) != ARCHIVE_OK) { + a->archive.state = ARCHIVE_STATE_FATAL; + return (ARCHIVE_FATAL); + } + if (t->initial_filesystem_id == -1) + t->initial_filesystem_id = t->current_filesystem_id; + if (!a->traverse_mount_points) { + if (t->initial_filesystem_id != t->current_filesystem_id) + return (ARCHIVE_RETRY); + } + t->descend = descend; + + tree_archive_entry_copy_bhfi(entry, t, st); + + /* Save the times to be restored. This must be in before + * calling archive_read_disk_descend() or any chance of it, + * especially, invokng a callback. */ + t->restore_time.lastWriteTime = st->ftLastWriteTime; + t->restore_time.lastAccessTime = st->ftLastAccessTime; + t->restore_time.filetype = archive_entry_filetype(entry); + + /* + * Perform time matching. + */ + if (a->matching) { + r = archive_match_time_excluded(a->matching, entry); + if (r < 0) { + archive_set_error(&(a->archive), errno, + "Faild : %s", archive_error_string(a->matching)); + return (r); + } + if (r) { + if (a->excluded_cb_func) + a->excluded_cb_func(&(a->archive), + a->excluded_cb_data, entry); + return (ARCHIVE_RETRY); + } + } + + /* Lookup uname/gname */ + name = archive_read_disk_uname(&(a->archive), archive_entry_uid(entry)); + if (name != NULL) + archive_entry_copy_uname(entry, name); + name = archive_read_disk_gname(&(a->archive), archive_entry_gid(entry)); + if (name != NULL) + archive_entry_copy_gname(entry, name); + + /* + * Perform owner matching. + */ + if (a->matching) { + r = archive_match_owner_excluded(a->matching, entry); + if (r < 0) { + archive_set_error(&(a->archive), errno, + "Faild : %s", archive_error_string(a->matching)); + return (r); + } + if (r) { + if (a->excluded_cb_func) + a->excluded_cb_func(&(a->archive), + a->excluded_cb_data, entry); + return (ARCHIVE_RETRY); + } + } + + /* + * Invoke a meta data filter callback. + */ + if (a->metadata_filter_func) { + if (!a->metadata_filter_func(&(a->archive), + a->metadata_filter_data, entry)) + return (ARCHIVE_RETRY); + } + + archive_entry_copy_sourcepath_w(entry, tree_current_access_path(t)); + + r = ARCHIVE_OK; + if (archive_entry_filetype(entry) == AE_IFREG && + archive_entry_size(entry) > 0) { + DWORD flags = FILE_FLAG_BACKUP_SEMANTICS; + if (t->async_io) + flags |= FILE_FLAG_OVERLAPPED; + if (t->direct_io) + flags |= FILE_FLAG_NO_BUFFERING; + else + flags |= FILE_FLAG_SEQUENTIAL_SCAN; + t->entry_fh = CreateFileW(tree_current_access_path(t), + GENERIC_READ, 0, NULL, OPEN_EXISTING, flags, NULL); + if (t->entry_fh == INVALID_HANDLE_VALUE) { + archive_set_error(&a->archive, errno, + "Couldn't open %ls", tree_current_path(a->tree)); + return (ARCHIVE_FAILED); + } + + /* Find sparse data from the disk. */ + if (archive_entry_hardlink(entry) == NULL && + (st->dwFileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) != 0) + r = setup_sparse_from_disk(a, entry, t->entry_fh); + } + return (r); +} + +static int +_archive_read_next_header2(struct archive *_a, struct archive_entry *entry) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + struct tree *t; + int r; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, + "archive_read_next_header2"); + + t = a->tree; + if (t->entry_fh != INVALID_HANDLE_VALUE) { + cancel_async(t); + close_and_restore_time(t->entry_fh, t, &t->restore_time); + t->entry_fh = INVALID_HANDLE_VALUE; + } + + while ((r = next_entry(a, t, entry)) == ARCHIVE_RETRY) + archive_entry_clear(entry); + + /* + * EOF and FATAL are persistent at this layer. By + * modifying the state, we guarantee that future calls to + * read a header or read data will fail. + */ + switch (r) { + case ARCHIVE_EOF: + a->archive.state = ARCHIVE_STATE_EOF; + break; + case ARCHIVE_OK: + case ARCHIVE_WARN: + t->entry_total = 0; + if (archive_entry_filetype(entry) == AE_IFREG) { + t->entry_remaining_bytes = archive_entry_size(entry); + t->entry_eof = (t->entry_remaining_bytes == 0)? 1: 0; + if (!t->entry_eof && + setup_sparse(a, entry) != ARCHIVE_OK) + return (ARCHIVE_FATAL); + } else { + t->entry_remaining_bytes = 0; + t->entry_eof = 1; + } + t->ol_idx_doing = t->ol_idx_done = 0; + t->ol_num_doing = t->ol_num_done = 0; + t->ol_remaining_bytes = t->entry_remaining_bytes; + t->ol_total = 0; + a->archive.state = ARCHIVE_STATE_DATA; + break; + case ARCHIVE_RETRY: + break; + case ARCHIVE_FATAL: + a->archive.state = ARCHIVE_STATE_FATAL; + break; + } + + return (r); +} + +static int +setup_sparse(struct archive_read_disk *a, struct archive_entry *entry) +{ + struct tree *t = a->tree; + int64_t aligned, length, offset; + int i; + + t->sparse_count = archive_entry_sparse_reset(entry); + if (t->sparse_count+1 > t->sparse_list_size) { + free(t->sparse_list); + t->sparse_list_size = t->sparse_count + 1; + t->sparse_list = malloc(sizeof(t->sparse_list[0]) * + t->sparse_list_size); + if (t->sparse_list == NULL) { + t->sparse_list_size = 0; + archive_set_error(&a->archive, ENOMEM, + "Can't allocate data"); + a->archive.state = ARCHIVE_STATE_FATAL; + return (ARCHIVE_FATAL); + } + } + /* + * Get sparse list and make sure those offsets and lengths are + * aligned by a sector size. + */ + for (i = 0; i < t->sparse_count; i++) { + archive_entry_sparse_next(entry, &offset, &length); + aligned = align_num_per_sector(t, offset); + if (aligned != offset) { + aligned -= t->current_filesystem->bytesPerSector; + length += offset - aligned; + } + t->sparse_list[i].offset = aligned; + aligned = align_num_per_sector(t, length); + t->sparse_list[i].length = aligned; + } + + aligned = align_num_per_sector(t, archive_entry_size(entry)); + if (i == 0) { + t->sparse_list[i].offset = 0; + t->sparse_list[i].length = aligned; + } else { + int j, last = i; + + t->sparse_list[i].offset = aligned; + t->sparse_list[i].length = 0; + for (i = 0; i < last; i++) { + if ((t->sparse_list[i].offset + + t->sparse_list[i].length) <= + t->sparse_list[i+1].offset) + continue; + /* + * Now sparse_list[i+1] is overlapped by sparse_list[i]. + * Merge those two. + */ + length = t->sparse_list[i+1].offset - + t->sparse_list[i].offset; + t->sparse_list[i+1].offset = t->sparse_list[i].offset; + t->sparse_list[i+1].length += length; + /* Remove sparse_list[i]. */ + for (j = i; j < last; j++) { + t->sparse_list[j].offset = + t->sparse_list[j+1].offset; + t->sparse_list[j].length = + t->sparse_list[j+1].length; + } + last--; + } + } + t->current_sparse = t->sparse_list; + + return (ARCHIVE_OK); +} + +int +archive_read_disk_set_matching(struct archive *_a, struct archive *_ma, + void (*_excluded_func)(struct archive *, void *, struct archive_entry *), + void *_client_data) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_read_disk_set_matching"); + a->matching = _ma; + a->excluded_cb_func = _excluded_func; + a->excluded_cb_data = _client_data; + return (ARCHIVE_OK); +} + +int +archive_read_disk_set_metadata_filter_callback(struct archive *_a, + int (*_metadata_filter_func)(struct archive *, void *, + struct archive_entry *), void *_client_data) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_ANY, + "archive_read_disk_set_metadata_filter_callback"); + + a->metadata_filter_func = _metadata_filter_func; + a->metadata_filter_data = _client_data; + return (ARCHIVE_OK); +} + +int +archive_read_disk_can_descend(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + struct tree *t = a->tree; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, + "archive_read_disk_can_descend"); + + return (t->visit_type == TREE_REGULAR && t->descend); +} + +/* + * Called by the client to mark the directory just returned from + * tree_next() as needing to be visited. + */ +int +archive_read_disk_descend(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + struct tree *t = a->tree; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, + "archive_read_disk_descend"); + + if (t->visit_type != TREE_REGULAR || !t->descend) + return (ARCHIVE_OK); + + if (tree_current_is_physical_dir(t)) { + tree_push(t, t->basename, t->full_path.s, + t->current_filesystem_id, + bhfi_dev(&(t->lst)), bhfi_ino(&(t->lst)), + &t->restore_time); + t->stack->flags |= isDir; + } else if (tree_current_is_dir(t)) { + tree_push(t, t->basename, t->full_path.s, + t->current_filesystem_id, + bhfi_dev(&(t->st)), bhfi_ino(&(t->st)), + &t->restore_time); + t->stack->flags |= isDirLink; + } + t->descend = 0; + return (ARCHIVE_OK); +} + +int +archive_read_disk_open(struct archive *_a, const char *pathname) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + struct archive_wstring wpath; + int ret; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_NEW | ARCHIVE_STATE_CLOSED, + "archive_read_disk_open"); + archive_clear_error(&a->archive); + + /* Make a wchar_t string from a char string. */ + archive_string_init(&wpath); + if (archive_wstring_append_from_mbs(&wpath, pathname, + strlen(pathname)) != 0) { + if (errno == ENOMEM) + archive_set_error(&a->archive, ENOMEM, + "Can't allocate memory"); + else + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Can't convert a path to a wchar_t string"); + a->archive.state = ARCHIVE_STATE_FATAL; + ret = ARCHIVE_FATAL; + } else + ret = _archive_read_disk_open_w(_a, wpath.s); + + archive_wstring_free(&wpath); + return (ret); +} + +int +archive_read_disk_open_w(struct archive *_a, const wchar_t *pathname) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, + ARCHIVE_STATE_NEW | ARCHIVE_STATE_CLOSED, + "archive_read_disk_open_w"); + archive_clear_error(&a->archive); + + return (_archive_read_disk_open_w(_a, pathname)); +} + +static int +_archive_read_disk_open_w(struct archive *_a, const wchar_t *pathname) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + + if (a->tree != NULL) + a->tree = tree_reopen(a->tree, pathname, a->restore_time); + else + a->tree = tree_open(pathname, a->symlink_mode, a->restore_time); + if (a->tree == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate directory traversal data"); + a->archive.state = ARCHIVE_STATE_FATAL; + return (ARCHIVE_FATAL); + } + a->archive.state = ARCHIVE_STATE_HEADER; + + return (ARCHIVE_OK); +} + +/* + * Return a current filesystem ID which is index of the filesystem entry + * you've visited through archive_read_disk. + */ +int +archive_read_disk_current_filesystem(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_DATA, + "archive_read_disk_current_filesystem"); + + return (a->tree->current_filesystem_id); +} + +static int +update_current_filesystem(struct archive_read_disk *a, int64_t dev) +{ + struct tree *t = a->tree; + int i, fid; + + if (t->current_filesystem != NULL && + t->current_filesystem->dev == dev) + return (ARCHIVE_OK); + + for (i = 0; i < t->max_filesystem_id; i++) { + if (t->filesystem_table[i].dev == dev) { + /* There is the filesytem ID we've already generated. */ + t->current_filesystem_id = i; + t->current_filesystem = &(t->filesystem_table[i]); + return (ARCHIVE_OK); + } + } + + /* + * There is a new filesytem, we generate a new ID for. + */ + fid = t->max_filesystem_id++; + if (t->max_filesystem_id > t->allocated_filesytem) { + size_t s; + void *p; + + s = t->max_filesystem_id * 2; + p = realloc(t->filesystem_table, + s * sizeof(*t->filesystem_table)); + if (p == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate tar data"); + return (ARCHIVE_FATAL); + } + t->filesystem_table = (struct filesystem *)p; + t->allocated_filesytem = (int)s; + } + t->current_filesystem_id = fid; + t->current_filesystem = &(t->filesystem_table[fid]); + t->current_filesystem->dev = dev; + + return (setup_current_filesystem(a)); +} + +/* + * Returns 1 if current filesystem is generated filesystem, 0 if it is not + * or -1 if it is unknown. + */ +int +archive_read_disk_current_filesystem_is_synthetic(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_DATA, + "archive_read_disk_current_filesystem"); + + return (a->tree->current_filesystem->synthetic); +} + +/* + * Returns 1 if current filesystem is remote filesystem, 0 if it is not + * or -1 if it is unknown. + */ +int +archive_read_disk_current_filesystem_is_remote(struct archive *_a) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + + archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_DATA, + "archive_read_disk_current_filesystem"); + + return (a->tree->current_filesystem->remote); +} + +/* + * If symlink is broken, statfs or statvfs will fail. + * Use its directory path instead. + */ +static wchar_t * +safe_path_for_statfs(struct tree *t) +{ + const wchar_t *path; + wchar_t *cp, *p = NULL; + + path = tree_current_access_path(t); + if (tree_current_stat(t) == NULL) { + p = _wcsdup(path); + cp = wcsrchr(p, '/'); + if (cp != NULL && wcslen(cp) >= 2) { + cp[1] = '.'; + cp[2] = '\0'; + path = p; + } + } else + p = _wcsdup(path); + return (p); +} + +/* + * Get conditions of synthetic and remote on Windows + */ +static int +setup_current_filesystem(struct archive_read_disk *a) +{ + struct tree *t = a->tree; + wchar_t vol[256]; + wchar_t *path; + + t->current_filesystem->synthetic = -1;/* Not supported */ + path = safe_path_for_statfs(t); + if (!GetVolumePathNameW(path, vol, sizeof(vol)/sizeof(vol[0]))) { + free(path); + t->current_filesystem->remote = -1; + t->current_filesystem->bytesPerSector = 0; + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "GetVolumePathName failed: %d", (int)GetLastError()); + return (ARCHIVE_FAILED); + } + free(path); + switch (GetDriveTypeW(vol)) { + case DRIVE_UNKNOWN: + case DRIVE_NO_ROOT_DIR: + t->current_filesystem->remote = -1; + break; + case DRIVE_REMOTE: + t->current_filesystem->remote = 1; + break; + default: + t->current_filesystem->remote = 0; + break; + } + + if (!GetDiskFreeSpaceW(vol, NULL, + &(t->current_filesystem->bytesPerSector), NULL, NULL)) { + t->current_filesystem->bytesPerSector = 0; + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "GetDiskFreeSpace failed: %d", (int)GetLastError()); + return (ARCHIVE_FAILED); + } + + return (ARCHIVE_OK); +} + +static int +close_and_restore_time(HANDLE h, struct tree *t, struct restore_time *rt) +{ + HANDLE handle; + int r = 0; + + if (h == INVALID_HANDLE_VALUE && AE_IFLNK == rt->filetype) + return (0); + + /* Close a file descritor. + * It will not be used for SetFileTime() because it has been opened + * by a read only mode. + */ + if (h != INVALID_HANDLE_VALUE) + CloseHandle(h); + if ((t->flags & needsRestoreTimes) == 0) + return (r); + + handle = CreateFileW(rt->full_path, FILE_WRITE_ATTRIBUTES, + 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (handle == INVALID_HANDLE_VALUE) { + errno = EINVAL; + return (-1); + } + + if (SetFileTime(handle, NULL, &rt->lastAccessTime, + &rt->lastWriteTime) == 0) { + errno = EINVAL; + r = -1; + } else + r = 0; + CloseHandle(handle); + return (r); +} + +/* + * Add a directory path to the current stack. + */ +static void +tree_push(struct tree *t, const wchar_t *path, const wchar_t *full_path, + int filesystem_id, int64_t dev, int64_t ino, struct restore_time *rt) +{ + struct tree_entry *te; + + te = malloc(sizeof(*te)); + memset(te, 0, sizeof(*te)); + te->next = t->stack; + te->parent = t->current; + if (te->parent) + te->depth = te->parent->depth + 1; + t->stack = te; + archive_string_init(&te->name); + archive_wstrcpy(&te->name, path); + archive_string_init(&te->full_path); + archive_wstrcpy(&te->full_path, full_path); + te->flags = needsDescent | needsOpen | needsAscent; + te->filesystem_id = filesystem_id; + te->dev = dev; + te->ino = ino; + te->dirname_length = t->dirname_length; + te->full_path_dir_length = t->full_path_dir_length; + te->restore_time.full_path = te->full_path.s; + if (rt != NULL) { + te->restore_time.lastWriteTime = rt->lastWriteTime; + te->restore_time.lastAccessTime = rt->lastAccessTime; + te->restore_time.filetype = rt->filetype; + } +} + +/* + * Append a name to the current dir path. + */ +static void +tree_append(struct tree *t, const wchar_t *name, size_t name_length) +{ + size_t size_needed; + + t->path.s[t->dirname_length] = L'\0'; + t->path.length = t->dirname_length; + /* Strip trailing '/' from name, unless entire name is "/". */ + while (name_length > 1 && name[name_length - 1] == L'/') + name_length--; + + /* Resize pathname buffer as needed. */ + size_needed = name_length + t->dirname_length + 2; + archive_wstring_ensure(&t->path, size_needed); + /* Add a separating '/' if it's needed. */ + if (t->dirname_length > 0 && + t->path.s[archive_strlen(&t->path)-1] != L'/') + archive_wstrappend_wchar(&t->path, L'/'); + t->basename = t->path.s + archive_strlen(&t->path); + archive_wstrncat(&t->path, name, name_length); + t->restore_time.full_path = t->basename; + if (t->full_path_dir_length > 0) { + t->full_path.s[t->full_path_dir_length] = L'\0'; + t->full_path.length = t->full_path_dir_length; + size_needed = name_length + t->full_path_dir_length + 2; + archive_wstring_ensure(&t->full_path, size_needed); + /* Add a separating '\' if it's needed. */ + if (t->full_path.s[archive_strlen(&t->full_path)-1] != L'\\') + archive_wstrappend_wchar(&t->full_path, L'\\'); + archive_wstrncat(&t->full_path, name, name_length); + t->restore_time.full_path = t->full_path.s; + } +} + +/* + * Open a directory tree for traversal. + */ +static struct tree * +tree_open(const wchar_t *path, int symlink_mode, int restore_time) +{ + struct tree *t; + + t = malloc(sizeof(*t)); + memset(t, 0, sizeof(*t)); + archive_string_init(&(t->full_path)); + archive_string_init(&t->path); + archive_wstring_ensure(&t->path, 15); + t->initial_symlink_mode = symlink_mode; + return (tree_reopen(t, path, restore_time)); +} + +static struct tree * +tree_reopen(struct tree *t, const wchar_t *path, int restore_time) +{ + struct archive_wstring ws; + wchar_t *pathname, *p, *base; + + t->flags = (restore_time)?needsRestoreTimes:0; + t->visit_type = 0; + t->tree_errno = 0; + t->full_path_dir_length = 0; + t->dirname_length = 0; + t->depth = 0; + t->descend = 0; + t->current = NULL; + t->d = INVALID_HANDLE_VALUE; + t->symlink_mode = t->initial_symlink_mode; + archive_string_empty(&(t->full_path)); + archive_string_empty(&t->path); + t->entry_fh = INVALID_HANDLE_VALUE; + t->entry_eof = 0; + t->entry_remaining_bytes = 0; + t->initial_filesystem_id = -1; + + /* Get wchar_t strings from char strings. */ + archive_string_init(&ws); + archive_wstrcpy(&ws, path); + pathname = ws.s; + /* Get a full-path-name. */ + p = __la_win_permissive_name_w(pathname); + if (p == NULL) + goto failed; + archive_wstrcpy(&(t->full_path), p); + free(p); + + /* Convert path separators from '\' to '/' */ + for (p = pathname; *p != L'\0'; ++p) { + if (*p == L'\\') + *p = L'/'; + } + base = pathname; + + /* First item is set up a lot like a symlink traversal. */ + /* printf("Looking for wildcard in %s\n", path); */ + if ((base[0] == L'/' && base[1] == L'/' && + base[2] == L'?' && base[3] == L'/' && + (wcschr(base+4, L'*') || wcschr(base+4, L'?'))) || + (!(base[0] == L'/' && base[1] == L'/' && + base[2] == L'?' && base[3] == L'/') && + (wcschr(base, L'*') || wcschr(base, L'?')))) { + // It has a wildcard in it... + // Separate the last element. + p = wcsrchr(base, L'/'); + if (p != NULL) { + *p = L'\0'; + tree_append(t, base, p - base); + t->dirname_length = archive_strlen(&t->path); + base = p + 1; + } + p = wcsrchr(t->full_path.s, L'\\'); + if (p != NULL) { + *p = L'\0'; + t->full_path.length = wcslen(t->full_path.s); + t->full_path_dir_length = archive_strlen(&t->full_path); + } + } + tree_push(t, base, t->full_path.s, 0, 0, 0, NULL); + archive_wstring_free(&ws); + t->stack->flags = needsFirstVisit; + /* + * Debug flag for Direct IO(No buffering) or Async IO. + * Those dependant on environment variable switches + * will be removed until next release. + */ + { + const char *e; + if ((e = getenv("LIBARCHIVE_DIRECT_IO")) != NULL) { + if (e[0] == '0') + t->direct_io = 0; + else + t->direct_io = 1; + fprintf(stderr, "LIBARCHIVE_DIRECT_IO=%s\n", + (t->direct_io)?"Enabled":"Disabled"); + } else + t->direct_io = DIRECT_IO; + if ((e = getenv("LIBARCHIVE_ASYNC_IO")) != NULL) { + if (e[0] == '0') + t->async_io = 0; + else + t->async_io = 1; + fprintf(stderr, "LIBARCHIVE_ASYNC_IO=%s\n", + (t->async_io)?"Enabled":"Disabled"); + } else + t->async_io = ASYNC_IO; + } + return (t); +failed: + archive_wstring_free(&ws); + tree_free(t); + return (NULL); +} + +static int +tree_descent(struct tree *t) +{ + t->dirname_length = archive_strlen(&t->path); + t->full_path_dir_length = archive_strlen(&t->full_path); + t->depth++; + return (0); +} + +/* + * We've finished a directory; ascend back to the parent. + */ +static int +tree_ascend(struct tree *t) +{ + struct tree_entry *te; + + te = t->stack; + t->depth--; + close_and_restore_time(INVALID_HANDLE_VALUE, t, &te->restore_time); + return (0); +} + +/* + * Pop the working stack. + */ +static void +tree_pop(struct tree *t) +{ + struct tree_entry *te; + + t->full_path.s[t->full_path_dir_length] = L'\0'; + t->full_path.length = t->full_path_dir_length; + t->path.s[t->dirname_length] = L'\0'; + t->path.length = t->dirname_length; + if (t->stack == t->current && t->current != NULL) + t->current = t->current->parent; + te = t->stack; + t->stack = te->next; + t->dirname_length = te->dirname_length; + t->basename = t->path.s + t->dirname_length; + t->full_path_dir_length = te->full_path_dir_length; + while (t->basename[0] == L'/') + t->basename++; + archive_wstring_free(&te->name); + archive_wstring_free(&te->full_path); + free(te); +} + +/* + * Get the next item in the tree traversal. + */ +static int +tree_next(struct tree *t) +{ + int r; + + while (t->stack != NULL) { + /* If there's an open dir, get the next entry from there. */ + if (t->d != INVALID_HANDLE_VALUE) { + r = tree_dir_next_windows(t, NULL); + if (r == 0) + continue; + return (r); + } + + if (t->stack->flags & needsFirstVisit) { + wchar_t *d = t->stack->name.s; + t->stack->flags &= ~needsFirstVisit; + if (!(d[0] == L'/' && d[1] == L'/' && + d[2] == L'?' && d[3] == L'/') && + (wcschr(d, L'*') || wcschr(d, L'?'))) { + r = tree_dir_next_windows(t, d); + if (r == 0) + continue; + return (r); + } else { + HANDLE h = FindFirstFileW(d, &t->_findData); + if (h == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); + t->tree_errno = errno; + t->visit_type = TREE_ERROR_DIR; + return (t->visit_type); + } + t->findData = &t->_findData; + FindClose(h); + } + /* Top stack item needs a regular visit. */ + t->current = t->stack; + tree_append(t, t->stack->name.s, + archive_strlen(&(t->stack->name))); + //t->dirname_length = t->path_length; + //tree_pop(t); + t->stack->flags &= ~needsFirstVisit; + return (t->visit_type = TREE_REGULAR); + } else if (t->stack->flags & needsDescent) { + /* Top stack item is dir to descend into. */ + t->current = t->stack; + tree_append(t, t->stack->name.s, + archive_strlen(&(t->stack->name))); + t->stack->flags &= ~needsDescent; + r = tree_descent(t); + if (r != 0) { + tree_pop(t); + t->visit_type = r; + } else + t->visit_type = TREE_POSTDESCENT; + return (t->visit_type); + } else if (t->stack->flags & needsOpen) { + t->stack->flags &= ~needsOpen; + r = tree_dir_next_windows(t, L"*"); + if (r == 0) + continue; + return (r); + } else if (t->stack->flags & needsAscent) { + /* Top stack item is dir and we're done with it. */ + r = tree_ascend(t); + tree_pop(t); + t->visit_type = r != 0 ? r : TREE_POSTASCENT; + return (t->visit_type); + } else { + /* Top item on stack is dead. */ + tree_pop(t); + t->flags &= ~hasLstat; + t->flags &= ~hasStat; + } + } + return (t->visit_type = 0); +} + +static int +tree_dir_next_windows(struct tree *t, const wchar_t *pattern) +{ + const wchar_t *name; + size_t namelen; + int r; + + for (;;) { + if (pattern != NULL) { + struct archive_wstring pt; + + archive_string_init(&pt); + archive_wstring_ensure(&pt, + archive_strlen(&(t->full_path)) + + 2 + wcslen(pattern)); + archive_wstring_copy(&pt, &(t->full_path)); + archive_wstrappend_wchar(&pt, L'\\'); + archive_wstrcat(&pt, pattern); + t->d = FindFirstFileW(pt.s, &t->_findData); + archive_wstring_free(&pt); + if (t->d == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); + t->tree_errno = errno; + r = tree_ascend(t); /* Undo "chdir" */ + tree_pop(t); + t->visit_type = r != 0 ? r : TREE_ERROR_DIR; + return (t->visit_type); + } + t->findData = &t->_findData; + pattern = NULL; + } else if (!FindNextFileW(t->d, &t->_findData)) { + FindClose(t->d); + t->d = INVALID_HANDLE_VALUE; + t->findData = NULL; + return (0); + } + name = t->findData->cFileName; + namelen = wcslen(name); + t->flags &= ~hasLstat; + t->flags &= ~hasStat; + if (name[0] == L'.' && name[1] == L'\0') + continue; + if (name[0] == L'.' && name[1] == L'.' && name[2] == L'\0') + continue; + tree_append(t, name, namelen); + return (t->visit_type = TREE_REGULAR); + } +} + +#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000) +static void +fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns) +{ + ULARGE_INTEGER utc; + + utc.HighPart = filetime->dwHighDateTime; + utc.LowPart = filetime->dwLowDateTime; + if (utc.QuadPart >= EPOC_TIME) { + utc.QuadPart -= EPOC_TIME; + /* milli seconds base */ + *t = (time_t)(utc.QuadPart / 10000000); + /* nano seconds base */ + *ns = (long)(utc.QuadPart % 10000000) * 100; + } else { + *t = 0; + *ns = 0; + } +} + +static void +entry_copy_bhfi(struct archive_entry *entry, const wchar_t *path, + const WIN32_FIND_DATAW *findData, + const BY_HANDLE_FILE_INFORMATION *bhfi) +{ + time_t secs; + long nsecs; + mode_t mode; + + fileTimeToUtc(&bhfi->ftLastAccessTime, &secs, &nsecs); + archive_entry_set_atime(entry, secs, nsecs); + fileTimeToUtc(&bhfi->ftLastWriteTime, &secs, &nsecs); + archive_entry_set_mtime(entry, secs, nsecs); + fileTimeToUtc(&bhfi->ftCreationTime, &secs, &nsecs); + archive_entry_set_birthtime(entry, secs, nsecs); + archive_entry_set_ctime(entry, secs, nsecs); + archive_entry_set_dev(entry, bhfi_dev(bhfi)); + archive_entry_set_ino64(entry, bhfi_ino(bhfi)); + if (bhfi->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + archive_entry_set_nlink(entry, bhfi->nNumberOfLinks + 1); + else + archive_entry_set_nlink(entry, bhfi->nNumberOfLinks); + archive_entry_set_size(entry, + (((int64_t)bhfi->nFileSizeHigh) << 32) + + bhfi->nFileSizeLow); + archive_entry_set_uid(entry, 0); + archive_entry_set_gid(entry, 0); + archive_entry_set_rdev(entry, 0); + + mode = S_IRUSR | S_IRGRP | S_IROTH; + if ((bhfi->dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0) + mode |= S_IWUSR | S_IWGRP | S_IWOTH; + if ((bhfi->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && + findData != NULL && + findData->dwReserved0 == IO_REPARSE_TAG_SYMLINK) + mode |= S_IFLNK; + else if (bhfi->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH; + else { + const wchar_t *p; + + mode |= S_IFREG; + p = wcsrchr(path, L'.'); + if (p != NULL && wcslen(p) == 4) { + switch (p[1]) { + case L'B': case L'b': + if ((p[2] == L'A' || p[2] == L'a' ) && + (p[3] == L'T' || p[3] == L't' )) + mode |= S_IXUSR | S_IXGRP | S_IXOTH; + break; + case L'C': case L'c': + if (((p[2] == L'M' || p[2] == L'm' ) && + (p[3] == L'D' || p[3] == L'd' )) || + ((p[2] == L'M' || p[2] == L'm' ) && + (p[3] == L'D' || p[3] == L'd' ))) + mode |= S_IXUSR | S_IXGRP | S_IXOTH; + break; + case L'E': case L'e': + if ((p[2] == L'X' || p[2] == L'x' ) && + (p[3] == L'E' || p[3] == L'e' )) + mode |= S_IXUSR | S_IXGRP | S_IXOTH; + break; + default: + break; + } + } + } + archive_entry_set_mode(entry, mode); +} + +static void +tree_archive_entry_copy_bhfi(struct archive_entry *entry, struct tree *t, + const BY_HANDLE_FILE_INFORMATION *bhfi) +{ + entry_copy_bhfi(entry, tree_current_path(t), t->findData, bhfi); +} + +static int +tree_current_file_information(struct tree *t, BY_HANDLE_FILE_INFORMATION *st, + int sim_lstat) +{ + HANDLE h; + int r; + DWORD flag = FILE_FLAG_BACKUP_SEMANTICS; + + if (sim_lstat && tree_current_is_physical_link(t)) + flag |= FILE_FLAG_OPEN_REPARSE_POINT; + h = CreateFileW(tree_current_access_path(t), 0, 0, NULL, + OPEN_EXISTING, flag, NULL); + if (h == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); + t->tree_errno = errno; + return (0); + } + r = GetFileInformationByHandle(h, st); + CloseHandle(h); + return (r); +} + +/* + * Get the stat() data for the entry just returned from tree_next(). + */ +static const BY_HANDLE_FILE_INFORMATION * +tree_current_stat(struct tree *t) +{ + if (!(t->flags & hasStat)) { + if (!tree_current_file_information(t, &t->st, 0)) + return NULL; + t->flags |= hasStat; + } + return (&t->st); +} + +/* + * Get the lstat() data for the entry just returned from tree_next(). + */ +static const BY_HANDLE_FILE_INFORMATION * +tree_current_lstat(struct tree *t) +{ + if (!(t->flags & hasLstat)) { + if (!tree_current_file_information(t, &t->lst, 1)) + return NULL; + t->flags |= hasLstat; + } + return (&t->lst); +} + +/* + * Test whether current entry is a dir or link to a dir. + */ +static int +tree_current_is_dir(struct tree *t) +{ + if (t->findData) + return (t->findData->dwFileAttributes + & FILE_ATTRIBUTE_DIRECTORY); + return (0); +} + +/* + * Test whether current entry is a physical directory. Usually, we + * already have at least one of stat() or lstat() in memory, so we + * use tricks to try to avoid an extra trip to the disk. + */ +static int +tree_current_is_physical_dir(struct tree *t) +{ + if (tree_current_is_physical_link(t)) + return (0); + return (tree_current_is_dir(t)); +} + +/* + * Test whether current entry is a symbolic link. + */ +static int +tree_current_is_physical_link(struct tree *t) +{ + if (t->findData) + return ((t->findData->dwFileAttributes + & FILE_ATTRIBUTE_REPARSE_POINT) && + (t->findData->dwReserved0 + == IO_REPARSE_TAG_SYMLINK)); + return (0); +} + +/* + * Test whether the same file has been in the tree as its parent. + */ +static int +tree_target_is_same_as_parent(struct tree *t, + const BY_HANDLE_FILE_INFORMATION *st) +{ + struct tree_entry *te; + int64_t dev = bhfi_dev(st); + int64_t ino = bhfi_ino(st); + + for (te = t->current->parent; te != NULL; te = te->parent) { + if (te->dev == dev && te->ino == ino) + return (1); + } + return (0); +} + +/* + * Return the access path for the entry just returned from tree_next(). + */ +static const wchar_t * +tree_current_access_path(struct tree *t) +{ + return (t->full_path.s); +} + +/* + * Return the full path for the entry just returned from tree_next(). + */ +static const wchar_t * +tree_current_path(struct tree *t) +{ + return (t->path.s); +} + +/* + * Terminate the traversal. + */ +static void +tree_close(struct tree *t) +{ + + if (t == NULL) + return; + if (t->entry_fh != INVALID_HANDLE_VALUE) { + cancel_async(t); + close_and_restore_time(t->entry_fh, t, &t->restore_time); + t->entry_fh = INVALID_HANDLE_VALUE; + } + /* Close the handle of FindFirstFileW */ + if (t->d != INVALID_HANDLE_VALUE) { + FindClose(t->d); + t->d = INVALID_HANDLE_VALUE; + t->findData = NULL; + } + /* Release anything remaining in the stack. */ + while (t->stack != NULL) + tree_pop(t); +} + +/* + * Release any resources. + */ +static void +tree_free(struct tree *t) +{ + int i; + + if (t == NULL) + return; + archive_wstring_free(&t->path); + archive_wstring_free(&t->full_path); + free(t->sparse_list); + free(t->filesystem_table); + for (i = 0; i < MAX_OVERLAPPED; i++) { + if (t->ol[i].buff) + VirtualFree(t->ol[i].buff, 0, MEM_RELEASE); + CloseHandle(t->ol[i].ol.hEvent); + } + free(t); +} + + +/* + * Populate the archive_entry with metadata from the disk. + */ +int +archive_read_disk_entry_from_file(struct archive *_a, + struct archive_entry *entry, int fd, const struct stat *st) +{ + struct archive_read_disk *a = (struct archive_read_disk *)_a; + const wchar_t *path; + const wchar_t *wname; + const char *name; + HANDLE h; + BY_HANDLE_FILE_INFORMATION bhfi; + DWORD fileAttributes = 0; + int r; + + archive_clear_error(_a); + wname = archive_entry_sourcepath_w(entry); + if (wname == NULL) + wname = archive_entry_pathname_w(entry); + if (wname == NULL) { + archive_set_error(&a->archive, EINVAL, + "Can't get a wide character version of the path"); + return (ARCHIVE_FAILED); + } + path = __la_win_permissive_name_w(wname); + + if (st == NULL) { + /* + * Get metadata through GetFileInformationByHandle(). + */ + if (fd >= 0) { + h = (HANDLE)_get_osfhandle(fd); + r = GetFileInformationByHandle(h, &bhfi); + if (r == 0) { + la_dosmaperr(GetLastError()); + archive_set_error(&a->archive, errno, + "Can't GetFileInformationByHandle"); + return (ARCHIVE_FAILED); + } + entry_copy_bhfi(entry, path, NULL, &bhfi); + } else { + WIN32_FIND_DATAW findData; + DWORD flag, desiredAccess; + + h = FindFirstFileW(path, &findData); + if (h == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); + archive_set_error(&a->archive, errno, + "Can't FindFirstFileW"); + return (ARCHIVE_FAILED); + } + FindClose(h); + + flag = FILE_FLAG_BACKUP_SEMANTICS; + if (!a->follow_symlinks && + (findData.dwFileAttributes + & FILE_ATTRIBUTE_REPARSE_POINT) && + (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK)) { + flag |= FILE_FLAG_OPEN_REPARSE_POINT; + desiredAccess = 0; + } else if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + desiredAccess = 0; + } else + desiredAccess = GENERIC_READ; + + h = CreateFileW(path, desiredAccess, 0, NULL, + OPEN_EXISTING, flag, NULL); + if (h == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); + archive_set_error(&a->archive, errno, + "Can't CreateFileW"); + return (ARCHIVE_FAILED); + } + r = GetFileInformationByHandle(h, &bhfi); + if (r == 0) { + la_dosmaperr(GetLastError()); + archive_set_error(&a->archive, errno, + "Can't GetFileInformationByHandle"); + CloseHandle(h); + return (ARCHIVE_FAILED); + } + entry_copy_bhfi(entry, path, &findData, &bhfi); + } + fileAttributes = bhfi.dwFileAttributes; + } else { + archive_entry_copy_stat(entry, st); + h = INVALID_HANDLE_VALUE; + } + + /* Lookup uname/gname */ + name = archive_read_disk_uname(_a, archive_entry_uid(entry)); + if (name != NULL) + archive_entry_copy_uname(entry, name); + name = archive_read_disk_gname(_a, archive_entry_gid(entry)); + if (name != NULL) + archive_entry_copy_gname(entry, name); + + /* + * Can this file be sparse file ? + */ + if (archive_entry_filetype(entry) != AE_IFREG + || archive_entry_size(entry) <= 0 + || archive_entry_hardlink(entry) != NULL) { + if (h != INVALID_HANDLE_VALUE && fd < 0) + CloseHandle(h); + return (ARCHIVE_OK); + } + + if (h == INVALID_HANDLE_VALUE) { + if (fd >= 0) { + h = (HANDLE)_get_osfhandle(fd); + } else { + h = CreateFileW(path, GENERIC_READ, 0, NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (h == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); + archive_set_error(&a->archive, errno, + "Can't CreateFileW"); + return (ARCHIVE_FAILED); + } + } + r = GetFileInformationByHandle(h, &bhfi); + if (r == 0) { + la_dosmaperr(GetLastError()); + archive_set_error(&a->archive, errno, + "Can't GetFileInformationByHandle"); + if (h != INVALID_HANDLE_VALUE && fd < 0) + CloseHandle(h); + return (ARCHIVE_FAILED); + } + fileAttributes = bhfi.dwFileAttributes; + } + + /* Sparse file must be set a mark, FILE_ATTRIBUTE_SPARSE_FILE */ + if ((fileAttributes & FILE_ATTRIBUTE_SPARSE_FILE) == 0) { + if (fd < 0) + CloseHandle(h); + return (ARCHIVE_OK); + } + + r = setup_sparse_from_disk(a, entry, h); + if (fd < 0) + CloseHandle(h); + + return (r); +} + +/* + * Windows sparse interface. + */ +#if defined(__MINGW32__) && !defined(FSCTL_QUERY_ALLOCATED_RANGES) +#define FSCTL_QUERY_ALLOCATED_RANGES 0x940CF +typedef struct { + LARGE_INTEGER FileOffset; + LARGE_INTEGER Length; +} FILE_ALLOCATED_RANGE_BUFFER; +#endif + +static int +setup_sparse_from_disk(struct archive_read_disk *a, + struct archive_entry *entry, HANDLE handle) +{ + FILE_ALLOCATED_RANGE_BUFFER range, *outranges = NULL; + size_t outranges_size; + int64_t entry_size = archive_entry_size(entry); + int exit_sts = ARCHIVE_OK; + + range.FileOffset.QuadPart = 0; + range.Length.QuadPart = entry_size; + outranges_size = 2048; + outranges = (FILE_ALLOCATED_RANGE_BUFFER *)malloc(outranges_size); + if (outranges == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Couldn't allocate memory"); + exit_sts = ARCHIVE_FATAL; + goto exit_setup_sparse; + } + + for (;;) { + DWORD retbytes; + BOOL ret; + + for (;;) { + ret = DeviceIoControl(handle, + FSCTL_QUERY_ALLOCATED_RANGES, + &range, sizeof(range), outranges, + (DWORD)outranges_size, &retbytes, NULL); + if (ret == 0 && GetLastError() == ERROR_MORE_DATA) { + free(outranges); + outranges_size *= 2; + outranges = (FILE_ALLOCATED_RANGE_BUFFER *) + malloc(outranges_size); + if (outranges == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Couldn't allocate memory"); + exit_sts = ARCHIVE_FATAL; + goto exit_setup_sparse; + } + continue; + } else + break; + } + if (ret != 0) { + if (retbytes > 0) { + DWORD i, n; + + n = retbytes / sizeof(outranges[0]); + if (n == 1 && + outranges[0].FileOffset.QuadPart == 0 && + outranges[0].Length.QuadPart == entry_size) + break;/* This is not sparse. */ + for (i = 0; i < n; i++) + archive_entry_sparse_add_entry(entry, + outranges[i].FileOffset.QuadPart, + outranges[i].Length.QuadPart); + range.FileOffset.QuadPart = + outranges[n-1].FileOffset.QuadPart + + outranges[n-1].Length.QuadPart; + range.Length.QuadPart = + entry_size - range.FileOffset.QuadPart; + if (range.Length.QuadPart > 0) + continue; + } else { + /* The remaining data is hole. */ + archive_entry_sparse_add_entry(entry, + range.FileOffset.QuadPart, + range.Length.QuadPart); + } + break; + } else { + la_dosmaperr(GetLastError()); + archive_set_error(&a->archive, errno, + "DeviceIoControl Failed: %lu", GetLastError()); + exit_sts = ARCHIVE_FAILED; + goto exit_setup_sparse; + } + } +exit_setup_sparse: + free(outranges); + + return (exit_sts); +} + +#endif diff --git a/libarchive/archive_windows.c b/libarchive/archive_windows.c new file mode 100644 index 000000000000..d3bf758bb39e --- /dev/null +++ b/libarchive/archive_windows.c @@ -0,0 +1,908 @@ +/*- + * Copyright (c) 2009-2011 Michihiro NAKAJIMA + * Copyright (c) 2003-2007 Kees Zeelenberg + * 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$ + */ + +/* + * A set of compatibility glue for building libarchive on Windows platforms. + * + * Originally created as "libarchive-nonposix.c" by Kees Zeelenberg + * for the GnuWin32 project, trimmed significantly by Tim Kientzle. + * + * Much of the original file was unnecessary for libarchive, because + * many of the features it emulated were not strictly necessary for + * libarchive. I hope for this to shrink further as libarchive + * internals are gradually reworked to sit more naturally on both + * POSIX and Windows. Any ideas for this are greatly appreciated. + * + * The biggest remaining issue is the dev/ino emulation; libarchive + * has a couple of public APIs that rely on dev/ino uniquely + * identifying a file. This doesn't match well with Windows. I'm + * considering alternative APIs. + */ + +#if defined(_WIN32) && !defined(__CYGWIN__) + +#include "archive_platform.h" +#include "archive_private.h" +#include "archive_entry.h" +#include +#include +#include +#ifdef HAVE_SYS_UTIME_H +#include +#endif +#include +#include +#include +#include +#include +#include +#include + +#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000) + +#if defined(__LA_LSEEK_NEEDED) +static BOOL SetFilePointerEx_perso(HANDLE hFile, + LARGE_INTEGER liDistanceToMove, + PLARGE_INTEGER lpNewFilePointer, + DWORD dwMoveMethod) +{ + LARGE_INTEGER li; + li.QuadPart = liDistanceToMove.QuadPart; + li.LowPart = SetFilePointer( + hFile, li.LowPart, &li.HighPart, dwMoveMethod); + if(lpNewFilePointer) { + lpNewFilePointer->QuadPart = li.QuadPart; + } + return li.LowPart != -1 || GetLastError() == NO_ERROR; +} +#endif + +struct ustat { + int64_t st_atime; + uint32_t st_atime_nsec; + int64_t st_ctime; + uint32_t st_ctime_nsec; + int64_t st_mtime; + uint32_t st_mtime_nsec; + gid_t st_gid; + /* 64bits ino */ + int64_t st_ino; + mode_t st_mode; + uint32_t st_nlink; + uint64_t st_size; + uid_t st_uid; + dev_t st_dev; + dev_t st_rdev; +}; + +/* Transform 64-bits ino into 32-bits by hashing. + * You do not forget that really unique number size is 64-bits. + */ +#define INOSIZE (8*sizeof(ino_t)) /* 32 */ +static __inline ino_t +getino(struct ustat *ub) +{ + ULARGE_INTEGER ino64; + ino64.QuadPart = ub->st_ino; + /* I don't know this hashing is correct way */ + return ((ino_t)(ino64.LowPart ^ (ino64.LowPart >> INOSIZE))); +} + +/* + * Prepend "\\?\" to the path name and convert it to unicode to permit + * an extended-length path for a maximum total path length of 32767 + * characters. + * see also http://msdn.microsoft.com/en-us/library/aa365247.aspx + */ +wchar_t * +__la_win_permissive_name(const char *name) +{ + wchar_t *wn; + wchar_t *ws; + size_t ll; + + ll = strlen(name); + wn = malloc((ll + 1) * sizeof(wchar_t)); + if (wn == NULL) + return (NULL); + ll = mbstowcs(wn, name, ll); + if (ll == (size_t)-1) { + free(wn); + return (NULL); + } + wn[ll] = L'\0'; + ws = __la_win_permissive_name_w(wn); + free(wn); + return (ws); +} + +wchar_t * +__la_win_permissive_name_w(const wchar_t *wname) +{ + wchar_t *wn, *wnp; + wchar_t *ws, *wsp; + DWORD l, len, slen; + int unc; + + /* Get a full-pathname. */ + l = GetFullPathNameW(wname, 0, NULL, NULL); + if (l == 0) + return (NULL); + /* NOTE: GetFullPathNameW has a bug that if the length of the file + * name is just 1 then it returns incomplete buffer size. Thus, we + * have to add three to the size to allocate a sufficient buffer + * size for the full-pathname of the file name. */ + l += 3; + wnp = malloc(l * sizeof(wchar_t)); + if (wnp == NULL) + return (NULL); + len = GetFullPathNameW(wname, l, wnp, NULL); + wn = wnp; + + if (wnp[0] == L'\\' && wnp[1] == L'\\' && + wnp[2] == L'?' && wnp[3] == L'\\') + /* We have already a permissive name. */ + return (wn); + + if (wnp[0] == L'\\' && wnp[1] == L'\\' && + wnp[2] == L'.' && wnp[3] == L'\\') { + /* This is a device name */ + if (((wnp[4] >= L'a' && wnp[4] <= L'z') || + (wnp[4] >= L'A' && wnp[4] <= L'Z')) && + wnp[5] == L':' && wnp[6] == L'\\') + wnp[2] = L'?';/* Not device name. */ + return (wn); + } + + unc = 0; + if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') { + wchar_t *p = &wnp[2]; + + /* Skip server-name letters. */ + while (*p != L'\\' && *p != L'\0') + ++p; + if (*p == L'\\') { + wchar_t *rp = ++p; + /* Skip share-name letters. */ + while (*p != L'\\' && *p != L'\0') + ++p; + if (*p == L'\\' && p != rp) { + /* Now, match patterns such as + * "\\server-name\share-name\" */ + wnp += 2; + len -= 2; + unc = 1; + } + } + } + + slen = 4 + (unc * 4) + len + 1; + ws = wsp = malloc(slen * sizeof(wchar_t)); + if (ws == NULL) { + free(wn); + return (NULL); + } + /* prepend "\\?\" */ + wcsncpy(wsp, L"\\\\?\\", 4); + wsp += 4; + slen -= 4; + if (unc) { + /* append "UNC\" ---> "\\?\UNC\" */ + wcsncpy(wsp, L"UNC\\", 4); + wsp += 4; + slen -= 4; + } + wcsncpy(wsp, wnp, slen); + wsp[slen - 1] = L'\0'; /* Ensure null termination. */ + free(wn); + return (ws); +} + +/* + * Create a file handle. + * This can exceed MAX_PATH limitation. + */ +static HANDLE +la_CreateFile(const char *path, DWORD dwDesiredAccess, DWORD dwShareMode, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, + DWORD dwFlagsAndAttributes, HANDLE hTemplateFile) +{ + wchar_t *wpath; + HANDLE handle; + + handle = CreateFileA(path, dwDesiredAccess, dwShareMode, + lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, + hTemplateFile); + if (handle != INVALID_HANDLE_VALUE) + return (handle); + if (GetLastError() != ERROR_PATH_NOT_FOUND) + return (handle); + wpath = __la_win_permissive_name(path); + if (wpath == NULL) + return (handle); + handle = CreateFileW(wpath, dwDesiredAccess, dwShareMode, + lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, + hTemplateFile); + free(wpath); + return (handle); +} + +#if defined(__LA_LSEEK_NEEDED) +__int64 +__la_lseek(int fd, __int64 offset, int whence) +{ + LARGE_INTEGER distance; + LARGE_INTEGER newpointer; + HANDLE handle; + + if (fd < 0) { + errno = EBADF; + return (-1); + } + handle = (HANDLE)_get_osfhandle(fd); + if (GetFileType(handle) != FILE_TYPE_DISK) { + errno = EBADF; + return (-1); + } + distance.QuadPart = offset; + if (!SetFilePointerEx_perso(handle, distance, &newpointer, whence)) { + DWORD lasterr; + + lasterr = GetLastError(); + if (lasterr == ERROR_BROKEN_PIPE) + return (0); + if (lasterr == ERROR_ACCESS_DENIED) + errno = EBADF; + else + la_dosmaperr(lasterr); + return (-1); + } + return (newpointer.QuadPart); +} +#endif + +/* This can exceed MAX_PATH limitation. */ +int +__la_open(const char *path, int flags, ...) +{ + va_list ap; + wchar_t *ws; + int r, pmode; + DWORD attr; + + va_start(ap, flags); + pmode = va_arg(ap, int); + va_end(ap); + ws = NULL; + if ((flags & ~O_BINARY) == O_RDONLY) { + /* + * When we open a directory, _open function returns + * "Permission denied" error. + */ + attr = GetFileAttributesA(path); + if (attr == (DWORD)-1 && GetLastError() == ERROR_PATH_NOT_FOUND) { + ws = __la_win_permissive_name(path); + if (ws == NULL) { + errno = EINVAL; + return (-1); + } + attr = GetFileAttributesW(ws); + } + if (attr == (DWORD)-1) { + la_dosmaperr(GetLastError()); + free(ws); + return (-1); + } + if (attr & FILE_ATTRIBUTE_DIRECTORY) { + HANDLE handle; + + if (ws != NULL) + handle = CreateFileW(ws, 0, 0, NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | + FILE_ATTRIBUTE_READONLY, + NULL); + else + handle = CreateFileA(path, 0, 0, NULL, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | + FILE_ATTRIBUTE_READONLY, + NULL); + free(ws); + if (handle == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); + return (-1); + } + r = _open_osfhandle((intptr_t)handle, _O_RDONLY); + return (r); + } + } + if (ws == NULL) { +#if defined(__BORLANDC__) + /* Borland has no mode argument. + TODO: Fix mode of new file. */ + r = _open(path, flags); +#else + r = _open(path, flags, pmode); +#endif + if (r < 0 && errno == EACCES && (flags & O_CREAT) != 0) { + /* Simulate other POSIX system action to pass our test suite. */ + attr = GetFileAttributesA(path); + if (attr == (DWORD)-1) + la_dosmaperr(GetLastError()); + else if (attr & FILE_ATTRIBUTE_DIRECTORY) + errno = EISDIR; + else + errno = EACCES; + return (-1); + } + if (r >= 0 || errno != ENOENT) + return (r); + ws = __la_win_permissive_name(path); + if (ws == NULL) { + errno = EINVAL; + return (-1); + } + } + r = _wopen(ws, flags, pmode); + if (r < 0 && errno == EACCES && (flags & O_CREAT) != 0) { + /* Simulate other POSIX system action to pass our test suite. */ + attr = GetFileAttributesW(ws); + if (attr == (DWORD)-1) + la_dosmaperr(GetLastError()); + else if (attr & FILE_ATTRIBUTE_DIRECTORY) + errno = EISDIR; + else + errno = EACCES; + } + free(ws); + return (r); +} + +ssize_t +__la_read(int fd, void *buf, size_t nbytes) +{ + HANDLE handle; + DWORD bytes_read, lasterr; + int r; + +#ifdef _WIN64 + if (nbytes > UINT32_MAX) + nbytes = UINT32_MAX; +#endif + if (fd < 0) { + errno = EBADF; + return (-1); + } + /* Do not pass 0 to third parameter of ReadFile(), read bytes. + * This will not return to application side. */ + if (nbytes == 0) + return (0); + handle = (HANDLE)_get_osfhandle(fd); + r = ReadFile(handle, buf, (uint32_t)nbytes, + &bytes_read, NULL); + if (r == 0) { + lasterr = GetLastError(); + if (lasterr == ERROR_NO_DATA) { + errno = EAGAIN; + return (-1); + } + if (lasterr == ERROR_BROKEN_PIPE) + return (0); + if (lasterr == ERROR_ACCESS_DENIED) + errno = EBADF; + else + la_dosmaperr(lasterr); + return (-1); + } + return ((ssize_t)bytes_read); +} + +/* Convert Windows FILETIME to UTC */ +__inline static void +fileTimeToUTC(const FILETIME *filetime, time_t *t, long *ns) +{ + ULARGE_INTEGER utc; + + utc.HighPart = filetime->dwHighDateTime; + utc.LowPart = filetime->dwLowDateTime; + if (utc.QuadPart >= EPOC_TIME) { + utc.QuadPart -= EPOC_TIME; + *t = (time_t)(utc.QuadPart / 10000000); /* milli seconds base */ + *ns = (long)(utc.QuadPart % 10000000) * 100;/* nano seconds base */ + } else { + *t = 0; + *ns = 0; + } +} + +/* Stat by handle + * Windows' stat() does not accept the path added "\\?\" especially "?" + * character. + * It means we cannot access the long name path longer than MAX_PATH. + * So I've implemented simular Windows' stat() to access the long name path. + * And I've added some feature. + * 1. set st_ino by nFileIndexHigh and nFileIndexLow of + * BY_HANDLE_FILE_INFORMATION. + * 2. set st_nlink by nNumberOfLinks of BY_HANDLE_FILE_INFORMATION. + * 3. set st_dev by dwVolumeSerialNumber by BY_HANDLE_FILE_INFORMATION. + */ +static int +__hstat(HANDLE handle, struct ustat *st) +{ + BY_HANDLE_FILE_INFORMATION info; + ULARGE_INTEGER ino64; + DWORD ftype; + mode_t mode; + time_t t; + long ns; + + switch (ftype = GetFileType(handle)) { + case FILE_TYPE_UNKNOWN: + errno = EBADF; + return (-1); + case FILE_TYPE_CHAR: + case FILE_TYPE_PIPE: + if (ftype == FILE_TYPE_CHAR) { + st->st_mode = S_IFCHR; + st->st_size = 0; + } else { + DWORD avail; + + st->st_mode = S_IFIFO; + if (PeekNamedPipe(handle, NULL, 0, NULL, &avail, NULL)) + st->st_size = avail; + else + st->st_size = 0; + } + st->st_atime = 0; + st->st_atime_nsec = 0; + st->st_mtime = 0; + st->st_mtime_nsec = 0; + st->st_ctime = 0; + st->st_ctime_nsec = 0; + st->st_ino = 0; + st->st_nlink = 1; + st->st_uid = 0; + st->st_gid = 0; + st->st_rdev = 0; + st->st_dev = 0; + return (0); + case FILE_TYPE_DISK: + break; + default: + /* This ftype is undocumented type. */ + la_dosmaperr(GetLastError()); + return (-1); + } + + ZeroMemory(&info, sizeof(info)); + if (!GetFileInformationByHandle (handle, &info)) { + la_dosmaperr(GetLastError()); + return (-1); + } + + mode = S_IRUSR | S_IRGRP | S_IROTH; + if ((info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0) + mode |= S_IWUSR | S_IWGRP | S_IWOTH; + if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH; + else + mode |= S_IFREG; + st->st_mode = mode; + + fileTimeToUTC(&info.ftLastAccessTime, &t, &ns); + st->st_atime = t; + st->st_atime_nsec = ns; + fileTimeToUTC(&info.ftLastWriteTime, &t, &ns); + st->st_mtime = t; + st->st_mtime_nsec = ns; + fileTimeToUTC(&info.ftCreationTime, &t, &ns); + st->st_ctime = t; + st->st_ctime_nsec = ns; + st->st_size = + ((int64_t)(info.nFileSizeHigh) * ((int64_t)MAXDWORD + 1)) + + (int64_t)(info.nFileSizeLow); +#ifdef SIMULATE_WIN_STAT + st->st_ino = 0; + st->st_nlink = 1; + st->st_dev = 0; +#else + /* Getting FileIndex as i-node. We should remove a sequence which + * is high-16-bits of nFileIndexHigh. */ + ino64.HighPart = info.nFileIndexHigh & 0x0000FFFFUL; + ino64.LowPart = info.nFileIndexLow; + st->st_ino = ino64.QuadPart; + st->st_nlink = info.nNumberOfLinks; + if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + ++st->st_nlink;/* Add parent directory. */ + st->st_dev = info.dwVolumeSerialNumber; +#endif + st->st_uid = 0; + st->st_gid = 0; + st->st_rdev = 0; + return (0); +} + +static void +copy_stat(struct stat *st, struct ustat *us) +{ + st->st_atime = us->st_atime; + st->st_ctime = us->st_ctime; + st->st_mtime = us->st_mtime; + st->st_gid = us->st_gid; + st->st_ino = getino(us); + st->st_mode = us->st_mode; + st->st_nlink = us->st_nlink; + st->st_size = (off_t)us->st_size; + st->st_uid = us->st_uid; + st->st_dev = us->st_dev; + st->st_rdev = us->st_rdev; +} + +/* + * TODO: Remove a use of __la_fstat and __la_stat. + * We should use GetFileInformationByHandle in place + * where We still use the *stat functions. + */ +int +__la_fstat(int fd, struct stat *st) +{ + struct ustat u; + int ret; + + if (fd < 0) { + errno = EBADF; + return (-1); + } + ret = __hstat((HANDLE)_get_osfhandle(fd), &u); + if (ret >= 0) { + copy_stat(st, &u); + if (u.st_mode & (S_IFCHR | S_IFIFO)) { + st->st_dev = fd; + st->st_rdev = fd; + } + } + return (ret); +} + +/* This can exceed MAX_PATH limitation. */ +int +__la_stat(const char *path, struct stat *st) +{ + HANDLE handle; + struct ustat u; + int ret; + + handle = la_CreateFile(path, 0, 0, NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + NULL); + if (handle == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); + return (-1); + } + ret = __hstat(handle, &u); + CloseHandle(handle); + if (ret >= 0) { + char *p; + + copy_stat(st, &u); + p = strrchr(path, '.'); + if (p != NULL && strlen(p) == 4) { + char exttype[4]; + + ++ p; + exttype[0] = toupper(*p++); + exttype[1] = toupper(*p++); + exttype[2] = toupper(*p++); + exttype[3] = '\0'; + if (!strcmp(exttype, "EXE") || !strcmp(exttype, "CMD") || + !strcmp(exttype, "BAT") || !strcmp(exttype, "COM")) + st->st_mode |= S_IXUSR | S_IXGRP | S_IXOTH; + } + } + return (ret); +} + +/* + * This waitpid is limited implementation. + */ +pid_t +__la_waitpid(HANDLE child, int *status, int option) +{ + DWORD cs; + + (void)option;/* UNUSED */ + do { + if (GetExitCodeProcess(child, &cs) == 0) { + CloseHandle(child); + la_dosmaperr(GetLastError()); + *status = 0; + return (-1); + } + } while (cs == STILL_ACTIVE); + + *status = (int)(cs & 0xff); + return (0); +} + +ssize_t +__la_write(int fd, const void *buf, size_t nbytes) +{ + DWORD bytes_written; + +#ifdef _WIN64 + if (nbytes > UINT32_MAX) + nbytes = UINT32_MAX; +#endif + if (fd < 0) { + errno = EBADF; + return (-1); + } + if (!WriteFile((HANDLE)_get_osfhandle(fd), buf, (uint32_t)nbytes, + &bytes_written, NULL)) { + DWORD lasterr; + + lasterr = GetLastError(); + if (lasterr == ERROR_ACCESS_DENIED) + errno = EBADF; + else + la_dosmaperr(lasterr); + return (-1); + } + return (bytes_written); +} + +/* + * Replace the Windows path separator '\' with '/'. + */ +static int +replace_pathseparator(struct archive_wstring *ws, const wchar_t *wp) +{ + wchar_t *w; + size_t path_length; + + if (wp == NULL) + return(0); + if (wcschr(wp, L'\\') == NULL) + return(0); + path_length = wcslen(wp); + if (archive_wstring_ensure(ws, path_length) == NULL) + return(-1); + archive_wstrncpy(ws, wp, path_length); + for (w = ws->s; *w; w++) { + if (*w == L'\\') + *w = L'/'; + } + return(1); +} + +static int +fix_pathseparator(struct archive_entry *entry) +{ + struct archive_wstring ws; + const wchar_t *wp; + int ret = ARCHIVE_OK; + + archive_string_init(&ws); + wp = archive_entry_pathname_w(entry); + switch (replace_pathseparator(&ws, wp)) { + case 0: /* Not replaced. */ + break; + case 1: /* Replaced. */ + archive_entry_copy_pathname_w(entry, ws.s); + break; + default: + ret = ARCHIVE_FAILED; + } + wp = archive_entry_hardlink_w(entry); + switch (replace_pathseparator(&ws, wp)) { + case 0: /* Not replaced. */ + break; + case 1: /* Replaced. */ + archive_entry_copy_hardlink_w(entry, ws.s); + break; + default: + ret = ARCHIVE_FAILED; + } + wp = archive_entry_symlink_w(entry); + switch (replace_pathseparator(&ws, wp)) { + case 0: /* Not replaced. */ + break; + case 1: /* Replaced. */ + archive_entry_copy_symlink_w(entry, ws.s); + break; + default: + ret = ARCHIVE_FAILED; + } + archive_wstring_free(&ws); + return(ret); +} + +struct archive_entry * +__la_win_entry_in_posix_pathseparator(struct archive_entry *entry) +{ + struct archive_entry *entry_main; + const wchar_t *wp; + int has_backslash = 0; + int ret; + + wp = archive_entry_pathname_w(entry); + if (wp != NULL && wcschr(wp, L'\\') != NULL) + has_backslash = 1; + if (!has_backslash) { + wp = archive_entry_hardlink_w(entry); + if (wp != NULL && wcschr(wp, L'\\') != NULL) + has_backslash = 1; + } + if (!has_backslash) { + wp = archive_entry_symlink_w(entry); + if (wp != NULL && wcschr(wp, L'\\') != NULL) + has_backslash = 1; + } + /* + * If there is no backslach chars, return the original. + */ + if (!has_backslash) + return (entry); + + /* Copy entry so we can modify it as needed. */ + entry_main = archive_entry_clone(entry); + if (entry_main == NULL) + return (NULL); + /* Replace the Windows path-separator '\' with '/'. */ + ret = fix_pathseparator(entry_main); + if (ret < ARCHIVE_WARN) { + archive_entry_free(entry_main); + return (NULL); + } + return (entry_main); +} + + +/* + * The following function was modified from PostgreSQL sources and is + * subject to the copyright below. + */ +/*------------------------------------------------------------------------- + * + * win32error.c + * Map win32 error codes to errno values + * + * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group + * + * IDENTIFICATION + * $PostgreSQL: pgsql/src/port/win32error.c,v 1.4 2008/01/01 19:46:00 momjian Exp $ + * + *------------------------------------------------------------------------- + */ +/* +PostgreSQL Database Management System +(formerly known as Postgres, then as Postgres95) + +Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group + +Portions Copyright (c) 1994, The Regents of the University of California + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose, without fee, and without a written agreement +is hereby granted, provided that the above copyright notice and this +paragraph and the following two paragraphs appear in all copies. + +IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING +LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +*/ + +static const struct { + DWORD winerr; + int doserr; +} doserrors[] = +{ + { ERROR_INVALID_FUNCTION, EINVAL }, + { ERROR_FILE_NOT_FOUND, ENOENT }, + { ERROR_PATH_NOT_FOUND, ENOENT }, + { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, + { ERROR_ACCESS_DENIED, EACCES }, + { ERROR_INVALID_HANDLE, EBADF }, + { ERROR_ARENA_TRASHED, ENOMEM }, + { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, + { ERROR_INVALID_BLOCK, ENOMEM }, + { ERROR_BAD_ENVIRONMENT, E2BIG }, + { ERROR_BAD_FORMAT, ENOEXEC }, + { ERROR_INVALID_ACCESS, EINVAL }, + { ERROR_INVALID_DATA, EINVAL }, + { ERROR_INVALID_DRIVE, ENOENT }, + { ERROR_CURRENT_DIRECTORY, EACCES }, + { ERROR_NOT_SAME_DEVICE, EXDEV }, + { ERROR_NO_MORE_FILES, ENOENT }, + { ERROR_LOCK_VIOLATION, EACCES }, + { ERROR_SHARING_VIOLATION, EACCES }, + { ERROR_BAD_NETPATH, ENOENT }, + { ERROR_NETWORK_ACCESS_DENIED, EACCES }, + { ERROR_BAD_NET_NAME, ENOENT }, + { ERROR_FILE_EXISTS, EEXIST }, + { ERROR_CANNOT_MAKE, EACCES }, + { ERROR_FAIL_I24, EACCES }, + { ERROR_INVALID_PARAMETER, EINVAL }, + { ERROR_NO_PROC_SLOTS, EAGAIN }, + { ERROR_DRIVE_LOCKED, EACCES }, + { ERROR_BROKEN_PIPE, EPIPE }, + { ERROR_DISK_FULL, ENOSPC }, + { ERROR_INVALID_TARGET_HANDLE, EBADF }, + { ERROR_INVALID_HANDLE, EINVAL }, + { ERROR_WAIT_NO_CHILDREN, ECHILD }, + { ERROR_CHILD_NOT_COMPLETE, ECHILD }, + { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, + { ERROR_NEGATIVE_SEEK, EINVAL }, + { ERROR_SEEK_ON_DEVICE, EACCES }, + { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, + { ERROR_NOT_LOCKED, EACCES }, + { ERROR_BAD_PATHNAME, ENOENT }, + { ERROR_MAX_THRDS_REACHED, EAGAIN }, + { ERROR_LOCK_FAILED, EACCES }, + { ERROR_ALREADY_EXISTS, EEXIST }, + { ERROR_FILENAME_EXCED_RANGE, ENOENT }, + { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, + { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } +}; + +void +__la_dosmaperr(unsigned long e) +{ + int i; + + if (e == 0) + { + errno = 0; + return; + } + + for (i = 0; i < (int)sizeof(doserrors); i++) + { + if (doserrors[i].winerr == e) + { + errno = doserrors[i].doserr; + return; + } + } + + /* fprintf(stderr, "unrecognized win32 error code: %lu", e); */ + errno = EINVAL; + return; +} + +#endif /* _WIN32 && !__CYGWIN__ */ diff --git a/libarchive/archive_windows.h b/libarchive/archive_windows.h new file mode 100644 index 000000000000..c6f5bc510513 --- /dev/null +++ b/libarchive/archive_windows.h @@ -0,0 +1,306 @@ +/*- + * Copyright (c) 2009-2011 Michihiro NAKAJIMA + * Copyright (c) 2003-2006 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 + * 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. + * + * $FreeBSD$ + */ + +#ifndef __LIBARCHIVE_BUILD +#error This header is only to be used internally to libarchive. +#endif + +/* + * TODO: A lot of stuff in here isn't actually used by libarchive and + * can be trimmed out. Note that this file is used by libarchive and + * libarchive_test but nowhere else. (But note that it gets compiled + * with many different Windows environments, including MinGW, Visual + * Studio, and Cygwin. Significant changes should be tested in all three.) + */ + +/* + * TODO: Don't use off_t in here. Use __int64 instead. Note that + * Visual Studio and the Windows SDK define off_t as 32 bits; Win32's + * more modern file handling APIs all use __int64 instead of off_t. + */ + +#ifndef LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED +#define LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED + +/* Start of configuration for native Win32 */ +#ifndef MINGW_HAS_SECURE_API +#define MINGW_HAS_SECURE_API 1 +#endif + +#include +#define set_errno(val) ((errno)=val) +#include +#include //brings in NULL +#if defined(HAVE_STDINT_H) +#include +#endif +#include +#include +#include +#include +#include +#if defined(__MINGW32__) && defined(HAVE_UNISTD_H) +/* Prevent build error from a type mismatch of ftruncate(). + * This unistd.h defines it as ftruncate(int, off_t). */ +#include +#endif +#define NOCRYPT +#include +//#define EFTYPE 7 + +#if defined(__BORLANDC__) +#pragma warn -8068 /* Constant out of range in comparison. */ +#pragma warn -8072 /* Suspicious pointer arithmetic. */ +#endif + +#ifndef NULL +#ifdef __cplusplus +#define NULL 0 +#else +#define NULL ((void *)0) +#endif +#endif + +/* Alias the Windows _function to the POSIX equivalent. */ +#define close _close +#define fcntl(fd, cmd, flg) /* No operation. */ +#ifndef fileno +#define fileno _fileno +#endif +#ifdef fstat +#undef fstat +#endif +#define fstat __la_fstat +#if !defined(__BORLANDC__) +#ifdef lseek +#undef lseek +#endif +#define lseek _lseeki64 +#else +#define lseek __la_lseek +#define __LA_LSEEK_NEEDED +#endif +#define lstat __la_stat +#define open __la_open +#define read __la_read +#if !defined(__BORLANDC__) +#define setmode _setmode +#endif +#ifdef stat +#undef stat +#endif +#define stat(path,stref) __la_stat(path,stref) +#if !defined(__BORLANDC__) +#define strdup _strdup +#endif +#define tzset _tzset +#if !defined(__BORLANDC__) +#define umask _umask +#endif +#define waitpid __la_waitpid +#define write __la_write + +#ifndef O_RDONLY +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_TRUNC _O_TRUNC +#define O_CREAT _O_CREAT +#define O_EXCL _O_EXCL +#define O_BINARY _O_BINARY +#endif + +#ifndef _S_IFIFO + #define _S_IFIFO 0010000 /* pipe */ +#endif +#ifndef _S_IFCHR + #define _S_IFCHR 0020000 /* character special */ +#endif +#ifndef _S_IFDIR + #define _S_IFDIR 0040000 /* directory */ +#endif +#ifndef _S_IFBLK + #define _S_IFBLK 0060000 /* block special */ +#endif +#ifndef _S_IFLNK + #define _S_IFLNK 0120000 /* symbolic link */ +#endif +#ifndef _S_IFSOCK + #define _S_IFSOCK 0140000 /* socket */ +#endif +#ifndef _S_IFREG + #define _S_IFREG 0100000 /* regular */ +#endif +#ifndef _S_IFMT + #define _S_IFMT 0170000 /* file type mask */ +#endif + +#ifndef S_IFIFO +#define S_IFIFO _S_IFIFO +#endif +//#define S_IFCHR _S_IFCHR +//#define S_IFDIR _S_IFDIR +#ifndef S_IFBLK +#define S_IFBLK _S_IFBLK +#endif +#ifndef S_IFLNK +#define S_IFLNK _S_IFLNK +#endif +#ifndef S_IFSOCK +#define S_IFSOCK _S_IFSOCK +#endif +//#define S_IFREG _S_IFREG +//#define S_IFMT _S_IFMT + +#ifndef S_ISBLK +#define S_ISBLK(m) (((m) & S_IFMT) == S_IFBLK) /* block special */ +#define S_ISFIFO(m) (((m) & S_IFMT) == S_IFIFO) /* fifo or socket */ +#define S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR) /* char special */ +#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /* directory */ +#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /* regular file */ +#endif +#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK) /* Symbolic link */ +#define S_ISSOCK(m) (((m) & S_IFMT) == S_IFSOCK) /* Socket */ + +#define _S_ISUID 0004000 /* set user id on execution */ +#define _S_ISGID 0002000 /* set group id on execution */ +#define _S_ISVTX 0001000 /* save swapped text even after use */ + +#define S_ISUID _S_ISUID +#define S_ISGID _S_ISGID +#define S_ISVTX _S_ISVTX + +#define _S_IRWXU (_S_IREAD | _S_IWRITE | _S_IEXEC) +#define _S_IXUSR _S_IEXEC /* read permission, user */ +#define _S_IWUSR _S_IWRITE /* write permission, user */ +#define _S_IRUSR _S_IREAD /* execute/search permission, user */ +#define _S_IRWXG (_S_IRWXU >> 3) +#define _S_IXGRP (_S_IXUSR >> 3) /* read permission, group */ +#define _S_IWGRP (_S_IWUSR >> 3) /* write permission, group */ +#define _S_IRGRP (_S_IRUSR >> 3) /* execute/search permission, group */ +#define _S_IRWXO (_S_IRWXG >> 3) +#define _S_IXOTH (_S_IXGRP >> 3) /* read permission, other */ +#define _S_IWOTH (_S_IWGRP >> 3) /* write permission, other */ +#define _S_IROTH (_S_IRGRP >> 3) /* execute/search permission, other */ + +#ifndef S_IRWXU +#define S_IRWXU _S_IRWXU +#define S_IXUSR _S_IXUSR +#define S_IWUSR _S_IWUSR +#define S_IRUSR _S_IRUSR +#endif +#define S_IRWXG _S_IRWXG +#define S_IXGRP _S_IXGRP +#define S_IWGRP _S_IWGRP +#define S_IRGRP _S_IRGRP +#define S_IRWXO _S_IRWXO +#define S_IXOTH _S_IXOTH +#define S_IWOTH _S_IWOTH +#define S_IROTH _S_IROTH + +#define F_DUPFD 0 /* Duplicate file descriptor. */ +#define F_GETFD 1 /* Get file descriptor flags. */ +#define F_SETFD 2 /* Set file descriptor flags. */ +#define F_GETFL 3 /* Get file status flags. */ +#define F_SETFL 4 /* Set file status flags. */ +#define F_GETOWN 5 /* Get owner (receiver of SIGIO). */ +#define F_SETOWN 6 /* Set owner (receiver of SIGIO). */ +#define F_GETLK 7 /* Get record locking info. */ +#define F_SETLK 8 /* Set record locking info (non-blocking). */ +#define F_SETLKW 9 /* Set record locking info (blocking). */ + +/* XXX missing */ +#define F_GETLK64 7 /* Get record locking info. */ +#define F_SETLK64 8 /* Set record locking info (non-blocking). */ +#define F_SETLKW64 9 /* Set record locking info (blocking). */ + +/* File descriptor flags used with F_GETFD and F_SETFD. */ +#define FD_CLOEXEC 1 /* Close on exec. */ + +//NOT SURE IF O_NONBLOCK is OK here but at least the 0x0004 flag is not used by anything else... +#define O_NONBLOCK 0x0004 /* Non-blocking I/O. */ +//#define O_NDELAY O_NONBLOCK + +/* Symbolic constants for the access() function */ +#if !defined(F_OK) + #define R_OK 4 /* Test for read permission */ + #define W_OK 2 /* Test for write permission */ + #define X_OK 1 /* Test for execute permission */ + #define F_OK 0 /* Test for existence of file */ +#endif + + +/* Replacement POSIX function */ +extern int __la_fstat(int fd, struct stat *st); +extern int __la_lstat(const char *path, struct stat *st); +#if defined(__LA_LSEEK_NEEDED) +extern __int64 __la_lseek(int fd, __int64 offset, int whence); +#endif +extern int __la_open(const char *path, int flags, ...); +extern ssize_t __la_read(int fd, void *buf, size_t nbytes); +extern int __la_stat(const char *path, struct stat *st); +extern pid_t __la_waitpid(HANDLE child, int *status, int option); +extern ssize_t __la_write(int fd, const void *buf, size_t nbytes); + +#define _stat64i32(path, st) __la_stat(path, st) +#define _stat64(path, st) __la_stat(path, st) +/* for status returned by la_waitpid */ +#define WIFEXITED(sts) ((sts & 0x100) == 0) +#define WEXITSTATUS(sts) (sts & 0x0FF) + +extern wchar_t *__la_win_permissive_name(const char *name); +extern wchar_t *__la_win_permissive_name_w(const wchar_t *wname); +extern void __la_dosmaperr(unsigned long e); +#define la_dosmaperr(e) __la_dosmaperr(e) +extern struct archive_entry *__la_win_entry_in_posix_pathseparator( + struct archive_entry *); + +#if defined(HAVE_WCRTOMB) && defined(__BORLANDC__) +typedef int mbstate_t; +size_t wcrtomb(char *, wchar_t, mbstate_t *); +#endif + +#if defined(_MSC_VER) && _MSC_VER < 1300 +WINBASEAPI BOOL WINAPI GetVolumePathNameW( + LPCWSTR lpszFileName, + LPWSTR lpszVolumePathName, + DWORD cchBufferLength + ); +# if _WIN32_WINNT < 0x0500 /* windows.h not providing 0x500 API */ +typedef struct _FILE_ALLOCATED_RANGE_BUFFER { + LARGE_INTEGER FileOffset; + LARGE_INTEGER Length; +} FILE_ALLOCATED_RANGE_BUFFER, *PFILE_ALLOCATED_RANGE_BUFFER; +# define FSCTL_SET_SPARSE \ + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 49, METHOD_BUFFERED, FILE_WRITE_DATA) +# define FSCTL_QUERY_ALLOCATED_RANGES \ + CTL_CODE(FILE_DEVICE_FILE_SYSTEM, 51, METHOD_NEITHER, FILE_READ_DATA) +# endif +#endif + +#endif /* LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED */ diff --git a/libarchive/archive_write_disk_windows.c b/libarchive/archive_write_disk_windows.c new file mode 100644 index 000000000000..0f0780a8e47e --- /dev/null +++ b/libarchive/archive_write_disk_windows.c @@ -0,0 +1,2502 @@ +/*- + * Copyright (c) 2003-2010 Tim Kientzle + * Copyright (c) 2011-2012 Michihiro NAKAJIMA + * 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#if defined(_WIN32) && !defined(__CYGWIN__) + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_UTIME_H +#include +#endif +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_FCNTL_H +#include +#endif +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#include + +/* TODO: Support Mac OS 'quarantine' feature. This is really just a + * standard tag to mark files that have been downloaded as "tainted". + * On Mac OS, we should mark the extracted files as tainted if the + * archive being read was tainted. Windows has a similar feature; we + * should investigate ways to support this generically. */ + +#include "archive.h" +#include "archive_acl_private.h" +#include "archive_string.h" +#include "archive_entry.h" +#include "archive_private.h" + +#ifndef O_BINARY +#define O_BINARY 0 +#endif +#ifndef IO_REPARSE_TAG_SYMLINK +/* Old SDKs do not provide IO_REPARSE_TAG_SYMLINK */ +#define IO_REPARSE_TAG_SYMLINK 0xA000000CL +#endif + +static BOOL SetFilePointerEx_perso(HANDLE hFile, + LARGE_INTEGER liDistanceToMove, + PLARGE_INTEGER lpNewFilePointer, + DWORD dwMoveMethod) +{ + LARGE_INTEGER li; + li.QuadPart = liDistanceToMove.QuadPart; + li.LowPart = SetFilePointer( + hFile, li.LowPart, &li.HighPart, dwMoveMethod); + if(lpNewFilePointer) { + lpNewFilePointer->QuadPart = li.QuadPart; + } + return li.LowPart != (DWORD)-1 || GetLastError() == NO_ERROR; +} + +struct fixup_entry { + struct fixup_entry *next; + struct archive_acl acl; + mode_t mode; + int64_t atime; + int64_t birthtime; + int64_t mtime; + int64_t ctime; + unsigned long atime_nanos; + unsigned long birthtime_nanos; + unsigned long mtime_nanos; + unsigned long ctime_nanos; + unsigned long fflags_set; + int fixup; /* bitmask of what needs fixing */ + wchar_t *name; +}; + +/* + * We use a bitmask to track which operations remain to be done for + * this file. In particular, this helps us avoid unnecessary + * operations when it's possible to take care of one step as a + * side-effect of another. For example, mkdir() can specify the mode + * for the newly-created object but symlink() cannot. This means we + * can skip chmod() if mkdir() succeeded, but we must explicitly + * chmod() if we're trying to create a directory that already exists + * (mkdir() failed) or if we're restoring a symlink. Similarly, we + * need to verify UID/GID before trying to restore SUID/SGID bits; + * that verification can occur explicitly through a stat() call or + * implicitly because of a successful chown() call. + */ +#define TODO_MODE_FORCE 0x40000000 +#define TODO_MODE_BASE 0x20000000 +#define TODO_SUID 0x10000000 +#define TODO_SUID_CHECK 0x08000000 +#define TODO_SGID 0x04000000 +#define TODO_SGID_CHECK 0x02000000 +#define TODO_MODE (TODO_MODE_BASE|TODO_SUID|TODO_SGID) +#define TODO_TIMES ARCHIVE_EXTRACT_TIME +#define TODO_OWNER ARCHIVE_EXTRACT_OWNER +#define TODO_FFLAGS ARCHIVE_EXTRACT_FFLAGS +#define TODO_ACLS ARCHIVE_EXTRACT_ACL +#define TODO_XATTR ARCHIVE_EXTRACT_XATTR +#define TODO_MAC_METADATA ARCHIVE_EXTRACT_MAC_METADATA + +struct archive_write_disk { + struct archive archive; + + mode_t user_umask; + struct fixup_entry *fixup_list; + struct fixup_entry *current_fixup; + int64_t user_uid; + int skip_file_set; + int64_t skip_file_dev; + int64_t skip_file_ino; + time_t start_time; + + int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid); + void (*cleanup_gid)(void *private); + void *lookup_gid_data; + int64_t (*lookup_uid)(void *private, const char *uname, int64_t uid); + void (*cleanup_uid)(void *private); + void *lookup_uid_data; + + /* + * Full path of last file to satisfy symlink checks. + */ + struct archive_wstring path_safe; + + /* + * Cached stat data from disk for the current entry. + * If this is valid, pst points to st. Otherwise, + * pst is null. + */ + BY_HANDLE_FILE_INFORMATION st; + BY_HANDLE_FILE_INFORMATION *pst; + + /* Information about the object being restored right now. */ + struct archive_entry *entry; /* Entry being extracted. */ + wchar_t *name; /* Name of entry, possibly edited. */ + struct archive_wstring _name_data; /* backing store for 'name' */ + /* Tasks remaining for this object. */ + int todo; + /* Tasks deferred until end-of-archive. */ + int deferred; + /* Options requested by the client. */ + int flags; + /* Handle for the file we're restoring. */ + HANDLE fh; + /* Current offset for writing data to the file. */ + int64_t offset; + /* Last offset actually written to disk. */ + int64_t fd_offset; + /* Total bytes actually written to files. */ + int64_t total_bytes_written; + /* Maximum size of file, -1 if unknown. */ + int64_t filesize; + /* Dir we were in before this restore; only for deep paths. */ + int restore_pwd; + /* Mode we should use for this entry; affected by _PERM and umask. */ + mode_t mode; + /* UID/GID to use in restoring this entry. */ + int64_t uid; + int64_t gid; +}; + +/* + * Default mode for dirs created automatically (will be modified by umask). + * Note that POSIX specifies 0777 for implicity-created dirs, "modified + * by the process' file creation mask." + */ +#define DEFAULT_DIR_MODE 0777 +/* + * Dir modes are restored in two steps: During the extraction, the permissions + * in the archive are modified to match the following limits. During + * the post-extract fixup pass, the permissions from the archive are + * applied. + */ +#define MINIMUM_DIR_MODE 0700 +#define MAXIMUM_DIR_MODE 0775 + +static int check_symlinks(struct archive_write_disk *); +static int create_filesystem_object(struct archive_write_disk *); +static struct fixup_entry *current_fixup(struct archive_write_disk *, + const wchar_t *pathname); +static int cleanup_pathname(struct archive_write_disk *); +static int create_dir(struct archive_write_disk *, wchar_t *); +static int create_parent_dir(struct archive_write_disk *, wchar_t *); +static int la_chmod(const wchar_t *, mode_t); +static int older(BY_HANDLE_FILE_INFORMATION *, struct archive_entry *); +static int permissive_name_w(struct archive_write_disk *); +static int restore_entry(struct archive_write_disk *); +static int set_acls(struct archive_write_disk *, HANDLE h, + const wchar_t *, struct archive_acl *); +static int set_xattrs(struct archive_write_disk *); +static int set_fflags(struct archive_write_disk *); +static int set_ownership(struct archive_write_disk *); +static int set_mode(struct archive_write_disk *, int mode); +static int set_times(struct archive_write_disk *, HANDLE, int, + const wchar_t *, time_t, long, time_t, long, time_t, + long, time_t, long); +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 struct archive_vtable *archive_write_disk_vtable(void); + +static int _archive_write_disk_close(struct archive *); +static int _archive_write_disk_free(struct archive *); +static int _archive_write_disk_header(struct archive *, + struct archive_entry *); +static int64_t _archive_write_disk_filter_bytes(struct archive *, int); +static int _archive_write_disk_finish_entry(struct archive *); +static ssize_t _archive_write_disk_data(struct archive *, const void *, + size_t); +static ssize_t _archive_write_disk_data_block(struct archive *, const void *, + size_t, int64_t); + +#define bhfi_dev(bhfi) ((bhfi)->dwVolumeSerialNumber) +/* Treat FileIndex as i-node. We should remove a sequence number + * which is high-16-bits of nFileIndexHigh. */ +#define bhfi_ino(bhfi) \ + ((((int64_t)((bhfi)->nFileIndexHigh & 0x0000FFFFUL)) << 32) \ + + (bhfi)->nFileIndexLow) +#define bhfi_size(bhfi) \ + ((((int64_t)(bhfi)->nFileSizeHigh) << 32) + (bhfi)->nFileSizeLow) + +static int +file_information(struct archive_write_disk *a, wchar_t *path, + BY_HANDLE_FILE_INFORMATION *st, mode_t *mode, int sim_lstat) +{ + HANDLE h; + int r; + DWORD flag = FILE_FLAG_BACKUP_SEMANTICS; + WIN32_FIND_DATAW findData; + + if (sim_lstat || mode != NULL) { + h = FindFirstFileW(path, &findData); + if (h == INVALID_HANDLE_VALUE && + GetLastError() == ERROR_INVALID_NAME) { + wchar_t *full; + full = __la_win_permissive_name_w(path); + h = FindFirstFileW(full, &findData); + free(full); + } + if (h == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); + return (-1); + } + FindClose(h); + } + + /* Is symlink file ? */ + if (sim_lstat && + ((findData.dwFileAttributes + & FILE_ATTRIBUTE_REPARSE_POINT) && + (findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK))) + flag |= FILE_FLAG_OPEN_REPARSE_POINT; + + h = CreateFileW(a->name, 0, 0, NULL, + OPEN_EXISTING, flag, NULL); + if (h == INVALID_HANDLE_VALUE && + GetLastError() == ERROR_INVALID_NAME) { + wchar_t *full; + full = __la_win_permissive_name_w(path); + h = CreateFileW(full, 0, 0, NULL, + OPEN_EXISTING, flag, NULL); + free(full); + } + if (h == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); + return (-1); + } + r = GetFileInformationByHandle(h, st); + CloseHandle(h); + if (r == 0) { + la_dosmaperr(GetLastError()); + return (-1); + } + + if (mode == NULL) + return (0); + + *mode = S_IRUSR | S_IRGRP | S_IROTH; + if ((st->dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0) + *mode |= S_IWUSR | S_IWGRP | S_IWOTH; + if ((st->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) && + findData.dwReserved0 == IO_REPARSE_TAG_SYMLINK) + *mode |= S_IFLNK; + else if (st->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + *mode |= S_IFDIR | S_IXUSR | S_IXGRP | S_IXOTH; + else { + const wchar_t *p; + + *mode |= S_IFREG; + p = wcsrchr(path, L'.'); + if (p != NULL && wcslen(p) == 4) { + switch (p[1]) { + case L'B': case L'b': + if ((p[2] == L'A' || p[2] == L'a' ) && + (p[3] == L'T' || p[3] == L't' )) + *mode |= S_IXUSR | S_IXGRP | S_IXOTH; + break; + case L'C': case L'c': + if (((p[2] == L'M' || p[2] == L'm' ) && + (p[3] == L'D' || p[3] == L'd' )) || + ((p[2] == L'M' || p[2] == L'm' ) && + (p[3] == L'D' || p[3] == L'd' ))) + *mode |= S_IXUSR | S_IXGRP | S_IXOTH; + break; + case L'E': case L'e': + if ((p[2] == L'X' || p[2] == L'x' ) && + (p[3] == L'E' || p[3] == L'e' )) + *mode |= S_IXUSR | S_IXGRP | S_IXOTH; + break; + default: + break; + } + } + } + return (0); +} + +/* + * Note: The path, for example, "aa/a/../b../c" will be converted to "aa/c" + * by GetFullPathNameW() W32 API, which __la_win_permissive_name_w uses. + * It means we cannot handle multiple dirs in one archive_entry. + * So we have to make the full-pathname in another way, which does not + * break "../" path string. + */ +static int +permissive_name_w(struct archive_write_disk *a) +{ + wchar_t *wn, *wnp; + wchar_t *ws, *wsp; + DWORD l; + + wnp = a->name; + if (wnp[0] == L'\\' && wnp[1] == L'\\' && + wnp[2] == L'?' && wnp[3] == L'\\') + /* We have already a permissive name. */ + return (0); + + if (wnp[0] == L'\\' && wnp[1] == L'\\' && + wnp[2] == L'.' && wnp[3] == L'\\') { + /* This is a device name */ + if (((wnp[4] >= L'a' && wnp[4] <= L'z') || + (wnp[4] >= L'A' && wnp[4] <= L'Z')) && + wnp[5] == L':' && wnp[6] == L'\\') { + wnp[2] = L'?';/* Not device name. */ + return (0); + } + } + + /* + * A full-pathname starting with a drive name like "C:\abc". + */ + if (((wnp[0] >= L'a' && wnp[0] <= L'z') || + (wnp[0] >= L'A' && wnp[0] <= L'Z')) && + wnp[1] == L':' && wnp[2] == L'\\') { + wn = _wcsdup(wnp); + if (wn == NULL) + return (-1); + archive_wstring_ensure(&(a->_name_data), 4 + wcslen(wn) + 1); + a->name = a->_name_data.s; + /* Prepend "\\?\" */ + archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4); + archive_wstrcat(&(a->_name_data), wn); + free(wn); + return (0); + } + + /* + * A full-pathname pointig a network drive + * like "\\\\file". + */ + if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') { + const wchar_t *p = &wnp[2]; + + /* Skip server-name letters. */ + while (*p != L'\\' && *p != L'\0') + ++p; + if (*p == L'\\') { + const wchar_t *rp = ++p; + /* Skip share-name letters. */ + while (*p != L'\\' && *p != L'\0') + ++p; + if (*p == L'\\' && p != rp) { + /* Now, match patterns such as + * "\\server-name\share-name\" */ + wn = _wcsdup(wnp); + if (wn == NULL) + return (-1); + archive_wstring_ensure(&(a->_name_data), + 8 + wcslen(wn) + 1); + a->name = a->_name_data.s; + /* Prepend "\\?\UNC\" */ + archive_wstrncpy(&(a->_name_data), + L"\\\\?\\UNC\\", 8); + archive_wstrcat(&(a->_name_data), wn+2); + free(wn); + return (0); + } + } + return (0); + } + + /* + * Get current working directory. + */ + l = GetCurrentDirectoryW(0, NULL); + if (l == 0) + return (-1); + ws = malloc(l * sizeof(wchar_t)); + l = GetCurrentDirectoryW(l, ws); + if (l == 0) { + free(ws); + return (-1); + } + wsp = ws; + + /* + * A full-pathname starting without a drive name like "\abc". + */ + if (wnp[0] == L'\\') { + wn = _wcsdup(wnp); + if (wn == NULL) + return (-1); + archive_wstring_ensure(&(a->_name_data), + 4 + 2 + wcslen(wn) + 1); + a->name = a->_name_data.s; + /* Prepend "\\?\" and drive name. */ + archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4); + archive_wstrncat(&(a->_name_data), wsp, 2); + archive_wstrcat(&(a->_name_data), wn); + free(wsp); + free(wn); + return (0); + } + + wn = _wcsdup(wnp); + if (wn == NULL) + return (-1); + archive_wstring_ensure(&(a->_name_data), 4 + l + 1 + wcslen(wn) + 1); + a->name = a->_name_data.s; + /* Prepend "\\?\" and drive name. */ + archive_wstrncpy(&(a->_name_data), L"\\\\?\\", 4); + archive_wstrncat(&(a->_name_data), wsp, l); + archive_wstrncat(&(a->_name_data), L"\\", 1); + archive_wstrcat(&(a->_name_data), wn); + a->name = a->_name_data.s; + free(wsp); + free(wn); + return (0); +} + +static int +la_chmod(const wchar_t *path, mode_t mode) +{ + DWORD attr; + BOOL r; + wchar_t *fullname; + int ret = 0; + + fullname = NULL; + attr = GetFileAttributesW(path); + if (attr == (DWORD)-1 && + GetLastError() == ERROR_INVALID_NAME) { + fullname = __la_win_permissive_name_w(path); + attr = GetFileAttributesW(fullname); + } + if (attr == (DWORD)-1) { + la_dosmaperr(GetLastError()); + ret = -1; + goto exit_chmode; + } + if (mode & _S_IWRITE) + attr &= ~FILE_ATTRIBUTE_READONLY; + else + attr |= FILE_ATTRIBUTE_READONLY; + if (fullname != NULL) + r = SetFileAttributesW(fullname, attr); + else + r = SetFileAttributesW(path, attr); + if (r == 0) { + la_dosmaperr(GetLastError()); + ret = -1; + } +exit_chmode: + free(fullname); + return (ret); +} + +static void * +la_GetFunctionKernel32(const char *name) +{ + static HINSTANCE lib; + static int set; + if (!set) { + set = 1; + lib = LoadLibrary("kernel32.dll"); + } + if (lib == NULL) { + fprintf(stderr, "Can't load kernel32.dll?!\n"); + exit(1); + } + return (void *)GetProcAddress(lib, name); +} + +static int +la_CreateHardLinkW(wchar_t *linkname, wchar_t *target) +{ + static BOOLEAN (WINAPI *f)(LPWSTR, LPWSTR, LPSECURITY_ATTRIBUTES); + static int set; + BOOL ret; + + if (!set) { + set = 1; + f = la_GetFunctionKernel32("CreateHardLinkW"); + } + if (!f) + return (0); + ret = (*f)(linkname, target, NULL); + if (!ret) { + /* Under windows 2000, it is necessary to remove + * the "\\?\" prefix. */ +#define IS_UNC(name) ((name[0] == L'U' || name[0] == L'u') && \ + (name[1] == L'N' || name[1] == L'n') && \ + (name[2] == L'C' || name[2] == L'c') && \ + name[3] == L'\\') + if (!wcsncmp(linkname,L"\\\\?\\", 4)) { + linkname += 4; + if (IS_UNC(linkname)) + linkname += 4; + } + if (!wcsncmp(target,L"\\\\?\\", 4)) { + target += 4; + if (IS_UNC(target)) + target += 4; + } +#undef IS_UNC + ret = (*f)(linkname, target, NULL); + } + return (ret); +} + +static int +la_ftruncate(HANDLE handle, int64_t length) +{ + LARGE_INTEGER distance; + + if (GetFileType(handle) != FILE_TYPE_DISK) { + errno = EBADF; + return (-1); + } + distance.QuadPart = length; + if (!SetFilePointerEx_perso(handle, distance, NULL, FILE_BEGIN)) { + la_dosmaperr(GetLastError()); + return (-1); + } + if (!SetEndOfFile(handle)) { + la_dosmaperr(GetLastError()); + return (-1); + } + return (0); +} + +static int +lazy_stat(struct archive_write_disk *a) +{ + if (a->pst != NULL) { + /* Already have stat() data available. */ + return (ARCHIVE_OK); + } + if (a->fh != INVALID_HANDLE_VALUE && + GetFileInformationByHandle(a->fh, &a->st) == 0) { + a->pst = &a->st; + return (ARCHIVE_OK); + } + + /* + * XXX At this point, symlinks should not be hit, otherwise + * XXX a race occurred. Do we want to check explicitly for that? + */ + if (file_information(a, a->name, &a->st, NULL, 1) == 0) { + a->pst = &a->st; + return (ARCHIVE_OK); + } + archive_set_error(&a->archive, errno, "Couldn't stat file"); + return (ARCHIVE_WARN); +} + +static struct archive_vtable * +archive_write_disk_vtable(void) +{ + static struct archive_vtable av; + static int inited = 0; + + if (!inited) { + av.archive_close = _archive_write_disk_close; + av.archive_filter_bytes = _archive_write_disk_filter_bytes; + av.archive_free = _archive_write_disk_free; + av.archive_write_header = _archive_write_disk_header; + av.archive_write_finish_entry + = _archive_write_disk_finish_entry; + av.archive_write_data = _archive_write_disk_data; + av.archive_write_data_block = _archive_write_disk_data_block; + inited = 1; + } + return (&av); +} + +static int64_t +_archive_write_disk_filter_bytes(struct archive *_a, int n) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + (void)n; /* UNUSED */ + if (n == -1 || n == 0) + return (a->total_bytes_written); + return (-1); +} + + +int +archive_write_disk_set_options(struct archive *_a, int flags) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + + a->flags = flags; + return (ARCHIVE_OK); +} + + +/* + * Extract this entry to disk. + * + * TODO: Validate hardlinks. According to the standards, we're + * supposed to check each extracted hardlink and squawk if it refers + * to a file that we didn't restore. I'm not entirely convinced this + * is a good idea, but more importantly: Is there any way to validate + * hardlinks without keeping a complete list of filenames from the + * entire archive?? Ugh. + * + */ +static int +_archive_write_disk_header(struct archive *_a, struct archive_entry *entry) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + struct fixup_entry *fe; + int ret, r; + + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, + "archive_write_disk_header"); + archive_clear_error(&a->archive); + if (a->archive.state & ARCHIVE_STATE_DATA) { + r = _archive_write_disk_finish_entry(&a->archive); + if (r == ARCHIVE_FATAL) + return (r); + } + + /* Set up for this particular entry. */ + a->pst = NULL; + a->current_fixup = NULL; + a->deferred = 0; + if (a->entry) { + archive_entry_free(a->entry); + a->entry = NULL; + } + a->entry = archive_entry_clone(entry); + a->fh = INVALID_HANDLE_VALUE; + a->fd_offset = 0; + a->offset = 0; + a->restore_pwd = -1; + a->uid = a->user_uid; + a->mode = archive_entry_mode(a->entry); + if (archive_entry_size_is_set(a->entry)) + a->filesize = archive_entry_size(a->entry); + else + a->filesize = -1; + archive_wstrcpy(&(a->_name_data), archive_entry_pathname_w(a->entry)); + a->name = a->_name_data.s; + archive_clear_error(&a->archive); + + /* + * Clean up the requested path. This is necessary for correct + * dir restores; the dir restore logic otherwise gets messed + * up by nonsense like "dir/.". + */ + ret = cleanup_pathname(a); + if (ret != ARCHIVE_OK) + return (ret); + + /* + * Generate a full-pathname and use it from here. + */ + if (permissive_name_w(a) < 0) { + errno = EINVAL; + return (ARCHIVE_FAILED); + } + + /* + * Query the umask so we get predictable mode settings. + * This gets done on every call to _write_header in case the + * user edits their umask during the extraction for some + * reason. + */ + umask(a->user_umask = umask(0)); + + /* Figure out what we need to do for this entry. */ + a->todo = TODO_MODE_BASE; + if (a->flags & ARCHIVE_EXTRACT_PERM) { + a->todo |= TODO_MODE_FORCE; /* Be pushy about permissions. */ + /* + * SGID requires an extra "check" step because we + * cannot easily predict the GID that the system will + * assign. (Different systems assign GIDs to files + * based on a variety of criteria, including process + * credentials and the gid of the enclosing + * directory.) We can only restore the SGID bit if + * the file has the right GID, and we only know the + * GID if we either set it (see set_ownership) or if + * we've actually called stat() on the file after it + * was restored. Since there are several places at + * which we might verify the GID, we need a TODO bit + * to keep track. + */ + if (a->mode & S_ISGID) + a->todo |= TODO_SGID | TODO_SGID_CHECK; + /* + * Verifying the SUID is simpler, but can still be + * done in multiple ways, hence the separate "check" bit. + */ + if (a->mode & S_ISUID) + a->todo |= TODO_SUID | TODO_SUID_CHECK; + } else { + /* + * User didn't request full permissions, so don't + * restore SUID, SGID bits and obey umask. + */ + a->mode &= ~S_ISUID; + a->mode &= ~S_ISGID; + a->mode &= ~S_ISVTX; + a->mode &= ~a->user_umask; + } +#if 0 + if (a->flags & ARCHIVE_EXTRACT_OWNER) + a->todo |= TODO_OWNER; +#endif + if (a->flags & ARCHIVE_EXTRACT_TIME) + a->todo |= TODO_TIMES; + if (a->flags & ARCHIVE_EXTRACT_ACL) { + if (archive_entry_filetype(a->entry) == AE_IFDIR) + a->deferred |= TODO_ACLS; + else + a->todo |= TODO_ACLS; + } + if (a->flags & ARCHIVE_EXTRACT_XATTR) + a->todo |= TODO_XATTR; + if (a->flags & ARCHIVE_EXTRACT_FFLAGS) + a->todo |= TODO_FFLAGS; + if (a->flags & ARCHIVE_EXTRACT_SECURE_SYMLINKS) { + ret = check_symlinks(a); + if (ret != ARCHIVE_OK) + return (ret); + } + + ret = restore_entry(a); + + /* + * TODO: There are rumours that some extended attributes must + * be restored before file data is written. If this is true, + * then we either need to write all extended attributes both + * before and after restoring the data, or find some rule for + * determining which must go first and which last. Due to the + * many ways people are using xattrs, this may prove to be an + * intractable problem. + */ + + /* + * Fixup uses the unedited pathname from archive_entry_pathname(), + * because it is relative to the base dir and the edited path + * might be relative to some intermediate dir as a result of the + * deep restore logic. + */ + if (a->deferred & TODO_MODE) { + fe = current_fixup(a, archive_entry_pathname_w(entry)); + fe->fixup |= TODO_MODE_BASE; + fe->mode = a->mode; + } + + if ((a->deferred & TODO_TIMES) + && (archive_entry_mtime_is_set(entry) + || archive_entry_atime_is_set(entry))) { + fe = current_fixup(a, archive_entry_pathname_w(entry)); + fe->mode = a->mode; + fe->fixup |= TODO_TIMES; + if (archive_entry_atime_is_set(entry)) { + fe->atime = archive_entry_atime(entry); + fe->atime_nanos = archive_entry_atime_nsec(entry); + } else { + /* If atime is unset, use start time. */ + fe->atime = a->start_time; + fe->atime_nanos = 0; + } + if (archive_entry_mtime_is_set(entry)) { + fe->mtime = archive_entry_mtime(entry); + fe->mtime_nanos = archive_entry_mtime_nsec(entry); + } else { + /* If mtime is unset, use start time. */ + fe->mtime = a->start_time; + fe->mtime_nanos = 0; + } + if (archive_entry_birthtime_is_set(entry)) { + fe->birthtime = archive_entry_birthtime(entry); + fe->birthtime_nanos = archive_entry_birthtime_nsec(entry); + } else { + /* If birthtime is unset, use mtime. */ + fe->birthtime = fe->mtime; + fe->birthtime_nanos = fe->mtime_nanos; + } + } + + if (a->deferred & TODO_ACLS) { + fe = current_fixup(a, archive_entry_pathname_w(entry)); + archive_acl_copy(&fe->acl, archive_entry_acl(entry)); + } + + if (a->deferred & TODO_FFLAGS) { + fe = current_fixup(a, archive_entry_pathname_w(entry)); + fe->fixup |= TODO_FFLAGS; + /* TODO: Complete this.. defer fflags from below. */ + } + + /* + * On Windows, A creating sparse file requires a special mark. + */ + if (a->fh != INVALID_HANDLE_VALUE && + archive_entry_sparse_count(entry) > 0) { + int64_t base = 0, offset, length; + int i, cnt = archive_entry_sparse_reset(entry); + int sparse = 0; + + for (i = 0; i < cnt; i++) { + archive_entry_sparse_next(entry, &offset, &length); + if (offset - base >= 4096) { + sparse = 1;/* we have a hole. */ + break; + } + base = offset + length; + } + if (sparse) { + DWORD dmy; + /* Mark this file as sparse. */ + DeviceIoControl(a->fh, FSCTL_SET_SPARSE, + NULL, 0, NULL, 0, &dmy, NULL); + } + } + + /* We've created the object and are ready to pour data into it. */ + if (ret >= ARCHIVE_WARN) + a->archive.state = ARCHIVE_STATE_DATA; + /* + * If it's not open, tell our client not to try writing. + * In particular, dirs, links, etc, don't get written to. + */ + if (a->fh == INVALID_HANDLE_VALUE) { + archive_entry_set_size(entry, 0); + a->filesize = 0; + } + + return (ret); +} + +int +archive_write_disk_set_skip_file(struct archive *_a, int64_t d, int64_t i) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_write_disk_set_skip_file"); + a->skip_file_set = 1; + a->skip_file_dev = d; + a->skip_file_ino = i; + return (ARCHIVE_OK); +} + +static ssize_t +write_data_block(struct archive_write_disk *a, const char *buff, size_t size) +{ + OVERLAPPED ol; + uint64_t start_size = size; + DWORD bytes_written = 0; + ssize_t block_size = 0, bytes_to_write; + + if (size == 0) + return (ARCHIVE_OK); + + if (a->filesize == 0 || a->fh == INVALID_HANDLE_VALUE) { + archive_set_error(&a->archive, 0, + "Attempt to write to an empty file"); + return (ARCHIVE_WARN); + } + + if (a->flags & ARCHIVE_EXTRACT_SPARSE) { + /* XXX TODO XXX Is there a more appropriate choice here ? */ + /* This needn't match the filesystem allocation size. */ + block_size = 16*1024; + } + + /* If this write would run beyond the file size, truncate it. */ + if (a->filesize >= 0 && (int64_t)(a->offset + size) > a->filesize) + start_size = size = (size_t)(a->filesize - a->offset); + + /* Write the data. */ + while (size > 0) { + if (block_size == 0) { + bytes_to_write = size; + } else { + /* We're sparsifying the file. */ + const char *p, *end; + int64_t block_end; + + /* Skip leading zero bytes. */ + for (p = buff, end = buff + size; p < end; ++p) { + if (*p != '\0') + break; + } + a->offset += p - buff; + size -= p - buff; + buff = p; + if (size == 0) + break; + + /* Calculate next block boundary after offset. */ + block_end + = (a->offset / block_size + 1) * block_size; + + /* If the adjusted write would cross block boundary, + * truncate it to the block boundary. */ + bytes_to_write = size; + if (a->offset + bytes_to_write > block_end) + bytes_to_write = (DWORD)(block_end - a->offset); + } + memset(&ol, 0, sizeof(ol)); + ol.Offset = (DWORD)(a->offset & 0xFFFFFFFF); + ol.OffsetHigh = (DWORD)(a->offset >> 32); + if (!WriteFile(a->fh, buff, (uint32_t)bytes_to_write, + &bytes_written, &ol)) { + DWORD lasterr; + + lasterr = GetLastError(); + if (lasterr == ERROR_ACCESS_DENIED) + errno = EBADF; + else + la_dosmaperr(lasterr); + archive_set_error(&a->archive, errno, "Write failed"); + return (ARCHIVE_WARN); + } + buff += bytes_written; + size -= bytes_written; + a->total_bytes_written += bytes_written; + a->offset += bytes_written; + a->fd_offset = a->offset; + } + return ((ssize_t)(start_size - size)); +} + +static ssize_t +_archive_write_disk_data_block(struct archive *_a, + const void *buff, size_t size, int64_t offset) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + ssize_t r; + + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_DATA, "archive_write_data_block"); + + a->offset = offset; + r = write_data_block(a, buff, size); + if (r < ARCHIVE_OK) + return (r); + if ((size_t)r < size) { + archive_set_error(&a->archive, 0, + "Write request too large"); + return (ARCHIVE_WARN); + } + return (ARCHIVE_OK); +} + +static ssize_t +_archive_write_disk_data(struct archive *_a, const void *buff, size_t size) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_DATA, "archive_write_data"); + + return (write_data_block(a, buff, size)); +} + +static int +_archive_write_disk_finish_entry(struct archive *_a) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + int ret = ARCHIVE_OK; + + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, + "archive_write_finish_entry"); + if (a->archive.state & ARCHIVE_STATE_HEADER) + return (ARCHIVE_OK); + archive_clear_error(&a->archive); + + /* Pad or truncate file to the right size. */ + if (a->fh == INVALID_HANDLE_VALUE) { + /* There's no file. */ + } else if (a->filesize < 0) { + /* File size is unknown, so we can't set the size. */ + } else if (a->fd_offset == a->filesize) { + /* Last write ended at exactly the filesize; we're done. */ + /* Hopefully, this is the common case. */ + } else { + if (la_ftruncate(a->fh, a->filesize) == -1) { + archive_set_error(&a->archive, errno, + "File size could not be restored"); + return (ARCHIVE_FAILED); + } + } + + /* Restore metadata. */ + + /* + * Look up the "real" UID only if we're going to need it. + * TODO: the TODO_SGID condition can be dropped here, can't it? + */ + if (a->todo & (TODO_OWNER | TODO_SUID | TODO_SGID)) { + a->uid = archive_write_disk_uid(&a->archive, + archive_entry_uname(a->entry), + archive_entry_uid(a->entry)); + } + /* Look up the "real" GID only if we're going to need it. */ + /* TODO: the TODO_SUID condition can be dropped here, can't it? */ + if (a->todo & (TODO_OWNER | TODO_SGID | TODO_SUID)) { + a->gid = archive_write_disk_gid(&a->archive, + archive_entry_gname(a->entry), + archive_entry_gid(a->entry)); + } + + /* + * Restore ownership before set_mode tries to restore suid/sgid + * bits. If we set the owner, we know what it is and can skip + * a stat() call to examine the ownership of the file on disk. + */ + if (a->todo & TODO_OWNER) + ret = set_ownership(a); + + /* + * set_mode must precede ACLs on systems such as Solaris and + * FreeBSD where setting the mode implicitly clears extended ACLs + */ + if (a->todo & TODO_MODE) { + int r2 = set_mode(a, a->mode); + if (r2 < ret) ret = r2; + } + + /* + * Security-related extended attributes (such as + * security.capability on Linux) have to be restored last, + * since they're implicitly removed by other file changes. + */ + if (a->todo & TODO_XATTR) { + int r2 = set_xattrs(a); + if (r2 < ret) ret = r2; + } + + /* + * Some flags prevent file modification; they must be restored after + * file contents are written. + */ + if (a->todo & TODO_FFLAGS) { + int r2 = set_fflags(a); + if (r2 < ret) ret = r2; + } + + /* + * Time must follow most other metadata; + * otherwise atime will get changed. + */ + if (a->todo & TODO_TIMES) { + int r2 = set_times_from_entry(a); + if (r2 < ret) ret = r2; + } + + /* + * ACLs must be restored after timestamps because there are + * ACLs that prevent attribute changes (including time). + */ + if (a->todo & TODO_ACLS) { + int r2 = set_acls(a, a->fh, + archive_entry_pathname_w(a->entry), + archive_entry_acl(a->entry)); + if (r2 < ret) ret = r2; + } + + /* If there's an fd, we can close it now. */ + if (a->fh != INVALID_HANDLE_VALUE) { + CloseHandle(a->fh); + a->fh = INVALID_HANDLE_VALUE; + } + /* If there's an entry, we can release it now. */ + if (a->entry) { + archive_entry_free(a->entry); + a->entry = NULL; + } + a->archive.state = ARCHIVE_STATE_HEADER; + return (ret); +} + +int +archive_write_disk_set_group_lookup(struct archive *_a, + void *private_data, + int64_t (*lookup_gid)(void *private, const char *gname, int64_t gid), + void (*cleanup_gid)(void *private)) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_write_disk_set_group_lookup"); + + if (a->cleanup_gid != NULL && a->lookup_gid_data != NULL) + (a->cleanup_gid)(a->lookup_gid_data); + + a->lookup_gid = lookup_gid; + a->cleanup_gid = cleanup_gid; + a->lookup_gid_data = private_data; + return (ARCHIVE_OK); +} + +int +archive_write_disk_set_user_lookup(struct archive *_a, + void *private_data, + int64_t (*lookup_uid)(void *private, const char *uname, int64_t uid), + void (*cleanup_uid)(void *private)) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_write_disk_set_user_lookup"); + + if (a->cleanup_uid != NULL && a->lookup_uid_data != NULL) + (a->cleanup_uid)(a->lookup_uid_data); + + a->lookup_uid = lookup_uid; + a->cleanup_uid = cleanup_uid; + a->lookup_uid_data = private_data; + return (ARCHIVE_OK); +} + +int64_t +archive_write_disk_gid(struct archive *_a, const char *name, int64_t id) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_write_disk_gid"); + if (a->lookup_gid) + return (a->lookup_gid)(a->lookup_gid_data, name, id); + return (id); +} + +int64_t +archive_write_disk_uid(struct archive *_a, const char *name, int64_t id) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_ANY, "archive_write_disk_uid"); + if (a->lookup_uid) + return (a->lookup_uid)(a->lookup_uid_data, name, id); + return (id); +} + +/* + * Create a new archive_write_disk object and initialize it with global state. + */ +struct archive * +archive_write_disk_new(void) +{ + struct archive_write_disk *a; + + a = (struct archive_write_disk *)malloc(sizeof(*a)); + if (a == NULL) + return (NULL); + memset(a, 0, sizeof(*a)); + a->archive.magic = ARCHIVE_WRITE_DISK_MAGIC; + /* We're ready to write a header immediately. */ + a->archive.state = ARCHIVE_STATE_HEADER; + a->archive.vtable = archive_write_disk_vtable(); + a->start_time = time(NULL); + /* Query and restore the umask. */ + umask(a->user_umask = umask(0)); + if (archive_wstring_ensure(&a->path_safe, 512) == NULL) { + free(a); + return (NULL); + } + return (&a->archive); +} + +static int +disk_unlink(wchar_t *path) +{ + wchar_t *fullname; + int r; + + r = _wunlink(path); + if (r != 0 && GetLastError() == ERROR_INVALID_NAME) { + fullname = __la_win_permissive_name_w(path); + r = _wunlink(fullname); + free(fullname); + } + return (r); +} + +static int +disk_rmdir(wchar_t *path) +{ + wchar_t *fullname; + int r; + + r = _wrmdir(path); + if (r != 0 && GetLastError() == ERROR_INVALID_NAME) { + fullname = __la_win_permissive_name_w(path); + r = _wrmdir(fullname); + free(fullname); + } + return (r); +} + +/* + * The main restore function. + */ +static int +restore_entry(struct archive_write_disk *a) +{ + int ret = ARCHIVE_OK, en; + + if (a->flags & ARCHIVE_EXTRACT_UNLINK && !S_ISDIR(a->mode)) { + /* + * TODO: Fix this. Apparently, there are platforms + * that still allow root to hose the entire filesystem + * by unlinking a dir. The S_ISDIR() test above + * prevents us from using unlink() here if the new + * object is a dir, but that doesn't mean the old + * object isn't a dir. + */ + if (disk_unlink(a->name) == 0) { + /* We removed it, reset cached stat. */ + a->pst = NULL; + } else if (errno == ENOENT) { + /* File didn't exist, that's just as good. */ + } else if (disk_rmdir(a->name) == 0) { + /* It was a dir, but now it's gone. */ + a->pst = NULL; + } else { + /* We tried, but couldn't get rid of it. */ + archive_set_error(&a->archive, errno, + "Could not unlink"); + return(ARCHIVE_FAILED); + } + } + + /* Try creating it first; if this fails, we'll try to recover. */ + en = create_filesystem_object(a); + + if ((en == ENOTDIR || en == ENOENT) + && !(a->flags & ARCHIVE_EXTRACT_NO_AUTODIR)) { + wchar_t *full; + /* If the parent dir doesn't exist, try creating it. */ + create_parent_dir(a, a->name); + /* Now try to create the object again. */ + full = __la_win_permissive_name_w(a->name); + if (full == NULL) { + en = EINVAL; + } else { + /* Remove multiple directories such as "a/../b../c" */ + archive_wstrcpy(&(a->_name_data), full); + a->name = a->_name_data.s; + free(full); + en = create_filesystem_object(a); + } + } + + if ((en == EISDIR || en == EEXIST) + && (a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) { + /* If we're not overwriting, we're done. */ + archive_entry_unset_size(a->entry); + return (ARCHIVE_OK); + } + + /* + * Some platforms return EISDIR if you call + * open(O_WRONLY | O_EXCL | O_CREAT) on a directory, some + * return EEXIST. POSIX is ambiguous, requiring EISDIR + * for open(O_WRONLY) on a dir and EEXIST for open(O_EXCL | O_CREAT) + * on an existing item. + */ + if (en == EISDIR) { + /* A dir is in the way of a non-dir, rmdir it. */ + if (disk_rmdir(a->name) != 0) { + archive_set_error(&a->archive, errno, + "Can't remove already-existing dir"); + return (ARCHIVE_FAILED); + } + a->pst = NULL; + /* Try again. */ + en = create_filesystem_object(a); + } else if (en == EEXIST) { + mode_t st_mode; + /* + * We know something is in the way, but we don't know what; + * we need to find out before we go any further. + */ + int r = 0; + /* + * The SECURE_SYMLINK logic has already removed a + * symlink to a dir if the client wants that. So + * follow the symlink if we're creating a dir. + */ + if (S_ISDIR(a->mode)) + r = file_information(a, a->name, &a->st, &st_mode, 0); + /* + * If it's not a dir (or it's a broken symlink), + * then don't follow it. + */ + if (r != 0 || !S_ISDIR(a->mode)) + r = file_information(a, a->name, &a->st, &st_mode, 1); + if (r != 0) { + archive_set_error(&a->archive, errno, + "Can't stat existing object"); + return (ARCHIVE_FAILED); + } + + /* + * NO_OVERWRITE_NEWER doesn't apply to directories. + */ + if ((a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER) + && !S_ISDIR(st_mode)) { + if (!older(&(a->st), a->entry)) { + archive_entry_unset_size(a->entry); + return (ARCHIVE_OK); + } + } + + /* If it's our archive, we're done. */ + if (a->skip_file_set && + bhfi_dev(&a->st) == a->skip_file_dev && + bhfi_ino(&a->st) == a->skip_file_ino) { + archive_set_error(&a->archive, 0, + "Refusing to overwrite archive"); + return (ARCHIVE_FAILED); + } + + if (!S_ISDIR(st_mode)) { + /* A non-dir is in the way, unlink it. */ + if (disk_unlink(a->name) != 0) { + archive_set_error(&a->archive, errno, + "Can't unlink already-existing object"); + return (ARCHIVE_FAILED); + } + a->pst = NULL; + /* Try again. */ + en = create_filesystem_object(a); + } else if (!S_ISDIR(a->mode)) { + /* A dir is in the way of a non-dir, rmdir it. */ + if (disk_rmdir(a->name) != 0) { + archive_set_error(&a->archive, errno, + "Can't remove already-existing dir"); + return (ARCHIVE_FAILED); + } + /* Try again. */ + en = create_filesystem_object(a); + } else { + /* + * There's a dir in the way of a dir. Don't + * waste time with rmdir()/mkdir(), just fix + * up the permissions on the existing dir. + * Note that we don't change perms on existing + * dirs unless _EXTRACT_PERM is specified. + */ + if ((a->mode != st_mode) + && (a->todo & TODO_MODE_FORCE)) + a->deferred |= (a->todo & TODO_MODE); + /* Ownership doesn't need deferred fixup. */ + en = 0; /* Forget the EEXIST. */ + } + } + + if (en) { + /* Everything failed; give up here. */ + archive_set_error(&a->archive, en, "Can't create '%ls'", + a->name); + return (ARCHIVE_FAILED); + } + + a->pst = NULL; /* Cached stat data no longer valid. */ + return (ret); +} + +/* + * Returns 0 if creation succeeds, or else returns errno value from + * the failed system call. Note: This function should only ever perform + * a single system call. + */ +static int +create_filesystem_object(struct archive_write_disk *a) +{ + /* Create the entry. */ + const wchar_t *linkname; + wchar_t *fullname; + mode_t final_mode, mode; + int r; + + /* We identify hard/symlinks according to the link names. */ + /* Since link(2) and symlink(2) don't handle modes, we're done here. */ + linkname = archive_entry_hardlink_w(a->entry); + if (linkname != NULL) { + wchar_t *linkfull, *namefull; + + linkfull = __la_win_permissive_name_w(linkname); + namefull = __la_win_permissive_name_w(a->name); + if (linkfull == NULL || namefull == NULL) { + errno = EINVAL; + r = -1; + } else { + r = la_CreateHardLinkW(namefull, linkfull); + if (r == 0) { + la_dosmaperr(GetLastError()); + r = errno; + } else + r = 0; + } + /* + * New cpio and pax formats allow hardlink entries + * to carry data, so we may have to open the file + * for hardlink entries. + * + * If the hardlink was successfully created and + * the archive doesn't have carry data for it, + * consider it to be non-authoritative for meta data. + * This is consistent with GNU tar and BSD pax. + * If the hardlink does carry data, let the last + * archive entry decide ownership. + */ + if (r == 0 && a->filesize <= 0) { + a->todo = 0; + a->deferred = 0; + } else if (r == 0 && a->filesize > 0) { + a->fh = CreateFileW(namefull, GENERIC_WRITE, 0, NULL, + TRUNCATE_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (a->fh == INVALID_HANDLE_VALUE) { + la_dosmaperr(GetLastError()); + r = errno; + } + } + free(linkfull); + free(namefull); + return (r); + } + linkname = archive_entry_symlink_w(a->entry); + if (linkname != NULL) { +#if HAVE_SYMLINK + return symlink(linkname, a->name) ? errno : 0; +#else + return (EPERM); +#endif + } + + /* + * The remaining system calls all set permissions, so let's + * try to take advantage of that to avoid an extra chmod() + * call. (Recall that umask is set to zero right now!) + */ + + /* Mode we want for the final restored object (w/o file type bits). */ + final_mode = a->mode & 07777; + /* + * The mode that will actually be restored in this step. Note + * that SUID, SGID, etc, require additional work to ensure + * security, so we never restore them at this point. + */ + mode = final_mode & 0777 & ~a->user_umask; + + switch (a->mode & AE_IFMT) { + default: + /* POSIX requires that we fall through here. */ + /* FALLTHROUGH */ + case AE_IFREG: + fullname = a->name; + /* O_WRONLY | O_CREAT | O_EXCL */ + a->fh = CreateFileW(fullname, GENERIC_WRITE, 0, NULL, + CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + if (a->fh == INVALID_HANDLE_VALUE && + GetLastError() == ERROR_INVALID_NAME && + fullname == a->name) { + fullname = __la_win_permissive_name_w(a->name); + a->fh = CreateFileW(fullname, GENERIC_WRITE, 0, NULL, + CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + } + if (a->fh == INVALID_HANDLE_VALUE) { + if (GetLastError() == ERROR_ACCESS_DENIED) { + DWORD attr; + /* Simulate an errno of POSIX system. */ + attr = GetFileAttributesW(fullname); + if (attr == (DWORD)-1) + la_dosmaperr(GetLastError()); + else if (attr & FILE_ATTRIBUTE_DIRECTORY) + errno = EISDIR; + else + errno = EACCES; + } else + la_dosmaperr(GetLastError()); + r = 1; + } else + r = 0; + if (fullname != a->name) + free(fullname); + break; + case AE_IFCHR: + case AE_IFBLK: + /* TODO: Find a better way to warn about our inability + * to restore a block device node. */ + return (EINVAL); + case AE_IFDIR: + mode = (mode | MINIMUM_DIR_MODE) & MAXIMUM_DIR_MODE; + fullname = a->name; + r = CreateDirectoryW(fullname, NULL); + if (r == 0 && GetLastError() == ERROR_INVALID_NAME && + fullname == a->name) { + fullname = __la_win_permissive_name_w(a->name); + r = CreateDirectoryW(fullname, NULL); + } + if (r != 0) { + r = 0; + /* Defer setting dir times. */ + a->deferred |= (a->todo & TODO_TIMES); + a->todo &= ~TODO_TIMES; + /* Never use an immediate chmod(). */ + /* We can't avoid the chmod() entirely if EXTRACT_PERM + * because of SysV SGID inheritance. */ + if ((mode != final_mode) + || (a->flags & ARCHIVE_EXTRACT_PERM)) + a->deferred |= (a->todo & TODO_MODE); + a->todo &= ~TODO_MODE; + } else { + la_dosmaperr(GetLastError()); + r = -1; + } + if (fullname != a->name) + free(fullname); + break; + case AE_IFIFO: + /* TODO: Find a better way to warn about our inability + * to restore a fifo. */ + return (EINVAL); + } + + /* All the system calls above set errno on failure. */ + if (r) + return (errno); + + /* If we managed to set the final mode, we've avoided a chmod(). */ + if (mode == final_mode) + a->todo &= ~TODO_MODE; + return (0); +} + +/* + * Cleanup function for archive_extract. Mostly, this involves processing + * the fixup list, which is used to address a number of problems: + * * Dir permissions might prevent us from restoring a file in that + * dir, so we restore the dir with minimum 0700 permissions first, + * then correct the mode at the end. + * * Similarly, the act of restoring a file touches the directory + * and changes the timestamp on the dir, so we have to touch-up dir + * timestamps at the end as well. + * * Some file flags can interfere with the restore by, for example, + * preventing the creation of hardlinks to those files. + * * Mac OS extended metadata includes ACLs, so must be deferred on dirs. + * + * Note that tar/cpio do not require that archives be in a particular + * order; there is no way to know when the last file has been restored + * within a directory, so there's no way to optimize the memory usage + * here by fixing up the directory any earlier than the + * end-of-archive. + * + * XXX TODO: Directory ACLs should be restored here, for the same + * reason we set directory perms here. XXX + */ +static int +_archive_write_disk_close(struct archive *_a) +{ + struct archive_write_disk *a = (struct archive_write_disk *)_a; + struct fixup_entry *next, *p; + int ret; + + archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, + "archive_write_disk_close"); + ret = _archive_write_disk_finish_entry(&a->archive); + + /* Sort dir list so directories are fixed up in depth-first order. */ + p = sort_dir_list(a->fixup_list); + + while (p != NULL) { + a->pst = NULL; /* Mark stat cache as out-of-date. */ + if (p->fixup & TODO_TIMES) { + set_times(a, INVALID_HANDLE_VALUE, p->mode, p->name, + p->atime, p->atime_nanos, + p->birthtime, p->birthtime_nanos, + p->mtime, p->mtime_nanos, + p->ctime, p->ctime_nanos); + } + if (p->fixup & TODO_MODE_BASE) + la_chmod(p->name, p->mode); + if (p->fixup & TODO_ACLS) + set_acls(a, INVALID_HANDLE_VALUE, p->name, &p->acl); + next = p->next; + archive_acl_clear(&p->acl); + free(p->name); + free(p); + p = next; + } + a->fixup_list = NULL; + return (ret); +} + +static int +_archive_write_disk_free(struct archive *_a) +{ + struct archive_write_disk *a; + int ret; + if (_a == NULL) + return (ARCHIVE_OK); + archive_check_magic(_a, ARCHIVE_WRITE_DISK_MAGIC, + ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL, "archive_write_disk_free"); + a = (struct archive_write_disk *)_a; + ret = _archive_write_disk_close(&a->archive); + archive_write_disk_set_group_lookup(&a->archive, NULL, NULL, NULL); + archive_write_disk_set_user_lookup(&a->archive, NULL, NULL, NULL); + if (a->entry) + archive_entry_free(a->entry); + archive_wstring_free(&a->_name_data); + archive_string_free(&a->archive.error_string); + archive_wstring_free(&a->path_safe); + a->archive.magic = 0; + __archive_clean(&a->archive); + free(a); + return (ret); +} + +/* + * Simple O(n log n) merge sort to order the fixup list. In + * particular, we want to restore dir timestamps depth-first. + */ +static struct fixup_entry * +sort_dir_list(struct fixup_entry *p) +{ + struct fixup_entry *a, *b, *t; + + if (p == NULL) + return (NULL); + /* A one-item list is already sorted. */ + if (p->next == NULL) + return (p); + + /* Step 1: split the list. */ + t = p; + a = p->next->next; + while (a != NULL) { + /* Step a twice, t once. */ + a = a->next; + if (a != NULL) + a = a->next; + t = t->next; + } + /* Now, t is at the mid-point, so break the list here. */ + b = t->next; + t->next = NULL; + a = p; + + /* Step 2: Recursively sort the two sub-lists. */ + a = sort_dir_list(a); + b = sort_dir_list(b); + + /* Step 3: Merge the returned lists. */ + /* Pick the first element for the merged list. */ + if (wcscmp(a->name, b->name) > 0) { + t = p = a; + a = a->next; + } else { + t = p = b; + b = b->next; + } + + /* Always put the later element on the list first. */ + while (a != NULL && b != NULL) { + if (wcscmp(a->name, b->name) > 0) { + t->next = a; + a = a->next; + } else { + t->next = b; + b = b->next; + } + t = t->next; + } + + /* Only one list is non-empty, so just splice it on. */ + if (a != NULL) + t->next = a; + if (b != NULL) + t->next = b; + + return (p); +} + +/* + * Returns a new, initialized fixup entry. + * + * TODO: Reduce the memory requirements for this list by using a tree + * structure rather than a simple list of names. + */ +static struct fixup_entry * +new_fixup(struct archive_write_disk *a, const wchar_t *pathname) +{ + struct fixup_entry *fe; + + fe = (struct fixup_entry *)calloc(1, sizeof(struct fixup_entry)); + if (fe == NULL) + return (NULL); + fe->next = a->fixup_list; + a->fixup_list = fe; + fe->fixup = 0; + fe->name = _wcsdup(pathname); + return (fe); +} + +/* + * Returns a fixup structure for the current entry. + */ +static struct fixup_entry * +current_fixup(struct archive_write_disk *a, const wchar_t *pathname) +{ + if (a->current_fixup == NULL) + a->current_fixup = new_fixup(a, pathname); + return (a->current_fixup); +} + +/* TODO: Make this work. */ +/* + * TODO: The deep-directory support bypasses this; disable deep directory + * support if we're doing symlink checks. + */ +/* + * TODO: Someday, integrate this with the deep dir support; they both + * scan the path and both can be optimized by comparing against other + * recent paths. + */ +/* TODO: Extend this to support symlinks on Windows Vista and later. */ +static int +check_symlinks(struct archive_write_disk *a) +{ + wchar_t *pn, *p; + wchar_t c; + int r; + BY_HANDLE_FILE_INFORMATION st; + mode_t st_mode; + + /* + * Guard against symlink tricks. Reject any archive entry whose + * destination would be altered by a symlink. + */ + /* Whatever we checked last time doesn't need to be re-checked. */ + pn = a->name; + p = a->path_safe.s; + while ((*pn != '\0') && (*p == *pn)) + ++p, ++pn; + c = pn[0]; + /* Keep going until we've checked the entire name. */ + while (pn[0] != '\0' && (pn[0] != '\\' || pn[1] != '\0')) { + /* Skip the next path element. */ + while (*pn != '\0' && *pn != '\\') + ++pn; + c = pn[0]; + pn[0] = '\0'; + /* Check that we haven't hit a symlink. */ + r = file_information(a, a->name, &st, &st_mode, 1); + if (r != 0) { + /* We've hit a dir that doesn't exist; stop now. */ + if (errno == ENOENT) + break; + } else if (S_ISLNK(st_mode)) { + if (c == '\0') { + /* + * Last element is symlink; remove it + * so we can overwrite it with the + * item being extracted. + */ + if (disk_unlink(a->name)) { + archive_set_error(&a->archive, errno, + "Could not remove symlink %ls", + a->name); + pn[0] = c; + return (ARCHIVE_FAILED); + } + a->pst = NULL; + /* + * Even if we did remove it, a warning + * is in order. The warning is silly, + * though, if we're just replacing one + * symlink with another symlink. + */ + if (!S_ISLNK(a->mode)) { + archive_set_error(&a->archive, 0, + "Removing symlink %ls", + a->name); + } + /* Symlink gone. No more problem! */ + pn[0] = c; + return (0); + } else if (a->flags & ARCHIVE_EXTRACT_UNLINK) { + /* User asked us to remove problems. */ + if (disk_unlink(a->name) != 0) { + archive_set_error(&a->archive, 0, + "Cannot remove intervening " + "symlink %ls", a->name); + pn[0] = c; + return (ARCHIVE_FAILED); + } + a->pst = NULL; + } else { + archive_set_error(&a->archive, 0, + "Cannot extract through symlink %ls", + a->name); + pn[0] = c; + return (ARCHIVE_FAILED); + } + } + } + pn[0] = c; + /* We've checked and/or cleaned the whole path, so remember it. */ + archive_wstrcpy(&a->path_safe, a->name); + return (ARCHIVE_OK); +} + +static int +guidword(wchar_t *p, int n) +{ + int i; + + for (i = 0; i < n; i++) { + if ((*p >= L'0' && *p <= L'9') || + (*p >= L'a' && *p <= L'f') || + (*p >= L'A' && *p <= L'F')) + p++; + else + return (-1); + } + return (0); +} + +/* + * Canonicalize the pathname. In particular, this strips duplicate + * '\' characters, '.' elements, and trailing '\'. It also raises an + * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is + * set) any '..' in the path. + */ +static int +cleanup_pathname(struct archive_write_disk *a) +{ + wchar_t *dest, *src, *p, *top; + wchar_t separator = L'\0'; + + p = a->name; + if (*p == L'\0') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Invalid empty pathname"); + return (ARCHIVE_FAILED); + } + + /* Replace '/' by '\' */ + for (; *p != L'\0'; p++) { + if (*p == L'/') + *p = L'\\'; + } + p = a->name; + + /* Skip leading "\\.\" or "\\?\" or "\\?\UNC\" or + * "\\?\Volume{GUID}\" + * (absolute path prefixes used by Windows API) */ + if (p[0] == L'\\' && p[1] == L'\\' && + (p[2] == L'.' || p[2] == L'?') && p[3] == L'\\') + { + /* A path begin with "\\?\UNC\" */ + if (p[2] == L'?' && + (p[4] == L'U' || p[4] == L'u') && + (p[5] == L'N' || p[5] == L'n') && + (p[6] == L'C' || p[6] == L'c') && + p[7] == L'\\') + p += 8; + /* A path begin with "\\?\Volume{GUID}\" */ + else if (p[2] == L'?' && + (p[4] == L'V' || p[4] == L'v') && + (p[5] == L'O' || p[5] == L'o') && + (p[6] == L'L' || p[6] == L'l') && + (p[7] == L'U' || p[7] == L'u') && + (p[8] == L'M' || p[8] == L'm') && + (p[9] == L'E' || p[9] == L'e') && + p[10] == L'{') { + if (guidword(p+11, 8) == 0 && p[19] == L'-' && + guidword(p+20, 4) == 0 && p[24] == L'-' && + guidword(p+25, 4) == 0 && p[29] == L'-' && + guidword(p+30, 4) == 0 && p[34] == L'-' && + guidword(p+35, 12) == 0 && p[47] == L'}' && + p[48] == L'\\') + p += 49; + else + p += 4; + /* A path begin with "\\.\PhysicalDriveX" */ + } else if (p[2] == L'.' && + (p[4] == L'P' || p[4] == L'p') && + (p[5] == L'H' || p[5] == L'h') && + (p[6] == L'Y' || p[6] == L'y') && + (p[7] == L'S' || p[7] == L's') && + (p[8] == L'I' || p[8] == L'i') && + (p[9] == L'C' || p[9] == L'c') && + (p[9] == L'A' || p[9] == L'a') && + (p[9] == L'L' || p[9] == L'l') && + (p[9] == L'D' || p[9] == L'd') && + (p[9] == L'R' || p[9] == L'r') && + (p[9] == L'I' || p[9] == L'i') && + (p[9] == L'V' || p[9] == L'v') && + (p[9] == L'E' || p[9] == L'e') && + (p[10] >= L'0' && p[10] <= L'9') && + p[11] == L'\0') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Path is a physical drive name"); + return (ARCHIVE_FAILED); + } else + p += 4; + } + + /* Skip leading drive letter from archives created + * on Windows. */ + if (((p[0] >= L'a' && p[0] <= L'z') || + (p[0] >= L'A' && p[0] <= L'Z')) && + p[1] == L':') { + if (p[2] == L'\0') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Path is a drive name"); + return (ARCHIVE_FAILED); + } + if (p[2] == L'\\') + p += 2; + } + + top = dest = src = p; + /* Rewrite the path name if its character is a unusable. */ + for (; *p != L'\0'; p++) { + if (*p == L':' || *p == L'*' || *p == L'?' || *p == L'"' || + *p == L'<' || *p == L'>' || *p == L'|') + *p = L'_'; + } + /* Skip leading '\'. */ + if (*src == L'\\') + separator = *src++; + + /* Scan the pathname one element at a time. */ + for (;;) { + /* src points to first char after '\' */ + if (src[0] == L'\0') { + break; + } else if (src[0] == L'\\') { + /* Found '\\'('//'), ignore second one. */ + src++; + continue; + } else if (src[0] == L'.') { + if (src[1] == L'\0') { + /* Ignore trailing '.' */ + break; + } else if (src[1] == L'\\') { + /* Skip '.\'. */ + src += 2; + continue; + } else if (src[1] == L'.') { + if (src[2] == L'\\' || src[2] == L'\0') { + /* Conditionally warn about '..' */ + if (a->flags & + ARCHIVE_EXTRACT_SECURE_NODOTDOT) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Path contains '..'"); + return (ARCHIVE_FAILED); + } + } + /* + * Note: Under no circumstances do we + * remove '..' elements. In + * particular, restoring + * '\foo\..\bar\' should create the + * 'foo' dir as a side-effect. + */ + } + } + + /* Copy current element, including leading '\'. */ + if (separator) + *dest++ = L'\\'; + while (*src != L'\0' && *src != L'\\') { + *dest++ = *src++; + } + + if (*src == L'\0') + break; + + /* Skip '\' separator. */ + separator = *src++; + } + /* + * We've just copied zero or more path elements, not including the + * final '\'. + */ + if (dest == top) { + /* + * Nothing got copied. The path must have been something + * like '.' or '\' or './' or '/././././/./'. + */ + if (separator) + *dest++ = L'\\'; + else + *dest++ = L'.'; + } + /* Terminate the result. */ + *dest = L'\0'; + return (ARCHIVE_OK); +} + +/* + * Create the parent directory of the specified path, assuming path + * is already in mutable storage. + */ +static int +create_parent_dir(struct archive_write_disk *a, wchar_t *path) +{ + wchar_t *slash; + int r; + + /* Remove tail element to obtain parent name. */ + slash = wcsrchr(path, L'\\'); + if (slash == NULL) + return (ARCHIVE_OK); + *slash = L'\0'; + r = create_dir(a, path); + *slash = L'\\'; + return (r); +} + +/* + * Create the specified dir, recursing to create parents as necessary. + * + * Returns ARCHIVE_OK if the path exists when we're done here. + * Otherwise, returns ARCHIVE_FAILED. + * Assumes path is in mutable storage; path is unchanged on exit. + */ +static int +create_dir(struct archive_write_disk *a, wchar_t *path) +{ + BY_HANDLE_FILE_INFORMATION st; + struct fixup_entry *le; + wchar_t *slash, *base, *full; + mode_t mode_final, mode, st_mode; + int r; + + /* Check for special names and just skip them. */ + slash = wcsrchr(path, L'\\'); + if (slash == NULL) + base = path; + else + base = slash + 1; + + if (base[0] == L'\0' || + (base[0] == L'.' && base[1] == L'\0') || + (base[0] == L'.' && base[1] == L'.' && base[2] == L'\0')) { + /* Don't bother trying to create null path, '.', or '..'. */ + if (slash != NULL) { + *slash = L'\0'; + r = create_dir(a, path); + *slash = L'\\'; + return (r); + } + return (ARCHIVE_OK); + } + + /* + * Yes, this should be stat() and not lstat(). Using lstat() + * here loses the ability to extract through symlinks. Also note + * that this should not use the a->st cache. + */ + if (file_information(a, path, &st, &st_mode, 0) == 0) { + if (S_ISDIR(st_mode)) + return (ARCHIVE_OK); + if ((a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) { + archive_set_error(&a->archive, EEXIST, + "Can't create directory '%ls'", path); + return (ARCHIVE_FAILED); + } + if (disk_unlink(path) != 0) { + archive_set_error(&a->archive, errno, + "Can't create directory '%ls': " + "Conflicting file cannot be removed", + path); + return (ARCHIVE_FAILED); + } + } else if (errno != ENOENT && errno != ENOTDIR) { + /* Stat failed? */ + archive_set_error(&a->archive, errno, + "Can't test directory '%ls'", path); + return (ARCHIVE_FAILED); + } else if (slash != NULL) { + *slash = '\0'; + r = create_dir(a, path); + *slash = '\\'; + if (r != ARCHIVE_OK) + return (r); + } + + /* + * Mode we want for the final restored directory. Per POSIX, + * implicitly-created dirs must be created obeying the umask. + * There's no mention whether this is different for privileged + * restores (which the rest of this code handles by pretending + * umask=0). I've chosen here to always obey the user's umask for + * implicit dirs, even if _EXTRACT_PERM was specified. + */ + mode_final = DEFAULT_DIR_MODE & ~a->user_umask; + /* Mode we want on disk during the restore process. */ + mode = mode_final; + mode |= MINIMUM_DIR_MODE; + mode &= MAXIMUM_DIR_MODE; + /* + * Apply __la_win_permissive_name_w to path in order to + * remove '../' path string. + */ + full = __la_win_permissive_name_w(path); + if (full == NULL) + errno = EINVAL; + else if (CreateDirectoryW(full, NULL) != 0) { + if (mode != mode_final) { + le = new_fixup(a, path); + le->fixup |=TODO_MODE_BASE; + le->mode = mode_final; + } + free(full); + return (ARCHIVE_OK); + } else { + la_dosmaperr(GetLastError()); + } + free(full); + + /* + * Without the following check, a/b/../b/c/d fails at the + * second visit to 'b', so 'd' can't be created. Note that we + * don't add it to the fixup list here, as it's already been + * added. + */ + if (file_information(a, path, &st, &st_mode, 0) == 0 && + S_ISDIR(st_mode)) + return (ARCHIVE_OK); + + archive_set_error(&a->archive, errno, "Failed to create dir '%ls'", + path); + return (ARCHIVE_FAILED); +} + +/* + * Note: Although we can skip setting the user id if the desired user + * id matches the current user, we cannot skip setting the group, as + * many systems set the gid based on the containing directory. So + * we have to perform a chown syscall if we want to set the SGID + * bit. (The alternative is to stat() and then possibly chown(); it's + * more efficient to skip the stat() and just always chown().) Note + * that a successful chown() here clears the TODO_SGID_CHECK bit, which + * allows set_mode to skip the stat() check for the GID. + */ +static int +set_ownership(struct archive_write_disk *a) +{ +/* unfortunately, on win32 there is no 'root' user with uid 0, + so we just have to try the chown and see if it works */ + + /* If we know we can't change it, don't bother trying. */ + if (a->user_uid != 0 && a->user_uid != a->uid) { + archive_set_error(&a->archive, errno, + "Can't set UID=%jd", (intmax_t)a->uid); + return (ARCHIVE_WARN); + } + + archive_set_error(&a->archive, errno, + "Can't set user=%jd/group=%jd for %ls", + (intmax_t)a->uid, (intmax_t)a->gid, a->name); + return (ARCHIVE_WARN); +} + +static int +set_times(struct archive_write_disk *a, + HANDLE h, int mode, const wchar_t *name, + time_t atime, long atime_nanos, + time_t birthtime, long birthtime_nanos, + time_t mtime, long mtime_nanos, + time_t ctime_sec, long ctime_nanos) +{ +#define EPOC_TIME ARCHIVE_LITERAL_ULL(116444736000000000) +#define WINTIME(sec, nsec) ((Int32x32To64(sec, 10000000) + EPOC_TIME)\ + + (((nsec)/1000)*10)) + + HANDLE hw = 0; + ULARGE_INTEGER wintm; + FILETIME *pfbtime; + FILETIME fatime, fbtime, fmtime; + + (void)ctime_sec; /* UNUSED */ + (void)ctime_nanos; /* UNUSED */ + + if (h != INVALID_HANDLE_VALUE) { + hw = NULL; + } else { + wchar_t *ws; + + if (S_ISLNK(mode)) + return (ARCHIVE_OK); + ws = __la_win_permissive_name_w(name); + if (ws == NULL) + goto settimes_failed; + hw = CreateFileW(ws, FILE_WRITE_ATTRIBUTES, + 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + free(ws); + if (hw == INVALID_HANDLE_VALUE) + goto settimes_failed; + h = hw; + } + + wintm.QuadPart = WINTIME(atime, atime_nanos); + fatime.dwLowDateTime = wintm.LowPart; + fatime.dwHighDateTime = wintm.HighPart; + wintm.QuadPart = WINTIME(mtime, mtime_nanos); + fmtime.dwLowDateTime = wintm.LowPart; + fmtime.dwHighDateTime = wintm.HighPart; + /* + * SetFileTime() supports birthtime. + */ + if (birthtime > 0 || birthtime_nanos > 0) { + wintm.QuadPart = WINTIME(birthtime, birthtime_nanos); + fbtime.dwLowDateTime = wintm.LowPart; + fbtime.dwHighDateTime = wintm.HighPart; + pfbtime = &fbtime; + } else + pfbtime = NULL; + if (SetFileTime(h, pfbtime, &fatime, &fmtime) == 0) + goto settimes_failed; + CloseHandle(hw); + return (ARCHIVE_OK); + +settimes_failed: + CloseHandle(hw); + archive_set_error(&a->archive, EINVAL, "Can't restore time"); + return (ARCHIVE_WARN); +} + +static int +set_times_from_entry(struct archive_write_disk *a) +{ + time_t atime, birthtime, mtime, ctime_sec; + long atime_nsec, birthtime_nsec, mtime_nsec, ctime_nsec; + + /* Suitable defaults. */ + atime = birthtime = mtime = ctime_sec = a->start_time; + atime_nsec = birthtime_nsec = mtime_nsec = ctime_nsec = 0; + + /* If no time was provided, we're done. */ + if (!archive_entry_atime_is_set(a->entry) + && !archive_entry_birthtime_is_set(a->entry) + && !archive_entry_mtime_is_set(a->entry)) + return (ARCHIVE_OK); + + if (archive_entry_atime_is_set(a->entry)) { + atime = archive_entry_atime(a->entry); + atime_nsec = archive_entry_atime_nsec(a->entry); + } + if (archive_entry_birthtime_is_set(a->entry)) { + birthtime = archive_entry_birthtime(a->entry); + birthtime_nsec = archive_entry_birthtime_nsec(a->entry); + } + if (archive_entry_mtime_is_set(a->entry)) { + mtime = archive_entry_mtime(a->entry); + mtime_nsec = archive_entry_mtime_nsec(a->entry); + } + if (archive_entry_ctime_is_set(a->entry)) { + ctime_sec = archive_entry_ctime(a->entry); + ctime_nsec = archive_entry_ctime_nsec(a->entry); + } + + return set_times(a, a->fh, a->mode, a->name, + atime, atime_nsec, + birthtime, birthtime_nsec, + mtime, mtime_nsec, + ctime_sec, ctime_nsec); +} + +static int +set_mode(struct archive_write_disk *a, int mode) +{ + int r = ARCHIVE_OK; + mode &= 07777; /* Strip off file type bits. */ + + if (a->todo & TODO_SGID_CHECK) { + /* + * If we don't know the GID is right, we must stat() + * to verify it. We can't just check the GID of this + * process, since systems sometimes set GID from + * the enclosing dir or based on ACLs. + */ + if ((r = lazy_stat(a)) != ARCHIVE_OK) + return (r); + if (0 != a->gid) { + mode &= ~ S_ISGID; + } + /* While we're here, double-check the UID. */ + if (0 != a->uid + && (a->todo & TODO_SUID)) { + mode &= ~ S_ISUID; + } + a->todo &= ~TODO_SGID_CHECK; + a->todo &= ~TODO_SUID_CHECK; + } else if (a->todo & TODO_SUID_CHECK) { + /* + * If we don't know the UID is right, we can just check + * the user, since all systems set the file UID from + * the process UID. + */ + if (a->user_uid != a->uid) { + mode &= ~ S_ISUID; + } + a->todo &= ~TODO_SUID_CHECK; + } + + if (S_ISLNK(a->mode)) { +#ifdef HAVE_LCHMOD + /* + * If this is a symlink, use lchmod(). If the + * platform doesn't support lchmod(), just skip it. A + * platform that doesn't provide a way to set + * permissions on symlinks probably ignores + * permissions on symlinks, so a failure here has no + * impact. + */ + if (lchmod(a->name, mode) != 0) { + archive_set_error(&a->archive, errno, + "Can't set permissions to 0%o", (int)mode); + r = ARCHIVE_WARN; + } +#endif + } else if (!S_ISDIR(a->mode)) { + /* + * If it's not a symlink and not a dir, then use + * fchmod() or chmod(), depending on whether we have + * an fd. Dirs get their perms set during the + * post-extract fixup, which is handled elsewhere. + */ +#ifdef HAVE_FCHMOD + if (a->fd >= 0) { + if (fchmod(a->fd, mode) != 0) { + archive_set_error(&a->archive, errno, + "Can't set permissions to 0%o", (int)mode); + r = ARCHIVE_WARN; + } + } else +#endif + /* If this platform lacks fchmod(), then + * we'll just use chmod(). */ + if (la_chmod(a->name, mode) != 0) { + archive_set_error(&a->archive, errno, + "Can't set permissions to 0%o", (int)mode); + r = ARCHIVE_WARN; + } + } + return (r); +} + +static int +set_fflags(struct archive_write_disk *a) +{ + (void)a; /* UNUSED */ + return (ARCHIVE_OK); +} + +/* Default empty function body to satisfy mainline code. */ +static int +set_acls(struct archive_write_disk *a, HANDLE h, const wchar_t *name, + struct archive_acl *acl) +{ + (void)a; /* UNUSED */ + (void)h; /* UNUSED */ + (void)name; /* UNUSED */ + (void)acl; /* UNUSED */ + return (ARCHIVE_OK); +} + +/* + * Restore extended attributes - stub implementation for unsupported systems + */ +static int +set_xattrs(struct archive_write_disk *a) +{ + static int warning_done = 0; + + /* If there aren't any extended attributes, then it's okay not + * to extract them, otherwise, issue a single warning. */ + if (archive_entry_xattr_count(a->entry) != 0 && !warning_done) { + warning_done = 1; + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Cannot restore extended attributes on this system"); + return (ARCHIVE_WARN); + } + /* Warning was already emitted; suppress further warnings. */ + return (ARCHIVE_OK); +} + +static void +fileTimeToUtc(const FILETIME *filetime, time_t *t, long *ns) +{ + ULARGE_INTEGER utc; + + utc.HighPart = filetime->dwHighDateTime; + utc.LowPart = filetime->dwLowDateTime; + if (utc.QuadPart >= EPOC_TIME) { + utc.QuadPart -= EPOC_TIME; + /* milli seconds base */ + *t = (time_t)(utc.QuadPart / 10000000); + /* nano seconds base */ + *ns = (long)(utc.QuadPart % 10000000) * 100; + } else { + *t = 0; + *ns = 0; + } +} +/* + * Test if file on disk is older than entry. + */ +static int +older(BY_HANDLE_FILE_INFORMATION *st, struct archive_entry *entry) +{ + time_t sec; + long nsec; + + fileTimeToUtc(&st->ftLastWriteTime, &sec, &nsec); + /* First, test the seconds and return if we have a definite answer. */ + /* Definitely older. */ + if (sec < archive_entry_mtime(entry)) + return (1); + /* Definitely younger. */ + if (sec > archive_entry_mtime(entry)) + return (0); + if (nsec < archive_entry_mtime_nsec(entry)) + return (1); + /* Same age or newer, so not older. */ + return (0); +} + +#endif /* _WIN32 && !__CYGWIN__ */ + diff --git a/libarchive/config_freebsd.h b/libarchive/config_freebsd.h new file mode 100644 index 000000000000..d61c4167b3b9 --- /dev/null +++ b/libarchive/config_freebsd.h @@ -0,0 +1,160 @@ +/*- + * 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$ + */ + +/* FreeBSD 5.0 and later have ACL and extattr support. */ +#if __FreeBSD__ > 4 +#define HAVE_ACL_CREATE_ENTRY 1 +#define HAVE_ACL_GET_LINK_NP 1 +#define HAVE_ACL_GET_PERM_NP 1 +#define HAVE_ACL_INIT 1 +#define HAVE_ACL_SET_FD 1 +#define HAVE_ACL_SET_FD_NP 1 +#define HAVE_ACL_SET_FILE 1 +#define HAVE_ACL_USER 1 +#define HAVE_EXTATTR_GET_FILE 1 +#define HAVE_EXTATTR_LIST_FILE 1 +#define HAVE_EXTATTR_SET_FD 1 +#define HAVE_EXTATTR_SET_FILE 1 +#define HAVE_SYS_ACL_H 1 +#define HAVE_SYS_EXTATTR_H 1 +#endif + +#ifdef WITH_OPENSSL +#define HAVE_OPENSSL_MD5_H 1 +#define HAVE_OPENSSL_RIPEMD_H 1 +#define HAVE_OPENSSL_SHA_H 1 +#define HAVE_SHA384 1 +#define HAVE_SHA512 1 +#endif + +#define HAVE_BSDXML_H 1 +#define HAVE_BZLIB_H 1 +#define HAVE_CHFLAGS 1 +#define HAVE_CHOWN 1 +#define HAVE_DECL_INT64_MAX 1 +#define HAVE_DECL_INT64_MIN 1 +#define HAVE_DECL_SIZE_MAX 1 +#define HAVE_DECL_SSIZE_MAX 1 +#define HAVE_DECL_STRERROR_R 1 +#define HAVE_DECL_UINT32_MAX 1 +#define HAVE_DECL_UINT64_MAX 1 +#define HAVE_DIRENT_H 1 +#define HAVE_EFTYPE 1 +#define HAVE_EILSEQ 1 +#define HAVE_ERRNO_H 1 +#define HAVE_FCHDIR 1 +#define HAVE_FCHFLAGS 1 +#define HAVE_FCHMOD 1 +#define HAVE_FCHOWN 1 +#define HAVE_FCNTL 1 +#define HAVE_FCNTL_H 1 +#define HAVE_FSEEKO 1 +#define HAVE_FSTAT 1 +#define HAVE_FTRUNCATE 1 +#define HAVE_FUTIMES 1 +#define HAVE_GETEUID 1 +#define HAVE_GETGRGID_R 1 +#define HAVE_GETPID 1 +#define HAVE_GETPWUID_R 1 +#define HAVE_GRP_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LCHFLAGS 1 +#define HAVE_LCHMOD 1 +#define HAVE_LCHOWN 1 +#define HAVE_LIMITS_H 1 +#define HAVE_LINK 1 +#define HAVE_LSTAT 1 +#define HAVE_LUTIMES 1 +#define HAVE_MALLOC 1 +#define HAVE_MD5 1 +#define HAVE_MD5_H 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MKDIR 1 +#define HAVE_MKFIFO 1 +#define HAVE_MKNOD 1 +#define HAVE_PIPE 1 +#define HAVE_POLL 1 +#define HAVE_POLL_H 1 +#define HAVE_PWD_H 1 +#define HAVE_READLINK 1 +#define HAVE_RMD160 1 +#define HAVE_SELECT 1 +#define HAVE_SETENV 1 +#define HAVE_SHA_H 1 +#define HAVE_SHA1 1 +#define HAVE_SHA256 1 +#define HAVE_SHA256_H 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRCHR 1 +#define HAVE_STRDUP 1 +#define HAVE_STRERROR 1 +#define HAVE_STRERROR_R 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 +#define HAVE_STRUCT_STAT_ST_BIRTHTIME 1 +#define HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC 1 +#define HAVE_STRUCT_STAT_ST_FLAGS 1 +#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 +#define HAVE_STRUCT_TM_TM_GMTOFF 1 +#define HAVE_SYMLINK 1 +#define HAVE_SYS_CDEFS_H 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_MOUNT_H 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#undef HAVE_SYS_UTIME_H +#define HAVE_SYS_UTSNAME_H 1 +#define HAVE_SYS_WAIT_H 1 +#define HAVE_TIMEGM 1 +#define HAVE_TZSET 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UNSETENV 1 +#define HAVE_UTIME 1 +#define HAVE_UTIMES 1 +#define HAVE_UTIME_H 1 +#define HAVE_VFORK 1 +#define HAVE_WCHAR_H 1 +#define HAVE_WCSCPY 1 +#define HAVE_WCSLEN 1 +#define HAVE_WCTOMB 1 +#define HAVE_WMEMCMP 1 +#define HAVE_WMEMCPY 1 +#define HAVE_ZLIB_H 1 +#define TIME_WITH_SYS_TIME 1 + +/* FreeBSD 4 and earlier lack intmax_t/uintmax_t */ +#if __FreeBSD__ < 5 +#define intmax_t int64_t +#define uintmax_t uint64_t +#endif diff --git a/libarchive/filter_fork_windows.c b/libarchive/filter_fork_windows.c new file mode 100644 index 000000000000..fa59cc9e90ce --- /dev/null +++ b/libarchive/filter_fork_windows.c @@ -0,0 +1,190 @@ +/*- + * Copyright (c) 2009-2012 Michihiro NAKAJIMA + * 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 "archive_platform.h" + +#if defined(_WIN32) && !defined(__CYGWIN__) +#include "archive_cmdline_private.h" +#include "archive_string.h" + +#include "filter_fork.h" + +pid_t +__archive_create_child(const char *cmd, int *child_stdin, int *child_stdout) +{ + HANDLE childStdout[2], childStdin[2],childStderr; + SECURITY_ATTRIBUTES secAtts; + STARTUPINFO staInfo; + PROCESS_INFORMATION childInfo; + struct archive_string cmdline; + struct archive_string fullpath; + struct archive_cmdline *acmd; + char *arg0, *ext; + int i, l; + DWORD fl, fl_old; + + childStdout[0] = childStdout[1] = INVALID_HANDLE_VALUE; + childStdin[0] = childStdin[1] = INVALID_HANDLE_VALUE; + childStderr = INVALID_HANDLE_VALUE; + archive_string_init(&cmdline); + archive_string_init(&fullpath); + + acmd = __archive_cmdline_allocate(); + if (acmd == NULL) + goto fail; + if (__archive_cmdline_parse(acmd, cmd) != ARCHIVE_OK) + goto fail; + + /* + * Search the full path of 'path'. + * NOTE: This does not need if we give CreateProcessA 'path' as + * a part of the cmdline and give CreateProcessA NULL as first + * parameter, but I do not like that way. + */ + ext = strrchr(acmd->path, '.'); + if (ext == NULL || strlen(ext) > 4) + /* 'path' does not have a proper extension, so we have to + * give SearchPath() ".exe" as the extension. */ + ext = ".exe"; + else + ext = NULL;/* 'path' has an extension. */ + + fl = MAX_PATH; + do { + if (archive_string_ensure(&fullpath, fl) == NULL) + goto fail; + fl_old = fl; + fl = SearchPathA(NULL, acmd->path, ext, fl, fullpath.s, + &arg0); + } while (fl != 0 && fl > fl_old); + if (fl == 0) + goto fail; + + /* + * Make a command line. + */ + for (l = 0, i = 0; acmd->argv[i] != NULL; i++) { + if (i == 0) + continue; + l += (int)strlen(acmd->argv[i]) + 1; + } + if (archive_string_ensure(&cmdline, l + 1) == NULL) + goto fail; + for (i = 0; acmd->argv[i] != NULL; i++) { + if (i == 0) { + const char *p, *sp; + + if ((p = strchr(acmd->argv[i], '/')) != NULL || + (p = strchr(acmd->argv[i], '\\')) != NULL) + p++; + else + p = acmd->argv[i]; + if ((sp = strchr(p, ' ')) != NULL) + archive_strappend_char(&cmdline, '"'); + archive_strcat(&cmdline, p); + if (sp != NULL) + archive_strappend_char(&cmdline, '"'); + } else { + archive_strappend_char(&cmdline, ' '); + archive_strcat(&cmdline, acmd->argv[i]); + } + } + if (i <= 1) { + const char *sp; + + if ((sp = strchr(arg0, ' ')) != NULL) + archive_strappend_char(&cmdline, '"'); + archive_strcat(&cmdline, arg0); + if (sp != NULL) + archive_strappend_char(&cmdline, '"'); + } + + secAtts.nLength = sizeof(SECURITY_ATTRIBUTES); + secAtts.bInheritHandle = TRUE; + secAtts.lpSecurityDescriptor = NULL; + if (CreatePipe(&childStdout[0], &childStdout[1], &secAtts, 0) == 0) + goto fail; + if (!SetHandleInformation(childStdout[0], HANDLE_FLAG_INHERIT, 0)) + goto fail; + if (CreatePipe(&childStdin[0], &childStdin[1], &secAtts, 0) == 0) + goto fail; + if (!SetHandleInformation(childStdin[1], HANDLE_FLAG_INHERIT, 0)) + goto fail; + if (DuplicateHandle(GetCurrentProcess(), GetStdHandle(STD_ERROR_HANDLE), + GetCurrentProcess(), &childStderr, 0, TRUE, + DUPLICATE_SAME_ACCESS) == 0) + goto fail; + + memset(&staInfo, 0, sizeof(staInfo)); + staInfo.cb = sizeof(staInfo); + staInfo.hStdError = childStderr; + staInfo.hStdOutput = childStdout[1]; + staInfo.hStdInput = childStdin[0]; + staInfo.wShowWindow = SW_HIDE; + staInfo.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW; + if (CreateProcessA(fullpath.s, cmdline.s, NULL, NULL, TRUE, 0, + NULL, NULL, &staInfo, &childInfo) == 0) + goto fail; + WaitForInputIdle(childInfo.hProcess, INFINITE); + CloseHandle(childInfo.hProcess); + CloseHandle(childInfo.hThread); + + *child_stdout = _open_osfhandle((intptr_t)childStdout[0], _O_RDONLY); + *child_stdin = _open_osfhandle((intptr_t)childStdin[1], _O_WRONLY); + + CloseHandle(childStdout[1]); + CloseHandle(childStdin[0]); + + archive_string_free(&cmdline); + archive_string_free(&fullpath); + __archive_cmdline_free(acmd); + return (childInfo.dwProcessId); + +fail: + if (childStdout[0] != INVALID_HANDLE_VALUE) + CloseHandle(childStdout[0]); + if (childStdout[1] != INVALID_HANDLE_VALUE) + CloseHandle(childStdout[1]); + if (childStdin[0] != INVALID_HANDLE_VALUE) + CloseHandle(childStdin[0]); + if (childStdin[1] != INVALID_HANDLE_VALUE) + CloseHandle(childStdin[1]); + if (childStderr != INVALID_HANDLE_VALUE) + CloseHandle(childStderr); + archive_string_free(&cmdline); + archive_string_free(&fullpath); + __archive_cmdline_free(acmd); + return (-1); +} + +void +__archive_check_child(int in, int out) +{ + (void)in; /* UNUSED */ + (void)out; /* UNUSED */ + Sleep(100); +} + +#endif /* _WIN32 && !__CYGWIN__ */ diff --git a/libarchive/mtree.5 b/libarchive/mtree.5 new file mode 100644 index 000000000000..983fff723891 --- /dev/null +++ b/libarchive/mtree.5 @@ -0,0 +1,269 @@ +.\" Copyright (c) 1989, 1990, 1993 +.\" The Regents of the University of California. 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. +.\" 4. Neither the name of the University nor the names of its contributors +.\" may be used to endorse or promote products derived from this software +.\" without specific prior written permission. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS 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. +.\" +.\" From: @(#)mtree.8 8.2 (Berkeley) 12/11/93 +.\" $FreeBSD$ +.\" +.Dd May 6, 2008 +.Dt MTREE 5 +.Os +.Sh NAME +.Nm mtree +.Nd format of mtree dir hierarchy files +.Sh DESCRIPTION +The +.Nm +format is a textual format that describes a collection of filesystem objects. +Such files are typically used to create or verify directory hierarchies. +.Ss General Format +An +.Nm +file consists of a series of lines, each providing information +about a single filesystem object. +Leading whitespace is always ignored. +.Pp +When encoding file or pathnames, any backslash character or +character outside of the 95 printable ASCII characters must be +encoded as a a backslash followed by three +octal digits. +When reading mtree files, any appearance of a backslash +followed by three octal digits should be converted into the +corresponding character. +.Pp +Each line is interpreted independently as one of the following types: +.Bl -tag -width Cm +.It Signature +The first line of any mtree file must begin with +.Dq #mtree . +If a file contains any full path entries, the first line should +begin with +.Dq #mtree v2.0 , +otherwise, the first line should begin with +.Dq #mtree v1.0 . +.It Blank +Blank lines are ignored. +.It Comment +Lines beginning with +.Cm # +are ignored. +.It Special +Lines beginning with +.Cm / +are special commands that influence +the interpretation of later lines. +.It Relative +If the first whitespace-delimited word has no +.Cm / +characters, +it is the name of a file in the current directory. +Any relative entry that describes a directory changes the +current directory. +.It dot-dot +As a special case, a relative entry with the filename +.Pa .. +changes the current directory to the parent directory. +Options on dot-dot entries are always ignored. +.It Full +If the first whitespace-delimited word has a +.Cm / +character after +the first character, it is the pathname of a file relative to the +starting directory. +There can be multiple full entries describing the same file. +.El +.Pp +Some tools that process +.Nm +files may require that multiple lines describing the same file +occur consecutively. +It is not permitted for the same file to be mentioned using +both a relative and a full file specification. +.Ss Special commands +Two special commands are currently defined: +.Bl -tag -width Cm +.It Cm /set +This command defines default values for one or more keywords. +It is followed on the same line by one or more whitespace-separated +keyword definitions. +These definitions apply to all following files that do not specify +a value for that keyword. +.It Cm /unset +This command removes any default value set by a previous +.Cm /set +command. +It is followed on the same line by one or more keywords +separated by whitespace. +.El +.Ss Keywords +After the filename, a full or relative entry consists of zero +or more whitespace-separated keyword definitions. +Each such definition consists of a key from the following +list immediately followed by an '=' sign +and a value. +Software programs reading mtree files should warn about +unrecognized keywords. +.Pp +Currently supported keywords are as follows: +.Bl -tag -width Cm +.It Cm cksum +The checksum of the file using the default algorithm specified by +the +.Xr cksum 1 +utility. +.It Cm contents +The full pathname of a file that holds the contents of this file. +.It Cm flags +The file flags as a symbolic name. +See +.Xr chflags 1 +for information on these names. +If no flags are to be set the string +.Dq none +may be used to override the current default. +.It Cm gid +The file group as a numeric value. +.It Cm gname +The file group as a symbolic name. +.It Cm ignore +Ignore any file hierarchy below this file. +.It Cm link +The target of the symbolic link when type=link. +.It Cm md5 +The MD5 message digest of the file. +.It Cm md5digest +A synonym for +.Cm md5 . +.It Cm mode +The current file's permissions as a numeric (octal) or symbolic +value. +.It Cm nlink +The number of hard links the file is expected to have. +.It Cm nochange +Make sure this file or directory exists but otherwise ignore all attributes. +.It Cm ripemd160digest +The +.Tn RIPEMD160 +message digest of the file. +.It Cm rmd160 +A synonym for +.Cm ripemd160digest . +.It Cm rmd160digest +A synonym for +.Cm ripemd160digest . +.It Cm sha1 +The +.Tn FIPS +160-1 +.Pq Dq Tn SHA-1 +message digest of the file. +.It Cm sha1digest +A synonym for +.Cm sha1 . +.It Cm sha256 +The +.Tn FIPS +180-2 +.Pq Dq Tn SHA-256 +message digest of the file. +.It Cm sha256digest +A synonym for +.Cm sha256 . +.It Cm size +The size, in bytes, of the file. +.It Cm time +The last modification time of the file. +.It Cm type +The type of the file; may be set to any one of the following: +.Pp +.Bl -tag -width Cm -compact +.It Cm block +block special device +.It Cm char +character special device +.It Cm dir +directory +.It Cm fifo +fifo +.It Cm file +regular file +.It Cm link +symbolic link +.It Cm socket +socket +.El +.It Cm uid +The file owner as a numeric value. +.It Cm uname +The file owner as a symbolic name. +.El +.Pp +.Sh SEE ALSO +.Xr cksum 1 , +.Xr find 1 , +.Xr mtree 8 +.Sh BUGS +The +.Fx +implementation of mtree does not currently support +the +.Nm +2.0 +format. +The requirement for a +.Dq #mtree +signature line is new and not yet widely implemented. +.Sh HISTORY +The +.Nm +utility appeared in +.Bx 4.3 Reno . +The +.Tn MD5 +digest capability was added in +.Fx 2.1 , +in response to the widespread use of programs which can spoof +.Xr cksum 1 . +The +.Tn SHA-1 +and +.Tn RIPEMD160 +digests were added in +.Fx 4.0 , +as new attacks have demonstrated weaknesses in +.Tn MD5 . +The +.Tn SHA-256 +digest was added in +.Fx 6.0 . +Support for file flags was added in +.Fx 4.0 , +and mostly comes from +.Nx . +The +.Dq full +entry format was added by +.Nx . diff --git a/libarchive/test/.cvsignore b/libarchive/test/.cvsignore new file mode 100644 index 000000000000..b71f5a0dbd62 --- /dev/null +++ b/libarchive/test/.cvsignore @@ -0,0 +1,10 @@ +*.tar +*.tar.gz +*.tgz +*.zip +.depend +.deps +.dirstamp +archive.h +libarchive_test +list.h diff --git a/libarchive/test/CMakeLists.txt b/libarchive/test/CMakeLists.txt new file mode 100644 index 000000000000..d2eb2c2f39ef --- /dev/null +++ b/libarchive/test/CMakeLists.txt @@ -0,0 +1,256 @@ +############################################ +# +# How to build libarchive_test +# +############################################ +IF(ENABLE_TEST) + SET(libarchive_test_SOURCES + ../../test_utils/test_utils.c + main.c + read_open_memory.c + test.h + test_acl_freebsd_posix1e.c + test_acl_freebsd_nfs4.c + test_acl_nfs4.c + test_acl_pax.c + test_acl_posix1e.c + test_archive_api_feature.c + test_archive_clear_error.c + test_archive_cmdline.c + test_archive_crypto.c + test_archive_getdate.c + test_archive_match_owner.c + test_archive_match_path.c + test_archive_match_time.c + test_archive_pathmatch.c + test_archive_read_close_twice.c + test_archive_read_close_twice_open_fd.c + test_archive_read_close_twice_open_filename.c + test_archive_read_multiple_data_objects.c + test_archive_read_next_header_empty.c + test_archive_read_next_header_raw.c + test_archive_read_open2.c + test_archive_read_set_filter_option.c + test_archive_read_set_format_option.c + test_archive_read_set_option.c + test_archive_read_set_options.c + test_archive_read_support.c + test_archive_set_error.c + test_archive_string.c + test_archive_string_conversion.c + test_archive_write_add_filter_by_name.c + test_archive_write_set_filter_option.c + test_archive_write_set_format_by_name.c + test_archive_write_set_format_option.c + test_archive_write_set_option.c + test_archive_write_set_options.c + test_bad_fd.c + test_compat_bzip2.c + test_compat_cpio.c + test_compat_gtar.c + test_compat_gzip.c + test_compat_lzip.c + test_compat_lzma.c + test_compat_lzop.c + test_compat_mac.c + test_compat_pax_libarchive_2x.c + test_compat_solaris_tar_acl.c + test_compat_solaris_pax_sparse.c + test_compat_tar_hardlink.c + test_compat_uudecode.c + test_compat_xz.c + test_compat_zip.c + test_empty_write.c + test_entry.c + test_entry_strmode.c + test_extattr_freebsd.c + test_filter_count.c + test_fuzz.c + test_gnutar_filename_encoding.c + test_link_resolver.c + test_open_failure.c + test_open_fd.c + test_open_file.c + test_open_filename.c + test_pax_filename_encoding.c + test_read_data_large.c + test_read_disk.c + test_read_disk_directory_traversals.c + test_read_disk_entry_from_file.c + test_read_extract.c + test_read_file_nonexistent.c + test_read_filter_grzip.c + test_read_filter_lrzip.c + test_read_filter_lzop.c + test_read_filter_lzop_multiple_parts.c + test_read_filter_program.c + test_read_filter_program_signature.c + test_read_filter_uudecode.c + test_read_format_7zip.c + test_read_format_ar.c + test_read_format_cab.c + test_read_format_cab_filename.c + test_read_format_cpio_afio.c + test_read_format_cpio_bin.c + test_read_format_cpio_bin_Z.c + test_read_format_cpio_bin_be.c + test_read_format_cpio_bin_bz2.c + test_read_format_cpio_bin_gz.c + test_read_format_cpio_bin_lzip.c + test_read_format_cpio_bin_lzma.c + test_read_format_cpio_bin_xz.c + test_read_format_cpio_filename.c + test_read_format_cpio_odc.c + test_read_format_cpio_svr4_bzip2_rpm.c + test_read_format_cpio_svr4_gzip.c + test_read_format_cpio_svr4_gzip_rpm.c + test_read_format_cpio_svr4c_Z.c + test_read_format_empty.c + test_read_format_gtar_filename.c + test_read_format_gtar_gz.c + test_read_format_gtar_lzma.c + test_read_format_gtar_sparse.c + test_read_format_iso_Z.c + test_read_format_iso_multi_extent.c + test_read_format_iso_xorriso.c + test_read_format_isojoliet_bz2.c + test_read_format_isojoliet_long.c + test_read_format_isojoliet_rr.c + test_read_format_isojoliet_versioned.c + test_read_format_isorr_bz2.c + test_read_format_isorr_ce.c + test_read_format_isorr_new_bz2.c + test_read_format_isorr_rr_moved.c + test_read_format_isozisofs_bz2.c + test_read_format_lha.c + test_read_format_lha_filename.c + test_read_format_mtree.c + test_read_format_pax_bz2.c + test_read_format_rar.c + test_read_format_raw.c + test_read_format_tar.c + test_read_format_tar_empty_filename.c + test_read_format_tar_filename.c + test_read_format_tbz.c + test_read_format_tgz.c + test_read_format_tlz.c + test_read_format_txz.c + test_read_format_tz.c + test_read_format_ustar_filename.c + test_read_format_xar.c + test_read_format_zip.c + test_read_format_zip_comment_stored.c + test_read_format_zip_filename.c + test_read_format_zip_mac_metadata.c + test_read_format_zip_sfx.c + test_read_large.c + test_read_pax_truncated.c + test_read_position.c + test_read_set_format.c + test_read_truncated.c + test_read_truncated_filter.c + test_sparse_basic.c + test_tar_filenames.c + test_tar_large.c + test_ustar_filenames.c + test_ustar_filename_encoding.c + test_write_disk.c + test_write_disk_appledouble.c + test_write_disk_failures.c + test_write_disk_hardlink.c + test_write_disk_hfs_compression.c + test_write_disk_lookup.c + test_write_disk_mac_metadata.c + test_write_disk_no_hfs_compression.c + test_write_disk_perms.c + test_write_disk_secure.c + test_write_disk_sparse.c + test_write_disk_symlink.c + test_write_disk_times.c + test_write_filter_b64encode.c + test_write_filter_bzip2.c + test_write_filter_compress.c + test_write_filter_gzip.c + test_write_filter_gzip_timestamp.c + test_write_filter_lrzip.c + test_write_filter_lzip.c + test_write_filter_lzma.c + test_write_filter_lzop.c + test_write_filter_program.c + test_write_filter_uuencode.c + test_write_filter_xz.c + test_write_format_7zip.c + test_write_format_7zip_empty.c + test_write_format_7zip_large.c + test_write_format_ar.c + test_write_format_cpio.c + test_write_format_cpio_empty.c + test_write_format_cpio_newc.c + test_write_format_cpio_odc.c + test_write_format_gnutar.c + test_write_format_iso9660.c + test_write_format_iso9660_boot.c + test_write_format_iso9660_empty.c + test_write_format_iso9660_filename.c + test_write_format_iso9660_zisofs.c + test_write_format_mtree.c + test_write_format_mtree_absolute_path.c + test_write_format_mtree_classic.c + test_write_format_mtree_classic_indent.c + test_write_format_mtree_fflags.c + test_write_format_mtree_no_separator.c + test_write_format_mtree_quoted_filename.c + test_write_format_pax.c + test_write_format_shar_empty.c + test_write_format_tar.c + test_write_format_tar_empty.c + test_write_format_tar_sparse.c + test_write_format_tar_ustar.c + test_write_format_tar_v7tar.c + test_write_format_xar.c + test_write_format_xar_empty.c + test_write_format_zip.c + test_write_format_zip_empty.c + test_write_format_zip_no_compression.c + test_write_zip_set_compression_store.c + test_write_open_memory.c + test_zip_filename_encoding.c + ) + + # + # Register target + # + ADD_EXECUTABLE(libarchive_test ${libarchive_test_SOURCES}) + TARGET_LINK_LIBRARIES(libarchive_test archive_static ${ADDITIONAL_LIBS}) + SET_PROPERTY(TARGET libarchive_test PROPERTY COMPILE_DEFINITIONS + LIBARCHIVE_STATIC 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} ${libarchive_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 libarchive_${_testname} + COMMAND libarchive_test -vv + -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(${CMAKE_SOURCE_DIR}/test_utils) + + # Experimental new test handling + ADD_CUSTOM_TARGET(run_libarchive_test + COMMAND libarchive_test -r ${CMAKE_CURRENT_SOURCE_DIR}) + ADD_DEPENDENCIES(run_all_tests run_libarchive_test) +ENDIF(ENABLE_TEST) + diff --git a/tar/CMakeLists.txt b/tar/CMakeLists.txt new file mode 100644 index 000000000000..46ce58b02e2e --- /dev/null +++ b/tar/CMakeLists.txt @@ -0,0 +1,49 @@ +############################################ +# +# How to build bsdtar +# +############################################ +IF(ENABLE_TAR) + + SET(bsdtar_SOURCES + bsdtar.c + bsdtar.h + bsdtar_platform.h + cmdline.c + creation_set.c + read.c + subst.c + util.c + write.c + ../libarchive_fe/err.c + ../libarchive_fe/err.h + ../libarchive_fe/lafe_platform.h + ../libarchive_fe/line_reader.c + ../libarchive_fe/line_reader.h + ) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe) + IF(WIN32 AND NOT CYGWIN) + LIST(APPEND bsdtar_SOURCES bsdtar_windows.c) + LIST(APPEND bsdtar_SOURCES bsdtar_windows.h) + ENDIF(WIN32 AND NOT CYGWIN) + + # bsdtar documentation + SET(bsdtar_MANS bsdtar.1) + + # How to build bsdtar + ADD_EXECUTABLE(bsdtar ${bsdtar_SOURCES}) + IF(ENABLE_TAR_SHARED) + TARGET_LINK_LIBRARIES(bsdtar archive ${ADDITIONAL_LIBS}) + ELSE(ENABLE_TAR_SHARED) + TARGET_LINK_LIBRARIES(bsdtar archive_static ${ADDITIONAL_LIBS}) + SET_TARGET_PROPERTIES(bsdtar PROPERTIES COMPILE_DEFINITIONS + LIBARCHIVE_STATIC) + ENDIF(ENABLE_TAR_SHARED) + GET_TARGET_PROPERTY(BSDTAR bsdtar LOCATION) + + # Installation rules + INSTALL(TARGETS bsdtar RUNTIME DESTINATION bin) + INSTALL_MAN(${bsdtar_MANS}) +ENDIF(ENABLE_TAR) + +add_subdirectory(test) diff --git a/tar/bsdtar_windows.c b/tar/bsdtar_windows.c new file mode 100644 index 000000000000..41ce6eb78c8b --- /dev/null +++ b/tar/bsdtar_windows.c @@ -0,0 +1,298 @@ +/*- + * Copyright (c) 2009 Michihiro NAKAJIMA + * 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$ + */ + +#if defined(_WIN32) && !defined(__CYGWIN__) + +#include "bsdtar_platform.h" +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_UTIME_H +#include +#endif +#include +#include +#include +#include +#include +#include + +#include "bsdtar.h" +#include "err.h" + +/* This may actually not be needed anymore. + * TODO: Review the error handling for chdir() failures and + * simply dump this if it's not really needed. */ +static void __tar_dosmaperr(unsigned long); + +/* + * Prepend "\\?\" to the path name and convert it to unicode to permit + * an extended-length path for a maximum total path length of 32767 + * characters. + * see also http://msdn.microsoft.com/en-us/library/aa365247.aspx + */ +static wchar_t * +permissive_name(const char *name) +{ + wchar_t *wn, *wnp; + wchar_t *ws, *wsp; + DWORD l, len, slen, alloclen; + int unc; + + len = (DWORD)strlen(name); + wn = malloc((len + 1) * sizeof(wchar_t)); + if (wn == NULL) + return (NULL); + l = MultiByteToWideChar(CP_ACP, 0, name, len, wn, len); + if (l == 0) { + free(wn); + return (NULL); + } + wn[l] = L'\0'; + + /* Get a full path names */ + l = GetFullPathNameW(wn, 0, NULL, NULL); + if (l == 0) { + free(wn); + return (NULL); + } + wnp = malloc(l * sizeof(wchar_t)); + if (wnp == NULL) { + free(wn); + return (NULL); + } + len = GetFullPathNameW(wn, l, wnp, NULL); + free(wn); + wn = wnp; + + if (wnp[0] == L'\\' && wnp[1] == L'\\' && + wnp[2] == L'?' && wnp[3] == L'\\') + /* We have already permissive names. */ + return (wn); + + if (wnp[0] == L'\\' && wnp[1] == L'\\' && + wnp[2] == L'.' && wnp[3] == L'\\') { + /* Device names */ + if (((wnp[4] >= L'a' && wnp[4] <= L'z') || + (wnp[4] >= L'A' && wnp[4] <= L'Z')) && + wnp[5] == L':' && wnp[6] == L'\\') + wnp[2] = L'?';/* Not device names. */ + return (wn); + } + + unc = 0; + if (wnp[0] == L'\\' && wnp[1] == L'\\' && wnp[2] != L'\\') { + wchar_t *p = &wnp[2]; + + /* Skip server-name letters. */ + while (*p != L'\\' && *p != L'\0') + ++p; + if (*p == L'\\') { + wchar_t *rp = ++p; + /* Skip share-name letters. */ + while (*p != L'\\' && *p != L'\0') + ++p; + if (*p == L'\\' && p != rp) { + /* Now, match patterns such as + * "\\server-name\share-name\" */ + wnp += 2; + len -= 2; + unc = 1; + } + } + } + + alloclen = slen = 4 + (unc * 4) + len + 1; + ws = wsp = malloc(slen * sizeof(wchar_t)); + if (ws == NULL) { + free(wn); + return (NULL); + } + /* prepend "\\?\" */ + wcsncpy(wsp, L"\\\\?\\", 4); + wsp += 4; + slen -= 4; + if (unc) { + /* append "UNC\" ---> "\\?\UNC\" */ + wcsncpy(wsp, L"UNC\\", 4); + wsp += 4; + slen -= 4; + } + wcsncpy(wsp, wnp, slen); + free(wn); + ws[alloclen - 1] = L'\0'; + return (ws); +} + +int +__tar_chdir(const char *path) +{ + wchar_t *ws; + int r; + + r = SetCurrentDirectoryA(path); + if (r == 0) { + if (GetLastError() != ERROR_FILE_NOT_FOUND) { + __tar_dosmaperr(GetLastError()); + return (-1); + } + } else + return (0); + ws = permissive_name(path); + if (ws == NULL) { + errno = EINVAL; + return (-1); + } + r = SetCurrentDirectoryW(ws); + free(ws); + if (r == 0) { + __tar_dosmaperr(GetLastError()); + return (-1); + } + return (0); +} + +/* + * The following function was modified from PostgreSQL sources and is + * subject to the copyright below. + */ +/*------------------------------------------------------------------------- + * + * win32error.c + * Map win32 error codes to errno values + * + * Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group + * + * IDENTIFICATION + * $PostgreSQL: pgsql/src/port/win32error.c,v 1.4 2008/01/01 19:46:00 momjian Exp $ + * + *------------------------------------------------------------------------- + */ +/* +PostgreSQL Database Management System +(formerly known as Postgres, then as Postgres95) + +Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group + +Portions Copyright (c) 1994, The Regents of the University of California + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose, without fee, and without a written agreement +is hereby granted, provided that the above copyright notice and this +paragraph and the following two paragraphs appear in all copies. + +IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR +DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING +LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS +DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, +INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS +ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATIONS TO +PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. +*/ + +static const struct { + DWORD winerr; + int doserr; +} doserrors[] = +{ + { ERROR_INVALID_FUNCTION, EINVAL }, + { ERROR_FILE_NOT_FOUND, ENOENT }, + { ERROR_PATH_NOT_FOUND, ENOENT }, + { ERROR_TOO_MANY_OPEN_FILES, EMFILE }, + { ERROR_ACCESS_DENIED, EACCES }, + { ERROR_INVALID_HANDLE, EBADF }, + { ERROR_ARENA_TRASHED, ENOMEM }, + { ERROR_NOT_ENOUGH_MEMORY, ENOMEM }, + { ERROR_INVALID_BLOCK, ENOMEM }, + { ERROR_BAD_ENVIRONMENT, E2BIG }, + { ERROR_BAD_FORMAT, ENOEXEC }, + { ERROR_INVALID_ACCESS, EINVAL }, + { ERROR_INVALID_DATA, EINVAL }, + { ERROR_INVALID_DRIVE, ENOENT }, + { ERROR_CURRENT_DIRECTORY, EACCES }, + { ERROR_NOT_SAME_DEVICE, EXDEV }, + { ERROR_NO_MORE_FILES, ENOENT }, + { ERROR_LOCK_VIOLATION, EACCES }, + { ERROR_SHARING_VIOLATION, EACCES }, + { ERROR_BAD_NETPATH, ENOENT }, + { ERROR_NETWORK_ACCESS_DENIED, EACCES }, + { ERROR_BAD_NET_NAME, ENOENT }, + { ERROR_FILE_EXISTS, EEXIST }, + { ERROR_CANNOT_MAKE, EACCES }, + { ERROR_FAIL_I24, EACCES }, + { ERROR_INVALID_PARAMETER, EINVAL }, + { ERROR_NO_PROC_SLOTS, EAGAIN }, + { ERROR_DRIVE_LOCKED, EACCES }, + { ERROR_BROKEN_PIPE, EPIPE }, + { ERROR_DISK_FULL, ENOSPC }, + { ERROR_INVALID_TARGET_HANDLE, EBADF }, + { ERROR_INVALID_HANDLE, EINVAL }, + { ERROR_WAIT_NO_CHILDREN, ECHILD }, + { ERROR_CHILD_NOT_COMPLETE, ECHILD }, + { ERROR_DIRECT_ACCESS_HANDLE, EBADF }, + { ERROR_NEGATIVE_SEEK, EINVAL }, + { ERROR_SEEK_ON_DEVICE, EACCES }, + { ERROR_DIR_NOT_EMPTY, ENOTEMPTY }, + { ERROR_NOT_LOCKED, EACCES }, + { ERROR_BAD_PATHNAME, ENOENT }, + { ERROR_MAX_THRDS_REACHED, EAGAIN }, + { ERROR_LOCK_FAILED, EACCES }, + { ERROR_ALREADY_EXISTS, EEXIST }, + { ERROR_FILENAME_EXCED_RANGE, ENOENT }, + { ERROR_NESTING_NOT_ALLOWED, EAGAIN }, + { ERROR_NOT_ENOUGH_QUOTA, ENOMEM } +}; + +static void +__tar_dosmaperr(unsigned long e) +{ + int i; + + if (e == 0) { + errno = 0; + return; + } + + for (i = 0; i < (int)sizeof(doserrors); i++) { + if (doserrors[i].winerr == e) { + errno = doserrors[i].doserr; + return; + } + } + + /* fprintf(stderr, "unrecognized win32 error code: %lu", e); */ + errno = EINVAL; + return; +} + +#endif diff --git a/tar/bsdtar_windows.h b/tar/bsdtar_windows.h new file mode 100644 index 000000000000..f0611d79abdc --- /dev/null +++ b/tar/bsdtar_windows.h @@ -0,0 +1,60 @@ +/*- + * Copyright (c) 2009 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef BSDTAR_WINDOWS_H +#define BSDTAR_WINDOWS_H 1 +#include +#include + +#ifndef PRId64 +#define PRId64 "I64" +#endif +#define geteuid() 0 + +#ifndef S_IFIFO +#define S_IFIFO 0010000 /* pipe */ +#endif + +#include /* Must include before redefining 'strdup' */ +#if !defined(__BORLANDC__) +#define strdup _strdup +#endif +#if !defined(__BORLANDC__) +#define getcwd _getcwd +#endif + +#define chdir __tar_chdir +int __tar_chdir(const char *); + +#ifndef S_ISREG +#define S_ISREG(a) (a & _S_IFREG) +#endif +#ifndef S_ISBLK +#define S_ISBLK(a) (0) +#endif + +#endif /* BSDTAR_WINDOWS_H */ diff --git a/tar/config_freebsd.h b/tar/config_freebsd.h new file mode 100644 index 000000000000..e9c2b0a81bbc --- /dev/null +++ b/tar/config_freebsd.h @@ -0,0 +1,84 @@ +/*- + * 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$ + */ + +/* A default configuration for FreeBSD, used if there is no config.h. */ + +#include /* __FreeBSD_version */ + +#undef HAVE_ATTR_XATTR_H +#define HAVE_CHROOT 1 +#define HAVE_DIRENT_D_NAMLEN 1 +#define HAVE_DIRENT_H 1 +#define HAVE_D_MD_ORDER 1 +#define HAVE_ERRNO_H 1 +#undef HAVE_EXT2FS_EXT2_FS_H +#define HAVE_FCHDIR 1 +#define HAVE_FCNTL_H 1 +#define HAVE_GRP_H 1 +#define HAVE_LANGINFO_H 1 +#undef HAVE_LIBACL +#define HAVE_LIBARCHIVE 1 +#define HAVE_LIMITS_H 1 +#define HAVE_LINK 1 +#undef HAVE_LINUX_EXT2_FS_H +#undef HAVE_LINUX_FS_H +#define HAVE_LOCALE_H 1 +#define HAVE_MBTOWC 1 +#undef HAVE_NDIR_H +#if __FreeBSD_version >= 450002 /* nl_langinfo introduced */ +#define HAVE_NL_LANGINFO 1 +#endif +#define HAVE_PATHS_H 1 +#define HAVE_PWD_H 1 +#define HAVE_READLINK 1 +#define HAVE_REGEX_H 1 +#define HAVE_SETLOCALE 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRUCT_STAT_ST_FLAGS 1 +#undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC +#undef HAVE_STRUCT_STAT_ST_MTIME_N +#undef HAVE_STRUCT_STAT_ST_MTIME_USEC +#define HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC 1 +#undef HAVE_STRUCT_STAT_ST_UMTIME +#define HAVE_SYMLINK 1 +#define HAVE_SYS_CDEFS_H 1 +#undef HAVE_SYS_DIR_H +#define HAVE_SYS_IOCTL_H 1 +#undef HAVE_SYS_NDIR_H +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_UINTMAX_T 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UNSIGNED_LONG_LONG +#define HAVE_WCTYPE_H 1 +#define HAVE_ZLIB_H 1 +#undef MAJOR_IN_MKDEV diff --git a/tar/test/CMakeLists.txt b/tar/test/CMakeLists.txt new file mode 100644 index 000000000000..98f49e29298b --- /dev/null +++ b/tar/test/CMakeLists.txt @@ -0,0 +1,101 @@ +############################################ +# +# How to build bsdtar_test +# +############################################ +IF(ENABLE_TAR AND ENABLE_TEST) + SET(bsdtar_test_SOURCES + ../../test_utils/test_utils.c + main.c + test.h + test_0.c + test_basic.c + test_copy.c + test_empty_mtree.c + test_extract_tar_Z.c + test_extract_tar_bz2.c + test_extract_tar_grz.c + test_extract_tar_gz.c + test_extract_tar_lrz.c + test_extract_tar_lz.c + test_extract_tar_lzma.c + test_extract_tar_lzo.c + test_extract_tar_xz.c + test_format_newc.c + test_help.c + test_option_C_upper.c + test_option_H_upper.c + test_option_L_upper.c + test_option_O_upper.c + test_option_T_upper.c + test_option_U_upper.c + test_option_X_upper.c + test_option_a.c + test_option_b.c + test_option_b64encode.c + test_option_exclude.c + test_option_gid_gname.c + test_option_grzip.c + test_option_j.c + test_option_k.c + test_option_keep_newer_files.c + test_option_lrzip.c + test_option_lzma.c + test_option_lzop.c + test_option_n.c + test_option_newer_than.c + test_option_nodump.c + test_option_older_than.c + test_option_q.c + test_option_r.c + test_option_s.c + test_option_uid_uname.c + test_option_uuencode.c + test_option_xz.c + test_option_z.c + test_patterns.c + test_print_longpath.c + test_stdio.c + test_strip_components.c + test_symlink_dir.c + test_version.c + test_windows.c + ) + + # + # Register target + # + ADD_EXECUTABLE(bsdtar_test ${bsdtar_test_SOURCES}) + SET_PROPERTY(TARGET bsdtar_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} ${bsdtar_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 bsdtar_${_testname} + COMMAND bsdtar_test -vv + -p $ + -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(${CMAKE_SOURCE_DIR}/test_utils) + + # Experimental new test handling + ADD_CUSTOM_TARGET(run_bsdtar_test + COMMAND bsdtar_test -p ${BSDTAR} -r ${CMAKE_CURRENT_SOURCE_DIR}) + ADD_DEPENDENCIES(run_bsdtar_test bsdtar) + ADD_DEPENDENCIES(run_all_tests run_bsdtar_test) + +ENDIF(ENABLE_TAR AND ENABLE_TEST) diff --git a/tar/test/test_windows.c b/tar/test/test_windows.c new file mode 100644 index 000000000000..1977ec644e68 --- /dev/null +++ b/tar/test/test_windows.c @@ -0,0 +1,324 @@ +/*- + * Copyright (c) 2009 Michihiro NAKAJIMA + * 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" + +#if defined(_WIN32) && !defined(__CYGWIN__) +#include +#include + +static void +mkfile(const char *name) +{ + FILE *f; + + f = fopen(name, "wb"); + assert(f != NULL); + assertEqualInt(5, fwrite("01234", 1, 5, f)); + fclose(f); +} + +static void +mkfullpath(char **path1, char **path2, const char *tpath, int type) +{ + char *fp1 = NULL, *fp2 = NULL, *p1 = NULL, *p2 = NULL; + size_t l; + + /* + * Get full path name of "tpath" + */ + l = GetFullPathNameA(tpath, 0, NULL, NULL); + assert(0 != l); + fp1 = malloc(l); + assert(NULL != fp1); + fp2 = malloc(l*2); + assert(NULL != fp2); + l = GetFullPathNameA(tpath, (DWORD)l, fp1, NULL); + if ((type & 0x01) == 0) { + for (p1 = fp1; *p1 != '\0'; p1++) + if (*p1 == '\\') + *p1 = '/'; + } + + switch(type) { + case 0: /* start with "/" */ + case 1: /* start with "\" */ + /* strip "c:" */ + memmove(fp1, fp1 + 2, l - 2); + fp1[l -2] = '\0'; + p1 = fp1 + 1; + break; + case 2: /* start with "c:/" */ + case 3: /* start with "c:\" */ + p1 = fp1 + 3; + break; + case 4: /* start with "//./c:/" */ + case 5: /* start with "\\.\c:\" */ + case 6: /* start with "//?/c:/" */ + case 7: /* start with "\\?\c:\" */ + p1 = malloc(l + 4 + 1); + assert(NULL != p1); + if (type & 0x1) + memcpy(p1, "\\\\.\\", 4); + else + memcpy(p1, "//./", 4); + if (type == 6 || type == 7) + p1[2] = '?'; + memcpy(p1 + 4, fp1, l); + p1[l + 4] = '\0'; + free(fp1); + fp1 = p1; + p1 = fp1 + 7; + break; + } + + /* + * Strip leading drive names and converting "\" to "\\" + */ + p2 = fp2; + while (*p1 != '\0') { + if (*p1 == '\\') + *p2 = '/'; + else + *p2 = *p1; + ++p1; + ++p2; + } + *p2++ = '\r'; + *p2++ = '\n'; + *p2 = '\0'; + + *path1 = fp1; + *path2 = fp2; +} + +static const char *list1[] = {"aaa/", "aaa/file1", "aaa/xxa/", "aaa/xxb/", + "aaa/zzc/", "aaa/zzc/file1", "aaa/xxb/file1", "aaa/xxa/file1", + "aab/", "aac/", "abb/", "abc/", "abd/", NULL}; +static const char *list2[] = {"bbb/", "bbb/file1", "bbb/xxa/", "bbb/xxb/", + "bbb/zzc/", "bbb/zzc/file1", "bbb/xxb/file1", "bbb/xxa/file1", "bbc/", + "bbd/", "bcc/", "bcd/", "bce/", NULL}; +static const char *list3[] = {"aac/", "abc/", "bbc/", "bcc/", "ccc/", NULL}; +static const char *list4[] = {"fff/abca", "fff/acca", NULL}; +static const char *list5[] = {"aaa/file1", "aaa/xxa/", "aaa/xxa/file1", + "aaa/xxb/", "aaa/xxb/file1", "aaa/zzc/", "aaa/zzc/file1", NULL}; +static const char *list6[] = {"fff/abca", "fff/acca", "aaa/xxa/", + "aaa/xxa/file1", "aaa/xxb/", "aaa/xxb/file1", NULL}; +#endif /* _WIN32 && !__CYGWIN__ */ + +DEFINE_TEST(test_windows) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + char *fp1, *fp2; + + /* + * Preparre tests. + * Create directories and files. + */ + assertMakeDir("tmp", 0775); + assertChdir("tmp"); + + assertMakeDir("aaa", 0775); + assertMakeDir("aaa/xxa", 0775); + assertMakeDir("aaa/xxb", 0775); + assertMakeDir("aaa/zzc", 0775); + mkfile("aaa/file1"); + mkfile("aaa/xxa/file1"); + mkfile("aaa/xxb/file1"); + mkfile("aaa/zzc/file1"); + assertMakeDir("aab", 0775); + assertMakeDir("aac", 0775); + assertMakeDir("abb", 0775); + assertMakeDir("abc", 0775); + assertMakeDir("abd", 0775); + assertMakeDir("bbb", 0775); + assertMakeDir("bbb/xxa", 0775); + assertMakeDir("bbb/xxb", 0775); + assertMakeDir("bbb/zzc", 0775); + mkfile("bbb/file1"); + mkfile("bbb/xxa/file1"); + mkfile("bbb/xxb/file1"); + mkfile("bbb/zzc/file1"); + assertMakeDir("bbc", 0775); + assertMakeDir("bbd", 0775); + assertMakeDir("bcc", 0775); + assertMakeDir("bcd", 0775); + assertEqualInt(0, _mkdir("bce")); + assertEqualInt(0, _mkdir("ccc")); + assertEqualInt(0, _mkdir("fff")); + mkfile("fff/aaaa"); + mkfile("fff/abba"); + mkfile("fff/abca"); + mkfile("fff/acba"); + mkfile("fff/acca"); + + /* + * Test1: Command line pattern matching. + */ + assertEqualInt(0, + systemf("%s -cf ../archive1.tar a*", testprog)); + assertEqualInt(0, + systemf("%s -tf ../archive1.tar > ../list1", testprog)); + assertFileContainsLinesAnyOrder("../list1", list1); + + assertEqualInt(0, + systemf("%s -cf ../archive2.tar b*", testprog)); + assertEqualInt(0, + systemf("%s -tf ../archive2.tar > ../list2", testprog)); + assertFileContainsLinesAnyOrder("../list2", list2); + + assertEqualInt(0, + systemf("%s -cf ../archive3.tar ??c", testprog)); + assertEqualInt(0, + systemf("%s -tf ../archive3.tar > ../list3", testprog)); + assertFileContainsLinesAnyOrder("../list3", list3); + + assertEqualInt(0, + systemf("%s -cf ../archive3b.tar *c", testprog)); + assertEqualInt(0, + systemf("%s -tf ../archive3b.tar > ../list3b", testprog)); + assertFileContainsLinesAnyOrder("../list3b", list3); + + assertEqualInt(0, + systemf("%s -cf ../archive4.tar fff/a?ca", testprog)); + assertEqualInt(0, + systemf("%s -tf ../archive4.tar > ../list4", testprog)); + assertFileContainsLinesAnyOrder("../list4", list4); + + assertEqualInt(0, + systemf("%s -cf ../archive5.tar aaa\\*", testprog)); + assertEqualInt(0, + systemf("%s -tf ../archive5.tar > ../list5", testprog)); + assertFileContainsLinesAnyOrder("../list5", list5); + + assertEqualInt(0, + systemf("%s -cf ../archive6.tar fff\\a?ca aaa\\xx*", testprog)); + assertEqualInt(0, + systemf("%s -tf ../archive6.tar > ../list6", testprog)); + assertFileContainsLinesAnyOrder("../list6", list6); + + /* + * Test2: Archive the file start with drive letters. + */ + /* Test2a: start with "/" */ + mkfullpath(&fp1, &fp2, "aaa/file1", 0); + assertEqualInt(0, + systemf("%s -cf ../archive10.tar %s > ../out10 2> ../err10", + testprog, fp1)); + assertEqualInt(0, + systemf("%s -tf ../archive10.tar > ../list10", testprog)); + /* Check drive letters have been stripped. */ + assertFileContents(fp2, (int)strlen(fp2), "../list10"); + free(fp1); + free(fp2); + + /* Test2b: start with "\" */ + mkfullpath(&fp1, &fp2, "aaa/file1", 1); + assertEqualInt(0, + systemf("%s -cf ../archive11.tar %s > ../out11 2> ../err11", + testprog, fp1)); + assertEqualInt(0, + systemf("%s -tf ../archive11.tar > ../list11", testprog)); + /* Check drive letters have been stripped. */ + assertFileContents(fp2, (int)strlen(fp2), "../list11"); + free(fp1); + free(fp2); + + /* Test2c: start with "c:/" */ + mkfullpath(&fp1, &fp2, "aaa/file1", 2); + assertEqualInt(0, + systemf("%s -cf ../archive12.tar %s > ../out12 2> ../err12", + testprog, fp1)); + assertEqualInt(0, + systemf("%s -tf ../archive12.tar > ../list12", testprog)); + /* Check drive letters have been stripped. */ + assertFileContents(fp2, (int)strlen(fp2), "../list12"); + free(fp1); + free(fp2); + + /* Test2d: start with "c:\" */ + mkfullpath(&fp1, &fp2, "aaa/file1", 3); + assertEqualInt(0, + systemf("%s -cf ../archive13.tar %s > ../out13 2> ../err13", + testprog, fp1)); + assertEqualInt(0, + systemf("%s -tf ../archive13.tar > ../list13", testprog)); + /* Check drive letters have been stripped. */ + assertFileContents(fp2, (int)strlen(fp2), "../list13"); + free(fp1); + free(fp2); + + /* Test2e: start with "//./c:/" */ + mkfullpath(&fp1, &fp2, "aaa/file1", 4); + assertEqualInt(0, + systemf("%s -cf ../archive14.tar %s > ../out14 2> ../err14", + testprog, fp1)); + assertEqualInt(0, + systemf("%s -tf ../archive14.tar > ../list14", testprog)); + /* Check drive letters have been stripped. */ + assertFileContents(fp2, (int)strlen(fp2), "../list14"); + free(fp1); + free(fp2); + + /* Test2f: start with "\\.\c:\" */ + mkfullpath(&fp1, &fp2, "aaa/file1", 5); + assertEqualInt(0, + systemf("%s -cf ../archive15.tar %s > ../out15 2> ../err15", + testprog, fp1)); + assertEqualInt(0, + systemf("%s -tf ../archive15.tar > ../list15", testprog)); + /* Check drive letters have been stripped. */ + assertFileContents(fp2, (int)strlen(fp2), "../list15"); + free(fp1); + free(fp2); + + /* Test2g: start with "//?/c:/" */ + mkfullpath(&fp1, &fp2, "aaa/file1", 6); + failure("fp1=%s, fp2=%s", fp1, fp2); + assertEqualInt(0, + systemf("%s -cf ../archive16.tar %s > ../out16 2> ../err16", + testprog, fp1)); + assertEqualInt(0, + systemf("%s -tf ../archive16.tar > ../list16", testprog)); + /* Check drive letters have been stripped. */ + assertFileContents(fp2, (int)strlen(fp2), "../list16"); + free(fp1); + free(fp2); + + /* Test2h: start with "\\?\c:\" */ + mkfullpath(&fp1, &fp2, "aaa/file1", 7); + failure("fp1=%s, fp2=%s", fp1, fp2); + assertEqualInt(0, + systemf("%s -cf ../archive17.tar %s > ../out17 2> ../err17", + testprog, fp1)); + assertEqualInt(0, + systemf("%s -tf ../archive17.tar > ../list17", testprog)); + /* Check drive letters have been stripped. */ + assertFileContents(fp2, (int)strlen(fp2), "../list17"); + free(fp1); + free(fp2); +#else + skipping("Windows specific test"); +#endif /* _WIN32 && !__CYGWIN__ */ +} From 4e579f6c9425c995106fbf72667f4ec7e5d5db85 Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Wed, 11 May 2016 10:19:44 +0000 Subject: [PATCH 3/3] Update vendor/libarchive/dist to git commit 61c56e5 (post 3.2.0) --- .gitignore | 23 +- .travis.yml | 20 + CMakeLists.txt | 274 +- CONTRIBUTING.md | 98 + COPYING | 5 +- INSTALL | 2 +- Makefile.am | 1711 +++-- NEWS | 32 + README | 24 +- build/autoconf/ax_append_compile_flags.m4 | 67 + build/autoconf/ax_append_flag.m4 | 71 + build/autoconf/ax_check_compile_flag.m4 | 74 + build/autoconf/ax_require_defined.m4 | 37 + build/autoconf/iconv.m4 | 63 +- build/autogen.sh | 2 +- build/clean.sh | 2 + build/cmake/CreatePkgConfigFile.cmake | 33 + .../LibarchiveCheckCSourceCompiles.cmake | 106 - build/cmake/LibarchiveCheckCSourceRuns.cmake | 102 - build/cmake/LibarchiveCodeCoverage.cmake | 68 + build/cmake/config.h.in | 83 +- build/version | 2 +- cat/CMakeLists.txt | 37 + cat/bsdcat.1 | 62 + cat/bsdcat.c | 146 + cat/bsdcat.h | 56 + cat/bsdcat_platform.h | 75 + cat/cmdline.c | 283 + cat/test/CMakeLists.txt | 65 + cat/test/main.c | 2969 ++++++++ cat/test/test.h | 344 + cat/test/test_0.c | 67 + cat/test/test_empty.gz.uu | 4 + cat/test/test_empty.lz4.uu | 4 + cat/test/test_empty.xz.uu | 4 + cat/test/test_empty_gz.c | 41 + cat/test/test_empty_lz4.c | 41 + cat/test/test_empty_xz.c | 41 + cat/test/test_error.c | 36 + cat/test/test_error_mixed.c | 43 + cat/test/test_expand.Z.uu | 3 + cat/test/test_expand.bz2.uu | 5 + cat/test/test_expand.gz.uu | 4 + cat/test/test_expand.lz4.uu | 5 + cat/test/test_expand.plain.uu | 3 + cat/test/test_expand.xz.uu | 4 + cat/test/test_expand_Z.c | 36 + cat/test/test_expand_bz2.c | 42 + cat/test/test_expand_gz.c | 42 + cat/test/test_expand_lz4.c | 42 + cat/test/test_expand_mixed.c | 41 + cat/test/test_expand_plain.c | 36 + cat/test/test_expand_xz.c | 42 + cat/test/test_help.c | 75 + cat/test/test_version.c | 97 + configure.ac | 139 +- contrib/android/Android.mk | 306 + contrib/android/config/android.h | 184 + contrib/android/config/linux_host.h | 189 + contrib/android/config/windows_host.h | 1062 +++ contrib/android/include/Bcrypt.h | 1 + contrib/android/include/Windows.h | 1 + contrib/android/include/android_lf.h | 47 + contrib/libarchive.spec | 90 +- contrib/untar.c | 10 +- cpio/CMakeLists.txt | 5 +- cpio/bsdcpio.1 | 25 +- cpio/cmdline.c | 2 + cpio/cpio.c | 90 +- cpio/cpio.h | 4 + cpio/cpio_platform.h | 8 +- cpio/cpio_windows.h | 7 +- cpio/test/CMakeLists.txt | 8 +- cpio/test/main.c | 155 +- cpio/test/test.h | 31 +- cpio/test/test_basic.c | 2 +- cpio/test/test_extract.cpio.lz4.uu | 7 + cpio/test/test_extract_cpio_lz4.c | 48 + cpio/test/test_extract_cpio_lzo.c | 2 +- cpio/test/test_option_c.c | 10 +- cpio/test/test_option_lz4.c | 74 + cpio/test/test_option_passphrase.c | 43 + cpio/test/test_option_passphrase.zip.uu | 12 + cpio/test/test_option_version.c | 5 + doc/mdoc2wiki.awk | 193 +- examples/minitar/Makefile | 8 +- examples/minitar/minitar.c | 34 +- examples/untar.c | 6 +- libarchive/CMakeLists.txt | 43 +- libarchive/archive.h | 273 +- libarchive/archive_cryptor.c | 448 ++ libarchive/archive_cryptor_private.h | 163 + .../{archive_crypto.c => archive_digest.c} | 10 +- ...pto_private.h => archive_digest_private.h} | 42 +- libarchive/archive_endian.h | 44 +- libarchive/archive_entry.3 | 2 +- libarchive/archive_entry.c | 171 +- libarchive/archive_entry.h | 69 +- libarchive/archive_entry_acl.3 | 2 +- libarchive/archive_entry_copy_stat.c | 4 + libarchive/archive_entry_paths.3 | 2 +- libarchive/archive_entry_perms.3 | 2 +- libarchive/archive_entry_private.h | 5 + libarchive/archive_entry_sparse.c | 2 +- libarchive/archive_entry_stat.3 | 4 +- libarchive/archive_entry_time.3 | 2 +- libarchive/archive_entry_xattr.c | 5 +- libarchive/archive_getdate.c | 19 +- libarchive/archive_getdate.h | 39 + libarchive/archive_hmac.c | 248 + libarchive/archive_hmac_private.h | 106 + libarchive/archive_match.c | 13 +- libarchive/archive_options.c | 6 +- libarchive/archive_pack_dev.c | 329 + libarchive/archive_pack_dev.h | 49 + libarchive/archive_pathmatch.c | 8 +- libarchive/archive_platform.h | 22 +- libarchive/archive_private.h | 19 + libarchive/archive_random.c | 269 + libarchive/archive_random_private.h | 36 + libarchive/archive_read.3 | 4 +- libarchive/archive_read.c | 143 +- libarchive/archive_read_add_passphrase.3 | 74 + libarchive/archive_read_add_passphrase.c | 186 + libarchive/archive_read_append_filter.c | 6 +- libarchive/archive_read_data.3 | 2 +- .../archive_read_disk_entry_from_file.c | 60 +- libarchive/archive_read_disk_posix.c | 58 +- libarchive/archive_read_disk_private.h | 5 + .../archive_read_disk_set_standard_lookup.c | 2 +- libarchive/archive_read_disk_windows.c | 29 +- libarchive/archive_read_extract.c | 147 +- libarchive/archive_read_extract2.c | 156 + libarchive/archive_read_filter.3 | 23 +- libarchive/archive_read_open.3 | 4 +- libarchive/archive_read_open_fd.c | 29 + libarchive/archive_read_open_file.c | 10 +- libarchive/archive_read_open_filename.c | 6 +- libarchive/archive_read_open_memory.c | 12 +- libarchive/archive_read_private.h | 76 +- libarchive/archive_read_set_options.3 | 22 + libarchive/archive_read_set_options.c | 39 +- libarchive/archive_read_support_filter_all.c | 2 + .../archive_read_support_filter_compress.c | 24 +- libarchive/archive_read_support_filter_lz4.c | 737 ++ libarchive/archive_read_support_filter_lzop.c | 16 +- libarchive/archive_read_support_filter_uu.c | 3 +- libarchive/archive_read_support_filter_xz.c | 4 +- libarchive/archive_read_support_format_7zip.c | 212 +- libarchive/archive_read_support_format_all.c | 1 + libarchive/archive_read_support_format_ar.c | 25 +- libarchive/archive_read_support_format_cab.c | 4 +- libarchive/archive_read_support_format_cpio.c | 4 +- .../archive_read_support_format_empty.c | 2 + .../archive_read_support_format_iso9660.c | 76 +- libarchive/archive_read_support_format_lha.c | 479 +- .../archive_read_support_format_mtree.c | 661 +- libarchive/archive_read_support_format_rar.c | 158 +- libarchive/archive_read_support_format_raw.c | 4 +- libarchive/archive_read_support_format_tar.c | 214 +- libarchive/archive_read_support_format_warc.c | 795 ++ libarchive/archive_read_support_format_xar.c | 73 +- libarchive/archive_read_support_format_zip.c | 4205 ++++++---- libarchive/archive_string.c | 94 +- libarchive/archive_util.c | 198 +- libarchive/archive_virtual.c | 16 +- libarchive/archive_windows.c | 10 +- libarchive/archive_windows.h | 14 +- libarchive/archive_write.3 | 15 +- libarchive/archive_write.c | 29 +- libarchive/archive_write_add_filter.c | 1 + libarchive/archive_write_add_filter_by_name.c | 1 + libarchive/archive_write_add_filter_bzip2.c | 2 +- libarchive/archive_write_add_filter_grzip.c | 2 +- libarchive/archive_write_add_filter_gzip.c | 2 +- libarchive/archive_write_add_filter_lrzip.c | 9 +- libarchive/archive_write_add_filter_lz4.c | 707 ++ libarchive/archive_write_add_filter_lzop.c | 4 +- libarchive/archive_write_add_filter_program.c | 16 +- libarchive/archive_write_add_filter_xz.c | 44 +- libarchive/archive_write_data.3 | 14 +- libarchive/archive_write_disk.3 | 10 +- libarchive/archive_write_disk_acl.c | 16 +- libarchive/archive_write_disk_posix.c | 122 +- .../archive_write_disk_set_standard_lookup.c | 7 +- libarchive/archive_write_disk_windows.c | 8 +- libarchive/archive_write_filter.3 | 31 +- libarchive/archive_write_finish_entry.3 | 2 +- libarchive/archive_write_format.3 | 124 +- libarchive/archive_write_open.3 | 2 +- libarchive/archive_write_open_filename.c | 5 +- libarchive/archive_write_private.h | 17 +- libarchive/archive_write_set_format.c | 4 +- libarchive/archive_write_set_format_7zip.c | 4 + libarchive/archive_write_set_format_by_name.c | 2 + .../archive_write_set_format_filter_by_ext.c | 142 + libarchive/archive_write_set_format_gnutar.c | 12 +- libarchive/archive_write_set_format_iso9660.c | 20 +- libarchive/archive_write_set_format_mtree.c | 43 +- libarchive/archive_write_set_format_pax.c | 37 +- libarchive/archive_write_set_format_raw.c | 125 + libarchive/archive_write_set_format_shar.c | 1 + libarchive/archive_write_set_format_warc.c | 445 ++ libarchive/archive_write_set_format_xar.c | 68 +- libarchive/archive_write_set_format_zip.c | 1648 ++-- libarchive/archive_write_set_options.3 | 61 +- libarchive/archive_write_set_passphrase.3 | 74 + libarchive/archive_write_set_passphrase.c | 95 + libarchive/archive_xxhash.h | 47 + libarchive/filter_fork_windows.c | 2 +- libarchive/libarchive-formats.5 | 55 +- libarchive/libarchive.3 | 4 +- libarchive/libarchive_internals.3 | 2 +- libarchive/mtree.5 | 96 +- libarchive/tar.5 | 2 +- libarchive/test/CMakeLists.txt | 57 +- libarchive/test/README | 14 +- libarchive/test/main.c | 134 +- libarchive/test/read_open_memory.c | 18 +- libarchive/test/test.h | 27 +- ...archive_crypto.c => test_archive_digest.c} | 4 +- libarchive/test/test_archive_getdate.c | 10 +- libarchive/test/test_archive_match_time.c | 3 +- libarchive/test/test_archive_pathmatch.c | 41 + .../test/test_archive_read_add_passphrase.c | 260 + libarchive/test/test_archive_string.c | 63 + .../test_archive_write_add_filter_by_name.c | 17 +- .../test_archive_write_set_format_by_name.c | 5 + ...t_archive_write_set_format_filter_by_ext.c | 211 + .../test/test_archive_write_set_passphrase.c | 95 + libarchive/test/test_compat_lz4.c | 120 + libarchive/test/test_compat_lz4_1.tar.lz4.uu | 12 + libarchive/test/test_compat_lz4_2.tar.lz4.uu | 13 + libarchive/test/test_compat_lz4_3.tar.lz4.uu | 9 + libarchive/test/test_compat_lz4_B4.tar.lz4.uu | 6739 ++++++++++++++++ .../test/test_compat_lz4_B4BD.tar.lz4.uu | 6739 ++++++++++++++++ .../test/test_compat_lz4_B4BDBX.tar.lz4.uu | 6744 +++++++++++++++++ libarchive/test/test_compat_lz4_B5.tar.lz4.uu | 2310 ++++++ .../test/test_compat_lz4_B5BD.tar.lz4.uu | 2310 ++++++ libarchive/test/test_compat_lz4_B6.tar.lz4.uu | 1197 +++ .../test/test_compat_lz4_B6BD.tar.lz4.uu | 1197 +++ libarchive/test/test_compat_lz4_B7.tar.lz4.uu | 918 +++ .../test/test_compat_lz4_B7BD.tar.lz4.uu | 918 +++ libarchive/test/test_compat_mac.c | 2 + .../test/test_compat_pax_libarchive_2x.c | 11 +- libarchive/test/test_compat_uudecode_large.c | 54 + .../test/test_compat_uudecode_large.tar.Z.uu | 1087 +++ libarchive/test/test_compat_zip.c | 56 +- libarchive/test/test_fuzz.c | 202 +- .../test/test_gnutar_filename_encoding.c | 39 +- libarchive/test/test_pax_filename_encoding.c | 24 +- libarchive/test/test_read_data_large.c | 6 +- .../test_read_disk_directory_traversals.c | 18 +- libarchive/test/test_read_filter_compress.c | 80 + libarchive/test/test_read_format_7zip.c | 81 +- .../test_read_format_7zip_encryption.7z.uu | 7 + .../test_read_format_7zip_encryption_data.c | 70 + ...t_read_format_7zip_encryption_header.7z.uu | 8 + .../test_read_format_7zip_encryption_header.c | 73 + ...ead_format_7zip_encryption_partially.7z.uu | 8 + ...st_read_format_7zip_encryption_partially.c | 82 + .../test_read_format_7zip_malformed.7z.uu | 5 + .../test/test_read_format_7zip_malformed.c | 67 + .../test_read_format_7zip_malformed2.7z.uu | 5 + libarchive/test/test_read_format_ar.c | 6 + libarchive/test/test_read_format_cab.c | 32 +- .../test/test_read_format_cab_filename.c | 8 + libarchive/test/test_read_format_cpio_afio.c | 4 + libarchive/test/test_read_format_cpio_bin.c | 2 + libarchive/test/test_read_format_cpio_bin_Z.c | 2 + .../test/test_read_format_cpio_bin_be.c | 2 + .../test/test_read_format_cpio_bin_bz2.c | 2 + .../test/test_read_format_cpio_bin_gz.c | 2 + .../test/test_read_format_cpio_bin_le.c | 57 + .../test/test_read_format_cpio_bin_le.cpio.uu | 7 + .../test/test_read_format_cpio_bin_lzip.c | 2 + .../test/test_read_format_cpio_bin_lzma.c | 2 + .../test/test_read_format_cpio_bin_xz.c | 2 + .../test/test_read_format_cpio_filename.c | 120 +- libarchive/test/test_read_format_cpio_odc.c | 2 + .../test_read_format_cpio_svr4_bzip2_rpm.c | 6 +- .../test/test_read_format_cpio_svr4_gzip.c | 2 + .../test_read_format_cpio_svr4_gzip_rpm.c | 2 + .../test/test_read_format_cpio_svr4c_Z.c | 2 + libarchive/test/test_read_format_empty.c | 2 + .../test/test_read_format_gtar_filename.c | 69 +- libarchive/test/test_read_format_gtar_gz.c | 2 + libarchive/test/test_read_format_gtar_lzma.c | 2 + .../test/test_read_format_gtar_sparse.c | 2 + .../test_read_format_gtar_sparse_skip_entry.c | 9 +- libarchive/test/test_read_format_iso_Z.c | 4 + .../test/test_read_format_iso_multi_extent.c | 2 + .../test/test_read_format_iso_xorriso.c | 3 + .../test/test_read_format_isojoliet_bz2.c | 6 + .../test/test_read_format_isojoliet_long.c | 8 + .../test/test_read_format_isojoliet_rr.c | 10 + .../test_read_format_isojoliet_versioned.c | 4 + libarchive/test/test_read_format_isorr_bz2.c | 3 + libarchive/test/test_read_format_isorr_ce.c | 3 + .../test/test_read_format_isorr_new_bz2.c | 3 + .../test/test_read_format_isorr_rr_moved.c | 3 + .../test/test_read_format_isozisofs_bz2.c | 3 + libarchive/test/test_read_format_lha.c | 16 + .../test/test_read_format_lha_bugfix_0.c | 76 + .../test/test_read_format_lha_bugfix_0.lzh.uu | 19 + .../test/test_read_format_lha_filename.c | 5 +- libarchive/test/test_read_format_mtree.c | 122 +- .../test/test_read_format_mtree.mtree.uu | 20 +- libarchive/test/test_read_format_pax_bz2.c | 2 + libarchive/test/test_read_format_rar.c | 160 +- .../test_read_format_rar_encryption_data.c | 79 + ...est_read_format_rar_encryption_data.rar.uu | 8 + .../test_read_format_rar_encryption_header.c | 71 + ...t_read_format_rar_encryption_header.rar.uu | 8 + ...est_read_format_rar_encryption_partially.c | 79 + ...ead_format_rar_encryption_partially.rar.uu | 7 + libarchive/test/test_read_format_raw.c | 4 + libarchive/test/test_read_format_tar.c | 4 + .../test/test_read_format_tar_concatenated.c | 86 + .../test_read_format_tar_concatenated.tar.uu | 72 + .../test_read_format_tar_empty_filename.c | 2 + .../test/test_read_format_tar_empty_pax.c | 58 + .../test_read_format_tar_empty_pax.tar.Z.uu | 10 + .../test/test_read_format_tar_filename.c | 31 + libarchive/test/test_read_format_tbz.c | 2 + libarchive/test/test_read_format_tgz.c | 2 + libarchive/test/test_read_format_tlz.c | 2 + libarchive/test/test_read_format_txz.c | 2 + libarchive/test/test_read_format_tz.c | 2 + .../test/test_read_format_ustar_filename.c | 37 +- libarchive/test/test_read_format_warc.c | 82 + libarchive/test/test_read_format_warc.warc.uu | 23 + libarchive/test/test_read_format_xar.c | 2 + libarchive/test/test_read_format_zip.c | 34 +- .../test_read_format_zip_comment_stored.c | 6 + .../test_read_format_zip_encryption_data.c | 79 + ...est_read_format_zip_encryption_data.zip.uu | 25 + .../test_read_format_zip_encryption_header.c | 71 + ...t_read_format_zip_encryption_header.zip.uu | 32 + ...est_read_format_zip_encryption_partially.c | 79 + ...ead_format_zip_encryption_partially.zip.uu | 18 + .../test/test_read_format_zip_filename.c | 218 +- .../test/test_read_format_zip_mac_metadata.c | 13 +- .../test/test_read_format_zip_malformed.c | 61 + .../test_read_format_zip_malformed1.zip.uu | 5 + libarchive/test/test_read_format_zip_msdos.c | 116 + .../test/test_read_format_zip_msdos.zip.uu | 23 + libarchive/test/test_read_format_zip_nested.c | 85 + .../test/test_read_format_zip_nested.zip.uu | 16 + .../test/test_read_format_zip_nofiletype.c | 66 + .../test_read_format_zip_nofiletype.zip.uu | 8 + libarchive/test/test_read_format_zip_padded.c | 90 + .../test/test_read_format_zip_padded1.zip.uu | 12 + .../test/test_read_format_zip_padded2.zip.uu | 15 + .../test/test_read_format_zip_padded3.zip.uu | 17 + libarchive/test/test_read_format_zip_sfx.c | 4 + ...d_format_zip_traditional_encryption_data.c | 168 + ...mat_zip_traditional_encryption_data.zip.uu | 12 + .../test/test_read_format_zip_winzip_aes.c | 152 + .../test_read_format_zip_winzip_aes128.zip.uu | 66 + .../test_read_format_zip_winzip_aes256.zip.uu | 66 + ...read_format_zip_winzip_aes256_large.zip.uu | 2184 ++++++ ...ead_format_zip_winzip_aes256_stored.zip.uu | 159 + .../test_read_format_zip_winzip_aes_large.c | 217 + libarchive/test/test_read_format_zip_zip64.c | 130 + .../test/test_read_format_zip_zip64a.zip.uu | 7 + .../test/test_read_format_zip_zip64b.zip.uu | 7 + libarchive/test/test_read_too_many_filters.c | 49 + .../test/test_read_too_many_filters.gz.uu | 15 + libarchive/test/test_read_truncated.c | 4 +- libarchive/test/test_sparse_basic.c | 178 +- .../test/test_ustar_filename_encoding.c | 39 +- .../test/test_warn_missing_hardlink_target.c | 45 + libarchive/test/test_write_disk_appledouble.c | 39 +- .../test/test_write_disk_hfs_compression.c | 4 +- .../test/test_write_disk_mac_metadata.c | 39 +- .../test/test_write_disk_no_hfs_compression.c | 4 +- libarchive/test/test_write_disk_perms.c | 110 +- libarchive/test/test_write_disk_secure.c | 66 + libarchive/test/test_write_filter_lz4.c | 409 + libarchive/test/test_write_filter_lzop.c | 17 +- libarchive/test/test_write_filter_program.c | 4 +- libarchive/test/test_write_format_ar.c | 4 +- libarchive/test/test_write_format_cpio_newc.c | 2 +- libarchive/test/test_write_format_gnutar.c | 26 +- libarchive/test/test_write_format_iso9660.c | 2 +- .../test/test_write_format_iso9660_boot.c | 2 +- libarchive/test/test_write_format_mtree.c | 123 + libarchive/test/test_write_format_pax.c | 2 +- libarchive/test/test_write_format_raw.c | 123 + libarchive/test/test_write_format_raw_b64.c | 77 + libarchive/test/test_write_format_tar.c | 4 +- .../test/test_write_format_tar_sparse.c | 2 +- libarchive/test/test_write_format_warc.c | 132 + .../test/test_write_format_warc_empty.c | 117 + libarchive/test/test_write_format_zip.c | 908 ++- ...test_write_format_zip_compression_store.c} | 265 +- .../test/test_write_format_zip_empty_zip64.c | 103 + libarchive/test/test_write_format_zip_file.c | 251 + .../test/test_write_format_zip_file_zip64.c | 285 + libarchive/test/test_write_format_zip_large.c | 474 ++ libarchive/test/test_write_format_zip_zip64.c | 67 + libarchive/test/test_write_read_format_zip.c | 751 ++ .../test_write_zip_set_compression_store.c | 308 - libarchive/test/test_zip_filename_encoding.c | 28 +- libarchive/xxhash.c | 514 ++ libarchive_fe/err.c | 24 + libarchive_fe/err.h | 5 +- libarchive_fe/passphrase.c | 317 + libarchive_fe/passphrase.h | 31 + tar/CMakeLists.txt | 3 +- tar/bsdtar.1 | 70 +- tar/bsdtar.c | 42 +- tar/bsdtar.h | 12 + tar/bsdtar_platform.h | 8 +- tar/bsdtar_windows.h | 6 + tar/cmdline.c | 5 + tar/creation_set.c | 2 + tar/read.c | 153 +- tar/subst.c | 108 +- tar/test/CMakeLists.txt | 9 +- tar/test/main.c | 154 +- tar/test/test.h | 29 +- tar/test/test_extract.tar.lz4.uu | 8 + tar/test/test_extract_tar_lz4.c | 48 + tar/test/test_leading_slash.c | 49 + tar/test/test_leading_slash.tar.uu | 60 + tar/test/test_option_X_upper.c | 14 + tar/test/test_option_b.c | 19 +- tar/test/test_option_lz4.c | 74 + tar/test/test_option_passphrase.c | 43 + tar/test/test_option_passphrase.zip.uu | 12 + tar/test/test_option_s.c | 23 +- tar/test/test_version.c | 5 + tar/util.c | 312 +- tar/write.c | 40 +- 436 files changed, 65485 insertions(+), 5979 deletions(-) create mode 100644 .travis.yml create mode 100644 CONTRIBUTING.md create mode 100644 build/autoconf/ax_append_compile_flags.m4 create mode 100644 build/autoconf/ax_append_flag.m4 create mode 100644 build/autoconf/ax_check_compile_flag.m4 create mode 100644 build/autoconf/ax_require_defined.m4 create mode 100644 build/cmake/CreatePkgConfigFile.cmake delete mode 100644 build/cmake/LibarchiveCheckCSourceCompiles.cmake delete mode 100644 build/cmake/LibarchiveCheckCSourceRuns.cmake create mode 100644 build/cmake/LibarchiveCodeCoverage.cmake create mode 100644 cat/CMakeLists.txt create mode 100644 cat/bsdcat.1 create mode 100644 cat/bsdcat.c create mode 100644 cat/bsdcat.h create mode 100644 cat/bsdcat_platform.h create mode 100644 cat/cmdline.c create mode 100644 cat/test/CMakeLists.txt create mode 100644 cat/test/main.c create mode 100644 cat/test/test.h create mode 100644 cat/test/test_0.c create mode 100644 cat/test/test_empty.gz.uu create mode 100644 cat/test/test_empty.lz4.uu create mode 100644 cat/test/test_empty.xz.uu create mode 100644 cat/test/test_empty_gz.c create mode 100644 cat/test/test_empty_lz4.c create mode 100644 cat/test/test_empty_xz.c create mode 100644 cat/test/test_error.c create mode 100644 cat/test/test_error_mixed.c create mode 100644 cat/test/test_expand.Z.uu create mode 100644 cat/test/test_expand.bz2.uu create mode 100644 cat/test/test_expand.gz.uu create mode 100644 cat/test/test_expand.lz4.uu create mode 100644 cat/test/test_expand.plain.uu create mode 100644 cat/test/test_expand.xz.uu create mode 100644 cat/test/test_expand_Z.c create mode 100644 cat/test/test_expand_bz2.c create mode 100644 cat/test/test_expand_gz.c create mode 100644 cat/test/test_expand_lz4.c create mode 100644 cat/test/test_expand_mixed.c create mode 100644 cat/test/test_expand_plain.c create mode 100644 cat/test/test_expand_xz.c create mode 100644 cat/test/test_help.c create mode 100644 cat/test/test_version.c create mode 100644 contrib/android/Android.mk create mode 100644 contrib/android/config/android.h create mode 100644 contrib/android/config/linux_host.h create mode 100644 contrib/android/config/windows_host.h create mode 100644 contrib/android/include/Bcrypt.h create mode 100644 contrib/android/include/Windows.h create mode 100644 contrib/android/include/android_lf.h create mode 100644 cpio/test/test_extract.cpio.lz4.uu create mode 100644 cpio/test/test_extract_cpio_lz4.c create mode 100644 cpio/test/test_option_lz4.c create mode 100644 cpio/test/test_option_passphrase.c create mode 100644 cpio/test/test_option_passphrase.zip.uu create mode 100644 libarchive/archive_cryptor.c create mode 100644 libarchive/archive_cryptor_private.h rename libarchive/{archive_crypto.c => archive_digest.c} (99%) rename libarchive/{archive_crypto_private.h => archive_digest_private.h} (93%) create mode 100644 libarchive/archive_getdate.h create mode 100644 libarchive/archive_hmac.c create mode 100644 libarchive/archive_hmac_private.h create mode 100644 libarchive/archive_pack_dev.c create mode 100644 libarchive/archive_pack_dev.h create mode 100644 libarchive/archive_random.c create mode 100644 libarchive/archive_random_private.h create mode 100644 libarchive/archive_read_add_passphrase.3 create mode 100644 libarchive/archive_read_add_passphrase.c create mode 100644 libarchive/archive_read_extract2.c create mode 100644 libarchive/archive_read_support_filter_lz4.c create mode 100644 libarchive/archive_read_support_format_warc.c create mode 100644 libarchive/archive_write_add_filter_lz4.c create mode 100644 libarchive/archive_write_set_format_filter_by_ext.c create mode 100644 libarchive/archive_write_set_format_raw.c create mode 100644 libarchive/archive_write_set_format_warc.c create mode 100644 libarchive/archive_write_set_passphrase.3 create mode 100644 libarchive/archive_write_set_passphrase.c create mode 100644 libarchive/archive_xxhash.h rename libarchive/test/{test_archive_crypto.c => test_archive_digest.c} (98%) create mode 100644 libarchive/test/test_archive_read_add_passphrase.c create mode 100644 libarchive/test/test_archive_write_set_format_filter_by_ext.c create mode 100644 libarchive/test/test_archive_write_set_passphrase.c create mode 100644 libarchive/test/test_compat_lz4.c create mode 100644 libarchive/test/test_compat_lz4_1.tar.lz4.uu create mode 100644 libarchive/test/test_compat_lz4_2.tar.lz4.uu create mode 100644 libarchive/test/test_compat_lz4_3.tar.lz4.uu create mode 100644 libarchive/test/test_compat_lz4_B4.tar.lz4.uu create mode 100644 libarchive/test/test_compat_lz4_B4BD.tar.lz4.uu create mode 100644 libarchive/test/test_compat_lz4_B4BDBX.tar.lz4.uu create mode 100644 libarchive/test/test_compat_lz4_B5.tar.lz4.uu create mode 100644 libarchive/test/test_compat_lz4_B5BD.tar.lz4.uu create mode 100644 libarchive/test/test_compat_lz4_B6.tar.lz4.uu create mode 100644 libarchive/test/test_compat_lz4_B6BD.tar.lz4.uu create mode 100644 libarchive/test/test_compat_lz4_B7.tar.lz4.uu create mode 100644 libarchive/test/test_compat_lz4_B7BD.tar.lz4.uu create mode 100644 libarchive/test/test_compat_uudecode_large.c create mode 100644 libarchive/test/test_compat_uudecode_large.tar.Z.uu create mode 100644 libarchive/test/test_read_filter_compress.c create mode 100644 libarchive/test/test_read_format_7zip_encryption.7z.uu create mode 100644 libarchive/test/test_read_format_7zip_encryption_data.c create mode 100644 libarchive/test/test_read_format_7zip_encryption_header.7z.uu create mode 100644 libarchive/test/test_read_format_7zip_encryption_header.c create mode 100644 libarchive/test/test_read_format_7zip_encryption_partially.7z.uu create mode 100644 libarchive/test/test_read_format_7zip_encryption_partially.c create mode 100644 libarchive/test/test_read_format_7zip_malformed.7z.uu create mode 100644 libarchive/test/test_read_format_7zip_malformed.c create mode 100644 libarchive/test/test_read_format_7zip_malformed2.7z.uu create mode 100644 libarchive/test/test_read_format_cpio_bin_le.c create mode 100644 libarchive/test/test_read_format_cpio_bin_le.cpio.uu create mode 100644 libarchive/test/test_read_format_lha_bugfix_0.c create mode 100644 libarchive/test/test_read_format_lha_bugfix_0.lzh.uu create mode 100644 libarchive/test/test_read_format_rar_encryption_data.c create mode 100644 libarchive/test/test_read_format_rar_encryption_data.rar.uu create mode 100644 libarchive/test/test_read_format_rar_encryption_header.c create mode 100644 libarchive/test/test_read_format_rar_encryption_header.rar.uu create mode 100644 libarchive/test/test_read_format_rar_encryption_partially.c create mode 100644 libarchive/test/test_read_format_rar_encryption_partially.rar.uu create mode 100644 libarchive/test/test_read_format_tar_concatenated.c create mode 100644 libarchive/test/test_read_format_tar_concatenated.tar.uu create mode 100644 libarchive/test/test_read_format_tar_empty_pax.c create mode 100644 libarchive/test/test_read_format_tar_empty_pax.tar.Z.uu create mode 100644 libarchive/test/test_read_format_warc.c create mode 100644 libarchive/test/test_read_format_warc.warc.uu create mode 100644 libarchive/test/test_read_format_zip_encryption_data.c create mode 100644 libarchive/test/test_read_format_zip_encryption_data.zip.uu create mode 100644 libarchive/test/test_read_format_zip_encryption_header.c create mode 100644 libarchive/test/test_read_format_zip_encryption_header.zip.uu create mode 100644 libarchive/test/test_read_format_zip_encryption_partially.c create mode 100644 libarchive/test/test_read_format_zip_encryption_partially.zip.uu create mode 100644 libarchive/test/test_read_format_zip_malformed.c create mode 100644 libarchive/test/test_read_format_zip_malformed1.zip.uu create mode 100644 libarchive/test/test_read_format_zip_msdos.c create mode 100644 libarchive/test/test_read_format_zip_msdos.zip.uu create mode 100644 libarchive/test/test_read_format_zip_nested.c create mode 100644 libarchive/test/test_read_format_zip_nested.zip.uu create mode 100644 libarchive/test/test_read_format_zip_nofiletype.c create mode 100644 libarchive/test/test_read_format_zip_nofiletype.zip.uu create mode 100644 libarchive/test/test_read_format_zip_padded.c create mode 100644 libarchive/test/test_read_format_zip_padded1.zip.uu create mode 100644 libarchive/test/test_read_format_zip_padded2.zip.uu create mode 100644 libarchive/test/test_read_format_zip_padded3.zip.uu create mode 100644 libarchive/test/test_read_format_zip_traditional_encryption_data.c create mode 100644 libarchive/test/test_read_format_zip_traditional_encryption_data.zip.uu create mode 100644 libarchive/test/test_read_format_zip_winzip_aes.c create mode 100644 libarchive/test/test_read_format_zip_winzip_aes128.zip.uu create mode 100644 libarchive/test/test_read_format_zip_winzip_aes256.zip.uu create mode 100644 libarchive/test/test_read_format_zip_winzip_aes256_large.zip.uu create mode 100644 libarchive/test/test_read_format_zip_winzip_aes256_stored.zip.uu create mode 100644 libarchive/test/test_read_format_zip_winzip_aes_large.c create mode 100644 libarchive/test/test_read_format_zip_zip64.c create mode 100644 libarchive/test/test_read_format_zip_zip64a.zip.uu create mode 100644 libarchive/test/test_read_format_zip_zip64b.zip.uu create mode 100644 libarchive/test/test_read_too_many_filters.c create mode 100644 libarchive/test/test_read_too_many_filters.gz.uu create mode 100644 libarchive/test/test_warn_missing_hardlink_target.c create mode 100644 libarchive/test/test_write_filter_lz4.c create mode 100644 libarchive/test/test_write_format_raw.c create mode 100644 libarchive/test/test_write_format_raw_b64.c create mode 100644 libarchive/test/test_write_format_warc.c create mode 100644 libarchive/test/test_write_format_warc_empty.c rename libarchive/test/{test_write_format_zip_no_compression.c => test_write_format_zip_compression_store.c} (64%) create mode 100644 libarchive/test/test_write_format_zip_empty_zip64.c create mode 100644 libarchive/test/test_write_format_zip_file.c create mode 100644 libarchive/test/test_write_format_zip_file_zip64.c create mode 100644 libarchive/test/test_write_format_zip_large.c create mode 100644 libarchive/test/test_write_format_zip_zip64.c create mode 100644 libarchive/test/test_write_read_format_zip.c delete mode 100644 libarchive/test/test_write_zip_set_compression_store.c create mode 100644 libarchive/xxhash.c create mode 100644 libarchive_fe/passphrase.c create mode 100644 libarchive_fe/passphrase.h create mode 100644 tar/test/test_extract.tar.lz4.uu create mode 100644 tar/test/test_extract_tar_lz4.c create mode 100644 tar/test/test_leading_slash.c create mode 100644 tar/test/test_leading_slash.tar.uu create mode 100644 tar/test/test_option_lz4.c create mode 100644 tar/test/test_option_passphrase.c create mode 100644 tar/test/test_option_passphrase.zip.uu diff --git a/.gitignore b/.gitignore index 3609145920ca..a766c3cf7f77 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +*~ *.o *.exe *.lo @@ -7,6 +8,8 @@ Makefile Makefile.in aclocal.m4 autom4te.cache/ +bsdcat +bsdcat_test bsdcpio bsdcpio_test bsdtar @@ -24,9 +27,13 @@ build/autoconf/ltversion.m4 build/autoconf/lt~obsolete.m4 build/autoconf/missing build/pkgconfig/libarchive.pc +cat/.deps/ +cat/.dirstamp +cat/test/.deps/ +cat/test/.dirstamp +cat/test/list.h config.h config.h.in -config.h.in~ config.log config.status configure @@ -82,3 +89,17 @@ libarchive/libarchive.so libarchive/libarchive.so.* .DS_Store + +bsdcat_test.log +bsdcat_test.trs +bsdcpio_test.log +bsdcpio_test.trs +bsdtar_test.log +bsdtar_test.trs +build/autoconf/test-driver +libarchive_test.log +libarchive_test.trs +test-suite.log + +.sw? +.*.sw? diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000000..c9323986a92d --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +language: C +sudo: true +compiler: + - gcc + - clang +before_install: + - sudo add-apt-repository ppa:kubuntu-ppa/backports -y + - sudo apt-get update -qq +install: + - sudo apt-get install -y cmake=2.8.12.2-0ubuntu1~ubuntu12.04.1~ppa2 + - sudo apt-get install -y libbz2-dev libzip-dev liblzma-dev +before_script: + - BUILD_DIR=`pwd`/BUILD + - mkdir -p ${BUILD_DIR} + - cd ${BUILD_DIR} + - cmake .. +script: + - cd ${BUILD_DIR} + - make + - make test diff --git a/CMakeLists.txt b/CMakeLists.txt index 2cdb9fb48585..68e94a6ac0e3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6 FATAL_ERROR) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR) # PROJECT(libarchive C) # @@ -15,7 +15,7 @@ endif() # RelWithDebInfo : Release build with Debug Info # MinSizeRel : Release Min Size build IF(NOT CMAKE_BUILD_TYPE) - SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build Type" FORCE) + SET(CMAKE_BUILD_TYPE "Debug" 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". @@ -35,6 +35,9 @@ ENDIF(NOT "${CMAKE_BUILD_TYPE}" # On MacOS, prefer MacPorts libraries to system libraries. # I haven't come up with a compelling argument for this to be conditional. list(APPEND CMAKE_PREFIX_PATH /opt/local) +# Enable @rpath in the install name. +# detail in "cmake --help-policy CMP0042" +SET(CMAKE_MACOSX_RPATH ON) # # Version - read from 'version' file. @@ -55,11 +58,12 @@ STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_revision ${_revision}) SET(VERSION "${_major}.${_trimmed_minor}.${_trimmed_revision}${_quality}") SET(BSDCPIO_VERSION_STRING "${VERSION}") SET(BSDTAR_VERSION_STRING "${VERSION}") +SET(BSDCAT_VERSION_STRING "${VERSION}") SET(LIBARCHIVE_VERSION_NUMBER "${_version_number}") SET(LIBARCHIVE_VERSION_STRING "${VERSION}") # INTERFACE_VERSION increments with every release -# libarchive 2.7 == interface version 9 = 2 + 7 +# libarchive 2.7 == interface version 9 = 2 + 7 # libarchive 2.8 == interface version 10 = 2 + 8 # libarchive 2.9 == interface version 11 = 2 + 9 # libarchive 3.0 == interface version 12 @@ -84,7 +88,7 @@ SET(CMAKE_REQUIRED_FLAGS) # Especially for early development, we want to be a little # aggressive about diagnosing build problems; this can get # relaxed somewhat in final shipping versions. -IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") +IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$") SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") ################################################################# # Set compile flags for all build types. @@ -92,11 +96,43 @@ IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") ################################################################# # Set compile flags for debug build. # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror -Wextra -Wunused") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wextra") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wunused") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") -ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") +ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$") +IF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") + SET(CMAKE_REQUIRED_FLAGS "-Wall -Wformat -Wformat-security") + ################################################################# + # Set compile flags for all build types. + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wformat -Wformat-security") + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Werror") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wextra") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wunused") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wshadow") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wmissing-prototypes") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wcast-qual") +ENDIF (CMAKE_C_COMPILER_ID MATCHES "^Clang$") +IF (CMAKE_C_COMPILER_ID MATCHES "^XL$") + SET(CMAKE_C_COMPILER "xlc_r") + SET(CMAKE_REQUIRED_FLAGS "-qflag=e:e -qformat=sec") + ################################################################# + # Set compile flags for all build types. + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -qflag=e:e -qformat=sec") + ################################################################# + # Set compile flags for debug build. + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -g") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qhalt=w") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qflag=w:w") + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -qinfo=pro:use") +ENDIF(CMAKE_C_COMPILER_ID MATCHES "^XL$") IF (MSVC) ################################################################# # Set compile flags for debug build. @@ -143,17 +179,36 @@ include(CTest) OPTION(ENABLE_NETTLE "Enable use of Nettle" ON) OPTION(ENABLE_OPENSSL "Enable use of OpenSSL" ON) +OPTION(ENABLE_LZMA "Enable the use of the system found LZMA library if found" ON) +OPTION(ENABLE_ZLIB "Enable the use of the system found ZLIB library if found" ON) +OPTION(ENABLE_BZip2 "Enable the use of the system found BZip2 library if found" ON) +OPTION(ENABLE_LIBXML2 "Enable the use of the system found libxml2 library if found" ON) +OPTION(ENABLE_EXPAT "Enable the use of the system found EXPAT library if found" ON) +OPTION(ENABLE_PCREPOSIX "Enable the use of the system found PCREPOSIX library if found" ON) +OPTION(ENABLE_LibGCC "Enable the use of the system found LibGCC library if found" ON) +# CNG is used for encrypt/decrypt Zip archives on Windows. +OPTION(ENABLE_CNG "Enable the use of CNG(Crypto Next Generation)" ON) + OPTION(ENABLE_TAR "Enable tar building" ON) OPTION(ENABLE_TAR_SHARED "Enable dynamic build of tar" FALSE) 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) OPTION(ENABLE_XATTR "Enable extended attribute support" ON) OPTION(ENABLE_ACL "Enable ACL support" ON) OPTION(ENABLE_ICONV "Enable iconv support" ON) OPTION(ENABLE_TEST "Enable unit and regression tests" ON) +OPTION(ENABLE_COVERAGE "Enable code coverage (GCC only, automatically sets ENABLE_TEST to ON)" FALSE) +OPTION(ENABLE_INSTALL "Enable installing of libraries" ON) + SET(POSIX_REGEX_LIB "AUTO" CACHE STRING "Choose what library should provide POSIX regular expression support") SET(ENABLE_SAFESEH "AUTO" CACHE STRING "Enable use of /SAFESEH linker flag (MSVC only)") -SET(WINDOWS_VERSION "" CACHE STRING "Set Windows version to use (Windows only)") +SET(WINDOWS_VERSION "WIN7" CACHE STRING "Set Windows version to use (Windows only)") + +IF(ENABLE_COVERAGE) + include(LibarchiveCodeCoverage) +ENDIF(ENABLE_COVERAGE) IF(ENABLE_TEST) ENABLE_TESTING() @@ -161,22 +216,35 @@ ENDIF(ENABLE_TEST) IF(WIN32) IF(WINDOWS_VERSION STREQUAL "WIN8") + SET(NTDDI_VERSION 0x06020000) + SET(_WIN32_WINNT 0x0602) SET(WINVER 0x0602) ELSEIF(WINDOWS_VERSION STREQUAL "WIN7") + SET(NTDDI_VERSION 0x06010000) + SET(_WIN32_WINNT 0x0601) SET(WINVER 0x0601) ELSEIF(WINDOWS_VERSION STREQUAL "WS08") + SET(NTDDI_VERSION 0x06000100) + SET(_WIN32_WINNT 0x0600) SET(WINVER 0x0600) ELSEIF(WINDOWS_VERSION STREQUAL "VISTA") + SET(NTDDI_VERSION 0x06000000) + SET(_WIN32_WINNT 0x0600) SET(WINVER 0x0600) ELSEIF(WINDOWS_VERSION STREQUAL "WS03") + SET(NTDDI_VERSION 0x05020000) + SET(_WIN32_WINNT 0x0502) SET(WINVER 0x0502) ELSEIF(WINDOWS_VERSION STREQUAL "WINXP") + SET(NTDDI_VERSION 0x05010000) + SET(_WIN32_WINNT 0x0501) SET(WINVER 0x0501) ELSE(WINDOWS_VERSION STREQUAL "WIN8") - # The default is to use Windows 2000 API. - SET(WINVER 0x0500) + # Default to Windows Server 2003 API if we don't recognize the specifier + SET(NTDDI_VERSION 0x05020000) + SET(_WIN32_WINNT 0x0502) + SET(WINVER 0x0502) ENDIF(WINDOWS_VERSION STREQUAL "WIN8") - SET(_WIN32_WINNT ${WINVER}) ENDIF(WIN32) IF(MSVC) @@ -184,12 +252,12 @@ IF(MSVC) SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH") SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH") - SET(CMAKE_REQUIRED_LINKER_FLAGS "/SAFESEH") + SET(ENV{LDFLAGS} "$ENV{LDFLAGS} /SAFESEH") ELSEIF(ENABLE_SAFESEH STREQUAL "NO") SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO") SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO") SET(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} /SAFESEH:NO") - SET(CMAKE_REQUIRED_LINKER_FLAGS "/SAFESEH:NO") + SET(ENV{LDFLAGS} "$ENV{LDFLAGS} /SAFESEH:NO") ENDIF(ENABLE_SAFESEH STREQUAL "YES") ENDIF(MSVC) @@ -198,8 +266,8 @@ IF("${CMAKE_C_PLATFORM_ID}" MATCHES "^(HP-UX)$") ENDIF() # -INCLUDE(LibarchiveCheckCSourceCompiles) -INCLUDE(LibarchiveCheckCSourceRuns) +INCLUDE(CheckCSourceCompiles) +INCLUDE(CheckCSourceRuns) INCLUDE(CheckFileOffsetBits) INCLUDE(CheckFuncs) INCLUDE(CheckHeaderDirent) @@ -263,9 +331,9 @@ MACRO (TRY_MACRO_FOR_LIBRARY INCLUDES LIBRARIES ENDIF(NOT "${PREV_VAR_WITH_LIB}" STREQUAL "${LIBRARIES}") # Check if the library can be used with the macro. IF("${TRY_TYPE}" MATCHES "COMPILES") - LIBARCHIVE_CHECK_C_SOURCE_COMPILES("${SAMPLE_SOURCE}" ${VAR}) + CHECK_C_SOURCE_COMPILES("${SAMPLE_SOURCE}" ${VAR}) ELSEIF("${TRY_TYPE}" MATCHES "RUNS") - LIBARCHIVE_CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR}) + CHECK_C_SOURCE_RUNS("${SAMPLE_SOURCE}" ${VAR}) ELSE("${TRY_TYPE}" MATCHES "COMPILES") MESSAGE(FATAL_ERROR "UNKNOWN KEYWORD \"${TRY_TYPE}\" FOR TRY_TYPE") ENDIF("${TRY_TYPE}" MATCHES "COMPILES") @@ -297,11 +365,11 @@ IF(DEFINED __GNUWIN32PATH AND EXISTS "${__GNUWIN32PATH}") # e.g. # cmake -DCMAKE_PREFIX_PATH= # - # If compiling error occured in zconf.h, You may need patch to zconf.h. + # If compiling error occurred in zconf.h, You may need patch to zconf.h. #--- zconf.h.orig 2005-07-21 00:40:26.000000000 #+++ zconf.h 2009-01-19 11:39:10.093750000 #@@ -286,7 +286,7 @@ - # + # # #if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */ # # include /* for off_t */ #-# include /* for SEEK_* and off_t */ @@ -315,7 +383,11 @@ SET(ADDITIONAL_LIBS "") # # Find ZLIB # -FIND_PACKAGE(ZLIB) +IF(ENABLE_ZLIB) + FIND_PACKAGE(ZLIB) +ELSE() + SET(ZLIB_FOUND FALSE) # Override cached value +ENDIF() IF(ZLIB_FOUND) SET(HAVE_LIBZ 1) SET(HAVE_ZLIB_H 1) @@ -350,7 +422,11 @@ MARK_AS_ADVANCED(CLEAR ZLIB_LIBRARY) # # Find BZip2 # -FIND_PACKAGE(BZip2) +IF(ENABLE_BZip2) + FIND_PACKAGE(BZip2) +ELSE() + SET(BZIP2_FOUND FALSE) # Override cached value +ENDIF() IF(BZIP2_FOUND) SET(HAVE_LIBBZ2 1) SET(HAVE_BZLIB_H 1) @@ -370,10 +446,18 @@ IF(BZIP2_FOUND) ENDIF(BZIP2_FOUND) MARK_AS_ADVANCED(CLEAR BZIP2_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR BZIP2_LIBRARIES) + + # # Find LZMA # -FIND_PACKAGE(LZMA) +IF(ENABLE_LZMA) + FIND_PACKAGE(LZMA) +ELSE() + SET(LZMA_FOUND FALSE) # Override cached value + SET(LZMADEC_FOUND FALSE) # Override cached value +ENDIF() + IF(LZMA_FOUND) SET(HAVE_LIBLZMA 1) SET(HAVE_LZMA_H 1) @@ -393,6 +477,8 @@ ELSEIF(LZMADEC_FOUND) SET(HAVE_LZMADEC_H 1) INCLUDE_DIRECTORIES(${LZMADEC_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${LZMADEC_LIBRARIES}) +ELSE(LZMA_FOUND) +# LZMA not found and will not be used. ENDIF(LZMA_FOUND) # # Find LZO2 @@ -418,6 +504,33 @@ IF(LZO2_FOUND) ENDIF(LZO2_FOUND) MARK_AS_ADVANCED(CLEAR LZO2_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR LZO2_LIBRARY) +# +# Find LZ4 +# +IF (LZ4_INCLUDE_DIR) + # Already in cache, be silent + SET(LZ4_FIND_QUIETLY TRUE) +ENDIF (LZ4_INCLUDE_DIR) + +FIND_PATH(LZ4_INCLUDE_DIR lz4.h) +FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) +IF(LZ4_FOUND) + SET(HAVE_LIBLZ4 1) + SET(HAVE_LZ4_H 1) + CMAKE_PUSH_CHECK_STATE() # Save the state of the variables + SET(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR}) + CHECK_INCLUDE_FILES("lz4hc.h" HAVE_LZ4HC_H) + CMAKE_POP_CHECK_STATE() # Restore the state of the variables + INCLUDE_DIRECTORIES(${LZ4_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${LZ4_LIBRARY}) + # + # TODO: test for static library. + # +ENDIF(LZ4_FOUND) +MARK_AS_ADVANCED(CLEAR LZ4_INCLUDE_DIR) +MARK_AS_ADVANCED(CLEAR LZ4_LIBRARY) # # Check headers @@ -444,7 +557,7 @@ LA_CHECK_INCLUDE_FILE("dlfcn.h" HAVE_DLFCN_H) LA_CHECK_INCLUDE_FILE("errno.h" HAVE_ERRNO_H) LA_CHECK_INCLUDE_FILE("ext2fs/ext2_fs.h" HAVE_EXT2FS_EXT2_FS_H) -LIBARCHIVE_CHECK_C_SOURCE_COMPILES("#include +CHECK_C_SOURCE_COMPILES("#include #include int main(void) { return EXT2_IOC_GETFLAGS; }" HAVE_WORKING_EXT2_IOC_GETFLAGS) @@ -463,7 +576,9 @@ LA_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H) LA_CHECK_INCLUDE_FILE("paths.h" HAVE_PATHS_H) LA_CHECK_INCLUDE_FILE("poll.h" HAVE_POLL_H) LA_CHECK_INCLUDE_FILE("process.h" HAVE_PROCESS_H) +LA_CHECK_INCLUDE_FILE("pthread.h" HAVE_PTHREAD_H) LA_CHECK_INCLUDE_FILE("pwd.h" HAVE_PWD_H) +LA_CHECK_INCLUDE_FILE("readpassphrase.h" HAVE_READPASSPHRASE_H) LA_CHECK_INCLUDE_FILE("regex.h" HAVE_REGEX_H) LA_CHECK_INCLUDE_FILE("signal.h" HAVE_SIGNAL_H) LA_CHECK_INCLUDE_FILE("spawn.h" HAVE_SPAWN_H) @@ -494,6 +609,11 @@ LA_CHECK_INCLUDE_FILE("utime.h" HAVE_UTIME_H) 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) +ELSE(ENABLE_CNG) + UNSET(HAVE_BCRYPT_H CACHE) +ENDIF(ENABLE_CNG) # Following files need windwos.h, so we should test it after windows.h test. LA_CHECK_INCLUDE_FILE("wincrypt.h" HAVE_WINCRYPT_H) LA_CHECK_INCLUDE_FILE("winioctl.h" HAVE_WINIOCTL_H) @@ -507,7 +627,7 @@ FOREACH (it ${_HEADER}) SET(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") ENDFOREACH (it) -LIBARCHIVE_CHECK_C_SOURCE_COMPILES( +CHECK_C_SOURCE_COMPILES( "#define __EXTENSIONS__ 1 ${_INCLUDE_FILES} int main() { return 0;}" @@ -520,11 +640,17 @@ IF(ENABLE_NETTLE) FIND_PACKAGE(Nettle) IF(NETTLE_FOUND) SET(HAVE_LIBNETTLE 1) - SET(HAVE_NETTLE_MD5_H 1) - SET(HAVE_NETTLE_RIPEMD160_H 1) - SET(HAVE_NETTLE_SHA_H 1) - INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${NETTLE_LIBRARIES}) + INCLUDE_DIRECTORIES(${NETTLE_INCLUDE_DIR}) + + LIST(APPEND CMAKE_REQUIRED_INCLUDES ${NETTLE_INCLUDE_DIR}) + LA_CHECK_INCLUDE_FILE("nettle/aes.h" HAVE_NETTLE_AES_H) + LA_CHECK_INCLUDE_FILE("nettle/hmac.h" HAVE_NETTLE_HMAC_H) + LA_CHECK_INCLUDE_FILE("nettle/md5.h" HAVE_NETTLE_MD5_H) + LA_CHECK_INCLUDE_FILE("nettle/pbkdf2.h" HAVE_NETTLE_PBKDF2_H) + LA_CHECK_INCLUDE_FILE("nettle/ripemd160.h" HAVE_NETTLE_RIPEMD160_H) + LA_CHECK_INCLUDE_FILE("nettle/sha.h" HAVE_NETTLE_SHA_H) + ENDIF(NETTLE_FOUND) MARK_AS_ADVANCED(CLEAR NETTLE_INCLUDE_DIR) MARK_AS_ADVANCED(CLEAR NETTLE_LIBRARIES) @@ -536,6 +662,11 @@ ENDIF(ENABLE_NETTLE) # IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(HAVE_LIBCRYPTO 1) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${OPENSSL_CRYPTO_LIBRARY}) + ENDIF(OPENSSL_FOUND) ELSE() SET(OPENSSL_FOUND FALSE) # Override cached value ENDIF() @@ -554,7 +685,7 @@ ENDIF(NOT OPENSSL_FOUND) # # How to prove that CRYPTO functions, which have several names on various -# platforms, just see if archive_crypto.c can compile and link against +# platforms, just see if archive_digest.c can compile and link against # required libraries. # MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) @@ -593,7 +724,7 @@ MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h) FILE(READ "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/confdefs.h" CONFDEFS_H) - FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/libarchive/archive_crypto.c" + FILE(READ "${CMAKE_CURRENT_SOURCE_DIR}/libarchive/archive_digest.c" ARCHIVE_CRYPTO_C) SET(SOURCE "${CONFDEFS_H} @@ -619,16 +750,10 @@ main(int argc, char **argv) FILE(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c" "${SOURCE}") MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}") - IF(CMAKE_REQUIRED_LINKER_FLAGS) - SET(CHECK_CRYPTO_ADD_LINKER_FLAGS - "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") - ELSE(CMAKE_REQUIRED_LINKER_FLAGS) - SET(CHECK_CRYPTO_ADD_LINKER_FLAGS) - ENDIF(CMAKE_REQUIRED_LINKER_FLAGS) TRY_COMPILE(ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION} ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/check_crypto_md.c - CMAKE_FLAGS ${CHECK_CRYPTO_ADD_LINKER_FLAGS} + CMAKE_FLAGS "${TRY_CRYPTO_REQUIRED_LIBS}" "${TRY_CRYPTO_REQUIRED_INCLUDES}" OUTPUT_VARIABLE OUTPUT) @@ -713,16 +838,10 @@ main(int argc, char **argv) FILE(WRITE "${SOURCE_FILE}" "${SOURCE}") MESSAGE(STATUS "Checking support for ARCHIVE_CRYPTO_${CRYPTO}_WIN") - IF(CMAKE_REQUIRED_LINKER_FLAGS) - SET(CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS - "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") - ELSE(CMAKE_REQUIRED_LINKER_FLAGS) - SET(CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS) - ENDIF(CMAKE_REQUIRED_LINKER_FLAGS) TRY_COMPILE(ARCHIVE_CRYPTO_${CRYPTO}_WIN ${CMAKE_BINARY_DIR} ${SOURCE_FILE} - CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive" ${CHECK_CRYPTO_WIN_ADD_LINKER_FLAGS} + CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_BINARY_DIR};${CMAKE_CURRENT_SOURCE_DIR}/libarchive" OUTPUT_VARIABLE OUTPUT) IF (ARCHIVE_CRYPTO_${CRYPTO}_WIN) @@ -755,20 +874,25 @@ ENDMACRO(CHECK_CRYPTO_WIN CRYPTO_LIST) MACRO(CHECK_ICONV LIB TRY_ICONV_CONST) IF(NOT HAVE_ICONV) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables - IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") # # During checking iconv proto type, we should use -Werror to avoid the # success of iconv detection with a warnig which success is a miss # detection. So this needs for all build mode(even it's a release mode). # SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") - ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") + ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") + IF (CMAKE_C_COMPILER_ID MATCHES "^XL$") + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -qhalt=w -qflag=w:w") + ENDIF (CMAKE_C_COMPILER_ID MATCHES "^XL$") IF (MSVC) # NOTE: /WX option is the same as gcc's -Werror option. SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} /WX") ENDIF (MSVC) # - LIBARCHIVE_CHECK_C_SOURCE_COMPILES( + CHECK_C_SOURCE_COMPILES( "#include #include int main() { @@ -884,7 +1008,11 @@ ENDIF(ENABLE_ICONV) # # Find Libxml2 # -FIND_PACKAGE(LibXml2) +IF(ENABLE_LIBXML2) + FIND_PACKAGE(LibXml2) +ELSE() + SET(LIBXML2_FOUND FALSE) +ENDIF() IF(LIBXML2_FOUND) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) @@ -909,7 +1037,11 @@ ELSE(LIBXML2_FOUND) # # Find Expat # - FIND_PACKAGE(EXPAT) + IF(ENABLE_EXPAT) + FIND_PACKAGE(EXPAT) + ELSE() + SET(EXPAT_FOUND FALSE) + ENDIF() IF(EXPAT_FOUND) CMAKE_PUSH_CHECK_STATE() # Save the state of the variables INCLUDE_DIRECTORIES(${EXPAT_INCLUDE_DIR}) @@ -979,8 +1111,16 @@ IF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX)$" # # If requested, try finding library for PCREPOSIX # - FIND_PACKAGE(LibGCC) - FIND_PACKAGE(PCREPOSIX) + IF(ENABLE_LibGCC) + FIND_PACKAGE(LibGCC) + ELSE() + SET(LIBGCC_FOUND FALSE) # Override cached value + ENDIF() + IF(ENABLE_PCREPOSIX) + FIND_PACKAGE(PCREPOSIX) + ELSE() + SET(PCREPOSIX_FOUND FALSE) # Override cached value + ENDIF() IF(PCREPOSIX_FOUND) INCLUDE_DIRECTORIES(${PCRE_INCLUDE_DIR}) LIST(APPEND ADDITIONAL_LIBS ${PCREPOSIX_LIBRARIES}) @@ -1032,15 +1172,18 @@ ENDIF(NOT FOUND_POSIX_REGEX_LIB AND POSIX_REGEX_LIB MATCHES "^(AUTO|LIBPCREPOSIX # Check functions # CMAKE_PUSH_CHECK_STATE() # Save the state of the variables -IF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") +IF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") # # During checking functions, we should use -fno-builtin to avoid the # failure of function detection which failure is an error "conflicting # types for built-in function" caused by using -Werror option. # SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-builtin") -ENDIF ("CMAKE_C_COMPILER_ID" MATCHES "^GNU$") +ENDIF (CMAKE_C_COMPILER_ID MATCHES "^GNU$" OR + CMAKE_C_COMPILER_ID MATCHES "^Clang$") CHECK_SYMBOL_EXISTS(_CrtSetReportMode "crtdbg.h" HAVE__CrtSetReportMode) +CHECK_FUNCTION_EXISTS_GLIBC(arc4random_buf HAVE_ARC4RANDOM_BUF) CHECK_FUNCTION_EXISTS_GLIBC(chflags HAVE_CHFLAGS) CHECK_FUNCTION_EXISTS_GLIBC(chown HAVE_CHOWN) CHECK_FUNCTION_EXISTS_GLIBC(chroot HAVE_CHROOT) @@ -1088,6 +1231,7 @@ CHECK_FUNCTION_EXISTS_GLIBC(pipe HAVE_PIPE) CHECK_FUNCTION_EXISTS_GLIBC(poll HAVE_POLL) CHECK_FUNCTION_EXISTS_GLIBC(posix_spawnp HAVE_POSIX_SPAWNP) CHECK_FUNCTION_EXISTS_GLIBC(readlink HAVE_READLINK) +CHECK_FUNCTION_EXISTS_GLIBC(readpassphrase HAVE_READPASSPHRASE) CHECK_FUNCTION_EXISTS_GLIBC(select HAVE_SELECT) CHECK_FUNCTION_EXISTS_GLIBC(setenv HAVE_SETENV) CHECK_FUNCTION_EXISTS_GLIBC(setlocale HAVE_SETLOCALE) @@ -1126,19 +1270,20 @@ CHECK_FUNCTION_EXISTS(strftime HAVE_STRFTIME) CHECK_FUNCTION_EXISTS(vprintf HAVE_VPRINTF) CHECK_FUNCTION_EXISTS(wmemcmp HAVE_WMEMCMP) CHECK_FUNCTION_EXISTS(wmemcpy HAVE_WMEMCPY) +CHECK_FUNCTION_EXISTS(wmemmove HAVE_WMEMMOVE) CMAKE_POP_CHECK_STATE() # Restore the state of the variables # Make sure we have the POSIX version of readdir_r, not the # older 2-argument version. -LIBARCHIVE_CHECK_C_SOURCE_COMPILES( +CHECK_C_SOURCE_COMPILES( "#include \nint main() {DIR *d = opendir(\".\"); struct dirent e,*r; return readdir_r(d,&e,&r);}" HAVE_READDIR_R) # Only detect readlinkat() if we also have AT_FDCWD in unistd.h. # NOTE: linux requires fcntl.h for AT_FDCWD. -LIBARCHIVE_CHECK_C_SOURCE_COMPILES( +CHECK_C_SOURCE_COMPILES( "#include \n#include \nint main() {char buf[10]; return readlinkat(AT_FDCWD, \"\", buf, 0);}" HAVE_READLINKAT) @@ -1147,10 +1292,10 @@ LIBARCHIVE_CHECK_C_SOURCE_COMPILES( # of interest and verify that the result can be linked. # CHECK_FUNCTION_EXISTS doesn't accept a header argument, # CHECK_SYMBOL_EXISTS doesn't test linkage. -LIBARCHIVE_CHECK_C_SOURCE_COMPILES( +CHECK_C_SOURCE_COMPILES( "#include \nint main() { return major(256); }" MAJOR_IN_MKDEV) -LIBARCHIVE_CHECK_C_SOURCE_COMPILES( +CHECK_C_SOURCE_COMPILES( "#include \nint main() { return major(256); }" MAJOR_IN_SYSMACROS) @@ -1171,10 +1316,15 @@ ENDIF(HAVE_INTTYPES_H) CHECK_SYMBOL_EXISTS(EFTYPE "errno.h" HAVE_EFTYPE) CHECK_SYMBOL_EXISTS(EILSEQ "errno.h" HAVE_EILSEQ) CHECK_SYMBOL_EXISTS(D_MD_ORDER "langinfo.h" HAVE_D_MD_ORDER) +CHECK_SYMBOL_EXISTS(INT32_MAX "${headers}" HAVE_DECL_INT32_MAX) +CHECK_SYMBOL_EXISTS(INT32_MIN "${headers}" HAVE_DECL_INT32_MIN) CHECK_SYMBOL_EXISTS(INT64_MAX "${headers}" HAVE_DECL_INT64_MAX) CHECK_SYMBOL_EXISTS(INT64_MIN "${headers}" HAVE_DECL_INT64_MIN) +CHECK_SYMBOL_EXISTS(INTMAX_MAX "${headers}" HAVE_DECL_INTMAX_MAX) +CHECK_SYMBOL_EXISTS(INTMAX_MIN "${headers}" HAVE_DECL_INTMAX_MIN) CHECK_SYMBOL_EXISTS(UINT32_MAX "${headers}" HAVE_DECL_UINT32_MAX) CHECK_SYMBOL_EXISTS(UINT64_MAX "${headers}" HAVE_DECL_UINT64_MAX) +CHECK_SYMBOL_EXISTS(UINTMAX_MAX "${headers}" HAVE_DECL_UINTMAX_MAX) CHECK_SYMBOL_EXISTS(SIZE_MAX "${headers}" HAVE_DECL_SIZE_MAX) CHECK_SYMBOL_EXISTS(SSIZE_MAX "limits.h" HAVE_DECL_SSIZE_MAX) @@ -1242,13 +1392,13 @@ CHECK_TYPE_SIZE("unsigned long long" SIZE_OF_UNSIGNED_LONG_LONG) CHECK_TYPE_SIZE("__int64" __INT64) CHECK_TYPE_SIZE("unsigned __int64" UNSIGNED___INT64) -CHECK_TYPE_SIZE(int16_t INT16_T) +CHECK_TYPE_SIZE(int16_t INT16_T) CHECK_TYPE_SIZE(int32_t INT32_T) CHECK_TYPE_SIZE(int64_t INT64_T) CHECK_TYPE_SIZE(intmax_t INTMAX_T) -CHECK_TYPE_SIZE(uint8_t UINT8_T) -CHECK_TYPE_SIZE(uint16_t UINT16_T) -CHECK_TYPE_SIZE(uint32_t UINT32_T) +CHECK_TYPE_SIZE(uint8_t UINT8_T) +CHECK_TYPE_SIZE(uint16_t UINT16_T) +CHECK_TYPE_SIZE(uint32_t UINT32_T) CHECK_TYPE_SIZE(uint64_t UINT64_T) CHECK_TYPE_SIZE(uintmax_t UINTMAX_T) @@ -1491,6 +1641,9 @@ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/cmake/config.h.in INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) ADD_DEFINITIONS(-DHAVE_CONFIG_H) +# Handle generation of the libarchive.pc file for pkg-config +INCLUDE(CreatePkgConfigFile) + # # Register installation of PDF documents. # @@ -1521,5 +1674,6 @@ IF(ENABLE_TEST) ENDIF(ENABLE_TEST) add_subdirectory(libarchive) +add_subdirectory(cat) add_subdirectory(tar) add_subdirectory(cpio) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 000000000000..9ccc45c3d185 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,98 @@ +Thank you for helping us improve libarchive. +The following guidelines will help ensure your contribution gets prompt attention. + +# Bugs and other Issues + +If you encounter any problems with libarchive, +[please file an issue on our issue tracker](https://github.com/libarchive/libarchive/issues). + +All bug reports should include the following information. You can copy the text below directly into the issue tracker to get started: + +``` +Basic Information + Version of libarchive: + How you obtained it: (build from source, pre-packaged binary, etc) + Operating system and version: + What compiler and/or IDE you are using (include version): + +If you are using a pre-packaged binary + Exact package name and version: + Repository you obtained it from: + +Description of the problem you are seeing: + What did you do? + What did you expect to happen? + What actually happened? + What log files or error messages were produced? + +How the libarchive developers can reproduce your problem: + What other software was involved? + What other files were involved? + How can we obtain any of the above? +``` + +Depending on the specific type of issue, other information will be helpful: + +## Test Failures + +If you see any test failures, please include the information above and also: + +* Names of the tests that failed. + +* Look for the .log files in the /tmp/libarchive_test_*date-and-time* directories. (On Mac OS, look in $TMPDIR which is different than /tmp.) + +Please paste the .log files you will find there directly into your report. + + +## Problems using libarchive in a program + +If you are trying to write a program using libarchive, please include the information above and also: + +* It will help us if we can actually run the program. This is easiest if you can provide source to a short program that illustrates your problem. + +* If you have a sufficiently short program that shows the problem, you can either paste it into the report or [put it into a gist](https://gist.github.com). + + +## Libarchive produced incorrect output + +Please tell us what program you ran, any command-line arguments you provided, and details of the input files (`ls -l` output is helpful here). If the problem involved a command-line program, please copy the full terminal text into the report, including the command line and any error messages. + +Please try to make the output file available to us. Unless it is very large, you can upload it into a fresh github repository and provide a link in your issue report. + + +## Libarchive could not read a particular input file + +Note: If you can provide a **very small** input file that reproduces the problem, we can add that to our test suite. This will ensure that the bug does not reappear in the future. + +A link to the relevant file is usually sufficient. + +If you cannot provide the input file or a link to the file, please let us know if there is some other way to obtain it. + + +## Documentation improvements + +We are always interested in improving the libarchive documentation. Please tell us about any errors you find, including: + +* Typos or errors in the manpages provided with libarchive source. + +* Mistakes in the [libarchive Wiki](https://github.com/libarchive/libarchive/wiki) + +* Problems with the PDF or Wiki files that are automatically generated from the manpages. + + +# Code Submissions + +We welcome all code submissions. But of course, some code submissions are easier for us to respond to than others. The best code submissions: + +* Address a single issue. There have been many cases where a simple fix to an obvious problem did not get handled for months because the patch that was provided also included an unrelated change affecting an especially complex area of the code. + +* Follow existing libarchive code style and conventions. Libarchive generally follows [BSD KNF](https://www.freebsd.org/cgi/man.cgi?query=style&sektion=9) for formatting code. + +* Do not make unnecessary changes to existing whitespace, capitalization, or spelling. + +* Include detailed instructions for reproducing the problem you're fixing. We do try to verify that a submission actually fixes a real problem. If we can't reproduce the problem, it will take us longer to evaluate the fix. For this reason, we encourage you to file an issue report first with details on reproducing the problem, then refer to that issue in your pull request. + +* Includes a test case. The libarchive Wiki has [detailed documentation for adding new test cases](https://github.com/libarchive/libarchive/wiki/LibarchiveAddingTest). + +* Are provided via Github pull requests. We welcome patches in almost any format, but github's pull request management makes it significantly easier for us to evaluate and test changes. + diff --git a/COPYING b/COPYING index b25880600230..93952b77ae25 100644 --- a/COPYING +++ b/COPYING @@ -17,12 +17,11 @@ the actual statements in the files are controlling. files for details: libarchive/archive_entry.c libarchive/archive_read_support_filter_compress.c - libarchive/archive_write_set_filter_compress.c + libarchive/archive_write_add_filter_compress.c libarchive/mtree.5 - tar/matching.c * The following source files are in the public domain: - tar/getdate.c + libarchive/archive_getdate.c * The build files---including Makefiles, configure scripts, and auxiliary scripts used as part of the compile process---have diff --git a/INSTALL b/INSTALL index 33c58b7ed454..2fafbd5046d8 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ More complete build documentation is available on the libarchive -Wiki: http://libarchive.googlecode.com/ +Wiki: https://github.com/libarchive/libarchive/wiki On most Unix-like systems, you should be able to install libarchive, bsdtar, and bsdcpio using the following common steps: diff --git a/Makefile.am b/Makefile.am index 3fa2d22b6de6..c5250184a71e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,24 +8,23 @@ ACLOCAL_AMFLAGS = -I build/autoconf # lib_LTLIBRARIES= libarchive.la noinst_LTLIBRARIES= libarchive_fe.la -bin_PROGRAMS= $(bsdtar_programs) $(bsdcpio_programs) -man_MANS= $(libarchive_man_MANS) $(bsdtar_man_MANS) $(bsdcpio_man_MANS) -BUILT_SOURCES= libarchive/test/list.h tar/test/list.h cpio/test/list.h +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 # # 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) -TESTS= libarchive_test $(bsdtar_test_programs) $(bsdcpio_test_programs) -TESTS_ENVIRONMENT= $(libarchive_TESTS_ENVIRONMENT) $(bsdtar_TESTS_ENVIRONMENT) $(bsdcpio_TESTS_ENVIRONMENT) +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) # Always build and test both bsdtar and bsdcpio as part of 'distcheck' DISTCHECK_CONFIGURE_FLAGS = --enable-bsdtar --enable-bsdcpio -COMMON_CFLAGS=-Wall -Wformat -Wformat-security # The next line is commented out by default in shipping libarchive releases. # It is uncommented by default in trunk. -# DEV_CFLAGS=-Werror -Wextra -Wunused -Wshadow -Wmissing-prototypes -Wcast-qual -AM_CFLAGS=$(COMMON_CFLAGS) $(DEV_CFLAGS) +DEV_CFLAGS=-Werror -Wextra -Wunused -Wshadow -Wmissing-prototypes -Wcast-qual -g +AM_CFLAGS=$(DEV_CFLAGS) PLATFORMCPPFLAGS = @PLATFORMCPPFLAGS@ AM_CPPFLAGS=$(PLATFORMCPPFLAGS) @@ -33,21 +32,23 @@ AM_CPPFLAGS=$(PLATFORMCPPFLAGS) # What to include in the distribution # EXTRA_DIST= \ - CMakeLists.txt \ - build/autogen.sh \ - build/bump-version.sh \ - build/clean.sh \ - build/cmake \ - build/version \ - contrib \ - doc \ - examples \ - $(libarchive_EXTRA_DIST) \ - $(libarchive_test_EXTRA_DIST) \ - $(bsdtar_EXTRA_DIST) \ - $(bsdtar_test_EXTRA_DIST) \ - $(bsdcpio_EXTRA_DIST) \ - $(bsdcpio_test_EXTRA_DIST) + CMakeLists.txt \ + build/autogen.sh \ + build/bump-version.sh \ + build/clean.sh \ + build/cmake \ + build/version \ + contrib \ + doc \ + examples \ + $(libarchive_EXTRA_DIST) \ + $(libarchive_test_EXTRA_DIST) \ + $(bsdtar_EXTRA_DIST) \ + $(bsdtar_test_EXTRA_DIST) \ + $(bsdcpio_EXTRA_DIST) \ + $(bsdcpio_test_EXTRA_DIST) \ + $(bsdcat_EXTRA_DIST) \ + $(bsdcat_test_EXTRA_DIST) # a) Clean out some unneeded files and directories # b) Collect all documentation and format it for distribution. @@ -63,10 +64,11 @@ dist-hook: # # Extra rules for cleanup # -DISTCLEANFILES= \ - libarchive/test/list.h \ - tar/test/list.h \ - cpio/test/list.h +DISTCLEANFILES= \ + libarchive/test/list.h \ + tar/test/list.h \ + cpio/test/list.h \ + cat/test/list.h distclean-local: -rm -rf .ref @@ -78,6 +80,8 @@ distclean-local: -[ -f tar/test/Makefile ] && cd tar/test && make clean -[ -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 # # Libarchive headers, source, etc. @@ -86,137 +90,157 @@ distclean-local: include_HEADERS= libarchive/archive.h libarchive/archive_entry.h -libarchive_la_SOURCES= \ - libarchive/archive_acl.c \ - libarchive/archive_acl_private.h \ - libarchive/archive_check_magic.c \ - libarchive/archive_cmdline.c \ - libarchive/archive_cmdline_private.h \ - libarchive/archive_crc32.h \ - libarchive/archive_crypto.c \ - libarchive/archive_crypto_private.h \ - libarchive/archive_endian.h \ - libarchive/archive_entry.c \ - libarchive/archive_entry.h \ - libarchive/archive_entry_copy_stat.c \ - libarchive/archive_entry_link_resolver.c \ - libarchive/archive_entry_locale.h \ - libarchive/archive_entry_private.h \ - libarchive/archive_entry_sparse.c \ - libarchive/archive_entry_stat.c \ - libarchive/archive_entry_strmode.c \ - libarchive/archive_entry_xattr.c \ - libarchive/archive_getdate.c \ - libarchive/archive_match.c \ - libarchive/archive_options.c \ - libarchive/archive_options_private.h \ - libarchive/archive_pathmatch.c \ - libarchive/archive_pathmatch.h \ - libarchive/archive_platform.h \ - libarchive/archive_ppmd_private.h \ - libarchive/archive_ppmd7.c \ - libarchive/archive_ppmd7_private.h \ - libarchive/archive_private.h \ - libarchive/archive_rb.c \ - libarchive/archive_rb.h \ - libarchive/archive_read.c \ - libarchive/archive_read_append_filter.c \ - libarchive/archive_read_data_into_fd.c \ - libarchive/archive_read_disk_entry_from_file.c \ - libarchive/archive_read_disk_posix.c \ - libarchive/archive_read_disk_private.h \ - libarchive/archive_read_disk_set_standard_lookup.c \ - libarchive/archive_read_extract.c \ - libarchive/archive_read_open_fd.c \ - libarchive/archive_read_open_file.c \ - libarchive/archive_read_open_filename.c \ - libarchive/archive_read_open_memory.c \ - libarchive/archive_read_private.h \ - libarchive/archive_read_set_format.c \ - libarchive/archive_read_set_options.c \ - libarchive/archive_read_support_filter_all.c \ - libarchive/archive_read_support_filter_bzip2.c \ - libarchive/archive_read_support_filter_compress.c \ - libarchive/archive_read_support_filter_grzip.c \ - libarchive/archive_read_support_filter_gzip.c \ - libarchive/archive_read_support_filter_lrzip.c \ - libarchive/archive_read_support_filter_lzop.c \ - libarchive/archive_read_support_filter_none.c \ - libarchive/archive_read_support_filter_program.c \ - libarchive/archive_read_support_filter_rpm.c \ - libarchive/archive_read_support_filter_uu.c \ - libarchive/archive_read_support_filter_xz.c \ - libarchive/archive_read_support_format_7zip.c \ - libarchive/archive_read_support_format_all.c \ - libarchive/archive_read_support_format_ar.c \ - libarchive/archive_read_support_format_by_code.c \ - libarchive/archive_read_support_format_cab.c \ - libarchive/archive_read_support_format_cpio.c \ - libarchive/archive_read_support_format_empty.c \ - libarchive/archive_read_support_format_iso9660.c \ - libarchive/archive_read_support_format_lha.c \ - libarchive/archive_read_support_format_mtree.c \ - libarchive/archive_read_support_format_rar.c \ - libarchive/archive_read_support_format_raw.c \ - libarchive/archive_read_support_format_tar.c \ - libarchive/archive_read_support_format_xar.c \ - libarchive/archive_read_support_format_zip.c \ - libarchive/archive_string.c \ - libarchive/archive_string.h \ - libarchive/archive_string_composition.h \ - libarchive/archive_string_sprintf.c \ - libarchive/archive_util.c \ - libarchive/archive_virtual.c \ - libarchive/archive_write.c \ - libarchive/archive_write_disk_acl.c \ - libarchive/archive_write_disk_posix.c \ - libarchive/archive_write_disk_private.h \ - libarchive/archive_write_disk_set_standard_lookup.c \ - libarchive/archive_write_open_fd.c \ - libarchive/archive_write_open_file.c \ - libarchive/archive_write_open_filename.c \ - libarchive/archive_write_open_memory.c \ - libarchive/archive_write_private.h \ - libarchive/archive_write_add_filter.c \ - libarchive/archive_write_add_filter_b64encode.c \ - libarchive/archive_write_add_filter_by_name.c \ - libarchive/archive_write_add_filter_bzip2.c \ - libarchive/archive_write_add_filter_compress.c \ - libarchive/archive_write_add_filter_grzip.c \ - libarchive/archive_write_add_filter_gzip.c \ - libarchive/archive_write_add_filter_lrzip.c \ - libarchive/archive_write_add_filter_lzop.c \ - libarchive/archive_write_add_filter_none.c \ - libarchive/archive_write_add_filter_program.c \ - libarchive/archive_write_add_filter_uuencode.c \ - libarchive/archive_write_add_filter_xz.c \ - libarchive/archive_write_set_format.c \ - libarchive/archive_write_set_format_7zip.c \ - libarchive/archive_write_set_format_ar.c \ - libarchive/archive_write_set_format_by_name.c \ - libarchive/archive_write_set_format_cpio.c \ - libarchive/archive_write_set_format_cpio_newc.c \ - libarchive/archive_write_set_format_iso9660.c \ - libarchive/archive_write_set_format_mtree.c \ - libarchive/archive_write_set_format_pax.c \ - libarchive/archive_write_set_format_shar.c \ - libarchive/archive_write_set_format_ustar.c \ - libarchive/archive_write_set_format_v7tar.c \ - libarchive/archive_write_set_format_gnutar.c \ - libarchive/archive_write_set_format_xar.c \ - libarchive/archive_write_set_format_zip.c \ - libarchive/archive_write_set_options.c \ - libarchive/config_freebsd.h \ - libarchive/filter_fork_posix.c \ - libarchive/filter_fork.h +libarchive_la_SOURCES= \ + libarchive/archive_acl.c \ + libarchive/archive_acl_private.h \ + libarchive/archive_check_magic.c \ + libarchive/archive_cmdline.c \ + libarchive/archive_cmdline_private.h \ + libarchive/archive_crc32.h \ + libarchive/archive_cryptor.c \ + libarchive/archive_cryptor_private.h \ + libarchive/archive_digest.c \ + libarchive/archive_digest_private.h \ + libarchive/archive_endian.h \ + libarchive/archive_entry.c \ + libarchive/archive_entry.h \ + libarchive/archive_entry_copy_stat.c \ + libarchive/archive_entry_link_resolver.c \ + libarchive/archive_entry_locale.h \ + libarchive/archive_entry_private.h \ + libarchive/archive_entry_sparse.c \ + libarchive/archive_entry_stat.c \ + libarchive/archive_entry_strmode.c \ + libarchive/archive_entry_xattr.c \ + libarchive/archive_getdate.c \ + libarchive/archive_getdate.h \ + libarchive/archive_hmac.c \ + libarchive/archive_hmac_private.h \ + libarchive/archive_match.c \ + libarchive/archive_options.c \ + libarchive/archive_options_private.h \ + libarchive/archive_pack_dev.h \ + libarchive/archive_pack_dev.c \ + libarchive/archive_pathmatch.c \ + libarchive/archive_pathmatch.h \ + libarchive/archive_platform.h \ + libarchive/archive_ppmd_private.h \ + libarchive/archive_ppmd7.c \ + libarchive/archive_ppmd7_private.h \ + libarchive/archive_private.h \ + libarchive/archive_random.c \ + libarchive/archive_random_private.h \ + libarchive/archive_rb.c \ + libarchive/archive_rb.h \ + libarchive/archive_read.c \ + libarchive/archive_read_add_passphrase.c \ + libarchive/archive_read_append_filter.c \ + libarchive/archive_read_data_into_fd.c \ + libarchive/archive_read_disk_entry_from_file.c \ + libarchive/archive_read_disk_posix.c \ + libarchive/archive_read_disk_private.h \ + libarchive/archive_read_disk_set_standard_lookup.c \ + libarchive/archive_read_extract.c \ + libarchive/archive_read_extract2.c \ + libarchive/archive_read_open_fd.c \ + libarchive/archive_read_open_file.c \ + libarchive/archive_read_open_filename.c \ + libarchive/archive_read_open_memory.c \ + libarchive/archive_read_private.h \ + libarchive/archive_read_set_format.c \ + libarchive/archive_read_set_options.c \ + libarchive/archive_read_support_filter_all.c \ + libarchive/archive_read_support_filter_bzip2.c \ + libarchive/archive_read_support_filter_compress.c \ + libarchive/archive_read_support_filter_grzip.c \ + libarchive/archive_read_support_filter_gzip.c \ + libarchive/archive_read_support_filter_lrzip.c \ + libarchive/archive_read_support_filter_lz4.c \ + libarchive/archive_read_support_filter_lzop.c \ + libarchive/archive_read_support_filter_none.c \ + libarchive/archive_read_support_filter_program.c \ + libarchive/archive_read_support_filter_rpm.c \ + libarchive/archive_read_support_filter_uu.c \ + libarchive/archive_read_support_filter_xz.c \ + libarchive/archive_read_support_format_7zip.c \ + libarchive/archive_read_support_format_all.c \ + libarchive/archive_read_support_format_ar.c \ + libarchive/archive_read_support_format_by_code.c \ + libarchive/archive_read_support_format_cab.c \ + libarchive/archive_read_support_format_cpio.c \ + libarchive/archive_read_support_format_empty.c \ + libarchive/archive_read_support_format_iso9660.c \ + libarchive/archive_read_support_format_lha.c \ + libarchive/archive_read_support_format_mtree.c \ + libarchive/archive_read_support_format_rar.c \ + libarchive/archive_read_support_format_raw.c \ + libarchive/archive_read_support_format_tar.c \ + libarchive/archive_read_support_format_warc.c \ + libarchive/archive_read_support_format_xar.c \ + libarchive/archive_read_support_format_zip.c \ + libarchive/archive_string.c \ + libarchive/archive_string.h \ + libarchive/archive_string_composition.h \ + libarchive/archive_string_sprintf.c \ + libarchive/archive_util.c \ + libarchive/archive_virtual.c \ + libarchive/archive_write.c \ + libarchive/archive_write_disk_acl.c \ + libarchive/archive_write_disk_posix.c \ + libarchive/archive_write_disk_private.h \ + libarchive/archive_write_disk_set_standard_lookup.c \ + libarchive/archive_write_open_fd.c \ + libarchive/archive_write_open_file.c \ + libarchive/archive_write_open_filename.c \ + libarchive/archive_write_open_memory.c \ + libarchive/archive_write_private.h \ + libarchive/archive_write_add_filter.c \ + libarchive/archive_write_add_filter_b64encode.c \ + libarchive/archive_write_add_filter_by_name.c \ + libarchive/archive_write_add_filter_bzip2.c \ + libarchive/archive_write_add_filter_compress.c \ + libarchive/archive_write_add_filter_grzip.c \ + libarchive/archive_write_add_filter_gzip.c \ + libarchive/archive_write_add_filter_lrzip.c \ + libarchive/archive_write_add_filter_lz4.c \ + libarchive/archive_write_add_filter_lzop.c \ + libarchive/archive_write_add_filter_none.c \ + libarchive/archive_write_add_filter_program.c \ + libarchive/archive_write_add_filter_uuencode.c \ + libarchive/archive_write_add_filter_xz.c \ + libarchive/archive_write_set_format.c \ + libarchive/archive_write_set_format_7zip.c \ + libarchive/archive_write_set_format_ar.c \ + libarchive/archive_write_set_format_by_name.c \ + libarchive/archive_write_set_format_cpio.c \ + libarchive/archive_write_set_format_cpio_newc.c \ + libarchive/archive_write_set_format_filter_by_ext.c \ + libarchive/archive_write_set_format_iso9660.c \ + libarchive/archive_write_set_format_mtree.c \ + libarchive/archive_write_set_format_pax.c \ + libarchive/archive_write_set_format_raw.c \ + libarchive/archive_write_set_format_shar.c \ + libarchive/archive_write_set_format_ustar.c \ + libarchive/archive_write_set_format_v7tar.c \ + libarchive/archive_write_set_format_gnutar.c \ + libarchive/archive_write_set_format_warc.c \ + libarchive/archive_write_set_format_xar.c \ + libarchive/archive_write_set_format_zip.c \ + libarchive/archive_write_set_options.c \ + libarchive/archive_write_set_passphrase.c \ + libarchive/archive_xxhash.h \ + libarchive/config_freebsd.h \ + libarchive/filter_fork_posix.c \ + libarchive/filter_fork.h \ + libarchive/xxhash.c if INC_WINDOWS_FILES -libarchive_la_SOURCES+= \ - libarchive/archive_entry_copy_bhfi.c \ - libarchive/archive_read_disk_windows.c \ - libarchive/archive_windows.h \ - libarchive/archive_windows.c \ - libarchive/archive_write_disk_windows.c \ +libarchive_la_SOURCES+= \ + libarchive/archive_entry_copy_bhfi.c \ + libarchive/archive_read_disk_windows.c \ + libarchive/archive_windows.h \ + libarchive/archive_windows.c \ + libarchive/archive_write_disk_windows.c \ libarchive/filter_fork_windows.c endif @@ -226,52 +250,54 @@ libarchive_la_LDFLAGS= -no-undefined -version-info $(ARCHIVE_LIBTOOL_VERSION) libarchive_la_LIBADD= $(LTLIBICONV) # Manpages to install -libarchive_man_MANS= \ - libarchive/archive_entry.3 \ - libarchive/archive_entry_acl.3 \ - libarchive/archive_entry_linkify.3 \ - libarchive/archive_entry_paths.3 \ - libarchive/archive_entry_perms.3 \ - libarchive/archive_entry_stat.3 \ - libarchive/archive_entry_time.3 \ - libarchive/archive_read.3 \ - libarchive/archive_read_data.3 \ - libarchive/archive_read_disk.3 \ - libarchive/archive_read_extract.3 \ - libarchive/archive_read_filter.3 \ - libarchive/archive_read_format.3 \ - libarchive/archive_read_free.3 \ - libarchive/archive_read_header.3 \ - libarchive/archive_read_new.3 \ - libarchive/archive_read_open.3 \ - libarchive/archive_read_set_options.3 \ - libarchive/archive_util.3 \ - libarchive/archive_write.3 \ - libarchive/archive_write_blocksize.3 \ - libarchive/archive_write_data.3 \ - libarchive/archive_write_disk.3 \ - libarchive/archive_write_filter.3 \ - libarchive/archive_write_finish_entry.3 \ - libarchive/archive_write_format.3 \ - libarchive/archive_write_free.3 \ - libarchive/archive_write_header.3 \ - libarchive/archive_write_new.3 \ - libarchive/archive_write_open.3 \ - libarchive/archive_write_set_options.3 \ - libarchive/cpio.5 \ - libarchive/libarchive.3 \ - libarchive/libarchive_changes.3 \ - libarchive/libarchive_internals.3 \ - libarchive/libarchive-formats.5 \ - libarchive/mtree.5 \ +libarchive_man_MANS= \ + libarchive/archive_entry.3 \ + libarchive/archive_entry_acl.3 \ + libarchive/archive_entry_linkify.3 \ + libarchive/archive_entry_paths.3 \ + libarchive/archive_entry_perms.3 \ + libarchive/archive_entry_stat.3 \ + libarchive/archive_entry_time.3 \ + libarchive/archive_read.3 \ + libarchive/archive_read_add_passphrase.3 \ + libarchive/archive_read_data.3 \ + libarchive/archive_read_disk.3 \ + libarchive/archive_read_extract.3 \ + libarchive/archive_read_filter.3 \ + libarchive/archive_read_format.3 \ + libarchive/archive_read_free.3 \ + libarchive/archive_read_header.3 \ + libarchive/archive_read_new.3 \ + libarchive/archive_read_open.3 \ + libarchive/archive_read_set_options.3 \ + libarchive/archive_util.3 \ + libarchive/archive_write.3 \ + libarchive/archive_write_blocksize.3 \ + libarchive/archive_write_data.3 \ + libarchive/archive_write_disk.3 \ + libarchive/archive_write_filter.3 \ + libarchive/archive_write_finish_entry.3 \ + libarchive/archive_write_format.3 \ + libarchive/archive_write_free.3 \ + libarchive/archive_write_header.3 \ + libarchive/archive_write_new.3 \ + libarchive/archive_write_open.3 \ + libarchive/archive_write_set_options.3 \ + libarchive/archive_write_set_passphrase.3 \ + libarchive/cpio.5 \ + libarchive/libarchive.3 \ + libarchive/libarchive_changes.3 \ + libarchive/libarchive_internals.3 \ + libarchive/libarchive-formats.5 \ + libarchive/mtree.5 \ libarchive/tar.5 # Additional libarchive files to include in the distribution -libarchive_EXTRA_DIST= \ - libarchive/archive_windows.c \ - libarchive/archive_windows.h \ - libarchive/filter_fork_windows.c \ - libarchive/CMakeLists.txt \ +libarchive_EXTRA_DIST= \ + libarchive/archive_windows.c \ + libarchive/archive_windows.h \ + libarchive/filter_fork_windows.c \ + libarchive/CMakeLists.txt \ $(libarchive_man_MANS) # pkgconfig @@ -288,217 +314,260 @@ test_utils_SOURCES= \ # libarchive_test program # # -libarchive_test_SOURCES= \ - $(libarchive_la_SOURCES) \ - $(test_utils_SOURCES) \ - libarchive/test/main.c \ - libarchive/test/read_open_memory.c \ - libarchive/test/test.h \ - libarchive/test/test_acl_freebsd_posix1e.c \ - libarchive/test/test_acl_freebsd_nfs4.c \ - libarchive/test/test_acl_nfs4.c \ - libarchive/test/test_acl_pax.c \ - libarchive/test/test_acl_posix1e.c \ - libarchive/test/test_archive_api_feature.c \ - libarchive/test/test_archive_clear_error.c \ - libarchive/test/test_archive_cmdline.c \ - libarchive/test/test_archive_crypto.c \ - libarchive/test/test_archive_getdate.c \ - libarchive/test/test_archive_match_owner.c \ - libarchive/test/test_archive_match_path.c \ - libarchive/test/test_archive_match_time.c \ - libarchive/test/test_archive_pathmatch.c \ - libarchive/test/test_archive_read_close_twice.c \ - libarchive/test/test_archive_read_close_twice_open_fd.c \ - libarchive/test/test_archive_read_close_twice_open_filename.c \ - libarchive/test/test_archive_read_multiple_data_objects.c \ - libarchive/test/test_archive_read_next_header_empty.c \ - libarchive/test/test_archive_read_next_header_raw.c \ - libarchive/test/test_archive_read_open2.c \ - libarchive/test/test_archive_read_set_filter_option.c \ - libarchive/test/test_archive_read_set_format_option.c \ - libarchive/test/test_archive_read_set_option.c \ - libarchive/test/test_archive_read_set_options.c \ - libarchive/test/test_archive_read_support.c \ - libarchive/test/test_archive_set_error.c \ - libarchive/test/test_archive_string.c \ - libarchive/test/test_archive_string_conversion.c \ - libarchive/test/test_archive_write_add_filter_by_name.c \ - libarchive/test/test_archive_write_set_filter_option.c \ - libarchive/test/test_archive_write_set_format_by_name.c \ - libarchive/test/test_archive_write_set_format_option.c \ - libarchive/test/test_archive_write_set_option.c \ - libarchive/test/test_archive_write_set_options.c \ - libarchive/test/test_bad_fd.c \ - libarchive/test/test_compat_bzip2.c \ - libarchive/test/test_compat_cpio.c \ - libarchive/test/test_compat_gtar.c \ - libarchive/test/test_compat_gzip.c \ - libarchive/test/test_compat_lzip.c \ - libarchive/test/test_compat_lzma.c \ - libarchive/test/test_compat_lzop.c \ - libarchive/test/test_compat_mac.c \ - libarchive/test/test_compat_pax_libarchive_2x.c \ - libarchive/test/test_compat_solaris_tar_acl.c \ - libarchive/test/test_compat_solaris_pax_sparse.c \ - libarchive/test/test_compat_tar_hardlink.c \ - libarchive/test/test_compat_uudecode.c \ - libarchive/test/test_compat_xz.c \ - libarchive/test/test_compat_zip.c \ - libarchive/test/test_empty_write.c \ - libarchive/test/test_entry.c \ - libarchive/test/test_entry_strmode.c \ - libarchive/test/test_extattr_freebsd.c \ - libarchive/test/test_filter_count.c \ - libarchive/test/test_fuzz.c \ - libarchive/test/test_gnutar_filename_encoding.c \ - libarchive/test/test_link_resolver.c \ - libarchive/test/test_open_failure.c \ - libarchive/test/test_open_fd.c \ - libarchive/test/test_open_file.c \ - libarchive/test/test_open_filename.c \ - libarchive/test/test_pax_filename_encoding.c \ - libarchive/test/test_read_data_large.c \ - libarchive/test/test_read_disk.c \ - libarchive/test/test_read_disk_directory_traversals.c \ - libarchive/test/test_read_disk_entry_from_file.c \ - libarchive/test/test_read_extract.c \ - libarchive/test/test_read_file_nonexistent.c \ - libarchive/test/test_read_filter_grzip.c \ - libarchive/test/test_read_filter_lrzip.c \ - libarchive/test/test_read_filter_lzop.c \ - libarchive/test/test_read_filter_lzop_multiple_parts.c \ - libarchive/test/test_read_filter_program.c \ - libarchive/test/test_read_filter_program_signature.c \ - libarchive/test/test_read_filter_uudecode.c \ - libarchive/test/test_read_format_7zip.c \ - libarchive/test/test_read_format_ar.c \ - libarchive/test/test_read_format_cab.c \ - libarchive/test/test_read_format_cab_filename.c \ - libarchive/test/test_read_format_cpio_afio.c \ - libarchive/test/test_read_format_cpio_bin.c \ - libarchive/test/test_read_format_cpio_bin_Z.c \ - libarchive/test/test_read_format_cpio_bin_be.c \ - libarchive/test/test_read_format_cpio_bin_bz2.c \ - libarchive/test/test_read_format_cpio_bin_gz.c \ - libarchive/test/test_read_format_cpio_bin_lzip.c \ - libarchive/test/test_read_format_cpio_bin_lzma.c \ - libarchive/test/test_read_format_cpio_bin_xz.c \ - libarchive/test/test_read_format_cpio_filename.c \ - libarchive/test/test_read_format_cpio_odc.c \ - libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c \ - libarchive/test/test_read_format_cpio_svr4_gzip.c \ - libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c \ - libarchive/test/test_read_format_cpio_svr4c_Z.c \ - libarchive/test/test_read_format_empty.c \ - libarchive/test/test_read_format_gtar_filename.c \ - libarchive/test/test_read_format_gtar_gz.c \ - libarchive/test/test_read_format_gtar_lzma.c \ - libarchive/test/test_read_format_gtar_sparse.c \ - libarchive/test/test_read_format_iso_Z.c \ - libarchive/test/test_read_format_iso_multi_extent.c \ - libarchive/test/test_read_format_iso_xorriso.c \ - libarchive/test/test_read_format_isojoliet_bz2.c \ - libarchive/test/test_read_format_isojoliet_long.c \ - libarchive/test/test_read_format_isojoliet_rr.c \ - libarchive/test/test_read_format_isojoliet_versioned.c \ - libarchive/test/test_read_format_isorr_bz2.c \ - libarchive/test/test_read_format_isorr_ce.c \ - libarchive/test/test_read_format_isorr_new_bz2.c \ - libarchive/test/test_read_format_isorr_rr_moved.c \ - libarchive/test/test_read_format_isozisofs_bz2.c \ - libarchive/test/test_read_format_lha.c \ - libarchive/test/test_read_format_lha_filename.c \ - libarchive/test/test_read_format_mtree.c \ - libarchive/test/test_read_format_pax_bz2.c \ - libarchive/test/test_read_format_rar.c \ - libarchive/test/test_read_format_raw.c \ - libarchive/test/test_read_format_tar.c \ - libarchive/test/test_read_format_tar_empty_filename.c \ - libarchive/test/test_read_format_tar_filename.c \ - libarchive/test/test_read_format_tbz.c \ - libarchive/test/test_read_format_tgz.c \ - libarchive/test/test_read_format_tlz.c \ - libarchive/test/test_read_format_txz.c \ - libarchive/test/test_read_format_tz.c \ - libarchive/test/test_read_format_ustar_filename.c \ - libarchive/test/test_read_format_xar.c \ - libarchive/test/test_read_format_zip.c \ - libarchive/test/test_read_format_zip_comment_stored.c \ - libarchive/test/test_read_format_zip_filename.c \ - libarchive/test/test_read_format_zip_mac_metadata.c \ - libarchive/test/test_read_format_zip_sfx.c \ - libarchive/test/test_read_large.c \ - libarchive/test/test_read_pax_truncated.c \ - libarchive/test/test_read_position.c \ - libarchive/test/test_read_set_format.c \ - libarchive/test/test_read_truncated.c \ - libarchive/test/test_read_truncated_filter.c \ - libarchive/test/test_sparse_basic.c \ - libarchive/test/test_tar_filenames.c \ - libarchive/test/test_tar_large.c \ - libarchive/test/test_ustar_filenames.c \ - libarchive/test/test_ustar_filename_encoding.c \ - libarchive/test/test_write_disk.c \ - libarchive/test/test_write_disk_appledouble.c \ - libarchive/test/test_write_disk_failures.c \ - libarchive/test/test_write_disk_hardlink.c \ - libarchive/test/test_write_disk_hfs_compression.c \ - libarchive/test/test_write_disk_lookup.c \ - libarchive/test/test_write_disk_mac_metadata.c \ - libarchive/test/test_write_disk_no_hfs_compression.c \ - libarchive/test/test_write_disk_perms.c \ - libarchive/test/test_write_disk_secure.c \ - libarchive/test/test_write_disk_sparse.c \ - libarchive/test/test_write_disk_symlink.c \ - libarchive/test/test_write_disk_times.c \ - libarchive/test/test_write_filter_b64encode.c \ - libarchive/test/test_write_filter_bzip2.c \ - libarchive/test/test_write_filter_compress.c \ - libarchive/test/test_write_filter_gzip.c \ - libarchive/test/test_write_filter_gzip_timestamp.c \ - libarchive/test/test_write_filter_lrzip.c \ - libarchive/test/test_write_filter_lzip.c \ - libarchive/test/test_write_filter_lzma.c \ - libarchive/test/test_write_filter_lzop.c \ - libarchive/test/test_write_filter_program.c \ - libarchive/test/test_write_filter_uuencode.c \ - libarchive/test/test_write_filter_xz.c \ - libarchive/test/test_write_format_7zip.c \ - libarchive/test/test_write_format_7zip_empty.c \ - libarchive/test/test_write_format_7zip_large.c \ - libarchive/test/test_write_format_ar.c \ - libarchive/test/test_write_format_cpio.c \ - libarchive/test/test_write_format_cpio_empty.c \ - libarchive/test/test_write_format_cpio_newc.c \ - libarchive/test/test_write_format_cpio_odc.c \ - libarchive/test/test_write_format_gnutar.c \ - libarchive/test/test_write_format_iso9660.c \ - libarchive/test/test_write_format_iso9660_boot.c \ - libarchive/test/test_write_format_iso9660_empty.c \ - libarchive/test/test_write_format_iso9660_filename.c \ - libarchive/test/test_write_format_iso9660_zisofs.c \ - libarchive/test/test_write_format_mtree.c \ - libarchive/test/test_write_format_mtree_absolute_path.c \ - libarchive/test/test_write_format_mtree_classic.c \ +libarchive_test_SOURCES= \ + $(libarchive_la_SOURCES) \ + $(test_utils_SOURCES) \ + libarchive/test/main.c \ + libarchive/test/read_open_memory.c \ + libarchive/test/test.h \ + libarchive/test/test_acl_freebsd_posix1e.c \ + libarchive/test/test_acl_freebsd_nfs4.c \ + libarchive/test/test_acl_nfs4.c \ + libarchive/test/test_acl_pax.c \ + libarchive/test/test_acl_posix1e.c \ + libarchive/test/test_archive_api_feature.c \ + libarchive/test/test_archive_clear_error.c \ + libarchive/test/test_archive_cmdline.c \ + libarchive/test/test_archive_digest.c \ + libarchive/test/test_archive_getdate.c \ + libarchive/test/test_archive_match_owner.c \ + libarchive/test/test_archive_match_path.c \ + libarchive/test/test_archive_match_time.c \ + libarchive/test/test_archive_pathmatch.c \ + libarchive/test/test_archive_read_add_passphrase.c \ + libarchive/test/test_archive_read_close_twice.c \ + libarchive/test/test_archive_read_close_twice_open_fd.c \ + libarchive/test/test_archive_read_close_twice_open_filename.c \ + libarchive/test/test_archive_read_multiple_data_objects.c \ + libarchive/test/test_archive_read_next_header_empty.c \ + libarchive/test/test_archive_read_next_header_raw.c \ + libarchive/test/test_archive_read_open2.c \ + libarchive/test/test_archive_read_set_filter_option.c \ + libarchive/test/test_archive_read_set_format_option.c \ + libarchive/test/test_archive_read_set_option.c \ + libarchive/test/test_archive_read_set_options.c \ + libarchive/test/test_archive_read_support.c \ + libarchive/test/test_archive_set_error.c \ + libarchive/test/test_archive_string.c \ + libarchive/test/test_archive_string_conversion.c \ + libarchive/test/test_archive_write_add_filter_by_name.c \ + libarchive/test/test_archive_write_set_filter_option.c \ + libarchive/test/test_archive_write_set_format_by_name.c \ + libarchive/test/test_archive_write_set_format_filter_by_ext.c \ + libarchive/test/test_archive_write_set_format_option.c \ + libarchive/test/test_archive_write_set_option.c \ + libarchive/test/test_archive_write_set_options.c \ + libarchive/test/test_archive_write_set_passphrase.c \ + libarchive/test/test_bad_fd.c \ + libarchive/test/test_compat_bzip2.c \ + libarchive/test/test_compat_cpio.c \ + libarchive/test/test_compat_gtar.c \ + libarchive/test/test_compat_gzip.c \ + libarchive/test/test_compat_lz4.c \ + libarchive/test/test_compat_lzip.c \ + libarchive/test/test_compat_lzma.c \ + libarchive/test/test_compat_lzop.c \ + libarchive/test/test_compat_mac.c \ + libarchive/test/test_compat_pax_libarchive_2x.c \ + libarchive/test/test_compat_solaris_tar_acl.c \ + libarchive/test/test_compat_solaris_pax_sparse.c \ + libarchive/test/test_compat_tar_hardlink.c \ + libarchive/test/test_compat_uudecode.c \ + libarchive/test/test_compat_uudecode_large.c \ + libarchive/test/test_compat_xz.c \ + libarchive/test/test_compat_zip.c \ + libarchive/test/test_empty_write.c \ + libarchive/test/test_entry.c \ + libarchive/test/test_entry_strmode.c \ + libarchive/test/test_extattr_freebsd.c \ + libarchive/test/test_filter_count.c \ + libarchive/test/test_fuzz.c \ + libarchive/test/test_gnutar_filename_encoding.c \ + libarchive/test/test_link_resolver.c \ + libarchive/test/test_open_failure.c \ + libarchive/test/test_open_fd.c \ + libarchive/test/test_open_file.c \ + libarchive/test/test_open_filename.c \ + libarchive/test/test_pax_filename_encoding.c \ + libarchive/test/test_read_data_large.c \ + libarchive/test/test_read_disk.c \ + libarchive/test/test_read_disk_directory_traversals.c \ + libarchive/test/test_read_disk_entry_from_file.c \ + libarchive/test/test_read_extract.c \ + libarchive/test/test_read_file_nonexistent.c \ + libarchive/test/test_read_filter_compress.c \ + libarchive/test/test_read_filter_grzip.c \ + libarchive/test/test_read_filter_lrzip.c \ + libarchive/test/test_read_filter_lzop.c \ + libarchive/test/test_read_filter_lzop_multiple_parts.c \ + libarchive/test/test_read_filter_program.c \ + libarchive/test/test_read_filter_program_signature.c \ + libarchive/test/test_read_filter_uudecode.c \ + libarchive/test/test_read_format_7zip.c \ + libarchive/test/test_read_format_7zip_encryption_data.c \ + libarchive/test/test_read_format_7zip_encryption_partially.c \ + libarchive/test/test_read_format_7zip_encryption_header.c \ + libarchive/test/test_read_format_7zip_malformed.c \ + libarchive/test/test_read_format_ar.c \ + libarchive/test/test_read_format_cab.c \ + libarchive/test/test_read_format_cab_filename.c \ + libarchive/test/test_read_format_cpio_afio.c \ + libarchive/test/test_read_format_cpio_bin.c \ + libarchive/test/test_read_format_cpio_bin_Z.c \ + libarchive/test/test_read_format_cpio_bin_be.c \ + libarchive/test/test_read_format_cpio_bin_bz2.c \ + libarchive/test/test_read_format_cpio_bin_gz.c \ + libarchive/test/test_read_format_cpio_bin_le.c \ + libarchive/test/test_read_format_cpio_bin_lzip.c \ + libarchive/test/test_read_format_cpio_bin_lzma.c \ + libarchive/test/test_read_format_cpio_bin_xz.c \ + libarchive/test/test_read_format_cpio_filename.c \ + libarchive/test/test_read_format_cpio_odc.c \ + libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c \ + libarchive/test/test_read_format_cpio_svr4_gzip.c \ + libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c \ + libarchive/test/test_read_format_cpio_svr4c_Z.c \ + libarchive/test/test_read_format_empty.c \ + libarchive/test/test_read_format_gtar_filename.c \ + libarchive/test/test_read_format_gtar_gz.c \ + libarchive/test/test_read_format_gtar_lzma.c \ + libarchive/test/test_read_format_gtar_sparse.c \ + libarchive/test/test_read_format_gtar_sparse_skip_entry.c \ + libarchive/test/test_read_format_iso_Z.c \ + libarchive/test/test_read_format_iso_multi_extent.c \ + libarchive/test/test_read_format_iso_xorriso.c \ + libarchive/test/test_read_format_isojoliet_bz2.c \ + libarchive/test/test_read_format_isojoliet_long.c \ + libarchive/test/test_read_format_isojoliet_rr.c \ + libarchive/test/test_read_format_isojoliet_versioned.c \ + libarchive/test/test_read_format_isorr_bz2.c \ + libarchive/test/test_read_format_isorr_ce.c \ + libarchive/test/test_read_format_isorr_new_bz2.c \ + libarchive/test/test_read_format_isorr_rr_moved.c \ + libarchive/test/test_read_format_isozisofs_bz2.c \ + libarchive/test/test_read_format_lha.c \ + libarchive/test/test_read_format_lha_bugfix_0.c \ + libarchive/test/test_read_format_lha_filename.c \ + libarchive/test/test_read_format_mtree.c \ + libarchive/test/test_read_format_pax_bz2.c \ + libarchive/test/test_read_format_rar.c \ + libarchive/test/test_read_format_rar_encryption_data.c \ + libarchive/test/test_read_format_rar_encryption_partially.c \ + libarchive/test/test_read_format_rar_encryption_header.c \ + libarchive/test/test_read_format_raw.c \ + libarchive/test/test_read_format_tar.c \ + libarchive/test/test_read_format_tar_concatenated.c \ + libarchive/test/test_read_format_tar_empty_pax.c \ + libarchive/test/test_read_format_tar_empty_filename.c \ + libarchive/test/test_read_format_tar_filename.c \ + libarchive/test/test_read_format_tbz.c \ + libarchive/test/test_read_format_tgz.c \ + libarchive/test/test_read_format_tlz.c \ + libarchive/test/test_read_format_txz.c \ + libarchive/test/test_read_format_tz.c \ + libarchive/test/test_read_format_ustar_filename.c \ + libarchive/test/test_read_format_warc.c \ + libarchive/test/test_read_format_xar.c \ + libarchive/test/test_read_format_zip.c \ + libarchive/test/test_read_format_zip_comment_stored.c \ + libarchive/test/test_read_format_zip_encryption_data.c \ + libarchive/test/test_read_format_zip_encryption_partially.c \ + libarchive/test/test_read_format_zip_encryption_header.c \ + libarchive/test/test_read_format_zip_filename.c \ + libarchive/test/test_read_format_zip_mac_metadata.c \ + libarchive/test/test_read_format_zip_malformed.c \ + libarchive/test/test_read_format_zip_msdos.c \ + libarchive/test/test_read_format_zip_nested.c \ + libarchive/test/test_read_format_zip_nofiletype.c \ + libarchive/test/test_read_format_zip_padded.c \ + libarchive/test/test_read_format_zip_sfx.c \ + libarchive/test/test_read_format_zip_traditional_encryption_data.c \ + libarchive/test/test_read_format_zip_winzip_aes.c \ + libarchive/test/test_read_format_zip_winzip_aes_large.c \ + libarchive/test/test_read_format_zip_zip64.c \ + libarchive/test/test_read_large.c \ + libarchive/test/test_read_pax_truncated.c \ + libarchive/test/test_read_position.c \ + libarchive/test/test_read_set_format.c \ + libarchive/test/test_read_too_many_filters.c \ + libarchive/test/test_read_truncated.c \ + libarchive/test/test_read_truncated_filter.c \ + libarchive/test/test_sparse_basic.c \ + libarchive/test/test_tar_filenames.c \ + libarchive/test/test_tar_large.c \ + libarchive/test/test_ustar_filenames.c \ + libarchive/test/test_ustar_filename_encoding.c \ + libarchive/test/test_warn_missing_hardlink_target.c \ + libarchive/test/test_write_disk.c \ + libarchive/test/test_write_disk_appledouble.c \ + libarchive/test/test_write_disk_failures.c \ + libarchive/test/test_write_disk_hardlink.c \ + libarchive/test/test_write_disk_hfs_compression.c \ + libarchive/test/test_write_disk_lookup.c \ + libarchive/test/test_write_disk_mac_metadata.c \ + libarchive/test/test_write_disk_no_hfs_compression.c \ + libarchive/test/test_write_disk_perms.c \ + libarchive/test/test_write_disk_secure.c \ + libarchive/test/test_write_disk_sparse.c \ + libarchive/test/test_write_disk_symlink.c \ + libarchive/test/test_write_disk_times.c \ + libarchive/test/test_write_filter_b64encode.c \ + libarchive/test/test_write_filter_bzip2.c \ + libarchive/test/test_write_filter_compress.c \ + libarchive/test/test_write_filter_gzip.c \ + libarchive/test/test_write_filter_gzip_timestamp.c \ + libarchive/test/test_write_filter_lrzip.c \ + libarchive/test/test_write_filter_lz4.c \ + libarchive/test/test_write_filter_lzip.c \ + libarchive/test/test_write_filter_lzma.c \ + libarchive/test/test_write_filter_lzop.c \ + libarchive/test/test_write_filter_program.c \ + libarchive/test/test_write_filter_uuencode.c \ + libarchive/test/test_write_filter_xz.c \ + libarchive/test/test_write_format_7zip.c \ + libarchive/test/test_write_format_7zip_empty.c \ + libarchive/test/test_write_format_7zip_large.c \ + libarchive/test/test_write_format_ar.c \ + libarchive/test/test_write_format_cpio.c \ + libarchive/test/test_write_format_cpio_empty.c \ + libarchive/test/test_write_format_cpio_newc.c \ + libarchive/test/test_write_format_cpio_odc.c \ + libarchive/test/test_write_format_gnutar.c \ + libarchive/test/test_write_format_iso9660.c \ + libarchive/test/test_write_format_iso9660_boot.c \ + libarchive/test/test_write_format_iso9660_empty.c \ + libarchive/test/test_write_format_iso9660_filename.c \ + libarchive/test/test_write_format_iso9660_zisofs.c \ + libarchive/test/test_write_format_mtree.c \ + libarchive/test/test_write_format_mtree_absolute_path.c \ + libarchive/test/test_write_format_mtree_classic.c \ libarchive/test/test_write_format_mtree_classic_indent.c\ - libarchive/test/test_write_format_mtree_fflags.c \ - libarchive/test/test_write_format_mtree_no_separator.c \ + libarchive/test/test_write_format_mtree_fflags.c \ + libarchive/test/test_write_format_mtree_no_separator.c \ libarchive/test/test_write_format_mtree_quoted_filename.c\ - libarchive/test/test_write_format_pax.c \ - libarchive/test/test_write_format_shar_empty.c \ - libarchive/test/test_write_format_tar.c \ - libarchive/test/test_write_format_tar_empty.c \ - libarchive/test/test_write_format_tar_sparse.c \ - libarchive/test/test_write_format_tar_ustar.c \ - libarchive/test/test_write_format_tar_v7tar.c \ - libarchive/test/test_write_format_xar.c \ - libarchive/test/test_write_format_xar_empty.c \ - libarchive/test/test_write_format_zip.c \ - libarchive/test/test_write_format_zip_empty.c \ - libarchive/test/test_write_format_zip_no_compression.c \ - libarchive/test/test_write_open_memory.c \ - libarchive/test/test_write_zip_set_compression_store.c \ + libarchive/test/test_write_format_pax.c \ + libarchive/test/test_write_format_raw.c \ + libarchive/test/test_write_format_raw_b64.c \ + libarchive/test/test_write_format_shar_empty.c \ + libarchive/test/test_write_format_tar.c \ + libarchive/test/test_write_format_tar_empty.c \ + libarchive/test/test_write_format_tar_sparse.c \ + libarchive/test/test_write_format_tar_ustar.c \ + libarchive/test/test_write_format_tar_v7tar.c \ + libarchive/test/test_write_format_warc.c \ + libarchive/test/test_write_format_warc_empty.c \ + libarchive/test/test_write_format_xar.c \ + libarchive/test/test_write_format_xar_empty.c \ + libarchive/test/test_write_format_zip.c \ + libarchive/test/test_write_format_zip_compression_store.c \ + libarchive/test/test_write_format_zip_empty.c \ + libarchive/test/test_write_format_zip_empty_zip64.c \ + libarchive/test/test_write_format_zip_file.c \ + libarchive/test/test_write_format_zip_file_zip64.c \ + libarchive/test/test_write_format_zip_large.c \ + libarchive/test/test_write_format_zip_zip64.c \ + libarchive/test/test_write_open_memory.c \ + libarchive/test/test_write_read_format_zip.c \ libarchive/test/test_zip_filename_encoding.c libarchive_test_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/test_utils -I$(top_builddir)/libarchive/test -DLIBARCHIVE_STATIC $(PLATFORMCPPFLAGS) @@ -508,56 +577,70 @@ libarchive_test_LDADD= $(LTLIBICONV) # Building it automatically provides a sanity-check on libarchive_test_SOURCES # above. libarchive/test/list.h: Makefile - cat $(top_srcdir)/libarchive/test/test_*.c | grep DEFINE_TEST > libarchive/test/list.h + $(MKDIR_P) libarchive/test + cat $(top_srcdir)/libarchive/test/test_*.c | grep '^DEFINE_TEST' > libarchive/test/list.h libarchive_TESTS_ENVIRONMENT= LIBARCHIVE_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/libarchive/test LRZIP=NOCONFIG libarchive_test_EXTRA_DIST=\ - libarchive/test/list.h \ - libarchive/test/test_acl_pax.tar.uu \ - libarchive/test/test_archive_string_conversion.txt.Z.uu \ - libarchive/test/test_compat_bzip2_1.tbz.uu \ - libarchive/test/test_compat_bzip2_2.tbz.uu \ - libarchive/test/test_compat_cpio_1.cpio.uu \ - libarchive/test/test_compat_gtar_1.tar.uu \ - libarchive/test/test_compat_gzip_1.tgz.uu \ - libarchive/test/test_compat_gzip_2.tgz.uu \ - libarchive/test/test_compat_lzip_1.tlz.uu \ - libarchive/test/test_compat_lzip_2.tlz.uu \ - libarchive/test/test_compat_lzma_1.tlz.uu \ - libarchive/test/test_compat_lzma_2.tlz.uu \ - libarchive/test/test_compat_lzma_3.tlz.uu \ - libarchive/test/test_compat_lzop_1.tar.lzo.uu \ - libarchive/test/test_compat_lzop_2.tar.lzo.uu \ - libarchive/test/test_compat_lzop_3.tar.lzo.uu \ - libarchive/test/test_compat_mac-1.tar.Z.uu \ - libarchive/test/test_compat_mac-2.tar.Z.uu \ - libarchive/test/test_compat_pax_libarchive_2x.tar.Z.uu \ - libarchive/test/test_compat_solaris_tar_acl.tar.uu \ - libarchive/test/test_compat_solaris_pax_sparse_1.pax.Z.uu \ - libarchive/test/test_compat_solaris_pax_sparse_2.pax.Z.uu \ - libarchive/test/test_compat_tar_hardlink_1.tar.uu \ - libarchive/test/test_compat_xz_1.txz.uu \ - libarchive/test/test_compat_zip_1.zip.uu \ - libarchive/test/test_compat_zip_2.zip.uu \ - libarchive/test/test_compat_zip_3.zip.uu \ - libarchive/test/test_compat_zip_4.zip.uu \ - libarchive/test/test_compat_zip_5.zip.uu \ - libarchive/test/test_compat_zip_6.zip.uu \ - libarchive/test/test_compat_zip_7.xps.uu \ - libarchive/test/test_fuzz_1.iso.Z.uu \ - libarchive/test/test_fuzz.cab.uu \ - libarchive/test/test_fuzz.lzh.uu \ - libarchive/test/test_pax_filename_encoding.tar.uu \ + libarchive/test/list.h \ + libarchive/test/test_acl_pax.tar.uu \ + libarchive/test/test_archive_string_conversion.txt.Z.uu \ + libarchive/test/test_compat_bzip2_1.tbz.uu \ + libarchive/test/test_compat_bzip2_2.tbz.uu \ + libarchive/test/test_compat_cpio_1.cpio.uu \ + libarchive/test/test_compat_gtar_1.tar.uu \ + libarchive/test/test_compat_gzip_1.tgz.uu \ + libarchive/test/test_compat_gzip_2.tgz.uu \ + libarchive/test/test_compat_lz4_1.tar.lz4.uu \ + libarchive/test/test_compat_lz4_2.tar.lz4.uu \ + libarchive/test/test_compat_lz4_3.tar.lz4.uu \ + libarchive/test/test_compat_lz4_B4.tar.lz4.uu \ + libarchive/test/test_compat_lz4_B4BD.tar.lz4.uu \ + libarchive/test/test_compat_lz4_B4BDBX.tar.lz4.uu \ + libarchive/test/test_compat_lz4_B5.tar.lz4.uu \ + libarchive/test/test_compat_lz4_B5BD.tar.lz4.uu \ + libarchive/test/test_compat_lz4_B6.tar.lz4.uu \ + libarchive/test/test_compat_lz4_B6BD.tar.lz4.uu \ + libarchive/test/test_compat_lz4_B7.tar.lz4.uu \ + libarchive/test/test_compat_lz4_B7BD.tar.lz4.uu \ + libarchive/test/test_compat_lzip_1.tlz.uu \ + libarchive/test/test_compat_lzip_2.tlz.uu \ + libarchive/test/test_compat_lzma_1.tlz.uu \ + libarchive/test/test_compat_lzma_2.tlz.uu \ + libarchive/test/test_compat_lzma_3.tlz.uu \ + libarchive/test/test_compat_lzop_1.tar.lzo.uu \ + libarchive/test/test_compat_lzop_2.tar.lzo.uu \ + libarchive/test/test_compat_lzop_3.tar.lzo.uu \ + libarchive/test/test_compat_mac-1.tar.Z.uu \ + libarchive/test/test_compat_mac-2.tar.Z.uu \ + libarchive/test/test_compat_pax_libarchive_2x.tar.Z.uu \ + libarchive/test/test_compat_solaris_pax_sparse_1.pax.Z.uu \ + libarchive/test/test_compat_solaris_pax_sparse_2.pax.Z.uu \ + libarchive/test/test_compat_solaris_tar_acl.tar.uu \ + libarchive/test/test_compat_tar_hardlink_1.tar.uu \ + libarchive/test/test_compat_uudecode_large.tar.Z.uu \ + libarchive/test/test_compat_xz_1.txz.uu \ + libarchive/test/test_compat_zip_1.zip.uu \ + libarchive/test/test_compat_zip_2.zip.uu \ + libarchive/test/test_compat_zip_3.zip.uu \ + libarchive/test/test_compat_zip_4.zip.uu \ + libarchive/test/test_compat_zip_5.zip.uu \ + libarchive/test/test_compat_zip_6.zip.uu \ + libarchive/test/test_compat_zip_7.xps.uu \ + libarchive/test/test_fuzz.cab.uu \ + libarchive/test/test_fuzz.lzh.uu \ + libarchive/test/test_fuzz_1.iso.Z.uu \ + libarchive/test/test_pax_filename_encoding.tar.uu \ libarchive/test/test_rar_multivolume_multiple_files.part1.rar.uu \ libarchive/test/test_rar_multivolume_multiple_files.part2.rar.uu \ libarchive/test/test_rar_multivolume_multiple_files.part3.rar.uu \ libarchive/test/test_rar_multivolume_multiple_files.part4.rar.uu \ libarchive/test/test_rar_multivolume_multiple_files.part5.rar.uu \ libarchive/test/test_rar_multivolume_multiple_files.part6.rar.uu \ - libarchive/test/test_rar_multivolume_single_file.part1.rar.uu \ - libarchive/test/test_rar_multivolume_single_file.part2.rar.uu \ - libarchive/test/test_rar_multivolume_single_file.part3.rar.uu \ + libarchive/test/test_rar_multivolume_single_file.part1.rar.uu \ + libarchive/test/test_rar_multivolume_single_file.part2.rar.uu \ + libarchive/test/test_rar_multivolume_single_file.part3.rar.uu \ libarchive/test/test_rar_multivolume_uncompressed_files.part01.rar.uu \ libarchive/test/test_rar_multivolume_uncompressed_files.part02.rar.uu \ libarchive/test/test_rar_multivolume_uncompressed_files.part03.rar.uu \ @@ -568,150 +651,184 @@ libarchive_test_EXTRA_DIST=\ libarchive/test/test_rar_multivolume_uncompressed_files.part08.rar.uu \ libarchive/test/test_rar_multivolume_uncompressed_files.part09.rar.uu \ libarchive/test/test_rar_multivolume_uncompressed_files.part10.rar.uu \ - libarchive/test/test_read_filter_grzip.tar.grz.uu \ - libarchive/test/test_read_filter_lrzip.tar.lrz.uu \ - libarchive/test/test_read_filter_lzop.tar.lzo.uu \ - libarchive/test/test_read_filter_lzop_multiple_parts.tar.lzo.uu \ - libarchive/test/test_read_format_7zip_bcj_bzip2.7z.uu \ - libarchive/test/test_read_format_7zip_bcj_copy.7z.uu \ - libarchive/test/test_read_format_7zip_bcj_deflate.7z.uu \ - libarchive/test/test_read_format_7zip_bcj_lzma1.7z.uu \ - libarchive/test/test_read_format_7zip_bcj_lzma2.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_bzip2.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_copy_1.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_copy_2.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_copy_lzma.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_deflate.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_lzma1_1.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_lzma1_2.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_lzma2_1.7z.uu \ - libarchive/test/test_read_format_7zip_bcj2_lzma2_2.7z.uu \ - libarchive/test/test_read_format_7zip_bzip2.7z.uu \ - 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_delta_lzma1.7z.uu \ - libarchive/test/test_read_format_7zip_delta_lzma2.7z.uu \ - libarchive/test/test_read_format_7zip_empty_archive.7z.uu \ - libarchive/test/test_read_format_7zip_empty_file.7z.uu \ - libarchive/test/test_read_format_7zip_lzma1.7z.uu \ - 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_ppmd.7z.uu \ - libarchive/test/test_read_format_7zip_symbolic_name.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 \ - libarchive/test/test_read_format_cab_3.cab.uu \ - libarchive/test/test_read_format_cab_filename_cp932.cab.uu \ - libarchive/test/test_read_format_cpio_bin_be.cpio.uu \ - libarchive/test/test_read_format_cpio_filename_cp866.cpio.uu \ - libarchive/test/test_read_format_cpio_filename_eucjp.cpio.uu \ - libarchive/test/test_read_format_cpio_filename_koi8r.cpio.uu \ - libarchive/test/test_read_format_cpio_filename_utf8_jp.cpio.uu \ - libarchive/test/test_read_format_cpio_filename_utf8_ru.cpio.uu \ - libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu \ - libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu \ - libarchive/test/test_read_format_gtar_filename_cp866.tar.Z.uu \ - libarchive/test/test_read_format_gtar_filename_eucjp.tar.Z.uu \ - libarchive/test/test_read_format_gtar_filename_koi8r.tar.Z.uu \ - libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu \ - libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu \ + libarchive/test/test_read_filter_grzip.tar.grz.uu \ + libarchive/test/test_read_filter_lrzip.tar.lrz.uu \ + libarchive/test/test_read_filter_lzop.tar.lzo.uu \ + libarchive/test/test_read_filter_lzop_multiple_parts.tar.lzo.uu \ + libarchive/test/test_read_format_7zip_bcj2_bzip2.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_copy_1.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_copy_2.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_copy_lzma.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_deflate.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_lzma1_1.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_lzma1_2.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_lzma2_1.7z.uu \ + libarchive/test/test_read_format_7zip_bcj2_lzma2_2.7z.uu \ + libarchive/test/test_read_format_7zip_bcj_bzip2.7z.uu \ + libarchive/test/test_read_format_7zip_bcj_copy.7z.uu \ + libarchive/test/test_read_format_7zip_bcj_deflate.7z.uu \ + libarchive/test/test_read_format_7zip_bcj_lzma1.7z.uu \ + libarchive/test/test_read_format_7zip_bcj_lzma2.7z.uu \ + libarchive/test/test_read_format_7zip_bzip2.7z.uu \ + 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_delta_lzma1.7z.uu \ + libarchive/test/test_read_format_7zip_delta_lzma2.7z.uu \ + libarchive/test/test_read_format_7zip_empty_archive.7z.uu \ + libarchive/test/test_read_format_7zip_empty_file.7z.uu \ + libarchive/test/test_read_format_7zip_encryption.7z.uu \ + libarchive/test/test_read_format_7zip_encryption_header.7z.uu \ + libarchive/test/test_read_format_7zip_encryption_partially.7z.uu \ + libarchive/test/test_read_format_7zip_lzma1.7z.uu \ + 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_malformed.7z.uu \ + libarchive/test/test_read_format_7zip_malformed2.7z.uu \ + libarchive/test/test_read_format_7zip_ppmd.7z.uu \ + libarchive/test/test_read_format_7zip_symbolic_name.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 \ + libarchive/test/test_read_format_cab_3.cab.uu \ + libarchive/test/test_read_format_cab_filename_cp932.cab.uu \ + libarchive/test/test_read_format_cpio_bin_be.cpio.uu \ + libarchive/test/test_read_format_cpio_bin_le.cpio.uu \ + libarchive/test/test_read_format_cpio_filename_cp866.cpio.uu \ + libarchive/test/test_read_format_cpio_filename_eucjp.cpio.uu \ + libarchive/test/test_read_format_cpio_filename_koi8r.cpio.uu \ + libarchive/test/test_read_format_cpio_filename_utf8_jp.cpio.uu \ + libarchive/test/test_read_format_cpio_filename_utf8_ru.cpio.uu \ + libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.rpm.uu \ + libarchive/test/test_read_format_cpio_svr4_gzip_rpm.rpm.uu \ + libarchive/test/test_read_format_gtar_filename_cp866.tar.Z.uu \ + libarchive/test/test_read_format_gtar_filename_eucjp.tar.Z.uu \ + libarchive/test/test_read_format_gtar_filename_koi8r.tar.Z.uu \ + libarchive/test/test_read_format_gtar_sparse_1_13.tar.uu \ + libarchive/test/test_read_format_gtar_sparse_1_17.tar.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix00.tar.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix01.tar.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix10.tar.uu \ libarchive/test/test_read_format_gtar_sparse_1_17_posix10_modified.tar.uu \ - libarchive/test/test_read_format_iso.iso.Z.uu \ - libarchive/test/test_read_format_iso_2.iso.Z.uu \ - libarchive/test/test_read_format_iso_joliet.iso.Z.uu \ - libarchive/test/test_read_format_iso_joliet_by_nero.iso.Z.uu \ - libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu \ - libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu \ - libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu \ - libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu\ - libarchive/test/test_read_format_iso_xorriso.iso.Z.uu \ - libarchive/test/test_read_format_iso_zisofs.iso.Z.uu \ - libarchive/test/test_read_format_lha_filename_cp932.lzh.uu \ - libarchive/test/test_read_format_lha_header0.lzh.uu \ - libarchive/test/test_read_format_lha_header1.lzh.uu \ - libarchive/test/test_read_format_lha_header2.lzh.uu \ - libarchive/test/test_read_format_lha_header3.lzh.uu \ - libarchive/test/test_read_format_lha_lh0.lzh.uu \ - libarchive/test/test_read_format_lha_lh6.lzh.uu \ - libarchive/test/test_read_format_lha_lh7.lzh.uu \ - libarchive/test/test_read_format_lha_withjunk.lzh.uu \ - libarchive/test/test_read_format_mtree.mtree.uu \ - libarchive/test/test_read_format_mtree_nomagic.mtree.uu \ - libarchive/test/test_read_format_mtree_nomagic2.mtree.uu \ - libarchive/test/test_read_format_mtree_nomagic3.mtree.uu \ - libarchive/test/test_read_format_rar.rar.uu \ - libarchive/test/test_read_format_rar_binary_data.rar.uu \ - libarchive/test/test_read_format_rar_compress_best.rar.uu \ - libarchive/test/test_read_format_rar_compress_normal.rar.uu \ - libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu \ - libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu\ - libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu\ - libarchive/test/test_read_format_rar_multivolume.part0003.rar.uu\ - libarchive/test/test_read_format_rar_multivolume.part0004.rar.uu\ - libarchive/test/test_read_format_rar_noeof.rar.uu \ - libarchive/test/test_read_format_rar_ppmd_lzss_conversion.rar.uu\ - libarchive/test/test_read_format_rar_sfx.exe.uu \ - libarchive/test/test_read_format_rar_subblock.rar.uu \ - libarchive/test/test_read_format_rar_unicode.rar.uu \ - libarchive/test/test_read_format_rar_windows.rar.uu \ - libarchive/test/test_read_format_raw.data.Z.uu \ - libarchive/test/test_read_format_raw.data.uu \ - libarchive/test/test_read_format_tar_empty_filename.tar.uu \ - libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu \ - libarchive/test/test_read_format_ustar_filename_cp866.tar.Z.uu \ - libarchive/test/test_read_format_ustar_filename_eucjp.tar.Z.uu \ - libarchive/test/test_read_format_ustar_filename_koi8r.tar.Z.uu \ - libarchive/test/test_read_format_zip.zip.uu \ - libarchive/test/test_read_format_zip_comment_stored_1.zip.uu \ - libarchive/test/test_read_format_zip_comment_stored_2.zip.uu \ - libarchive/test/test_read_format_zip_filename_cp866.zip.uu \ - libarchive/test/test_read_format_zip_filename_cp932.zip.uu \ - libarchive/test/test_read_format_zip_filename_koi8r.zip.uu \ - libarchive/test/test_read_format_zip_filename_utf8_jp.zip.uu \ - libarchive/test/test_read_format_zip_filename_utf8_ru2.zip.uu \ - libarchive/test/test_read_format_zip_filename_utf8_ru.zip.uu \ - libarchive/test/test_read_format_zip_length_at_end.zip.uu \ - libarchive/test/test_read_format_zip_mac_metadata.zip.uu \ - libarchive/test/test_read_format_zip_sfx.uu \ - libarchive/test/test_read_format_zip_symlink.zip.uu \ - libarchive/test/test_read_format_zip_ux.zip.uu \ - libarchive/test/test_read_large_splitted_rar_aa.uu \ - libarchive/test/test_read_large_splitted_rar_ab.uu \ - libarchive/test/test_read_large_splitted_rar_ac.uu \ - libarchive/test/test_read_large_splitted_rar_ad.uu \ - libarchive/test/test_read_large_splitted_rar_ae.uu \ - libarchive/test/test_read_splitted_rar_aa.uu \ - libarchive/test/test_read_splitted_rar_ab.uu \ - libarchive/test/test_read_splitted_rar_ac.uu \ - libarchive/test/test_read_splitted_rar_ad.uu \ - libarchive/test/test_splitted_rar_seek_support_aa.uu \ - libarchive/test/test_splitted_rar_seek_support_ab.uu \ - libarchive/test/test_splitted_rar_seek_support_ac.uu \ - libarchive/test/test_write_disk_appledouble.cpio.gz.uu \ - libarchive/test/test_write_disk_hfs_compression.tgz.uu \ - libarchive/test/test_write_disk_mac_metadata.tar.gz.uu \ - libarchive/test/test_write_disk_no_hfs_compression.tgz.uu \ - libarchive/test/CMakeLists.txt \ + libarchive/test/test_read_format_gtar_sparse_skip_entry.tar.Z.uu \ + libarchive/test/test_read_format_iso.iso.Z.uu \ + libarchive/test/test_read_format_iso_2.iso.Z.uu \ + libarchive/test/test_read_format_iso_joliet.iso.Z.uu \ + libarchive/test/test_read_format_iso_joliet_by_nero.iso.Z.uu \ + libarchive/test/test_read_format_iso_joliet_long.iso.Z.uu \ + libarchive/test/test_read_format_iso_joliet_rockridge.iso.Z.uu \ + libarchive/test/test_read_format_iso_multi_extent.iso.Z.uu \ + libarchive/test/test_read_format_iso_rockridge.iso.Z.uu \ + libarchive/test/test_read_format_iso_rockridge_ce.iso.Z.uu \ + libarchive/test/test_read_format_iso_rockridge_new.iso.Z.uu \ + libarchive/test/test_read_format_iso_rockridge_rr_moved.iso.Z.uu \ + libarchive/test/test_read_format_iso_xorriso.iso.Z.uu \ + libarchive/test/test_read_format_iso_zisofs.iso.Z.uu \ + libarchive/test/test_read_format_lha_bugfix_0.lzh.uu \ + libarchive/test/test_read_format_lha_filename_cp932.lzh.uu \ + libarchive/test/test_read_format_lha_header0.lzh.uu \ + libarchive/test/test_read_format_lha_header1.lzh.uu \ + libarchive/test/test_read_format_lha_header2.lzh.uu \ + libarchive/test/test_read_format_lha_header3.lzh.uu \ + libarchive/test/test_read_format_lha_lh0.lzh.uu \ + libarchive/test/test_read_format_lha_lh6.lzh.uu \ + libarchive/test/test_read_format_lha_lh7.lzh.uu \ + libarchive/test/test_read_format_lha_withjunk.lzh.uu \ + libarchive/test/test_read_format_mtree.mtree.uu \ + libarchive/test/test_read_format_mtree_nomagic.mtree.uu \ + libarchive/test/test_read_format_mtree_nomagic2.mtree.uu \ + libarchive/test/test_read_format_mtree_nomagic3.mtree.uu \ + libarchive/test/test_read_format_rar.rar.uu \ + libarchive/test/test_read_format_rar_binary_data.rar.uu \ + libarchive/test/test_read_format_rar_compress_best.rar.uu \ + libarchive/test/test_read_format_rar_compress_normal.rar.uu \ + libarchive/test/test_read_format_rar_encryption_data.rar.uu \ + libarchive/test/test_read_format_rar_encryption_header.rar.uu \ + libarchive/test/test_read_format_rar_encryption_partially.rar.uu \ + libarchive/test/test_read_format_rar_multi_lzss_blocks.rar.uu \ + libarchive/test/test_read_format_rar_multivolume.part0001.rar.uu \ + libarchive/test/test_read_format_rar_multivolume.part0002.rar.uu \ + libarchive/test/test_read_format_rar_multivolume.part0003.rar.uu \ + libarchive/test/test_read_format_rar_multivolume.part0004.rar.uu \ + libarchive/test/test_read_format_rar_noeof.rar.uu \ + libarchive/test/test_read_format_rar_ppmd_lzss_conversion.rar.uu \ + libarchive/test/test_read_format_rar_sfx.exe.uu \ + libarchive/test/test_read_format_rar_subblock.rar.uu \ + libarchive/test/test_read_format_rar_unicode.rar.uu \ + libarchive/test/test_read_format_rar_windows.rar.uu \ + libarchive/test/test_read_format_raw.data.Z.uu \ + libarchive/test/test_read_format_raw.data.uu \ + libarchive/test/test_read_format_tar_concatenated.tar.uu \ + libarchive/test/test_read_format_tar_empty_filename.tar.uu \ + libarchive/test/test_read_format_tar_empty_pax.tar.Z.uu \ + libarchive/test/test_read_format_tar_filename_koi8r.tar.Z.uu \ + libarchive/test/test_read_format_ustar_filename_cp866.tar.Z.uu \ + libarchive/test/test_read_format_ustar_filename_eucjp.tar.Z.uu \ + libarchive/test/test_read_format_ustar_filename_koi8r.tar.Z.uu \ + libarchive/test/test_read_format_warc.warc.uu \ + libarchive/test/test_read_format_zip.zip.uu \ + libarchive/test/test_read_format_zip_comment_stored_1.zip.uu \ + libarchive/test/test_read_format_zip_comment_stored_2.zip.uu \ + libarchive/test/test_read_format_zip_encryption_data.zip.uu \ + libarchive/test/test_read_format_zip_encryption_header.zip.uu \ + libarchive/test/test_read_format_zip_encryption_partially.zip.uu \ + libarchive/test/test_read_format_zip_filename_cp866.zip.uu \ + libarchive/test/test_read_format_zip_filename_cp932.zip.uu \ + libarchive/test/test_read_format_zip_filename_koi8r.zip.uu \ + libarchive/test/test_read_format_zip_filename_utf8_jp.zip.uu \ + libarchive/test/test_read_format_zip_filename_utf8_ru.zip.uu \ + libarchive/test/test_read_format_zip_filename_utf8_ru2.zip.uu \ + libarchive/test/test_read_format_zip_length_at_end.zip.uu \ + libarchive/test/test_read_format_zip_mac_metadata.zip.uu \ + libarchive/test/test_read_format_zip_malformed1.zip.uu \ + libarchive/test/test_read_format_zip_msdos.zip.uu \ + libarchive/test/test_read_format_zip_nested.zip.uu \ + libarchive/test/test_read_format_zip_nofiletype.zip.uu \ + libarchive/test/test_read_format_zip_padded1.zip.uu \ + libarchive/test/test_read_format_zip_padded2.zip.uu \ + libarchive/test/test_read_format_zip_padded3.zip.uu \ + libarchive/test/test_read_format_zip_sfx.uu \ + libarchive/test/test_read_format_zip_symlink.zip.uu \ + libarchive/test/test_read_format_zip_traditional_encryption_data.zip.uu \ + libarchive/test/test_read_format_zip_ux.zip.uu \ + libarchive/test/test_read_format_zip_winzip_aes128.zip.uu \ + libarchive/test/test_read_format_zip_winzip_aes256.zip.uu \ + libarchive/test/test_read_format_zip_winzip_aes256_large.zip.uu \ + libarchive/test/test_read_format_zip_winzip_aes256_stored.zip.uu \ + libarchive/test/test_read_format_zip_zip64a.zip.uu \ + libarchive/test/test_read_format_zip_zip64b.zip.uu \ + libarchive/test/test_read_large_splitted_rar_aa.uu \ + libarchive/test/test_read_large_splitted_rar_ab.uu \ + libarchive/test/test_read_large_splitted_rar_ac.uu \ + libarchive/test/test_read_large_splitted_rar_ad.uu \ + libarchive/test/test_read_large_splitted_rar_ae.uu \ + libarchive/test/test_read_splitted_rar_aa.uu \ + libarchive/test/test_read_splitted_rar_ab.uu \ + libarchive/test/test_read_splitted_rar_ac.uu \ + libarchive/test/test_read_splitted_rar_ad.uu \ + libarchive/test/test_read_too_many_filters.gz.uu \ + libarchive/test/test_splitted_rar_seek_support_aa.uu \ + libarchive/test/test_splitted_rar_seek_support_ab.uu \ + libarchive/test/test_splitted_rar_seek_support_ac.uu \ + libarchive/test/test_write_disk_appledouble.cpio.gz.uu \ + libarchive/test/test_write_disk_hfs_compression.tgz.uu \ + libarchive/test/test_write_disk_mac_metadata.tar.gz.uu \ + libarchive/test/test_write_disk_no_hfs_compression.tgz.uu \ + libarchive/test/CMakeLists.txt \ libarchive/test/README # # Common code for libarchive frontends (cpio, tar) # -libarchive_fe_la_SOURCES= \ - libarchive_fe/err.c \ - libarchive_fe/err.h \ - libarchive_fe/lafe_platform.h \ - libarchive_fe/line_reader.c \ - libarchive_fe/line_reader.h +libarchive_fe_la_SOURCES= \ + libarchive_fe/err.c \ + libarchive_fe/err.h \ + libarchive_fe/lafe_platform.h \ + libarchive_fe/line_reader.c \ + libarchive_fe/line_reader.h \ + libarchive_fe/passphrase.c \ + libarchive_fe/passphrase.h libarchive_fe_la_CPPFLAGS= -I$(top_srcdir)/libarchive # @@ -720,20 +837,20 @@ libarchive_fe_la_CPPFLAGS= -I$(top_srcdir)/libarchive # # -bsdtar_SOURCES= \ - tar/bsdtar.c \ - tar/bsdtar.h \ - tar/bsdtar_platform.h \ - tar/cmdline.c \ - tar/creation_set.c \ - tar/read.c \ - tar/subst.c \ - tar/util.c \ +bsdtar_SOURCES= \ + tar/bsdtar.c \ + tar/bsdtar.h \ + tar/bsdtar_platform.h \ + tar/cmdline.c \ + tar/creation_set.c \ + tar/read.c \ + tar/subst.c \ + tar/util.c \ tar/write.c if INC_WINDOWS_FILES -bsdtar_SOURCES+= \ - tar/bsdtar_windows.h \ +bsdtar_SOURCES+= \ + tar/bsdtar_windows.h \ tar/bsdtar_windows.c endif @@ -751,11 +868,11 @@ bsdtar_LDADD= libarchive.la libarchive_fe.la $(LTLIBICONV) bsdtar_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdtar_ccstatic) $(PLATFORMCPPFLAGS) bsdtar_LDFLAGS= $(bsdtar_ldstatic) -bsdtar_EXTRA_DIST= \ - tar/bsdtar.1 \ - tar/bsdtar_windows.h \ - tar/bsdtar_windows.c \ - tar/CMakeLists.txt \ +bsdtar_EXTRA_DIST= \ + tar/bsdtar.1 \ + tar/bsdtar_windows.h \ + tar/bsdtar_windows.c \ + tar/CMakeLists.txt \ tar/config_freebsd.h @@ -771,61 +888,65 @@ endif # bsdtar_test # -bsdtar_test_SOURCES= \ - $(test_utils_SOURCES) \ - tar/test/main.c \ - tar/test/test.h \ - tar/test/test_0.c \ - tar/test/test_basic.c \ - tar/test/test_copy.c \ - tar/test/test_empty_mtree.c \ - tar/test/test_extract_tar_Z.c \ - tar/test/test_extract_tar_bz2.c \ - tar/test/test_extract_tar_grz.c \ - tar/test/test_extract_tar_gz.c \ - tar/test/test_extract_tar_lrz.c \ - tar/test/test_extract_tar_lz.c \ - tar/test/test_extract_tar_lzma.c \ - tar/test/test_extract_tar_lzo.c \ - tar/test/test_extract_tar_xz.c \ - tar/test/test_format_newc.c \ - tar/test/test_help.c \ - tar/test/test_option_C_upper.c \ - tar/test/test_option_H_upper.c \ - tar/test/test_option_L_upper.c \ - tar/test/test_option_O_upper.c \ - tar/test/test_option_T_upper.c \ - tar/test/test_option_U_upper.c \ - tar/test/test_option_X_upper.c \ - tar/test/test_option_a.c \ - tar/test/test_option_b.c \ - tar/test/test_option_b64encode.c \ - tar/test/test_option_exclude.c \ - tar/test/test_option_gid_gname.c \ - tar/test/test_option_grzip.c \ - tar/test/test_option_j.c \ - tar/test/test_option_k.c \ - tar/test/test_option_keep_newer_files.c \ - tar/test/test_option_lrzip.c \ - tar/test/test_option_lzma.c \ - tar/test/test_option_lzop.c \ - tar/test/test_option_n.c \ - tar/test/test_option_newer_than.c \ - tar/test/test_option_nodump.c \ - tar/test/test_option_older_than.c \ - tar/test/test_option_q.c \ - tar/test/test_option_r.c \ - tar/test/test_option_s.c \ - tar/test/test_option_uid_uname.c \ - tar/test/test_option_uuencode.c \ - tar/test/test_option_xz.c \ - tar/test/test_option_z.c \ - tar/test/test_patterns.c \ - tar/test/test_print_longpath.c \ - tar/test/test_stdio.c \ - tar/test/test_strip_components.c \ - tar/test/test_symlink_dir.c \ - tar/test/test_version.c \ +bsdtar_test_SOURCES= \ + $(test_utils_SOURCES) \ + tar/test/main.c \ + tar/test/test.h \ + tar/test/test_0.c \ + tar/test/test_basic.c \ + tar/test/test_copy.c \ + tar/test/test_empty_mtree.c \ + tar/test/test_extract_tar_Z.c \ + tar/test/test_extract_tar_bz2.c \ + tar/test/test_extract_tar_grz.c \ + tar/test/test_extract_tar_gz.c \ + tar/test/test_extract_tar_lrz.c \ + tar/test/test_extract_tar_lz.c \ + tar/test/test_extract_tar_lz4.c \ + tar/test/test_extract_tar_lzma.c \ + tar/test/test_extract_tar_lzo.c \ + tar/test/test_extract_tar_xz.c \ + tar/test/test_format_newc.c \ + tar/test/test_help.c \ + tar/test/test_leading_slash.c \ + tar/test/test_option_C_upper.c \ + tar/test/test_option_H_upper.c \ + tar/test/test_option_L_upper.c \ + tar/test/test_option_O_upper.c \ + tar/test/test_option_T_upper.c \ + tar/test/test_option_U_upper.c \ + tar/test/test_option_X_upper.c \ + tar/test/test_option_a.c \ + tar/test/test_option_b.c \ + tar/test/test_option_b64encode.c \ + tar/test/test_option_exclude.c \ + tar/test/test_option_gid_gname.c \ + tar/test/test_option_grzip.c \ + tar/test/test_option_j.c \ + tar/test/test_option_k.c \ + tar/test/test_option_keep_newer_files.c \ + tar/test/test_option_lrzip.c \ + tar/test/test_option_lz4.c \ + tar/test/test_option_lzma.c \ + tar/test/test_option_lzop.c \ + tar/test/test_option_n.c \ + tar/test/test_option_newer_than.c \ + tar/test/test_option_nodump.c \ + tar/test/test_option_older_than.c \ + tar/test/test_option_passphrase.c \ + tar/test/test_option_q.c \ + tar/test/test_option_r.c \ + tar/test/test_option_s.c \ + tar/test/test_option_uid_uname.c \ + tar/test/test_option_uuencode.c \ + tar/test/test_option_xz.c \ + tar/test/test_option_z.c \ + tar/test/test_patterns.c \ + tar/test/test_print_longpath.c \ + tar/test/test_stdio.c \ + tar/test/test_strip_components.c \ + tar/test/test_symlink_dir.c \ + tar/test/test_version.c \ tar/test/test_windows.c bsdtar_test_CPPFLAGS=\ @@ -835,7 +956,8 @@ bsdtar_test_CPPFLAGS=\ $(PLATFORMCPPFLAGS) tar/test/list.h: Makefile - cat $(top_srcdir)/tar/test/test_*.c | grep DEFINE_TEST > tar/test/list.h + $(MKDIR_P) tar/test + cat $(top_srcdir)/tar/test/test_*.c | grep '^DEFINE_TEST' > tar/test/list.h if BUILD_BSDTAR bsdtar_test_programs= bsdtar_test @@ -845,22 +967,25 @@ bsdtar_test_programs= bsdtar_TESTS_ENVIRONMENT= endif -bsdtar_test_EXTRA_DIST= \ +bsdtar_test_EXTRA_DIST= \ tar/test/list.h \ - tar/test/test_extract.tar.Z.uu \ + tar/test/test_extract.tar.Z.uu \ tar/test/test_extract.tar.bz2.uu \ tar/test/test_extract.tar.grz.uu \ - tar/test/test_extract.tar.gz.uu \ + tar/test/test_extract.tar.gz.uu \ tar/test/test_extract.tar.lrz.uu \ - tar/test/test_extract.tar.lz.uu \ + tar/test/test_extract.tar.lz.uu \ + tar/test/test_extract.tar.lz4.uu \ tar/test/test_extract.tar.lzma.uu \ tar/test/test_extract.tar.lzo.uu \ tar/test/test_extract.tar.xz.uu \ + tar/test/test_leading_slash.tar.uu \ tar/test/test_option_keep_newer_files.tar.Z.uu \ + tar/test/test_option_passphrase.zip.uu \ tar/test/test_option_s.tar.Z.uu \ - tar/test/test_patterns_2.tar.uu \ - tar/test/test_patterns_3.tar.uu \ - tar/test/test_patterns_4.tar.uu \ + tar/test/test_patterns_2.tar.uu \ + tar/test/test_patterns_3.tar.uu \ + tar/test/test_patterns_4.tar.uu \ tar/test/test_print_longpath.tar.Z.uu \ tar/test/CMakeLists.txt @@ -871,15 +996,15 @@ bsdtar_test_EXTRA_DIST= \ # # -bsdcpio_SOURCES= \ - cpio/cmdline.c \ - cpio/cpio.c \ - cpio/cpio.h \ +bsdcpio_SOURCES= \ + cpio/cmdline.c \ + cpio/cpio.c \ + cpio/cpio.h \ cpio/cpio_platform.h if INC_WINDOWS_FILES -bsdcpio_SOURCES+= \ - cpio/cpio_windows.h \ +bsdcpio_SOURCES+= \ + cpio/cpio_windows.h \ cpio/cpio_windows.c endif @@ -898,11 +1023,11 @@ bsdcpio_LDADD= libarchive_fe.la libarchive.la $(LTLIBICONV) bsdcpio_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcpio_ccstatic) $(PLATFORMCPPFLAGS) bsdcpio_LDFLAGS= $(bsdcpio_ldstatic) -bsdcpio_EXTRA_DIST= \ - cpio/bsdcpio.1 \ - cpio/cpio_windows.h \ - cpio/cpio_windows.c \ - cpio/CMakeLists.txt \ +bsdcpio_EXTRA_DIST= \ + cpio/bsdcpio.1 \ + cpio/cpio_windows.h \ + cpio/cpio_windows.c \ + cpio/CMakeLists.txt \ cpio/config_freebsd.h @@ -919,52 +1044,55 @@ endif # bsdcpio_test # -bsdcpio_test_SOURCES= \ - $(test_utils_SOURCES) \ - cpio/cmdline.c \ - cpio/test/main.c \ - cpio/test/test.h \ - cpio/test/test_0.c \ - cpio/test/test_basic.c \ - cpio/test/test_cmdline.c \ - cpio/test/test_extract_cpio_Z.c \ - cpio/test/test_extract_cpio_bz2.c \ - cpio/test/test_extract_cpio_grz.c \ - cpio/test/test_extract_cpio_gz.c \ - cpio/test/test_extract_cpio_lrz.c \ - cpio/test/test_extract_cpio_lz.c \ - cpio/test/test_extract_cpio_lzma.c \ - cpio/test/test_extract_cpio_lzo.c \ - cpio/test/test_extract_cpio_xz.c \ - cpio/test/test_format_newc.c \ - cpio/test/test_gcpio_compat.c \ - cpio/test/test_option_0.c \ - cpio/test/test_option_B_upper.c \ - cpio/test/test_option_C_upper.c \ - cpio/test/test_option_J_upper.c \ - cpio/test/test_option_L_upper.c \ - cpio/test/test_option_Z_upper.c \ - cpio/test/test_option_a.c \ - cpio/test/test_option_b64encode.c \ - cpio/test/test_option_c.c \ - cpio/test/test_option_d.c \ - cpio/test/test_option_f.c \ - cpio/test/test_option_grzip.c \ - cpio/test/test_option_help.c \ - cpio/test/test_option_l.c \ - cpio/test/test_option_lrzip.c \ - cpio/test/test_option_lzma.c \ - cpio/test/test_option_lzop.c \ - cpio/test/test_option_m.c \ - cpio/test/test_option_t.c \ - cpio/test/test_option_u.c \ - cpio/test/test_option_uuencode.c \ - cpio/test/test_option_version.c \ - cpio/test/test_option_xz.c \ - cpio/test/test_option_y.c \ - cpio/test/test_option_z.c \ - cpio/test/test_owner_parse.c \ - cpio/test/test_passthrough_dotdot.c \ +bsdcpio_test_SOURCES= \ + $(test_utils_SOURCES) \ + cpio/cmdline.c \ + cpio/test/main.c \ + cpio/test/test.h \ + cpio/test/test_0.c \ + cpio/test/test_basic.c \ + cpio/test/test_cmdline.c \ + cpio/test/test_extract_cpio_Z.c \ + cpio/test/test_extract_cpio_bz2.c \ + cpio/test/test_extract_cpio_grz.c \ + cpio/test/test_extract_cpio_gz.c \ + cpio/test/test_extract_cpio_lrz.c \ + cpio/test/test_extract_cpio_lz.c \ + cpio/test/test_extract_cpio_lz4.c \ + cpio/test/test_extract_cpio_lzma.c \ + cpio/test/test_extract_cpio_lzo.c \ + cpio/test/test_extract_cpio_xz.c \ + cpio/test/test_format_newc.c \ + cpio/test/test_gcpio_compat.c \ + cpio/test/test_option_0.c \ + cpio/test/test_option_B_upper.c \ + cpio/test/test_option_C_upper.c \ + cpio/test/test_option_J_upper.c \ + cpio/test/test_option_L_upper.c \ + cpio/test/test_option_Z_upper.c \ + cpio/test/test_option_a.c \ + cpio/test/test_option_b64encode.c \ + cpio/test/test_option_c.c \ + cpio/test/test_option_d.c \ + cpio/test/test_option_f.c \ + cpio/test/test_option_grzip.c \ + cpio/test/test_option_help.c \ + cpio/test/test_option_l.c \ + cpio/test/test_option_lrzip.c \ + cpio/test/test_option_lz4.c \ + cpio/test/test_option_lzma.c \ + cpio/test/test_option_lzop.c \ + cpio/test/test_option_m.c \ + cpio/test/test_option_passphrase.c \ + cpio/test/test_option_t.c \ + cpio/test/test_option_u.c \ + cpio/test/test_option_uuencode.c \ + cpio/test/test_option_version.c \ + cpio/test/test_option_xz.c \ + cpio/test/test_option_y.c \ + cpio/test/test_option_z.c \ + cpio/test/test_owner_parse.c \ + cpio/test/test_passthrough_dotdot.c \ cpio/test/test_passthrough_reverse.c bsdcpio_test_CPPFLAGS= \ @@ -975,7 +1103,8 @@ bsdcpio_test_CPPFLAGS= \ bsdcpio_test_LDADD=libarchive_fe.la cpio/test/list.h: Makefile - cat $(top_srcdir)/cpio/test/test_*.c | grep DEFINE_TEST > cpio/test/list.h + $(MKDIR_P) cpio/test + cat $(top_srcdir)/cpio/test/test_*.c | grep '^DEFINE_TEST' > cpio/test/list.h if BUILD_BSDCPIO bsdcpio_test_programs= bsdcpio_test @@ -985,28 +1114,130 @@ bsdcpio_test_programs= bsdcpio_TESTS_ENVIRONMENT= endif -bsdcpio_test_EXTRA_DIST= \ - cpio/test/list.h \ - cpio/test/test_extract.cpio.Z.uu \ - cpio/test/test_extract.cpio.bz2.uu \ - cpio/test/test_extract.cpio.grz.uu \ - cpio/test/test_extract.cpio.gz.uu \ - cpio/test/test_extract.cpio.lrz.uu \ - cpio/test/test_extract.cpio.lz.uu \ - cpio/test/test_extract.cpio.lzma.uu \ - cpio/test/test_extract.cpio.lzo.uu \ - cpio/test/test_extract.cpio.xz.uu \ - cpio/test/test_gcpio_compat_ref.bin.uu \ - cpio/test/test_gcpio_compat_ref.crc.uu \ - cpio/test/test_gcpio_compat_ref.newc.uu \ +bsdcpio_test_EXTRA_DIST= \ + cpio/test/list.h \ + cpio/test/test_extract.cpio.Z.uu \ + cpio/test/test_extract.cpio.bz2.uu \ + cpio/test/test_extract.cpio.grz.uu \ + cpio/test/test_extract.cpio.gz.uu \ + cpio/test/test_extract.cpio.lrz.uu \ + cpio/test/test_extract.cpio.lz.uu \ + cpio/test/test_extract.cpio.lz4.uu \ + cpio/test/test_extract.cpio.lzma.uu \ + cpio/test/test_extract.cpio.lzo.uu \ + cpio/test/test_extract.cpio.xz.uu \ + cpio/test/test_gcpio_compat_ref.bin.uu \ + cpio/test/test_gcpio_compat_ref.crc.uu \ + cpio/test/test_gcpio_compat_ref.newc.uu \ cpio/test/test_gcpio_compat_ref.ustar.uu \ cpio/test/test_gcpio_compat_ref_nosym.bin.uu \ cpio/test/test_gcpio_compat_ref_nosym.crc.uu \ cpio/test/test_gcpio_compat_ref_nosym.newc.uu \ cpio/test/test_gcpio_compat_ref_nosym.ustar.uu \ - cpio/test/test_option_f.cpio.uu \ - cpio/test/test_option_m.cpio.uu \ - cpio/test/test_option_t.cpio.uu \ - cpio/test/test_option_t.stdout.uu \ - cpio/test/test_option_tv.stdout.uu \ + cpio/test/test_option_f.cpio.uu \ + cpio/test/test_option_m.cpio.uu \ + cpio/test/test_option_passphrase.zip.uu \ + cpio/test/test_option_t.cpio.uu \ + cpio/test/test_option_t.stdout.uu \ + cpio/test/test_option_tv.stdout.uu \ cpio/test/CMakeLists.txt + +# +# +# bsdcat source, docs, etc. +# +# + +bsdcat_SOURCES= \ + cat/bsdcat.c \ + cat/bsdcat.h \ + cat/bsdcat_platform.h \ + cat/cmdline.c + +if INC_WINDOWS_FILES +bsdcat_SOURCES+= +endif + +bsdcat_DEPENDENCIES = libarchive.la libarchive_fe.la + + +if STATIC_BSDCAT +bsdcat_ldstatic= -static +bsdcat_ccstatic= -DLIBARCHIVE_STATIC +else +bsdcat_ldstatic= +bsdcat_ccstatic= +endif + +bsdcat_LDADD= libarchive_fe.la libarchive.la $(LTLIBICONV) +bsdcat_CPPFLAGS= -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe $(bsdcat_ccstatic) $(PLATFORMCPPFLAGS) +bsdcat_LDFLAGS= $(bsdcat_ldstatic) + +bsdcat_EXTRA_DIST= \ + cat/bsdcat.1 \ + cat/CMakeLists.txt + + +if BUILD_BSDCAT +# Manpages to install +bsdcat_man_MANS= cat/bsdcat.1 +bsdcat_programs= bsdcat +else +bsdcat_man_MANS= +bsdcat_programs= +endif + +# +# bsdcat_test +# + +bsdcat_test_SOURCES= \ + $(test_utils_SOURCES) \ + cat/test/main.c \ + cat/test/test.h \ + cat/test/test_0.c \ + cat/test/test_empty_gz.c \ + cat/test/test_empty_lz4.c \ + cat/test/test_empty_xz.c \ + cat/test/test_error.c \ + cat/test/test_error_mixed.c \ + cat/test/test_expand_Z.c \ + cat/test/test_expand_bz2.c \ + cat/test/test_expand_gz.c \ + cat/test/test_expand_lz4.c \ + cat/test/test_expand_mixed.c \ + cat/test/test_expand_plain.c \ + cat/test/test_expand_xz.c \ + cat/test/test_help.c \ + cat/test/test_version.c + +bsdcat_test_CPPFLAGS= \ + -I$(top_srcdir)/libarchive -I$(top_srcdir)/libarchive_fe \ + -I$(top_srcdir)/test_utils \ + -I$(top_srcdir)/cat -I$(top_builddir)/cat/test \ + $(PLATFORMCPPFLAGS) +bsdcat_test_LDADD=libarchive_fe.la + +cat/test/list.h: Makefile + cat $(top_srcdir)/cat/test/test_*.c | grep '^DEFINE_TEST' > cat/test/list.h + +if BUILD_BSDCAT +bsdcat_test_programs= bsdcat_test +bsdcat_TESTS_ENVIRONMENT= BSDCAT=`cd $(top_builddir);/bin/pwd`/bsdcat$(EXEEXT) BSDCAT_TEST_FILES=`cd $(top_srcdir);/bin/pwd`/cat/test +else +bsdcat_test_programs= +bsdcat_TESTS_ENVIRONMENT= +endif + +bsdcat_test_EXTRA_DIST= \ + cat/test/list.h \ + cat/test/test_empty.gz.uu \ + cat/test/test_empty.lz4.uu \ + cat/test/test_empty.xz.uu \ + cat/test/test_expand.Z.uu \ + cat/test/test_expand.bz2.uu \ + cat/test/test_expand.gz.uu \ + cat/test/test_expand.lz4.uu \ + cat/test/test_expand.plain.uu \ + cat/test/test_expand.xz.uu \ + cat/test/CMakeLists.txt diff --git a/NEWS b/NEWS index 107d4da0f11e..5bf877606244 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,35 @@ +Apr 09, 2016: libarchive 3.1.901a released + Another test release in preparation for 3.2.0 + +Feb 13, 2016: libarchive 3.1.900a released + This is a test release in preparation for 3.2.0 + +Oct 21, 2015: Preliminary port to OSF + +Apr 11, 2015: libarchive's issue tracker is now hosted at GitHub. + https://github.com/libarchive/libarchive/issues + +Early 2015: Many fixes to crash and overflow bugs thanks to Hanno Boeck + +Oct 13, 2014: Zip encryption and decryption support + +Aug 13, 2014: Add support for lz4 compression. + +Jun 10, 2014: Add warc format support + +May 3, 2014: Add experimental Zip streaming extension + +Apr 6, 2014: Add bsdcat command-line tool + +Jan 12, 2014: Add Zip64 support + +Dec 1, 2013: Rewrite Zip write logic + +Jul 1, 2013: Add ability to detect encrypted entries for many formats + (This does not add the ability to *decrypt* those entries, however) + +Feb 23, 2013: "raw" write support added + Feb 09, 2013: libarchive 3.1.2 released Jan 28, 2013: libarchive's new website moved to http://www.libarchive.org. diff --git a/README b/README index 1c974fde2202..180d28459e5f 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ Questions? Issues? libarchive development, including documentation, and links to the libarchive mailing lists. * To report an issue, use the issue tracker at - http://code.google.com/p/libarchive/issues/list + https://github.com/libarchive/libarchive/issues * To submit an enhancement to libarchive, please submit a pull request via GitHub. https://github.com/libarchive/libarchive/pulls @@ -13,9 +13,11 @@ Questions? Issues? This distribution bundle includes the following components: * libarchive: a library for reading and writing streaming archives * tar: the 'bsdtar' program is a full-featured 'tar' - replacement built on libarchive + 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 * 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; @@ -39,6 +41,7 @@ The following files in the top-level directory are used by the Guide to Documentation installed by this system: * bsdtar.1 explains the use of the bsdtar program * bsdcpio.1 explains the use of the bsdcpio program + * bsdcat.1 explains the use of the bsdcat program * libarchive.3 gives an overview of the library as a whole * archive_read.3, archive_write.3, archive_write_disk.3, and archive_read_disk.3 provide detailed calling sequences for the read @@ -84,6 +87,8 @@ The library also detects and handles any of the following before evaluating the * bzip2 compression * compress/LZW compression * lzma, lzip, and xz compression + * lz4 compression + * lzop compression The library can create archives in any of the following formats: * POSIX ustar @@ -91,6 +96,7 @@ The library can create archives in any of the following formats: * "restricted" pax format, which will create ustar archives except for entries that require pax extensions (for long filenames, ACLs, etc). * Old GNU tar format + * Old V7 tar format * POSIX octet-oriented cpio * SVR4 "newc" cpio * shar archives @@ -107,6 +113,8 @@ When creating archives, the result can be filtered with any of the following: * bzip2 compression * compress/LZW compression * lzma, lzip, and xz compression + * lz4 compression + * lzop compression Notes about the library architecture: @@ -123,12 +131,12 @@ Notes about the library architecture: * I've attempted to minimize static link pollution. If you don't explicitly invoke a particular feature (such as support for a - particular compression or format), it won't get pulled in. - In particular, if you don't explicitly enable a particular - compression or decompression support, you won't need to link - against the corresponding compression or decompression libraries. - This also reduces the size of statically-linked binaries in - environments where that matters. + particular compression or format), it won't get pulled in to + statically-linked programs. In particular, if you don't explicitly + enable a particular compression or decompression support, you won't + need to link against the corresponding compression or decompression + libraries. This also reduces the size of statically-linked + binaries in environments where that matters. * On read, the library accepts whatever blocks you hand it. Your read callback is free to pass the library a byte at a time diff --git a/build/autoconf/ax_append_compile_flags.m4 b/build/autoconf/ax_append_compile_flags.m4 new file mode 100644 index 000000000000..2bb27ef2b1b4 --- /dev/null +++ b/build/autoconf/ax_append_compile_flags.m4 @@ -0,0 +1,67 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_append_compile_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_COMPILE_FLAGS([FLAG1 FLAG2 ...], [FLAGS-VARIABLE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# For every FLAG1, FLAG2 it is checked whether the compiler works with the +# flag. If it does, the flag is added FLAGS-VARIABLE +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. During the check the flag is always added to the +# current language's flags. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: This macro depends on the AX_APPEND_FLAG and +# AX_CHECK_COMPILE_FLAG. Please keep this macro in sync with +# AX_APPEND_LINK_FLAGS. +# +# LICENSE +# +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 5 + +AC_DEFUN([AX_APPEND_COMPILE_FLAGS], +[AX_REQUIRE_DEFINED([AX_CHECK_COMPILE_FLAG]) +AX_REQUIRE_DEFINED([AX_APPEND_FLAG]) +for flag in $1; do + AX_CHECK_COMPILE_FLAG([$flag], [AX_APPEND_FLAG([$flag], [$2])], [], [$3], [$4]) +done +])dnl AX_APPEND_COMPILE_FLAGS diff --git a/build/autoconf/ax_append_flag.m4 b/build/autoconf/ax_append_flag.m4 new file mode 100644 index 000000000000..08f2e07ec61b --- /dev/null +++ b/build/autoconf/ax_append_flag.m4 @@ -0,0 +1,71 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_append_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_APPEND_FLAG(FLAG, [FLAGS-VARIABLE]) +# +# DESCRIPTION +# +# FLAG is appended to the FLAGS-VARIABLE shell variable, with a space +# added in between. +# +# If FLAGS-VARIABLE is not specified, the current language's flags (e.g. +# CFLAGS) is used. FLAGS-VARIABLE is not changed if it already contains +# FLAG. If FLAGS-VARIABLE is unset in the shell, it is set to exactly +# FLAG. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 6 + +AC_DEFUN([AX_APPEND_FLAG], +[dnl +AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_SET_IF +AS_VAR_PUSHDEF([FLAGS], [m4_default($2,_AC_LANG_PREFIX[FLAGS])]) +AS_VAR_SET_IF(FLAGS,[ + AS_CASE([" AS_VAR_GET(FLAGS) "], + [*" $1 "*], [AC_RUN_LOG([: FLAGS already contains $1])], + [ + AS_VAR_APPEND(FLAGS,[" $1"]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) + ], + [ + AS_VAR_SET(FLAGS,[$1]) + AC_RUN_LOG([: FLAGS="$FLAGS"]) + ]) +AS_VAR_POPDEF([FLAGS])dnl +])dnl AX_APPEND_FLAG diff --git a/build/autoconf/ax_check_compile_flag.m4 b/build/autoconf/ax_check_compile_flag.m4 new file mode 100644 index 000000000000..ca3639715e72 --- /dev/null +++ b/build/autoconf/ax_check_compile_flag.m4 @@ -0,0 +1,74 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2011 Maarten Bosmans +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 4 + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS diff --git a/build/autoconf/ax_require_defined.m4 b/build/autoconf/ax_require_defined.m4 new file mode 100644 index 000000000000..cae11112d901 --- /dev/null +++ b/build/autoconf/ax_require_defined.m4 @@ -0,0 +1,37 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_require_defined.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_REQUIRE_DEFINED(MACRO) +# +# DESCRIPTION +# +# AX_REQUIRE_DEFINED is a simple helper for making sure other macros have +# been defined and thus are available for use. This avoids random issues +# where a macro isn't expanded. Instead the configure script emits a +# non-fatal: +# +# ./configure: line 1673: AX_CFLAGS_WARN_ALL: command not found +# +# It's like AC_REQUIRE except it doesn't expand the required macro. +# +# Here's an example: +# +# AX_REQUIRE_DEFINED([AX_CHECK_LINK_FLAG]) +# +# LICENSE +# +# Copyright (c) 2014 Mike Frysinger +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 1 + +AC_DEFUN([AX_REQUIRE_DEFINED], [dnl + m4_ifndef([$1], [m4_fatal([macro ]$1[ is not defined; is a m4 file missing?])]) +])dnl AX_REQUIRE_DEFINED diff --git a/build/autoconf/iconv.m4 b/build/autoconf/iconv.m4 index 98fcd64d313c..4e3736315662 100644 --- a/build/autoconf/iconv.m4 +++ b/build/autoconf/iconv.m4 @@ -1,5 +1,5 @@ -# iconv.m4 serial 18 (gettext-0.18.2) -dnl Copyright (C) 2000-2002, 2007-2011 Free Software Foundation, Inc. +# iconv.m4 serial 19 (gettext-0.18.2) +dnl Copyright (C) 2000-2002, 2007-2014 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -72,27 +72,33 @@ AC_DEFUN([AM_ICONV_LINK], if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi - AC_RUN_IFELSE( - [AC_LANG_SOURCE([[ + am_cv_func_iconv_works=no + for ac_iconv_const in '' 'const'; do + AC_RUN_IFELSE( + [AC_LANG_PROGRAM( + [[ #include #include -int main () -{ - int result = 0; + +#ifndef ICONV_CONST +# define ICONV_CONST $ac_iconv_const +#endif + ]], + [[int result = 0; /* Test against AIX 5.1 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { - static const char input[] = "\342\202\254"; /* EURO SIGN */ + static ICONV_CONST char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; - const char *inptr = input; + ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, - (char **) &inptr, &inbytesleft, + &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 1; @@ -105,14 +111,14 @@ int main () iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { - static const char input[] = "\263"; + static ICONV_CONST char input[] = "\263"; char buf[10]; - const char *inptr = input; + ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, - (char **) &inptr, &inbytesleft, + &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) result |= 2; @@ -124,14 +130,14 @@ int main () iconv_t cd_88591_to_utf8 = iconv_open ("UTF-8", "ISO-8859-1"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { - static const char input[] = "\304"; + static ICONV_CONST char input[] = "\304"; static char buf[2] = { (char)0xDE, (char)0xAD }; - const char *inptr = input; + ICONV_CONST char *inptr = input; size_t inbytesleft = 1; char *outptr = buf; size_t outbytesleft = 1; size_t res = iconv (cd_88591_to_utf8, - (char **) &inptr, &inbytesleft, + &inptr, &inbytesleft, &outptr, &outbytesleft); if (res != (size_t)(-1) || outptr - buf > 1 || buf[1] != (char)0xAD) result |= 4; @@ -144,14 +150,14 @@ int main () iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { - static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; + static ICONV_CONST char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; - const char *inptr = input; + ICONV_CONST char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, - (char **) &inptr, &inbytesleft, + &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) result |= 8; @@ -171,17 +177,14 @@ int main () && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) result |= 16; return result; -}]])], - [am_cv_func_iconv_works=yes], - [am_cv_func_iconv_works=no], - [ -changequote(,)dnl - case "$host_os" in - aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; - *) am_cv_func_iconv_works="guessing yes" ;; - esac -changequote([,])dnl - ]) +]])], + [am_cv_func_iconv_works=yes], , + [case "$host_os" in + aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; + *) am_cv_func_iconv_works="guessing yes" ;; + esac]) + test "$am_cv_func_iconv_works" = no || break + done LIBS="$am_save_LIBS" ]) case "$am_cv_func_iconv_works" in diff --git a/build/autogen.sh b/build/autogen.sh index e73162465d2a..64767b6ee6ca 100755 --- a/build/autogen.sh +++ b/build/autogen.sh @@ -43,7 +43,7 @@ cd .. # Substitute the versions into Libarchive's archive.h and archive_entry.h perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive.h perl -p -i -e "s/^(#define\tARCHIVE_VERSION_NUMBER).*/\$1 $VN/" libarchive/archive_entry.h -perl -p -i -e "s/^(#define\tARCHIVE_VERSION_STRING).*/\$1 \"libarchive $VS\"/" libarchive/archive.h +perl -p -i -e "s/^(#define\tARCHIVE_VERSION_ONLY_STRING).*/\$1 \"$VS\"/" libarchive/archive.h # Substitute versions into configure.ac as well perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_S\]),.*\)/$1,['"$VS"'])/' configure.ac perl -p -i -e 's/(m4_define\(\[LIBARCHIVE_VERSION_N\]),.*\)/$1,['"$VN"'])/' configure.ac diff --git a/build/clean.sh b/build/clean.sh index e4465f8a786c..b669426ccb5e 100755 --- a/build/clean.sh +++ b/build/clean.sh @@ -62,8 +62,10 @@ rm -f build/autoconf/ltsugar.m4 rm -f build/autoconf/ltversion.m4 rm -f build/autoconf/lt~obsolete.m4 rm -f build/autoconf/missing +rm -f build/autoconf/test-driver rm -f build/pkgconfig/libarchive.pc rm -f build/version.old +rm -f cat/test/list.h rm -f config.h rm -f config.h.in rm -f config.log diff --git a/build/cmake/CreatePkgConfigFile.cmake b/build/cmake/CreatePkgConfigFile.cmake new file mode 100644 index 000000000000..fc8529a571f2 --- /dev/null +++ b/build/cmake/CreatePkgConfigFile.cmake @@ -0,0 +1,33 @@ +# - Generate a libarchive.pc like autotools for pkg-config +# + +# Set the required variables (we use the same input file as autotools) +SET(prefix ${CMAKE_INSTALL_PREFIX}) +SET(exec_prefix \${prefix}) +SET(libdir \${exec_prefix}/lib) +SET(includedir \${prefix}/include) +# Now, this is not particularly pretty, nor is it terribly accurate... +# Loop over all our additional libs +FOREACH(mylib ${ADDITIONAL_LIBS}) + # Extract the filename from the absolute path + GET_FILENAME_COMPONENT(mylib_name ${mylib} NAME_WE) + # Strip the lib prefix + STRING(REGEX REPLACE "^lib" "" mylib_name ${mylib_name}) + # Append it to our LIBS string + SET(LIBS "${LIBS} -l${mylib_name}") +ENDFOREACH() +# libxml2 is easier, since it's already using pkg-config +FOREACH(mylib ${PC_LIBXML_STATIC_LDFLAGS}) + SET(LIBS "${LIBS} ${mylib}") +ENDFOREACH() +# FIXME: The order of the libraries doesn't take dependencies into account, +# thus there's a good chance it'll make some binutils versions unhappy... +# This only affects Libs.private (looked up for static builds) though. +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/build/pkgconfig/libarchive.pc.in + ${CMAKE_CURRENT_SOURCE_DIR}/build/pkgconfig/libarchive.pc + @ONLY) +# And install it, of course ;). +IF(ENABLE_INSTALL) + INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/build/pkgconfig/libarchive.pc + DESTINATION "lib/pkgconfig") +ENDIF() diff --git a/build/cmake/LibarchiveCheckCSourceCompiles.cmake b/build/cmake/LibarchiveCheckCSourceCompiles.cmake deleted file mode 100644 index 6b6f59334da4..000000000000 --- a/build/cmake/LibarchiveCheckCSourceCompiles.cmake +++ /dev/null @@ -1,106 +0,0 @@ -# - Check if given C source compiles and links into an executable -# CHECK_C_SOURCE_COMPILES( [FAIL_REGEX ]) -# - source code to try to compile, must define 'main' -# - variable to store whether the source code compiled -# - fail if test output matches this regex -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# CMAKE_REQUIRED_LIBRARIES = list of libraries to link - -#============================================================================= -# Copyright 2005-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# -# Extra arguments added by libarchive -# CMAKE_REQUIRED_LINKER_FLAGS = string of linker command line flags -# - -include(CMakeExpandImportedTargets) - - -macro(LIBARCHIVE_CHECK_C_SOURCE_COMPILES SOURCE VAR) - if("${VAR}" MATCHES "^${VAR}$") - set(_FAIL_REGEX) - set(_key) - foreach(arg ${ARGN}) - if("${arg}" MATCHES "^(FAIL_REGEX)$") - set(_key "${arg}") - elseif(_key) - list(APPEND _${_key} "${arg}") - else() - message(FATAL_ERROR "Unknown argument:\n ${arg}\n") - endif() - endforeach() - set(MACRO_CHECK_FUNCTION_DEFINITIONS - "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") - if(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - endif() - if(CMAKE_REQUIRED_INCLUDES) - set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) - endif() - if(CMAKE_REQUIRED_LINKER_FLAGS) - set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS - "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS) - endif() - file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" - "${SOURCE}\n") - - message(STATUS "Performing Test ${VAR}") - try_compile(${VAR} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} ${CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS} - "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" - "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" - OUTPUT_VARIABLE OUTPUT) - - foreach(_regex ${_FAIL_REGEX}) - if("${OUTPUT}" MATCHES "${_regex}") - set(${VAR} 0) - endif() - endforeach() - - if(${VAR}) - set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" - "${OUTPUT}\n" - "Source file was:\n${SOURCE}\n") - else() - message(STATUS "Performing Test ${VAR} - Failed") - set(${VAR} "" CACHE INTERNAL "Test ${VAR}") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" - "${OUTPUT}\n" - "Source file was:\n${SOURCE}\n") - endif() - endif() -endmacro() - diff --git a/build/cmake/LibarchiveCheckCSourceRuns.cmake b/build/cmake/LibarchiveCheckCSourceRuns.cmake deleted file mode 100644 index 498f52265aca..000000000000 --- a/build/cmake/LibarchiveCheckCSourceRuns.cmake +++ /dev/null @@ -1,102 +0,0 @@ -# - Check if the given C source code compiles and runs. -# CHECK_C_SOURCE_RUNS( ) -# - source code to try to compile -# - variable to store the result -# (1 for success, empty for failure) -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# CMAKE_REQUIRED_LIBRARIES = list of libraries to link - -#============================================================================= -# Copyright 2006-2009 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# -# Extra arguments added by libarchive -# CMAKE_REQUIRED_LINKER_FLAGS = string of linker command line flags -# - -include(CMakeExpandImportedTargets) - - -macro(LIBARCHIVE_CHECK_C_SOURCE_RUNS SOURCE VAR) - if("${VAR}" MATCHES "^${VAR}$") - set(MACRO_CHECK_FUNCTION_DEFINITIONS - "-D${VAR} ${CMAKE_REQUIRED_FLAGS}") - if(CMAKE_REQUIRED_LIBRARIES) - # this one translates potentially used imported library targets to their files on disk - CMAKE_EXPAND_IMPORTED_TARGETS(_ADJUSTED_CMAKE_REQUIRED_LIBRARIES LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} CONFIGURATION "${CMAKE_TRY_COMPILE_CONFIGURATION}") - set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES - "-DLINK_LIBRARIES:STRING=${_ADJUSTED_CMAKE_REQUIRED_LIBRARIES}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES) - endif() - if(CMAKE_REQUIRED_INCLUDES) - set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES - "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_INCLUDES) - endif() - if(CMAKE_REQUIRED_LINKER_FLAGS) - set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS - "-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS} -DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_REQUIRED_LINKER_FLAGS}") - else() - set(CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS) - endif() - file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c" - "${SOURCE}\n") - - message(STATUS "Performing Test ${VAR}") - try_run(${VAR}_EXITCODE ${VAR}_COMPILED - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c - COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} - CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} ${CHECK_C_SOURCE_COMPILES_ADD_LINKER_FLAGS} - -DCMAKE_SKIP_RPATH:BOOL=${CMAKE_SKIP_RPATH} - "${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}" - "${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}" - COMPILE_OUTPUT_VARIABLE OUTPUT) - # if it did not compile make the return value fail code of 1 - if(NOT ${VAR}_COMPILED) - set(${VAR}_EXITCODE 1) - endif() - # if the return value was 0 then it worked - if("${${VAR}_EXITCODE}" EQUAL 0) - set(${VAR} 1 CACHE INTERNAL "Test ${VAR}") - message(STATUS "Performing Test ${VAR} - Success") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n" - "${OUTPUT}\n" - "Return value: ${${VAR}}\n" - "Source file was:\n${SOURCE}\n") - else() - if(CMAKE_CROSSCOMPILING AND "${${VAR}_EXITCODE}" MATCHES "FAILED_TO_RUN") - set(${VAR} "${${VAR}_EXITCODE}") - else() - set(${VAR} "" CACHE INTERNAL "Test ${VAR}") - endif() - - message(STATUS "Performing Test ${VAR} - Failed") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Performing C SOURCE FILE Test ${VAR} failed with the following output:\n" - "${OUTPUT}\n" - "Return value: ${${VAR}_EXITCODE}\n" - "Source file was:\n${SOURCE}\n") - - endif() - endif() -endmacro() - diff --git a/build/cmake/LibarchiveCodeCoverage.cmake b/build/cmake/LibarchiveCodeCoverage.cmake new file mode 100644 index 000000000000..297b886ccf05 --- /dev/null +++ b/build/cmake/LibarchiveCodeCoverage.cmake @@ -0,0 +1,68 @@ +################################################################# +# Adds a build target called "coverage" for code coverage. +# +# This compiles the code using special GCC flags, run the tests, +# and then generates a nice HTML output. This new "coverage" make +# target will only be available if you build using GCC in Debug +# mode. If any of the required programs (lcov and genhtml) were +# not found, a FATAL_ERROR message is printed. +# +# If not already done, this code will set ENABLE_TEST to ON. +# +# To build the code coverage and open it in your browser do this: +# +# mkdir debug +# cd debug +# cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON .. +# make -j4 +# make coverage +# xdg-open coverage/index.html +################################################################# + +# Find programs we need +FIND_PROGRAM(LCOV_EXECUTABLE lcov DOC "Full path to lcov executable") +FIND_PROGRAM(GENHTML_EXECUTABLE genhtml DOC "Full path to genhtml executable") +MARK_AS_ADVANCED(LCOV_EXECUTABLE GENHTML_EXECUTABLE) + +# Check, compiler, build types and programs are available +IF(NOT CMAKE_COMPILER_IS_GNUCC) +MESSAGE(FATAL_ERROR "Coverage can only be built on GCC") +ELSEIF(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") +MESSAGE(FATAL_ERROR "Coverage can only be built in Debug mode") +ELSEIF(NOT LCOV_EXECUTABLE) +MESSAGE(FATAL_ERROR "lcov executable not found") +ELSEIF(NOT GENHTML_EXECUTABLE) +MESSAGE(FATAL_ERROR "genhtml executable not found") +ENDIF(NOT CMAKE_COMPILER_IS_GNUCC) + +# Enable testing if not already done +SET(ENABLE_TEST ON) + +################################################################# +# Set special compiler and linker flags for test coverage +################################################################# +# 0. Enable debug: -g +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g") +# 1. Disable optimizations: -O0 +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O0") +# 2. Enable all kind of warnings: +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -W") +# 3. Enable special coverage flag (HINT: --coverage is a synonym for -fprofile-arcs -ftest-coverage) +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --coverage") +SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --coverage") +SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} --coverage") +################################################################# + +ADD_CUSTOM_TARGET(coverage +COMMAND ${CMAKE_COMMAND} -E echo "Beginning test coverage. Output is written to coverage.log." +COMMAND ${CMAKE_COMMAND} -E echo "COVERAGE-STEP-1/5: Reset all execution counts to zero" +COMMAND ${LCOV_EXECUTABLE} --directory . --zerocounters > coverage.log 2>&1 +COMMAND ${CMAKE_COMMAND} -E echo "COVERAGE-STEP-2/5: Run testrunner" +COMMAND ${CMAKE_CTEST_COMMAND} >> coverage.log 2>&1 +COMMAND ${CMAKE_COMMAND} -E echo "COVERAGE-STEP-3/5: Collect coverage data" +COMMAND ${LCOV_EXECUTABLE} --capture --directory . --output-file "./coverage.info" >> coverage.log 2>&1 +COMMAND ${CMAKE_COMMAND} -E echo "COVERAGE-STEP-4/5: Generate HTML from coverage data" +COMMAND ${GENHTML_EXECUTABLE} "coverage.info" --title="libarchive-${LIBARCHIVE_VERSION_STRING}" --show-details --legend --output-directory "./coverage" >> coverage.log 2>&1 +COMMAND ${CMAKE_COMMAND} -E echo "COVERAGE-STEP-5/5: Open test coverage HTML output in browser: xdg-open ./coverage/index.html" +COMMENT "Runs testrunner and generates coverage output (formats: .info and .html)") + diff --git a/build/cmake/config.h.in b/build/cmake/config.h.in index c04314ee5e32..64f4d4df1789 100644 --- a/build/cmake/config.h.in +++ b/build/cmake/config.h.in @@ -63,7 +63,7 @@ typedef long long int64_t; * Similarly for int32_t */ #if !defined(HAVE_INT32_T) && SIZE_OF_INT == 4 -typedef long int32_t; +typedef int int32_t; #define HAVE_INT32_T #endif @@ -170,8 +170,6 @@ typedef unsigned char uint8_t; /* Define intmax_t and uintmax_t if they are not already defined. */ #if !defined(HAVE_INTMAX_T) typedef int64_t intmax_t; -#define INTMAX_MIN INT64_MIN -#define INTMAX_MAX INT64_MAX #endif #if !defined(HAVE_UINTMAX_T) @@ -289,6 +287,9 @@ typedef uint64_t uintmax_t; /* Version number of bsdtar */ #cmakedefine BSDTAR_VERSION_STRING "${BSDTAR_VERSION_STRING}" +/* Version number of bsdcat */ +#cmakedefine BSDCAT_VERSION_STRING "${BSDCAT_VERSION_STRING}" + /* Define to 1 if you have the `acl_create_entry' function. */ #cmakedefine HAVE_ACL_CREATE_ENTRY 1 @@ -325,9 +326,15 @@ typedef uint64_t uintmax_t; /* True for systems with POSIX ACL support */ #cmakedefine HAVE_ACL_USER 1 +/* Define to 1 if you have the `arc4random_buf' function. */ +#cmakedefine HAVE_ARC4RANDOM_BUF 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_ATTR_XATTR_H 1 +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_BCRYPT_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_BSDXML_H 1 @@ -355,6 +362,14 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `cygwin_conv_path' function. */ #cmakedefine HAVE_CYGWIN_CONV_PATH 1 +/* Define to 1 if you have the declaration of `INT32_MAX', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_INT32_MAX 1 + +/* Define to 1 if you have the declaration of `INT32_MIN', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_INT32_MIN 1 + /* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you don't. */ #cmakedefine HAVE_DECL_INT64_MAX 1 @@ -363,6 +378,14 @@ typedef uint64_t uintmax_t; don't. */ #cmakedefine HAVE_DECL_INT64_MIN 1 +/* Define to 1 if you have the declaration of `INTMAX_MAX', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_INTMAX_MAX 1 + +/* Define to 1 if you have the declaration of `INTMAX_MIN', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_INTMAX_MIN 1 + /* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you don't. */ #cmakedefine HAVE_DECL_SIZE_MAX 1 @@ -383,6 +406,10 @@ typedef uint64_t uintmax_t; don't. */ #cmakedefine HAVE_DECL_UINT64_MAX 1 +/* Define to 1 if you have the declaration of `UINTMAX_MAX', and to 0 if you + don't. */ +#cmakedefine HAVE_DECL_UINTMAX_MAX 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_DIRECT_H 1 @@ -576,12 +603,21 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `bz2' library (-lbz2). */ #cmakedefine HAVE_LIBBZ2 1 +/* Define to 1 if you have the `charset' library (-lcharset). */ +#cmakedefine HAVE_LIBCHARSET 1 + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +#cmakedefine HAVE_LIBCRYPTO 1 + /* Define to 1 if you have the `expat' library (-lexpat). */ #cmakedefine HAVE_LIBEXPAT 1 /* Define to 1 if you have the `gcc' library (-lgcc). */ #cmakedefine HAVE_LIBGCC 1 +/* Define to 1 if you have the `lz4' library (-llz4). */ +#cmakedefine HAVE_LIBLZ4 1 + /* Define to 1 if you have the `lzma' library (-llzma). */ #cmakedefine HAVE_LIBLZMA 1 @@ -673,6 +709,12 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `lutimes' function. */ #cmakedefine HAVE_LUTIMES 1 +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LZ4HC_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LZ4_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LZMADEC_H 1 @@ -709,9 +751,18 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the header file, and it defines `DIR'. */ #cmakedefine HAVE_NDIR_H 1 +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETTLE_AES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETTLE_HMAC_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_NETTLE_MD5_H 1 +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETTLE_PBKDF2_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_NETTLE_RIPEMD160_H 1 @@ -733,6 +784,9 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `pipe' function. */ #cmakedefine HAVE_PIPE 1 +/* Define to 1 if you have the `PKCS5_PBKDF2_HMAC_SHA1' function. */ +#cmakedefine HAVE_PKCS5_PBKDF2_HMAC_SHA1 1 + /* Define to 1 if you have the `poll' function. */ #cmakedefine HAVE_POLL 1 @@ -745,6 +799,9 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the header file. */ #cmakedefine HAVE_PROCESS_H 1 +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PTHREAD_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_PWD_H 1 @@ -757,6 +814,12 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `readlinkat' function. */ #cmakedefine HAVE_READLINKAT 1 +/* Define to 1 if you have the `readpassphrase' function. */ +#cmakedefine HAVE_READPASSPHRASE 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_READPASSPHRASE_H 1 + /* Define to 1 if you have the header file. */ #cmakedefine HAVE_REGEX_H 1 @@ -1012,6 +1075,9 @@ typedef uint64_t uintmax_t; /* Define to 1 if you have the `wmemcpy' function. */ #cmakedefine HAVE_WMEMCPY 1 +/* Define to 1 if you have the `wmemmove' function. */ +#cmakedefine HAVE_WMEMMOVE 1 + /* Define to 1 if you have a working EXT2_IOC_GETFLAGS */ #cmakedefine HAVE_WORKING_EXT2_IOC_GETFLAGS 1 @@ -1105,9 +1171,18 @@ typedef uint64_t uintmax_t; /* Define for large files, on AIX-style hosts. */ #cmakedefine _LARGE_FILES ${_LARGE_FILES} -/* Define for Windows to use Windows 2000+ APIs. */ +/* Define to control Windows SDK version */ +#ifndef NTDDI_VERSION +#cmakedefine NTDDI_VERSION ${NTDDI_VERSION} +#endif // NTDDI_VERSION + +#ifndef _WIN32_WINNT #cmakedefine _WIN32_WINNT ${_WIN32_WINNT} +#endif // _WIN32_WINNT + +#ifndef WINVER #cmakedefine WINVER ${WINVER} +#endif // WINVER /* Define to empty if `const' does not conform to ANSI C. */ #cmakedefine const ${const} diff --git a/build/version b/build/version index 937b126a2ede..595378f1050c 100644 --- a/build/version +++ b/build/version @@ -1 +1 @@ -3001002 +3002000 diff --git a/cat/CMakeLists.txt b/cat/CMakeLists.txt new file mode 100644 index 000000000000..4fe6354b3131 --- /dev/null +++ b/cat/CMakeLists.txt @@ -0,0 +1,37 @@ +############################################ +# +# How to build bsdcat +# +############################################ +IF(ENABLE_CAT) + + SET(bsdcat_SOURCES + bsdcat.c + bsdcat.h + bsdcat_platform.h + cmdline.c + ../libarchive_fe/err.c + ../libarchive_fe/err.h + ../libarchive_fe/lafe_platform.h + ) + INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe) + + # bsdcat documentation + SET(bsdcat_MANS bsdcat.1) + + # How to build bsdcat + ADD_EXECUTABLE(bsdcat ${bsdcat_SOURCES}) + IF(ENABLE_CAT_SHARED) + TARGET_LINK_LIBRARIES(bsdcat archive ${ADDITIONAL_LIBS}) + ELSE(ENABLE_CAT_SHARED) + TARGET_LINK_LIBRARIES(bsdcat archive_static ${ADDITIONAL_LIBS}) + SET_TARGET_PROPERTIES(bsdcat PROPERTIES COMPILE_DEFINITIONS + LIBARCHIVE_STATIC) + ENDIF(ENABLE_CAT_SHARED) + + # Installation rules + INSTALL(TARGETS bsdcat RUNTIME DESTINATION bin) + INSTALL_MAN(${bsdcat_MANS}) +ENDIF(ENABLE_CAT) + +add_subdirectory(test) diff --git a/cat/bsdcat.1 b/cat/bsdcat.1 new file mode 100644 index 000000000000..4f82b1e57c06 --- /dev/null +++ b/cat/bsdcat.1 @@ -0,0 +1,62 @@ +.\" Copyright (c) 2011-2014, Mike Kazantsev +.\" 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 March 1, 2014 +.Dt BSDCAT 1 +.Os +.Sh NAME +.Nm bsdcat +.Nd expand files to standard output +.Sh SYNOPSIS +.Nm +.Op options +.Op files +.Pp +.Sh DESCRIPTION +.Nm +expands files to standard output. +.Sh OPTIONS +.Nm +typically takes a filename as an argument or reads standard input when used in a +pipe. In both cases decompressed data it written to standard output. +.Sh EXAMPLES +.Pp +To decompress a file: +.Pp +.Dl bsdcat example.txt.gz > example.txt +.Pp +To decompress standard input in a pipe: +.Pp +.Dl cat example.txt.gz | bsdcat > example.txt +.Pp +Both examples achieve the same results - a decompressed file by redirecting +output. +.Sh SEE ALSO +.Xr uncompress 1 , +.Xr zcat 1 , +.Xr bzcat 1 , +.Xr xzcat 1 , +.Xr libarchive-formats 5 , diff --git a/cat/bsdcat.c b/cat/bsdcat.c new file mode 100644 index 000000000000..af140e0001c7 --- /dev/null +++ b/cat/bsdcat.c @@ -0,0 +1,146 @@ +/*- + * Copyright (c) 2011-2014, Mike Kazantsev + * 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 "bsdcat_platform.h" +__FBSDID("$FreeBSD$"); + +#include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include "bsdcat.h" +#include "err.h" + +#define BYTES_PER_BLOCK (20*512) + +struct archive *a; +struct archive_entry *ae; +char *bsdcat_current_path; +int exit_status = 0; + + +void +usage(FILE *stream, int eval) +{ + const char *p; + p = lafe_getprogname(); + fprintf(stream, + "Usage: %s [-h] [--help] [--version] [--] [filenames...]\n", p); + exit(eval); +} + +static void +version(void) +{ + printf("bsdcat %s - %s\n", + BSDCAT_VERSION_STRING, + archive_version_details()); + exit(0); +} + +void +bsdcat_next() +{ + a = archive_read_new(); + archive_read_support_filter_all(a); + archive_read_support_format_empty(a); + archive_read_support_format_raw(a); +} + +void +bsdcat_print_error(void) +{ + lafe_warnc(0, "%s: %s", + bsdcat_current_path, archive_error_string(a)); + exit_status = 1; +} + +void +bsdcat_read_to_stdout(char* filename) +{ + int r; + + if (archive_read_open_filename(a, filename, BYTES_PER_BLOCK) + != ARCHIVE_OK) + bsdcat_print_error(); + else if (r = archive_read_next_header(a, &ae), + r != ARCHIVE_OK && r != ARCHIVE_EOF) + bsdcat_print_error(); + else if (r == ARCHIVE_EOF) + /* for empty payloads don't try and read data */ + ; + else if (archive_read_data_into_fd(a, 1) != ARCHIVE_OK) + bsdcat_print_error(); + if (archive_read_free(a) != ARCHIVE_OK) + bsdcat_print_error(); +} + +int +main(int argc, char **argv) +{ + struct bsdcat *bsdcat, bsdcat_storage; + int c; + + bsdcat = &bsdcat_storage; + memset(bsdcat, 0, sizeof(*bsdcat)); + + lafe_setprogname(*argv, "bsdcat"); + + bsdcat->argv = argv; + bsdcat->argc = argc; + + while ((c = bsdcat_getopt(bsdcat)) != -1) { + switch (c) { + case 'h': + usage(stdout, 0); + break; + case OPTION_VERSION: + version(); + break; + default: + usage(stderr, 1); + } + } + + bsdcat_next(); + if (*bsdcat->argv == NULL) { + bsdcat_current_path = ""; + bsdcat_read_to_stdout(NULL); + } else + while (*bsdcat->argv) { + bsdcat_current_path = *bsdcat->argv++; + bsdcat_read_to_stdout(bsdcat_current_path); + bsdcat_next(); + } + + exit(exit_status); +} diff --git a/cat/bsdcat.h b/cat/bsdcat.h new file mode 100644 index 000000000000..ca603d3d6f89 --- /dev/null +++ b/cat/bsdcat.h @@ -0,0 +1,56 @@ +/*- + * Copyright (c) 2014, Mike Kazantsev + * 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. + */ + +#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 + +#include +#include + +struct bsdcat { + /* Option parser state */ + int getopt_state; + char *getopt_word; + + /* Miscellaneous state information */ + int argc; + char **argv; + const char *argument; +}; + +enum { + OPTION_VERSION +}; + +int bsdcat_getopt(struct bsdcat *); +void usage(FILE *stream, int eval); +void bsdcat_next(void); +void bsdcat_print_error(void); +void bsdcat_read_to_stdout(char* filename); diff --git a/cat/bsdcat_platform.h b/cat/bsdcat_platform.h new file mode 100644 index 000000000000..ff9245e84811 --- /dev/null +++ b/cat/bsdcat_platform.h @@ -0,0 +1,75 @@ +/*- + * 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$ + */ + +/* + * 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 BSDCAT_PLATFORM_H_INCLUDED +#define BSDCAT_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 +#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 +#include +#else +/* Otherwise, include user headers. */ +#include "archive.h" +#include "archive_entry.h" +#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 /* !BSDCAT_PLATFORM_H_INCLUDED */ diff --git a/cat/cmdline.c b/cat/cmdline.c new file mode 100644 index 000000000000..cae19beb7d4c --- /dev/null +++ b/cat/cmdline.c @@ -0,0 +1,283 @@ +/*- + * Copyright (c) 2003-2008 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. + */ + +/* + * Command line parser for tar. + */ + +#include "bsdcat_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include "bsdcat.h" +#include "err.h" + +/* + * Short options for tar. Please keep this sorted. + */ +static const char *short_options = "h"; + +/* + * Long options for tar. Please keep this list sorted. + * + * The symbolic names for options that lack a short equivalent are + * defined in bsdcat.h. Also note that so far I've found no need + * to support optional arguments to long options. That would be + * a small change to the code below. + */ + +static const struct bsdcat_option { + const char *name; + int required; /* 1 if this option requires an argument. */ + int equivalent; /* Equivalent short option. */ +} tar_longopts[] = { + { "help", 0, 'h' }, + { "version", 0, OPTION_VERSION }, + { NULL, 0, 0 } +}; + +/* + * This getopt implementation has two key features that common + * getopt_long() implementations lack. Apart from those, it's a + * straightforward option parser, considerably simplified by not + * needing to support the wealth of exotic getopt_long() features. It + * has, of course, been shamelessly tailored for bsdcat. (If you're + * looking for a generic getopt_long() implementation for your + * project, I recommend Gregory Pietsch's public domain getopt_long() + * implementation.) The two additional features are: + * + * Old-style tar arguments: The original tar implementation treated + * the first argument word as a list of single-character option + * letters. All arguments follow as separate words. For example, + * tar xbf 32 /dev/tape + * Here, the "xbf" is three option letters, "32" is the argument for + * "b" and "/dev/tape" is the argument for "f". We support this usage + * if the first command-line argument does not begin with '-'. We + * also allow regular short and long options to follow, e.g., + * tar xbf 32 /dev/tape -P --format=pax + * + * -W long options: There's an obscure GNU convention (only rarely + * supported even there) that allows "-W option=argument" as an + * alternative way to support long options. This was supported in + * early bsdcat as a way to access long options on platforms that did + * not support getopt_long() and is preserved here for backwards + * compatibility. (Of course, if I'd started with a custom + * command-line parser from the beginning, I would have had normal + * long option support on every platform so that hack wouldn't have + * been necessary. Oh, well. Some mistakes you just have to live + * with.) + * + * TODO: We should be able to use this to pull files and intermingled + * options (such as -C) from the command line in write mode. That + * will require a little rethinking of the argument handling in + * bsdcat.c. + * + * TODO: If we want to support arbitrary command-line options from -T + * input (as GNU tar does), we may need to extend this to handle option + * words from sources other than argv/argc. I'm not really sure if I + * like that feature of GNU tar, so it's certainly not a priority. + */ + +int +bsdcat_getopt(struct bsdcat *bsdcat) +{ + enum { state_start = 0, state_old_tar, state_next_word, + state_short, state_long }; + + const struct bsdcat_option *popt, *match = NULL, *match2 = NULL; + const char *p, *long_prefix = "--"; + size_t optlength; + int opt = '?'; + int required = 0; + + bsdcat->argument = NULL; + + /* First time through, initialize everything. */ + if (bsdcat->getopt_state == state_start) { + /* Skip program name. */ + ++bsdcat->argv; + --bsdcat->argc; + if (*bsdcat->argv == NULL) + return (-1); + /* Decide between "new style" and "old style" arguments. */ + bsdcat->getopt_state = state_next_word; + } + + /* + * We're ready to look at the next word in argv. + */ + if (bsdcat->getopt_state == state_next_word) { + /* No more arguments, so no more options. */ + if (bsdcat->argv[0] == NULL) + return (-1); + /* Doesn't start with '-', so no more options. */ + if (bsdcat->argv[0][0] != '-') + return (-1); + /* "--" marks end of options; consume it and return. */ + if (strcmp(bsdcat->argv[0], "--") == 0) { + ++bsdcat->argv; + --bsdcat->argc; + return (-1); + } + /* Get next word for parsing. */ + bsdcat->getopt_word = *bsdcat->argv++; + --bsdcat->argc; + if (bsdcat->getopt_word[1] == '-') { + /* Set up long option parser. */ + bsdcat->getopt_state = state_long; + bsdcat->getopt_word += 2; /* Skip leading '--' */ + } else { + /* Set up short option parser. */ + bsdcat->getopt_state = state_short; + ++bsdcat->getopt_word; /* Skip leading '-' */ + } + } + + /* + * We're parsing a group of POSIX-style single-character options. + */ + if (bsdcat->getopt_state == state_short) { + /* Peel next option off of a group of short options. */ + opt = *bsdcat->getopt_word++; + if (opt == '\0') { + /* End of this group; recurse to get next option. */ + bsdcat->getopt_state = state_next_word; + return bsdcat_getopt(bsdcat); + } + + /* Does this option take an argument? */ + p = strchr(short_options, opt); + if (p == NULL) + return ('?'); + if (p[1] == ':') + required = 1; + + /* If it takes an argument, parse that. */ + if (required) { + /* If arg is run-in, bsdcat->getopt_word already points to it. */ + if (bsdcat->getopt_word[0] == '\0') { + /* Otherwise, pick up the next word. */ + bsdcat->getopt_word = *bsdcat->argv; + if (bsdcat->getopt_word == NULL) { + lafe_warnc(0, + "Option -%c requires an argument", + opt); + return ('?'); + } + ++bsdcat->argv; + --bsdcat->argc; + } + if (opt == 'W') { + bsdcat->getopt_state = state_long; + long_prefix = "-W "; /* For clearer errors. */ + } else { + bsdcat->getopt_state = state_next_word; + bsdcat->argument = bsdcat->getopt_word; + } + } + } + + /* We're reading a long option, including -W long=arg convention. */ + if (bsdcat->getopt_state == state_long) { + /* After this long option, we'll be starting a new word. */ + bsdcat->getopt_state = state_next_word; + + /* Option name ends at '=' if there is one. */ + p = strchr(bsdcat->getopt_word, '='); + if (p != NULL) { + optlength = (size_t)(p - bsdcat->getopt_word); + bsdcat->argument = (char *)(uintptr_t)(p + 1); + } else { + optlength = strlen(bsdcat->getopt_word); + } + + /* Search the table for an unambiguous match. */ + for (popt = tar_longopts; popt->name != NULL; popt++) { + /* Short-circuit if first chars don't match. */ + if (popt->name[0] != bsdcat->getopt_word[0]) + continue; + /* If option is a prefix of name in table, record it.*/ + if (strncmp(bsdcat->getopt_word, popt->name, optlength) == 0) { + match2 = match; /* Record up to two matches. */ + match = popt; + /* If it's an exact match, we're done. */ + if (strlen(popt->name) == optlength) { + match2 = NULL; /* Forget the others. */ + break; + } + } + } + + /* Fail if there wasn't a unique match. */ + if (match == NULL) { + lafe_warnc(0, + "Option %s%s is not supported", + long_prefix, bsdcat->getopt_word); + return ('?'); + } + if (match2 != NULL) { + lafe_warnc(0, + "Ambiguous option %s%s (matches --%s and --%s)", + long_prefix, bsdcat->getopt_word, match->name, match2->name); + return ('?'); + } + + /* We've found a unique match; does it need an argument? */ + if (match->required) { + /* Argument required: get next word if necessary. */ + if (bsdcat->argument == NULL) { + bsdcat->argument = *bsdcat->argv; + if (bsdcat->argument == NULL) { + lafe_warnc(0, + "Option %s%s requires an argument", + long_prefix, match->name); + return ('?'); + } + ++bsdcat->argv; + --bsdcat->argc; + } + } else { + /* Argument forbidden: fail if there is one. */ + if (bsdcat->argument != NULL) { + lafe_warnc(0, + "Option %s%s does not allow an argument", + long_prefix, match->name); + return ('?'); + } + } + return (match->equivalent); + } + + return (opt); +} diff --git a/cat/test/CMakeLists.txt b/cat/test/CMakeLists.txt new file mode 100644 index 000000000000..0990bcf272a7 --- /dev/null +++ b/cat/test/CMakeLists.txt @@ -0,0 +1,65 @@ +############################################ +# +# How to build bsdtar_test +# +############################################ +IF(ENABLE_CAT AND ENABLE_TEST) + SET(bsdcat_test_SOURCES + ../../test_utils/test_utils.c + main.c + test.h + test_0.c + test_empty_gz.c + test_empty_lz4.c + test_empty_xz.c + test_error.c + test_error_mixed.c + test_expand_Z.c + test_expand_bz2.c + test_expand_gz.c + test_expand_lz4.c + test_expand_mixed.c + test_expand_plain.c + test_expand_xz.c + test_help.c + test_version.c + ) + + # + # Register target + # + ADD_EXECUTABLE(bsdcat_test ${bsdcat_test_SOURCES}) + SET_PROPERTY(TARGET bsdcat_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} ${bsdcat_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 bsdcat_${_testname} + COMMAND bsdcat_test -vv + -p $ + -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) + + # Experimental new test handling + ADD_CUSTOM_TARGET(run_bsdcat_test + COMMAND bsdcat_test -p $ + -r ${CMAKE_CURRENT_SOURCE_DIR}) + ADD_DEPENDENCIES(run_bsdcat_test bsdcat) + ADD_DEPENDENCIES(run_all_tests run_bsdcat_test) + +ENDIF(ENABLE_CAT AND ENABLE_TEST) diff --git a/cat/test/main.c b/cat/test/main.c new file mode 100644 index 000000000000..319f68c774f0 --- /dev/null +++ b/cat/test/main.c @@ -0,0 +1,2969 @@ +/* + * Copyright (c) 2003-2009 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" +#include "test_utils.h" +#ifdef HAVE_SYS_IOCTL_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include +#ifdef HAVE_ICONV_H +#include +#endif +/* + * Some Linux distributions have both linux/ext2_fs.h and ext2fs/ext2_fs.h. + * As the include guards don't agree, the order of include is important. + */ +#ifdef HAVE_LINUX_EXT2_FS_H +#include /* for Linux file flags */ +#endif +#if defined(HAVE_EXT2FS_EXT2_FS_H) && !defined(__CYGWIN__) +#include /* Linux file flags, broken on Cygwin */ +#endif +#include +#include +#ifdef HAVE_SIGNAL_H +#include +#endif +#include +#include + +/* + * This same file is used pretty much verbatim for all test harnesses. + * + * The next few lines are the only differences. + * TODO: Move this into a separate configuration header, have all test + * suites share one copy of this file. + */ +#define KNOWNREF "test_expand.Z.uu" +#define ENVBASE "BSDCAT" /* Prefix for environment variables. */ +#define PROGRAM "bsdcat" /* Name of program being tested. */ +#define PROGRAM_ALIAS "cat" /* 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 --version", testprog) ? "" : "") + +/* + * + * Windows support routines + * + * Note: Configuration is a tricky issue. Using HAVE_* feature macros + * in the test harness is dangerous because they cover up + * configuration errors. The classic example of this is omitting a + * configure check. If libarchive and libarchive_test both look for + * the same feature macro, such errors are hard to detect. Platform + * macros (e.g., _WIN32 or __GNUC__) are a little better, but can + * easily lead to very messy code. It's best to limit yourself + * to only the most generic programming techniques in the test harness + * and thus avoid conditionals altogether. Where that's not possible, + * try to minimize conditionals by grouping platform-specific tests in + * one place (e.g., test_acl_freebsd) or by adding new assert() + * functions (e.g., assertMakeHardlink()) to cover up platform + * differences. Platform-specific coding in libarchive_test is often + * a symptom that some capability is missing from libarchive itself. + */ +#if defined(_WIN32) && !defined(__CYGWIN__) +#include +#include +#include +#ifndef F_OK +#define F_OK (0) +#endif +#ifndef S_ISDIR +#define S_ISDIR(m) ((m) & _S_IFDIR) +#endif +#ifndef S_ISREG +#define S_ISREG(m) ((m) & _S_IFREG) +#endif +#if !defined(__BORLANDC__) +#define access _access +#undef chdir +#define chdir _chdir +#endif +#ifndef fileno +#define fileno _fileno +#endif +/*#define fstat _fstat64*/ +#if !defined(__BORLANDC__) +#define getcwd _getcwd +#endif +#define lstat stat +/*#define lstat _stat64*/ +/*#define stat _stat64*/ +#define rmdir _rmdir +#if !defined(__BORLANDC__) +#define strdup _strdup +#define umask _umask +#endif +#define int64_t __int64 +#endif + +#if defined(HAVE__CrtSetReportMode) +# include +#endif + +/* Path to working directory for current test */ +const char *testworkdir; +#ifdef PROGRAM +/* Pathname of exe to be tested. */ +const char *testprogfile; +/* Name of exe to use in printf-formatted command strings. */ +/* On Windows, this includes leading/trailing quotes. */ +const char *testprog; +#endif + +#if defined(_WIN32) && !defined(__CYGWIN__) +static void *GetFunctionKernel32(const char *); +static int my_CreateSymbolicLinkA(const char *, const char *, int); +static int my_CreateHardLinkA(const char *, const char *); +static int my_GetFileInformationByName(const char *, + BY_HANDLE_FILE_INFORMATION *); + +static void * +GetFunctionKernel32(const char *name) +{ + static HINSTANCE lib; + static int set; + if (!set) { + set = 1; + lib = LoadLibrary("kernel32.dll"); + } + if (lib == NULL) { + fprintf(stderr, "Can't load kernel32.dll?!\n"); + exit(1); + } + return (void *)GetProcAddress(lib, name); +} + +static int +my_CreateSymbolicLinkA(const char *linkname, const char *target, int flags) +{ + static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, DWORD); + static int set; + if (!set) { + set = 1; + f = GetFunctionKernel32("CreateSymbolicLinkA"); + } + return f == NULL ? 0 : (*f)(linkname, target, flags); +} + +static int +my_CreateHardLinkA(const char *linkname, const char *target) +{ + static BOOLEAN (WINAPI *f)(LPCSTR, LPCSTR, LPSECURITY_ATTRIBUTES); + static int set; + if (!set) { + set = 1; + f = GetFunctionKernel32("CreateHardLinkA"); + } + return f == NULL ? 0 : (*f)(linkname, target, NULL); +} + +static int +my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi) +{ + HANDLE h; + int r; + + memset(bhfi, 0, sizeof(*bhfi)); + h = CreateFile(path, FILE_READ_ATTRIBUTES, 0, NULL, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (h == INVALID_HANDLE_VALUE) + return (0); + r = GetFileInformationByHandle(h, bhfi); + CloseHandle(h); + return (r); +} +#endif + +#if defined(HAVE__CrtSetReportMode) && !defined(__WATCOMC__) +static void +invalid_parameter_handler(const wchar_t * expression, + const wchar_t * function, const wchar_t * file, + unsigned int line, uintptr_t pReserved) +{ + /* nop */ +} +#endif + +/* + * + * OPTIONS FLAGS + * + */ + +/* Enable core dump on failure. */ +static int dump_on_failure = 0; +/* Default is to remove temp dirs and log data for successful tests. */ +static int keep_temp_files = 0; +/* Default is to run the specified tests once and report errors. */ +static int until_failure = 0; +/* Default is to just report pass/fail for each test. */ +static int verbosity = 0; +#define VERBOSITY_SUMMARY_ONLY -1 /* -q */ +#define VERBOSITY_PASSFAIL 0 /* Default */ +#define VERBOSITY_LIGHT_REPORT 1 /* -v */ +#define VERBOSITY_FULL 2 /* -vv */ +/* A few places generate even more output for verbosity > VERBOSITY_FULL, + * mostly for debugging the test harness itself. */ +/* Cumulative count of assertion failures. */ +static int failures = 0; +/* Cumulative count of reported skips. */ +static int skips = 0; +/* Cumulative count of assertions checked. */ +static int assertions = 0; + +/* Directory where uuencoded reference files can be found. */ +static const char *refdir; + +/* + * Report log information selectively to console and/or disk log. + */ +static int log_console = 0; +static FILE *logfile; +static void +vlogprintf(const char *fmt, va_list ap) +{ +#ifdef va_copy + va_list lfap; + va_copy(lfap, ap); +#endif + if (log_console) + vfprintf(stdout, fmt, ap); + if (logfile != NULL) +#ifdef va_copy + vfprintf(logfile, fmt, lfap); + va_end(lfap); +#else + vfprintf(logfile, fmt, ap); +#endif +} + +static void +logprintf(const char *fmt, ...) +{ + va_list ap; + va_start(ap, fmt); + vlogprintf(fmt, ap); + va_end(ap); +} + +/* Set up a message to display only if next assertion fails. */ +static char msgbuff[4096]; +static const char *msg, *nextmsg; +void +failure(const char *fmt, ...) +{ + va_list ap; + if (fmt == NULL) { + nextmsg = NULL; + } else { + va_start(ap, fmt); + vsprintf(msgbuff, fmt, ap); + va_end(ap); + nextmsg = msgbuff; + } +} + +/* + * Copy arguments into file-local variables. + * This was added to permit vararg assert() functions without needing + * variadic wrapper macros. Turns out that the vararg capability is almost + * never used, so almost all of the vararg assertions can be simplified + * by removing the vararg capability and reworking the wrapper macro to + * pass __FILE__, __LINE__ directly into the function instead of using + * this hook. I suspect this machinery is used so rarely that we + * would be better off just removing it entirely. That would simplify + * the code here noticeably. + */ +static const char *skipping_filename; +static int skipping_line; +void skipping_setup(const char *filename, int line) +{ + skipping_filename = filename; + skipping_line = line; +} + +/* Called at the beginning of each assert() function. */ +static void +assertion_count(const char *file, int line) +{ + (void)file; /* UNUSED */ + (void)line; /* UNUSED */ + ++assertions; + /* Proper handling of "failure()" message. */ + msg = nextmsg; + nextmsg = NULL; + /* Uncomment to print file:line after every assertion. + * Verbose, but occasionally useful in tracking down crashes. */ + /* printf("Checked %s:%d\n", file, line); */ +} + +/* + * For each test source file, we remember how many times each + * assertion was reported. Cleared before each new test, + * used by test_summarize(). + */ +static struct line { + int count; + int skip; +} failed_lines[10000]; +const char *failed_filename; + +/* Count this failure, setup up log destination and handle initial report. */ +static void +failure_start(const char *filename, int line, const char *fmt, ...) +{ + va_list ap; + + /* Record another failure for this line. */ + ++failures; + failed_filename = filename; + failed_lines[line].count++; + + /* Determine whether to log header to console. */ + switch (verbosity) { + case VERBOSITY_LIGHT_REPORT: + log_console = (failed_lines[line].count < 2); + break; + default: + log_console = (verbosity >= VERBOSITY_FULL); + } + + /* Log file:line header for this failure */ + va_start(ap, fmt); +#if _MSC_VER + logprintf("%s(%d): ", filename, line); +#else + logprintf("%s:%d: ", filename, line); +#endif + vlogprintf(fmt, ap); + va_end(ap); + logprintf("\n"); + + if (msg != NULL && msg[0] != '\0') { + logprintf(" Description: %s\n", msg); + msg = NULL; + } + + /* Determine whether to log details to console. */ + if (verbosity == VERBOSITY_LIGHT_REPORT) + log_console = 0; +} + +/* Complete reporting of failed tests. */ +/* + * The 'extra' hook here is used by libarchive to include libarchive + * error messages with assertion failures. It could also be used + * to add strerror() output, for example. Just define the EXTRA_DUMP() + * macro appropriately. + */ +static void +failure_finish(void *extra) +{ + (void)extra; /* UNUSED (maybe) */ +#ifdef EXTRA_DUMP + if (extra != NULL) { + logprintf(" errno: %d\n", EXTRA_ERRNO(extra)); + logprintf(" detail: %s\n", EXTRA_DUMP(extra)); + } +#endif + + if (dump_on_failure) { + fprintf(stderr, + " *** forcing core dump so failure can be debugged ***\n"); + abort(); + } +} + +/* Inform user that we're skipping some checks. */ +void +test_skipping(const char *fmt, ...) +{ + char buff[1024]; + va_list ap; + + va_start(ap, fmt); + vsprintf(buff, fmt, ap); + va_end(ap); + /* Use failure() message if set. */ + msg = nextmsg; + nextmsg = NULL; + /* failure_start() isn't quite right, but is awfully convenient. */ + failure_start(skipping_filename, skipping_line, "SKIPPING: %s", buff); + --failures; /* Undo failures++ in failure_start() */ + /* Don't failure_finish() here. */ + /* Mark as skip, so doesn't count as failed test. */ + failed_lines[skipping_line].skip = 1; + ++skips; +} + +/* + * + * ASSERTIONS + * + */ + +/* Generic assert() just displays the failed condition. */ +int +assertion_assert(const char *file, int line, int value, + const char *condition, void *extra) +{ + assertion_count(file, line); + if (!value) { + failure_start(file, line, "Assertion failed: %s", condition); + failure_finish(extra); + } + return (value); +} + +/* chdir() and report any errors */ +int +assertion_chdir(const char *file, int line, const char *pathname) +{ + assertion_count(file, line); + if (chdir(pathname) == 0) + return (1); + failure_start(file, line, "chdir(\"%s\")", pathname); + failure_finish(NULL); + return (0); + +} + +/* Verify two integers are equal. */ +int +assertion_equal_int(const char *file, int line, + long long v1, const char *e1, long long v2, const char *e2, void *extra) +{ + assertion_count(file, line); + if (v1 == v2) + return (1); + failure_start(file, line, "%s != %s", e1, e2); + logprintf(" %s=%lld (0x%llx, 0%llo)\n", e1, v1, v1, v1); + logprintf(" %s=%lld (0x%llx, 0%llo)\n", e2, v2, v2, v2); + failure_finish(extra); + return (0); +} + +/* + * Utility to convert a single UTF-8 sequence. + */ +static int +_utf8_to_unicode(uint32_t *pwc, const char *s, size_t n) +{ + static const char utf8_count[256] = { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 00 - 0F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 10 - 1F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 20 - 2F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 30 - 3F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 40 - 4F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 50 - 5F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 60 - 6F */ + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,/* 70 - 7F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* 80 - 8F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* 90 - 9F */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* A0 - AF */ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,/* B0 - BF */ + 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,/* C0 - CF */ + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,/* D0 - DF */ + 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,/* E0 - EF */ + 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 /* F0 - FF */ + }; + int ch; + int cnt; + uint32_t wc; + + *pwc = 0; + + /* Sanity check. */ + if (n == 0) + return (0); + /* + * Decode 1-4 bytes depending on the value of the first byte. + */ + ch = (unsigned char)*s; + if (ch == 0) + return (0); /* Standard: return 0 for end-of-string. */ + cnt = utf8_count[ch]; + + /* Invalide sequence or there are not plenty bytes. */ + if (n < (size_t)cnt) + return (-1); + + /* Make a Unicode code point from a single UTF-8 sequence. */ + switch (cnt) { + case 1: /* 1 byte sequence. */ + *pwc = ch & 0x7f; + return (cnt); + case 2: /* 2 bytes sequence. */ + if ((s[1] & 0xc0) != 0x80) return (-1); + *pwc = ((ch & 0x1f) << 6) | (s[1] & 0x3f); + return (cnt); + case 3: /* 3 bytes sequence. */ + if ((s[1] & 0xc0) != 0x80) return (-1); + if ((s[2] & 0xc0) != 0x80) return (-1); + wc = ((ch & 0x0f) << 12) + | ((s[1] & 0x3f) << 6) + | (s[2] & 0x3f); + if (wc < 0x800) + return (-1);/* Overlong sequence. */ + break; + case 4: /* 4 bytes sequence. */ + if (n < 4) + return (-1); + if ((s[1] & 0xc0) != 0x80) return (-1); + if ((s[2] & 0xc0) != 0x80) return (-1); + if ((s[3] & 0xc0) != 0x80) return (-1); + wc = ((ch & 0x07) << 18) + | ((s[1] & 0x3f) << 12) + | ((s[2] & 0x3f) << 6) + | (s[3] & 0x3f); + if (wc < 0x10000) + return (-1);/* Overlong sequence. */ + break; + default: + return (-1); + } + + /* The code point larger than 0x10FFFF is not leagal + * Unicode values. */ + if (wc > 0x10FFFF) + return (-1); + /* Correctly gets a Unicode, returns used bytes. */ + *pwc = wc; + return (cnt); +} + +static void strdump(const char *e, const char *p, int ewidth, int utf8) +{ + const char *q = p; + + logprintf(" %*s = ", ewidth, e); + if (p == NULL) { + logprintf("NULL\n"); + return; + } + logprintf("\""); + while (*p != '\0') { + unsigned int c = 0xff & *p++; + switch (c) { + case '\a': logprintf("\\a"); break; + case '\b': logprintf("\\b"); break; + case '\n': logprintf("\\n"); break; + case '\r': logprintf("\\r"); break; + default: + if (c >= 32 && c < 127) + logprintf("%c", c); + else + logprintf("\\x%02X", c); + } + } + logprintf("\""); + logprintf(" (length %d)", q == NULL ? -1 : (int)strlen(q)); + + /* + * If the current string is UTF-8, dump its code points. + */ + if (utf8) { + size_t len; + uint32_t uc; + int n; + int cnt = 0; + + p = q; + len = strlen(p); + logprintf(" ["); + while ((n = _utf8_to_unicode(&uc, p, len)) > 0) { + if (p != q) + logprintf(" "); + logprintf("%04X", uc); + p += n; + len -= n; + cnt++; + } + logprintf("]"); + logprintf(" (count %d", cnt); + if (n < 0) { + logprintf(",unknown %d bytes", len); + } + logprintf(")"); + + } + logprintf("\n"); +} + +/* Verify two strings are equal, dump them if not. */ +int +assertion_equal_string(const char *file, int line, + const char *v1, const char *e1, + const char *v2, const char *e2, + void *extra, int utf8) +{ + int l1, l2; + + assertion_count(file, line); + if (v1 == v2 || (v1 != NULL && v2 != NULL && strcmp(v1, v2) == 0)) + return (1); + failure_start(file, line, "%s != %s", e1, e2); + l1 = (int)strlen(e1); + l2 = (int)strlen(e2); + if (l1 < l2) + l1 = l2; + strdump(e1, v1, l1, utf8); + strdump(e2, v2, l1, utf8); + failure_finish(extra); + return (0); +} + +static void +wcsdump(const char *e, const wchar_t *w) +{ + logprintf(" %s = ", e); + if (w == NULL) { + logprintf("(null)"); + return; + } + logprintf("\""); + while (*w != L'\0') { + unsigned int c = *w++; + if (c >= 32 && c < 127) + logprintf("%c", c); + else if (c < 256) + logprintf("\\x%02X", c); + else if (c < 0x10000) + logprintf("\\u%04X", c); + else + logprintf("\\U%08X", c); + } + logprintf("\"\n"); +} + +#ifndef HAVE_WCSCMP +static int +wcscmp(const wchar_t *s1, const wchar_t *s2) +{ + + while (*s1 == *s2++) { + if (*s1++ == L'\0') + return 0; + } + if (*s1 > *--s2) + return 1; + else + return -1; +} +#endif + +/* Verify that two wide strings are equal, dump them if not. */ +int +assertion_equal_wstring(const char *file, int line, + const wchar_t *v1, const char *e1, + const wchar_t *v2, const char *e2, + void *extra) +{ + assertion_count(file, line); + if (v1 == v2) + return (1); + if (v1 != NULL && v2 != NULL && wcscmp(v1, v2) == 0) + return (1); + failure_start(file, line, "%s != %s", e1, e2); + wcsdump(e1, v1); + wcsdump(e2, v2); + failure_finish(extra); + return (0); +} + +/* + * Pretty standard hexdump routine. As a bonus, if ref != NULL, then + * any bytes in p that differ from ref will be highlighted with '_' + * before and after the hex value. + */ +static void +hexdump(const char *p, const char *ref, size_t l, size_t offset) +{ + size_t i, j; + char sep; + + if (p == NULL) { + logprintf("(null)\n"); + return; + } + for(i=0; i < l; i+=16) { + logprintf("%04x", (unsigned)(i + offset)); + sep = ' '; + for (j = 0; j < 16 && i + j < l; j++) { + if (ref != NULL && p[i + j] != ref[i + j]) + sep = '_'; + logprintf("%c%02x", sep, 0xff & (int)p[i+j]); + if (ref != NULL && p[i + j] == ref[i + j]) + sep = ' '; + } + for (; j < 16; j++) { + logprintf("%c ", sep); + sep = ' '; + } + logprintf("%c", sep); + for (j=0; j < 16 && i + j < l; j++) { + int c = p[i + j]; + if (c >= ' ' && c <= 126) + logprintf("%c", c); + else + logprintf("."); + } + logprintf("\n"); + } +} + +/* Verify that two blocks of memory are the same, display the first + * block of differences if they're not. */ +int +assertion_equal_mem(const char *file, int line, + const void *_v1, const char *e1, + const void *_v2, const char *e2, + size_t l, const char *ld, void *extra) +{ + const char *v1 = (const char *)_v1; + const char *v2 = (const char *)_v2; + size_t offset; + + assertion_count(file, line); + if (v1 == v2 || (v1 != NULL && v2 != NULL && memcmp(v1, v2, l) == 0)) + return (1); + if (v1 == NULL || v2 == NULL) + return (0); + + failure_start(file, line, "%s != %s", e1, e2); + logprintf(" size %s = %d\n", ld, (int)l); + /* Dump 48 bytes (3 lines) so that the first difference is + * in the second line. */ + offset = 0; + while (l > 64 && memcmp(v1, v2, 32) == 0) { + /* Two lines agree, so step forward one line. */ + v1 += 16; + v2 += 16; + l -= 16; + offset += 16; + } + logprintf(" Dump of %s\n", e1); + hexdump(v1, v2, l < 128 ? l : 128, offset); + logprintf(" Dump of %s\n", e2); + hexdump(v2, v1, l < 128 ? l : 128, offset); + logprintf("\n"); + failure_finish(extra); + return (0); +} + +/* Verify that a block of memory is filled with the specified byte. */ +int +assertion_memory_filled_with(const char *file, int line, + const void *_v1, const char *vd, + size_t l, const char *ld, + char b, const char *bd, void *extra) +{ + const char *v1 = (const char *)_v1; + size_t c = 0; + size_t i; + (void)ld; /* UNUSED */ + + assertion_count(file, line); + + for (i = 0; i < l; ++i) { + if (v1[i] == b) { + ++c; + } + } + if (c == l) + return (1); + + failure_start(file, line, "%s (size %d) not filled with %s", vd, (int)l, bd); + logprintf(" Only %d bytes were correct\n", (int)c); + failure_finish(extra); + return (0); +} + +/* Verify that the named file exists and is empty. */ +int +assertion_empty_file(const char *filename, int line, const char *f1) +{ + char buff[1024]; + struct stat st; + ssize_t s; + FILE *f; + + assertion_count(filename, line); + + if (stat(f1, &st) != 0) { + failure_start(filename, line, "Stat failed: %s", f1); + failure_finish(NULL); + return (0); + } + if (st.st_size == 0) + return (1); + + failure_start(filename, line, "File should be empty: %s", f1); + logprintf(" File size: %d\n", (int)st.st_size); + logprintf(" Contents:\n"); + f = fopen(f1, "rb"); + if (f == NULL) { + logprintf(" Unable to open %s\n", f1); + } else { + s = ((off_t)sizeof(buff) < st.st_size) ? + (ssize_t)sizeof(buff) : (ssize_t)st.st_size; + s = fread(buff, 1, s, f); + hexdump(buff, NULL, s, 0); + fclose(f); + } + failure_finish(NULL); + return (0); +} + +/* Verify that the named file exists and is not empty. */ +int +assertion_non_empty_file(const char *filename, int line, const char *f1) +{ + struct stat st; + + assertion_count(filename, line); + + if (stat(f1, &st) != 0) { + failure_start(filename, line, "Stat failed: %s", f1); + failure_finish(NULL); + return (0); + } + if (st.st_size == 0) { + failure_start(filename, line, "File empty: %s", f1); + failure_finish(NULL); + return (0); + } + return (1); +} + +/* Verify that two files have the same contents. */ +/* TODO: hexdump the first bytes that actually differ. */ +int +assertion_equal_file(const char *filename, int line, const char *fn1, const char *fn2) +{ + char buff1[1024]; + char buff2[1024]; + FILE *f1, *f2; + int n1, n2; + + assertion_count(filename, line); + + f1 = fopen(fn1, "rb"); + f2 = fopen(fn2, "rb"); + if (f1 == NULL || f2 == NULL) { + if (f1) fclose(f1); + if (f2) fclose(f2); + return (0); + } + for (;;) { + n1 = (int)fread(buff1, 1, sizeof(buff1), f1); + n2 = (int)fread(buff2, 1, sizeof(buff2), f2); + if (n1 != n2) + break; + if (n1 == 0 && n2 == 0) { + fclose(f1); + fclose(f2); + return (1); + } + if (memcmp(buff1, buff2, n1) != 0) + break; + } + fclose(f1); + fclose(f2); + failure_start(filename, line, "Files not identical"); + logprintf(" file1=\"%s\"\n", fn1); + logprintf(" file2=\"%s\"\n", fn2); + failure_finish(NULL); + return (0); +} + +/* Verify that the named file does exist. */ +int +assertion_file_exists(const char *filename, int line, const char *f) +{ + assertion_count(filename, line); + +#if defined(_WIN32) && !defined(__CYGWIN__) + if (!_access(f, 0)) + return (1); +#else + if (!access(f, F_OK)) + return (1); +#endif + failure_start(filename, line, "File should exist: %s", f); + failure_finish(NULL); + return (0); +} + +/* Verify that the named file doesn't exist. */ +int +assertion_file_not_exists(const char *filename, int line, const char *f) +{ + assertion_count(filename, line); + +#if defined(_WIN32) && !defined(__CYGWIN__) + if (_access(f, 0)) + return (1); +#else + if (access(f, F_OK)) + return (1); +#endif + failure_start(filename, line, "File should not exist: %s", f); + failure_finish(NULL); + return (0); +} + +/* Compare the contents of a file to a block of memory. */ +int +assertion_file_contents(const char *filename, int line, const void *buff, int s, const char *fn) +{ + char *contents; + FILE *f; + int n; + + assertion_count(filename, line); + + f = fopen(fn, "rb"); + if (f == NULL) { + failure_start(filename, line, + "File should exist: %s", fn); + failure_finish(NULL); + return (0); + } + contents = malloc(s * 2); + n = (int)fread(contents, 1, s * 2, f); + fclose(f); + if (n == s && memcmp(buff, contents, s) == 0) { + free(contents); + return (1); + } + failure_start(filename, line, "File contents don't match"); + logprintf(" file=\"%s\"\n", fn); + if (n > 0) + hexdump(contents, buff, n > 512 ? 512 : n, 0); + else { + logprintf(" File empty, contents should be:\n"); + hexdump(buff, NULL, s > 512 ? 512 : s, 0); + } + failure_finish(NULL); + free(contents); + return (0); +} + +/* Check the contents of a text file, being tolerant of line endings. */ +int +assertion_text_file_contents(const char *filename, int line, const char *buff, const char *fn) +{ + char *contents; + const char *btxt, *ftxt; + FILE *f; + int n, s; + + assertion_count(filename, line); + f = fopen(fn, "r"); + if (f == NULL) { + failure_start(filename, line, + "File doesn't exist: %s", fn); + failure_finish(NULL); + return (0); + } + s = (int)strlen(buff); + contents = malloc(s * 2 + 128); + n = (int)fread(contents, 1, s * 2 + 128 - 1, f); + if (n >= 0) + contents[n] = '\0'; + fclose(f); + /* Compare texts. */ + btxt = buff; + ftxt = (const char *)contents; + while (*btxt != '\0' && *ftxt != '\0') { + if (*btxt == *ftxt) { + ++btxt; + ++ftxt; + continue; + } + if (btxt[0] == '\n' && ftxt[0] == '\r' && ftxt[1] == '\n') { + /* Pass over different new line characters. */ + ++btxt; + ftxt += 2; + continue; + } + break; + } + if (*btxt == '\0' && *ftxt == '\0') { + free(contents); + return (1); + } + failure_start(filename, line, "Contents don't match"); + logprintf(" file=\"%s\"\n", fn); + if (n > 0) { + hexdump(contents, buff, n, 0); + logprintf(" expected\n", fn); + hexdump(buff, contents, s, 0); + } else { + logprintf(" File empty, contents should be:\n"); + hexdump(buff, NULL, s, 0); + } + failure_finish(NULL); + free(contents); + return (0); +} + +/* Verify that a text file contains the specified lines, regardless of order */ +/* This could be more efficient if we sorted both sets of lines, etc, but + * since this is used only for testing and only ever deals with a dozen or so + * lines at a time, this relatively crude approach is just fine. */ +int +assertion_file_contains_lines_any_order(const char *file, int line, + const char *pathname, const char *lines[]) +{ + char *buff; + size_t buff_size; + size_t expected_count, actual_count, i, j; + char **expected = NULL; + char *p, **actual = NULL; + char c; + int expected_failure = 0, actual_failure = 0; + + assertion_count(file, line); + + buff = slurpfile(&buff_size, "%s", pathname); + if (buff == NULL) { + failure_start(pathname, line, "Can't read file: %s", pathname); + failure_finish(NULL); + return (0); + } + + /* Make a copy of the provided lines and count up the expected + * file size. */ + for (i = 0; lines[i] != NULL; ++i) { + } + expected_count = i; + if (expected_count) { + expected = malloc(sizeof(char *) * expected_count); + if (expected == NULL) { + failure_start(pathname, line, "Can't allocate memory"); + failure_finish(NULL); + free(expected); + return (0); + } + for (i = 0; lines[i] != NULL; ++i) { + expected[i] = strdup(lines[i]); + } + } + + /* Break the file into lines */ + actual_count = 0; + for (c = '\0', p = buff; p < buff + buff_size; ++p) { + if (*p == '\x0d' || *p == '\x0a') + *p = '\0'; + if (c == '\0' && *p != '\0') + ++actual_count; + c = *p; + } + if (actual_count) { + actual = calloc(sizeof(char *), actual_count); + if (actual == NULL) { + failure_start(pathname, line, "Can't allocate memory"); + failure_finish(NULL); + free(expected); + return (0); + } + for (j = 0, p = buff; p < buff + buff_size; + p += 1 + strlen(p)) { + if (*p != '\0') { + actual[j] = p; + ++j; + } + } + } + + /* Erase matching lines from both lists */ + for (i = 0; i < expected_count; ++i) { + if (expected[i] == NULL) + continue; + for (j = 0; j < actual_count; ++j) { + if (actual[j] == NULL) + continue; + if (strcmp(expected[i], actual[j]) == 0) { + free(expected[i]); + expected[i] = NULL; + actual[j] = NULL; + break; + } + } + } + + /* If there's anything left, it's a failure */ + for (i = 0; i < expected_count; ++i) { + if (expected[i] != NULL) + ++expected_failure; + } + for (j = 0; j < actual_count; ++j) { + if (actual[j] != NULL) + ++actual_failure; + } + if (expected_failure == 0 && actual_failure == 0) { + free(buff); + free(expected); + free(actual); + return (1); + } + failure_start(file, line, "File doesn't match: %s", pathname); + for (i = 0; i < expected_count; ++i) { + if (expected[i] != NULL) { + logprintf(" Expected but not present: %s\n", expected[i]); + free(expected[i]); + } + } + for (j = 0; j < actual_count; ++j) { + if (actual[j] != NULL) + logprintf(" Present but not expected: %s\n", actual[j]); + } + failure_finish(NULL); + free(buff); + free(expected); + free(actual); + return (0); +} + +/* Test that two paths point to the same file. */ +/* As a side-effect, asserts that both files exist. */ +static int +is_hardlink(const char *file, int line, + const char *path1, const char *path2) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + BY_HANDLE_FILE_INFORMATION bhfi1, bhfi2; + int r; + + assertion_count(file, line); + r = my_GetFileInformationByName(path1, &bhfi1); + if (r == 0) { + failure_start(file, line, "File %s can't be inspected?", path1); + failure_finish(NULL); + return (0); + } + r = my_GetFileInformationByName(path2, &bhfi2); + if (r == 0) { + failure_start(file, line, "File %s can't be inspected?", path2); + failure_finish(NULL); + return (0); + } + return (bhfi1.dwVolumeSerialNumber == bhfi2.dwVolumeSerialNumber + && bhfi1.nFileIndexHigh == bhfi2.nFileIndexHigh + && bhfi1.nFileIndexLow == bhfi2.nFileIndexLow); +#else + struct stat st1, st2; + int r; + + assertion_count(file, line); + r = lstat(path1, &st1); + if (r != 0) { + failure_start(file, line, "File should exist: %s", path1); + failure_finish(NULL); + return (0); + } + r = lstat(path2, &st2); + if (r != 0) { + failure_start(file, line, "File should exist: %s", path2); + failure_finish(NULL); + return (0); + } + return (st1.st_ino == st2.st_ino && st1.st_dev == st2.st_dev); +#endif +} + +int +assertion_is_hardlink(const char *file, int line, + const char *path1, const char *path2) +{ + if (is_hardlink(file, line, path1, path2)) + return (1); + failure_start(file, line, + "Files %s and %s are not hardlinked", path1, path2); + failure_finish(NULL); + return (0); +} + +int +assertion_is_not_hardlink(const char *file, int line, + const char *path1, const char *path2) +{ + if (!is_hardlink(file, line, path1, path2)) + return (1); + failure_start(file, line, + "Files %s and %s should not be hardlinked", path1, path2); + failure_finish(NULL); + return (0); +} + +/* Verify a/b/mtime of 'pathname'. */ +/* If 'recent', verify that it's within last 10 seconds. */ +static int +assertion_file_time(const char *file, int line, + const char *pathname, long t, long nsec, char type, int recent) +{ + long long filet, filet_nsec; + int r; + +#if defined(_WIN32) && !defined(__CYGWIN__) +#define EPOC_TIME (116444736000000000ULL) + FILETIME fxtime, fbirthtime, fatime, fmtime; + ULARGE_INTEGER wintm; + HANDLE h; + fxtime.dwLowDateTime = 0; + fxtime.dwHighDateTime = 0; + + assertion_count(file, 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, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (h == INVALID_HANDLE_VALUE) { + failure_start(file, line, "Can't access %s\n", pathname); + failure_finish(NULL); + return (0); + } + r = GetFileTime(h, &fbirthtime, &fatime, &fmtime); + switch (type) { + case 'a': fxtime = fatime; break; + case 'b': fxtime = fbirthtime; break; + case 'm': fxtime = fmtime; break; + } + CloseHandle(h); + if (r == 0) { + failure_start(file, line, "Can't GetFileTime %s\n", pathname); + failure_finish(NULL); + return (0); + } + wintm.LowPart = fxtime.dwLowDateTime; + wintm.HighPart = fxtime.dwHighDateTime; + filet = (wintm.QuadPart - EPOC_TIME) / 10000000; + filet_nsec = ((wintm.QuadPart - EPOC_TIME) % 10000000) * 100; + nsec = (nsec / 100) * 100; /* Round the request */ +#else + struct stat st; + + assertion_count(file, line); + r = lstat(pathname, &st); + if (r != 0) { + failure_start(file, line, "Can't stat %s\n", pathname); + failure_finish(NULL); + return (0); + } + switch (type) { + case 'a': filet = st.st_atime; break; + case 'm': filet = st.st_mtime; break; + case 'b': filet = 0; break; + default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); + exit(1); + } +#if defined(__FreeBSD__) + switch (type) { + case 'a': filet_nsec = st.st_atimespec.tv_nsec; break; + case 'b': filet = st.st_birthtime; + filet_nsec = st.st_birthtimespec.tv_nsec; break; + case 'm': filet_nsec = st.st_mtimespec.tv_nsec; break; + default: fprintf(stderr, "INTERNAL: Bad type %c for file time", type); + exit(1); + } + /* FreeBSD generally only stores to microsecond res, so round. */ + filet_nsec = (filet_nsec / 1000) * 1000; + nsec = (nsec / 1000) * 1000; +#else + filet_nsec = nsec = 0; /* Generic POSIX only has whole seconds. */ + if (type == 'b') return (1); /* Generic POSIX doesn't have birthtime */ +#if defined(__HAIKU__) + if (type == 'a') return (1); /* Haiku doesn't have atime. */ +#endif +#endif +#endif + if (recent) { + /* Check that requested time is up-to-date. */ + time_t now = time(NULL); + if (filet < now - 10 || filet > now + 1) { + failure_start(file, line, + "File %s has %ctime %lld, %lld seconds ago\n", + pathname, type, filet, now - filet); + failure_finish(NULL); + return (0); + } + } else if (filet != t || filet_nsec != nsec) { + failure_start(file, line, + "File %s has %ctime %lld.%09lld, expected %lld.%09lld", + pathname, type, filet, filet_nsec, t, nsec); + failure_finish(NULL); + return (0); + } + return (1); +} + +/* Verify atime of 'pathname'. */ +int +assertion_file_atime(const char *file, int line, + const char *pathname, long t, long nsec) +{ + return assertion_file_time(file, line, pathname, t, nsec, 'a', 0); +} + +/* Verify atime of 'pathname' is up-to-date. */ +int +assertion_file_atime_recent(const char *file, int line, const char *pathname) +{ + return assertion_file_time(file, line, pathname, 0, 0, 'a', 1); +} + +/* Verify birthtime of 'pathname'. */ +int +assertion_file_birthtime(const char *file, int line, + const char *pathname, long t, long nsec) +{ + return assertion_file_time(file, line, pathname, t, nsec, 'b', 0); +} + +/* Verify birthtime of 'pathname' is up-to-date. */ +int +assertion_file_birthtime_recent(const char *file, int line, + const char *pathname) +{ + return assertion_file_time(file, line, pathname, 0, 0, 'b', 1); +} + +/* Verify mtime of 'pathname'. */ +int +assertion_file_mtime(const char *file, int line, + const char *pathname, long t, long nsec) +{ + return assertion_file_time(file, line, pathname, t, nsec, 'm', 0); +} + +/* Verify mtime of 'pathname' is up-to-date. */ +int +assertion_file_mtime_recent(const char *file, int line, const char *pathname) +{ + return assertion_file_time(file, line, pathname, 0, 0, 'm', 1); +} + +/* Verify number of links to 'pathname'. */ +int +assertion_file_nlinks(const char *file, int line, + const char *pathname, int nlinks) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + BY_HANDLE_FILE_INFORMATION bhfi; + int r; + + assertion_count(file, line); + r = my_GetFileInformationByName(pathname, &bhfi); + if (r != 0 && bhfi.nNumberOfLinks == (DWORD)nlinks) + return (1); + failure_start(file, line, "File %s has %d links, expected %d", + pathname, bhfi.nNumberOfLinks, nlinks); + failure_finish(NULL); + return (0); +#else + struct stat st; + int r; + + assertion_count(file, line); + r = lstat(pathname, &st); + if (r == 0 && (int)st.st_nlink == nlinks) + return (1); + failure_start(file, line, "File %s has %d links, expected %d", + pathname, st.st_nlink, nlinks); + failure_finish(NULL); + return (0); +#endif +} + +/* Verify size of 'pathname'. */ +int +assertion_file_size(const char *file, int line, const char *pathname, long size) +{ + int64_t filesize; + int r; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + { + BY_HANDLE_FILE_INFORMATION bhfi; + r = !my_GetFileInformationByName(pathname, &bhfi); + filesize = ((int64_t)bhfi.nFileSizeHigh << 32) + bhfi.nFileSizeLow; + } +#else + { + struct stat st; + r = lstat(pathname, &st); + filesize = st.st_size; + } +#endif + if (r == 0 && filesize == size) + return (1); + failure_start(file, line, "File %s has size %ld, expected %ld", + pathname, (long)filesize, (long)size); + failure_finish(NULL); + return (0); +} + +/* Assert that 'pathname' is a dir. If mode >= 0, verify that too. */ +int +assertion_is_dir(const char *file, int line, const char *pathname, int mode) +{ + struct stat st; + int r; + +#if defined(_WIN32) && !defined(__CYGWIN__) + (void)mode; /* UNUSED */ +#endif + assertion_count(file, line); + r = lstat(pathname, &st); + if (r != 0) { + failure_start(file, line, "Dir should exist: %s", pathname); + failure_finish(NULL); + return (0); + } + if (!S_ISDIR(st.st_mode)) { + failure_start(file, line, "%s is not a dir", pathname); + failure_finish(NULL); + return (0); + } +#if !defined(_WIN32) || defined(__CYGWIN__) + /* Windows doesn't handle permissions the same way as POSIX, + * so just ignore the mode tests. */ + /* TODO: Can we do better here? */ + if (mode >= 0 && (mode_t)mode != (st.st_mode & 07777)) { + failure_start(file, line, "Dir %s has wrong mode", pathname); + logprintf(" Expected: 0%3o\n", mode); + logprintf(" Found: 0%3o\n", st.st_mode & 07777); + failure_finish(NULL); + return (0); + } +#endif + return (1); +} + +/* Verify that 'pathname' is a regular file. If 'mode' is >= 0, + * verify that too. */ +int +assertion_is_reg(const char *file, int line, const char *pathname, int mode) +{ + struct stat st; + int r; + +#if defined(_WIN32) && !defined(__CYGWIN__) + (void)mode; /* UNUSED */ +#endif + assertion_count(file, line); + r = lstat(pathname, &st); + if (r != 0 || !S_ISREG(st.st_mode)) { + failure_start(file, line, "File should exist: %s", pathname); + failure_finish(NULL); + return (0); + } +#if !defined(_WIN32) || defined(__CYGWIN__) + /* Windows doesn't handle permissions the same way as POSIX, + * so just ignore the mode tests. */ + /* TODO: Can we do better here? */ + if (mode >= 0 && (mode_t)mode != (st.st_mode & 07777)) { + failure_start(file, line, "File %s has wrong mode", pathname); + logprintf(" Expected: 0%3o\n", mode); + logprintf(" Found: 0%3o\n", st.st_mode & 07777); + failure_finish(NULL); + return (0); + } +#endif + return (1); +} + +/* Check whether 'pathname' is a symbolic link. If 'contents' is + * non-NULL, verify that the symlink has those contents. */ +static int +is_symlink(const char *file, int line, + const char *pathname, const char *contents) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + (void)pathname; /* UNUSED */ + (void)contents; /* UNUSED */ + assertion_count(file, line); + /* Windows sort-of has real symlinks, but they're only usable + * by privileged users and are crippled even then, so there's + * really not much point in bothering with this. */ + return (0); +#else + char buff[300]; + struct stat st; + ssize_t linklen; + int r; + + assertion_count(file, line); + r = lstat(pathname, &st); + if (r != 0) { + failure_start(file, line, + "Symlink should exist: %s", pathname); + failure_finish(NULL); + return (0); + } + if (!S_ISLNK(st.st_mode)) + return (0); + if (contents == NULL) + return (1); + linklen = readlink(pathname, buff, sizeof(buff)); + if (linklen < 0) { + failure_start(file, line, "Can't read symlink %s", pathname); + failure_finish(NULL); + return (0); + } + buff[linklen] = '\0'; + if (strcmp(buff, contents) != 0) + return (0); + return (1); +#endif +} + +/* Assert that path is a symlink that (optionally) contains contents. */ +int +assertion_is_symlink(const char *file, int line, + const char *path, const char *contents) +{ + if (is_symlink(file, line, path, contents)) + return (1); + if (contents) + failure_start(file, line, "File %s is not a symlink to %s", + path, contents); + else + failure_start(file, line, "File %s is not a symlink", path); + failure_finish(NULL); + return (0); +} + + +/* Create a directory and report any errors. */ +int +assertion_make_dir(const char *file, int line, const char *dirname, int mode) +{ + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + (void)mode; /* UNUSED */ + if (0 == _mkdir(dirname)) + return (1); +#else + if (0 == mkdir(dirname, mode)) + return (1); +#endif + failure_start(file, line, "Could not create directory %s", dirname); + failure_finish(NULL); + return(0); +} + +/* Create a file with the specified contents and report any failures. */ +int +assertion_make_file(const char *file, int line, + const char *path, int mode, int csize, const void *contents) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + /* TODO: Rework this to set file mode as well. */ + FILE *f; + (void)mode; /* UNUSED */ + assertion_count(file, line); + f = fopen(path, "wb"); + if (f == NULL) { + failure_start(file, line, "Could not create file %s", path); + failure_finish(NULL); + return (0); + } + if (contents != NULL) { + size_t wsize; + + if (csize < 0) + wsize = strlen(contents); + else + wsize = (size_t)csize; + if (wsize != fwrite(contents, 1, wsize, f)) { + fclose(f); + failure_start(file, line, + "Could not write file %s", path); + failure_finish(NULL); + return (0); + } + } + fclose(f); + return (1); +#else + int fd; + assertion_count(file, line); + fd = open(path, O_CREAT | O_WRONLY, mode >= 0 ? mode : 0644); + if (fd < 0) { + failure_start(file, line, "Could not create %s", path); + failure_finish(NULL); + return (0); + } + if (contents != NULL) { + ssize_t wsize; + + if (csize < 0) + wsize = (ssize_t)strlen(contents); + else + wsize = (ssize_t)csize; + if (wsize != write(fd, contents, wsize)) { + close(fd); + failure_start(file, line, + "Could not write to %s", path); + failure_finish(NULL); + return (0); + } + } + close(fd); + return (1); +#endif +} + +/* Create a hardlink and report any failures. */ +int +assertion_make_hardlink(const char *file, int line, + const char *newpath, const char *linkto) +{ + int succeeded; + + assertion_count(file, line); +#if defined(_WIN32) && !defined(__CYGWIN__) + succeeded = my_CreateHardLinkA(newpath, linkto); +#elif HAVE_LINK + succeeded = !link(linkto, newpath); +#else + succeeded = 0; +#endif + if (succeeded) + return (1); + failure_start(file, line, "Could not create hardlink"); + logprintf(" New link: %s\n", newpath); + logprintf(" Old name: %s\n", linkto); + failure_finish(NULL); + return(0); +} + +/* Create a symlink and report any failures. */ +int +assertion_make_symlink(const char *file, int line, + const char *newpath, const char *linkto) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + int targetIsDir = 0; /* TODO: Fix this */ + assertion_count(file, line); + if (my_CreateSymbolicLinkA(newpath, linkto, targetIsDir)) + return (1); +#elif HAVE_SYMLINK + assertion_count(file, line); + if (0 == symlink(linkto, newpath)) + return (1); +#endif + failure_start(file, line, "Could not create symlink"); + logprintf(" New link: %s\n", newpath); + logprintf(" Old name: %s\n", linkto); + failure_finish(NULL); + return(0); +} + +/* Set umask, report failures. */ +int +assertion_umask(const char *file, int line, int mask) +{ + assertion_count(file, line); + (void)file; /* UNUSED */ + (void)line; /* UNUSED */ + umask(mask); + return (1); +} + +/* Set times, report failures. */ +int +assertion_utimes(const char *file, int line, + const char *pathname, long at, long at_nsec, long mt, long mt_nsec) +{ + int r; + +#if defined(_WIN32) && !defined(__CYGWIN__) +#define WINTIME(sec, nsec) ((Int32x32To64(sec, 10000000) + EPOC_TIME)\ + + (((nsec)/1000)*10)) + HANDLE h; + ULARGE_INTEGER wintm; + FILETIME fatime, fmtime; + FILETIME *pat, *pmt; + + assertion_count(file, line); + h = CreateFileA(pathname,GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, NULL); + if (h == INVALID_HANDLE_VALUE) { + failure_start(file, line, "Can't access %s\n", pathname); + failure_finish(NULL); + return (0); + } + + if (at > 0 || at_nsec > 0) { + wintm.QuadPart = WINTIME(at, at_nsec); + fatime.dwLowDateTime = wintm.LowPart; + fatime.dwHighDateTime = wintm.HighPart; + pat = &fatime; + } else + pat = NULL; + if (mt > 0 || mt_nsec > 0) { + wintm.QuadPart = WINTIME(mt, mt_nsec); + fmtime.dwLowDateTime = wintm.LowPart; + fmtime.dwHighDateTime = wintm.HighPart; + pmt = &fmtime; + } else + pmt = NULL; + if (pat != NULL || pmt != NULL) + r = SetFileTime(h, NULL, pat, pmt); + else + r = 1; + CloseHandle(h); + if (r == 0) { + failure_start(file, line, "Can't SetFileTime %s\n", pathname); + failure_finish(NULL); + return (0); + } + return (1); +#else /* defined(_WIN32) && !defined(__CYGWIN__) */ + struct stat st; + struct timeval times[2]; + +#if !defined(__FreeBSD__) + mt_nsec = at_nsec = 0; /* Generic POSIX only has whole seconds. */ +#endif + if (mt == 0 && mt_nsec == 0 && at == 0 && at_nsec == 0) + return (1); + + r = lstat(pathname, &st); + if (r < 0) { + failure_start(file, line, "Can't stat %s\n", pathname); + failure_finish(NULL); + return (0); + } + + if (mt == 0 && mt_nsec == 0) { + mt = st.st_mtime; +#if defined(__FreeBSD__) + mt_nsec = st.st_mtimespec.tv_nsec; + /* FreeBSD generally only stores to microsecond res, so round. */ + mt_nsec = (mt_nsec / 1000) * 1000; +#endif + } + if (at == 0 && at_nsec == 0) { + at = st.st_atime; +#if defined(__FreeBSD__) + at_nsec = st.st_atimespec.tv_nsec; + /* FreeBSD generally only stores to microsecond res, so round. */ + at_nsec = (at_nsec / 1000) * 1000; +#endif + } + + times[1].tv_sec = mt; + times[1].tv_usec = mt_nsec / 1000; + + times[0].tv_sec = at; + times[0].tv_usec = at_nsec / 1000; + +#ifdef HAVE_LUTIMES + r = lutimes(pathname, times); +#else + r = utimes(pathname, times); +#endif + if (r < 0) { + failure_start(file, line, "Can't utimes %s\n", pathname); + failure_finish(NULL); + return (0); + } + return (1); +#endif /* defined(_WIN32) && !defined(__CYGWIN__) */ +} + +/* Set nodump, report failures. */ +int +assertion_nodump(const char *file, int line, const char *pathname) +{ +#if defined(HAVE_STRUCT_STAT_ST_FLAGS) && defined(UF_NODUMP) + int r; + + assertion_count(file, line); + r = chflags(pathname, UF_NODUMP); + if (r < 0) { + failure_start(file, line, "Can't set nodump %s\n", pathname); + failure_finish(NULL); + return (0); + } +#elif defined(EXT2_IOC_GETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS)\ + && defined(EXT2_NODUMP_FL) + int fd, r, flags; + + assertion_count(file, line); + fd = open(pathname, O_RDONLY | O_NONBLOCK); + if (fd < 0) { + failure_start(file, line, "Can't open %s\n", pathname); + failure_finish(NULL); + return (0); + } + r = ioctl(fd, EXT2_IOC_GETFLAGS, &flags); + if (r < 0) { + failure_start(file, line, "Can't get flags %s\n", pathname); + failure_finish(NULL); + return (0); + } + flags |= EXT2_NODUMP_FL; + r = ioctl(fd, EXT2_IOC_SETFLAGS, &flags); + if (r < 0) { + failure_start(file, line, "Can't set nodump %s\n", pathname); + failure_finish(NULL); + return (0); + } + close(fd); +#else + (void)pathname; /* UNUSED */ + assertion_count(file, line); +#endif + return (1); +} + +/* + * + * UTILITIES for use by tests. + * + */ + +/* + * Check whether platform supports symlinks. This is intended + * for tests to use in deciding whether to bother testing symlink + * support; if the platform doesn't support symlinks, there's no point + * in checking whether the program being tested can create them. + * + * Note that the first time this test is called, we actually go out to + * disk to create and verify a symlink. This is necessary because + * symlink support is actually a property of a particular filesystem + * and can thus vary between directories on a single system. After + * the first call, this returns the cached result from memory, so it's + * safe to call it as often as you wish. + */ +int +canSymlink(void) +{ + /* Remember the test result */ + static int value = 0, tested = 0; + if (tested) + return (value); + + ++tested; + assertion_make_file(__FILE__, __LINE__, "canSymlink.0", 0644, 1, "a"); + /* Note: Cygwin has its own symlink() emulation that does not + * use the Win32 CreateSymbolicLink() function. */ +#if defined(_WIN32) && !defined(__CYGWIN__) + value = my_CreateSymbolicLinkA("canSymlink.1", "canSymlink.0", 0) + && is_symlink(__FILE__, __LINE__, "canSymlink.1", "canSymlink.0"); +#elif HAVE_SYMLINK + value = (0 == symlink("canSymlink.0", "canSymlink.1")) + && is_symlink(__FILE__, __LINE__, "canSymlink.1","canSymlink.0"); +#endif + return (value); +} + +/* Platform-dependent options for hiding the output of a subcommand. */ +#if defined(_WIN32) && !defined(__CYGWIN__) +static const char *redirectArgs = ">NUL 2>NUL"; /* Win32 cmd.exe */ +#else +static const char *redirectArgs = ">/dev/null 2>/dev/null"; /* POSIX 'sh' */ +#endif +/* + * Can this platform run the bzip2 program? + */ +int +canBzip2(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("bzip2 -d -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the grzip program? + */ +int +canGrzip(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("grzip -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the gzip program? + */ +int +canGzip(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("gzip -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the lrzip program? + */ +int +canRunCommand(const char *cmd) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("%s %s", cmd, redirectArgs) == 0) + value = 1; + } + return (value); +} + +int +canLrzip(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("lrzip -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the lz4 program? + */ +int +canLz4(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("lz4 -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the lzip program? + */ +int +canLzip(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("lzip -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the lzma program? + */ +int +canLzma(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("lzma -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the lzop program? + */ +int +canLzop(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("lzop -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this platform run the xz program? + */ +int +canXz(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("xz -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + +/* + * Can this filesystem handle nodump flags. + */ +#if defined(HAVE_STRUCT_STAT_ST_FLAGS) && defined(UF_NODUMP) + +int +canNodump(void) +{ + const char *path = "cannodumptest"; + struct stat sb; + + assertion_make_file(__FILE__, __LINE__, path, 0644, 0, NULL); + if (chflags(path, UF_NODUMP) < 0) + return (0); + if (stat(path, &sb) < 0) + return (0); + if (sb.st_flags & UF_NODUMP) + return (1); + return (0); +} + +#elif defined(EXT2_IOC_GETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS)\ + && defined(EXT2_NODUMP_FL) + +int +canNodump(void) +{ + const char *path = "cannodumptest"; + int fd, r, flags; + + assertion_make_file(__FILE__, __LINE__, path, 0644, 0, NULL); + fd = open(path, O_RDONLY | O_NONBLOCK); + if (fd < 0) + return (0); + r = ioctl(fd, EXT2_IOC_GETFLAGS, &flags); + if (r < 0) + return (0); + flags |= EXT2_NODUMP_FL; + r = ioctl(fd, EXT2_IOC_SETFLAGS, &flags); + if (r < 0) + return (0); + close(fd); + fd = open(path, O_RDONLY | O_NONBLOCK); + if (fd < 0) + return (0); + r = ioctl(fd, EXT2_IOC_GETFLAGS, &flags); + if (r < 0) + return (0); + close(fd); + if (flags & EXT2_NODUMP_FL) + return (1); + return (0); +} + +#else + +int +canNodump() +{ + return (0); +} + +#endif + +/* + * Sleep as needed; useful for verifying disk timestamp changes by + * ensuring that the wall-clock time has actually changed before we + * go back to re-read something from disk. + */ +void +sleepUntilAfter(time_t t) +{ + while (t >= time(NULL)) +#if defined(_WIN32) && !defined(__CYGWIN__) + Sleep(500); +#else + sleep(1); +#endif +} + +/* + * Call standard system() call, but build up the command line using + * sprintf() conventions. + */ +int +systemf(const char *fmt, ...) +{ + char buff[8192]; + va_list ap; + int r; + + va_start(ap, fmt); + vsprintf(buff, fmt, ap); + if (verbosity > VERBOSITY_FULL) + logprintf("Cmd: %s\n", buff); + r = system(buff); + va_end(ap); + return (r); +} + +/* + * Slurp a file into memory for ease of comparison and testing. + * Returns size of file in 'sizep' if non-NULL, null-terminates + * data in memory for ease of use. + */ +char * +slurpfile(size_t * sizep, const char *fmt, ...) +{ + char filename[8192]; + struct stat st; + va_list ap; + char *p; + ssize_t bytes_read; + FILE *f; + int r; + + va_start(ap, fmt); + vsprintf(filename, fmt, ap); + va_end(ap); + + f = fopen(filename, "rb"); + if (f == NULL) { + /* Note: No error; non-existent file is okay here. */ + return (NULL); + } + r = fstat(fileno(f), &st); + if (r != 0) { + logprintf("Can't stat file %s\n", filename); + fclose(f); + return (NULL); + } + p = malloc((size_t)st.st_size + 1); + if (p == NULL) { + logprintf("Can't allocate %ld bytes of memory to read file %s\n", + (long int)st.st_size, filename); + fclose(f); + return (NULL); + } + bytes_read = fread(p, 1, (size_t)st.st_size, f); + if (bytes_read < st.st_size) { + logprintf("Can't read file %s\n", filename); + fclose(f); + free(p); + return (NULL); + } + p[st.st_size] = '\0'; + if (sizep != NULL) + *sizep = (size_t)st.st_size; + fclose(f); + return (p); +} + +/* + * Slurp a file into memory for ease of comparison and testing. + * Returns size of file in 'sizep' if non-NULL, null-terminates + * data in memory for ease of use. + */ +void +dumpfile(const char *filename, void *data, size_t len) +{ + ssize_t bytes_written; + FILE *f; + + f = fopen(filename, "wb"); + if (f == NULL) { + logprintf("Can't open file %s for writing\n", filename); + return; + } + bytes_written = fwrite(data, 1, len, f); + if (bytes_written < (ssize_t)len) + logprintf("Can't write file %s\n", filename); + fclose(f); +} + +/* Read a uuencoded file from the reference directory, decode, and + * write the result into the current directory. */ +#define VALID_UUDECODE(c) (c >= 32 && c <= 96) +#define UUDECODE(c) (((c) - 0x20) & 0x3f) +void +extract_reference_file(const char *name) +{ + char buff[1024]; + FILE *in, *out; + + sprintf(buff, "%s/%s.uu", refdir, name); + in = fopen(buff, "r"); + failure("Couldn't open reference file %s", buff); + assert(in != NULL); + if (in == NULL) + return; + /* Read up to and including the 'begin' line. */ + for (;;) { + if (fgets(buff, sizeof(buff), in) == NULL) { + /* TODO: This is a failure. */ + return; + } + if (memcmp(buff, "begin ", 6) == 0) + break; + } + /* Now, decode the rest and write it. */ + out = fopen(name, "wb"); + while (fgets(buff, sizeof(buff), in) != NULL) { + char *p = buff; + int bytes; + + if (memcmp(buff, "end", 3) == 0) + break; + + bytes = UUDECODE(*p++); + while (bytes > 0) { + int n = 0; + /* Write out 1-3 bytes from that. */ + if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); + assert(VALID_UUDECODE(p[1])); + n = UUDECODE(*p++) << 18; + n |= UUDECODE(*p++) << 12; + fputc(n >> 16, out); + --bytes; + } + if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); + n |= UUDECODE(*p++) << 6; + fputc((n >> 8) & 0xFF, out); + --bytes; + } + if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); + n |= UUDECODE(*p++); + fputc(n & 0xFF, out); + --bytes; + } + } + } + fclose(out); + fclose(in); +} + +void +copy_reference_file(const char *name) +{ + char buff[1024]; + FILE *in, *out; + size_t rbytes; + + sprintf(buff, "%s/%s", refdir, name); + in = fopen(buff, "rb"); + failure("Couldn't open reference file %s", buff); + assert(in != NULL); + if (in == NULL) + return; + /* Now, decode the rest and write it. */ + /* Not a lot of error checking here; the input better be right. */ + out = fopen(name, "wb"); + while ((rbytes = fread(buff, 1, sizeof(buff), in)) > 0) { + if (fwrite(buff, 1, rbytes, out) != rbytes) { + logprintf("Error: fwrite\n"); + break; + } + } + fclose(out); + fclose(in); +} + +int +is_LargeInode(const char *file) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + BY_HANDLE_FILE_INFORMATION bhfi; + int r; + + r = my_GetFileInformationByName(file, &bhfi); + if (r != 0) + return (0); + return (bhfi.nFileIndexHigh & 0x0000FFFFUL); +#else + struct stat st; + int64_t ino; + + if (stat(file, &st) < 0) + return (0); + ino = (int64_t)st.st_ino; + return (ino > 0xffffffff); +#endif +} + +void +extract_reference_files(const char **names) +{ + while (names && *names) + extract_reference_file(*names++); +} + +/* + * + * TEST management + * + */ + +/* + * "list.h" is simply created by "grep DEFINE_TEST test_*.c"; it has + * a line like + * DEFINE_TEST(test_function) + * for each test. + */ + +/* Use "list.h" to declare all of the test functions. */ +#undef DEFINE_TEST +#define DEFINE_TEST(name) void name(void); +#include "list.h" + +/* Use "list.h" to create a list of all tests (functions and names). */ +#undef DEFINE_TEST +#define DEFINE_TEST(n) { n, #n, 0 }, +struct test_list_t tests[] = { + #include "list.h" +}; + +/* + * Summarize repeated failures in the just-completed test. + */ +static void +test_summarize(int failed, int skips_num) +{ + unsigned int i; + + switch (verbosity) { + case VERBOSITY_SUMMARY_ONLY: + printf(failed ? "E" : "."); + fflush(stdout); + break; + case VERBOSITY_PASSFAIL: + printf(failed ? "FAIL\n" : skips_num ? "ok (S)\n" : "ok\n"); + break; + } + + log_console = (verbosity == VERBOSITY_LIGHT_REPORT); + + for (i = 0; i < sizeof(failed_lines)/sizeof(failed_lines[0]); i++) { + if (failed_lines[i].count > 1 && !failed_lines[i].skip) + logprintf("%s:%d: Summary: Failed %d times\n", + failed_filename, i, failed_lines[i].count); + } + /* Clear the failure history for the next file. */ + failed_filename = NULL; + memset(failed_lines, 0, sizeof(failed_lines)); +} + +/* + * Actually run a single test, with appropriate setup and cleanup. + */ +static int +test_run(int i, const char *tmpdir) +{ + char workdir[1024]; + char logfilename[64]; + int failures_before = failures; + int skips_before = skips; + int oldumask; + + switch (verbosity) { + case VERBOSITY_SUMMARY_ONLY: /* No per-test reports at all */ + break; + case VERBOSITY_PASSFAIL: /* rest of line will include ok/FAIL marker */ + printf("%3d: %-64s", i, tests[i].name); + fflush(stdout); + break; + default: /* Title of test, details will follow */ + printf("%3d: %s\n", i, tests[i].name); + } + + /* Chdir to the top-level work directory. */ + if (!assertChdir(tmpdir)) { + fprintf(stderr, + "ERROR: Can't chdir to top work dir %s\n", tmpdir); + exit(1); + } + /* Create a log file for this test. */ + sprintf(logfilename, "%s.log", tests[i].name); + logfile = fopen(logfilename, "w"); + fprintf(logfile, "%s\n\n", tests[i].name); + /* Chdir() to a work dir for this specific test. */ + snprintf(workdir, sizeof(workdir), "%s/%s", tmpdir, tests[i].name); + testworkdir = workdir; + if (!assertMakeDir(testworkdir, 0755) + || !assertChdir(testworkdir)) { + fprintf(stderr, + "ERROR: Can't chdir to work dir %s\n", testworkdir); + exit(1); + } + /* Explicitly reset the locale before each test. */ + setlocale(LC_ALL, "C"); + /* Record the umask before we run the test. */ + umask(oldumask = umask(0)); + /* + * Run the actual test. + */ + (*tests[i].func)(); + /* + * Clean up and report afterwards. + */ + testworkdir = NULL; + /* Restore umask */ + umask(oldumask); + /* Reset locale. */ + setlocale(LC_ALL, "C"); + /* Reset directory. */ + if (!assertChdir(tmpdir)) { + fprintf(stderr, "ERROR: Couldn't chdir to temp dir %s\n", + tmpdir); + exit(1); + } + /* Report per-test summaries. */ + tests[i].failures = failures - failures_before; + test_summarize(tests[i].failures, skips - skips_before); + /* Close the per-test log file. */ + fclose(logfile); + logfile = NULL; + /* If there were no failures, we can remove the work dir and logfile. */ + if (tests[i].failures == 0) { + if (!keep_temp_files && assertChdir(tmpdir)) { +#if defined(_WIN32) && !defined(__CYGWIN__) + /* Make sure not to leave empty directories. + * Sometimes a processing of closing files used by tests + * is not done, then rmdir will be failed and it will + * leave a empty test directory. So we should wait a few + * seconds and retry rmdir. */ + int r, t; + for (t = 0; t < 10; t++) { + if (t > 0) + Sleep(1000); + r = systemf("rmdir /S /Q %s", tests[i].name); + if (r == 0) + break; + } + systemf("del %s", logfilename); +#else + systemf("rm -rf %s", tests[i].name); + systemf("rm %s", logfilename); +#endif + } + } + /* Return appropriate status. */ + return (tests[i].failures); +} + +/* + * + * + * MAIN and support routines. + * + * + */ + +static void +usage(const char *program) +{ + static const int limit = sizeof(tests) / sizeof(tests[0]); + int i; + + printf("Usage: %s [options] ...\n", program); + printf("Default is to run all tests.\n"); + printf("Otherwise, specify the numbers of the tests you wish to run.\n"); + printf("Options:\n"); + printf(" -d Dump core after any failure, for debugging.\n"); + printf(" -k Keep all temp files.\n"); + printf(" Default: temp files for successful tests deleted.\n"); +#ifdef PROGRAM + printf(" -p Path to executable to be tested.\n"); + printf(" Default: path taken from " ENVBASE " environment variable.\n"); +#endif + printf(" -q Quiet.\n"); + printf(" -r Path to dir containing reference files.\n"); + printf(" Default: Current directory.\n"); + printf(" -u Keep running specifies tests until one fails.\n"); + printf(" -v Verbose.\n"); + printf("Available tests:\n"); + for (i = 0; i < limit; i++) + printf(" %d: %s\n", i, tests[i].name); + exit(1); +} + +static char * +get_refdir(const char *d) +{ + char tried[512] = { '\0' }; + char buff[128]; + char *pwd, *p; + + /* If a dir was specified, try that */ + if (d != NULL) { + pwd = NULL; + snprintf(buff, sizeof(buff), "%s", d); + p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); + if (p != NULL) goto success; + strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); + strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + goto failure; + } + + /* Get the current dir. */ +#ifdef PATH_MAX + pwd = getcwd(NULL, PATH_MAX);/* Solaris getcwd needs the size. */ +#else + pwd = getcwd(NULL, 0); +#endif + while (pwd[strlen(pwd) - 1] == '\n') + pwd[strlen(pwd) - 1] = '\0'; + + /* Look for a known file. */ + snprintf(buff, sizeof(buff), "%s", pwd); + p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); + if (p != NULL) goto success; + strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); + strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + + snprintf(buff, sizeof(buff), "%s/test", pwd); + p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); + if (p != NULL) goto success; + strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); + strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + +#if defined(LIBRARY) + snprintf(buff, sizeof(buff), "%s/%s/test", pwd, LIBRARY); +#else + snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM); +#endif + p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); + if (p != NULL) goto success; + strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); + strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + +#if defined(PROGRAM_ALIAS) + snprintf(buff, sizeof(buff), "%s/%s/test", pwd, PROGRAM_ALIAS); + p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); + if (p != NULL) goto success; + strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); + strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); +#endif + + if (memcmp(pwd, "/usr/obj", 8) == 0) { + snprintf(buff, sizeof(buff), "%s", pwd + 8); + p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); + if (p != NULL) goto success; + strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); + strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + + snprintf(buff, sizeof(buff), "%s/test", pwd + 8); + p = slurpfile(NULL, "%s/%s", buff, KNOWNREF); + if (p != NULL) goto success; + strncat(tried, buff, sizeof(tried) - strlen(tried) - 1); + strncat(tried, "\n", sizeof(tried) - strlen(tried) - 1); + } + +failure: + printf("Unable to locate known reference file %s\n", KNOWNREF); + printf(" Checked following directories:\n%s\n", tried); + printf("Use -r option to specify full path to reference directory\n"); +#if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG) + DebugBreak(); +#endif + exit(1); + +success: + free(p); + free(pwd); + return strdup(buff); +} + +int +main(int argc, char **argv) +{ + static const int limit = sizeof(tests) / sizeof(tests[0]); + int test_set[sizeof(tests) / sizeof(tests[0])]; + int i = 0, j = 0, tests_run = 0, tests_failed = 0, option; + time_t now; + char *refdir_alloc = NULL; + const char *progname; + char **saved_argv; + const char *tmp, *option_arg, *p; + char tmpdir[256], *pwd, *testprogdir, *tmp2 = NULL, *vlevel = NULL; + char tmpdir_timestamp[256]; + + (void)argc; /* UNUSED */ + + /* Get the current dir. */ +#ifdef PATH_MAX + pwd = getcwd(NULL, PATH_MAX);/* Solaris getcwd needs the size. */ +#else + pwd = getcwd(NULL, 0); +#endif + while (pwd[strlen(pwd) - 1] == '\n') + pwd[strlen(pwd) - 1] = '\0'; + +#if defined(HAVE__CrtSetReportMode) && !defined(__WATCOMC__) + /* To stop to run the default invalid parameter handler. */ + _set_invalid_parameter_handler(invalid_parameter_handler); + /* Disable annoying assertion message box. */ + _CrtSetReportMode(_CRT_ASSERT, 0); +#endif + + /* + * Name of this program, used to build root of our temp directory + * tree. + */ + progname = p = argv[0]; + if ((testprogdir = (char *)malloc(strlen(progname) + 1)) == NULL) + { + fprintf(stderr, "ERROR: Out of memory."); + exit(1); + } + strcpy(testprogdir, progname); + while (*p != '\0') { + /* Support \ or / dir separators for Windows compat. */ + if (*p == '/' || *p == '\\') + { + progname = p + 1; + i = j; + } + ++p; + j++; + } + testprogdir[i] = '\0'; +#if defined(_WIN32) && !defined(__CYGWIN__) + if (testprogdir[0] != '/' && testprogdir[0] != '\\' && + !(((testprogdir[0] >= 'a' && testprogdir[0] <= 'z') || + (testprogdir[0] >= 'A' && testprogdir[0] <= 'Z')) && + testprogdir[1] == ':' && + (testprogdir[2] == '/' || testprogdir[2] == '\\'))) +#else + if (testprogdir[0] != '/') +#endif + { + /* Fixup path for relative directories. */ + if ((testprogdir = (char *)realloc(testprogdir, + strlen(pwd) + 1 + strlen(testprogdir) + 1)) == NULL) + { + fprintf(stderr, "ERROR: Out of memory."); + exit(1); + } + memmove(testprogdir + strlen(pwd) + 1, testprogdir, + strlen(testprogdir) + 1); + memcpy(testprogdir, pwd, strlen(pwd)); + testprogdir[strlen(pwd)] = '/'; + } + +#ifdef PROGRAM + /* Get the target program from environment, if available. */ + testprogfile = getenv(ENVBASE); +#endif + + if (getenv("TMPDIR") != NULL) + tmp = getenv("TMPDIR"); + else if (getenv("TMP") != NULL) + tmp = getenv("TMP"); + else if (getenv("TEMP") != NULL) + tmp = getenv("TEMP"); + else if (getenv("TEMPDIR") != NULL) + tmp = getenv("TEMPDIR"); + else + tmp = "/tmp"; + + /* Allow -d to be controlled through the environment. */ + if (getenv(ENVBASE "_DEBUG") != NULL) + dump_on_failure = 1; + + /* Allow -v to be controlled through the environment. */ + if (getenv("_VERBOSITY_LEVEL") != NULL) + { + vlevel = getenv("_VERBOSITY_LEVEL"); + verbosity = atoi(vlevel); + if (verbosity < VERBOSITY_SUMMARY_ONLY || verbosity > VERBOSITY_FULL) + { + /* Unsupported verbosity levels are silently ignored */ + vlevel = NULL; + verbosity = VERBOSITY_PASSFAIL; + } + } + + /* Get the directory holding test files from environment. */ + refdir = getenv(ENVBASE "_TEST_FILES"); + + /* + * Parse options, without using getopt(), which isn't available + * on all platforms. + */ + ++argv; /* Skip program name */ + while (*argv != NULL) { + if (**argv != '-') + break; + p = *argv++; + ++p; /* Skip '-' */ + while (*p != '\0') { + option = *p++; + option_arg = NULL; + /* If 'opt' takes an argument, parse that. */ + if (option == 'p' || option == 'r') { + if (*p != '\0') + option_arg = p; + else if (*argv == NULL) { + fprintf(stderr, + "Option -%c requires argument.\n", + option); + usage(progname); + } else + option_arg = *argv++; + p = ""; /* End of this option word. */ + } + + /* Now, handle the option. */ + switch (option) { + case 'd': + dump_on_failure = 1; + break; + case 'k': + keep_temp_files = 1; + break; + case 'p': +#ifdef PROGRAM + testprogfile = option_arg; +#else + fprintf(stderr, "-p option not permitted\n"); + usage(progname); +#endif + break; + case 'q': + if (!vlevel) + verbosity--; + break; + case 'r': + refdir = option_arg; + break; + case 'u': + until_failure++; + break; + case 'v': + if (!vlevel) + verbosity++; + break; + default: + fprintf(stderr, "Unrecognized option '%c'\n", + option); + usage(progname); + } + } + } + + /* + * Sanity-check that our options make sense. + */ +#ifdef PROGRAM + if (testprogfile == NULL) + { + if ((tmp2 = (char *)malloc(strlen(testprogdir) + 1 + + strlen(PROGRAM) + 1)) == NULL) + { + fprintf(stderr, "ERROR: Out of memory."); + exit(1); + } + strcpy(tmp2, testprogdir); + strcat(tmp2, "/"); + strcat(tmp2, PROGRAM); + testprogfile = tmp2; + } + + { + char *testprg; +#if defined(_WIN32) && !defined(__CYGWIN__) + /* Command.com sometimes rejects '/' separators. */ + testprg = strdup(testprogfile); + for (i = 0; testprg[i] != '\0'; i++) { + if (testprg[i] == '/') + testprg[i] = '\\'; + } + testprogfile = testprg; +#endif + /* Quote the name that gets put into shell command lines. */ + testprg = malloc(strlen(testprogfile) + 3); + strcpy(testprg, "\""); + strcat(testprg, testprogfile); + strcat(testprg, "\""); + testprog = testprg; + } +#endif + +#if !defined(_WIN32) && defined(SIGPIPE) + { /* Ignore SIGPIPE signals */ + struct sigaction sa; + sa.sa_handler = SIG_IGN; + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; + sigaction(SIGPIPE, &sa, NULL); + } +#endif + + /* + * Create a temp directory for the following tests. + * Include the time the tests started as part of the name, + * to make it easier to track the results of multiple tests. + */ + now = time(NULL); + for (i = 0; ; i++) { + strftime(tmpdir_timestamp, sizeof(tmpdir_timestamp), + "%Y-%m-%dT%H.%M.%S", + localtime(&now)); + sprintf(tmpdir, "%s/%s.%s-%03d", tmp, progname, + tmpdir_timestamp, i); + if (assertMakeDir(tmpdir,0755)) + break; + if (i >= 999) { + fprintf(stderr, + "ERROR: Unable to create temp directory %s\n", + tmpdir); + exit(1); + } + } + + /* + * If the user didn't specify a directory for locating + * reference files, try to find the reference files in + * the "usual places." + */ + refdir = refdir_alloc = get_refdir(refdir); + + /* + * Banner with basic information. + */ + printf("\n"); + printf("If tests fail or crash, details will be in:\n"); + printf(" %s\n", tmpdir); + printf("\n"); + if (verbosity > VERBOSITY_SUMMARY_ONLY) { + printf("Reference files will be read from: %s\n", refdir); +#ifdef PROGRAM + printf("Running tests on: %s\n", testprog); +#endif + printf("Exercising: "); + fflush(stdout); + printf("%s\n", EXTRA_VERSION); + } else { + printf("Running "); + fflush(stdout); + } + + /* + * Run some or all of the individual tests. + */ + saved_argv = argv; + do { + argv = saved_argv; + do { + int test_num; + + test_num = get_test_set(test_set, limit, *argv, tests); + if (test_num < 0) { + printf("*** INVALID Test %s\n", *argv); + free(refdir_alloc); + free(testprogdir); + usage(progname); + return (1); + } + for (i = 0; i < test_num; i++) { + tests_run++; + if (test_run(test_set[i], tmpdir)) { + tests_failed++; + if (until_failure) + goto finish; + } + } + if (*argv != NULL) + argv++; + } while (*argv != NULL); + } while (until_failure); + +finish: + /* Must be freed after all tests run */ + free(tmp2); + free(testprogdir); + free(pwd); + + /* + * Report summary statistics. + */ + if (verbosity > VERBOSITY_SUMMARY_ONLY) { + printf("\n"); + printf("Totals:\n"); + printf(" Tests run: %8d\n", tests_run); + printf(" Tests failed: %8d\n", tests_failed); + printf(" Assertions checked:%8d\n", assertions); + printf(" Assertions failed: %8d\n", failures); + printf(" Skips reported: %8d\n", skips); + } + if (failures) { + printf("\n"); + printf("Failing tests:\n"); + for (i = 0; i < limit; ++i) { + if (tests[i].failures) + printf(" %d: %s (%d failures)\n", i, + tests[i].name, tests[i].failures); + } + printf("\n"); + printf("Details for failing tests: %s\n", tmpdir); + printf("\n"); + } else { + if (verbosity == VERBOSITY_SUMMARY_ONLY) + printf("\n"); + printf("%d tests passed, no failures\n", tests_run); + } + + free(refdir_alloc); + + /* If the final tmpdir is empty, we can remove it. */ + /* This should be the usual case when all tests succeed. */ + assertChdir(".."); + rmdir(tmpdir); + + return (tests_failed ? 1 : 0); +} diff --git a/cat/test/test.h b/cat/test/test.h new file mode 100644 index 000000000000..c5d2363040f8 --- /dev/null +++ b/cat/test/test.h @@ -0,0 +1,344 @@ +/* + * Copyright (c) 2003-2006 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. */ + +/* + * The goal of this file (and the matching test.c) is to + * simplify the very repetitive test-*.c test programs. + */ +#if defined(HAVE_CONFIG_H) +/* Most POSIX platforms use the 'configure' script to build config.h */ +#include "config.h" +#elif defined(__FreeBSD__) +/* Building as part of FreeBSD system requires a pre-built config.h. */ +#include "config_freebsd.h" +#elif defined(_WIN32) && !defined(__CYGWIN__) +/* Win32 can't run the 'configure' script. */ +#include "config_windows.h" +#else +/* Warn if the library hasn't been (automatically or manually) configured. */ +#error Oops: No config.h and no pre-built configuration in test.h. +#endif + +#include /* Windows requires this before sys/stat.h */ +#include + +#if HAVE_DIRENT_H +#include +#endif +#ifdef HAVE_DIRECT_H +#include +#define dirent direct +#endif +#include +#include +#ifdef HAVE_IO_H +#include +#endif +#ifdef HAVE_STDINT_H +#include +#endif +#include +#include +#include +#include +#include +#ifdef HAVE_UNISTD_H +#include +#endif +#include +#ifdef HAVE_WINDOWS_H +#include +#endif + +/* + * System-specific tweaks. We really want to minimize these + * as much as possible, since they make it harder to understand + * the mainline code. + */ + +/* Windows (including Visual Studio and MinGW but not Cygwin) */ +#if defined(_WIN32) && !defined(__CYGWIN__) +#if !defined(__BORLANDC__) +#undef chdir +#define chdir _chdir +#define strdup _strdup +#endif +#endif + +/* Visual Studio */ +#if defined(_MSC_VER) && _MSC_VER < 1900 +#define snprintf sprintf_s +#endif + +#if defined(__BORLANDC__) +#pragma warn -8068 /* Constant out of range in comparison. */ +#endif + +/* Haiku OS and QNX */ +#if defined(__HAIKU__) || defined(__QNXNTO__) +/* Haiku and QNX have typedefs in stdint.h (needed for int64_t) */ +#include +#endif + +/* Get a real definition for __FBSDID if we can */ +#if HAVE_SYS_CDEFS_H +#include +#endif + +/* If not, define it so as to avoid dangling semicolons. */ +#ifndef __FBSDID +#define __FBSDID(a) struct _undefined_hack +#endif + +#ifndef O_BINARY +#define O_BINARY 0 +#endif + +/* + * Redefine DEFINE_TEST for use in defining the test functions. + */ +#undef DEFINE_TEST +#define DEFINE_TEST(name) void name(void); void name(void) + +/* An implementation of the standard assert() macro */ +#define assert(e) assertion_assert(__FILE__, __LINE__, (e), #e, NULL) +/* chdir() and error if it fails */ +#define assertChdir(path) \ + assertion_chdir(__FILE__, __LINE__, path) +/* Assert two integers are the same. Reports value of each one if not. */ +#define assertEqualInt(v1,v2) \ + assertion_equal_int(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL) +/* Assert two strings are the same. Reports value of each one if not. */ +#define assertEqualString(v1,v2) \ + assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL, 0) +#define assertEqualUTF8String(v1,v2) \ + assertion_equal_string(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL, 1) +/* As above, but v1 and v2 are wchar_t * */ +#define assertEqualWString(v1,v2) \ + assertion_equal_wstring(__FILE__, __LINE__, (v1), #v1, (v2), #v2, NULL) +/* As above, but raw blocks of bytes. */ +#define assertEqualMem(v1, v2, l) \ + assertion_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL) +/* Assert that memory is full of a specified byte */ +#define assertMemoryFilledWith(v1, l, b) \ + assertion_memory_filled_with(__FILE__, __LINE__, (v1), #v1, (l), #l, (b), #b, NULL) +/* Assert two files are the same. */ +#define assertEqualFile(f1, f2) \ + assertion_equal_file(__FILE__, __LINE__, (f1), (f2)) +/* Assert that a file is empty. */ +#define assertEmptyFile(pathname) \ + assertion_empty_file(__FILE__, __LINE__, (pathname)) +/* Assert that a file is not empty. */ +#define assertNonEmptyFile(pathname) \ + assertion_non_empty_file(__FILE__, __LINE__, (pathname)) +#define assertFileAtime(pathname, sec, nsec) \ + assertion_file_atime(__FILE__, __LINE__, pathname, sec, nsec) +#define assertFileAtimeRecent(pathname) \ + assertion_file_atime_recent(__FILE__, __LINE__, pathname) +#define assertFileBirthtime(pathname, sec, nsec) \ + assertion_file_birthtime(__FILE__, __LINE__, pathname, sec, nsec) +#define assertFileBirthtimeRecent(pathname) \ + assertion_file_birthtime_recent(__FILE__, __LINE__, pathname) +/* Assert that a file exists; supports printf-style arguments. */ +#define assertFileExists(pathname) \ + assertion_file_exists(__FILE__, __LINE__, pathname) +/* Assert that a file exists. */ +#define assertFileNotExists(pathname) \ + assertion_file_not_exists(__FILE__, __LINE__, pathname) +/* Assert that file contents match a string. */ +#define assertFileContents(data, data_size, pathname) \ + assertion_file_contents(__FILE__, __LINE__, data, data_size, pathname) +#define assertFileMtime(pathname, sec, nsec) \ + assertion_file_mtime(__FILE__, __LINE__, pathname, sec, nsec) +#define assertFileMtimeRecent(pathname) \ + assertion_file_mtime_recent(__FILE__, __LINE__, pathname) +#define assertFileNLinks(pathname, nlinks) \ + assertion_file_nlinks(__FILE__, __LINE__, pathname, nlinks) +#define assertFileSize(pathname, size) \ + assertion_file_size(__FILE__, __LINE__, pathname, size) +#define assertTextFileContents(text, pathname) \ + assertion_text_file_contents(__FILE__, __LINE__, text, pathname) +#define assertFileContainsLinesAnyOrder(pathname, lines) \ + assertion_file_contains_lines_any_order(__FILE__, __LINE__, pathname, lines) +#define assertIsDir(pathname, mode) \ + assertion_is_dir(__FILE__, __LINE__, pathname, mode) +#define assertIsHardlink(path1, path2) \ + assertion_is_hardlink(__FILE__, __LINE__, path1, path2) +#define assertIsNotHardlink(path1, path2) \ + assertion_is_not_hardlink(__FILE__, __LINE__, path1, path2) +#define assertIsReg(pathname, mode) \ + assertion_is_reg(__FILE__, __LINE__, pathname, mode) +#define assertIsSymlink(pathname, contents) \ + assertion_is_symlink(__FILE__, __LINE__, pathname, contents) +/* Create a directory, report error if it fails. */ +#define assertMakeDir(dirname, mode) \ + assertion_make_dir(__FILE__, __LINE__, dirname, mode) +#define assertMakeFile(path, mode, contents) \ + assertion_make_file(__FILE__, __LINE__, path, mode, -1, contents) +#define assertMakeBinFile(path, mode, csize, contents) \ + assertion_make_file(__FILE__, __LINE__, path, mode, csize, contents) +#define assertMakeHardlink(newfile, oldfile) \ + assertion_make_hardlink(__FILE__, __LINE__, newfile, oldfile) +#define assertMakeSymlink(newfile, linkto) \ + assertion_make_symlink(__FILE__, __LINE__, newfile, linkto) +#define assertNodump(path) \ + assertion_nodump(__FILE__, __LINE__, path) +#define assertUmask(mask) \ + assertion_umask(__FILE__, __LINE__, mask) +#define assertUtimes(pathname, atime, atime_nsec, mtime, mtime_nsec) \ + assertion_utimes(__FILE__, __LINE__, pathname, atime, atime_nsec, mtime, mtime_nsec) + +/* + * This would be simple with C99 variadic macros, but I don't want to + * require that. Instead, I insert a function call before each + * skipping() call to pass the file and line information down. Crude, + * but effective. + */ +#define skipping \ + skipping_setup(__FILE__, __LINE__);test_skipping + +/* Function declarations. These are defined in test_utility.c. */ +void failure(const char *fmt, ...); +int assertion_assert(const char *, int, int, const char *, void *); +int assertion_chdir(const char *, int, const char *); +int assertion_empty_file(const char *, int, const char *); +int assertion_equal_file(const char *, int, const char *, const char *); +int assertion_equal_int(const char *, int, long long, const char *, long long, const char *, void *); +int assertion_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *); +int assertion_memory_filled_with(const char *, int, const void *, const char *, size_t, const char *, char, const char *, void *); +int assertion_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *, int); +int assertion_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *); +int assertion_file_atime(const char *, int, const char *, long, long); +int assertion_file_atime_recent(const char *, int, const char *); +int assertion_file_birthtime(const char *, int, const char *, long, long); +int assertion_file_birthtime_recent(const char *, int, const char *); +int assertion_file_contains_lines_any_order(const char *, int, const char *, const char **); +int assertion_file_contents(const char *, int, const void *, int, const char *); +int assertion_file_exists(const char *, int, const char *); +int assertion_file_mtime(const char *, int, const char *, long, long); +int assertion_file_mtime_recent(const char *, int, const char *); +int assertion_file_nlinks(const char *, int, const char *, int); +int assertion_file_not_exists(const char *, int, const char *); +int assertion_file_size(const char *, int, const char *, long); +int assertion_is_dir(const char *, int, const char *, int); +int assertion_is_hardlink(const char *, int, const char *, const char *); +int assertion_is_not_hardlink(const char *, int, const char *, const char *); +int assertion_is_reg(const char *, int, const char *, int); +int assertion_is_symlink(const char *, int, const char *, const char *); +int assertion_make_dir(const char *, int, const char *, int); +int assertion_make_file(const char *, int, const char *, int, int, const void *); +int assertion_make_hardlink(const char *, int, const char *newpath, const char *); +int assertion_make_symlink(const char *, int, const char *newpath, const char *); +int assertion_nodump(const char *, int, const char *); +int assertion_non_empty_file(const char *, int, const char *); +int assertion_text_file_contents(const char *, int, const char *buff, const char *f); +int assertion_umask(const char *, int, int); +int assertion_utimes(const char *, int, const char *, long, long, long, long ); + +void skipping_setup(const char *, int); +void test_skipping(const char *fmt, ...); + +/* Like sprintf, then system() */ +int systemf(const char * fmt, ...); + +/* Delay until time() returns a value after this. */ +void sleepUntilAfter(time_t); + +/* Return true if this platform can create symlinks. */ +int canSymlink(void); + +/* Return true if this platform can run the "bzip2" program. */ +int canBzip2(void); + +/* Return true if this platform can run the "grzip" program. */ +int canGrzip(void); + +/* Return true if this platform can run the "gzip" program. */ +int canGzip(void); + +/* Return true if this platform can run the specified command. */ +int canRunCommand(const char *); + +/* Return true if this platform can run the "lrzip" program. */ +int canLrzip(void); + +/* Return true if this platform can run the "lz4" program. */ +int canLz4(void); + +/* Return true if this platform can run the "lzip" program. */ +int canLzip(void); + +/* Return true if this platform can run the "lzma" program. */ +int canLzma(void); + +/* Return true if this platform can run the "lzop" program. */ +int canLzop(void); + +/* Return true if this platform can run the "xz" program. */ +int canXz(void); + +/* Return true if this filesystem can handle nodump flags. */ +int canNodump(void); + +/* Return true if the file has large i-node number(>0xffffffff). */ +int is_LargeInode(const char *); + +/* Suck file into string allocated via malloc(). Call free() when done. */ +/* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */ +char *slurpfile(size_t *, const char *fmt, ...); + +/* Dump block of bytes to a file. */ +void dumpfile(const char *filename, void *, size_t); + +/* Extracts named reference file to the current directory. */ +void extract_reference_file(const char *); +/* Copies named reference file to the current directory. */ +void copy_reference_file(const char *); + +/* Extracts a list of files to the current directory. + * List must be NULL terminated. + */ +void extract_reference_files(const char **); + +/* Path to working directory for current test */ +extern const char *testworkdir; + +/* + * Special interfaces for program test harness. + */ + +/* Pathname of exe to be tested. */ +extern const char *testprogfile; +/* Name of exe to use in printf-formatted command strings. */ +/* On Windows, this includes leading/trailing quotes. */ +extern const char *testprog; + +#ifdef USE_DMALLOC +#include +#endif diff --git a/cat/test/test_0.c b/cat/test/test_0.c new file mode 100644 index 000000000000..f9fe5d8473f9 --- /dev/null +++ b/cat/test/test_0.c @@ -0,0 +1,67 @@ +/*- + * 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); + } + + /* + * Try to successfully run the program; this requires that + * we know some option that will succeed. + */ + if (0 != systemf("%s --version >" DEV_NULL, testprog)) { + failure("Unable to successfully run: %s --version\n", testprog, testprog); + assert(0); + } + + /* TODO: Ensure that our reference files are available. */ +} diff --git a/cat/test/test_empty.gz.uu b/cat/test/test_empty.gz.uu new file mode 100644 index 000000000000..22b52308e5fa --- /dev/null +++ b/cat/test/test_empty.gz.uu @@ -0,0 +1,4 @@ +begin 644 test_empty.gz +?'XL(""\MZE,``W1Etest.out 2>test.err", testprog, reffile); + if (f == 0 || canGzip()) { + assertEqualInt(0, f); + assertEmptyFile("test.out"); + assertEmptyFile("test.err"); + } else { + skipping("It seems gzip is not supported on this platform"); + } +} diff --git a/cat/test/test_empty_lz4.c b/cat/test/test_empty_lz4.c new file mode 100644 index 000000000000..9d98e9cfd390 --- /dev/null +++ b/cat/test/test_empty_lz4.c @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2014 Sebastian Freundt + * 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" + +DEFINE_TEST(test_empty_lz4) +{ + const char *reffile = "test_empty.lz4"; + int f; + + extract_reference_file(reffile); + f = systemf("%s %s >test.out 2>test.err", testprog, reffile); + if (f == 0 || canLz4()) { + assertEqualInt(0, f); + assertEmptyFile("test.out"); + assertEmptyFile("test.err"); + } else { + skipping("It seems lz4 is not supported on this platform"); + } +} diff --git a/cat/test/test_empty_xz.c b/cat/test/test_empty_xz.c new file mode 100644 index 000000000000..368ffb574e50 --- /dev/null +++ b/cat/test/test_empty_xz.c @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2014 Sebastian Freundt + * 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" + +DEFINE_TEST(test_empty_xz) +{ + const char *reffile = "test_empty.xz"; + int f; + + extract_reference_file(reffile); + f = systemf("%s %s >test.out 2>test.err", testprog, reffile); + if (f == 0 || canXz()) { + assertEqualInt(0, f); + assertEmptyFile("test.out"); + assertEmptyFile("test.err"); + } else { + skipping("It seems xz is not supported on this platform"); + } +} diff --git a/cat/test/test_error.c b/cat/test/test_error.c new file mode 100644 index 000000000000..918af01be2dc --- /dev/null +++ b/cat/test/test_error.c @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2014 Mike Kazantsev + * 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" + +DEFINE_TEST(test_error) +{ + const char *reffile = "test_expand.error"; + + assertFileNotExists(reffile); + assert(0 != systemf("%s %s >test.out 2>test.err", testprog, reffile)); + + assertEmptyFile("test.out"); + assertNonEmptyFile("test.err"); +} diff --git a/cat/test/test_error_mixed.c b/cat/test/test_error_mixed.c new file mode 100644 index 000000000000..7d94fce467aa --- /dev/null +++ b/cat/test/test_error_mixed.c @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2014 Mike Kazantsev + * 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" + +DEFINE_TEST(test_error_mixed) +{ + const char *reffile1 = "test_expand.plain"; + const char *reffile2 = "test_expand.error"; + const char *reffile3 = "test_expand.Z"; + + assertFileNotExists(reffile2); + extract_reference_file(reffile1); + extract_reference_file(reffile3); + assert(0 != systemf("%s %s %s %s >test.out 2>test.err", + testprog, reffile1, reffile2, reffile3)); + + assertTextFileContents( + "contents of test_expand.plain.\n" + "contents of test_expand.Z.\n", "test.out"); + assertNonEmptyFile("test.err"); +} diff --git a/cat/test/test_expand.Z.uu b/cat/test/test_expand.Z.uu new file mode 100644 index 000000000000..b65efc1a2adf --- /dev/null +++ b/cat/test/test_expand.Z.uu @@ -0,0 +1,3 @@ +begin 664 test_expand.Z +@'YV08]ZXH5-FX!P0;\R`(#B'SI."$<4/&A187"@` +end diff --git a/cat/test/test_expand.bz2.uu b/cat/test/test_expand.bz2.uu new file mode 100644 index 000000000000..344c1cbaa7d0 --- /dev/null +++ b/cat/test/test_expand.bz2.uu @@ -0,0 +1,5 @@ +begin 664 test_expand.bz2 +M0EIH.3%!62936=[T@^L [__N000(!!(#!@\P+(, !@4 1 @$" (0 80$ +M(!D0 " 5%)D::#( #0]0 9J%1Z@>H :!B:&33(!"X";"%C@I$+32H/(0MXG +J,EA1G51 WG-"6JV7JKA;/&]$X 6MNH 8'N@3[\XCA_%W)%.%"0WO2#ZP +end diff --git a/cat/test/test_expand.gz.uu b/cat/test/test_expand.gz.uu new file mode 100644 index 000000000000..528167c6f447 --- /dev/null +++ b/cat/test/test_expand.gz.uu @@ -0,0 +1,4 @@ +begin 664 test_expand.gz +M'XL("-UD1%,``V%S9`!+SL\K2C0N"@`````Y +#!E9+ +` +end diff --git a/cat/test/test_expand.plain.uu b/cat/test/test_expand.plain.uu new file mode 100644 index 000000000000..ab83c9cb4302 --- /dev/null +++ b/cat/test/test_expand.plain.uu @@ -0,0 +1,3 @@ +begin 664 test_expand.plain +?8V]N=&5N=',@;V8@=&5S=%]E>'!A;F0N<&QA:6XN"@ +end diff --git a/cat/test/test_expand.xz.uu b/cat/test/test_expand.xz.uu new file mode 100644 index 000000000000..8a92980c0e7c --- /dev/null +++ b/cat/test/test_expand.xz.uu @@ -0,0 +1,4 @@ +begin 664 test_expand.xz +M_3=Z6%H 3FUK1& @ A 18 !T+^6C 0 ;8V]N=&5N=',@;V8@=&5S=%]E +G>'!A;F0N>'HN"@!S;^LVAO^3[ !-!R3&JV/'[;S?0$ !%E: +end diff --git a/cat/test/test_expand_Z.c b/cat/test/test_expand_Z.c new file mode 100644 index 000000000000..d48d4972ebee --- /dev/null +++ b/cat/test/test_expand_Z.c @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2014 Mike Kazantsev + * 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" + +DEFINE_TEST(test_expand_Z) +{ + const char *reffile = "test_expand.Z"; + + extract_reference_file(reffile); + assertEqualInt(0, systemf("%s %s >test.out 2>test.err", testprog, reffile)); + + assertTextFileContents("contents of test_expand.Z.\n", "test.out"); + assertEmptyFile("test.err"); +} diff --git a/cat/test/test_expand_bz2.c b/cat/test/test_expand_bz2.c new file mode 100644 index 000000000000..82f074b341c8 --- /dev/null +++ b/cat/test/test_expand_bz2.c @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2014 Mike Kazantsev + * Copyright (c) 2012 Michihiro NAKAJIMA + * 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" + +DEFINE_TEST(test_expand_bz2) +{ + const char *reffile = "test_expand.bz2"; + int f; + + extract_reference_file(reffile); + f = systemf("%s %s >test.out 2>test.err", testprog, reffile); + if (f == 0 || canBzip2()) { + assertEqualInt(0, f); + assertTextFileContents("contents of test_expand.bz2.\n", "test.out"); + assertEmptyFile("test.err"); + } else { + skipping("It seems bzip2 is not supported on this platform"); + } +} diff --git a/cat/test/test_expand_gz.c b/cat/test/test_expand_gz.c new file mode 100644 index 000000000000..18b715c66ebb --- /dev/null +++ b/cat/test/test_expand_gz.c @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2014 Mike Kazantsev + * Copyright (c) 2012 Michihiro NAKAJIMA + * 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" + +DEFINE_TEST(test_expand_gz) +{ + const char *reffile = "test_expand.gz"; + int f; + + extract_reference_file(reffile); + f = systemf("%s %s >test.out 2>test.err", testprog, reffile); + if (f == 0 || canGzip()) { + assertEqualInt(0, f); + assertTextFileContents("contents of test_expand.gz.\n", "test.out"); + assertEmptyFile("test.err"); + } else { + skipping("It seems gzip is not supported on this platform"); + } +} diff --git a/cat/test/test_expand_lz4.c b/cat/test/test_expand_lz4.c new file mode 100644 index 000000000000..1b1d2106459d --- /dev/null +++ b/cat/test/test_expand_lz4.c @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2014 Mike Kazantsev + * Copyright (c) 2012, 2014 Michihiro NAKAJIMA + * 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" + +DEFINE_TEST(test_expand_lz4) +{ + const char *reffile = "test_expand.lz4"; + int f; + + extract_reference_file(reffile); + f = systemf("%s %s >test.out 2>test.err", testprog, reffile); + if (f == 0 || canLz4()) { + assertEqualInt(0, f); + assertTextFileContents("contents of test_expand.lz4.\n", "test.out"); + assertEmptyFile("test.err"); + } else { + skipping("It seems lz4 is not supported on this platform"); + } +} diff --git a/cat/test/test_expand_mixed.c b/cat/test/test_expand_mixed.c new file mode 100644 index 000000000000..fa2235719df6 --- /dev/null +++ b/cat/test/test_expand_mixed.c @@ -0,0 +1,41 @@ +/*- + * Copyright (c) 2014 Mike Kazantsev + * 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" + +DEFINE_TEST(test_expand_mixed) +{ + const char *reffile1 = "test_expand.Z"; + const char *reffile2 = "test_expand.plain"; + + extract_reference_file(reffile1); + extract_reference_file(reffile2); + assertEqualInt(0, systemf("%s %s %s >test.out 2>test.err", + testprog, reffile1, reffile2)); + + assertTextFileContents( + "contents of test_expand.Z.\n" + "contents of test_expand.plain.\n", "test.out"); + assertEmptyFile("test.err"); +} diff --git a/cat/test/test_expand_plain.c b/cat/test/test_expand_plain.c new file mode 100644 index 000000000000..8b2276982885 --- /dev/null +++ b/cat/test/test_expand_plain.c @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2014 Mike Kazantsev + * 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" + +DEFINE_TEST(test_expand_plain) +{ + const char *reffile = "test_expand.plain"; + + extract_reference_file(reffile); + assertEqualInt(0, systemf("%s %s >test.out 2>test.err", testprog, reffile)); + + assertTextFileContents("contents of test_expand.plain.\n", "test.out"); + assertEmptyFile("test.err"); +} diff --git a/cat/test/test_expand_xz.c b/cat/test/test_expand_xz.c new file mode 100644 index 000000000000..99f87bf4c66b --- /dev/null +++ b/cat/test/test_expand_xz.c @@ -0,0 +1,42 @@ +/*- + * Copyright (c) 2014 Mike Kazantsev + * Copyright (c) 2012 Michihiro NAKAJIMA + * 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" + +DEFINE_TEST(test_expand_xz) +{ + const char *reffile = "test_expand.xz"; + int f; + + extract_reference_file(reffile); + f = systemf("%s %s >test.out 2>test.err", testprog, reffile); + if (f == 0 || canXz()) { + assertEqualInt(0, f); + assertTextFileContents("contents of test_expand.xz.\n", "test.out"); + assertEmptyFile("test.err"); + } else { + skipping("It seems xz is not supported on this platform"); + } +} diff --git a/cat/test/test_help.c b/cat/test/test_help.c new file mode 100644 index 000000000000..4ed47a076b29 --- /dev/null +++ b/cat/test/test_help.c @@ -0,0 +1,75 @@ +/*- + * 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" + +/* + * Test that "--help", "-h", and "-W help" options all work and + * generate reasonable output. + */ + +static int +in_first_line(const char *p, const char *substring) +{ + size_t l = strlen(substring); + + while (*p != '\0' && *p != '\n') { + if (memcmp(p, substring, l) == 0) + return (1); + ++p; + } + return (0); +} + +DEFINE_TEST(test_help) +{ + int r; + char *p; + size_t plen; + + /* Exercise --help option. */ + r = systemf("%s --help >help.stdout 2>help.stderr", testprog); + assertEqualInt(r, 0); + failure("--help should generate nothing to stderr."); + assertEmptyFile("help.stderr"); + /* Help message should start with name of program. */ + p = slurpfile(&plen, "help.stdout"); + failure("Help output should be long enough."); + assert(plen >= 6); + failure("First line of help output should contain 'bsdcat': %s", p); + assert(in_first_line(p, "bsdcat")); + /* + * TODO: Extend this check to further verify that --help output + * looks approximately right. + */ + free(p); + + /* -h option should generate the same output. */ + r = systemf("%s -h >h.stdout 2>h.stderr", testprog); + assertEqualInt(r, 0); + failure("-h should generate nothing to stderr."); + assertEmptyFile("h.stderr"); + failure("stdout should be same for -h and --help"); + assertEqualFile("h.stdout", "help.stdout"); +} diff --git a/cat/test/test_version.c b/cat/test/test_version.c new file mode 100644 index 000000000000..e7c93630b499 --- /dev/null +++ b/cat/test/test_version.c @@ -0,0 +1,97 @@ +/*- + * 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" + +/* + * Test that --version option works and generates reasonable output. + */ + +DEFINE_TEST(test_version) +{ + int r; + char *p, *q; + size_t s; + + + r = systemf("%s --version >version.stdout 2>version.stderr", testprog); + failure("Unable to run %s --version", testprog); + if (!assert(r == 0)) + return; + + /* --version should generate nothing to stdout. */ + assertEmptyFile("version.stderr"); + /* Verify format of version message. */ + q = p = slurpfile(&s, "version.stdout"); + /* Version message should start with name of program, then space. */ + assert(s > 6); + failure("Version must start with 'bsdcat': ``%s''", p); + if (!assertEqualMem(q, "bsdcat ", 7)) + return; + q += 7; s -= 7; + /* Version number is a series of digits and periods. */ + while (s > 0 && (*q == '.' || (*q >= '0' && *q <= '9'))) { + ++q; + --s; + } + /* Version number terminated by space. */ + failure("No space after bsdcat version: ``%s''", p); + assert(s > 1); + /* Skip a single trailing a,b,c, or d. */ + if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') + ++q; + failure("No space after bsdcat version: ``%s''", p); + assert(*q == ' '); + ++q; --s; + /* Separator. */ + failure("No `-' between bsdcat and libarchive versions: ``%s''", p); + assertEqualMem(q, "- ", 2); + q += 2; s -= 2; + /* libarchive name and version number */ + failure("Not long enough for libarchive version: ``%s''", p); + assert(s > 11); + failure("Libarchive version must start with `libarchive': ``%s''", p); + assertEqualMem(q, "libarchive ", 11); + q += 11; s -= 11; + /* Version number is a series of digits and periods. */ + while (s > 0 && (*q == '.' || (*q >= '0' && *q <= '9'))) { + ++q; + --s; + } + /* Skip a single trailing a,b,c, or d. */ + if (*q == 'a' || *q == 'b' || *q == 'c' || *q == 'd') + ++q; + /* Skip arbitrary third-party version numbers. */ + while (s > 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) { + ++q; + --s; + } + /* All terminated by end-of-line. */ + assert(s >= 1); + /* Skip an optional CR character (e.g., Windows) */ + failure("Version output must end with \\n or \\r\\n"); + if (*q == '\r') { ++q; --s; } + assertEqualMem(q, "\n", 1); + free(p); +} diff --git a/configure.ac b/configure.ac index 73944d3e0754..cb6943fa7f73 100644 --- a/configure.ac +++ b/configure.ac @@ -4,20 +4,21 @@ 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.1.2]) -m4_define([LIBARCHIVE_VERSION_N],[3001002]) +m4_define([LIBARCHIVE_VERSION_S],[3.2.0]) +m4_define([LIBARCHIVE_VERSION_N],[3002000]) dnl bsdtar and bsdcpio versioning tracks libarchive m4_define([BSDTAR_VERSION_S],LIBARCHIVE_VERSION_S()) m4_define([BSDCPIO_VERSION_S],LIBARCHIVE_VERSION_S()) +m4_define([BSDCAT_VERSION_S],LIBARCHIVE_VERSION_S()) -AC_PREREQ(2.65) +AC_PREREQ([2.69]) # # Now starts the "real" configure script. # -AC_INIT([libarchive],LIBARCHIVE_VERSION_S(),[libarchive-discuss@googlegroups.com]) +AC_INIT([libarchive],[LIBARCHIVE_VERSION_S()],[libarchive-discuss@googlegroups.com]) # Make sure the srcdir contains "libarchive" directory AC_CONFIG_SRCDIR([libarchive]) # Use auxiliary subscripts from this subdirectory (cleans up root) @@ -53,12 +54,15 @@ AC_DEFINE([BSDCPIO_VERSION_STRING],"BSDCPIO_VERSION_S()", [Version number of bsdcpio]) AC_DEFINE([BSDTAR_VERSION_STRING],"BSDTAR_VERSION_S()", [Version number of bsdtar]) +AC_DEFINE([BSDCAT_VERSION_STRING],"BSDTAR_VERSION_S()", + [Version number of bsdcat]) # The shell variables here must be the same as the AC_SUBST() variables # below, but the shell variable names apparently cannot be the same as # the m4 macro names above. Why? Ask autoconf. BSDCPIO_VERSION_STRING=BSDCPIO_VERSION_S() BSDTAR_VERSION_STRING=BSDTAR_VERSION_S() +BSDCAT_VERSION_STRING=BSDCAT_VERSION_S() LIBARCHIVE_VERSION_STRING=LIBARCHIVE_VERSION_S() LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N() @@ -68,6 +72,7 @@ LIBARCHIVE_VERSION_NUMBER=LIBARCHIVE_VERSION_N() AC_SUBST(ARCHIVE_LIBTOOL_VERSION) AC_SUBST(BSDCPIO_VERSION_STRING) AC_SUBST(BSDTAR_VERSION_STRING) +AC_SUBST(BSDCAT_VERSION_STRING) AC_SUBST(LIBARCHIVE_VERSION_STRING) AC_SUBST(LIBARCHIVE_VERSION_NUMBER) @@ -102,6 +107,7 @@ AC_USE_SYSTEM_EXTENSIONS AC_LIBTOOL_WIN32_DLL AC_PROG_LIBTOOL AC_CHECK_TOOL([STRIP],[strip]) +AC_PROG_MKDIR_P # # Options for building bsdtar. @@ -147,6 +153,50 @@ esac AM_CONDITIONAL([BUILD_BSDTAR], [ test "$build_bsdtar" = yes ]) AM_CONDITIONAL([STATIC_BSDTAR], [ test "$static_bsdtar" = yes ]) +# +# Options for building bsdcat. +# +# Default is to build bsdcat, but allow people to override that. +# +AC_ARG_ENABLE([bsdcat], + [AS_HELP_STRING([--enable-bsdcat], [enable build of bsdcat (default)]) + AS_HELP_STRING([--enable-bsdcat=static], [force static build of bsdcat]) + AS_HELP_STRING([--enable-bsdcat=shared], [force dynamic build of bsdcat]) +AS_HELP_STRING([--disable-bsdcat], [disable build of bsdcat])], + [], [enable_bsdcat=yes]) + +case "$enable_bsdcat" in +yes) + if test "$enable_static" = "no"; then + static_bsdcat=no + else + static_bsdcat=yes + fi + build_bsdcat=yes + ;; +dynamic|shared) + if test "$enable_shared" = "no"; then + AC_MSG_FAILURE([Shared linking of bsdcat requires shared libarchive]) + fi + build_bsdcat=yes + static_bsdcat=no + ;; +static) + build_bsdcat=yes + static_bsdcat=yes + ;; +no) + build_bsdcat=no + static_bsdcat=no + ;; +*) + AC_MSG_FAILURE([Unsupported value for --enable-bsdcat]) + ;; +esac + +AM_CONDITIONAL([BUILD_BSDCAT], [ test "$build_bsdcat" = yes ]) +AM_CONDITIONAL([STATIC_BSDCAT], [ test "$static_bsdcat" = yes ]) + # # Options for building bsdcpio. # @@ -193,8 +243,9 @@ AM_CONDITIONAL([STATIC_BSDCPIO], [ test "$static_bsdcpio" = yes ]) # Set up defines needed before including any headers case $host in *mingw* | *cygwin* ) - AC_DEFINE([_WIN32_WINNT], 0x0500, [Define to '0x0500' for Windows 2000 APIs.]) - AC_DEFINE([WINVER], 0x0500, [Define to '0x0500' for Windows 2000 APIs.]) + AC_DEFINE([_WIN32_WINNT], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.]) + AC_DEFINE([WINVER], 0x0502, [Define to '0x0502' for Windows Server 2003 APIs.]) + AC_DEFINE([NTDDI_VERSION], 0x05020000, [Define to '0x05020000' for Windows Server 2003 APIs.]) ;; esac @@ -218,7 +269,8 @@ AS_VAR_IF([ac_cv_have_decl_EXT2_IOC_GETFLAGS], [yes], AC_CHECK_HEADERS([inttypes.h io.h langinfo.h limits.h]) AC_CHECK_HEADERS([linux/fiemap.h linux/fs.h linux/magic.h linux/types.h]) -AC_CHECK_HEADERS([locale.h paths.h poll.h pwd.h signal.h spawn.h]) +AC_CHECK_HEADERS([locale.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/extattr.h]) AC_CHECK_HEADERS([sys/ioctl.h sys/mkdev.h sys/mount.h]) @@ -226,6 +278,7 @@ AC_CHECK_HEADERS([sys/param.h sys/poll.h sys/select.h sys/statfs.h sys/statvfs.h AC_CHECK_HEADERS([sys/time.h sys/utime.h sys/utsname.h sys/vfs.h]) AC_CHECK_HEADERS([time.h unistd.h utime.h wchar.h wctype.h]) AC_CHECK_HEADERS([windows.h]) +AC_CHECK_HEADERS([Bcrypt.h]) # check windows.h first; the other headers require it. AC_CHECK_HEADERS([wincrypt.h winioctl.h],[],[], [[#ifdef HAVE_WINDOWS_H @@ -299,12 +352,34 @@ if test "x$with_iconv" != "xno"; then fi fi +AC_ARG_WITH([lz4], + AS_HELP_STRING([--without-lz4], [Don't build support for lz4 through liblz4])) + +if test "x$with_lz4" != "xno"; then + AC_CHECK_HEADERS([lz4.h lz4hc.h]) + AC_CHECK_LIB(lz4,LZ4_decompress_safe) +fi + AC_ARG_WITH([lzma], AS_HELP_STRING([--without-lzma], [Don't build support for xz through lzma])) if test "x$with_lzma" != "xno"; then AC_CHECK_HEADERS([lzma.h]) AC_CHECK_LIB(lzma,lzma_stream_decoder) + # Some pre-release (but widely distributed) versions of liblzma + # included a disabled version of lzma_stream_encoder_mt that + # fools a naive AC_CHECK_LIB or AC_CHECK_FUNC, so we need + # to do something more complex here: + AC_CACHE_CHECK( + [whether we have multithread support in lzma], + ac_cv_lzma_has_mt, + [AC_COMPILE_IFELSE([ + AC_LANG_PROGRAM([[#include ]], + [[lzma_stream_encoder_mt(0, 0);]])], + [ac_cv_lzma_has_mt=yes], [ac_cv_lzma_has_mt=no])]) + 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 fi AC_ARG_WITH([lzo2], @@ -329,14 +404,14 @@ AC_ARG_WITH([expat], AS_HELP_STRING([--without-expat], [Don't build support for xar through expat])) if test "x$with_xml2" != "xno"; then - AC_PATH_PROG([XML2_CONFIG], [xml2-config],, [${PATH}]) - if test "x$XML2_CONFIG" != "x"; then - CPPFLAGS="${CPPFLAGS} `${XML2_CONFIG} --cflags`" - LIBS="${LIBS} `${XML2_CONFIG} --libs`" + PKG_PROG_PKG_CONFIG + PKG_CHECK_MODULES(LIBXML2_PC, [libxml-2.0], [ + CPPFLAGS="${CPPFLAGS} ${LIBXML2_PC_CFLAGS}" + LIBS="${LIBS} ${LIBXML2_PC_LIBS}" AC_CHECK_LIB(xml2,xmlInitParser,[true],AC_MSG_FAILURE(Missing xml2 library)) - else + ], [ AC_CHECK_LIB(xml2,xmlInitParser) - fi + ]) AC_CHECK_HEADERS([libxml/xmlreader.h libxml/xmlwriter.h]) fi if test "x$ac_cv_header_libxml_xmlreader_h" != "xyes"; then @@ -411,9 +486,12 @@ fi # -larchive in that case. #AC_CHECK_LIB(archive,archive_version) +# Checks for supported compiler flags +AX_APPEND_COMPILE_FLAGS([-Wall -Wformat -Wformat-security]) + # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST -# AC_TYPE_UID_T defaults to "int", which is incorrect for MinGW +# la_TYPE_UID_T defaults to "int", which is incorrect for MinGW # and MSVC. Use a customized version. la_TYPE_UID_T AC_TYPE_MODE_T @@ -475,7 +553,9 @@ AC_TYPE_INT16_T AC_TYPE_UINT16_T AC_TYPE_UINT8_T -AC_CHECK_DECLS([SIZE_MAX, INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) +AC_CHECK_DECLS([SIZE_MAX, INT32_MAX, INT32_MIN]) +AC_CHECK_DECLS([INT64_MAX, INT64_MIN, UINT64_MAX, UINT32_MAX]) +AC_CHECK_DECLS([INTMAX_MAX, INTMAX_MIN, UINTMAX_MAX]) AC_CHECK_DECL([SSIZE_MAX], [AC_DEFINE(HAVE_DECL_SSIZE_MAX, 1, [Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you don't.])], @@ -512,7 +592,7 @@ AC_FUNC_VPRINTF # To avoid necessity for including windows.h or special forward declaration # workarounds, we use 'void *' for 'struct SECURITY_ATTRIBUTES *' AC_CHECK_STDCALL_FUNC([CreateHardLinkA],[const char *, const char *, void *]) -AC_CHECK_FUNCS([chflags chown chroot ctime_r dirfd]) +AC_CHECK_FUNCS([arc4random_buf chflags chown chroot ctime_r dirfd]) AC_CHECK_FUNCS([fchdir fchflags fchmod fchown fcntl fdopendir fork]) AC_CHECK_FUNCS([fstat fstatat fstatfs fstatvfs ftruncate]) AC_CHECK_FUNCS([futimens futimes futimesat]) @@ -522,10 +602,11 @@ AC_CHECK_FUNCS([lchflags lchmod lchown link localtime_r lstat lutimes]) AC_CHECK_FUNCS([mbrtowc memmove memset]) AC_CHECK_FUNCS([mkdir mkfifo mknod mkstemp]) AC_CHECK_FUNCS([nl_langinfo openat pipe poll posix_spawnp readlink readlinkat]) +AC_CHECK_FUNCS([readpassphrase]) AC_CHECK_FUNCS([select setenv setlocale sigaction statfs statvfs]) AC_CHECK_FUNCS([strchr strdup strerror strncpy_s strrchr symlink timegm]) AC_CHECK_FUNCS([tzset unsetenv utime utimensat utimes vfork]) -AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy]) +AC_CHECK_FUNCS([wcrtomb wcscmp wcscpy wcslen wctomb wmemcmp wmemcpy wmemmove]) AC_CHECK_FUNCS([_ctime64_s _fseeki64]) AC_CHECK_FUNCS([_get_timezone _localtime64_s _mkgmtime64]) # detects cygwin-1.7, as opposed to older versions @@ -568,7 +649,7 @@ AC_ARG_ENABLE([xattr], if test "x$enable_xattr" != "xno"; then AC_CHECK_HEADERS([attr/xattr.h]) AC_CHECK_HEADERS([sys/xattr.h sys/ea.h]) - AC_CHECK_LIB(attr,setxattr) + AC_SEARCH_LIBS([setxattr], [attr]) AC_CHECK_FUNCS([extattr_get_file extattr_list_file]) AC_CHECK_FUNCS([extattr_set_fd extattr_set_file]) AC_CHECK_FUNCS([fgetxattr flistxattr fsetxattr getxattr]) @@ -642,7 +723,7 @@ AC_DEFUN([CRYPTO_CHECK], [ #define ARCHIVE_CRYPTO_$1_$2 #define PLATFORM_CONFIG_H "check_crypto_md.h" -$(cat "$srcdir/libarchive/archive_crypto.c") +$(cat "$srcdir/libarchive/archive_digest.c") int main(int argc, char **argv) @@ -717,8 +798,9 @@ esac if test "x$with_nettle" != "xno"; then AC_CHECK_HEADERS([nettle/md5.h nettle/ripemd160.h nettle/sha.h]) + AC_CHECK_HEADERS([nettle/pbkdf2.h nettle/aes.h nettle/hmac.h]) saved_LIBS=$LIBS - AC_CHECK_LIB(nettle,main) + AC_CHECK_LIB(nettle,nettle_sha1_init) CRYPTO_CHECK(MD5, NETTLE, md5) CRYPTO_CHECK(RMD160, NETTLE, rmd160) CRYPTO_CHECK(SHA1, NETTLE, sha1) @@ -729,6 +811,7 @@ if test "x$with_nettle" != "xno"; then LIBS=$saved_LIBS fi fi + if test "x$with_openssl" != "xno"; then AC_CHECK_HEADERS([openssl/evp.h]) saved_LIBS=$LIBS @@ -736,18 +819,18 @@ if test "x$with_openssl" != "xno"; then *mingw* | *cygwin*) case "$host_cpu" in x86_64) - AC_CHECK_LIB(eay64,main) + AC_CHECK_LIB(eay64,OPENSSL_config) if test "x$ac_cv_lib_eay64_main" != "xyes"; then - AC_CHECK_LIB(eay32,main) + AC_CHECK_LIB(eay32,OPENSSL_config) fi ;; *) - AC_CHECK_LIB(eay32,main) + AC_CHECK_LIB(eay32,OPENSSL_config) ;; esac ;; *) - AC_CHECK_LIB(crypto,main) + AC_CHECK_LIB(crypto,OPENSSL_config) ;; esac CRYPTO_CHECK(MD5, OPENSSL, md5) @@ -758,6 +841,8 @@ if test "x$with_openssl" != "xno"; then CRYPTO_CHECK(SHA512, OPENSSL, sha512) if test "x$found_OPENSSL" != "xyes"; then LIBS=$saved_LIBS + else + AC_CHECK_FUNCS([PKCS5_PBKDF2_HMAC_SHA1]) fi fi @@ -765,7 +850,7 @@ fi # The two are incompatible and OpenSSL is more complete. AC_CHECK_HEADERS([md5.h ripemd.h sha.h sha256.h sha512.h]) saved_LIBS=$LIBS -AC_CHECK_LIB(md,main) +AC_CHECK_LIB(md,MD5Init) CRYPTO_CHECK(MD5, LIBMD, md5) CRYPTO_CHECK(RMD160, LIBMD, rmd160) CRYPTO_CHECK(SHA1, LIBMD, sha1) @@ -785,4 +870,8 @@ case "$host_os" in ;; esac +# Ensure test directories are present if building out-of-tree +AC_CONFIG_COMMANDS([mkdirs], + [mkdir -p libarchive/test tar/test cat/test cpio/test]) + AC_OUTPUT diff --git a/contrib/android/Android.mk b/contrib/android/Android.mk new file mode 100644 index 000000000000..b82beab4a6d2 --- /dev/null +++ b/contrib/android/Android.mk @@ -0,0 +1,306 @@ +# +# Copyright (C) 2014 Trevor Drake +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# + + +# A bit of a non-standard LOCAL_PATH declaration here +# The Android.mk lives below the top source directory +# but LOCAL_PATH needs to point to the top of the module +# source tree to maintain the integrity of the intermediates +# directories +LOCAL_PATH := $(subst /contrib/android,,$(call my-dir)) + +libarchive_target_config := contrib/android/config/android.h + +libarchive_src_files := libarchive/archive_acl.c \ + libarchive/archive_check_magic.c \ + libarchive/archive_cmdline.c \ + libarchive/archive_cryptor.c \ + libarchive/archive_digest.c \ + libarchive/archive_entry.c \ + libarchive/archive_entry_copy_stat.c \ + libarchive/archive_entry_link_resolver.c \ + libarchive/archive_entry_sparse.c \ + libarchive/archive_entry_stat.c \ + libarchive/archive_entry_strmode.c \ + libarchive/archive_entry_xattr.c \ + libarchive/archive_getdate.c \ + libarchive/archive_hmac.c \ + libarchive/archive_match.c \ + libarchive/archive_options.c \ + libarchive/archive_pack_dev.c \ + libarchive/archive_pathmatch.c \ + libarchive/archive_ppmd7.c \ + libarchive/archive_random.c \ + libarchive/archive_rb.c \ + libarchive/archive_read.c \ + libarchive/archive_read_add_passphrase.c \ + libarchive/archive_read_append_filter.c \ + libarchive/archive_read_data_into_fd.c \ + libarchive/archive_read_disk_entry_from_file.c \ + libarchive/archive_read_disk_posix.c \ + libarchive/archive_read_disk_set_standard_lookup.c \ + libarchive/archive_read_extract.c \ + libarchive/archive_read_extract2.c \ + libarchive/archive_read_open_fd.c \ + libarchive/archive_read_open_file.c \ + libarchive/archive_read_open_filename.c \ + libarchive/archive_read_open_memory.c \ + libarchive/archive_read_set_format.c \ + libarchive/archive_read_set_options.c \ + libarchive/archive_read_support_filter_all.c \ + libarchive/archive_read_support_filter_bzip2.c \ + libarchive/archive_read_support_filter_compress.c \ + libarchive/archive_read_support_filter_grzip.c \ + libarchive/archive_read_support_filter_gzip.c \ + libarchive/archive_read_support_filter_lrzip.c \ + libarchive/archive_read_support_filter_lz4.c \ + libarchive/archive_read_support_filter_lzop.c \ + libarchive/archive_read_support_filter_none.c \ + libarchive/archive_read_support_filter_program.c \ + libarchive/archive_read_support_filter_rpm.c \ + libarchive/archive_read_support_filter_uu.c \ + libarchive/archive_read_support_filter_xz.c \ + libarchive/archive_read_support_format_7zip.c \ + libarchive/archive_read_support_format_all.c \ + libarchive/archive_read_support_format_ar.c \ + libarchive/archive_read_support_format_by_code.c \ + libarchive/archive_read_support_format_cab.c \ + libarchive/archive_read_support_format_cpio.c \ + libarchive/archive_read_support_format_empty.c \ + libarchive/archive_read_support_format_iso9660.c \ + libarchive/archive_read_support_format_lha.c \ + libarchive/archive_read_support_format_mtree.c \ + libarchive/archive_read_support_format_rar.c \ + libarchive/archive_read_support_format_raw.c \ + libarchive/archive_read_support_format_tar.c \ + libarchive/archive_read_support_format_warc.c \ + libarchive/archive_read_support_format_xar.c \ + libarchive/archive_read_support_format_zip.c \ + libarchive/archive_string.c \ + libarchive/archive_string_sprintf.c \ + libarchive/archive_util.c \ + libarchive/archive_virtual.c \ + libarchive/archive_write.c \ + libarchive/archive_write_disk_acl.c \ + libarchive/archive_write_disk_posix.c \ + libarchive/archive_write_disk_set_standard_lookup.c \ + libarchive/archive_write_open_fd.c \ + libarchive/archive_write_open_file.c \ + libarchive/archive_write_open_filename.c \ + libarchive/archive_write_open_memory.c \ + libarchive/archive_write_add_filter.c \ + libarchive/archive_write_add_filter_b64encode.c \ + libarchive/archive_write_add_filter_by_name.c \ + libarchive/archive_write_add_filter_bzip2.c \ + libarchive/archive_write_add_filter_compress.c \ + libarchive/archive_write_add_filter_grzip.c \ + libarchive/archive_write_add_filter_gzip.c \ + libarchive/archive_write_add_filter_lrzip.c \ + libarchive/archive_write_add_filter_lz4.c \ + libarchive/archive_write_add_filter_lzop.c \ + libarchive/archive_write_add_filter_none.c \ + libarchive/archive_write_add_filter_program.c \ + libarchive/archive_write_add_filter_uuencode.c \ + libarchive/archive_write_add_filter_xz.c \ + libarchive/archive_write_set_format.c \ + libarchive/archive_write_set_format_7zip.c \ + libarchive/archive_write_set_format_ar.c \ + libarchive/archive_write_set_format_by_name.c \ + libarchive/archive_write_set_format_cpio.c \ + libarchive/archive_write_set_format_cpio_newc.c \ + libarchive/archive_write_set_format_iso9660.c \ + libarchive/archive_write_set_format_mtree.c \ + libarchive/archive_write_set_format_pax.c \ + libarchive/archive_write_set_format_raw.c \ + libarchive/archive_write_set_format_shar.c \ + libarchive/archive_write_set_format_ustar.c \ + libarchive/archive_write_set_format_v7tar.c \ + libarchive/archive_write_set_format_gnutar.c \ + libarchive/archive_write_set_format_warc.c \ + libarchive/archive_write_set_format_xar.c \ + libarchive/archive_write_set_format_zip.c \ + libarchive/archive_write_set_options.c \ + libarchive/archive_write_set_passphrase.c \ + libarchive/filter_fork_posix.c \ + libarchive/xxhash.c + +ifeq ($(HOST_OS),windows) +libarchive_host_src_files := \ + libarchive/archive_entry_copy_bhfi.c \ + libarchive/archive_read_disk_windows.c \ + libarchive/archive_write_disk_windows.c \ + libarchive/filter_fork_windows.c \ + libarchive/archive_windows.c +else +libarchive_host_src_files := +endif + +libarchive_fe_src_files := libarchive_fe/err.c \ + libarchive_fe/line_reader.c \ + libarchive_fe/passphrase.c + +bsdtar_src_files := tar/bsdtar.c \ + tar/bsdtar_windows.c \ + tar/cmdline.c \ + tar/creation_set.c \ + tar/read.c \ + tar/subst.c \ + tar/util.c \ + tar/write.c + +bsdcpio_src_files := cpio/cmdline.c \ + cpio/cpio.c + +bsdcat_src_files := cat/cmdline.c \ + cat/bsdcat.c + + +ifeq ($(HOST_OS),darwin) +$(warning Host : $(HOST_OS) Not Supported. Host Build Will Be Skipped ) +else +libarchive_host_config := contrib/android/config/$(HOST_OS)_host.h + +include $(CLEAR_VARS) +LOCAL_MODULE := libarchive +LOCAL_MODULE_TAGS := optional +LOCAL_SRC_FILES := $(libarchive_src_files) $(libarchive_host_src_files) +LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\" +LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive +include $(BUILD_HOST_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := libarchive +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\" +LOCAL_SHARED_LIBRARIES := libz-host +LOCAL_WHOLE_STATIC_LIBRARIES := libarchive +LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive +include $(BUILD_HOST_SHARED_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := libarchive_fe +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\" +LOCAL_SRC_FILES := $(libarchive_fe_src_files) +LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive_fe +include $(BUILD_HOST_STATIC_LIBRARY) + +endif + + +# Do not build target binaries if we are not targeting linux +# on the host +ifeq ($(HOST_OS),linux) + +include $(CLEAR_VARS) +LOCAL_MODULE := bsdtar +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := -DBSDTAR_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\" +LOCAL_SHARED_LIBRARIES := libz-host +LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe +LOCAL_SRC_FILES := $(bsdtar_src_files) +LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include +include $(BUILD_HOST_EXECUTABLE) + +include $(CLEAR_VARS) +LOCAL_MODULE := bsdcpio +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := -DBSDCPIO_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\" +LOCAL_SHARED_LIBRARIES := libz-host +LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe +LOCAL_SRC_FILES := $(bsdcpio_src_files) +LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include +include $(BUILD_HOST_EXECUTABLE) + +include $(CLEAR_VARS) +LOCAL_MODULE := bsdcat +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := -DBSDCAT_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_host_config)\" +LOCAL_SHARED_LIBRARIES := libz-host +LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe +LOCAL_SRC_FILES := $(bsdcat_src_files) +LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include +include $(BUILD_HOST_EXECUTABLE) + + + +include $(CLEAR_VARS) +LOCAL_MODULE := libarchive +LOCAL_MODULE_TAGS := optional +LOCAL_SRC_FILES := $(libarchive_src_files) +LOCAL_STATIC_LIBRARIES := libz liblz4 +LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\" +LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive +include $(BUILD_STATIC_LIBRARY) + + +include $(CLEAR_VARS) +LOCAL_MODULE := libarchive +LOCAL_MODULE_TAGS := optional +LOCAL_C_INCLUDES := +LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\" +LOCAL_SHARED_LIBRARIES := libz +LOCAL_WHOLE_STATIC_LIBRARIES := libarchive +LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive +include $(BUILD_SHARED_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := libarchive_fe +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\" +LOCAL_SRC_FILES := $(libarchive_fe_src_files) +LOCAL_C_INCLUDES := $(LOCAL_PATH)/contrib/android/include +LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH)/libarchive_fe +include $(BUILD_STATIC_LIBRARY) + + +include $(CLEAR_VARS) +LOCAL_MODULE := bsdtar +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := -DBSDTAR_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\" +LOCAL_SHARED_LIBRARIES := libz +LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe +LOCAL_SRC_FILES := $(bsdtar_src_files) +LOCAL_C_INCLUDES := $(LOCAL_PATH)/libarchive $(LOCAL_PATH)/libarchive_fe $(LOCAL_PATH)/contrib/android/include +include $(BUILD_EXECUTABLE) + +include $(CLEAR_VARS) +LOCAL_MODULE := bsdcpio +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := -DBSDCPIO_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\" +LOCAL_SHARED_LIBRARIES := libz +LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe +LOCAL_SRC_FILES := $(bsdcpio_src_files) +LOCAL_C_INCLUDES := $(LOCAL_PATH)/libarchive $(LOCAL_PATH)/libarchive_fe $(LOCAL_PATH)/contrib/android/include +include $(BUILD_EXECUTABLE) + +include $(CLEAR_VARS) +LOCAL_MODULE := bsdcat +LOCAL_MODULE_TAGS := optional +LOCAL_CFLAGS := -DBSDCAT_VERSION_STRING=ARCHIVE_VERSION_ONLY_STRING -DPLATFORM_CONFIG_H=\"$(libarchive_target_config)\" +LOCAL_SHARED_LIBRARIES := libz +LOCAL_STATIC_LIBRARIES := libarchive libarchive_fe +LOCAL_SRC_FILES := $(bsdcat_src_files) +LOCAL_C_INCLUDES := $(LOCAL_PATH)/libarchive $(LOCAL_PATH)/libarchive_fe $(LOCAL_PATH)/contrib/android/include +include $(BUILD_EXECUTABLE) + +endif diff --git a/contrib/android/config/android.h b/contrib/android/config/android.h new file mode 100644 index 000000000000..8e18312449ed --- /dev/null +++ b/contrib/android/config/android.h @@ -0,0 +1,184 @@ +/*- + * Copyright (c) 2014 Trevor Drake + * 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. + * + */ +#ifndef ARCHIVE_PLATFORM_H_ANDROID_INCLUDED +#define ARCHIVE_PLATFORM_H_ANDROID_INCLUDED + +#include +#ifdef __ANDROID_API__ +#if __ANDROID_API__ > 20 +#define HAVE_FSTATVFS 1 +#define HAVE_STATVFS 1 +#define HAVE_TIMEGM 1 +#define HAVE_SYS_XATTR_H 1 +#define HAVE_LINUX_FIEMAP_H 1 +#define HAVE_SYS_STATVFS_H 1 +#endif +#endif + +#define HAVE_CHOWN 1 +#define HAVE_CHROOT 1 +#define HAVE_CTIME_R 1 +#define HAVE_CTYPE_H 1 +#define HAVE_DECL_EXTATTR_NAMESPACE_USER 0 +#define HAVE_DECL_INTMAX_MIN 1 +#define HAVE_DECL_INTMAX_MAX 1 +#define HAVE_DECL_INT64_MAX 1 +#define HAVE_DECL_INT64_MIN 1 +#define HAVE_DECL_SIZE_MAX 1 +#define HAVE_DECL_SSIZE_MAX 1 +#define HAVE_DECL_STRERROR_R 1 +#define HAVE_DECL_UINTMAX_MAX 1 +#define HAVE_DECL_UINT32_MAX 1 +#define HAVE_DECL_UINT64_MAX 1 +#define HAVE_DIRENT_H 1 +#define HAVE_DIRFD 1 +#define HAVE_DLFCN_H 1 +#define HAVE_EILSEQ 1 +#define HAVE_ERRNO_H 1 +#define HAVE_FCHDIR 1 +#define HAVE_FCHMOD 1 +#define HAVE_FCHOWN 1 +#define HAVE_FCNTL 1 +#define HAVE_FCNTL_H 1 +#define HAVE_FDOPENDIR 1 +#define HAVE_FGETXATTR 1 +#define HAVE_FLISTXATTR 1 +#define HAVE_FORK 1 +#define HAVE_FSEEKO 1 +#define HAVE_FSETXATTR 1 +#define HAVE_FSTAT 1 +#define HAVE_FSTATAT 1 +#define HAVE_FSTATFS 1 +#define HAVE_FTRUNCATE 1 +#define HAVE_GETEUID 1 +#define HAVE_GETPID 1 +#define HAVE_GETPWNAM_R 1 +#define HAVE_GETPWUID_R 1 +#define HAVE_GETXATTR 1 +#define HAVE_GMTIME_R 1 +#define HAVE_GRP_H 1 +#define HAVE_INTMAX_T 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LCHOWN 1 +#define HAVE_LGETXATTR 1 +#define HAVE_LIBLZMA 1 +#define HAVE_LIBZ 1 +#define HAVE_LIMITS_H 1 +#define HAVE_LINK 1 +#define HAVE_LINUX_FS_H 1 +#define HAVE_LINUX_MAGIC_H 1 +#define HAVE_LINUX_TYPES_H 1 +#define HAVE_LISTXATTR 1 +#define HAVE_LLISTXATTR 1 +#define HAVE_LOCALE_H 1 +#define HAVE_LOCALTIME_R 1 +#define HAVE_LONG_LONG_INT 1 +#define HAVE_LSETXATTR 1 +#define HAVE_LSTAT 1 +#define HAVE_MBRTOWC 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMORY_H 1 +#define HAVE_MEMSET 1 +#define HAVE_MKDIR 1 +#define HAVE_MKFIFO 1 +#define HAVE_MKNOD 1 +#define HAVE_MKSTEMP 1 +#define HAVE_OPENAT 1 +#define HAVE_PATHS_H 1 +#define HAVE_PIPE 1 +#define HAVE_POLL 1 +#define HAVE_POLL_H 1 +#define HAVE_PTHREAD_H 1 +#define HAVE_PWD_H 1 +#define HAVE_READDIR_R 1 +#define HAVE_READLINK 1 +#define HAVE_READLINKAT 1 +#define HAVE_REGEX_H 1 +#define HAVE_SELECT 1 +#define HAVE_SETENV 1 +#define HAVE_SETLOCALE 1 +#define HAVE_SIGACTION 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_STATFS 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRCHR 1 +#define HAVE_STRDUP 1 +#define HAVE_STRERROR 1 +#define HAVE_STRERROR_R 1 +#define HAVE_STRFTIME 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 +#define HAVE_STRUCT_STAT_ST_MTIME_NSEC 1 +#define HAVE_STRUCT_TM_TM_GMTOFF 1 +#define HAVE_SYMLINK 1 +#define HAVE_SYS_CDEFS_H 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_MOUNT_H 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_POLL_H 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_SYS_STATFS_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_UTSNAME_H 1 +#define HAVE_SYS_VFS_H 1 +#define HAVE_SYS_WAIT_H 1 +#define HAVE_TIME_H 1 +#define HAVE_TZSET 1 +#define HAVE_UINTMAX_T 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UNSETENV 1 +#define HAVE_UNSIGNED_LONG_LONG 1 +#define HAVE_UNSIGNED_LONG_LONG_INT 1 +#define HAVE_UTIME 1 +#define HAVE_UTIMENSAT 1 +#define HAVE_UTIMES 1 +#define HAVE_UTIME_H 1 +#define HAVE_VFORK 1 +#define HAVE_VPRINTF 1 +#define HAVE_WCHAR_H 1 +#define HAVE_WCHAR_T 1 +#define HAVE_WCRTOMB 1 +#define HAVE_WCSCMP 1 +#define HAVE_WCSCPY 1 +#define HAVE_WCSLEN 1 +#define HAVE_WCTOMB 1 +#define HAVE_WCTYPE_H 1 +#define HAVE_WMEMCMP 1 +#define HAVE_WMEMCPY 1 +#define HAVE_ARC4RANDOM_BUF 1 +#define HAVE_ZLIB_H 1 +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 +#define SIZEOF_WCHAR_T 4 +#define STDC_HEADERS 1 +#define STRERROR_R_CHAR_P 1 +#define TIME_WITH_SYS_TIME 1 +#endif diff --git a/contrib/android/config/linux_host.h b/contrib/android/config/linux_host.h new file mode 100644 index 000000000000..709b657c9da7 --- /dev/null +++ b/contrib/android/config/linux_host.h @@ -0,0 +1,189 @@ +/*- + * Copyright (c) 2014 Trevor Drake + * 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. + * + */ +#ifndef ARCHIVE_PLATFORM_H_ANDROID_LINUX_HOST_INCLUDED +#define ARCHIVE_PLATFORM_H_ANDROID_LINUX_HOST_INCLUDED + +#define HAVE_CHOWN 1 +#define HAVE_CHROOT 1 +#define HAVE_CTIME_R 1 +#define HAVE_CTYPE_H 1 +#define HAVE_DECL_EXTATTR_NAMESPACE_USER 0 +#define HAVE_DECL_INT64_MAX 1 +#define HAVE_DECL_INT64_MIN 1 +#define HAVE_DECL_SIZE_MAX 1 +#define HAVE_DECL_SSIZE_MAX 1 +#define HAVE_DECL_STRERROR_R 1 +#define HAVE_DECL_UINT32_MAX 1 +#define HAVE_DECL_UINT64_MAX 1 +#define HAVE_DIRENT_H 1 +#define HAVE_DIRFD 1 +#define HAVE_DLFCN_H 1 +#define HAVE_EILSEQ 1 +#define HAVE_ERRNO_H 1 +#define HAVE_FCHDIR 1 +#define HAVE_FCHMOD 1 +#define HAVE_FCHOWN 1 +#define HAVE_FCNTL 1 +#define HAVE_FCNTL_H 1 +#define HAVE_FDOPENDIR 1 +#define HAVE_FGETXATTR 1 +#define HAVE_FLISTXATTR 1 +#define HAVE_FORK 1 +#define HAVE_FSEEKO 1 +#define HAVE_FSETXATTR 1 +#define HAVE_FSTAT 1 +#define HAVE_FSTATAT 1 +#define HAVE_FSTATFS 1 +#define HAVE_FSTATVFS 1 +#define HAVE_FTRUNCATE 1 +#define HAVE_FUTIMENS 1 +#define HAVE_FUTIMES 1 +#define HAVE_FUTIMESAT 1 +#define HAVE_GETEUID 1 +#define HAVE_GETGRGID_R 1 +#define HAVE_GETGRNAM_R 1 +#define HAVE_GETPID 1 +#define HAVE_GETPWNAM_R 1 +#define HAVE_GETPWUID_R 1 +#define HAVE_GETXATTR 1 +#define HAVE_GMTIME_R 1 +#define HAVE_GRP_H 1 +#define HAVE_ICONV 1 +#define HAVE_ICONV_H 1 +#define HAVE_INTMAX_T 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LANGINFO_H 1 +#define HAVE_LCHOWN 1 +#define HAVE_LGETXATTR 1 +#define HAVE_LIBLZMA 1 +#define HAVE_LIBZ 1 +#define HAVE_LIMITS_H 1 +#define HAVE_LINK 1 +#define HAVE_LINUX_FIEMAP_H 1 +#define HAVE_LINUX_FS_H 1 +#define HAVE_LINUX_MAGIC_H 1 +#define HAVE_LINUX_TYPES_H 1 +#define HAVE_LISTXATTR 1 +#define HAVE_LLISTXATTR 1 +#define HAVE_LOCALE_H 1 +#define HAVE_LOCALTIME_R 1 +#define HAVE_LONG_LONG_INT 1 +#define HAVE_LSETXATTR 1 +#define HAVE_LSTAT 1 +#define HAVE_LUTIMES 1 +#define HAVE_MBRTOWC 1 +#define HAVE_MEMMOVE 1 +#define HAVE_MEMORY_H 1 +#define HAVE_MEMSET 1 +#define HAVE_MKDIR 1 +#define HAVE_MKFIFO 1 +#define HAVE_MKNOD 1 +#define HAVE_MKSTEMP 1 +#define HAVE_NL_LANGINFO 1 +#define HAVE_OPENAT 1 +#define HAVE_PATHS_H 1 +#define HAVE_PIPE 1 +#define HAVE_POLL 1 +#define HAVE_POLL_H 1 +#define HAVE_POSIX_SPAWNP 1 +#define HAVE_PTHREAD_H 1 +#define HAVE_PWD_H 1 +#define HAVE_READDIR_R 1 +#define HAVE_READLINK 1 +#define HAVE_READLINKAT 1 +#define HAVE_REGEX_H 1 +#define HAVE_SELECT 1 +#define HAVE_SETENV 1 +#define HAVE_SETLOCALE 1 +#define HAVE_SIGACTION 1 +#define HAVE_SIGNAL_H 1 +#define HAVE_SPAWN_H 1 +#define HAVE_STATFS 1 +#define HAVE_STATVFS 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRCHR 1 +#define HAVE_STRDUP 1 +#define HAVE_STRERROR 1 +#define HAVE_STRERROR_R 1 +#define HAVE_STRFTIME 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_STRRCHR 1 +#define HAVE_STRUCT_STAT_ST_BLKSIZE 1 +#define HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC 1 +#define HAVE_STRUCT_TM_TM_GMTOFF 1 +#define HAVE_SYMLINK 1 +#define HAVE_SYS_CDEFS_H 1 +#define HAVE_SYS_IOCTL_H 1 +#define HAVE_SYS_MOUNT_H 1 +#define HAVE_SYS_PARAM_H 1 +#define HAVE_SYS_POLL_H 1 +#define HAVE_SYS_SELECT_H 1 +#define HAVE_SYS_STATFS_H 1 +#define HAVE_SYS_STATVFS_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TIME_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_SYS_UTSNAME_H 1 +#define HAVE_SYS_VFS_H 1 +#define HAVE_SYS_WAIT_H 1 +#define HAVE_SYS_XATTR_H 1 +#define HAVE_TIMEGM 1 +#define HAVE_TIME_H 1 +#define HAVE_TZSET 1 +#define HAVE_UINTMAX_T 1 +#define HAVE_UNISTD_H 1 +#define HAVE_UNSETENV 1 +#define HAVE_UNSIGNED_LONG_LONG 1 +#define HAVE_UNSIGNED_LONG_LONG_INT 1 +#define HAVE_UTIME 1 +#define HAVE_UTIMENSAT 1 +#define HAVE_UTIMES 1 +#define HAVE_UTIME_H 1 +#define HAVE_VFORK 1 +#define HAVE_VPRINTF 1 +#define HAVE_WCHAR_H 1 +#define HAVE_WCHAR_T 1 +#define HAVE_WCRTOMB 1 +#define HAVE_WCSCMP 1 +#define HAVE_WCSCPY 1 +#define HAVE_WCSLEN 1 +#define HAVE_WCTOMB 1 +#define HAVE_WCTYPE_H 1 +#define HAVE_WMEMCMP 1 +#define HAVE_WMEMCPY 1 +#define HAVE_ZLIB_H 1 +#define ICONV_CONST +#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 +#define SIZEOF_WCHAR_T 4 +#define STDC_HEADERS 1 +#define STRERROR_R_CHAR_P 1 +#define TIME_WITH_SYS_TIME 1 +#define _GNU_SOURCE 1 + +#endif diff --git a/contrib/android/config/windows_host.h b/contrib/android/config/windows_host.h new file mode 100644 index 000000000000..decc87f2a361 --- /dev/null +++ b/contrib/android/config/windows_host.h @@ -0,0 +1,1062 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_LIBC */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_LIBMD supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_LIBMD */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_LIBSYSTEM */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_NETTLE */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_MD5_OPENSSL */ + +/* MD5 via ARCHIVE_CRYPTO_MD5_WIN supported. */ +#define ARCHIVE_CRYPTO_MD5_WIN 1 + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_LIBC */ + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_LIBMD supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_LIBMD */ + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_NETTLE */ + +/* RMD160 via ARCHIVE_CRYPTO_RMD160_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_RMD160_OPENSSL */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_LIBC */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBMD supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_LIBMD */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_LIBSYSTEM */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_NETTLE */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA1_OPENSSL */ + +/* SHA1 via ARCHIVE_CRYPTO_SHA1_WIN supported. */ +#define ARCHIVE_CRYPTO_SHA1_WIN 1 + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBC */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC2 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBC2 */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBC3 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBC3 */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBMD supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBMD */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_LIBSYSTEM */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_NETTLE */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA256_OPENSSL */ + +/* SHA256 via ARCHIVE_CRYPTO_SHA256_WIN supported. */ +#define ARCHIVE_CRYPTO_SHA256_WIN 1 + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBC */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC2 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBC2 */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBC3 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBC3 */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_LIBSYSTEM */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_NETTLE */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA384_OPENSSL */ + +/* SHA384 via ARCHIVE_CRYPTO_SHA384_WIN supported. */ +#define ARCHIVE_CRYPTO_SHA384_WIN 1 + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBC */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC2 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBC2 */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBC3 supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBC3 */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBMD supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBMD */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_LIBSYSTEM supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_LIBSYSTEM */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_NETTLE supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_NETTLE */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_OPENSSL supported. */ +/* #undef ARCHIVE_CRYPTO_SHA512_OPENSSL */ + +/* SHA512 via ARCHIVE_CRYPTO_SHA512_WIN supported. */ +#define ARCHIVE_CRYPTO_SHA512_WIN 1 + +/* Define to 1 if you have the `acl_create_entry' function. */ +/* #undef HAVE_ACL_CREATE_ENTRY */ + +/* Define to 1 if you have the `acl_get_link' function. */ +/* #undef HAVE_ACL_GET_LINK */ + +/* Define to 1 if you have the `acl_get_link_np' function. */ +/* #undef HAVE_ACL_GET_LINK_NP */ + +/* Define to 1 if you have the `acl_get_perm' function. */ +/* #undef HAVE_ACL_GET_PERM */ + +/* Define to 1 if you have the `acl_get_perm_np' function. */ +/* #undef HAVE_ACL_GET_PERM_NP */ + +/* Define to 1 if you have the `acl_init' function. */ +/* #undef HAVE_ACL_INIT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ACL_LIBACL_H */ + +/* Define to 1 if the system has the type `acl_permset_t'. */ +/* #undef HAVE_ACL_PERMSET_T */ + +/* Define to 1 if you have the `acl_set_fd' function. */ +/* #undef HAVE_ACL_SET_FD */ + +/* Define to 1 if you have the `acl_set_fd_np' function. */ +/* #undef HAVE_ACL_SET_FD_NP */ + +/* Define to 1 if you have the `acl_set_file' function. */ +/* #undef HAVE_ACL_SET_FILE */ + +/* True for systems with POSIX ACL support */ +/* #undef HAVE_ACL_USER */ + +/* Define to 1 if you have the `arc4random_buf' function. */ +/* #undef HAVE_ARC4RANDOM_BUF */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ATTR_XATTR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_BCRYPT_H + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BZLIB_H */ + +/* Define to 1 if you have the `chflags' function. */ +/* #undef HAVE_CHFLAGS */ + +/* Define to 1 if you have the `chown' function. */ +/* #undef HAVE_CHOWN */ + +/* Define to 1 if you have the `chroot' function. */ +/* #undef HAVE_CHROOT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_COPYFILE_H */ + +/* Define to 1 if you have the `ctime_r' function. */ +/* #undef HAVE_CTIME_R */ + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the `cygwin_conv_path' function. */ +/* #undef HAVE_CYGWIN_CONV_PATH */ + +/* Define to 1 if you have the declaration of `EXTATTR_NAMESPACE_USER', and to + 0 if you don't. */ +#define HAVE_DECL_EXTATTR_NAMESPACE_USER 0 + +/* Define to 1 if you have the declaration of `INT64_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_INT64_MAX 1 + +/* Define to 1 if you have the declaration of `INT64_MIN', and to 0 if you + don't. */ +#define HAVE_DECL_INT64_MIN 1 + +/* Define to 1 if you have the declaration of `SIZE_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_SIZE_MAX 1 + +/* Define to 1 if you have the declaration of `SSIZE_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_SSIZE_MAX 1 + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#define HAVE_DECL_STRERROR_R 0 + +/* Define to 1 if you have the declaration of `UINT32_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_UINT32_MAX 1 + +/* Define to 1 if you have the declaration of `UINT64_MAX', and to 0 if you + don't. */ +#define HAVE_DECL_UINT64_MAX 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the `dirfd' function. */ +/* #undef HAVE_DIRFD */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_DLFCN_H */ + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if nl_langinfo supports D_MD_ORDER */ +/* #undef HAVE_D_MD_ORDER */ + +/* A possible errno value for invalid file format errors */ +/* #undef HAVE_EFTYPE */ + +/* A possible errno value for invalid file format errors */ +#define HAVE_EILSEQ 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_EXPAT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_EXT2FS_EXT2_FS_H */ + +/* Define to 1 if you have the `extattr_get_file' function. */ +/* #undef HAVE_EXTATTR_GET_FILE */ + +/* Define to 1 if you have the `extattr_list_file' function. */ +/* #undef HAVE_EXTATTR_LIST_FILE */ + +/* Define to 1 if you have the `extattr_set_fd' function. */ +/* #undef HAVE_EXTATTR_SET_FD */ + +/* Define to 1 if you have the `extattr_set_file' function. */ +/* #undef HAVE_EXTATTR_SET_FILE */ + +/* Define to 1 if you have the `fchdir' function. */ +/* #undef HAVE_FCHDIR */ + +/* Define to 1 if you have the `fchflags' function. */ +/* #undef HAVE_FCHFLAGS */ + +/* Define to 1 if you have the `fchmod' function. */ +/* #undef HAVE_FCHMOD */ + +/* Define to 1 if you have the `fchown' function. */ +/* #undef HAVE_FCHOWN */ + +/* Define to 1 if you have the `fcntl' function. */ +/* #undef HAVE_FCNTL */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fdopendir' function. */ +/* #undef HAVE_FDOPENDIR */ + +/* Define to 1 if you have the `fgetea' function. */ +/* #undef HAVE_FGETEA */ + +/* Define to 1 if you have the `fgetxattr' function. */ +/* #undef HAVE_FGETXATTR */ + +/* Define to 1 if you have the `flistea' function. */ +/* #undef HAVE_FLISTEA */ + +/* Define to 1 if you have the `flistxattr' function. */ +/* #undef HAVE_FLISTXATTR */ + +/* Define to 1 if you have the `fork' function. */ +/* #undef HAVE_FORK */ + +/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ +#define HAVE_FSEEKO 1 + +/* Define to 1 if you have the `fsetea' function. */ +/* #undef HAVE_FSETEA */ + +/* Define to 1 if you have the `fsetxattr' function. */ +/* #undef HAVE_FSETXATTR */ + +/* Define to 1 if you have the `fstat' function. */ +#define HAVE_FSTAT 1 + +/* Define to 1 if you have the `fstatat' function. */ +/* #undef HAVE_FSTATAT */ + +/* Define to 1 if you have the `fstatfs' function. */ +/* #undef HAVE_FSTATFS */ + +/* Define to 1 if you have the `fstatvfs' function. */ +/* #undef HAVE_FSTATVFS */ + +/* Define to 1 if you have the `ftruncate' function. */ +#define HAVE_FTRUNCATE 1 + +/* Define to 1 if you have the `futimens' function. */ +/* #undef HAVE_FUTIMENS */ + +/* Define to 1 if you have the `futimes' function. */ +/* #undef HAVE_FUTIMES */ + +/* Define to 1 if you have the `futimesat' function. */ +/* #undef HAVE_FUTIMESAT */ + +/* Define to 1 if you have the `getea' function. */ +/* #undef HAVE_GETEA */ + +/* Define to 1 if you have the `geteuid' function. */ +/* #undef HAVE_GETEUID */ + +/* Define to 1 if you have the `getgrgid_r' function. */ +/* #undef HAVE_GETGRGID_R */ + +/* Define to 1 if you have the `getgrnam_r' function. */ +/* #undef HAVE_GETGRNAM_R */ + +/* Define to 1 if you have the `getpid' function. */ +#define HAVE_GETPID 1 + +/* Define to 1 if you have the `getpwnam_r' function. */ +/* #undef HAVE_GETPWNAM_R */ + +/* Define to 1 if you have the `getpwuid_r' function. */ +/* #undef HAVE_GETPWUID_R */ + +/* Define to 1 if you have the `getvfsbyname' function. */ +/* #undef HAVE_GETVFSBYNAME */ + +/* Define to 1 if you have the `getxattr' function. */ +/* #undef HAVE_GETXATTR */ + +/* Define to 1 if you have the `gmtime_r' function. */ +/* #undef HAVE_GMTIME_R */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_GRP_H */ + +/* Define if you have the iconv() function and it works. */ +/* #undef HAVE_ICONV */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ICONV_H */ + +/* Define to 1 if the system has the type `intmax_t'. */ +#define HAVE_INTMAX_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_IO_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LANGINFO_H */ + +/* Define to 1 if you have the `lchflags' function. */ +/* #undef HAVE_LCHFLAGS */ + +/* Define to 1 if you have the `lchmod' function. */ +/* #undef HAVE_LCHMOD */ + +/* Define to 1 if you have the `lchown' function. */ +/* #undef HAVE_LCHOWN */ + +/* Define to 1 if you have the `lgetea' function. */ +/* #undef HAVE_LGETEA */ + +/* Define to 1 if you have the `lgetxattr' function. */ +/* #undef HAVE_LGETXATTR */ + +/* Define to 1 if you have the `acl' library (-lacl). */ +/* #undef HAVE_LIBACL */ + +/* Define to 1 if you have the `attr' library (-lattr). */ +/* #undef HAVE_LIBATTR */ + +/* Define to 1 if you have the `bz2' library (-lbz2). */ +/* #undef HAVE_LIBBZ2 */ + +/* Define to 1 if you have the `charset' library (-lcharset). */ +/* #undef HAVE_LIBCHARSET */ + +/* Define to 1 if you have the `crypto' library (-lcrypto). */ +/* #undef HAVE_LIBCRYPTO */ + +/* Define to 1 if you have the `eay32' library (-leay32). */ +/* #undef HAVE_LIBEAY32 */ + +/* Define to 1 if you have the `eay64' library (-leay64). */ +/* #undef HAVE_LIBEAY64 */ + +/* Define to 1 if you have the `expat' library (-lexpat). */ +/* #undef HAVE_LIBEXPAT */ + +/* Define to 1 if you have the `lz4' library (-llz4). */ +/* #undef HAVE_LIBLZ4 */ + +/* Define to 1 if you have the `lzma' library (-llzma). */ +/* #undef HAVE_LIBLZMA */ + +/* Define to 1 if you have the `lzmadec' library (-llzmadec). */ +/* #undef HAVE_LIBLZMADEC */ + +/* Define to 1 if you have the `lzo2' library (-llzo2). */ +/* #undef HAVE_LIBLZO2 */ + +/* Define to 1 if you have the `md' library (-lmd). */ +/* #undef HAVE_LIBMD */ + +/* Define to 1 if you have the `nettle' library (-lnettle). */ +/* #undef HAVE_LIBNETTLE */ + +/* Define to 1 if you have the `pcre' library (-lpcre). */ +/* #undef HAVE_LIBPCRE */ + +/* Define to 1 if you have the `pcreposix' library (-lpcreposix). */ +/* #undef HAVE_LIBPCREPOSIX */ + +/* Define to 1 if you have the `regex' library (-lregex). */ +/* #undef HAVE_LIBREGEX */ + +/* Define to 1 if you have the `xml2' library (-lxml2). */ +/* #undef HAVE_LIBXML2 */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBXML_XMLREADER_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LIBXML_XMLWRITER_H */ + +/* Define to 1 if you have the `z' library (-lz). */ +/* #undef HAVE_LIBZ */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the `link' function. */ +/* #undef HAVE_LINK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_FIEMAP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_FS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_MAGIC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LINUX_TYPES_H */ + +/* Define to 1 if you have the `listea' function. */ +/* #undef HAVE_LISTEA */ + +/* Define to 1 if you have the `listxattr' function. */ +/* #undef HAVE_LISTXATTR */ + +/* Define to 1 if you have the `llistea' function. */ +/* #undef HAVE_LLISTEA */ + +/* Define to 1 if you have the `llistxattr' function. */ +/* #undef HAVE_LLISTXATTR */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LOCALCHARSET_H */ + +/* Define to 1 if you have the `locale_charset' function. */ +/* #undef HAVE_LOCALE_CHARSET */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + +/* Define to 1 if you have the `localtime_r' function. */ +/* #undef HAVE_LOCALTIME_R */ + +/* Define to 1 if the system has the type `long long int'. */ +#define HAVE_LONG_LONG_INT 1 + +/* Define to 1 if you have the `lsetea' function. */ +/* #undef HAVE_LSETEA */ + +/* Define to 1 if you have the `lsetxattr' function. */ +/* #undef HAVE_LSETXATTR */ + +/* Define to 1 if you have the `lstat' function. */ +/* #undef HAVE_LSTAT */ + +/* Define to 1 if `lstat' has the bug that it succeeds when given the + zero-length file name argument. */ +#define HAVE_LSTAT_EMPTY_STRING_BUG 1 + +/* Define to 1 if you have the `lutimes' function. */ +/* #undef HAVE_LUTIMES */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZ4HC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZ4_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZMADEC_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZMA_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZO_LZO1X_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_LZO_LZOCONF_H */ + +/* Define to 1 if you have the `mbrtowc' function. */ +#define HAVE_MBRTOWC 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MD5_H */ + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `memset' function. */ +#define HAVE_MEMSET 1 + +/* Define to 1 if you have the `mkdir' function. */ +#define HAVE_MKDIR 1 + +/* Define to 1 if you have the `mkfifo' function. */ +/* #undef HAVE_MKFIFO */ + +/* Define to 1 if you have the `mknod' function. */ +/* #undef HAVE_MKNOD */ + +/* Define to 1 if you have the `mkstemp' function. */ +/* #undef HAVE_MKSTEMP */ + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_MD5_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_PBKDF2_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_RIPEMD160_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_NETTLE_SHA_H */ + +/* Define to 1 if you have the `nl_langinfo' function. */ +/* #undef HAVE_NL_LANGINFO */ + +/* Define to 1 if you have the `openat' function. */ +/* #undef HAVE_OPENAT */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_OPENSSL_EVP_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PATHS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PCREPOSIX_H */ + +/* Define to 1 if you have the `pipe' function. */ +/* #undef HAVE_PIPE */ + +/* Define to 1 if you have the `PKCS5_PBKDF2_HMAC_SHA1' function. */ +/* #undef HAVE_PKCS5_PBKDF2_HMAC_SHA1 */ + +/* Define to 1 if you have the `poll' function. */ +/* #undef HAVE_POLL */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_POLL_H */ + +/* Define to 1 if you have the `posix_spawnp' function. */ +/* #undef HAVE_POSIX_SPAWNP */ + +/* Define to 1 if you have the header file. */ +#define HAVE_PTHREAD_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_PWD_H */ + +/* Define to 1 if you have a POSIX compatible readdir_r */ +#define HAVE_READDIR_R 1 + +/* Define to 1 if you have the `readlink' function. */ +/* #undef HAVE_READLINK */ + +/* Define to 1 if you have the `readlinkat' function. */ +/* #undef HAVE_READLINKAT */ + +/* Define to 1 if you have the `readpassphrase' function. */ +/* #undef HAVE_READPASSPHRASE */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_READPASSPHRASE_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_REGEX_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_RIPEMD_H */ + +/* Define to 1 if you have the `select' function. */ +/* #undef HAVE_SELECT */ + +/* Define to 1 if you have the `setenv' function. */ +/* #undef HAVE_SETENV */ + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SHA256_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SHA512_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SHA_H */ + +/* Define to 1 if you have the `sigaction' function. */ +/* #undef HAVE_SIGACTION */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SPAWN_H */ + +/* Define to 1 if you have the `statfs' function. */ +/* #undef HAVE_STATFS */ + +/* Define to 1 if you have the `statvfs' function. */ +/* #undef HAVE_STATVFS */ + +/* Define to 1 if `stat' has the bug that it succeeds when given the + zero-length file name argument. */ +#define HAVE_STAT_EMPTY_STRING_BUG 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strchr' function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the `strdup' function. */ +#define HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror' function. */ +#define HAVE_STRERROR 1 + +/* Define to 1 if you have the `strerror_r' function. */ +/* #undef HAVE_STRERROR_R */ + +/* Define to 1 if you have the `strftime' function. */ +#define HAVE_STRFTIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strncpy_s' function. */ +#define HAVE_STRNCPY_S 1 + +/* Define to 1 if you have the `strrchr' function. */ +#define HAVE_STRRCHR 1 + +/* Define to 1 if `f_namemax' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_NAMEMAX */ + +/* Define to 1 if `f_iosize' is a member of `struct statvfs'. */ +/* #undef HAVE_STRUCT_STATVFS_F_IOSIZE */ + +/* Define to 1 if `st_birthtime' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIME */ + +/* Define to 1 if `st_birthtimespec.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BIRTHTIMESPEC_TV_NSEC */ + +/* Define to 1 if `st_blksize' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_BLKSIZE */ + +/* Define to 1 if `st_flags' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_FLAGS */ + +/* Define to 1 if `st_mtimespec.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC */ + +/* Define to 1 if `st_mtime_n' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIME_N */ + +/* Define to 1 if `st_mtime_usec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIME_USEC */ + +/* Define to 1 if `st_mtim.tv_nsec' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC */ + +/* Define to 1 if `st_umtime' is a member of `struct stat'. */ +/* #undef HAVE_STRUCT_STAT_ST_UMTIME */ + +/* Define to 1 if `tm_gmtoff' is a member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM_TM_GMTOFF */ + +/* Define to 1 if `__tm_gmtoff' is a member of `struct tm'. */ +/* #undef HAVE_STRUCT_TM___TM_GMTOFF */ + +/* Define to 1 if you have the `symlink' function. */ +/* #undef HAVE_SYMLINK */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_ACL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_CDEFS_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_EA_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_EXTATTR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_IOCTL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MKDEV_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_MOUNT_H */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_POLL_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_SELECT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STATFS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_STATVFS_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UTIME_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_UTSNAME_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_VFS_H */ + +/* Define to 1 if you have that is POSIX.1 compatible. */ +/* #undef HAVE_SYS_WAIT_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_XATTR_H */ + +/* Define to 1 if you have the `timegm' function. */ +/* #undef HAVE_TIMEGM */ + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the `tzset' function. */ +#define HAVE_TZSET 1 + +/* Define to 1 if the system has the type `uintmax_t'. */ +#define HAVE_UINTMAX_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `unsetenv' function. */ +/* #undef HAVE_UNSETENV */ + +/* Define to 1 if the system has the type `unsigned long long'. */ +#define HAVE_UNSIGNED_LONG_LONG 1 + +/* Define to 1 if the system has the type `unsigned long long int'. */ +#define HAVE_UNSIGNED_LONG_LONG_INT 1 + +/* Define to 1 if you have the `utime' function. */ +#define HAVE_UTIME 1 + +/* Define to 1 if you have the `utimensat' function. */ +/* #undef HAVE_UTIMENSAT */ + +/* Define to 1 if you have the `utimes' function. */ +/* #undef HAVE_UTIMES */ + +/* Define to 1 if you have the header file. */ +#define HAVE_UTIME_H 1 + +/* Define to 1 if you have the `vfork' function. */ +/* #undef HAVE_VFORK */ + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define to 1 if the system has the type `wchar_t'. */ +#define HAVE_WCHAR_T 1 + +/* Define to 1 if you have the `wcrtomb' function. */ +#define HAVE_WCRTOMB 1 + +/* Define to 1 if you have the `wcscmp' function. */ +#define HAVE_WCSCMP 1 + +/* Define to 1 if you have the `wcscpy' function. */ +#define HAVE_WCSCPY 1 + +/* Define to 1 if you have the `wcslen' function. */ +#define HAVE_WCSLEN 1 + +/* Define to 1 if you have the `wctomb' function. */ +#define HAVE_WCTOMB 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WINCRYPT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WINDOWS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WINIOCTL_H 1 + +/* Define to 1 if you have the `wmemcmp' function. */ +#define HAVE_WMEMCMP 1 + +/* Define to 1 if you have the `wmemcpy' function. */ +#define HAVE_WMEMCPY 1 + +/* Define to 1 if you have a working EXT2_IOC_GETFLAGS */ +/* #undef HAVE_WORKING_EXT2_IOC_GETFLAGS */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ZLIB_H */ + +/* Define to 1 if you have the `_ctime64_s' function. */ +#define HAVE__CTIME64_S 1 + +/* Define to 1 if you have the `_fseeki64' function. */ +#define HAVE__FSEEKI64 1 + +/* Define to 1 if you have the `_get_timezone' function. */ +/* #undef HAVE__GET_TIMEZONE */ + +/* Define to 1 if you have the `_localtime64_s' function. */ +#define HAVE__LOCALTIME64_S 1 + +/* Define to 1 if you have the `_mkgmtime64' function. */ +/* #define HAVE__MKGMTIME64 1 */ + +/* Define as const if the declaration of iconv() needs const. */ +/* #undef ICONV_CONST */ + +/* Define to 1 if `lstat' dereferences a symlink specified with a trailing + slash. */ +/* #undef LSTAT_FOLLOWS_SLASHED_SYMLINK */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in . + */ +/* #undef MAJOR_IN_MKDEV */ + +/* Define to 1 if `major', `minor', and `makedev' are declared in + . */ +/* #undef MAJOR_IN_SYSMACROS */ + + +/* Define to 1 if PCRE_STATIC needs to be defined. */ +/* #undef PCRE_STATIC */ + +/* The size of `wchar_t', as computed by sizeof. */ +#define SIZEOF_WCHAR_T 2 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if strerror_r returns char *. */ +/* #undef STRERROR_R_CHAR_P */ + +/* Define to 1 if you can safely include both and . */ +#define TIME_WITH_SYS_TIME 1 + + + +/* Define to '0x0500' for Windows 2000 APIs. */ +#define WINVER 0x0500 + +/* Number of bits in a file offset, on hosts where this is settable. */ +#define _FILE_OFFSET_BITS 64 + +/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */ +/* #undef _LARGEFILE_SOURCE */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define for Solaris 2.5.1 so the uint32_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT32_T */ + +/* Define for Solaris 2.5.1 so the uint64_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT64_T */ + +/* Define for Solaris 2.5.1 so the uint8_t typedef from , + , or is not used. If the typedef were allowed, the + #define below would cause a syntax error. */ +/* #undef _UINT8_T */ + +/* Define to '0x0500' for Windows 2000 APIs. */ +#define _WIN32_WINNT 0x0500 + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to match typeof st_gid field of struct stat if doesn't + define. */ +#define gid_t short + +/* Define to `unsigned long' if does not define. */ +#define id_t unsigned long + +/* Define to the type of a signed integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int16_t */ + +/* Define to the type of a signed integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int32_t */ + +/* Define to the type of a signed integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef int64_t */ + +/* Define to the widest signed integer type if and do + not define. */ +/* #undef intmax_t */ + +/* Define to `int' if does not define. */ +/* #undef mode_t */ + +/* Define to `long long' if does not define. */ +/* #undef off_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef size_t */ + +/* Define to match typeof st_uid field of struct stat if doesn't + define. */ +#define uid_t short + +/* Define to the type of an unsigned integer type of width exactly 16 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint16_t */ + +/* Define to the type of an unsigned integer type of width exactly 32 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint32_t */ + +/* Define to the type of an unsigned integer type of width exactly 64 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint64_t */ + +/* Define to the type of an unsigned integer type of width exactly 8 bits if + such a type exists and the standard includes do not define it. */ +/* #undef uint8_t */ + +/* Define to the widest unsigned integer type if and + do not define. */ +/* #undef uintmax_t */ + +/* Define to `unsigned int' if does not define. */ +/* #undef uintptr_t */ diff --git a/contrib/android/include/Bcrypt.h b/contrib/android/include/Bcrypt.h new file mode 100644 index 000000000000..df295990292b --- /dev/null +++ b/contrib/android/include/Bcrypt.h @@ -0,0 +1 @@ +#include diff --git a/contrib/android/include/Windows.h b/contrib/android/include/Windows.h new file mode 100644 index 000000000000..776a87ce358d --- /dev/null +++ b/contrib/android/include/Windows.h @@ -0,0 +1 @@ +#include diff --git a/contrib/android/include/android_lf.h b/contrib/android/include/android_lf.h new file mode 100644 index 000000000000..2a18f5142033 --- /dev/null +++ b/contrib/android/include/android_lf.h @@ -0,0 +1,47 @@ +/* + * Macros for file64 functions + * + * Android does not support the macro _FILE_OFFSET_BITS=64 + * As of android-21 it does however support many file64 functions +*/ + +#ifndef ARCHIVE_ANDROID_LF_H_INCLUDED +#define ARCHIVE_ANDROID_LF_H_INCLUDED + +#if __ANDROID_API__ > 20 + +#include +#include +#include +#include +#include +#include +#include + +//dirent.h +#define readdir_r readdir64_r +#define readdir readdir64 +#define dirent dirent64 +//fcntl.h +#define openat openat64 +#define open open64 +#define mkstemp mkstemp64 +//unistd.h +#define lseek lseek64 +#define ftruncate ftruncate64 +//sys/stat.h +#define fstatat fstatat64 +#define fstat fstat64 +#define lstat lstat64 +#define stat stat64 +//sys/statvfs.h +#define fstatvfs fstatvfs64 +#define statvfs statvfs64 +//sys/types.h +#define off_t off64_t +//sys/vfs.h +#define fstatfs fstatfs64 +#define statfs statfs64 +#endif + +#endif /* ARCHIVE_ANDROID_LF_H_INCLUDED */ diff --git a/contrib/libarchive.spec b/contrib/libarchive.spec index b5b658a874b1..f4ed359721a0 100644 --- a/contrib/libarchive.spec +++ b/contrib/libarchive.spec @@ -1,14 +1,11 @@ -# $LastChangedRevision$, $LastChangedDate$ Summary: Library to create and read several different archive formats -Summary(pl): Biblioteka do tworzenia i odczytu ró¿nych formatów archiwów Name: libarchive -Version: 2.0a3 +Version: 3.1.2 Release: 1 License: BSD Group: Libraries -Source0: http://people.freebsd.org/~kientzle/libarchive/src/%{name}-%{version}.tar.gz -Patch: %{name}-0123457890.patch -URL: http://people.freebsd.org/~kientzle/libarchive/ +Source0: http://libarchive.org/downloads/%{name}-%{version}.tar.gz +URL: http:/libarchive.org/ Requires: glibc Requires: zlib Requires: bzip2 @@ -24,57 +21,47 @@ Libarchive is a programming library that can create and read several different streaming archive formats, including most popular TAR variants and several CPIO formats. It can also write SHAR archives. -%description -l pl -Libarchive jest bibliotek± s³u¿ac± to tworzenia i odczytu wielu -ró¿nych strumieniowych formatów archiwów, w³±czaj±c w to popularne -odmiany TAR oraz wiele formatów CPIO. Biblioteka ta potrafi tak¿e -zapisywaæ archiwa SHAR. - %package devel Summary: Header files for libarchive library -Summary(pl): Pliki nag³ówkowe biblioteki libarchive Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel Header files for libarchive library. -%description devel -l pl -Pliki nag³ówkowe biblioteki libarchive. - %package static Summary: Static libarchive library -Summary(pl): Statyczna biblioteka libarchive Group: Development/Libraries Requires: %{name}-devel = %{version}-%{release} %description static Static libarchive library. -%description static -l pl -Statyczna biblioteka libarchive. - %package -n bsdtar Summary: bsdtar - tar(1) implementation based on libarchive -Summary(pl): bsdtar - implementacja programu tar(1) oparta na libarchive Group: Applications/Archiving Requires: %{name} = %{version}-%{release} %description -n bsdtar bsdtar - tar(1) implementation based on libarchive. -%description -n bsdtar -l pl -bsdtar - implementacja programu tar(1), oparta na libarchive. +%package -n bsdcpio +Summary: bsdcpio - cpio(1) implementation based on libarchive +Group: Applications/Archiving +Requires: %{name} = %{version}-%{release} + +%description -n bsdcpio +bsdcpio - cpio(1) implementation based on libarchive %prep %setup -q -%patch0 -p1 %build mkdir -p %{buildroot} ./configure \ --prefix=%{_prefix} \ --libexecdir=%{_libexecdir} \ +--libdir=%{_libdir} \ --mandir=%{_mandir} \ --infodir=%{_infodir} \ --enable-shared=yes \ @@ -85,63 +72,34 @@ make | tee %{buildroot}/make.log %install [ "%buildroot" != "/" ] && [ -d %buildroot ] && rm -rf %buildroot; make DESTDIR=%buildroot install -# original install builds, but does install bsdtar -cp .libs/%{name}.a %{buildroot}%{_libdir} -cp bsdtar %{buildroot}%{_bindir} -cp tar/bsdtar.1 %{buildroot}%{_mandir}/man1 %clean rm -fr %buildroot %files -%defattr(644,root,root,755) +%{_libdir}/libarchive.so* + +%files static %{_libdir}/libarchive.a %files devel -%defattr(644,root,root,755) +%{_libdir}/pkgconfig/libarchive.pc %{_libdir}/libarchive.la %{_includedir}/*.h %doc %{_mandir}/man3/* %doc %{_mandir}/man5/* %files -n bsdtar -%defattr(644,root,root,755) %attr(755,root,root) %{_bindir}/bsdtar %doc %{_mandir}/man1/bsdtar.1* -%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`) +%files -n bsdcpio +%attr(755,root,root) %{_bindir}/bsdcpio +%doc %{_mandir}/man1/bsdcpio.1* + %changelog -* %{date} PLD Team -All persons listed below can be reached at @pld-linux.org - -$Log: libarchive.spec,v $ -Release 1 2006/12/12 rm1023@dcx.com -- added libarchive-0123457890.patch for "0123457890" error -- replaced libarchive-1.3.1.tar.gz with libarchive-2.0a3.tar.gz -- removed obsolete -CVE-2006-5680.patch and -man_progname.patch - -Revision 1.6 2006/11/15 10:41:28 qboosh -- BR: acl-devel,attr-devel -- devel deps - -Revision 1.5 2006/11/08 22:22:25 twittner -- up to 1.3.1 -- added BR: e2fsprogs-devel -- added -CVE-2006-5680.patch against entering an infinite -loop in corrupt archives -- added bsdtar package (bsdtar is included now in libarchive -sources) -- rel. 0.1 for testing - -Revision 1.4 2005/12/15 18:26:36 twittner -- up to 1.2.37 -- removed -shared.patch (no longer needed) - -Revision 1.3 2005/10/05 17:00:12 arekm -- up to 1.02.034 - -Revision 1.2 2005/07/27 20:17:21 qboosh -- typo - -Revision 1.1 2005/07/27 08:36:03 adamg -- new +* Wed May 01 2013 Nikolai Lifanov - 3.1.2-1 +- Initial package +- contrib/libarchive.spec by PLD team overhaul +- Added "bsdcpio" package +- Fixed build on x86_64 platform diff --git a/contrib/untar.c b/contrib/untar.c index c4cc2bf9bea2..3d954f638be0 100644 --- a/contrib/untar.c +++ b/contrib/untar.c @@ -1,3 +1,7 @@ +/* + * This file is in the public domain. Use it as you see fit. + */ + /* * "untar" is an extremely simple tar extractor: * * A single C source file, so it should be easy to compile @@ -95,7 +99,7 @@ static FILE * create_file(char *pathname, int mode) { FILE *f; - f = fopen(pathname, "w+"); + f = fopen(pathname, "wb+"); if (f == NULL) { /* Try creating parent dir and then creating file. */ char *p = strrchr(pathname, '/'); @@ -103,7 +107,7 @@ create_file(char *pathname, int mode) *p = '\0'; create_dir(pathname, 0755); *p = '/'; - f = fopen(pathname, "w+"); + f = fopen(pathname, "wb+"); } } return (f); @@ -213,7 +217,7 @@ main(int argc, char **argv) ++argv; /* Skip program name */ for ( ;*argv != NULL; ++argv) { - a = fopen(*argv, "r"); + a = fopen(*argv, "rb"); if (a == NULL) fprintf(stderr, "Unable to open %s\n", *argv); else { diff --git a/cpio/CMakeLists.txt b/cpio/CMakeLists.txt index cc4aa14cb54b..85fda7782800 100644 --- a/cpio/CMakeLists.txt +++ b/cpio/CMakeLists.txt @@ -15,7 +15,10 @@ IF(ENABLE_CPIO) ../libarchive_fe/lafe_platform.h ../libarchive_fe/line_reader.c ../libarchive_fe/line_reader.h + ../libarchive_fe/passphrase.c + ../libarchive_fe/passphrase.h ) + INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/test_utils) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe) IF(WIN32 AND NOT CYGWIN) LIST(APPEND bsdcpio_SOURCES cpio_windows.c) @@ -34,8 +37,6 @@ IF(ENABLE_CPIO) SET_TARGET_PROPERTIES(bsdcpio PROPERTIES COMPILE_DEFINITIONS LIBARCHIVE_STATIC) ENDIF(ENABLE_CPIO_SHARED) - # Full path to the compiled executable (used by test suite) - GET_TARGET_PROPERTY(BSDCPIO bsdcpio LOCATION) # Installation rules INSTALL(TARGETS bsdcpio RUNTIME DESTINATION bin) diff --git a/cpio/bsdcpio.1 b/cpio/bsdcpio.1 index b3d0d40a21ad..e52546e6f761 100644 --- a/cpio/bsdcpio.1 +++ b/cpio/bsdcpio.1 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 7, 2012 +.Dd September 16, 2014 .Dt CPIO 1 .Os .Sh NAME @@ -32,17 +32,17 @@ .Nd copy files to and from archives .Sh SYNOPSIS .Nm -.Brq Fl i +.Fl i .Op Ar options .Op Ar pattern ... .Op Ar < archive .Nm -.Brq Fl o +.Fl o .Op Ar options .Ar < name-list .Op Ar > archive .Nm -.Brq Fl p +.Fl p .Op Ar options .Ar dest-dir .Ar < name-list @@ -156,7 +156,8 @@ See above for description. .It Fl Fl insecure (i and p mode only) Disable security checks during extraction or copying. -This allows extraction via symbolic links and path names containing +This allows extraction via symbolic links, absolute paths, +and path names containing .Sq .. in the name. .It Fl J , Fl Fl xz @@ -181,6 +182,11 @@ instead of copying. Compress the resulting archive with .Xr lrzip 1 . In input mode, this option is ignored. +.It Fl Fl lz4 +(o mode only) +Compress the archive with lz4-compatible compression before writing it. +In input mode, this option is ignored; lz4 compression is recognized +automatically on input. .It Fl Fl lzma (o mode only) Compress the file with lzma-compatible compression before writing it. @@ -191,6 +197,15 @@ automatically on input. Compress the resulting archive with .Xr lzop 1 . In input mode, this option is ignored. +.It Fl Fl passphrase Ar passphrase +The +.Pa passphrase +is used to extract or create an encrypted archive. +Currently, zip is only a format that +.Nm +can handle encrypted archives. +You shouldn't use this option unless you realize how insecure +use of this option is. .It Fl m , Fl Fl preserve-modification-time (i and p modes) Set file modification time on created files to match diff --git a/cpio/cmdline.c b/cpio/cmdline.c index 0121fd13937f..7e59536957a4 100644 --- a/cpio/cmdline.c +++ b/cpio/cmdline.c @@ -73,6 +73,7 @@ static const struct option { { "link", 0, 'l' }, { "list", 0, 't' }, { "lrzip", 0, OPTION_LRZIP }, + { "lz4", 0, OPTION_LZ4 }, { "lzma", 0, OPTION_LZMA }, { "lzop", 0, OPTION_LZOP }, { "make-directories", 0, 'd' }, @@ -80,6 +81,7 @@ static const struct option { { "null", 0, '0' }, { "numeric-uid-gid", 0, 'n' }, { "owner", 1, 'R' }, + { "passphrase", 1, OPTION_PASSPHRASE }, { "pass-through", 0, 'p' }, { "preserve-modification-time", 0, 'm' }, { "preserve-owner", 0, OPTION_PRESERVE_OWNER }, diff --git a/cpio/cpio.c b/cpio/cpio.c index 6f57d95d616e..b267e9b8a744 100644 --- a/cpio/cpio.c +++ b/cpio/cpio.c @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/cpio.c,v 1.15 2008/12/06 07:30:40 kientzle #include "cpio.h" #include "err.h" #include "line_reader.h" +#include "passphrase.h" /* Fixed size of uname/gname caches. */ #define name_cache_size 101 @@ -123,6 +124,8 @@ static int restore_time(struct cpio *, struct archive_entry *, const char *, int fd); static void usage(void); static void version(void); +static const char * passphrase_callback(struct archive *, void *); +static void passphrase_free(char *); int main(int argc, char *argv[]) @@ -149,20 +152,9 @@ main(int argc, char *argv[]) } #endif - /* Need lafe_progname before calling lafe_warnc. */ - if (*argv == NULL) - lafe_progname = "bsdcpio"; - else { -#if defined(_WIN32) && !defined(__CYGWIN__) - lafe_progname = strrchr(*argv, '\\'); - if (strrchr(*argv, '/') > lafe_progname) -#endif - lafe_progname = strrchr(*argv, '/'); - if (lafe_progname != NULL) - lafe_progname++; - else - lafe_progname = *argv; - } + /* Set lafe_progname before calling lafe_warnc. */ + lafe_setprogname(*argv, "bsdcpio"); + #if HAVE_SETLOCALE if (setlocale(LC_ALL, "") == NULL) lafe_warnc(0, "Failed to set default locale"); @@ -179,6 +171,7 @@ main(int argc, char *argv[]) cpio->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER; cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_SYMLINKS; cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NODOTDOT; + cpio->extract_flags |= ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; cpio->extract_flags |= ARCHIVE_EXTRACT_PERM; cpio->extract_flags |= ARCHIVE_EXTRACT_FFLAGS; cpio->extract_flags |= ARCHIVE_EXTRACT_ACL; @@ -264,6 +257,7 @@ main(int argc, char *argv[]) case OPTION_INSECURE: cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_SYMLINKS; cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; + cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS; break; case 'L': /* GNU cpio */ cpio->option_follow_links = 1; @@ -272,6 +266,7 @@ main(int argc, char *argv[]) cpio->option_link = 1; break; case OPTION_LRZIP: + case OPTION_LZ4: case OPTION_LZMA: /* GNU tar, others */ case OPTION_LZOP: /* GNU tar, others */ cpio->compress = opt; @@ -301,6 +296,9 @@ main(int argc, char *argv[]) cpio->mode = opt; cpio->extract_flags &= ~ARCHIVE_EXTRACT_SECURE_NODOTDOT; break; + case OPTION_PASSPHRASE: + cpio->passphrase = cpio->argument; + break; case OPTION_PRESERVE_OWNER: cpio->extract_flags |= ARCHIVE_EXTRACT_OWNER; break; @@ -429,6 +427,7 @@ main(int argc, char *argv[]) free_cache(cpio->gname_cache); free_cache(cpio->uname_cache); free(cpio->destdir); + passphrase_free(cpio->ppbuff); return (cpio->return_value); } @@ -437,7 +436,7 @@ usage(void) { const char *p; - p = lafe_progname; + p = lafe_getprogname(); fprintf(stderr, "Brief Usage:\n"); fprintf(stderr, " List: %s -it < archive\n", p); @@ -475,7 +474,7 @@ long_help(void) const char *prog; const char *p; - prog = lafe_progname; + prog = lafe_getprogname(); fflush(stderr); @@ -500,7 +499,7 @@ version(void) { fprintf(stdout,"bsdcpio %s -- %s\n", BSDCPIO_VERSION_STRING, - archive_version_string()); + archive_version_details()); exit(0); } @@ -537,6 +536,9 @@ mode_out(struct cpio *cpio) case OPTION_LRZIP: r = archive_write_add_filter_lrzip(cpio->archive); break; + case OPTION_LZ4: + r = archive_write_add_filter_lz4(cpio->archive); + break; case OPTION_LZMA: r = archive_write_add_filter_lzma(cpio->archive); break; @@ -578,6 +580,14 @@ mode_out(struct cpio *cpio) cpio->linkresolver = archive_entry_linkresolver_new(); archive_entry_linkresolver_set_strategy(cpio->linkresolver, archive_format(cpio->archive)); + if (cpio->passphrase != NULL) + r = archive_write_set_passphrase(cpio->archive, + cpio->passphrase); + else + r = archive_write_set_passphrase_callback(cpio->archive, cpio, + &passphrase_callback); + if (r != ARCHIVE_OK) + lafe_errc(1, 0, "%s", archive_error_string(cpio->archive)); /* * The main loop: Copy each file into the output archive. @@ -944,6 +954,13 @@ mode_in(struct cpio *cpio) lafe_errc(1, 0, "Couldn't allocate archive object"); archive_read_support_filter_all(a); archive_read_support_format_all(a); + if (cpio->passphrase != NULL) + r = archive_read_add_passphrase(a, cpio->passphrase); + else + r = archive_read_set_passphrase_callback(a, cpio, + &passphrase_callback); + if (r != ARCHIVE_OK) + lafe_errc(1, 0, "%s", archive_error_string(a)); if (archive_read_open_filename(a, cpio->filename, cpio->bytes_per_block)) @@ -1047,6 +1064,13 @@ mode_list(struct cpio *cpio) lafe_errc(1, 0, "Couldn't allocate archive object"); archive_read_support_filter_all(a); archive_read_support_format_all(a); + if (cpio->passphrase != NULL) + r = archive_read_add_passphrase(a, cpio->passphrase); + else + r = archive_read_set_passphrase_callback(a, cpio, + &passphrase_callback); + if (r != ARCHIVE_OK) + lafe_errc(1, 0, "%s", archive_error_string(a)); if (archive_read_open_filename(a, cpio->filename, cpio->bytes_per_block)) @@ -1140,7 +1164,8 @@ list_item_verbose(struct cpio *cpio, struct archive_entry *entry) else fmt = cpio->day_first ? "%d %b %H:%M" : "%b %d %H:%M"; #else - if (abs(mtime - now) > (365/2)*86400) + if (mtime - now > 365*86400/2 + || mtime - now < -365*86400/2) fmt = cpio->day_first ? "%e %b %Y" : "%b %e %Y"; else fmt = cpio->day_first ? "%e %b %H:%M" : "%b %e %H:%M"; @@ -1235,8 +1260,10 @@ cpio_rename(const char *name) if (t == NULL) return (name); to = fopen("CONOUT$", "w"); - if (to == NULL) + if (to == NULL) { + fclose(t); return (name); + } fprintf(to, "%s (Enter/./(new name))? ", name); fclose(to); #else @@ -1416,3 +1443,28 @@ cpio_i64toa(int64_t n0) *--p = '-'; return p; } + +#define PPBUFF_SIZE 1024 +static const char * +passphrase_callback(struct archive *a, void *_client_data) +{ + struct cpio *cpio = (struct cpio *)_client_data; + (void)a; /* UNUSED */ + + if (cpio->ppbuff == NULL) { + cpio->ppbuff = malloc(PPBUFF_SIZE); + if (cpio->ppbuff == NULL) + lafe_errc(1, errno, "Out of memory"); + } + return lafe_readpassphrase("Enter passphrase:", + cpio->ppbuff, PPBUFF_SIZE); +} + +static void +passphrase_free(char *ppbuff) +{ + if (ppbuff != NULL) { + memset(ppbuff, 0, PPBUFF_SIZE); + free(ppbuff); + } +} diff --git a/cpio/cpio.h b/cpio/cpio.h index 3e951ce7403e..1036dece93b0 100644 --- a/cpio/cpio.h +++ b/cpio/cpio.h @@ -71,6 +71,7 @@ struct cpio { int gid_override; char *gname_override; int day_first; /* true if locale prefers day/mon */ + const char *passphrase; /* If >= 0, then close this when done. */ int fd; @@ -90,6 +91,7 @@ struct cpio { struct archive *matching; char *buff; size_t buff_size; + char *ppbuff; }; const char *owner_parse(const char *, int *, int *); @@ -101,8 +103,10 @@ enum { OPTION_GRZIP, OPTION_INSECURE, OPTION_LRZIP, + OPTION_LZ4, OPTION_LZMA, OPTION_LZOP, + OPTION_PASSPHRASE, OPTION_NO_PRESERVE_OWNER, OPTION_PRESERVE_OWNER, OPTION_QUIET, diff --git a/cpio/cpio_platform.h b/cpio/cpio_platform.h index 31d9a738fcb0..58d2edbcd7a4 100644 --- a/cpio/cpio_platform.h +++ b/cpio/cpio_platform.h @@ -42,6 +42,10 @@ #include "config.h" #endif +#if defined(_WIN32) && !defined(__CYGWIN__) +#include "cpio_windows.h" +#endif + /* Get a real definition for __FBSDID if we can */ #if HAVE_SYS_CDEFS_H #include @@ -70,8 +74,4 @@ #define __LA_DEAD #endif -#if defined(_WIN32) && !defined(__CYGWIN__) -#include "cpio_windows.h" -#endif - #endif /* !CPIO_PLATFORM_H_INCLUDED */ diff --git a/cpio/cpio_windows.h b/cpio/cpio_windows.h index 105bf69991de..970a63df663d 100644 --- a/cpio/cpio_windows.h +++ b/cpio/cpio_windows.h @@ -26,6 +26,7 @@ */ #ifndef CPIO_WINDOWS_H #define CPIO_WINDOWS_H 1 +#include #include #include @@ -35,8 +36,10 @@ #define getpwnam(name) NULL #define getpwuid(id) NULL -#ifdef _MSC_VER -#define snprintf sprintf_s +#if defined(_MSC_VER) + #if _MSC_VER < 1900 + #define snprintf sprintf_s + #endif // _MSC_VER < 1900 #define strdup _strdup #define open _open #define read _read diff --git a/cpio/test/CMakeLists.txt b/cpio/test/CMakeLists.txt index 09ca2c7d96b3..f2c27540813d 100644 --- a/cpio/test/CMakeLists.txt +++ b/cpio/test/CMakeLists.txt @@ -19,6 +19,7 @@ IF(ENABLE_CPIO AND ENABLE_TEST) test_extract_cpio_gz test_extract_cpio_lrz test_extract_cpio_lz + test_extract_cpio_lz4 test_extract_cpio_lzma test_extract_cpio_lzo test_extract_cpio_xz @@ -39,9 +40,11 @@ IF(ENABLE_CPIO AND ENABLE_TEST) test_option_help.c test_option_l.c test_option_lrzip.c + test_option_lz4.c test_option_lzma.c test_option_lzop.c test_option_m.c + test_option_passphrase.c test_option_t.c test_option_u.c test_option_uuencode.c @@ -82,11 +85,12 @@ IF(ENABLE_CPIO AND ENABLE_TEST) INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) - INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/test_utils) + INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/test_utils) # Experimental new test handling ADD_CUSTOM_TARGET(run_bsdcpio_test - COMMAND bsdcpio_test -p ${BSDCPIO} -r ${CMAKE_CURRENT_SOURCE_DIR}) + COMMAND bsdcpio_test -p $ + -r ${CMAKE_CURRENT_SOURCE_DIR}) ADD_DEPENDENCIES(run_bsdcpio_test bsdcpio) ADD_DEPENDENCIES(run_all_tests run_bsdcpio_test) ENDIF(ENABLE_CPIO AND ENABLE_TEST) diff --git a/cpio/test/main.c b/cpio/test/main.c index d4c6e5c3388c..fa22adfbc81a 100644 --- a/cpio/test/main.c +++ b/cpio/test/main.c @@ -130,6 +130,16 @@ __FBSDID("$FreeBSD: src/usr.bin/cpio/test/main.c,v 1.3 2008/08/24 04:58:22 kient # include #endif +/* Path to working directory for current test */ +const char *testworkdir; +#ifdef PROGRAM +/* Pathname of exe to be tested. */ +const char *testprogfile; +/* Name of exe to use in printf-formatted command strings. */ +/* On Windows, this includes leading/trailing quotes. */ +const char *testprog; +#endif + #if defined(_WIN32) && !defined(__CYGWIN__) static void *GetFunctionKernel32(const char *); static int my_CreateSymbolicLinkA(const char *, const char *, int); @@ -194,7 +204,7 @@ my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi) } #endif -#if defined(HAVE__CrtSetReportMode) +#if defined(HAVE__CrtSetReportMode) && !defined(__WATCOMC__) static void invalid_parameter_handler(const wchar_t * expression, const wchar_t * function, const wchar_t * file, @@ -565,10 +575,10 @@ static void strdump(const char *e, const char *p, int ewidth, int utf8) while (*p != '\0') { unsigned int c = 0xff & *p++; switch (c) { - case '\a': printf("\a"); break; - case '\b': printf("\b"); break; - case '\n': printf("\n"); break; - case '\r': printf("\r"); break; + case '\a': logprintf("\\a"); break; + case '\b': logprintf("\\b"); break; + case '\n': logprintf("\\n"); break; + case '\r': logprintf("\\r"); break; default: if (c >= 32 && c < 127) logprintf("%c", c); @@ -771,6 +781,34 @@ assertion_equal_mem(const char *file, int line, return (0); } +/* Verify that a block of memory is filled with the specified byte. */ +int +assertion_memory_filled_with(const char *file, int line, + const void *_v1, const char *vd, + size_t l, const char *ld, + char b, const char *bd, void *extra) +{ + const char *v1 = (const char *)_v1; + size_t c = 0; + size_t i; + (void)ld; /* UNUSED */ + + assertion_count(file, line); + + for (i = 0; i < l; ++i) { + if (v1[i] == b) { + ++c; + } + } + if (c == l) + return (1); + + failure_start(file, line, "%s (size %d) not filled with %s", vd, (int)l, bd); + logprintf(" Only %d bytes were correct\n", (int)c); + failure_finish(extra); + return (0); +} + /* Verify that the named file exists and is empty. */ int assertion_empty_file(const char *filename, int line, const char *f1) @@ -1036,6 +1074,7 @@ assertion_file_contains_lines_any_order(const char *file, int line, if (expected == NULL) { failure_start(pathname, line, "Can't allocate memory"); failure_finish(NULL); + free(expected); return (0); } for (i = 0; lines[i] != NULL; ++i) { @@ -1060,7 +1099,8 @@ assertion_file_contains_lines_any_order(const char *file, int line, free(expected); return (0); } - for (j = 0, p = buff; p < buff + buff_size; p += 1 + strlen(p)) { + for (j = 0, p = buff; p < buff + buff_size; + p += 1 + strlen(p)) { if (*p != '\0') { actual[j] = p; ++j; @@ -1911,6 +1951,18 @@ canGzip(void) /* * Can this platform run the lrzip program? */ +int +canRunCommand(const char *cmd) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("%s %s", cmd, redirectArgs) == 0) + value = 1; + } + return (value); +} + int canLrzip(void) { @@ -1923,6 +1975,21 @@ canLrzip(void) return (value); } +/* + * Can this platform run the lz4 program? + */ +int +canLz4(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("lz4 -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + /* * Can this platform run the lzip program? */ @@ -2135,8 +2202,31 @@ slurpfile(size_t * sizep, const char *fmt, ...) return (p); } +/* + * Slurp a file into memory for ease of comparison and testing. + * Returns size of file in 'sizep' if non-NULL, null-terminates + * data in memory for ease of use. + */ +void +dumpfile(const char *filename, void *data, size_t len) +{ + ssize_t bytes_written; + FILE *f; + + f = fopen(filename, "wb"); + if (f == NULL) { + logprintf("Can't open file %s for writing\n", filename); + return; + } + bytes_written = fwrite(data, 1, len, f); + if (bytes_written < (ssize_t)len) + logprintf("Can't write file %s\n", filename); + fclose(f); +} + /* Read a uuencoded file from the reference directory, decode, and * write the result into the current directory. */ +#define VALID_UUDECODE(c) (c >= 32 && c <= 96) #define UUDECODE(c) (((c) - 0x20) & 0x3f) void extract_reference_file(const char *name) @@ -2160,7 +2250,6 @@ extract_reference_file(const char *name) break; } /* Now, decode the rest and write it. */ - /* Not a lot of error checking here; the input better be right. */ out = fopen(name, "wb"); while (fgets(buff, sizeof(buff), in) != NULL) { char *p = buff; @@ -2174,17 +2263,21 @@ extract_reference_file(const char *name) int n = 0; /* Write out 1-3 bytes from that. */ if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); + assert(VALID_UUDECODE(p[1])); n = UUDECODE(*p++) << 18; n |= UUDECODE(*p++) << 12; fputc(n >> 16, out); --bytes; } if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); n |= UUDECODE(*p++) << 6; fputc((n >> 8) & 0xFF, out); --bytes; } if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); n |= UUDECODE(*p++); fputc(n & 0xFF, out); --bytes; @@ -2195,6 +2288,32 @@ extract_reference_file(const char *name) fclose(in); } +void +copy_reference_file(const char *name) +{ + char buff[1024]; + FILE *in, *out; + size_t rbytes; + + sprintf(buff, "%s/%s", refdir, name); + in = fopen(buff, "rb"); + failure("Couldn't open reference file %s", buff); + assert(in != NULL); + if (in == NULL) + return; + /* Now, decode the rest and write it. */ + /* Not a lot of error checking here; the input better be right. */ + out = fopen(name, "wb"); + while ((rbytes = fread(buff, 1, sizeof(buff), in)) > 0) { + if (fwrite(buff, 1, rbytes, out) != rbytes) { + logprintf("Error: fwrite\n"); + break; + } + } + fclose(out); + fclose(in); +} + int is_LargeInode(const char *file) { @@ -2216,6 +2335,14 @@ is_LargeInode(const char *file) return (ino > 0xffffffff); #endif } + +void +extract_reference_files(const char **names) +{ + while (names && *names) + extract_reference_file(*names++); +} + /* * * TEST management @@ -2245,7 +2372,7 @@ struct test_list_t tests[] = { * Summarize repeated failures in the just-completed test. */ static void -test_summarize(int failed) +test_summarize(int failed, int skips_num) { unsigned int i; @@ -2255,7 +2382,7 @@ test_summarize(int failed) fflush(stdout); break; case VERBOSITY_PASSFAIL: - printf(failed ? "FAIL\n" : "ok\n"); + printf(failed ? "FAIL\n" : skips_num ? "ok (S)\n" : "ok\n"); break; } @@ -2280,13 +2407,14 @@ test_run(int i, const char *tmpdir) char workdir[1024]; char logfilename[64]; int failures_before = failures; + int skips_before = skips; int oldumask; switch (verbosity) { case VERBOSITY_SUMMARY_ONLY: /* No per-test reports at all */ break; case VERBOSITY_PASSFAIL: /* rest of line will include ok/FAIL marker */ - printf("%3d: %-50s", i, tests[i].name); + printf("%3d: %-64s", i, tests[i].name); fflush(stdout); break; default: /* Title of test, details will follow */ @@ -2336,7 +2464,7 @@ test_run(int i, const char *tmpdir) } /* Report per-test summaries. */ tests[i].failures = failures - failures_before; - test_summarize(tests[i].failures); + test_summarize(tests[i].failures, skips - skips_before); /* Close the per-test log file. */ fclose(logfile); logfile = NULL; @@ -2479,6 +2607,7 @@ get_refdir(const char *d) failure: printf("Unable to locate known reference file %s\n", KNOWNREF); printf(" Checked following directories:\n%s\n", tried); + printf("Use -r option to specify full path to reference directory\n"); #if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG) DebugBreak(); #endif @@ -2515,7 +2644,7 @@ main(int argc, char **argv) while (pwd[strlen(pwd) - 1] == '\n') pwd[strlen(pwd) - 1] = '\0'; -#if defined(HAVE__CrtSetReportMode) +#if defined(HAVE__CrtSetReportMode) && !defined(__WATCOMC__) /* To stop to run the default invalid parameter handler. */ _set_invalid_parameter_handler(invalid_parameter_handler); /* Disable annoying assertion message box. */ @@ -2562,7 +2691,7 @@ main(int argc, char **argv) exit(1); } memmove(testprogdir + strlen(pwd) + 1, testprogdir, - strlen(testprogdir)); + strlen(testprogdir) + 1); memcpy(testprogdir, pwd, strlen(pwd)); testprogdir[strlen(pwd)] = '/'; } diff --git a/cpio/test/test.h b/cpio/test/test.h index 666bba0e8b30..606b121bba6e 100644 --- a/cpio/test/test.h +++ b/cpio/test/test.h @@ -66,6 +66,7 @@ #include #include #include +#include #include #ifdef HAVE_UNISTD_H #include @@ -84,12 +85,14 @@ /* Windows (including Visual Studio and MinGW but not Cygwin) */ #if defined(_WIN32) && !defined(__CYGWIN__) #if !defined(__BORLANDC__) +#undef chdir +#define chdir _chdir #define strdup _strdup #endif #endif /* Visual Studio */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf sprintf_s #endif @@ -142,6 +145,9 @@ /* As above, but raw blocks of bytes. */ #define assertEqualMem(v1, v2, l) \ assertion_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL) +/* Assert that memory is full of a specified byte */ +#define assertMemoryFilledWith(v1, l, b) \ + assertion_memory_filled_with(__FILE__, __LINE__, (v1), #v1, (l), #l, (b), #b, NULL) /* Assert two files are the same. */ #define assertEqualFile(f1, f2) \ assertion_equal_file(__FILE__, __LINE__, (f1), (f2)) @@ -225,6 +231,7 @@ int assertion_empty_file(const char *, int, const char *); int assertion_equal_file(const char *, int, const char *, const char *); int assertion_equal_int(const char *, int, long long, const char *, long long, const char *, void *); int assertion_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *); +int assertion_memory_filled_with(const char *, int, const void *, const char *, size_t, const char *, char, const char *, void *); int assertion_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *, int); int assertion_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *); int assertion_file_atime(const char *, int, const char *, long, long); @@ -275,9 +282,15 @@ int canGrzip(void); /* Return true if this platform can run the "gzip" program. */ int canGzip(void); +/* Return true if this platform can run the specified command. */ +int canRunCommand(const char *); + /* Return true if this platform can run the "lrzip" program. */ int canLrzip(void); +/* Return true if this platform can run the "lz4" program. */ +int canLz4(void); + /* Return true if this platform can run the "lzip" program. */ int canLzip(void); @@ -300,21 +313,31 @@ int is_LargeInode(const char *); /* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */ char *slurpfile(size_t *, const char *fmt, ...); +/* Dump block of bytes to a file. */ +void dumpfile(const char *filename, void *, size_t); + /* Extracts named reference file to the current directory. */ void extract_reference_file(const char *); +/* Copies named reference file to the current directory. */ +void copy_reference_file(const char *); + +/* Extracts a list of files to the current directory. + * List must be NULL terminated. + */ +void extract_reference_files(const char **); /* Path to working directory for current test */ -const char *testworkdir; +extern const char *testworkdir; /* * Special interfaces for program test harness. */ /* Pathname of exe to be tested. */ -const char *testprogfile; +extern const char *testprogfile; /* Name of exe to use in printf-formatted command strings. */ /* On Windows, this includes leading/trailing quotes. */ -const char *testprog; +extern const char *testprog; #ifdef USE_DMALLOC #include diff --git a/cpio/test/test_basic.c b/cpio/test/test_basic.c index 7213062e8d20..f3a048002a55 100644 --- a/cpio/test/test_basic.c +++ b/cpio/test/test_basic.c @@ -72,7 +72,7 @@ basic_cpio(const char *target, return; /* Use the cpio program to create an archive. */ - r = systemf("%s -o %s < filelist >%s/archive 2>%s/pack.err", + r = systemf("%s -R 1000:1000 -o %s < filelist >%s/archive 2>%s/pack.err", testprog, pack_options, target, target); failure("Error invoking %s -o %s", testprog, pack_options); assertEqualInt(r, 0); diff --git a/cpio/test/test_extract.cpio.lz4.uu b/cpio/test/test_extract.cpio.lz4.uu new file mode 100644 index 000000000000..0adc7bbcc484 --- /dev/null +++ b/cpio/test/test_extract.cpio.lz4.uu @@ -0,0 +1,7 @@ +begin 644 test_extract.cpio.lz4 +M!")-&&1PN9$````A,#<"`&`P-#`P,3`!`&`Q,3`P-C8/`#0W-3`&```)``$& +M`,$P,3(P,S(W-#`R,S01`!$V!@```@#Q!3(S9FEL93$`8V]N=&5N=',@;V8@ +M$@`A+@IC``AE`!\R90`4$#2#``YE`!TR90`6,F4`#P(`#@+H``P"`"test.out 2>test.err", testprog, reffile); + if (f == 0 || canLz4()) { + assertEqualInt(0, systemf("%s -i < %s >test.out 2>test.err", + testprog, reffile)); + + assertFileExists("file1"); + assertTextFileContents("contents of file1.\n", "file1"); + assertFileExists("file2"); + assertTextFileContents("contents of file2.\n", "file2"); + assertEmptyFile("test.out"); + assertTextFileContents("1 block\n", "test.err"); + } else { + skipping("It seems lz4 is not supported on this platform"); + } +} diff --git a/cpio/test/test_extract_cpio_lzo.c b/cpio/test/test_extract_cpio_lzo.c index f351ba7a79aa..99476af95318 100644 --- a/cpio/test/test_extract_cpio_lzo.c +++ b/cpio/test/test_extract_cpio_lzo.c @@ -27,7 +27,7 @@ __FBSDID("$FreeBSD$"); DEFINE_TEST(test_extract_cpio_lzo) { - const char *reffile = "test_extract.cpio.lrz"; + const char *reffile = "test_extract.cpio.lzo"; int f; extract_reference_file(reffile); diff --git a/cpio/test/test_option_c.c b/cpio/test/test_option_c.c index a634be10ba7c..fa47b7e277d8 100644 --- a/cpio/test/test_option_c.c +++ b/cpio/test/test_option_c.c @@ -65,18 +65,14 @@ DEFINE_TEST(test_option_c) { FILE *filelist; int r; - int uid = -1; - int dev, ino, gid; + int uid = 1000; + int dev, ino, gid = 1000; time_t t, now; char *p, *e; size_t s; assertUmask(0); -#if !defined(_WIN32) - uid = getuid(); -#endif - /* * Create an assortment of files. * TODO: Extend this to cover more filetypes. @@ -101,7 +97,7 @@ DEFINE_TEST(test_option_c) /* Use the cpio program to create an archive. */ fclose(filelist); - r = systemf("%s -oc basic.out 2>basic.err", testprog); + r = systemf("%s -R 1000:1000 -oc basic.out 2>basic.err", testprog); /* Verify that nothing went to stderr. */ assertTextFileContents("1 block\n", "basic.err"); diff --git a/cpio/test/test_option_lz4.c b/cpio/test/test_option_lz4.c new file mode 100644 index 000000000000..d430ac755f4f --- /dev/null +++ b/cpio/test/test_option_lz4.c @@ -0,0 +1,74 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_option_lz4) +{ + char *p; + int r; + size_t s; + + /* Create a file. */ + assertMakeFile("f", 0644, "a"); + + /* Archive it with lz4 compression. */ + r = systemf("echo f | %s -o --lz4 >archive.out 2>archive.err", + testprog); + p = slurpfile(&s, "archive.err"); + p[s] = '\0'; + if (r != 0) { + if (strstr(p, "compression not available") != NULL) { + skipping("This version of bsdcpio was compiled " + "without lz4 support"); + return; + } + /* POSIX permits different handling of the spawnp + * system call used to launch the subsidiary + * program: */ + /* Some systems fail immediately to spawn the new process. */ + if (strstr(p, "Can't launch") != NULL && !canLz4()) { + skipping("This version of bsdcpio uses an external lz4 program " + "but no such program is available on this system."); + return; + } + /* Some systems successfully spawn the new process, + * but fail to exec a program within that process. + * This results in failure at the first attempt to + * write. */ + if (strstr(p, "Can't write") != NULL && !canLz4()) { + skipping("This version of bsdcpio uses an external lz4 program " + "but no such program is available on this system."); + return; + } + failure("--lz4 option is broken: %s", p); + assertEqualInt(r, 0); + return; + } + /* Check that the archive file has an lz4 signature. */ + p = slurpfile(&s, "archive.out"); + assert(s > 2); + assertEqualMem(p, "\x04\x22\x4d\x18", 4); +} diff --git a/cpio/test/test_option_passphrase.c b/cpio/test/test_option_passphrase.c new file mode 100644 index 000000000000..ae77a23fcb74 --- /dev/null +++ b/cpio/test/test_option_passphrase.c @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_option_passphrase) +{ + const char *reffile = "test_option_passphrase.zip"; + + extract_reference_file(reffile); + assertEqualInt(0, + systemf("%s -i --passphrase pass1 < %s >test.out 2>test.err", + testprog, reffile)); + + assertFileExists("file1"); + assertTextFileContents("contents of file1.\n", "file1"); + assertFileExists("file2"); + assertTextFileContents("contents of file2.\n", "file2"); + assertEmptyFile("test.out"); + assertTextFileContents("1 block\n", "test.err"); +} diff --git a/cpio/test/test_option_passphrase.zip.uu b/cpio/test/test_option_passphrase.zip.uu new file mode 100644 index 000000000000..021ae8585fe8 --- /dev/null +++ b/cpio/test/test_option_passphrase.zip.uu @@ -0,0 +1,12 @@ +begin 644 test_option_passphrase.zip +M4$L#!`H`"0```#B91$7D$C4,'P```!,````%`!P`9FEL93%55`D``VS'+U0" +MQR]4=7@+``$$]0$```04````BHPD*"^*I04=XKI\_FQ*TE+#),TD7TTKSP/7 +MR6R35%!+!PCD$C4,'P```!,```!02P,$"@`)````09E$1;VL<`L``03U`0``!!0```!D#6Z\@CI8 +MV1GIJO5TISQF^I:7.;Y3<-G3$YOCL(C_4$L'"+VL +M`PH`"0```#B91$7D$C4,'P```!,````%`!@```````$```"D@0````!F:6QE +M,554!0`#;,`PH`"0```$&91$6]K',. +M'P```!,````%`!@```````$```"D@6X```!F:6QE,E54!0`#>< 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) { + ++q; + --s; + } /* All terminated by end-of-line: \r, \r\n, or \n */ assert(s >= 1); failure("Version: %s", p); diff --git a/doc/mdoc2wiki.awk b/doc/mdoc2wiki.awk index 5fee29c32952..eb89ba09028b 100755 --- a/doc/mdoc2wiki.awk +++ b/doc/mdoc2wiki.awk @@ -93,14 +93,44 @@ function breakline() { linecmd("
    ") } +function crossref(name, sect, other) { + if (name == "cpio" && sect == 1) { + n = "ManPageBsdcpio1" + } else if (name == "cpio" && sect == 5) { + n = "ManPageCpio5" + } else if (name == "mtree" && sect == 5) { + n = "ManPageMtree5" + } else if (name == "tar" && sect == 1) { + n = "ManPageBsdtar1" + } else if (name == "tar" && sect == 5) { + n = "ManPageTar5" + } else if (!match(name, "^archive") && !match(name, "^libarchive")) { + n = name "(" sect ")|http://www.freebsd.org/cgi/man.cgi?query=" name "&sektion=" sect + } else { + n = "ManPage" + numbits = split(name, namebits, "[_-]") + for (i = 1; i <= numbits; ++i) { + p = namebits[i] + n = n toupper(substr(p, 0, 1)) substr(p, 2) + } + n = n sect + } + n = "[[" n "]]" + if (length other > 0) + n = n other + return n +} + # Start an indented display function dispstart() { - linecmd("```text") + endline() + print "```text" } # End an indented display function dispend() { - linecmd("```") + endline() + print "```" } # Collect rest of input line @@ -123,22 +153,22 @@ function splitwords(l, dest, n, o, w) { l = substr(l, 2) o = index(l, "\"") if (o > 0) { - w = substr(l, 1, o-1) - l = substr(l, o+1) - dest[n++] = w + w = substr(l, 1, o-1) + l = substr(l, o+1) + dest[n++] = w } else { - dest[n++] = l - l = "" + dest[n++] = l + l = "" } } else { o = match(l, "[ \t]") if (o > 0) { - w = substr(l, 1, o-1) - l = substr(l, o+1) - dest[n++] = w + w = substr(l, 1, o-1) + l = substr(l, o+1) + dest[n++] = w } else { - dest[n++] = l - l = "" + dest[n++] = l + l = "" } } } @@ -154,6 +184,7 @@ function splitwords(l, dest, n, o, w) { /^\.\\"/ { next } { + gsub("\\\\e", "\\") sub("^\\.","") nwords=splitwords($0, words) # TODO: Instead of iterating 'w' over the array, have a separate @@ -170,8 +201,8 @@ function splitwords(l, dest, n, o, w) { STATE = PRETAG_STATE if(match(words[w+1],"-literal")) { dispstart() - displaylines=10000 - w=nwords + displaylines=10000 + w=nwords } } else if(match(words[w],"^Ed$")) { # End display displaylines = 0 @@ -185,7 +216,7 @@ function splitwords(l, dest, n, o, w) { addopen("\"") add(words[++w]) while(w= nwords) - n=name + n=name else if (match(words[w+1], "^[A-Z][a-z]$")) - n=name + n=name else if (match(words[w+1], "^[.,;:]$")) - n=name + n=name else { n=words[++w] if(!length(name)) @@ -259,27 +291,30 @@ function splitwords(l, dest, n, o, w) { if(!length(n)) n=name if (displaylines == 0) - add("'''" n "'''") + add("'''" n "'''") else - add(n) + add(n) } else if(match(words[w],"^Nd$")) { add("- " wtail()) } else if(match(words[w],"^Fl$")) { addopen("-") } else if(match(words[w],"^Ar$")) { if(w==nwords) - add("''file ...''") + add("''file ...''") else { - ++w - gsub("<", "<", words[w]) - add("''" words[w] "''") + ++w + gsub("<", "\\<", words[w]) + if (displaylines > 0) + add(words[w]) + else + add("''" words[w] "''") } } else if(match(words[w],"^Cm$")) { ++w if (displaylines == 0) { - add("'''" words[w] "'''") + add("'''" words[w] "'''") } else - add(words[w]) + add(words[w]) } else if(match(words[w],"^Op$")) { addopen("[") option=1 @@ -290,36 +325,36 @@ function splitwords(l, dest, n, o, w) { print "" } else if(match(words[w],"^An$")) { if (match(words[w+1],"-nosplit")) - ++w + ++w endline() } else if(match(words[w],"^Ss$")) { add("===") trailer="===" } else if(match(words[w],"^Ft$")) { if (match(section, "SYNOPSIS")) { - breakline() + breakline() } l = wtail() - add("'''" l "'''") + add("''" l "''") if (match(section, "SYNOPSIS")) { - breakline() + breakline() } } else if(match(words[w],"^Fn$")) { ++w F = "'''" words[w] "'''(" Fsep = "" while(w") - listclose[listdepth]="" + optlist[listdepth]=1 + addopen("
      ") + listclose[listdepth]="
    " } else if(match(words[w+1],"-enum")) { - optlist[listdepth]=2 - enum=0 - addopen("
      ") - listclose[listdepth]="
    " + optlist[listdepth]=2 + enum=0 + addopen("
      ") + listclose[listdepth]="
    " } else if(match(words[w+1],"-tag")) { - optlist[listdepth]=3 - addopen("
    ") - listclose[listdepth]="
    " + optlist[listdepth]=3 + addopen("
    ") + listclose[listdepth]="
    " } else if(match(words[w+1],"-item")) { - optlist[listdepth]=4 - addopen("
      ") - listclose[listdepth]="
    " + optlist[listdepth]=4 + addopen("
      ") + listclose[listdepth]="
    " } w=nwords } else if(match(words[w],"^El$")) { @@ -399,28 +434,30 @@ function splitwords(l, dest, n, o, w) { } else if(match(words[w],"^It$")) { addclose(listnext[listdepth]) if(optlist[listdepth]==1) { - addpunct("
  • ") - listnext[listdepth] = "
  • " + addpunct("
  • ") + listnext[listdepth] = "
  • " } else if(optlist[listdepth]==2) { - addpunct("
  • ") - listnext[listdepth] = "
  • " + addpunct("
  • ") + listnext[listdepth] = "
  • " } else if(optlist[listdepth]==3) { - addpunct("
    ") - listnext[listdepth] = "
    " - if(match(words[w+1],"^Xo$")) { - # Suppress trailer - w++ - } else if(match(words[w+1],"^Pa$|^Ev$")) { - addopen("'''") - w++ - add(words[++w] "'''") - } else { - trailer = listnext[listdepth] "
    " trailer - listnext[listdepth] = "
    " - } + addpunct("
    ") + listnext[listdepth] = "
    " + if(match(words[w+1],"^Xo$")) { + # Suppress trailer + w++ + } else if(match(words[w+1],"^Pa$|^Ev$")) { + addopen("'''") + w++ + add(words[++w] "'''") + trailer = listnext[listdepth] "
    " trailer + listnext[listdepth] = "
    " + } else { + trailer = listnext[listdepth] "
    " trailer + listnext[listdepth] = "
    " + } } else if(optlist[listdepth]==4) { - addpunct("
  • ") - listnext[listdepth] = "
  • " + addpunct("
  • ") + listnext[listdepth] = "
  • " } } else if(match(words[w], "^Vt$")) { w++ @@ -430,9 +467,9 @@ function splitwords(l, dest, n, o, w) { } else if(match(words[w],"^Xc$")) { # TODO: Figure out how to handle this if (optlist[listdepth] == 3) { - addclose(listnext[listdepth]) - addopen("
    ") - listnext[listdepth] = "
    " + addclose(listnext[listdepth]) + addopen("
    ") + listnext[listdepth] = "
    " } } else if(match(words[w],"^[=]$")) { addpunct(words[w]) diff --git a/examples/minitar/Makefile b/examples/minitar/Makefile index 1ec4593df66b..e2cc0899fbba 100644 --- a/examples/minitar/Makefile +++ b/examples/minitar/Makefile @@ -8,13 +8,19 @@ CFLAGS= \ -I../../libarchive \ -g +# +# You may need to add additional libraries or link options here +# For example, many Linux systems require -lacl +# +LIBS= -lz -lbz2 + # How to link against libarchive. LIBARCHIVE= ../../libarchive/libarchive.a all: minitar minitar: minitar.o - cc -g -o minitar minitar.o $(LIBARCHIVE) -lz -lbz2 + cc -g -o minitar minitar.o $(LIBARCHIVE) $(LIBS) strip minitar ls -l minitar diff --git a/examples/minitar/minitar.c b/examples/minitar/minitar.c index 0ff6263ebf84..81e5e11c7985 100644 --- a/examples/minitar/minitar.c +++ b/examples/minitar/minitar.c @@ -249,7 +249,7 @@ create(const char *filename, int compress, const char **argv) break; } archive_write_set_format_ustar(a); - if (strcmp(filename, "-") == 0) + if (filename != NULL && strcmp(filename, "-") == 0) filename = NULL; archive_write_open_filename(a, filename); @@ -367,6 +367,7 @@ extract(const char *filename, int do_extract, int flags) exit(r); } for (;;) { + int needcr = 0; r = archive_read_next_header(a, &entry); if (r == ARCHIVE_EOF) break; @@ -377,16 +378,24 @@ extract(const char *filename, int do_extract, int flags) } if (verbose && do_extract) msg("x "); - if (verbose || !do_extract) + if (verbose || !do_extract) { msg(archive_entry_pathname(entry)); + msg(" "); + needcr = 1; + } if (do_extract) { r = archive_write_header(ext, entry); - if (r != ARCHIVE_OK) + if (r != ARCHIVE_OK) { errmsg(archive_error_string(a)); - else - copy_data(a, ext); + needcr = 1; + } + else { + r = copy_data(a, ext); + if (r != ARCHIVE_OK) + needcr = 1; + } } - if (verbose || !do_extract) + if (needcr) msg("\n"); } archive_read_close(a); @@ -400,16 +409,16 @@ copy_data(struct archive *ar, struct archive *aw) int r; const void *buff; size_t size; - off_t offset; + int64_t offset; for (;;) { r = archive_read_data_block(ar, &buff, &size, &offset); - if (r == ARCHIVE_EOF) { - errmsg(archive_error_string(ar)); + if (r == ARCHIVE_EOF) return (ARCHIVE_OK); - } - if (r != ARCHIVE_OK) + if (r != ARCHIVE_OK) { + errmsg(archive_error_string(ar)); return (r); + } r = archive_write_data_block(aw, buff, size, offset); if (r != ARCHIVE_OK) { errmsg(archive_error_string(ar)); @@ -427,6 +436,9 @@ msg(const char *m) static void errmsg(const char *m) { + if (m == NULL) { + m = "Error: No error description provided.\n"; + } write(2, m, strlen(m)); } diff --git a/examples/untar.c b/examples/untar.c index b22d8361a012..dab75d2ede53 100644 --- a/examples/untar.c +++ b/examples/untar.c @@ -53,7 +53,6 @@ */ #include -__FBSDID("$FreeBSD$"); #include @@ -191,6 +190,9 @@ extract(const char *filename, int do_extract, int flags) } archive_read_close(a); archive_read_free(a); + + archive_write_close(ext); + archive_write_free(ext); exit(0); } @@ -200,7 +202,7 @@ copy_data(struct archive *ar, struct archive *aw) int r; const void *buff; size_t size; -#if ARCHIVE_VERSION >= 3000000 +#if ARCHIVE_VERSION_NUMBER >= 3000000 int64_t offset; #else off_t offset; diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt index ecb0409bd9d8..4cc9a2ca2c17 100644 --- a/libarchive/CMakeLists.txt +++ b/libarchive/CMakeLists.txt @@ -18,8 +18,10 @@ SET(libarchive_SOURCES archive_cmdline.c archive_cmdline_private.h archive_crc32.h - archive_crypto.c - archive_crypto_private.h + archive_cryptor.c + archive_cryptor_private.h + archive_digest.c + archive_digest_private.h archive_endian.h archive_entry.c archive_entry.h @@ -32,9 +34,14 @@ SET(libarchive_SOURCES archive_entry_strmode.c archive_entry_xattr.c archive_getdate.c + archive_getdate.h + archive_hmac.c + archive_hmac_private.h archive_match.c archive_options.c archive_options_private.h + archive_pack_dev.h + archive_pack_dev.c archive_pathmatch.c archive_pathmatch.h archive_platform.h @@ -42,9 +49,12 @@ SET(libarchive_SOURCES archive_ppmd7.c archive_ppmd7_private.h archive_private.h + archive_random.c + archive_random_private.h archive_rb.c archive_rb.h archive_read.c + archive_read_add_passphrase.c archive_read_append_filter.c archive_read_data_into_fd.c archive_read_disk_entry_from_file.c @@ -52,6 +62,7 @@ SET(libarchive_SOURCES archive_read_disk_private.h archive_read_disk_set_standard_lookup.c archive_read_extract.c + archive_read_extract2.c archive_read_open_fd.c archive_read_open_file.c archive_read_open_filename.c @@ -65,6 +76,7 @@ SET(libarchive_SOURCES archive_read_support_filter_gzip.c archive_read_support_filter_grzip.c archive_read_support_filter_lrzip.c + archive_read_support_filter_lz4.c archive_read_support_filter_lzop.c archive_read_support_filter_none.c archive_read_support_filter_program.c @@ -84,6 +96,7 @@ SET(libarchive_SOURCES archive_read_support_format_rar.c archive_read_support_format_raw.c archive_read_support_format_tar.c + archive_read_support_format_warc.c archive_read_support_format_xar.c archive_read_support_format_zip.c archive_string.c @@ -110,6 +123,7 @@ SET(libarchive_SOURCES archive_write_add_filter_grzip.c archive_write_add_filter_gzip.c archive_write_add_filter_lrzip.c + archive_write_add_filter_lz4.c archive_write_add_filter_lzop.c archive_write_add_filter_none.c archive_write_add_filter_program.c @@ -121,18 +135,24 @@ SET(libarchive_SOURCES archive_write_set_format_by_name.c archive_write_set_format_cpio.c archive_write_set_format_cpio_newc.c + archive_write_set_format_filter_by_ext.c archive_write_set_format_gnutar.c archive_write_set_format_iso9660.c archive_write_set_format_mtree.c archive_write_set_format_pax.c + archive_write_set_format_raw.c archive_write_set_format_shar.c archive_write_set_format_ustar.c archive_write_set_format_v7tar.c + archive_write_set_format_warc.c archive_write_set_format_xar.c archive_write_set_format_zip.c archive_write_set_options.c + archive_write_set_passphrase.c + archive_xxhash.h filter_fork_posix.c filter_fork.h + xxhash.c ) # Man pages @@ -145,12 +165,14 @@ SET(libarchive_MANS archive_entry_stat.3 archive_entry_time.3 archive_read.3 + archive_read_add_passphrase.3 archive_read_disk.3 archive_read_set_options.3 archive_util.3 archive_write.3 archive_write_disk.3 archive_write_set_options.3 + archive_write_set_passphrase.3 cpio.5 libarchive.3 libarchive_internals.3 @@ -175,6 +197,7 @@ SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) # archive_static is a static library ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) +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. @@ -182,12 +205,14 @@ IF(NOT WIN32 OR CYGWIN) SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) ENDIF(NOT WIN32 OR CYGWIN) -# How to install the libraries -INSTALL(TARGETS archive archive_static - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) -INSTALL_MAN(${libarchive_MANS}) -INSTALL(FILES ${include_HEADERS} DESTINATION include) +IF(ENABLE_INSTALL) + # How to install the libraries + INSTALL(TARGETS archive archive_static + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + INSTALL_MAN(${libarchive_MANS}) + INSTALL(FILES ${include_HEADERS} DESTINATION include) +ENDIF() add_subdirectory(test) diff --git a/libarchive/archive.h b/libarchive/archive.h index f56bc38e5b43..59e9ef15eb60 100644 --- a/libarchive/archive.h +++ b/libarchive/archive.h @@ -28,9 +28,20 @@ #ifndef ARCHIVE_H_INCLUDED #define ARCHIVE_H_INCLUDED +/* + * The version number is expressed as a single integer that makes it + * easy to compare versions at build time: for version a.b.c, the + * version number is printf("%d%03d%03d",a,b,c). For example, if you + * know your application requires version 2.12.108 or later, you can + * assert that ARCHIVE_VERSION_NUMBER >= 2012108. + */ +/* Note: Compiler will complain if this does not match archive_entry.h! */ +#define ARCHIVE_VERSION_NUMBER 3002000 + #include #include /* for wchar_t */ #include /* For FILE * */ +#include /* For time_t */ /* * Note: archive.h is for use outside of libarchive; the configuration @@ -41,29 +52,53 @@ */ #if defined(__BORLANDC__) && __BORLANDC__ >= 0x560 # include -#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) && !defined(_SCO_DS) +#elif !defined(__WATCOMC__) && !defined(_MSC_VER) && !defined(__INTERIX) && !defined(__BORLANDC__) && !defined(_SCO_DS) && !defined(__osf__) # include #endif -/* Get appropriate definitions of standard POSIX-style types. */ -/* These should match the types used in 'struct stat' */ -#if defined(_WIN32) && !defined(__CYGWIN__) -# define __LA_INT64_T __int64 -# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_) -# define __LA_SSIZE_T ssize_t -# elif defined(_WIN64) -# define __LA_SSIZE_T __int64 -# else -# define __LA_SSIZE_T long +/* Get appropriate definitions of 64-bit integer */ +#if !defined(__LA_INT64_T_DEFINED) +/* Older code relied on the __LA_INT64_T macro; after 4.0 we'll switch to the typedef exclusively. */ +# if ARCHIVE_VERSION_NUMBER < 4000000 +#define __LA_INT64_T la_int64_t # endif -#else +#define __LA_INT64_T_DEFINED +# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) +typedef __int64 la_int64_t; +# else # include /* ssize_t */ -# if defined(_SCO_DS) -# define __LA_INT64_T long long -# else -# define __LA_INT64_T int64_t +# if defined(_SCO_DS) || defined(__osf__) +typedef long long la_int64_t; +# else +typedef int64_t la_int64_t; +# endif # endif -# define __LA_SSIZE_T ssize_t +#endif + +/* The la_ssize_t should match the type used in 'struct stat' */ +#if !defined(__LA_SSIZE_T_DEFINED) +/* Older code relied on the __LA_SSIZE_T macro; after 4.0 we'll switch to the typedef exclusively. */ +# if ARCHIVE_VERSION_NUMBER < 4000000 +#define __LA_SSIZE_T la_ssize_t +# endif +#define __LA_SSIZE_T_DEFINED +# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) +# if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_) +typedef ssize_t la_ssize_t; +# elif defined(_WIN64) +typedef __int64 la_ssize_t; +# else +typedef long la_ssize_t; +# endif +# else +# include /* ssize_t */ +typedef ssize_t la_ssize_t; +# endif +#endif + +/* Large file support for Android */ +#ifdef __ANDROID__ +#include "android_lf.h" #endif /* @@ -115,24 +150,34 @@ extern "C" { * header and library are very different, you should expect some * strangeness. Don't do that. */ - -/* - * The version number is expressed as a single integer that makes it - * easy to compare versions at build time: for version a.b.c, the - * version number is printf("%d%03d%03d",a,b,c). For example, if you - * know your application requires version 2.12.108 or later, you can - * assert that ARCHIVE_VERSION_NUMBER >= 2012108. - */ -/* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3001002 __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_STRING "libarchive 3.1.2" +#define ARCHIVE_VERSION_ONLY_STRING "3.2.0" +#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); +/* + * Detailed textual name/version of the library and its dependencies. + * This has the form: + * "libarchive x.y.z zlib/a.b.c liblzma/d.e.f ... etc ..." + * the list of libraries described here will vary depending on how + * libarchive was compiled. + */ +__LA_DECL const char * archive_version_details(void); + +/* + * Returns NULL if libarchive was compiled without the associated library. + * Otherwise, returns the version number that libarchive was compiled + * against. + */ +__LA_DECL const char * archive_zlib_version(void); +__LA_DECL const char * archive_liblzma_version(void); +__LA_DECL const char * archive_bzlib_version(void); +__LA_DECL const char * archive_liblz4_version(void); + /* Declare our basic types. */ struct archive; struct archive_entry; @@ -173,7 +218,7 @@ struct archive_entry; */ /* Returns pointer and size of next block of data from archive. */ -typedef __LA_SSIZE_T archive_read_callback(struct archive *, +typedef la_ssize_t archive_read_callback(struct archive *, void *_client_data, const void **_buffer); /* Skips at most request bytes from archive and returns the skipped amount. @@ -181,18 +226,18 @@ typedef __LA_SSIZE_T archive_read_callback(struct archive *, * If you do skip fewer bytes than requested, libarchive will invoke your * read callback and discard data as necessary to make up the full skip. */ -typedef __LA_INT64_T archive_skip_callback(struct archive *, - void *_client_data, __LA_INT64_T request); +typedef la_int64_t archive_skip_callback(struct archive *, + void *_client_data, la_int64_t request); /* Seeks to specified location in the file and returns the position. * Whence values are SEEK_SET, SEEK_CUR, SEEK_END from stdio.h. * Return ARCHIVE_FATAL if the seek fails for any reason. */ -typedef __LA_INT64_T archive_seek_callback(struct archive *, - void *_client_data, __LA_INT64_T offset, int whence); +typedef la_int64_t archive_seek_callback(struct archive *, + void *_client_data, la_int64_t offset, int whence); /* Returns size actually written, zero on EOF, -1 on error. */ -typedef __LA_SSIZE_T archive_write_callback(struct archive *, +typedef la_ssize_t archive_write_callback(struct archive *, void *_client_data, const void *_buffer, size_t _length); @@ -207,6 +252,13 @@ typedef int archive_close_callback(struct archive *, void *_client_data); typedef int archive_switch_callback(struct archive *, void *_client_data1, void *_client_data2); +/* + * Returns a passphrase used for encryption or decryption, NULL on nothing + * to do and give it up. + */ +typedef const char *archive_passphrase_callback(struct archive *, + void *_client_data); + /* * Codes to identify various stream filters. */ @@ -223,6 +275,7 @@ typedef int archive_switch_callback(struct archive *, void *_client_data1, #define ARCHIVE_FILTER_LRZIP 10 #define ARCHIVE_FILTER_LZOP 11 #define ARCHIVE_FILTER_GRZIP 12 +#define ARCHIVE_FILTER_LZ4 13 #if ARCHIVE_VERSION_NUMBER < 4000000 #define ARCHIVE_COMPRESSION_NONE ARCHIVE_FILTER_NONE @@ -284,6 +337,31 @@ typedef int archive_switch_callback(struct archive *, void *_client_data1, #define ARCHIVE_FORMAT_CAB 0xC0000 #define ARCHIVE_FORMAT_RAR 0xD0000 #define ARCHIVE_FORMAT_7ZIP 0xE0000 +#define ARCHIVE_FORMAT_WARC 0xF0000 + +/* + * Codes returned by archive_read_format_capabilities(). + * + * This list can be extended with values between 0 and 0xffff. + * The original purpose of this list was to let different archive + * format readers expose their general capabilities in terms of + * encryption. + */ +#define ARCHIVE_READ_FORMAT_CAPS_NONE (0) /* no special capabilities */ +#define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA (1<<0) /* reader can detect encrypted data */ +#define ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA (1<<1) /* reader can detect encryptable metadata (pathname, mtime, etc.) */ + +/* + * Codes returned by archive_read_has_encrypted_entries(). + * + * In case the archive does not support encryption detection at all + * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned. If the reader + * for some other reason (e.g. not enough bytes read) cannot say if + * there are encrypted entries, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW + * is returned. + */ +#define ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED -2 +#define ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW -1 /*- * Basic outline for reading an archive: @@ -342,6 +420,7 @@ __LA_DECL int archive_read_support_filter_compress(struct archive *); __LA_DECL int archive_read_support_filter_gzip(struct archive *); __LA_DECL int archive_read_support_filter_grzip(struct archive *); __LA_DECL int archive_read_support_filter_lrzip(struct archive *); +__LA_DECL int archive_read_support_filter_lz4(struct archive *); __LA_DECL int archive_read_support_filter_lzip(struct archive *); __LA_DECL int archive_read_support_filter_lzma(struct archive *); __LA_DECL int archive_read_support_filter_lzop(struct archive *); @@ -369,8 +448,17 @@ __LA_DECL int archive_read_support_format_mtree(struct archive *); __LA_DECL int archive_read_support_format_rar(struct archive *); __LA_DECL int archive_read_support_format_raw(struct archive *); __LA_DECL int archive_read_support_format_tar(struct archive *); +__LA_DECL int archive_read_support_format_warc(struct archive *); __LA_DECL int archive_read_support_format_xar(struct archive *); +/* archive_read_support_format_zip() enables both streamable and seekable + * zip readers. */ __LA_DECL int archive_read_support_format_zip(struct archive *); +/* Reads Zip archives as stream from beginning to end. Doesn't + * correctly handle SFX ZIP files or ZIP archives that have been modified + * in-place. */ +__LA_DECL int archive_read_support_format_zip_streamable(struct archive *); +/* Reads starting from central directory; requires seekable input. */ +__LA_DECL int archive_read_support_format_zip_seekable(struct archive *); /* Functions to manually set the format and filters to be used. This is * useful to bypass the bidding process when the format and filters to use @@ -441,9 +529,9 @@ __LA_DECL int archive_read_open_file(struct archive *, const char *_filename, size_t _block_size) __LA_DEPRECATED; /* Read an archive that's stored in memory. */ __LA_DECL int archive_read_open_memory(struct archive *, - void * buff, size_t size); + const void * buff, size_t size); /* A more involved version that is only used for internal testing. */ -__LA_DECL int archive_read_open_memory2(struct archive *a, void *buff, +__LA_DECL int archive_read_open_memory2(struct archive *a, const void *buff, size_t size, size_t read_size); /* Read an archive that's already open, using the file descriptor. */ __LA_DECL int archive_read_open_fd(struct archive *, int _fd, @@ -464,14 +552,40 @@ __LA_DECL int archive_read_next_header2(struct archive *, * Retrieve the byte offset in UNCOMPRESSED data where last-read * header started. */ -__LA_DECL __LA_INT64_T archive_read_header_position(struct archive *); +__LA_DECL la_int64_t archive_read_header_position(struct archive *); + +/* + * Returns 1 if the archive contains at least one encrypted entry. + * If the archive format not support encryption at all + * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned. + * If for any other reason (e.g. not enough data read so far) + * we cannot say whether there are encrypted entries, then + * ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW is returned. + * In general, this function will return values below zero when the + * reader is uncertain or totally uncapable of encryption support. + * When this function returns 0 you can be sure that the reader + * supports encryption detection but no encrypted entries have + * been found yet. + * + * NOTE: If the metadata/header of an archive is also encrypted, you + * cannot rely on the number of encrypted entries. That is why this + * function does not return the number of encrypted entries but# + * just shows that there are some. + */ +__LA_DECL int archive_read_has_encrypted_entries(struct archive *); + +/* + * Returns a bitmask of capabilities that are supported by the archive format reader. + * If the reader has no special capabilities, ARCHIVE_READ_FORMAT_CAPS_NONE is returned. + */ +__LA_DECL int archive_read_format_capabilities(struct archive *); /* Read data from the body of an entry. Similar to read(2). */ -__LA_DECL __LA_SSIZE_T archive_read_data(struct archive *, +__LA_DECL la_ssize_t archive_read_data(struct archive *, void *, size_t); /* Seek within the body of an entry. Similar to lseek(2). */ -__LA_DECL __LA_INT64_T archive_seek_data(struct archive *, __LA_INT64_T, int); +__LA_DECL la_int64_t archive_seek_data(struct archive *, la_int64_t, int); /* * A zero-copy version of archive_read_data that also exposes the file offset @@ -480,7 +594,7 @@ __LA_DECL __LA_INT64_T archive_seek_data(struct archive *, __LA_INT64_T, int); * be strictly increasing and that returned blocks will not overlap. */ __LA_DECL int archive_read_data_block(struct archive *a, - const void **buff, size_t *size, __LA_INT64_T *offset); + const void **buff, size_t *size, la_int64_t *offset); /*- * Some convenience functions that are built on archive_read_data: @@ -510,6 +624,14 @@ __LA_DECL int archive_read_set_option(struct archive *_a, __LA_DECL int archive_read_set_options(struct archive *_a, const char *opts); +/* + * Add a decryption passphrase. + */ +__LA_DECL int archive_read_add_passphrase(struct archive *, const char *); +__LA_DECL int archive_read_set_passphrase_callback(struct archive *, + void *client_data, archive_passphrase_callback *); + + /*- * Convenience function to recreate the current entry (whose header * has just been read) on disk. @@ -562,6 +684,10 @@ __LA_DECL int archive_read_set_options(struct archive *_a, /* Default: Do not use HFS+ compression if it was not compressed. */ /* This has no effect except on Mac OS v10.6 or later. */ #define ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED (0x8000) +/* Default: Do not reject entries with absolute paths */ +#define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000) +/* Default: Do not clear no-change flags when unlinking object */ +#define ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS (0x20000) __LA_DECL int archive_read_extract(struct archive *, struct archive_entry *, int flags); @@ -573,7 +699,7 @@ __LA_DECL void archive_read_extract_set_progress_callback(struct archive *, /* Record the dev/ino of a file that will not be written. This is * generally set to the dev/ino of the archive being read. */ __LA_DECL void archive_read_extract_set_skip_file(struct archive *, - __LA_INT64_T, __LA_INT64_T); + la_int64_t, la_int64_t); /* Close the file and release most resources. */ __LA_DECL int archive_read_close(struct archive *); @@ -612,7 +738,7 @@ __LA_DECL int archive_write_get_bytes_in_last_block(struct archive *); /* The dev/ino of a file that won't be archived. This is used * to avoid recursively adding an archive to itself. */ __LA_DECL int archive_write_set_skip_file(struct archive *, - __LA_INT64_T, __LA_INT64_T); + la_int64_t, la_int64_t); #if ARCHIVE_VERSION_NUMBER < 4000000 __LA_DECL int archive_write_set_compression_bzip2(struct archive *) @@ -643,6 +769,7 @@ __LA_DECL int archive_write_add_filter_compress(struct archive *); __LA_DECL int archive_write_add_filter_grzip(struct archive *); __LA_DECL int archive_write_add_filter_gzip(struct archive *); __LA_DECL int archive_write_add_filter_lrzip(struct archive *); +__LA_DECL int archive_write_add_filter_lz4(struct archive *); __LA_DECL int archive_write_add_filter_lzip(struct archive *); __LA_DECL int archive_write_add_filter_lzma(struct archive *); __LA_DECL int archive_write_add_filter_lzop(struct archive *); @@ -670,12 +797,16 @@ __LA_DECL int archive_write_set_format_mtree_classic(struct archive *); /* TODO: int archive_write_set_format_old_tar(struct archive *); */ __LA_DECL int archive_write_set_format_pax(struct archive *); __LA_DECL int archive_write_set_format_pax_restricted(struct archive *); +__LA_DECL int archive_write_set_format_raw(struct archive *); __LA_DECL int archive_write_set_format_shar(struct archive *); __LA_DECL int archive_write_set_format_shar_dump(struct archive *); __LA_DECL int archive_write_set_format_ustar(struct archive *); __LA_DECL int archive_write_set_format_v7tar(struct archive *); +__LA_DECL int archive_write_set_format_warc(struct archive *); __LA_DECL int archive_write_set_format_xar(struct archive *); __LA_DECL int archive_write_set_format_zip(struct archive *); +__LA_DECL int archive_write_set_format_filter_by_ext(struct archive *a, const char *filename); +__LA_DECL int archive_write_set_format_filter_by_ext_def(struct archive *a, const char *filename, const char * def_ext); __LA_DECL int archive_write_zip_set_compression_deflate(struct archive *); __LA_DECL int archive_write_zip_set_compression_store(struct archive *); __LA_DECL int archive_write_open(struct archive *, void *, @@ -700,12 +831,12 @@ __LA_DECL int archive_write_open_memory(struct archive *, */ __LA_DECL int archive_write_header(struct archive *, struct archive_entry *); -__LA_DECL __LA_SSIZE_T archive_write_data(struct archive *, +__LA_DECL la_ssize_t archive_write_data(struct archive *, const void *, size_t); /* This interface is currently only available for archive_write_disk handles. */ -__LA_DECL __LA_SSIZE_T archive_write_data_block(struct archive *, - const void *, size_t, __LA_INT64_T); +__LA_DECL la_ssize_t archive_write_data_block(struct archive *, + const void *, size_t, la_int64_t); __LA_DECL int archive_write_finish_entry(struct archive *); __LA_DECL int archive_write_close(struct archive *); @@ -740,6 +871,13 @@ __LA_DECL int archive_write_set_option(struct archive *_a, __LA_DECL int archive_write_set_options(struct archive *_a, const char *opts); +/* + * Set a encryption passphrase. + */ +__LA_DECL int archive_write_set_passphrase(struct archive *_a, const char *p); +__LA_DECL int archive_write_set_passphrase_callback(struct archive *, + void *client_data, archive_passphrase_callback *); + /*- * ARCHIVE_WRITE_DISK API * @@ -759,7 +897,7 @@ __LA_DECL int archive_write_set_options(struct archive *_a, __LA_DECL struct archive *archive_write_disk_new(void); /* This file will not be overwritten. */ __LA_DECL int archive_write_disk_set_skip_file(struct archive *, - __LA_INT64_T, __LA_INT64_T); + la_int64_t, la_int64_t); /* Set flags to control how the next item gets created. * This accepts a bitmask of ARCHIVE_EXTRACT_XXX flags defined above. */ __LA_DECL int archive_write_disk_set_options(struct archive *, @@ -789,14 +927,14 @@ __LA_DECL int archive_write_disk_set_standard_lookup(struct archive *); */ __LA_DECL int archive_write_disk_set_group_lookup(struct archive *, void * /* private_data */, - __LA_INT64_T (*)(void *, const char *, __LA_INT64_T), + la_int64_t (*)(void *, const char *, la_int64_t), void (* /* cleanup */)(void *)); __LA_DECL int archive_write_disk_set_user_lookup(struct archive *, void * /* private_data */, - __LA_INT64_T (*)(void *, const char *, __LA_INT64_T), + la_int64_t (*)(void *, const char *, la_int64_t), void (* /* cleanup */)(void *)); -__LA_DECL __LA_INT64_T archive_write_disk_gid(struct archive *, const char *, __LA_INT64_T); -__LA_DECL __LA_INT64_T archive_write_disk_uid(struct archive *, const char *, __LA_INT64_T); +__LA_DECL la_int64_t archive_write_disk_gid(struct archive *, const char *, la_int64_t); +__LA_DECL la_int64_t archive_write_disk_uid(struct archive *, const char *, la_int64_t); /* * ARCHIVE_READ_DISK API @@ -817,19 +955,19 @@ __LA_DECL int archive_read_disk_entry_from_file(struct archive *, struct archive_entry *, int /* fd */, const struct stat *); /* Look up gname for gid or uname for uid. */ /* Default implementations are very, very stupid. */ -__LA_DECL const char *archive_read_disk_gname(struct archive *, __LA_INT64_T); -__LA_DECL const char *archive_read_disk_uname(struct archive *, __LA_INT64_T); +__LA_DECL const char *archive_read_disk_gname(struct archive *, la_int64_t); +__LA_DECL const char *archive_read_disk_uname(struct archive *, la_int64_t); /* "Standard" implementation uses getpwuid_r, getgrgid_r and caches the * results for performance. */ __LA_DECL int archive_read_disk_set_standard_lookup(struct archive *); /* You can install your own lookups if you like. */ __LA_DECL int archive_read_disk_set_gname_lookup(struct archive *, void * /* private_data */, - const char *(* /* lookup_fn */)(void *, __LA_INT64_T), + const char *(* /* lookup_fn */)(void *, la_int64_t), void (* /* cleanup_fn */)(void *)); __LA_DECL int archive_read_disk_set_uname_lookup(struct archive *, void * /* private_data */, - const char *(* /* lookup_fn */)(void *, __LA_INT64_T), + const char *(* /* lookup_fn */)(void *, la_int64_t), void (* /* cleanup_fn */)(void *)); /* Start traversal. */ __LA_DECL int archive_read_disk_open(struct archive *, const char *); @@ -859,8 +997,10 @@ __LA_DECL int archive_read_disk_set_atime_restored(struct archive *); /* Default: Skip a mac resource fork file whose prefix is "._" because of * using copyfile. */ #define ARCHIVE_READDISK_MAC_COPYFILE (0x0004) -/* Default: Do not traverse mount points. */ +/* Default: Traverse mount points. */ #define ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS (0x0008) +/* Default: Xattrs are read from disk. */ +#define ARCHIVE_READDISK_NO_XATTR (0x0010) __LA_DECL int archive_read_disk_set_behavior(struct archive *, int flags); @@ -879,6 +1019,10 @@ __LA_DECL int archive_read_disk_set_metadata_filter_callback(struct archive *, int (*_metadata_filter_func)(struct archive *, void *, struct archive_entry *), void *_client_data); +/* Simplified cleanup interface; + * This calls archive_read_free() or archive_write_free() as needed. */ +__LA_DECL int archive_free(struct archive *); + /* * Accessor functions to read/set various information in * the struct archive object: @@ -889,7 +1033,7 @@ __LA_DECL int archive_read_disk_set_metadata_filter_callback(struct archive *, * last filter, which is always the pseudo-filter that wraps the * client callbacks. */ __LA_DECL int archive_filter_count(struct archive *); -__LA_DECL __LA_INT64_T archive_filter_bytes(struct archive *, int); +__LA_DECL la_int64_t archive_filter_bytes(struct archive *, int); __LA_DECL int archive_filter_code(struct archive *, int); __LA_DECL const char * archive_filter_name(struct archive *, int); @@ -897,10 +1041,10 @@ __LA_DECL const char * archive_filter_name(struct archive *, int); /* These don't properly handle multiple filters, so are deprecated and * will eventually be removed. */ /* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, -1); */ -__LA_DECL __LA_INT64_T archive_position_compressed(struct archive *) +__LA_DECL la_int64_t archive_position_compressed(struct archive *) __LA_DEPRECATED; /* As of libarchive 3.0, this is an alias for archive_filter_bytes(a, 0); */ -__LA_DECL __LA_INT64_T archive_position_uncompressed(struct archive *) +__LA_DECL la_int64_t archive_position_uncompressed(struct archive *) __LA_DEPRECATED; /* As of libarchive 3.0, this is an alias for archive_filter_name(a, 0); */ __LA_DECL const char *archive_compression_name(struct archive *) @@ -1016,8 +1160,8 @@ __LA_DECL int archive_match_exclude_entry(struct archive *, __LA_DECL int archive_match_owner_excluded(struct archive *, struct archive_entry *); /* Add inclusion uid, gid, uname and gname. */ -__LA_DECL int archive_match_include_uid(struct archive *, __LA_INT64_T); -__LA_DECL int archive_match_include_gid(struct archive *, __LA_INT64_T); +__LA_DECL int archive_match_include_uid(struct archive *, la_int64_t); +__LA_DECL int archive_match_include_gid(struct archive *, la_int64_t); __LA_DECL int archive_match_include_uname(struct archive *, const char *); __LA_DECL int archive_match_include_uname_w(struct archive *, const wchar_t *); @@ -1025,6 +1169,10 @@ __LA_DECL int archive_match_include_gname(struct archive *, const char *); __LA_DECL int archive_match_include_gname_w(struct archive *, const wchar_t *); +/* Utility functions */ +/* Convenience function to sort a NULL terminated list of strings */ +__LA_DECL int archive_utility_string_sort(char **); + #ifdef __cplusplus } #endif @@ -1032,9 +1180,4 @@ __LA_DECL int archive_match_include_gname_w(struct archive *, /* These are meaningless outside of this header. */ #undef __LA_DECL -/* These need to remain defined because they're used in the - * callback type definitions. XXX Fix this. This is ugly. XXX */ -/* #undef __LA_INT64_T */ -/* #undef __LA_SSIZE_T */ - #endif /* !ARCHIVE_H_INCLUDED */ diff --git a/libarchive/archive_cryptor.c b/libarchive/archive_cryptor.c new file mode 100644 index 000000000000..0be30c601a94 --- /dev/null +++ b/libarchive/archive_cryptor.c @@ -0,0 +1,448 @@ +/*- +* Copyright (c) 2014 Michihiro NAKAJIMA +* 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 "archive_platform.h" + +#ifdef HAVE_STRING_H +#include +#endif +#include "archive.h" +#include "archive_cryptor_private.h" + +/* + * On systems that do not support any recognized crypto libraries, + * this file will normally define no usable symbols. + * + * But some compilers and linkers choke on empty object files, so + * define a public symbol that will always exist. This could + * be removed someday if this file gains another always-present + * symbol definition. + */ +int __libarchive_cryptor_build_hack(void) { + return 0; +} + +#ifdef ARCHIVE_CRYPTOR_USE_Apple_CommonCrypto + +static int +pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt, + size_t salt_len, unsigned rounds, uint8_t *derived_key, + size_t derived_key_len) +{ + CCKeyDerivationPBKDF(kCCPBKDF2, (const char *)pw, + pw_len, salt, salt_len, kCCPRFHmacAlgSHA1, rounds, + derived_key, derived_key_len); + return 0; +} + +#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) +#ifdef _MSC_VER +#pragma comment(lib, "Bcrypt.lib") +#endif + +static int +pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt, + size_t salt_len, unsigned rounds, uint8_t *derived_key, + size_t derived_key_len) +{ + NTSTATUS status; + BCRYPT_ALG_HANDLE hAlg; + + status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_SHA1_ALGORITHM, + MS_PRIMITIVE_PROVIDER, BCRYPT_ALG_HANDLE_HMAC_FLAG); + if (!BCRYPT_SUCCESS(status)) + return -1; + + status = BCryptDeriveKeyPBKDF2(hAlg, + (PUCHAR)(uintptr_t)pw, (ULONG)pw_len, + (PUCHAR)(uintptr_t)salt, (ULONG)salt_len, rounds, + (PUCHAR)derived_key, (ULONG)derived_key_len, 0); + + BCryptCloseAlgorithmProvider(hAlg, 0); + + return (BCRYPT_SUCCESS(status)) ? 0: -1; +} + +#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_PBKDF2_H) + +static int +pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt, + size_t salt_len, unsigned rounds, uint8_t *derived_key, + size_t derived_key_len) { + pbkdf2_hmac_sha1((unsigned)pw_len, (const uint8_t *)pw, rounds, + salt_len, salt, derived_key_len, derived_key); + return 0; +} + +#elif defined(HAVE_LIBCRYPTO) && defined(HAVE_PKCS5_PBKDF2_HMAC_SHA1) + +static int +pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt, + size_t salt_len, unsigned rounds, uint8_t *derived_key, + size_t derived_key_len) { + + PKCS5_PBKDF2_HMAC_SHA1(pw, pw_len, salt, salt_len, rounds, + derived_key_len, derived_key); + return 0; +} + +#else + +/* Stub */ +static int +pbkdf2_sha1(const char *pw, size_t pw_len, const uint8_t *salt, + size_t salt_len, unsigned rounds, uint8_t *derived_key, + size_t derived_key_len) { + (void)pw; /* UNUSED */ + (void)pw_len; /* UNUSED */ + (void)salt; /* UNUSED */ + (void)salt_len; /* UNUSED */ + (void)rounds; /* UNUSED */ + (void)derived_key; /* UNUSED */ + (void)derived_key_len; /* UNUSED */ + return -1; /* UNSUPPORTED */ +} + +#endif + +#ifdef ARCHIVE_CRYPTOR_USE_Apple_CommonCrypto +# if MAC_OS_X_VERSION_MAX_ALLOWED < 1090 +# define kCCAlgorithmAES kCCAlgorithmAES128 +# endif + +static int +aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) +{ + CCCryptorStatus r; + + ctx->key_len = key_len; + memcpy(ctx->key, key, key_len); + memset(ctx->nonce, 0, sizeof(ctx->nonce)); + ctx->encr_pos = AES_BLOCK_SIZE; + r = CCCryptorCreateWithMode(kCCEncrypt, kCCModeECB, kCCAlgorithmAES, + ccNoPadding, NULL, key, key_len, NULL, 0, 0, 0, &ctx->ctx); + return (r == kCCSuccess)? 0: -1; +} + +static int +aes_ctr_encrypt_counter(archive_crypto_ctx *ctx) +{ + CCCryptorRef ref = ctx->ctx; + CCCryptorStatus r; + + r = CCCryptorReset(ref, NULL); + if (r != kCCSuccess) + return -1; + r = CCCryptorUpdate(ref, ctx->nonce, AES_BLOCK_SIZE, ctx->encr_buf, + AES_BLOCK_SIZE, NULL); + return (r == kCCSuccess)? 0: -1; +} + +static int +aes_ctr_release(archive_crypto_ctx *ctx) +{ + memset(ctx->key, 0, ctx->key_len); + memset(ctx->nonce, 0, sizeof(ctx->nonce)); + return 0; +} + +#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) + +static int +aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) +{ + BCRYPT_ALG_HANDLE hAlg; + BCRYPT_KEY_HANDLE hKey; + DWORD keyObj_len, aes_key_len; + PBYTE keyObj; + ULONG result; + NTSTATUS status; + BCRYPT_KEY_LENGTHS_STRUCT key_lengths; + + ctx->hAlg = NULL; + ctx->hKey = NULL; + ctx->keyObj = NULL; + switch (key_len) { + case 16: aes_key_len = 128; break; + case 24: aes_key_len = 192; break; + case 32: aes_key_len = 256; break; + default: return -1; + } + status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_AES_ALGORITHM, + MS_PRIMITIVE_PROVIDER, 0); + if (!BCRYPT_SUCCESS(status)) + return -1; + status = BCryptGetProperty(hAlg, BCRYPT_KEY_LENGTHS, (PUCHAR)&key_lengths, + sizeof(key_lengths), &result, 0); + if (!BCRYPT_SUCCESS(status)) { + BCryptCloseAlgorithmProvider(hAlg, 0); + return -1; + } + if (key_lengths.dwMinLength > aes_key_len + || key_lengths.dwMaxLength < aes_key_len) { + BCryptCloseAlgorithmProvider(hAlg, 0); + return -1; + } + status = BCryptGetProperty(hAlg, BCRYPT_OBJECT_LENGTH, (PUCHAR)&keyObj_len, + sizeof(keyObj_len), &result, 0); + if (!BCRYPT_SUCCESS(status)) { + BCryptCloseAlgorithmProvider(hAlg, 0); + return -1; + } + keyObj = (PBYTE)HeapAlloc(GetProcessHeap(), 0, keyObj_len); + if (keyObj == NULL) { + BCryptCloseAlgorithmProvider(hAlg, 0); + return -1; + } + status = BCryptSetProperty(hAlg, BCRYPT_CHAINING_MODE, + (PUCHAR)BCRYPT_CHAIN_MODE_ECB, sizeof(BCRYPT_CHAIN_MODE_ECB), 0); + if (!BCRYPT_SUCCESS(status)) { + BCryptCloseAlgorithmProvider(hAlg, 0); + HeapFree(GetProcessHeap(), 0, keyObj); + return -1; + } + status = BCryptGenerateSymmetricKey(hAlg, &hKey, + keyObj, keyObj_len, + (PUCHAR)(uintptr_t)key, (ULONG)key_len, 0); + if (!BCRYPT_SUCCESS(status)) { + BCryptCloseAlgorithmProvider(hAlg, 0); + HeapFree(GetProcessHeap(), 0, keyObj); + return -1; + } + + ctx->hAlg = hAlg; + ctx->hKey = hKey; + ctx->keyObj = keyObj; + ctx->keyObj_len = keyObj_len; + ctx->encr_pos = AES_BLOCK_SIZE; + + return 0; +} + +static int +aes_ctr_encrypt_counter(archive_crypto_ctx *ctx) +{ + NTSTATUS status; + ULONG result; + + status = BCryptEncrypt(ctx->hKey, (PUCHAR)ctx->nonce, AES_BLOCK_SIZE, + NULL, NULL, 0, (PUCHAR)ctx->encr_buf, AES_BLOCK_SIZE, + &result, 0); + return BCRYPT_SUCCESS(status) ? 0 : -1; +} + +static int +aes_ctr_release(archive_crypto_ctx *ctx) +{ + + if (ctx->hAlg != NULL) { + BCryptCloseAlgorithmProvider(ctx->hAlg, 0); + ctx->hAlg = NULL; + BCryptDestroyKey(ctx->hKey); + ctx->hKey = NULL; + HeapFree(GetProcessHeap(), 0, ctx->keyObj); + ctx->keyObj = NULL; + } + memset(ctx, 0, sizeof(*ctx)); + return 0; +} + +#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_AES_H) + +static int +aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) +{ + ctx->key_len = key_len; + memcpy(ctx->key, key, key_len); + memset(ctx->nonce, 0, sizeof(ctx->nonce)); + ctx->encr_pos = AES_BLOCK_SIZE; + memset(&ctx->ctx, 0, sizeof(ctx->ctx)); + return 0; +} + +static int +aes_ctr_encrypt_counter(archive_crypto_ctx *ctx) +{ + aes_set_encrypt_key(&ctx->ctx, ctx->key_len, ctx->key); + aes_encrypt(&ctx->ctx, AES_BLOCK_SIZE, ctx->encr_buf, ctx->nonce); + return 0; +} + +static int +aes_ctr_release(archive_crypto_ctx *ctx) +{ + memset(ctx, 0, sizeof(*ctx)); + return 0; +} + +#elif defined(HAVE_LIBCRYPTO) + +static int +aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) +{ + + switch (key_len) { + case 16: ctx->type = EVP_aes_128_ecb(); break; + case 24: ctx->type = EVP_aes_192_ecb(); break; + case 32: ctx->type = EVP_aes_256_ecb(); break; + default: ctx->type = NULL; return -1; + } + + ctx->key_len = key_len; + memcpy(ctx->key, key, key_len); + memset(ctx->nonce, 0, sizeof(ctx->nonce)); + ctx->encr_pos = AES_BLOCK_SIZE; + EVP_CIPHER_CTX_init(&ctx->ctx); + return 0; +} + +static int +aes_ctr_encrypt_counter(archive_crypto_ctx *ctx) +{ + int outl = 0; + int r; + + r = EVP_EncryptInit_ex(&ctx->ctx, ctx->type, NULL, ctx->key, NULL); + if (r == 0) + return -1; + r = EVP_EncryptUpdate(&ctx->ctx, ctx->encr_buf, &outl, ctx->nonce, + AES_BLOCK_SIZE); + if (r == 0 || outl != AES_BLOCK_SIZE) + return -1; + return 0; +} + +static int +aes_ctr_release(archive_crypto_ctx *ctx) +{ + EVP_CIPHER_CTX_cleanup(&ctx->ctx); + memset(ctx->key, 0, ctx->key_len); + memset(ctx->nonce, 0, sizeof(ctx->nonce)); + return 0; +} + +#else + +#define ARCHIVE_CRYPTOR_STUB +/* Stub */ +static int +aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *key, size_t key_len) +{ + (void)ctx; /* UNUSED */ + (void)key; /* UNUSED */ + (void)key_len; /* UNUSED */ + return -1; +} + +static int +aes_ctr_encrypt_counter(archive_crypto_ctx *ctx) +{ + (void)ctx; /* UNUSED */ + return -1; +} + +static int +aes_ctr_release(archive_crypto_ctx *ctx) +{ + (void)ctx; /* UNUSED */ + return 0; +} + +#endif + +#ifdef ARCHIVE_CRYPTOR_STUB +static int +aes_ctr_update(archive_crypto_ctx *ctx, const uint8_t * const in, + size_t in_len, uint8_t * const out, size_t *out_len) +{ + (void)ctx; /* UNUSED */ + (void)in; /* UNUSED */ + (void)in_len; /* UNUSED */ + (void)out; /* UNUSED */ + (void)out_len; /* UNUSED */ + aes_ctr_encrypt_counter(ctx); /* UNUSED */ /* Fix unused function warning */ + return -1; +} + +#else +static void +aes_ctr_increase_counter(archive_crypto_ctx *ctx) +{ + uint8_t *const nonce = ctx->nonce; + int j; + + for (j = 0; j < 8; j++) { + if (++nonce[j]) + break; + } +} + +static int +aes_ctr_update(archive_crypto_ctx *ctx, const uint8_t * const in, + size_t in_len, uint8_t * const out, size_t *out_len) +{ + uint8_t *const ebuf = ctx->encr_buf; + unsigned pos = ctx->encr_pos; + unsigned max = (unsigned)((in_len < *out_len)? in_len: *out_len); + unsigned i; + + for (i = 0; i < max; ) { + if (pos == AES_BLOCK_SIZE) { + aes_ctr_increase_counter(ctx); + if (aes_ctr_encrypt_counter(ctx) != 0) + return -1; + while (max -i >= AES_BLOCK_SIZE) { + for (pos = 0; pos < AES_BLOCK_SIZE; pos++) + out[i+pos] = in[i+pos] ^ ebuf[pos]; + i += AES_BLOCK_SIZE; + aes_ctr_increase_counter(ctx); + if (aes_ctr_encrypt_counter(ctx) != 0) + return -1; + } + pos = 0; + if (i >= max) + break; + } + out[i] = in[i] ^ ebuf[pos++]; + i++; + } + ctx->encr_pos = pos; + *out_len = i; + + return 0; +} +#endif /* ARCHIVE_CRYPTOR_STUB */ + + +const struct archive_cryptor __archive_cryptor = +{ + &pbkdf2_sha1, + &aes_ctr_init, + &aes_ctr_update, + &aes_ctr_release, + &aes_ctr_init, + &aes_ctr_update, + &aes_ctr_release, +}; diff --git a/libarchive/archive_cryptor_private.h b/libarchive/archive_cryptor_private.h new file mode 100644 index 000000000000..37eaad369dc7 --- /dev/null +++ b/libarchive/archive_cryptor_private.h @@ -0,0 +1,163 @@ +/*- +* Copyright (c) 2014 Michihiro NAKAJIMA +* 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. +*/ + +#ifndef __LIBARCHIVE_BUILD +#error This header is only to be used internally to libarchive. +#endif + +#ifndef ARCHIVE_CRYPTOR_PRIVATE_H_INCLUDED +#define ARCHIVE_CRYPTOR_PRIVATE_H_INCLUDED + +/* + * On systems that do not support any recognized crypto libraries, + * the archive_cryptor.c file will normally define no usable symbols. + * + * But some compilers and linkers choke on empty object files, so + * define a public symbol that will always exist. This could + * be removed someday if this file gains another always-present + * symbol definition. + */ +int __libarchive_cryptor_build_hack(void); + +#ifdef __APPLE__ +# include +# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 +# define ARCHIVE_CRYPTOR_USE_Apple_CommonCrypto +# endif +#endif + +#ifdef ARCHIVE_CRYPTOR_USE_Apple_CommonCrypto +#include +#include +#define AES_BLOCK_SIZE 16 +#define AES_MAX_KEY_SIZE kCCKeySizeAES256 + +typedef struct { + CCCryptorRef ctx; + uint8_t key[AES_MAX_KEY_SIZE]; + unsigned key_len; + uint8_t nonce[AES_BLOCK_SIZE]; + uint8_t encr_buf[AES_BLOCK_SIZE]; + unsigned encr_pos; +} archive_crypto_ctx; + +#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) +#include + +/* Common in other bcrypt implementations, but missing from VS2008. */ +#ifndef BCRYPT_SUCCESS +#define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS) +#endif + +#define AES_MAX_KEY_SIZE 32 +#define AES_BLOCK_SIZE 16 +typedef struct { + BCRYPT_ALG_HANDLE hAlg; + BCRYPT_KEY_HANDLE hKey; + PBYTE keyObj; + DWORD keyObj_len; + uint8_t nonce[AES_BLOCK_SIZE]; + uint8_t encr_buf[AES_BLOCK_SIZE]; + unsigned encr_pos; +} archive_crypto_ctx; + +#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_AES_H) +#if defined(HAVE_NETTLE_PBKDF2_H) +#include +#endif +#include + +typedef struct { + struct aes_ctx ctx; + uint8_t key[AES_MAX_KEY_SIZE]; + unsigned key_len; + uint8_t nonce[AES_BLOCK_SIZE]; + uint8_t encr_buf[AES_BLOCK_SIZE]; + unsigned encr_pos; +} archive_crypto_ctx; + +#elif defined(HAVE_LIBCRYPTO) +#include +#define AES_BLOCK_SIZE 16 +#define AES_MAX_KEY_SIZE 32 + +typedef struct { + EVP_CIPHER_CTX ctx; + const EVP_CIPHER *type; + uint8_t key[AES_MAX_KEY_SIZE]; + unsigned key_len; + uint8_t nonce[AES_BLOCK_SIZE]; + uint8_t encr_buf[AES_BLOCK_SIZE]; + unsigned encr_pos; +} archive_crypto_ctx; + +#else + +#define AES_BLOCK_SIZE 16 +#define AES_MAX_KEY_SIZE 32 +typedef int archive_crypto_ctx; + +#endif + +/* defines */ +#define archive_pbkdf2_sha1(pw, pw_len, salt, salt_len, rounds, dk, dk_len)\ + __archive_cryptor.pbkdf2sha1(pw, pw_len, salt, salt_len, rounds, dk, dk_len) + +#define archive_decrypto_aes_ctr_init(ctx, key, key_len) \ + __archive_cryptor.decrypto_aes_ctr_init(ctx, key, key_len) +#define archive_decrypto_aes_ctr_update(ctx, in, in_len, out, out_len) \ + __archive_cryptor.decrypto_aes_ctr_update(ctx, in, in_len, out, out_len) +#define archive_decrypto_aes_ctr_release(ctx) \ + __archive_cryptor.decrypto_aes_ctr_release(ctx) + +#define archive_encrypto_aes_ctr_init(ctx, key, key_len) \ + __archive_cryptor.encrypto_aes_ctr_init(ctx, key, key_len) +#define archive_encrypto_aes_ctr_update(ctx, in, in_len, out, out_len) \ + __archive_cryptor.encrypto_aes_ctr_update(ctx, in, in_len, out, out_len) +#define archive_encrypto_aes_ctr_release(ctx) \ + __archive_cryptor.encrypto_aes_ctr_release(ctx) + +/* Minimal interface to cryptographic functionality for internal use in + * libarchive */ +struct archive_cryptor +{ + /* PKCS5 PBKDF2 HMAC-SHA1 */ + int (*pbkdf2sha1)(const char *pw, size_t pw_len, const uint8_t *salt, + size_t salt_len, unsigned rounds, uint8_t *derived_key, + size_t derived_key_len); + /* AES CTR mode(little endian version) */ + int (*decrypto_aes_ctr_init)(archive_crypto_ctx *, const uint8_t *, size_t); + int (*decrypto_aes_ctr_update)(archive_crypto_ctx *, const uint8_t *, + size_t, uint8_t *, size_t *); + int (*decrypto_aes_ctr_release)(archive_crypto_ctx *); + int (*encrypto_aes_ctr_init)(archive_crypto_ctx *, const uint8_t *, size_t); + int (*encrypto_aes_ctr_update)(archive_crypto_ctx *, const uint8_t *, + size_t, uint8_t *, size_t *); + int (*encrypto_aes_ctr_release)(archive_crypto_ctx *); +}; + +extern const struct archive_cryptor __archive_cryptor; + +#endif diff --git a/libarchive/archive_crypto.c b/libarchive/archive_digest.c similarity index 99% rename from libarchive/archive_crypto.c rename to libarchive/archive_digest.c index 85aba3ae27cd..f009d317aeef 100644 --- a/libarchive/archive_crypto.c +++ b/libarchive/archive_digest.c @@ -28,7 +28,7 @@ #include "archive_platform.h" #include "archive.h" -#include "archive_crypto_private.h" +#include "archive_digest_private.h" /* In particular, force the configure probe to break if it tries * to test a combination of OpenSSL and libmd. */ @@ -1216,8 +1216,8 @@ __archive_stub_sha512final(archive_sha512_ctx *ctx, void *md) #endif -/* NOTE: Crypto functions are set based on availability and by the following - * order of preference. +/* NOTE: Message Digest functions are set based on availability and by the + * following order of preference. * 1. libc * 2. libc2 * 3. libc3 @@ -1227,7 +1227,7 @@ __archive_stub_sha512final(archive_sha512_ctx *ctx, void *md) * 7. libmd * 8. Windows API */ -const struct archive_crypto __archive_crypto = +const struct archive_digest __archive_digest = { /* MD5 */ #if defined(ARCHIVE_CRYPTO_MD5_LIBC) @@ -1412,7 +1412,7 @@ const struct archive_crypto __archive_crypto = #elif defined(ARCHIVE_CRYPTO_SHA512_NETTLE) &__archive_nettle_sha512init, &__archive_nettle_sha512update, - &__archive_nettle_sha512final, + &__archive_nettle_sha512final #elif defined(ARCHIVE_CRYPTO_SHA512_OPENSSL) &__archive_openssl_sha512init, &__archive_openssl_sha512update, diff --git a/libarchive/archive_crypto_private.h b/libarchive/archive_digest_private.h similarity index 93% rename from libarchive/archive_crypto_private.h rename to libarchive/archive_digest_private.h index f8b1fb3c3f54..77fad5806fdd 100644 --- a/libarchive/archive_crypto_private.h +++ b/libarchive/archive_digest_private.h @@ -264,11 +264,11 @@ typedef unsigned char archive_sha512_ctx; #define ARCHIVE_HAS_MD5 #endif #define archive_md5_init(ctx)\ - __archive_crypto.md5init(ctx) + __archive_digest.md5init(ctx) #define archive_md5_final(ctx, md)\ - __archive_crypto.md5final(ctx, md) + __archive_digest.md5final(ctx, md) #define archive_md5_update(ctx, buf, n)\ - __archive_crypto.md5update(ctx, buf, n) + __archive_digest.md5update(ctx, buf, n) #if defined(ARCHIVE_CRYPTO_RMD160_LIBC) ||\ defined(ARCHIVE_CRYPTO_RMD160_NETTLE) ||\ @@ -276,11 +276,11 @@ typedef unsigned char archive_sha512_ctx; #define ARCHIVE_HAS_RMD160 #endif #define archive_rmd160_init(ctx)\ - __archive_crypto.rmd160init(ctx) + __archive_digest.rmd160init(ctx) #define archive_rmd160_final(ctx, md)\ - __archive_crypto.rmd160final(ctx, md) + __archive_digest.rmd160final(ctx, md) #define archive_rmd160_update(ctx, buf, n)\ - __archive_crypto.rmd160update(ctx, buf, n) + __archive_digest.rmd160update(ctx, buf, n) #if defined(ARCHIVE_CRYPTO_SHA1_LIBC) ||\ defined(ARCHIVE_CRYPTO_SHA1_LIBMD) || \ @@ -291,11 +291,11 @@ typedef unsigned char archive_sha512_ctx; #define ARCHIVE_HAS_SHA1 #endif #define archive_sha1_init(ctx)\ - __archive_crypto.sha1init(ctx) + __archive_digest.sha1init(ctx) #define archive_sha1_final(ctx, md)\ - __archive_crypto.sha1final(ctx, md) + __archive_digest.sha1final(ctx, md) #define archive_sha1_update(ctx, buf, n)\ - __archive_crypto.sha1update(ctx, buf, n) + __archive_digest.sha1update(ctx, buf, n) #if defined(ARCHIVE_CRYPTO_SHA256_LIBC) ||\ defined(ARCHIVE_CRYPTO_SHA256_LIBC2) ||\ @@ -308,11 +308,11 @@ typedef unsigned char archive_sha512_ctx; #define ARCHIVE_HAS_SHA256 #endif #define archive_sha256_init(ctx)\ - __archive_crypto.sha256init(ctx) + __archive_digest.sha256init(ctx) #define archive_sha256_final(ctx, md)\ - __archive_crypto.sha256final(ctx, md) + __archive_digest.sha256final(ctx, md) #define archive_sha256_update(ctx, buf, n)\ - __archive_crypto.sha256update(ctx, buf, n) + __archive_digest.sha256update(ctx, buf, n) #if defined(ARCHIVE_CRYPTO_SHA384_LIBC) ||\ defined(ARCHIVE_CRYPTO_SHA384_LIBC2) ||\ @@ -324,11 +324,11 @@ typedef unsigned char archive_sha512_ctx; #define ARCHIVE_HAS_SHA384 #endif #define archive_sha384_init(ctx)\ - __archive_crypto.sha384init(ctx) + __archive_digest.sha384init(ctx) #define archive_sha384_final(ctx, md)\ - __archive_crypto.sha384final(ctx, md) + __archive_digest.sha384final(ctx, md) #define archive_sha384_update(ctx, buf, n)\ - __archive_crypto.sha384update(ctx, buf, n) + __archive_digest.sha384update(ctx, buf, n) #if defined(ARCHIVE_CRYPTO_SHA512_LIBC) ||\ defined(ARCHIVE_CRYPTO_SHA512_LIBC2) ||\ @@ -341,14 +341,14 @@ typedef unsigned char archive_sha512_ctx; #define ARCHIVE_HAS_SHA512 #endif #define archive_sha512_init(ctx)\ - __archive_crypto.sha512init(ctx) + __archive_digest.sha512init(ctx) #define archive_sha512_final(ctx, md)\ - __archive_crypto.sha512final(ctx, md) + __archive_digest.sha512final(ctx, md) #define archive_sha512_update(ctx, buf, n)\ - __archive_crypto.sha512update(ctx, buf, n) + __archive_digest.sha512update(ctx, buf, n) -/* Minimal interface to crypto functionality for internal use in libarchive */ -struct archive_crypto +/* Minimal interface to digest functionality for internal use in libarchive */ +struct archive_digest { /* Message Digest */ int (*md5init)(archive_md5_ctx *ctx); @@ -371,6 +371,6 @@ struct archive_crypto int (*sha512final)(archive_sha512_ctx *, void *); }; -extern const struct archive_crypto __archive_crypto; +extern const struct archive_digest __archive_digest; #endif diff --git a/libarchive/archive_endian.h b/libarchive/archive_endian.h index 68123b0dd6a3..1c48563b137d 100644 --- a/libarchive/archive_endian.h +++ b/libarchive/archive_endian.h @@ -44,10 +44,16 @@ * - Watcom C++ in C code. (For any version?) * - SGI MIPSpro * - Microsoft Visual C++ 6.0 (supposedly newer versions too) + * - IBM VisualAge 6 (XL v6) + * - Sun WorkShop C (SunPro) before 5.9 */ #if defined(__WATCOMC__) || defined(__sgi) || defined(__hpux) || defined(__BORLANDC__) #define inline -#elif defined(_MSC_VER) +#elif defined(__IBMC__) && __IBMC__ < 700 +#define inline +#elif defined(__SUNPRO_C) && __SUNPRO_C < 0x590 +#define inline +#elif defined(_MSC_VER) || defined(__osf__) #define inline __inline #endif @@ -58,7 +64,13 @@ archive_be16dec(const void *pp) { unsigned char const *p = (unsigned char const *)pp; - return ((p[0] << 8) | p[1]); + /* Store into unsigned temporaries before left shifting, to avoid + promotion to signed int and then left shifting into the sign bit, + which is undefined behaviour. */ + unsigned int p1 = p[1]; + unsigned int p0 = p[0]; + + return ((p0 << 8) | p1); } static inline uint32_t @@ -66,7 +78,15 @@ archive_be32dec(const void *pp) { unsigned char const *p = (unsigned char const *)pp; - return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); + /* Store into unsigned temporaries before left shifting, to avoid + promotion to signed int and then left shifting into the sign bit, + which is undefined behaviour. */ + unsigned int p3 = p[3]; + unsigned int p2 = p[2]; + unsigned int p1 = p[1]; + unsigned int p0 = p[0]; + + return ((p0 << 24) | (p1 << 16) | (p2 << 8) | p3); } static inline uint64_t @@ -82,7 +102,13 @@ archive_le16dec(const void *pp) { unsigned char const *p = (unsigned char const *)pp; - return ((p[1] << 8) | p[0]); + /* Store into unsigned temporaries before left shifting, to avoid + promotion to signed int and then left shifting into the sign bit, + which is undefined behaviour. */ + unsigned int p1 = p[1]; + unsigned int p0 = p[0]; + + return ((p1 << 8) | p0); } static inline uint32_t @@ -90,7 +116,15 @@ archive_le32dec(const void *pp) { unsigned char const *p = (unsigned char const *)pp; - return ((p[3] << 24) | (p[2] << 16) | (p[1] << 8) | p[0]); + /* Store into unsigned temporaries before left shifting, to avoid + promotion to signed int and then left shifting into the sign bit, + which is undefined behaviour. */ + unsigned int p3 = p[3]; + unsigned int p2 = p[2]; + unsigned int p1 = p[1]; + unsigned int p0 = p[0]; + + return ((p3 << 24) | (p2 << 16) | (p1 << 8) | p0); } static inline uint64_t diff --git a/libarchive/archive_entry.3 b/libarchive/archive_entry.3 index f77f385f2e2c..f5e22af85122 100644 --- a/libarchive/archive_entry.3 +++ b/libarchive/archive_entry.3 @@ -131,11 +131,11 @@ be discarded in favor of the new data. .\" .Sh RETURN VALUES .\" .Sh ERRORS .Sh SEE ALSO -.Xr archive 3 , .Xr archive_entry_acl 3 , .Xr archive_entry_paths 3 , .Xr archive_entry_perms 3 , .Xr archive_entry_time 3 +.Xr libarchive 3 , .Sh HISTORY The .Nm libarchive diff --git a/libarchive/archive_entry.c b/libarchive/archive_entry.c index 386e51d473e8..4ac196608938 100644 --- a/libarchive/archive_entry.c +++ b/libarchive/archive_entry.c @@ -201,6 +201,9 @@ archive_entry_clone(struct archive_entry *entry) entry2->ae_set = entry->ae_set; archive_mstring_copy(&entry2->ae_uname, &entry->ae_uname); + /* Copy encryption status */ + entry2->encryption = entry->encryption; + /* Copy ACL data over. */ archive_acl_copy(&entry2->acl, &entry->acl); @@ -415,6 +418,18 @@ archive_entry_gname(struct archive_entry *entry) return (NULL); } +const char * +archive_entry_gname_utf8(struct archive_entry *entry) +{ + const char *p; + if (archive_mstring_get_utf8(entry->archive, &entry->ae_gname, &p) == 0) + return (p); + if (errno == ENOMEM) + __archive_errx(1, "No memory"); + return (NULL); +} + + const wchar_t * archive_entry_gname_w(struct archive_entry *entry) { @@ -447,6 +462,20 @@ archive_entry_hardlink(struct archive_entry *entry) return (NULL); } +const char * +archive_entry_hardlink_utf8(struct archive_entry *entry) +{ + const char *p; + if ((entry->ae_set & AE_SET_HARDLINK) == 0) + return (NULL); + if (archive_mstring_get_utf8( + entry->archive, &entry->ae_hardlink, &p) == 0) + return (p); + if (errno == ENOMEM) + __archive_errx(1, "No memory"); + return (NULL); +} + const wchar_t * archive_entry_hardlink_w(struct archive_entry *entry) { @@ -533,6 +562,18 @@ archive_entry_pathname(struct archive_entry *entry) return (NULL); } +const char * +archive_entry_pathname_utf8(struct archive_entry *entry) +{ + const char *p; + if (archive_mstring_get_utf8( + entry->archive, &entry->ae_pathname, &p) == 0) + return (p); + if (errno == ENOMEM) + __archive_errx(1, "No memory"); + return (NULL); +} + const wchar_t * archive_entry_pathname_w(struct archive_entry *entry) { @@ -634,6 +675,20 @@ archive_entry_symlink(struct archive_entry *entry) return (NULL); } +const char * +archive_entry_symlink_utf8(struct archive_entry *entry) +{ + const char *p; + if ((entry->ae_set & AE_SET_SYMLINK) == 0) + return (NULL); + if (archive_mstring_get_utf8( + entry->archive, &entry->ae_symlink, &p) == 0) + return (p); + if (errno == ENOMEM) + __archive_errx(1, "No memory"); + return (NULL); +} + const wchar_t * archive_entry_symlink_w(struct archive_entry *entry) { @@ -677,6 +732,17 @@ archive_entry_uname(struct archive_entry *entry) return (NULL); } +const char * +archive_entry_uname_utf8(struct archive_entry *entry) +{ + const char *p; + if (archive_mstring_get_utf8(entry->archive, &entry->ae_uname, &p) == 0) + return (p); + if (errno == ENOMEM) + __archive_errx(1, "No memory"); + return (NULL); +} + const wchar_t * archive_entry_uname_w(struct archive_entry *entry) { @@ -695,6 +761,24 @@ _archive_entry_uname_l(struct archive_entry *entry, return (archive_mstring_get_mbs_l(&entry->ae_uname, p, len, sc)); } +int +archive_entry_is_data_encrypted(struct archive_entry *entry) +{ + return ((entry->encryption & AE_ENCRYPTION_DATA) == AE_ENCRYPTION_DATA); +} + +int +archive_entry_is_metadata_encrypted(struct archive_entry *entry) +{ + return ((entry->encryption & AE_ENCRYPTION_METADATA) == AE_ENCRYPTION_METADATA); +} + +int +archive_entry_is_encrypted(struct archive_entry *entry) +{ + return (entry->encryption & (AE_ENCRYPTION_DATA|AE_ENCRYPTION_METADATA)); +} + /* * Functions to set archive_entry properties. */ @@ -747,6 +831,12 @@ archive_entry_set_gname(struct archive_entry *entry, const char *name) archive_mstring_copy_mbs(&entry->ae_gname, name); } +void +archive_entry_set_gname_utf8(struct archive_entry *entry, const char *name) +{ + archive_mstring_copy_utf8(&entry->ae_gname, name); +} + void archive_entry_copy_gname(struct archive_entry *entry, const char *name) { @@ -803,6 +893,16 @@ archive_entry_set_hardlink(struct archive_entry *entry, const char *target) entry->ae_set &= ~AE_SET_HARDLINK; } +void +archive_entry_set_hardlink_utf8(struct archive_entry *entry, const char *target) +{ + archive_mstring_copy_utf8(&entry->ae_hardlink, target); + if (target != NULL) + entry->ae_set |= AE_SET_HARDLINK; + else + entry->ae_set &= ~AE_SET_HARDLINK; +} + void archive_entry_copy_hardlink(struct archive_entry *entry, const char *target) { @@ -941,6 +1041,15 @@ archive_entry_set_link(struct archive_entry *entry, const char *target) archive_mstring_copy_mbs(&entry->ae_hardlink, target); } +void +archive_entry_set_link_utf8(struct archive_entry *entry, const char *target) +{ + if (entry->ae_set & AE_SET_SYMLINK) + archive_mstring_copy_utf8(&entry->ae_symlink, target); + else + archive_mstring_copy_utf8(&entry->ae_hardlink, target); +} + /* Set symlink if symlink is already set, else set hardlink. */ void archive_entry_copy_link(struct archive_entry *entry, const char *target) @@ -1030,6 +1139,12 @@ archive_entry_set_pathname(struct archive_entry *entry, const char *name) archive_mstring_copy_mbs(&entry->ae_pathname, name); } +void +archive_entry_set_pathname_utf8(struct archive_entry *entry, const char *name) +{ + archive_mstring_copy_utf8(&entry->ae_pathname, name); +} + void archive_entry_copy_pathname(struct archive_entry *entry, const char *name) { @@ -1130,6 +1245,16 @@ archive_entry_set_symlink(struct archive_entry *entry, const char *linkname) entry->ae_set &= ~AE_SET_SYMLINK; } +void +archive_entry_set_symlink_utf8(struct archive_entry *entry, const char *linkname) +{ + archive_mstring_copy_utf8(&entry->ae_symlink, linkname); + if (linkname != NULL) + entry->ae_set |= AE_SET_SYMLINK; + else + entry->ae_set &= ~AE_SET_SYMLINK; +} + void archive_entry_copy_symlink(struct archive_entry *entry, const char *linkname) { @@ -1193,6 +1318,12 @@ archive_entry_set_uname(struct archive_entry *entry, const char *name) archive_mstring_copy_mbs(&entry->ae_uname, name); } +void +archive_entry_set_uname_utf8(struct archive_entry *entry, const char *name) +{ + archive_mstring_copy_utf8(&entry->ae_uname, name); +} + void archive_entry_copy_uname(struct archive_entry *entry, const char *name) { @@ -1216,6 +1347,26 @@ archive_entry_update_uname_utf8(struct archive_entry *entry, const char *name) return (0); } +void +archive_entry_set_is_data_encrypted(struct archive_entry *entry, char is_encrypted) +{ + if (is_encrypted) { + entry->encryption |= AE_ENCRYPTION_DATA; + } else { + entry->encryption &= ~AE_ENCRYPTION_DATA; + } +} + +void +archive_entry_set_is_metadata_encrypted(struct archive_entry *entry, char is_encrypted) +{ + if (is_encrypted) { + entry->encryption |= AE_ENCRYPTION_METADATA; + } else { + entry->encryption &= ~AE_ENCRYPTION_METADATA; + } +} + int _archive_entry_copy_uname_l(struct archive_entry *entry, const char *name, size_t len, struct archive_string_conv *sc) @@ -1588,19 +1739,23 @@ ae_strtofflags(const char *s, unsigned long *setp, unsigned long *clrp) while (*start == '\t' || *start == ' ' || *start == ',') start++; while (*start != '\0') { + size_t length; /* Locate end of token. */ end = start; while (*end != '\0' && *end != '\t' && *end != ' ' && *end != ',') end++; + length = end - start; for (flag = flags; flag->name != NULL; flag++) { - if (memcmp(start, flag->name, end - start) == 0) { + size_t flag_length = strlen(flag->name); + if (length == flag_length + && memcmp(start, flag->name, length) == 0) { /* Matched "noXXXX", so reverse the sense. */ clear |= flag->set; set |= flag->clear; break; - } else if (memcmp(start, flag->name + 2, end - start) - == 0) { + } else if (length == flag_length - 2 + && memcmp(start, flag->name + 2, length) == 0) { /* Matched "XXXX", so don't reverse. */ set |= flag->set; clear |= flag->clear; @@ -1652,19 +1807,23 @@ ae_wcstofflags(const wchar_t *s, unsigned long *setp, unsigned long *clrp) while (*start == L'\t' || *start == L' ' || *start == L',') start++; while (*start != L'\0') { + size_t length; /* Locate end of token. */ end = start; while (*end != L'\0' && *end != L'\t' && *end != L' ' && *end != L',') end++; + length = end - start; for (flag = flags; flag->wname != NULL; flag++) { - if (wmemcmp(start, flag->wname, end - start) == 0) { + size_t flag_length = wcslen(flag->wname); + if (length == flag_length + && wmemcmp(start, flag->wname, length) == 0) { /* Matched "noXXXX", so reverse the sense. */ clear |= flag->set; set |= flag->clear; break; - } else if (wmemcmp(start, flag->wname + 2, end - start) - == 0) { + } else if (length == flag_length - 2 + && wmemcmp(start, flag->wname + 2, length) == 0) { /* Matched "XXXX", so don't reverse. */ set |= flag->set; clear |= flag->clear; diff --git a/libarchive/archive_entry.h b/libarchive/archive_entry.h index a9050652e6a4..423c8d3ff7b1 100644 --- a/libarchive/archive_entry.h +++ b/libarchive/archive_entry.h @@ -29,7 +29,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3001002 +#define ARCHIVE_VERSION_NUMBER 3002000 /* * Note: archive_entry.h is for use outside of libarchive; the @@ -48,14 +48,20 @@ #endif /* Get a suitable 64-bit integer type. */ -#if defined(_WIN32) && !defined(__CYGWIN__) -# define __LA_INT64_T __int64 -#else -#include -# if defined(_SCO_DS) -# define __LA_INT64_T long long +#if !defined(__LA_INT64_T_DEFINED) +# if ARCHIVE_VERSION_NUMBER < 4000000 +#define __LA_INT64_T la_int64_t +# endif +#define __LA_INT64_T_DEFINED +# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__WATCOMC__) +typedef __int64 la_int64_t; # else -# define __LA_INT64_T int64_t +#include +# if defined(_SCO_DS) || defined(__osf__) +typedef long long la_int64_t; +# else +typedef int64_t la_int64_t; +# endif # endif #endif @@ -63,12 +69,17 @@ #if ARCHIVE_VERSION_NUMBER >= 3999000 /* Switch to plain 'int' for libarchive 4.0. It's less broken than 'mode_t' */ # define __LA_MODE_T int -#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) +#elif defined(_WIN32) && !defined(__CYGWIN__) && !defined(__BORLANDC__) && !defined(__WATCOMC__) # define __LA_MODE_T unsigned short #else # define __LA_MODE_T mode_t #endif +/* Large file support for Android */ +#ifdef __ANDROID__ +#include "android_lf.h" +#endif + /* * On Windows, define LIBARCHIVE_STATIC if you're building or using a * .lib. The default here assumes you're building a DLL. Only @@ -206,13 +217,15 @@ __LA_DECL void archive_entry_fflags(struct archive_entry *, unsigned long * /* set */, unsigned long * /* clear */); __LA_DECL const char *archive_entry_fflags_text(struct archive_entry *); -__LA_DECL __LA_INT64_T archive_entry_gid(struct archive_entry *); +__LA_DECL la_int64_t archive_entry_gid(struct archive_entry *); __LA_DECL const char *archive_entry_gname(struct archive_entry *); +__LA_DECL const char *archive_entry_gname_utf8(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_gname_w(struct archive_entry *); __LA_DECL const char *archive_entry_hardlink(struct archive_entry *); +__LA_DECL const char *archive_entry_hardlink_utf8(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_hardlink_w(struct archive_entry *); -__LA_DECL __LA_INT64_T archive_entry_ino(struct archive_entry *); -__LA_DECL __LA_INT64_T archive_entry_ino64(struct archive_entry *); +__LA_DECL la_int64_t archive_entry_ino(struct archive_entry *); +__LA_DECL la_int64_t archive_entry_ino64(struct archive_entry *); __LA_DECL int archive_entry_ino_is_set(struct archive_entry *); __LA_DECL __LA_MODE_T archive_entry_mode(struct archive_entry *); __LA_DECL time_t archive_entry_mtime(struct archive_entry *); @@ -220,6 +233,7 @@ __LA_DECL long archive_entry_mtime_nsec(struct archive_entry *); __LA_DECL int archive_entry_mtime_is_set(struct archive_entry *); __LA_DECL unsigned int archive_entry_nlink(struct archive_entry *); __LA_DECL const char *archive_entry_pathname(struct archive_entry *); +__LA_DECL const char *archive_entry_pathname_utf8(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_pathname_w(struct archive_entry *); __LA_DECL __LA_MODE_T archive_entry_perm(struct archive_entry *); __LA_DECL dev_t archive_entry_rdev(struct archive_entry *); @@ -227,14 +241,19 @@ __LA_DECL dev_t archive_entry_rdevmajor(struct archive_entry *); __LA_DECL dev_t archive_entry_rdevminor(struct archive_entry *); __LA_DECL const char *archive_entry_sourcepath(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_sourcepath_w(struct archive_entry *); -__LA_DECL __LA_INT64_T archive_entry_size(struct archive_entry *); +__LA_DECL la_int64_t archive_entry_size(struct archive_entry *); __LA_DECL int archive_entry_size_is_set(struct archive_entry *); __LA_DECL const char *archive_entry_strmode(struct archive_entry *); __LA_DECL const char *archive_entry_symlink(struct archive_entry *); +__LA_DECL const char *archive_entry_symlink_utf8(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_symlink_w(struct archive_entry *); -__LA_DECL __LA_INT64_T archive_entry_uid(struct archive_entry *); +__LA_DECL la_int64_t archive_entry_uid(struct archive_entry *); __LA_DECL const char *archive_entry_uname(struct archive_entry *); +__LA_DECL const char *archive_entry_uname_utf8(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_uname_w(struct archive_entry *); +__LA_DECL int archive_entry_is_data_encrypted(struct archive_entry *); +__LA_DECL int archive_entry_is_metadata_encrypted(struct archive_entry *); +__LA_DECL int archive_entry_is_encrypted(struct archive_entry *); /* * Set fields in an archive_entry. @@ -266,18 +285,21 @@ __LA_DECL const char *archive_entry_copy_fflags_text(struct archive_entry *, const char *); __LA_DECL const wchar_t *archive_entry_copy_fflags_text_w(struct archive_entry *, const wchar_t *); -__LA_DECL void archive_entry_set_gid(struct archive_entry *, __LA_INT64_T); +__LA_DECL void archive_entry_set_gid(struct archive_entry *, la_int64_t); __LA_DECL void archive_entry_set_gname(struct archive_entry *, const char *); +__LA_DECL void archive_entry_set_gname_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_gname(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_gname_w(struct archive_entry *, const wchar_t *); __LA_DECL int archive_entry_update_gname_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_set_hardlink(struct archive_entry *, const char *); +__LA_DECL void archive_entry_set_hardlink_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_hardlink(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_hardlink_w(struct archive_entry *, const wchar_t *); __LA_DECL int archive_entry_update_hardlink_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_ino(struct archive_entry *, __LA_INT64_T); -__LA_DECL void archive_entry_set_ino64(struct archive_entry *, __LA_INT64_T); +__LA_DECL void archive_entry_set_ino(struct archive_entry *, la_int64_t); +__LA_DECL void archive_entry_set_ino64(struct archive_entry *, la_int64_t); __LA_DECL void archive_entry_set_link(struct archive_entry *, const char *); +__LA_DECL void archive_entry_set_link_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_link(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_link_w(struct archive_entry *, const wchar_t *); __LA_DECL int archive_entry_update_link_utf8(struct archive_entry *, const char *); @@ -286,6 +308,7 @@ __LA_DECL void archive_entry_set_mtime(struct archive_entry *, time_t, long); __LA_DECL void archive_entry_unset_mtime(struct archive_entry *); __LA_DECL void archive_entry_set_nlink(struct archive_entry *, unsigned int); __LA_DECL void archive_entry_set_pathname(struct archive_entry *, const char *); +__LA_DECL void archive_entry_set_pathname_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_pathname(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *); __LA_DECL int archive_entry_update_pathname_utf8(struct archive_entry *, const char *); @@ -293,19 +316,23 @@ __LA_DECL void archive_entry_set_perm(struct archive_entry *, __LA_MODE_T); __LA_DECL void archive_entry_set_rdev(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, dev_t); __LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, dev_t); -__LA_DECL void archive_entry_set_size(struct archive_entry *, __LA_INT64_T); +__LA_DECL void archive_entry_set_size(struct archive_entry *, la_int64_t); __LA_DECL void archive_entry_unset_size(struct archive_entry *); __LA_DECL void archive_entry_copy_sourcepath(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_sourcepath_w(struct archive_entry *, const wchar_t *); __LA_DECL void archive_entry_set_symlink(struct archive_entry *, const char *); +__LA_DECL void archive_entry_set_symlink_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_symlink(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_symlink_w(struct archive_entry *, const wchar_t *); __LA_DECL int archive_entry_update_symlink_utf8(struct archive_entry *, const char *); -__LA_DECL void archive_entry_set_uid(struct archive_entry *, __LA_INT64_T); +__LA_DECL void archive_entry_set_uid(struct archive_entry *, la_int64_t); __LA_DECL void archive_entry_set_uname(struct archive_entry *, const char *); +__LA_DECL void archive_entry_set_uname_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_uname(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_uname_w(struct archive_entry *, const wchar_t *); __LA_DECL int archive_entry_update_uname_utf8(struct archive_entry *, const char *); +__LA_DECL void archive_entry_set_is_data_encrypted(struct archive_entry *, char is_encrypted); +__LA_DECL void archive_entry_set_is_metadata_encrypted(struct archive_entry *, char is_encrypted); /* * Routines to bulk copy fields to/from a platform-native "struct * stat." Libarchive used to just store a struct stat inside of each @@ -514,7 +541,7 @@ __LA_DECL int archive_entry_xattr_next(struct archive_entry *, __LA_DECL void archive_entry_sparse_clear(struct archive_entry *); __LA_DECL void archive_entry_sparse_add_entry(struct archive_entry *, - __LA_INT64_T /* offset */, __LA_INT64_T /* length */); + la_int64_t /* offset */, la_int64_t /* length */); /* * To retrieve the xattr list, first "reset", then repeatedly ask for the @@ -524,7 +551,7 @@ __LA_DECL void archive_entry_sparse_add_entry(struct archive_entry *, __LA_DECL int archive_entry_sparse_count(struct archive_entry *); __LA_DECL int archive_entry_sparse_reset(struct archive_entry *); __LA_DECL int archive_entry_sparse_next(struct archive_entry *, - __LA_INT64_T * /* offset */, __LA_INT64_T * /* length */); + la_int64_t * /* offset */, la_int64_t * /* length */); /* * Utility to match up hardlinks. diff --git a/libarchive/archive_entry_acl.3 b/libarchive/archive_entry_acl.3 index f5c337733ce8..5aff99682352 100644 --- a/libarchive/archive_entry_acl.3 +++ b/libarchive/archive_entry_acl.3 @@ -226,8 +226,8 @@ The returned long string is valid until the next call to or .Fn archive_entry_acl_text_w . .Sh SEE ALSO -.Xr archive 3 , .Xr archive_entry 3 +.Xr libarchive 3 , .Sh BUGS .Dv ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID and diff --git a/libarchive/archive_entry_copy_stat.c b/libarchive/archive_entry_copy_stat.c index 37d4d6edbd86..ac83868e8f8a 100644 --- a/libarchive/archive_entry_copy_stat.c +++ b/libarchive/archive_entry_copy_stat.c @@ -44,6 +44,10 @@ archive_entry_copy_stat(struct archive_entry *entry, const struct stat *st) archive_entry_set_atime(entry, st->st_atime, st->st_atim.tv_nsec); archive_entry_set_ctime(entry, st->st_ctime, st->st_ctim.tv_nsec); archive_entry_set_mtime(entry, st->st_mtime, st->st_mtim.tv_nsec); +#elif HAVE_STRUCT_STAT_ST_MTIME_NSEC + archive_entry_set_atime(entry, st->st_atime, st->st_atime_nsec); + archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_nsec); + archive_entry_set_mtime(entry, st->st_mtime, st->st_mtime_nsec); #elif HAVE_STRUCT_STAT_ST_MTIME_N archive_entry_set_atime(entry, st->st_atime, st->st_atime_n); archive_entry_set_ctime(entry, st->st_ctime, st->st_ctime_n); diff --git a/libarchive/archive_entry_paths.3 b/libarchive/archive_entry_paths.3 index 51c8b8c8e6d8..fd22cf7e20c1 100644 --- a/libarchive/archive_entry_paths.3 +++ b/libarchive/archive_entry_paths.3 @@ -149,5 +149,5 @@ It doesn't have a corresponding get accessor function. is an alias for .Fn archive_entry_copy_XXX . .Sh SEE ALSO -.Xr archive 3 , .Xr archive_entry 3 +.Xr libarchive 3 , diff --git a/libarchive/archive_entry_perms.3 b/libarchive/archive_entry_perms.3 index 5b7b5d955a8d..340c5ea72486 100644 --- a/libarchive/archive_entry_perms.3 +++ b/libarchive/archive_entry_perms.3 @@ -194,11 +194,11 @@ every name that is recognized. .Xr strtofflags 3 , which stops parsing at the first unrecognized name.) .Sh SEE ALSO -.Xr archive 3 , .Xr archive_entry 3 , .Xr archive_entry_acl 3 , .Xr archive_read_disk 3 , .Xr archive_write_disk 3 +.Xr libarchive 3 , .Sh BUGS The platform types .Vt uid_t diff --git a/libarchive/archive_entry_private.h b/libarchive/archive_entry_private.h index e3547c3e3187..c69233e68bd3 100644 --- a/libarchive/archive_entry_private.h +++ b/libarchive/archive_entry_private.h @@ -154,6 +154,11 @@ struct archive_entry { /* Not used within libarchive; useful for some clients. */ struct archive_mstring ae_sourcepath; /* Path this entry is sourced from. */ +#define AE_ENCRYPTION_NONE 0 +#define AE_ENCRYPTION_DATA 1 +#define AE_ENCRYPTION_METADATA 2 + char encryption; + void *mac_metadata; size_t mac_metadata_size; diff --git a/libarchive/archive_entry_sparse.c b/libarchive/archive_entry_sparse.c index 10c54474a379..fed74f5121d7 100644 --- a/libarchive/archive_entry_sparse.c +++ b/libarchive/archive_entry_sparse.c @@ -58,7 +58,7 @@ archive_entry_sparse_add_entry(struct archive_entry *entry, if (offset < 0 || length < 0) /* Invalid value */ return; - if (offset + length < 0 || + if (offset > INT64_MAX - length || offset + length > archive_entry_size(entry)) /* A value of "length" parameter is too large. */ return; diff --git a/libarchive/archive_entry_stat.3 b/libarchive/archive_entry_stat.3 index 84a4ea12a0ad..26611e4c62e9 100644 --- a/libarchive/archive_entry_stat.3 +++ b/libarchive/archive_entry_stat.3 @@ -226,7 +226,7 @@ and are used by .Xr archive_entry_linkify 3 to find hardlinks. -The pair of device and inode is suppossed to identify hardlinked files. +The pair of device and inode is supposed to identify hardlinked files. .Pp The device major and minor number can be obtained independently using .Fn archive_entry_devmajor @@ -267,8 +267,8 @@ platforms. Some archive formats use the combined form, while other formats use the split form. .Sh SEE ALSO -.Xr archive 3 , .Xr archive_entry_acl 3 , .Xr archive_entry_perms 3 , .Xr archive_entry_time 3 , +.Xr libarchive 3 , .Xr stat 2 diff --git a/libarchive/archive_entry_time.3 b/libarchive/archive_entry_time.3 index 17c658a65817..186452159370 100644 --- a/libarchive/archive_entry_time.3 +++ b/libarchive/archive_entry_time.3 @@ -113,8 +113,8 @@ The current state can be queried using .Fn XXX_is_set . Unset time fields have a second and nanosecond field of 0. .Sh SEE ALSO -.Xr archive 3 , .Xr archive_entry 3 +.Xr libarchive 3 , .Sh HISTORY The .Nm libarchive diff --git a/libarchive/archive_entry_xattr.c b/libarchive/archive_entry_xattr.c index a3efe7ca8d9f..05eb90f1afd1 100644 --- a/libarchive/archive_entry_xattr.c +++ b/libarchive/archive_entry_xattr.c @@ -98,7 +98,10 @@ archive_entry_xattr_add_entry(struct archive_entry *entry, /* XXX Error XXX */ return; - xp->name = strdup(name); + if ((xp->name = strdup(name)) == NULL) + /* XXX Error XXX */ + return; + if ((xp->value = malloc(size)) != NULL) { memcpy(xp->value, value, size); xp->size = size; diff --git a/libarchive/archive_getdate.c b/libarchive/archive_getdate.c index f8b5a28d583d..beb0cba2ed3b 100644 --- a/libarchive/archive_getdate.c +++ b/libarchive/archive_getdate.c @@ -38,8 +38,8 @@ __FBSDID("$FreeBSD$"); #include #include -/* This file defines a single public function. */ -time_t __archive_get_date(time_t now, char *); +#define __LIBARCHIVE_BUILD 1 +#include "archive_getdate.h" /* Basic time units. */ #define EPOCH 1970 @@ -369,8 +369,8 @@ relunitphrase(struct gdstate *gds) && gds->tokenp[1].token == tSEC_UNIT) { /* "1 day" */ gds->HaveRel++; - gds->RelSeconds += gds->tokenp[1].value * gds->tokenp[2].value; - gds->tokenp += 3; + gds->RelSeconds += gds->tokenp[0].value * gds->tokenp[1].value; + gds->tokenp += 2; return 1; } if (gds->tokenp[0].token == '-' @@ -403,7 +403,7 @@ relunitphrase(struct gdstate *gds) /* "now", "tomorrow" */ gds->HaveRel++; gds->RelSeconds += gds->tokenp[0].value; - ++gds->tokenp; + gds->tokenp += 1; return 1; } if (gds->tokenp[0].token == tMONTH_UNIT) { @@ -782,7 +782,7 @@ RelativeMonth(time_t Start, time_t Timezone, time_t RelMonth) * Tokenizer. */ static int -nexttoken(char **in, time_t *value) +nexttoken(const char **in, time_t *value) { char c; char buff[64]; @@ -809,7 +809,7 @@ nexttoken(char **in, time_t *value) /* Try the next token in the word table first. */ /* This allows us to match "2nd", for example. */ { - char *src = *in; + const char *src = *in; const struct LEXICON *tp; unsigned i = 0; @@ -894,7 +894,7 @@ difftm (struct tm *a, struct tm *b) * TODO: tokens[] array should be dynamically sized. */ time_t -__archive_get_date(time_t now, char *p) +__archive_get_date(time_t now, const char *p) { struct token tokens[256]; struct gdstate _gds; @@ -1022,10 +1022,11 @@ int main(int argc, char **argv) { time_t d; + time_t now = time(NULL); while (*++argv != NULL) { (void)printf("Input: %s\n", *argv); - d = get_date(*argv); + d = get_date(now, *argv); if (d == -1) (void)printf("Bad format - couldn't convert.\n"); else diff --git a/libarchive/archive_getdate.h b/libarchive/archive_getdate.h new file mode 100644 index 000000000000..666ff5ff78b9 --- /dev/null +++ b/libarchive/archive_getdate.h @@ -0,0 +1,39 @@ +/*- + * Copyright (c) 2003-2015 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$ + */ + +#ifndef __LIBARCHIVE_BUILD +#error This header is only to be used internally to libarchive. +#endif + +#ifndef ARCHIVE_GETDATE_H_INCLUDED +#define ARCHIVE_GETDATE_H_INCLUDED + +#include + +time_t __archive_get_date(time_t now, const char *); + +#endif diff --git a/libarchive/archive_hmac.c b/libarchive/archive_hmac.c new file mode 100644 index 000000000000..7857c0ff3568 --- /dev/null +++ b/libarchive/archive_hmac.c @@ -0,0 +1,248 @@ +/*- +* Copyright (c) 2014 Michihiro NAKAJIMA +* 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 "archive_platform.h" + +#ifdef HAVE_STRING_H +#include +#endif +#include "archive.h" +#include "archive_hmac_private.h" + +/* + * On systems that do not support any recognized crypto libraries, + * the archive_hmac.c file is expected to define no usable symbols. + * + * But some compilers and linkers choke on empty object files, so + * define a public symbol that will always exist. This could + * be removed someday if this file gains another always-present + * symbol definition. + */ +int __libarchive_hmac_build_hack(void) { + return 0; +} + + +#ifdef ARCHIVE_HMAC_USE_Apple_CommonCrypto + +static int +__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) +{ + CCHmacInit(ctx, kCCHmacAlgSHA1, key, key_len); + return 0; +} + +static void +__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data, + size_t data_len) +{ + CCHmacUpdate(ctx, data, data_len); +} + +static void +__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len) +{ + CCHmacFinal(ctx, out); + *out_len = 20; +} + +static void +__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) +{ + memset(ctx, 0, sizeof(*ctx)); +} + +#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) + +static int +__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) +{ + BCRYPT_ALG_HANDLE hAlg; + BCRYPT_HASH_HANDLE hHash; + DWORD hash_len; + PBYTE hash; + ULONG result; + NTSTATUS status; + + ctx->hAlg = NULL; + status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_SHA1_ALGORITHM, + MS_PRIMITIVE_PROVIDER, BCRYPT_ALG_HANDLE_HMAC_FLAG); + if (!BCRYPT_SUCCESS(status)) + return -1; + status = BCryptGetProperty(hAlg, BCRYPT_HASH_LENGTH, (PUCHAR)&hash_len, + sizeof(hash_len), &result, 0); + if (!BCRYPT_SUCCESS(status)) { + BCryptCloseAlgorithmProvider(hAlg, 0); + return -1; + } + hash = (PBYTE)HeapAlloc(GetProcessHeap(), 0, hash_len); + if (hash == NULL) { + BCryptCloseAlgorithmProvider(hAlg, 0); + return -1; + } + status = BCryptCreateHash(hAlg, &hHash, NULL, 0, + (PUCHAR)key, (ULONG)key_len, BCRYPT_HASH_REUSABLE_FLAG); + if (!BCRYPT_SUCCESS(status)) { + BCryptCloseAlgorithmProvider(hAlg, 0); + HeapFree(GetProcessHeap(), 0, hash); + return -1; + } + + ctx->hAlg = hAlg; + ctx->hHash = hHash; + ctx->hash_len = hash_len; + ctx->hash = hash; + + return 0; +} + +static void +__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data, + size_t data_len) +{ + BCryptHashData(ctx->hHash, (PUCHAR)(uintptr_t)data, (ULONG)data_len, 0); +} + +static void +__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len) +{ + BCryptFinishHash(ctx->hHash, ctx->hash, ctx->hash_len, 0); + if (ctx->hash_len == *out_len) + memcpy(out, ctx->hash, *out_len); +} + +static void +__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) +{ + if (ctx->hAlg != NULL) { + BCryptCloseAlgorithmProvider(ctx->hAlg, 0); + HeapFree(GetProcessHeap(), 0, ctx->hash); + ctx->hAlg = NULL; + } +} + +#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_HMAC_H) + +static int +__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) +{ + hmac_sha1_set_key(ctx, key_len, key); + return 0; +} + +static void +__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data, + size_t data_len) +{ + hmac_sha1_update(ctx, data_len, data); +} + +static void +__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len) +{ + hmac_sha1_digest(ctx, (unsigned)*out_len, out); +} + +static void +__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) +{ + memset(ctx, 0, sizeof(*ctx)); +} + +#elif defined(HAVE_LIBCRYPTO) + +static int +__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) +{ + HMAC_CTX_init(ctx); + HMAC_Init(ctx, key, key_len, EVP_sha1()); + return 0; +} + +static void +__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data, + size_t data_len) +{ + HMAC_Update(ctx, data, data_len); +} + +static void +__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len) +{ + unsigned int len = (unsigned int)*out_len; + HMAC_Final(ctx, out, &len); + *out_len = len; +} + +static void +__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) +{ + HMAC_CTX_cleanup(ctx); + memset(ctx, 0, sizeof(*ctx)); +} + +#else + +/* Stub */ +static int +__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) +{ + (void)ctx;/* UNUSED */ + (void)key;/* UNUSED */ + (void)key_len;/* UNUSED */ + return -1; +} + +static void +__hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data, + size_t data_len) +{ + (void)ctx;/* UNUSED */ + (void)data;/* UNUSED */ + (void)data_len;/* UNUSED */ +} + +static void +__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len) +{ + (void)ctx;/* UNUSED */ + (void)out;/* UNUSED */ + (void)out_len;/* UNUSED */ +} + +static void +__hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx) +{ + (void)ctx;/* UNUSED */ +} + +#endif + +const struct archive_hmac __archive_hmac = { + &__hmac_sha1_init, + &__hmac_sha1_update, + &__hmac_sha1_final, + &__hmac_sha1_cleanup, +}; diff --git a/libarchive/archive_hmac_private.h b/libarchive/archive_hmac_private.h new file mode 100644 index 000000000000..64de743cb329 --- /dev/null +++ b/libarchive/archive_hmac_private.h @@ -0,0 +1,106 @@ +/*- +* Copyright (c) 2014 Michihiro NAKAJIMA +* 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. +*/ + +#ifndef __LIBARCHIVE_BUILD +#error This header is only to be used internally to libarchive. +#endif + +#ifndef ARCHIVE_HMAC_PRIVATE_H_INCLUDED +#define ARCHIVE_HMAC_PRIVATE_H_INCLUDED + +/* + * On systems that do not support any recognized crypto libraries, + * the archive_hmac.c file is expected to define no usable symbols. + * + * But some compilers and linkers choke on empty object files, so + * define a public symbol that will always exist. This could + * be removed someday if this file gains another always-present + * symbol definition. + */ +int __libarchive_hmac_build_hack(void); + +#ifdef __APPLE__ +# include +# if MAC_OS_X_VERSION_MAX_ALLOWED >= 1060 +# define ARCHIVE_HMAC_USE_Apple_CommonCrypto +# endif +#endif + +#ifdef ARCHIVE_HMAC_USE_Apple_CommonCrypto +#include + +typedef CCHmacContext archive_hmac_sha1_ctx; + +#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) +#include + +typedef struct { + BCRYPT_ALG_HANDLE hAlg; + BCRYPT_HASH_HANDLE hHash; + DWORD hash_len; + PBYTE hash; + +} archive_hmac_sha1_ctx; + +#elif defined(HAVE_LIBNETTLE) && defined(HAVE_NETTLE_HMAC_H) +#include + +typedef struct hmac_sha1_ctx archive_hmac_sha1_ctx; + +#elif defined(HAVE_LIBCRYPTO) +#include + +typedef HMAC_CTX archive_hmac_sha1_ctx; + +#else + +typedef int archive_hmac_sha1_ctx; + +#endif + + +/* HMAC */ +#define archive_hmac_sha1_init(ctx, key, key_len)\ + __archive_hmac.__hmac_sha1_init(ctx, key, key_len) +#define archive_hmac_sha1_update(ctx, data, data_len)\ + __archive_hmac.__hmac_sha1_update(ctx, data, data_len) +#define archive_hmac_sha1_final(ctx, out, out_len)\ + __archive_hmac.__hmac_sha1_final(ctx, out, out_len) +#define archive_hmac_sha1_cleanup(ctx)\ + __archive_hmac.__hmac_sha1_cleanup(ctx) + + +struct archive_hmac { + /* HMAC */ + int (*__hmac_sha1_init)(archive_hmac_sha1_ctx *, const uint8_t *, + size_t); + void (*__hmac_sha1_update)(archive_hmac_sha1_ctx *, const uint8_t *, + size_t); + void (*__hmac_sha1_final)(archive_hmac_sha1_ctx *, uint8_t *, size_t *); + void (*__hmac_sha1_cleanup)(archive_hmac_sha1_ctx *); +}; + +extern const struct archive_hmac __archive_hmac; +#endif /* ARCHIVE_HMAC_PRIVATE_H_INCLUDED */ diff --git a/libarchive/archive_match.c b/libarchive/archive_match.c index 6b6be9cb20b5..4c41badf1f86 100644 --- a/libarchive/archive_match.c +++ b/libarchive/archive_match.c @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include "archive.h" #include "archive_private.h" #include "archive_entry.h" +#include "archive_getdate.h" #include "archive_pathmatch.h" #include "archive_rb.h" #include "archive_string.h" @@ -184,7 +185,6 @@ static int time_excluded(struct archive_match *, struct archive_entry *); static int validate_time_flag(struct archive *, int, const char *); -time_t __archive_get_date(time_t now, const char *); #define get_date __archive_get_date static const struct archive_rb_tree_ops rb_ops_mbs = { @@ -580,6 +580,7 @@ add_pattern_from_file(struct archive_match *a, struct match_list *mlist, return (ARCHIVE_FATAL); } r = archive_read_support_format_raw(ar); + r = archive_read_support_format_empty(ar); if (r != ARCHIVE_OK) { archive_copy_error(&(a->archive), ar); archive_read_free(ar); @@ -596,9 +597,13 @@ add_pattern_from_file(struct archive_match *a, struct match_list *mlist, } r = archive_read_next_header(ar, &ae); if (r != ARCHIVE_OK) { - archive_copy_error(&(a->archive), ar); archive_read_free(ar); - return (r); + if (r == ARCHIVE_EOF) { + return (ARCHIVE_OK); + } else { + archive_copy_error(&(a->archive), ar); + return (r); + } } archive_string_init(&as); @@ -1152,7 +1157,7 @@ set_timefilter_pathname_mbs(struct archive_match *a, int timetype, { /* NOTE: stat() on Windows cannot handle nano seconds. */ HANDLE h; - WIN32_FIND_DATA d; + WIN32_FIND_DATAA d; if (path == NULL || *path == '\0') { archive_set_error(&(a->archive), EINVAL, "pathname is empty"); diff --git a/libarchive/archive_options.c b/libarchive/archive_options.c index 8af623931f01..dbf3e80e9024 100644 --- a/libarchive/archive_options.c +++ b/libarchive/archive_options.c @@ -42,9 +42,9 @@ _archive_set_option(struct archive *a, archive_check_magic(a, magic, ARCHIVE_STATE_NEW, fn); - mp = m != NULL && m[0] == '\0' ? NULL : m; - op = o != NULL && o[0] == '\0' ? NULL : o; - vp = v != NULL && v[0] == '\0' ? NULL : v; + mp = (m != NULL && m[0] != '\0') ? m : NULL; + op = (o != NULL && o[0] != '\0') ? o : NULL; + vp = (v != NULL && v[0] != '\0') ? v : NULL; if (op == NULL && vp == NULL) return (ARCHIVE_OK); diff --git a/libarchive/archive_pack_dev.c b/libarchive/archive_pack_dev.c new file mode 100644 index 000000000000..6b7b4726d6ea --- /dev/null +++ b/libarchive/archive_pack_dev.c @@ -0,0 +1,329 @@ +/* $NetBSD: pack_dev.c,v 1.12 2013/06/14 16:28:20 tsutsui Exp $ */ + +/*- + * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Charles M. Hannum. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +/* Originally from NetBSD's mknod(8) source. */ + +#include "archive_platform.h" + +#if HAVE_SYS_CDEFS_H +#include +#endif +#if !defined(lint) +__RCSID("$NetBSD$"); +#endif /* not lint */ + +#ifdef HAVE_LIMITS_H +#include +#endif + +#include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif + +#include "archive_pack_dev.h" + +static pack_t pack_netbsd; +static pack_t pack_freebsd; +static pack_t pack_8_8; +static pack_t pack_12_20; +static pack_t pack_14_18; +static pack_t pack_8_24; +static pack_t pack_bsdos; +static int compare_format(const void *, const void *); + +static const char iMajorError[] = "invalid major number"; +static const char iMinorError[] = "invalid minor number"; +static const char tooManyFields[] = "too many fields for format"; + +/* This is blatantly stolen from libarchive/archive_entry.c, + * in an attempt to get this to play nice on MinGW... */ +#if !defined(HAVE_MAJOR) && !defined(major) +/* Replacement for major/minor/makedev. */ +#define major(x) ((int)(0x00ff & ((x) >> 8))) +#define minor(x) ((int)(0xffff00ff & (x))) +#define makedev(maj,min) ((0xff00 & ((maj)<<8)) | (0xffff00ff & (min))) +#endif + +/* Play games to come up with a suitable makedev() definition. */ +#ifdef __QNXNTO__ +/* QNX. */ +#include +#define apd_makedev(maj, min) makedev(ND_LOCAL_NODE, (maj), (min)) +#elif defined makedev +/* There's a "makedev" macro. */ +#define apd_makedev(maj, min) makedev((maj), (min)) +#elif defined mkdev || ((defined _WIN32 || defined __WIN32__) && !defined(__CYGWIN__)) +/* Windows. */ +#define apd_makedev(maj, min) mkdev((maj), (min)) +#else +/* There's a "makedev" function. */ +#define apd_makedev(maj, min) makedev((maj), (min)) +#endif + +/* exported */ +dev_t +pack_native(int n, unsigned long numbers[], const char **error) +{ + dev_t dev = 0; + + if (n == 2) { + dev = apd_makedev(numbers[0], numbers[1]); + if ((unsigned long)major(dev) != numbers[0]) + *error = iMajorError; + else if ((unsigned long)minor(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +static dev_t +pack_netbsd(int n, unsigned long numbers[], const char **error) +{ + dev_t dev = 0; + + if (n == 2) { + dev = makedev_netbsd(numbers[0], numbers[1]); + if ((unsigned long)major_netbsd(dev) != numbers[0]) + *error = iMajorError; + else if ((unsigned long)minor_netbsd(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_freebsd(x) ((int32_t)(((x) & 0x0000ff00) >> 8)) +#define minor_freebsd(x) ((int32_t)(((x) & 0xffff00ff) >> 0)) +#define makedev_freebsd(x,y) ((dev_t)((((x) << 8) & 0x0000ff00) | \ + (((y) << 0) & 0xffff00ff))) + +static dev_t +pack_freebsd(int n, unsigned long numbers[], const char **error) +{ + dev_t dev = 0; + + if (n == 2) { + dev = makedev_freebsd(numbers[0], numbers[1]); + if ((unsigned long)major_freebsd(dev) != numbers[0]) + *error = iMajorError; + if ((unsigned long)minor_freebsd(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_8_8(x) ((int32_t)(((x) & 0x0000ff00) >> 8)) +#define minor_8_8(x) ((int32_t)(((x) & 0x000000ff) >> 0)) +#define makedev_8_8(x,y) ((dev_t)((((x) << 8) & 0x0000ff00) | \ + (((y) << 0) & 0x000000ff))) + +static dev_t +pack_8_8(int n, unsigned long numbers[], const char **error) +{ + dev_t dev = 0; + + if (n == 2) { + dev = makedev_8_8(numbers[0], numbers[1]); + if ((unsigned long)major_8_8(dev) != numbers[0]) + *error = iMajorError; + if ((unsigned long)minor_8_8(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_12_20(x) ((int32_t)(((x) & 0xfff00000) >> 20)) +#define minor_12_20(x) ((int32_t)(((x) & 0x000fffff) >> 0)) +#define makedev_12_20(x,y) ((dev_t)((((x) << 20) & 0xfff00000) | \ + (((y) << 0) & 0x000fffff))) + +static dev_t +pack_12_20(int n, unsigned long numbers[], const char **error) +{ + dev_t dev = 0; + + if (n == 2) { + dev = makedev_12_20(numbers[0], numbers[1]); + if ((unsigned long)major_12_20(dev) != numbers[0]) + *error = iMajorError; + if ((unsigned long)minor_12_20(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_14_18(x) ((int32_t)(((x) & 0xfffc0000) >> 18)) +#define minor_14_18(x) ((int32_t)(((x) & 0x0003ffff) >> 0)) +#define makedev_14_18(x,y) ((dev_t)((((x) << 18) & 0xfffc0000) | \ + (((y) << 0) & 0x0003ffff))) + +static dev_t +pack_14_18(int n, unsigned long numbers[], const char **error) +{ + dev_t dev = 0; + + if (n == 2) { + dev = makedev_14_18(numbers[0], numbers[1]); + if ((unsigned long)major_14_18(dev) != numbers[0]) + *error = iMajorError; + if ((unsigned long)minor_14_18(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_8_24(x) ((int32_t)(((x) & 0xff000000) >> 24)) +#define minor_8_24(x) ((int32_t)(((x) & 0x00ffffff) >> 0)) +#define makedev_8_24(x,y) ((dev_t)((((x) << 24) & 0xff000000) | \ + (((y) << 0) & 0x00ffffff))) + +static dev_t +pack_8_24(int n, unsigned long numbers[], const char **error) +{ + dev_t dev = 0; + + if (n == 2) { + dev = makedev_8_24(numbers[0], numbers[1]); + if ((unsigned long)major_8_24(dev) != numbers[0]) + *error = iMajorError; + if ((unsigned long)minor_8_24(dev) != numbers[1]) + *error = iMinorError; + } else + *error = tooManyFields; + return (dev); +} + + +#define major_12_12_8(x) ((int32_t)(((x) & 0xfff00000) >> 20)) +#define unit_12_12_8(x) ((int32_t)(((x) & 0x000fff00) >> 8)) +#define subunit_12_12_8(x) ((int32_t)(((x) & 0x000000ff) >> 0)) +#define makedev_12_12_8(x,y,z) ((dev_t)((((x) << 20) & 0xfff00000) | \ + (((y) << 8) & 0x000fff00) | \ + (((z) << 0) & 0x000000ff))) + +static dev_t +pack_bsdos(int n, unsigned long numbers[], const char **error) +{ + dev_t dev = 0; + + if (n == 2) { + dev = makedev_12_20(numbers[0], numbers[1]); + if ((unsigned long)major_12_20(dev) != numbers[0]) + *error = iMajorError; + if ((unsigned long)minor_12_20(dev) != numbers[1]) + *error = iMinorError; + } else if (n == 3) { + dev = makedev_12_12_8(numbers[0], numbers[1], numbers[2]); + if ((unsigned long)major_12_12_8(dev) != numbers[0]) + *error = iMajorError; + if ((unsigned long)unit_12_12_8(dev) != numbers[1]) + *error = "invalid unit number"; + if ((unsigned long)subunit_12_12_8(dev) != numbers[2]) + *error = "invalid subunit number"; + } else + *error = tooManyFields; + return (dev); +} + + + /* list of formats and pack functions */ + /* this list must be sorted lexically */ +static struct format { + const char *name; + pack_t *pack; +} formats[] = { + {"386bsd", pack_8_8}, + {"4bsd", pack_8_8}, + {"bsdos", pack_bsdos}, + {"freebsd", pack_freebsd}, + {"hpux", pack_8_24}, + {"isc", pack_8_8}, + {"linux", pack_8_8}, + {"native", pack_native}, + {"netbsd", pack_netbsd}, + {"osf1", pack_12_20}, + {"sco", pack_8_8}, + {"solaris", pack_14_18}, + {"sunos", pack_8_8}, + {"svr3", pack_8_8}, + {"svr4", pack_14_18}, + {"ultrix", pack_8_8}, +}; + +static int +compare_format(const void *key, const void *element) +{ + const char *name; + const struct format *format; + + name = key; + format = element; + + return (strcmp(name, format->name)); +} + + +pack_t * +pack_find(const char *name) +{ + struct format *format; + + format = bsearch(name, formats, + sizeof(formats)/sizeof(formats[0]), + sizeof(formats[0]), compare_format); + if (format == 0) + return (NULL); + return (format->pack); +} diff --git a/libarchive/archive_pack_dev.h b/libarchive/archive_pack_dev.h new file mode 100644 index 000000000000..749fd3d2cb65 --- /dev/null +++ b/libarchive/archive_pack_dev.h @@ -0,0 +1,49 @@ +/* $NetBSD: pack_dev.h,v 1.8 2013/06/14 16:28:20 tsutsui Exp $ */ + +/*- + * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Charles M. Hannum. + * + * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +/* Originally from NetBSD's mknod(8) source. */ + +#ifndef _PACK_DEV_H +#define _PACK_DEV_H + +typedef dev_t pack_t(int, unsigned long [], const char **); + +pack_t *pack_find(const char *); +pack_t pack_native; + +#define major_netbsd(x) ((int32_t)((((x) & 0x000fff00) >> 8))) +#define minor_netbsd(x) ((int32_t)((((x) & 0xfff00000) >> 12) | \ + (((x) & 0x000000ff) >> 0))) +#define makedev_netbsd(x,y) ((dev_t)((((x) << 8) & 0x000fff00) | \ + (((y) << 12) & 0xfff00000) | \ + (((y) << 0) & 0x000000ff))) + +#endif /* _PACK_DEV_H */ diff --git a/libarchive/archive_pathmatch.c b/libarchive/archive_pathmatch.c index 505252a18f38..619e2b622a3c 100644 --- a/libarchive/archive_pathmatch.c +++ b/libarchive/archive_pathmatch.c @@ -394,8 +394,8 @@ __archive_pathmatch(const char *p, const char *s, int flags) if (*p == '/' && *s != '/') return (0); - /* Certain patterns and file names anchor implicitly. */ - if (*p == '*' || *p == '/' || *p == '/') { + /* Certain patterns anchor implicitly. */ + if (*p == '*' || *p == '/') { while (*p == '/') ++p; while (*s == '/') @@ -434,8 +434,8 @@ __archive_pathmatch_w(const wchar_t *p, const wchar_t *s, int flags) if (*p == L'/' && *s != L'/') return (0); - /* Certain patterns and file names anchor implicitly. */ - if (*p == L'*' || *p == L'/' || *p == L'/') { + /* Certain patterns anchor implicitly. */ + if (*p == L'*' || *p == L'/') { while (*p == L'/') ++p; while (*s == L'/') diff --git a/libarchive/archive_platform.h b/libarchive/archive_platform.h index ce2f482ba042..b06c3cd28fa6 100644 --- a/libarchive/archive_platform.h +++ b/libarchive/archive_platform.h @@ -66,15 +66,18 @@ * headers as required. */ -/* Get a real definition for __FBSDID if we can */ +/* Get a real definition for __FBSDID or __RCSID if we can */ #if HAVE_SYS_CDEFS_H #include #endif -/* If not, define it so as to avoid dangling semicolons. */ +/* If not, define them so as to avoid dangling semicolons. */ #ifndef __FBSDID #define __FBSDID(a) struct _undefined_hack #endif +#ifndef __RCSID +#define __RCSID(a) struct _undefined_hack +#endif /* Try to get standard C99-style integer type definitions. */ #if HAVE_INTTYPES_H @@ -114,6 +117,12 @@ #if !HAVE_DECL_UINT32_MAX #define UINT32_MAX (~(uint32_t)0) #endif +#if !HAVE_DECL_INT32_MAX +#define INT32_MAX ((int32_t)(UINT32_MAX >> 1)) +#endif +#if !HAVE_DECL_INT32_MIN +#define INT32_MIN ((int32_t)(~INT32_MAX)) +#endif #if !HAVE_DECL_UINT64_MAX #define UINT64_MAX (~(uint64_t)0) #endif @@ -123,6 +132,15 @@ #if !HAVE_DECL_INT64_MIN #define INT64_MIN ((int64_t)(~INT64_MAX)) #endif +#if !HAVE_DECL_UINTMAX_MAX +#define UINTMAX_MAX (~(uintmax_t)0) +#endif +#if !HAVE_DECL_INTMAX_MAX +#define INTMAX_MAX ((intmax_t)(UINTMAX_MAX >> 1)) +#endif +#if !HAVE_DECL_INTMAX_MIN +#define INTMAX_MIN ((intmax_t)(~INTMAX_MAX)) +#endif /* * If this platform has , acl_create(), acl_init(), diff --git a/libarchive/archive_private.h b/libarchive/archive_private.h index 30d472fcda0f..4b4be9796dfc 100644 --- a/libarchive/archive_private.h +++ b/libarchive/archive_private.h @@ -119,6 +119,23 @@ struct archive { unsigned current_codepage; /* Current ACP(ANSI CodePage). */ unsigned current_oemcp; /* Current OEMCP(OEM CodePage). */ struct archive_string_conv *sconv; + + /* + * Used by archive_read_data() to track blocks and copy + * data to client buffers, filling gaps with zero bytes. + */ + const char *read_data_block; + int64_t read_data_offset; + int64_t read_data_output_offset; + size_t read_data_remaining; + + /* + * Used by formats/filters to determine the amount of data + * requested from a call to archive_read_data(). This is only + * useful when the format/filter has seek support. + */ + char read_data_is_posix_read; + size_t read_data_requested; }; /* Check magic value and state; return(ARCHIVE_FATAL) if it isn't valid. */ @@ -139,6 +156,8 @@ int __archive_mktemp(const char *tmpdir); int __archive_clean(struct archive *); +void __archive_reset_read_data(struct archive *); + #define err_combine(a,b) ((a) < (b) ? (a) : (b)) #if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER <= 1300) diff --git a/libarchive/archive_random.c b/libarchive/archive_random.c new file mode 100644 index 000000000000..a20b9b111510 --- /dev/null +++ b/libarchive/archive_random.c @@ -0,0 +1,269 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_STDLIB_H +#include +#endif + +#if !defined(HAVE_ARC4RANDOM_BUF) && (!defined(_WIN32) || defined(__CYGWIN__)) + +#ifdef HAVE_FCNTL +#include +#endif +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#ifdef HAVE_PTHREAD_H +#include +#endif + +static void arc4random_buf(void *, size_t); + +#endif /* HAVE_ARC4RANDOM_BUF */ + +#include "archive.h" +#include "archive_random_private.h" + +#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__) +#include +#endif + +#ifndef O_CLOEXEC +#define O_CLOEXEC 0 +#endif + +/* + * Random number generator function. + * This simply calls arc4random_buf function if the platform provides it. + */ + +int +archive_random(void *buf, size_t nbytes) +{ +#if defined(_WIN32) && !defined(__CYGWIN__) + HCRYPTPROV hProv; + BOOL success; + + success = CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, + CRYPT_VERIFYCONTEXT); + if (!success && GetLastError() == NTE_BAD_KEYSET) { + success = CryptAcquireContext(&hProv, NULL, NULL, + PROV_RSA_FULL, CRYPT_NEWKEYSET); + } + if (success) { + success = CryptGenRandom(hProv, (DWORD)nbytes, (BYTE*)buf); + CryptReleaseContext(hProv, 0); + if (success) + return ARCHIVE_OK; + } + /* TODO: Does this case really happen? */ + return ARCHIVE_FAILED; +#else + arc4random_buf(buf, nbytes); + return ARCHIVE_OK; +#endif +} + +#if !defined(HAVE_ARC4RANDOM_BUF) && (!defined(_WIN32) || defined(__CYGWIN__)) + +/* $OpenBSD: arc4random.c,v 1.24 2013/06/11 16:59:50 deraadt Exp $ */ +/* + * Copyright (c) 1996, David Mazieres + * Copyright (c) 2008, Damien Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * Arc4 random number generator for OpenBSD. + * + * This code is derived from section 17.1 of Applied Cryptography, + * second edition, which describes a stream cipher allegedly + * compatible with RSA Labs "RC4" cipher (the actual description of + * which is a trade secret). The same algorithm is used as a stream + * cipher called "arcfour" in Tatu Ylonen's ssh package. + * + * RC4 is a registered trademark of RSA Laboratories. + */ + +#ifdef __GNUC__ +#define inline __inline +#else /* !__GNUC__ */ +#define inline +#endif /* !__GNUC__ */ + +struct arc4_stream { + uint8_t i; + uint8_t j; + uint8_t s[256]; +}; + +#define RANDOMDEV "/dev/urandom" +#define KEYSIZE 128 +#ifdef HAVE_PTHREAD_H +static pthread_mutex_t arc4random_mtx = PTHREAD_MUTEX_INITIALIZER; +#define _ARC4_LOCK() pthread_mutex_lock(&arc4random_mtx); +#define _ARC4_UNLOCK() pthread_mutex_unlock(&arc4random_mtx); +#else +#define _ARC4_LOCK() +#define _ARC4_UNLOCK() +#endif + +static int rs_initialized; +static struct arc4_stream rs; +static pid_t arc4_stir_pid; +static int arc4_count; + +static inline uint8_t arc4_getbyte(void); +static void arc4_stir(void); + +static inline void +arc4_init(void) +{ + int n; + + for (n = 0; n < 256; n++) + rs.s[n] = n; + rs.i = 0; + rs.j = 0; +} + +static inline void +arc4_addrandom(u_char *dat, int datlen) +{ + int n; + uint8_t si; + + rs.i--; + for (n = 0; n < 256; n++) { + rs.i = (rs.i + 1); + si = rs.s[rs.i]; + rs.j = (rs.j + si + dat[n % datlen]); + rs.s[rs.i] = rs.s[rs.j]; + rs.s[rs.j] = si; + } + rs.j = rs.i; +} + +static void +arc4_stir(void) +{ + int done, fd, i; + struct { + struct timeval tv; + pid_t pid; + u_char rnd[KEYSIZE]; + } rdat; + + if (!rs_initialized) { + arc4_init(); + rs_initialized = 1; + } + done = 0; + fd = open(RANDOMDEV, O_RDONLY | O_CLOEXEC, 0); + if (fd >= 0) { + if (read(fd, &rdat, KEYSIZE) == KEYSIZE) + done = 1; + (void)close(fd); + } + if (!done) { + (void)gettimeofday(&rdat.tv, NULL); + rdat.pid = getpid(); + /* We'll just take whatever was on the stack too... */ + } + + arc4_addrandom((u_char *)&rdat, KEYSIZE); + + /* + * Discard early keystream, as per recommendations in: + * "(Not So) Random Shuffles of RC4" by Ilya Mironov. + */ + for (i = 0; i < 1024; i++) + (void)arc4_getbyte(); + arc4_count = 1600000; +} + +static void +arc4_stir_if_needed(void) +{ + pid_t pid = getpid(); + + if (arc4_count <= 0 || !rs_initialized || arc4_stir_pid != pid) { + arc4_stir_pid = pid; + arc4_stir(); + } +} + +static inline uint8_t +arc4_getbyte(void) +{ + uint8_t si, sj; + + rs.i = (rs.i + 1); + si = rs.s[rs.i]; + rs.j = (rs.j + si); + sj = rs.s[rs.j]; + rs.s[rs.i] = sj; + rs.s[rs.j] = si; + return (rs.s[(si + sj) & 0xff]); +} + +static void +arc4random_buf(void *_buf, size_t n) +{ + u_char *buf = (u_char *)_buf; + _ARC4_LOCK(); + arc4_stir_if_needed(); + while (n--) { + if (--arc4_count <= 0) + arc4_stir(); + buf[n] = arc4_getbyte(); + } + _ARC4_UNLOCK(); +} + +#endif /* !HAVE_ARC4RANDOM_BUF */ diff --git a/libarchive/archive_random_private.h b/libarchive/archive_random_private.h new file mode 100644 index 000000000000..c414779f8d44 --- /dev/null +++ b/libarchive/archive_random_private.h @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * 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. + */ + +#ifndef __LIBARCHIVE_BUILD +#error This header is only to be used internally to libarchive. +#endif + +#ifndef ARCHIVE_RANDOM_PRIVATE_H_INCLUDED +#define ARCHIVE_RANDOM_PRIVATE_H_INCLUDED + +/* Random number generator. */ +int archive_random(void *buf, size_t nbytes); + +#endif /* ARCHIVE_RANDOM_PRIVATE_H_INCLUDED */ diff --git a/libarchive/archive_read.3 b/libarchive/archive_read.3 index a29cc1ea6915..d37e7327cb5e 100644 --- a/libarchive/archive_read.3 +++ b/libarchive/archive_read.3 @@ -130,7 +130,7 @@ which provides a slightly more efficient interface. You may prefer to use the higher-level .Fn archive_read_data_skip , which reads and discards the data for this entry, -.Fn archive_read_data_to_file , +.Fn archive_read_data_into_fd , which copies the data to the provided file descriptor, or .Fn archive_read_extract , which recreates the specified entry on disk and copies data @@ -186,7 +186,7 @@ list_archive(const char *name) free(mydata); } -ssize_t +la_ssize_t myread(struct archive *a, void *client_data, const void **buff) { struct mydata *mydata = client_data; diff --git a/libarchive/archive_read.c b/libarchive/archive_read.c index eb8a5b0bc444..0bbacc8f185b 100644 --- a/libarchive/archive_read.c +++ b/libarchive/archive_read.c @@ -101,16 +101,17 @@ archive_read_new(void) { struct archive_read *a; - a = (struct archive_read *)malloc(sizeof(*a)); + a = (struct archive_read *)calloc(1, sizeof(*a)); if (a == NULL) return (NULL); - memset(a, 0, sizeof(*a)); a->archive.magic = ARCHIVE_READ_MAGIC; a->archive.state = ARCHIVE_STATE_NEW; a->entry = archive_entry_new2(&a->archive); a->archive.vtable = archive_read_vtable(); + a->passphrases.last = &a->passphrases.first; + return (&a->archive); } @@ -194,10 +195,12 @@ client_skip_proxy(struct archive_read_filter *self, int64_t request) ask = skip_limit; get = (self->archive->client.skipper) (&self->archive->archive, self->data, ask); - if (get == 0) - return (total); - request -= get; total += get; + if (get == 0 || get == request) + return (total); + if (get > request) + return ARCHIVE_FATAL; + request -= get; } } else if (self->archive->client.seeker != NULL && request > 64 * 1024) { @@ -230,8 +233,11 @@ client_seek_proxy(struct archive_read_filter *self, int64_t offset, int whence) * other libarchive code that assumes a successful forward * seek means it can also seek backwards. */ - if (self->archive->client.seeker == NULL) + if (self->archive->client.seeker == NULL) { + archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC, + "Current client reader does not support seeking a device"); return (ARCHIVE_FAILED); + } return (self->archive->client.seeker)(&self->archive->archive, self->data, offset, whence); } @@ -454,7 +460,7 @@ archive_read_open1(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; struct archive_read_filter *filter, *tmp; - int slot, e; + int slot, e = ARCHIVE_OK; unsigned int i; archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, @@ -541,16 +547,20 @@ archive_read_open1(struct archive *_a) * it wants to handle this stream. Repeat until we've finished * building the pipeline. */ + +/* We won't build a filter pipeline with more stages than this. */ +#define MAX_NUMBER_FILTERS 25 + static int choose_filters(struct archive_read *a) { - int number_bidders, i, bid, best_bid, n; + int number_bidders, i, bid, best_bid, number_filters; struct archive_read_filter_bidder *bidder, *best_bidder; struct archive_read_filter *filter; ssize_t avail; int r; - for (n = 0; n < 25; ++n) { + for (number_filters = 0; number_filters < MAX_NUMBER_FILTERS; ++number_filters) { number_bidders = sizeof(a->bidders) / sizeof(a->bidders[0]); best_bid = 0; @@ -661,16 +671,14 @@ _archive_read_next_header2(struct archive *_a, struct archive_entry *entry) break; } - a->read_data_output_offset = 0; - a->read_data_remaining = 0; - a->read_data_is_posix_read = 0; - a->read_data_requested = 0; + __archive_reset_read_data(&a->archive); + a->data_start_node = a->client.cursor; /* EOF always wins; otherwise return the worst error. */ return (r2 < r1 || r2 == ARCHIVE_EOF) ? r2 : r1; } -int +static int _archive_read_next_header(struct archive *_a, struct archive_entry **entryp) { int ret; @@ -749,6 +757,59 @@ archive_read_header_position(struct archive *_a) return (a->header_position); } +/* + * Returns 1 if the archive contains at least one encrypted entry. + * If the archive format not support encryption at all + * ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED is returned. + * If for any other reason (e.g. not enough data read so far) + * we cannot say whether there are encrypted entries, then + * ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW is returned. + * In general, this function will return values below zero when the + * reader is uncertain or totally uncapable of encryption support. + * When this function returns 0 you can be sure that the reader + * supports encryption detection but no encrypted entries have + * been found yet. + * + * NOTE: If the metadata/header of an archive is also encrypted, you + * cannot rely on the number of encrypted entries. That is why this + * function does not return the number of encrypted entries but# + * just shows that there are some. + */ +int +archive_read_has_encrypted_entries(struct archive *_a) +{ + struct archive_read *a = (struct archive_read *)_a; + int format_supports_encryption = archive_read_format_capabilities(_a) + & (ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA | ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA); + + if (!_a || !format_supports_encryption) { + /* Format in general doesn't support encryption */ + return ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED; + } + + /* A reader potentially has read enough data now. */ + if (a->format && a->format->has_encrypted_entries) { + return (a->format->has_encrypted_entries)(a); + } + + /* For any other reason we cannot say how many entries are there. */ + return ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW; +} + +/* + * Returns a bitmask of capabilities that are supported by the archive format reader. + * If the reader has no special capabilities, ARCHIVE_READ_FORMAT_CAPS_NONE is returned. + */ +int +archive_read_format_capabilities(struct archive *_a) +{ + struct archive_read *a = (struct archive_read *)_a; + if (a && a->format && a->format->format_capabilties) { + return (a->format->format_capabilties)(a); + } + return ARCHIVE_READ_FORMAT_CAPS_NONE; +} + /* * Read data from an archive entry, using a read(2)-style interface. * This is a convenience routine that just calls @@ -763,7 +824,7 @@ archive_read_header_position(struct archive *_a) ssize_t archive_read_data(struct archive *_a, void *buff, size_t s) { - struct archive_read *a = (struct archive_read *)_a; + struct archive *a = (struct archive *)_a; char *dest; const void *read_buf; size_t bytes_read; @@ -778,7 +839,7 @@ archive_read_data(struct archive *_a, void *buff, size_t s) read_buf = a->read_data_block; a->read_data_is_posix_read = 1; a->read_data_requested = s; - r = _archive_read_data_block(&a->archive, &read_buf, + r = archive_read_data_block(a, &read_buf, &a->read_data_remaining, &a->read_data_offset); a->read_data_block = read_buf; if (r == ARCHIVE_EOF) @@ -793,7 +854,7 @@ archive_read_data(struct archive *_a, void *buff, size_t s) } if (a->read_data_offset < a->read_data_output_offset) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, "Encountered out-of-order sparse blocks"); return (ARCHIVE_RETRY); } @@ -836,6 +897,21 @@ archive_read_data(struct archive *_a, void *buff, size_t s) return (bytes_read); } +/* + * Reset the read_data_* variables, used for starting a new entry. + */ +void __archive_reset_read_data(struct archive * a) +{ + a->read_data_output_offset = 0; + a->read_data_remaining = 0; + a->read_data_is_posix_read = 0; + a->read_data_requested = 0; + + /* extra resets, from rar.c */ + a->read_data_block = NULL; + a->read_data_offset = 0; +} + /* * Skip over all remaining data in this entry. */ @@ -903,7 +979,7 @@ _archive_read_data_block(struct archive *_a, if (a->format->read_data == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER, "Internal error: " - "No format_read_data_block function registered"); + "No format->read_data function registered"); return (ARCHIVE_FATAL); } @@ -990,6 +1066,7 @@ static int _archive_read_free(struct archive *_a) { struct archive_read *a = (struct archive_read *)_a; + struct archive_read_passphrase *p; int i, n; int slots; int r = ARCHIVE_OK; @@ -1027,9 +1104,20 @@ _archive_read_free(struct archive *_a) } } + /* Release passphrase list. */ + p = a->passphrases.first; + while (p != NULL) { + struct archive_read_passphrase *np = p->next; + + /* A passphrase should be cleaned. */ + memset(p->passphrase, 0, strlen(p->passphrase)); + free(p->passphrase); + free(p); + p = np; + } + archive_string_free(&a->archive.error_string); - if (a->entry) - archive_entry_free(a->entry); + archive_entry_free(a->entry); a->archive.magic = 0; __archive_clean(&a->archive); free(a->client.dataset); @@ -1073,7 +1161,7 @@ static const char * _archive_filter_name(struct archive *_a, int n) { struct archive_read_filter *f = get_filter(_a, n); - return f == NULL ? NULL : f->name; + return f != NULL ? f->name : NULL; } static int64_t @@ -1097,7 +1185,9 @@ __archive_read_register_format(struct archive_read *a, int (*read_data)(struct archive_read *, const void **, size_t *, int64_t *), int (*read_data_skip)(struct archive_read *), int64_t (*seek_data)(struct archive_read *, int64_t, int), - int (*cleanup)(struct archive_read *)) + int (*cleanup)(struct archive_read *), + int (*format_capabilities)(struct archive_read *), + int (*has_encrypted_entries)(struct archive_read *)) { int i, number_slots; @@ -1120,6 +1210,8 @@ __archive_read_register_format(struct archive_read *a, a->formats[i].cleanup = cleanup; a->formats[i].data = format_data; a->formats[i].name = name; + a->formats[i].format_capabilties = format_capabilities; + a->formats[i].has_encrypted_entries = has_encrypted_entries; return (ARCHIVE_OK); } } @@ -1562,10 +1654,9 @@ __archive_read_filter_seek(struct archive_read_filter *filter, int64_t offset, client->dataset[++cursor].begin_position = r; } offset -= client->dataset[cursor].begin_position; - if (offset < 0) - offset = 0; - else if (offset > client->dataset[cursor].total_size - 1) - offset = client->dataset[cursor].total_size - 1; + if (offset < 0 + || offset > client->dataset[cursor].total_size) + return ARCHIVE_FATAL; if ((r = client_seek_proxy(filter, offset, SEEK_SET)) < 0) return r; break; diff --git a/libarchive/archive_read_add_passphrase.3 b/libarchive/archive_read_add_passphrase.3 new file mode 100644 index 000000000000..8b242ea79b1e --- /dev/null +++ b/libarchive/archive_read_add_passphrase.3 @@ -0,0 +1,74 @@ +.\" Copyright (c) 2014 Michihiro NAKAJIMA +.\" 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 September 14, 2014 +.Dt ARCHIVE_READ_ADD_PASSPHRASE 3 +.Os +.Sh NAME +.Nm archive_read_add_passphrase , +.Nm archive_read_set_passphrase_callback +.Nd functions for reading encrypted archives +.Sh LIBRARY +Streaming Archive Library (libarchive, -larchive) +.Sh SYNOPSIS +.In archive.h +.Ft int +.Fo archive_read_add_passphrase +.Fa "struct archive *" +.Fa "const char *passphrase" +.Fc +.Ft int +.Fo archive_read_set_passphrase_callback +.Fa "struct archive *" +.Fa "void *client_data" +.Fa "archive_passphrase_callback *" +.Fc +.Sh DESCRIPTION +.Bl -tag -width indent +.It Fn archive_read_add_passphrase +Register passphrases for reading an encryption archive. +If +.Ar passphrase +is +.Dv NULL +or empty, this function will do nothing and +.Cm ARCHIVE_FAILED +will be returned. +Otherwise, +.Cm ARCHIVE_OK +will be returned. +.It Fn archive_read_set_passphrase_callback +Register callback function that will be invoked to get a passphrase +for decrption after trying all passphrases registered by the +.Fn archive_read_add_passphrase +function failed. +.El +.\" .Sh ERRORS +.Sh SEE ALSO +.Xr tar 1 , +.Xr libarchive 3 , +.Xr archive_read 3 , +.Xr archive_read_set_options 3 diff --git a/libarchive/archive_read_add_passphrase.c b/libarchive/archive_read_add_passphrase.c new file mode 100644 index 000000000000..f67f1ebc6e27 --- /dev/null +++ b/libarchive/archive_read_add_passphrase.c @@ -0,0 +1,186 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_ERRNO_H +#include +#endif +#include "archive_read_private.h" + +static void +add_passphrase_to_tail(struct archive_read *a, + struct archive_read_passphrase *p) +{ + *a->passphrases.last = p; + a->passphrases.last = &p->next; + p->next = NULL; +} + +static struct archive_read_passphrase * +remove_passphrases_from_head(struct archive_read *a) +{ + struct archive_read_passphrase *p; + + p = a->passphrases.first; + if (p != NULL) + a->passphrases.first = p->next; + return (p); +} + +static void +insert_passphrase_to_head(struct archive_read *a, + struct archive_read_passphrase *p) +{ + p->next = a->passphrases.first; + a->passphrases.first = p; +} + +static struct archive_read_passphrase * +new_read_passphrase(struct archive_read *a, const char *passphrase) +{ + struct archive_read_passphrase *p; + + p = malloc(sizeof(*p)); + if (p == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate memory"); + return (NULL); + } + p->passphrase = strdup(passphrase); + if (p->passphrase == NULL) { + free(p); + archive_set_error(&a->archive, ENOMEM, + "Can't allocate memory"); + return (NULL); + } + return (p); +} + +int +archive_read_add_passphrase(struct archive *_a, const char *passphrase) +{ + struct archive_read *a = (struct archive_read *)_a; + struct archive_read_passphrase *p; + + archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, + "archive_read_add_passphrase"); + + if (passphrase == NULL || passphrase[0] == '\0') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Empty passphrase is unacceptable"); + return (ARCHIVE_FAILED); + } + + p = new_read_passphrase(a, passphrase); + if (p == NULL) + return (ARCHIVE_FATAL); + add_passphrase_to_tail(a, p); + + return (ARCHIVE_OK); +} + +int +archive_read_set_passphrase_callback(struct archive *_a, void *client_data, + archive_passphrase_callback *cb) +{ + struct archive_read *a = (struct archive_read *)_a; + + archive_check_magic(_a, ARCHIVE_READ_MAGIC, ARCHIVE_STATE_NEW, + "archive_read_set_passphrase_callback"); + + a->passphrases.callback = cb; + a->passphrases.client_data = client_data; + return (ARCHIVE_OK); +} + +/* + * Call this in advance when you start to get a passphrase for decryption + * for a entry. + */ +void +__archive_read_reset_passphrase(struct archive_read *a) +{ + + a->passphrases.candiate = -1; +} + +/* + * Get a passphrase for decryption. + */ +const char * +__archive_read_next_passphrase(struct archive_read *a) +{ + struct archive_read_passphrase *p; + const char *passphrase; + + if (a->passphrases.candiate < 0) { + /* Count out how many passphrases we have. */ + int cnt = 0; + + for (p = a->passphrases.first; p != NULL; p = p->next) + cnt++; + a->passphrases.candiate = cnt; + p = a->passphrases.first; + } else if (a->passphrases.candiate > 1) { + /* Rotate a passphrase list. */ + a->passphrases.candiate--; + p = remove_passphrases_from_head(a); + add_passphrase_to_tail(a, p); + /* Pick a new passphrase candiate up. */ + p = a->passphrases.first; + } else if (a->passphrases.candiate == 1) { + /* This case is that all cadiates failed to decryption. */ + a->passphrases.candiate = 0; + if (a->passphrases.first->next != NULL) { + /* Rotate a passphrase list. */ + p = remove_passphrases_from_head(a); + add_passphrase_to_tail(a, p); + } + p = NULL; + } else /* There is no passphrase candaite. */ + p = NULL; + + if (p != NULL) + passphrase = p->passphrase; + else if (a->passphrases.callback != NULL) { + /* Get a passphrase through a call-back function + * since we tried all passphrases out or we don't + * have it. */ + passphrase = a->passphrases.callback(&a->archive, + a->passphrases.client_data); + if (passphrase != NULL) { + p = new_read_passphrase(a, passphrase); + if (p == NULL) + return (NULL); + insert_passphrase_to_head(a, p); + a->passphrases.candiate = 1; + } + } else + passphrase = NULL; + + return (passphrase); +} diff --git a/libarchive/archive_read_append_filter.c b/libarchive/archive_read_append_filter.c index 017d7c68a4b3..3a0d4d68d89a 100644 --- a/libarchive/archive_read_append_filter.c +++ b/libarchive/archive_read_append_filter.c @@ -43,7 +43,7 @@ archive_read_append_filter(struct archive *_a, int code) struct archive_read_filter *filter; struct archive_read *a = (struct archive_read *)_a; - r1 = r2 = (ARCHIVE_OK); + r2 = (ARCHIVE_OK); switch (code) { case ARCHIVE_FILTER_NONE: @@ -85,6 +85,10 @@ archive_read_append_filter(struct archive *_a, int code) strcpy(str, "rpm"); r1 = archive_read_support_filter_rpm(_a); break; + case ARCHIVE_FILTER_LZ4: + strcpy(str, "lz4"); + r1 = archive_read_support_filter_lz4(_a); + break; case ARCHIVE_FILTER_LZIP: strcpy(str, "lzip"); r1 = archive_read_support_filter_lzip(_a); diff --git a/libarchive/archive_read_data.3 b/libarchive/archive_read_data.3 index bf0578ce3779..c1bc15d7cc8c 100644 --- a/libarchive/archive_read_data.3 +++ b/libarchive/archive_read_data.3 @@ -37,7 +37,7 @@ Streaming Archive Library (libarchive, -larchive) .Sh SYNOPSIS .In archive.h -.Ft ssize_t +.Ft la_ssize_t .Fn archive_read_data "struct archive *" "void *buff" "size_t len" .Ft int .Fo archive_read_data_block diff --git a/libarchive/archive_read_disk_entry_from_file.c b/libarchive/archive_read_disk_entry_from_file.c index e984aaadbeab..74fe353d9d34 100644 --- a/libarchive/archive_read_disk_entry_from_file.c +++ b/libarchive/archive_read_disk_entry_from_file.c @@ -251,9 +251,11 @@ archive_read_disk_entry_from_file(struct archive *_a, #endif /* HAVE_READLINK || HAVE_READLINKAT */ r = setup_acls(a, entry, &fd); - r1 = setup_xattrs(a, entry, &fd); - if (r1 < r) - r = r1; + if (!a->suppress_xattr) { + r1 = setup_xattrs(a, entry, &fd); + if (r1 < r) + r = r1; + } if (a->enable_copyfile) { r1 = setup_mac_metadata(a, entry, &fd); if (r1 < r) @@ -399,7 +401,7 @@ setup_mac_metadata(struct archive_read_disk *a, #endif -#if defined(HAVE_POSIX_ACL) && defined(ACL_TYPE_NFS4) +#ifdef HAVE_POSIX_ACL static int translate_acl(struct archive_read_disk *a, struct archive_entry *entry, acl_t acl, int archive_entry_acl_type); @@ -419,6 +421,7 @@ setup_acls(struct archive_read_disk *a, archive_entry_acl_clear(entry); +#ifdef ACL_TYPE_NFS4 /* Try NFS4 ACL first. */ if (*fd >= 0) acl = acl_get_fd(*fd); @@ -447,6 +450,7 @@ setup_acls(struct archive_read_disk *a, acl_free(acl); return (ARCHIVE_OK); } +#endif /* Retrieve access ACL from file. */ if (*fd >= 0) @@ -492,6 +496,7 @@ static struct { {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE}, {ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE}, {ARCHIVE_ENTRY_ACL_READ, ACL_READ}, +#ifdef ACL_TYPE_NFS4 {ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA}, {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY}, {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA}, @@ -508,8 +513,10 @@ static struct { {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_ACL}, {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_WRITE_OWNER}, {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE} +#endif }; +#ifdef ACL_TYPE_NFS4 static struct { int archive_inherit; int platform_inherit; @@ -519,21 +526,25 @@ static struct { {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY} }; - +#endif static int translate_acl(struct archive_read_disk *a, struct archive_entry *entry, acl_t acl, int default_entry_acl_type) { acl_tag_t acl_tag; +#ifdef ACL_TYPE_NFS4 acl_entry_type_t acl_type; acl_flagset_t acl_flagset; + int brand, r; +#endif acl_entry_t acl_entry; acl_permset_t acl_permset; - int brand, i, r, entry_acl_type; + int i, entry_acl_type; int s, ae_id, ae_tag, ae_perm; const char *ae_name; +#ifdef ACL_TYPE_NFS4 // FreeBSD "brands" ACLs as POSIX.1e or NFSv4 // Make sure the "brand" on this ACL is consistent // with the default_entry_acl_type bits provided. @@ -560,6 +571,7 @@ translate_acl(struct archive_read_disk *a, return ARCHIVE_FAILED; break; } +#endif s = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_entry); @@ -592,9 +604,11 @@ translate_acl(struct archive_read_disk *a, case ACL_OTHER: ae_tag = ARCHIVE_ENTRY_ACL_OTHER; break; +#ifdef ACL_TYPE_NFS4 case ACL_EVERYONE: ae_tag = ARCHIVE_ENTRY_ACL_EVERYONE; break; +#endif default: /* Skip types that libarchive can't support. */ s = acl_get_entry(acl, ACL_NEXT_ENTRY, &acl_entry); @@ -605,6 +619,7 @@ translate_acl(struct archive_read_disk *a, // XXX acl_get_entry_type_np on FreeBSD returns EINVAL for // non-NFSv4 ACLs entry_acl_type = default_entry_acl_type; +#ifdef ACL_TYPE_NFS4 r = acl_get_entry_type_np(acl_entry, &acl_type); if (r == 0) { switch (acl_type) { @@ -634,9 +649,10 @@ translate_acl(struct archive_read_disk *a, ae_perm |= acl_inherit_map[i].archive_inherit; } +#endif acl_get_permset(acl_entry, &acl_permset); - for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) { + for (i = 0; i < (int)(sizeof(acl_perm_map) / sizeof(acl_perm_map[0])); ++i) { /* * acl_get_perm() is spelled differently on different * platforms; see above. @@ -1030,7 +1046,7 @@ setup_sparse(struct archive_read_disk *a, struct fiemap *fm; struct fiemap_extent *fe; int64_t size; - int count, do_fiemap; + int count, do_fiemap, iters; int exit_sts = ARCHIVE_OK; if (archive_entry_filetype(entry) != AE_IFREG @@ -1067,7 +1083,7 @@ setup_sparse(struct archive_read_disk *a, fm->fm_extent_count = count; do_fiemap = 1; size = archive_entry_size(entry); - for (;;) { + for (iters = 0; ; ++iters) { int i, r; r = ioctl(*fd, FS_IOC_FIEMAP, fm); @@ -1077,8 +1093,13 @@ setup_sparse(struct archive_read_disk *a, * version(<2.6.28) cannot perfom FS_IOC_FIEMAP. */ goto exit_setup_sparse; } - if (fm->fm_mapped_extents == 0) + if (fm->fm_mapped_extents == 0) { + if (iters == 0) { + /* Fully sparse file; insert a zero-length "data" entry */ + archive_entry_sparse_add_entry(entry, 0, 0); + } break; + } fe = fm->fm_extents; for (i = 0; i < (int)fm->fm_mapped_extents; i++, fe++) { if (!(fe->fe_flags & FIEMAP_EXTENT_UNWRITTEN)) { @@ -1123,6 +1144,7 @@ setup_sparse(struct archive_read_disk *a, off_t initial_off; /* FreeBSD/Solaris only, so off_t okay here */ off_t off_s, off_e; /* FreeBSD/Solaris only, so off_t okay here */ int exit_sts = ARCHIVE_OK; + int check_fully_sparse = 0; if (archive_entry_filetype(entry) != AE_IFREG || archive_entry_size(entry) <= 0 @@ -1175,8 +1197,14 @@ setup_sparse(struct archive_read_disk *a, while (off_s < size) { off_s = lseek(*fd, off_s, SEEK_DATA); if (off_s == (off_t)-1) { - if (errno == ENXIO) - break;/* no more hole */ + if (errno == ENXIO) { + /* no more hole */ + if (archive_entry_sparse_count(entry) == 0) { + /* Potentially a fully-sparse file. */ + check_fully_sparse = 1; + } + break; + } archive_set_error(&a->archive, errno, "lseek(SEEK_HOLE) failed"); exit_sts = ARCHIVE_FAILED; @@ -1200,6 +1228,14 @@ setup_sparse(struct archive_read_disk *a, off_e - off_s); off_s = off_e; } + + if (check_fully_sparse) { + if (lseek(*fd, 0, SEEK_HOLE) == 0 && + lseek(*fd, 0, SEEK_END) == size) { + /* Fully sparse file; insert a zero-length "data" entry */ + archive_entry_sparse_add_entry(entry, 0, 0); + } + } exit_setup_sparse: lseek(*fd, initial_off, SEEK_SET); return (exit_sts); diff --git a/libarchive/archive_read_disk_posix.c b/libarchive/archive_read_disk_posix.c index 1787d864ca92..22a1f14c0e03 100644 --- a/libarchive/archive_read_disk_posix.c +++ b/libarchive/archive_read_disk_posix.c @@ -356,6 +356,8 @@ static int _archive_read_free(struct archive *); static int _archive_read_close(struct archive *); static int _archive_read_data_block(struct archive *, const void **, size_t *, int64_t *); +static int _archive_read_next_header(struct archive *, + struct archive_entry **); static int _archive_read_next_header2(struct archive *, struct archive_entry *); static const char *trivial_lookup_gname(void *, int64_t gid); @@ -377,6 +379,7 @@ archive_read_disk_vtable(void) av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; av.archive_read_data_block = _archive_read_data_block; + av.archive_read_next_header = _archive_read_next_header; av.archive_read_next_header2 = _archive_read_next_header2; inited = 1; } @@ -459,6 +462,7 @@ archive_read_disk_new(void) a->archive.magic = ARCHIVE_READ_DISK_MAGIC; a->archive.state = ARCHIVE_STATE_NEW; a->archive.vtable = archive_read_disk_vtable(); + a->entry = archive_entry_new2(&a->archive); a->lookup_uname = trivial_lookup_uname; a->lookup_gname = trivial_lookup_gname; a->enable_copyfile = 1; @@ -491,6 +495,7 @@ _archive_read_free(struct archive *_a) if (a->cleanup_uname != NULL && a->lookup_uname_data != NULL) (a->cleanup_uname)(a->lookup_uname_data); archive_string_free(&a->archive.error_string); + archive_entry_free(a->entry); a->archive.magic = 0; __archive_clean(&a->archive); free(a); @@ -609,6 +614,10 @@ archive_read_disk_set_behavior(struct archive *_a, int flags) a->traverse_mount_points = 0; else a->traverse_mount_points = 1; + if (flags & ARCHIVE_READDISK_NO_XATTR) + a->suppress_xattr = 1; + else + a->suppress_xattr = 0; return (r); } @@ -708,6 +717,7 @@ _archive_read_data_block(struct archive *_a, const void **buff, int r; ssize_t bytes; size_t buffbytes; + int empty_sparse_region = 0; archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, ARCHIVE_STATE_DATA, "archive_read_data_block"); @@ -789,6 +799,9 @@ _archive_read_data_block(struct archive *_a, const void **buff, if ((int64_t)buffbytes > t->current_sparse->length) buffbytes = t->current_sparse->length; + if (t->current_sparse->length == 0) + empty_sparse_region = 1; + /* * Skip hole. * TODO: Should we consider t->current_filesystem->xfer_align? @@ -819,7 +832,11 @@ _archive_read_data_block(struct archive *_a, const void **buff, } } else bytes = 0; - if (bytes == 0) { + /* + * Return an EOF unless we've read a leading empty sparse region, which + * is used to represent fully-sparse files. + */ + if (bytes == 0 && !empty_sparse_region) { /* Get EOF */ t->entry_eof = 1; r = ARCHIVE_EOF; @@ -1080,6 +1097,17 @@ next_entry(struct archive_read_disk *a, struct tree *t, return (r); } +static int +_archive_read_next_header(struct archive *_a, struct archive_entry **entryp) +{ + int ret; + struct archive_read_disk *a = (struct archive_read_disk *)_a; + *entryp = NULL; + ret = _archive_read_next_header2(_a, a->entry); + *entryp = a->entry; + return ret; +} + static int _archive_read_next_header2(struct archive *_a, struct archive_entry *entry) { @@ -1148,6 +1176,7 @@ _archive_read_next_header2(struct archive *_a, struct archive_entry *entry) break; } + __archive_reset_read_data(&a->archive); return (r); } @@ -1555,6 +1584,7 @@ setup_current_filesystem(struct archive_read_disk *a) #if defined(HAVE_STRUCT_STATFS_F_NAMEMAX) t->current_filesystem->name_max = sfs.f_namemax; #else +# if defined(_PC_NAME_MAX) /* Mac OS X does not have f_namemax in struct statfs. */ if (tree_current_is_symblic_link_target(t)) { if (tree_enter_working_dir(t) != 0) { @@ -1564,6 +1594,9 @@ setup_current_filesystem(struct archive_read_disk *a) nm = pathconf(tree_current_access_path(t), _PC_NAME_MAX); } else nm = fpathconf(tree_current_dir_fd(t), _PC_NAME_MAX); +# else + nm = -1; +# endif if (nm == -1) t->current_filesystem->name_max = NAME_MAX; else @@ -1660,7 +1693,9 @@ setup_current_filesystem(struct archive_read_disk *a) { struct tree *t = a->tree; struct statfs sfs; +#if defined(HAVE_STATVFS) struct statvfs svfs; +#endif int r, vr = 0, xr = 0; if (tree_current_is_symblic_link_target(t)) { @@ -1677,7 +1712,9 @@ setup_current_filesystem(struct archive_read_disk *a) "openat failed"); return (ARCHIVE_FAILED); } +#if defined(HAVE_FSTATVFS) vr = fstatvfs(fd, &svfs);/* for f_flag, mount flags */ +#endif r = fstatfs(fd, &sfs); if (r == 0) xr = get_xfer_size(t, fd, NULL); @@ -1687,14 +1724,18 @@ setup_current_filesystem(struct archive_read_disk *a) archive_set_error(&a->archive, errno, "fchdir failed"); return (ARCHIVE_FAILED); } +#if defined(HAVE_STATVFS) vr = statvfs(tree_current_access_path(t), &svfs); +#endif r = statfs(tree_current_access_path(t), &sfs); if (r == 0) xr = get_xfer_size(t, -1, tree_current_access_path(t)); #endif } else { #ifdef HAVE_FSTATFS +#if defined(HAVE_FSTATVFS) vr = fstatvfs(tree_current_dir_fd(t), &svfs); +#endif r = fstatfs(tree_current_dir_fd(t), &sfs); if (r == 0) xr = get_xfer_size(t, tree_current_dir_fd(t), NULL); @@ -1703,7 +1744,9 @@ setup_current_filesystem(struct archive_read_disk *a) archive_set_error(&a->archive, errno, "fchdir failed"); return (ARCHIVE_FAILED); } +#if defined(HAVE_STATVFS) vr = statvfs(".", &svfs); +#endif r = statfs(".", &sfs); if (r == 0) xr = get_xfer_size(t, -1, "."); @@ -1716,10 +1759,17 @@ setup_current_filesystem(struct archive_read_disk *a) return (ARCHIVE_FAILED); } else if (xr == 1) { /* pathconf(_PC_REX_*) operations are not supported. */ +#if defined(HAVE_STATVFS) t->current_filesystem->xfer_align = svfs.f_frsize; t->current_filesystem->max_xfer_size = -1; t->current_filesystem->min_xfer_size = svfs.f_bsize; t->current_filesystem->incr_xfer_size = svfs.f_bsize; +#else + t->current_filesystem->xfer_align = sfs.f_frsize; + t->current_filesystem->max_xfer_size = -1; + t->current_filesystem->min_xfer_size = sfs.f_bsize; + t->current_filesystem->incr_xfer_size = sfs.f_bsize; +#endif } switch (sfs.f_type) { case AFS_SUPER_MAGIC: @@ -1744,7 +1794,11 @@ setup_current_filesystem(struct archive_read_disk *a) } #if defined(ST_NOATIME) +#if defined(HAVE_STATVFS) if (svfs.f_flag & ST_NOATIME) +#else + if (sfs.f_flag & ST_NOATIME) +#endif t->current_filesystem->noatime = 1; else #endif @@ -1973,7 +2027,7 @@ tree_dup(int fd) static volatile int can_dupfd_cloexec = 1; if (can_dupfd_cloexec) { - new_fd = fcntl(fd, F_DUPFD_CLOEXEC); + new_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0); if (new_fd != -1) return (new_fd); /* Linux 2.6.18 - 2.6.23 declare F_DUPFD_CLOEXEC, diff --git a/libarchive/archive_read_disk_private.h b/libarchive/archive_read_disk_private.h index e5af16b9161b..2569321da544 100644 --- a/libarchive/archive_read_disk_private.h +++ b/libarchive/archive_read_disk_private.h @@ -39,6 +39,9 @@ struct archive_entry; struct archive_read_disk { struct archive archive; + /* Reused by archive_read_next_header() */ + struct archive_entry *entry; + /* * Symlink mode is one of 'L'ogical, 'P'hysical, or 'H'ybrid, * following an old BSD convention. 'L' follows all symlinks, @@ -68,6 +71,8 @@ struct archive_read_disk { int enable_copyfile; /* Set 1 if users request to traverse mount points. */ int traverse_mount_points; + /* Set 1 if users want to suppress xattr information. */ + int suppress_xattr; const char * (*lookup_gname)(void *private, int64_t gid); void (*cleanup_gname)(void *private); diff --git a/libarchive/archive_read_disk_set_standard_lookup.c b/libarchive/archive_read_disk_set_standard_lookup.c index 3bc52c70dbcb..d6b2d55b8d7b 100644 --- a/libarchive/archive_read_disk_set_standard_lookup.c +++ b/libarchive/archive_read_disk_set_standard_lookup.c @@ -83,7 +83,7 @@ static const char * lookup_uname_helper(struct name_cache *, id_t uid); * a simple cache to accelerate such lookups---into the archive_read_disk * object. This is in a separate file because getpwuid()/getgrgid() * can pull in a LOT of library code (including NIS/LDAP functions, which - * pull in DNS resolveers, etc). This can easily top 500kB, which makes + * pull in DNS resolvers, etc). This can easily top 500kB, which makes * it inappropriate for some space-constrained applications. * * Applications that are size-sensitive may want to just use the diff --git a/libarchive/archive_read_disk_windows.c b/libarchive/archive_read_disk_windows.c index 9c5420d80e77..566d264e9a41 100644 --- a/libarchive/archive_read_disk_windows.c +++ b/libarchive/archive_read_disk_windows.c @@ -288,6 +288,8 @@ static int _archive_read_free(struct archive *); static int _archive_read_close(struct archive *); static int _archive_read_data_block(struct archive *, const void **, size_t *, int64_t *); +static int _archive_read_next_header(struct archive *, + struct archive_entry **); static int _archive_read_next_header2(struct archive *, struct archive_entry *); static const char *trivial_lookup_gname(void *, int64_t gid); @@ -310,6 +312,7 @@ archive_read_disk_vtable(void) av.archive_free = _archive_read_free; av.archive_close = _archive_read_close; av.archive_read_data_block = _archive_read_data_block; + av.archive_read_next_header = _archive_read_next_header; av.archive_read_next_header2 = _archive_read_next_header2; inited = 1; } @@ -393,6 +396,7 @@ archive_read_disk_new(void) a->archive.magic = ARCHIVE_READ_DISK_MAGIC; a->archive.state = ARCHIVE_STATE_NEW; a->archive.vtable = archive_read_disk_vtable(); + a->entry = archive_entry_new2(&a->archive); a->lookup_uname = trivial_lookup_uname; a->lookup_gname = trivial_lookup_gname; a->enable_copyfile = 1; @@ -422,6 +426,7 @@ _archive_read_free(struct archive *_a) if (a->cleanup_uname != NULL && a->lookup_uname_data != NULL) (a->cleanup_uname)(a->lookup_uname_data); archive_string_free(&a->archive.error_string); + archive_entry_free(a->entry); a->archive.magic = 0; free(a); return (r); @@ -929,7 +934,7 @@ next_entry(struct archive_read_disk *a, struct tree *t, else flags |= FILE_FLAG_SEQUENTIAL_SCAN; t->entry_fh = CreateFileW(tree_current_access_path(t), - GENERIC_READ, 0, NULL, OPEN_EXISTING, flags, NULL); + GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, flags, NULL); if (t->entry_fh == INVALID_HANDLE_VALUE) { archive_set_error(&a->archive, errno, "Couldn't open %ls", tree_current_path(a->tree)); @@ -944,6 +949,17 @@ next_entry(struct archive_read_disk *a, struct tree *t, return (r); } +static int +_archive_read_next_header(struct archive *_a, struct archive_entry **entryp) +{ + int ret; + struct archive_read_disk *a = (struct archive_read_disk *)_a; + *entryp = NULL; + ret = _archive_read_next_header2(_a, a->entry); + *entryp = a->entry; + return ret; +} + static int _archive_read_next_header2(struct archive *_a, struct archive_entry *entry) { @@ -1000,6 +1016,7 @@ _archive_read_next_header2(struct archive *_a, struct archive_entry *entry) break; } + __archive_reset_read_data(&a->archive); return (r); } @@ -1569,7 +1586,7 @@ tree_reopen(struct tree *t, const wchar_t *path, int restore_time) t->stack->flags = needsFirstVisit; /* * Debug flag for Direct IO(No buffering) or Async IO. - * Those dependant on environment variable switches + * Those dependent on environment variable switches * will be removed until next release. */ { @@ -1851,8 +1868,6 @@ entry_copy_bhfi(struct archive_entry *entry, const wchar_t *path, break; case L'C': case L'c': if (((p[2] == L'M' || p[2] == L'm' ) && - (p[3] == L'D' || p[3] == L'd' )) || - ((p[2] == L'M' || p[2] == L'm' ) && (p[3] == L'D' || p[3] == L'd' ))) mode |= S_IXUSR | S_IXGRP | S_IXOTH; break; @@ -1886,7 +1901,7 @@ tree_current_file_information(struct tree *t, BY_HANDLE_FILE_INFORMATION *st, if (sim_lstat && tree_current_is_physical_link(t)) flag |= FILE_FLAG_OPEN_REPARSE_POINT; - h = CreateFileW(tree_current_access_path(t), 0, 0, NULL, + h = CreateFileW(tree_current_access_path(t), 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, flag, NULL); if (h == INVALID_HANDLE_VALUE) { la_dosmaperr(GetLastError()); @@ -2115,7 +2130,7 @@ archive_read_disk_entry_from_file(struct archive *_a, } else desiredAccess = GENERIC_READ; - h = CreateFileW(path, desiredAccess, 0, NULL, + h = CreateFileW(path, desiredAccess, FILE_SHARE_READ, NULL, OPEN_EXISTING, flag, NULL); if (h == INVALID_HANDLE_VALUE) { la_dosmaperr(GetLastError()); @@ -2162,7 +2177,7 @@ archive_read_disk_entry_from_file(struct archive *_a, if (fd >= 0) { h = (HANDLE)_get_osfhandle(fd); } else { - h = CreateFileW(path, GENERIC_READ, 0, NULL, + h = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if (h == INVALID_HANDLE_VALUE) { la_dosmaperr(GetLastError()); diff --git a/libarchive/archive_read_extract.c b/libarchive/archive_read_extract.c index 795f2abea847..b7973fa8e006 100644 --- a/libarchive/archive_read_extract.c +++ b/libarchive/archive_read_extract.c @@ -26,158 +26,35 @@ #include "archive_platform.h" __FBSDID("$FreeBSD: src/lib/libarchive/archive_read_extract.c,v 1.61 2008/05/26 17:00:22 kientzle Exp $"); -#ifdef HAVE_SYS_TYPES_H -#include -#endif #ifdef HAVE_ERRNO_H #include #endif -#ifdef HAVE_STDLIB_H -#include -#endif -#ifdef HAVE_STRING_H -#include -#endif #include "archive.h" #include "archive_entry.h" #include "archive_private.h" #include "archive_read_private.h" -#include "archive_write_disk_private.h" - -struct extract { - struct archive *ad; /* archive_write_disk object */ - - /* Progress function invoked during extract. */ - void (*extract_progress)(void *); - void *extract_progress_user_data; -}; - -static int archive_read_extract_cleanup(struct archive_read *); -static int copy_data(struct archive *ar, struct archive *aw); -static struct extract *get_extract(struct archive_read *); - -static struct extract * -get_extract(struct archive_read *a) -{ - /* If we haven't initialized, do it now. */ - /* This also sets up a lot of global state. */ - if (a->extract == NULL) { - a->extract = (struct extract *)malloc(sizeof(*a->extract)); - if (a->extract == NULL) { - archive_set_error(&a->archive, ENOMEM, "Can't extract"); - return (NULL); - } - memset(a->extract, 0, sizeof(*a->extract)); - a->extract->ad = archive_write_disk_new(); - if (a->extract->ad == NULL) { - archive_set_error(&a->archive, ENOMEM, "Can't extract"); - return (NULL); - } - archive_write_disk_set_standard_lookup(a->extract->ad); - a->cleanup_archive_extract = archive_read_extract_cleanup; - } - return (a->extract); -} int archive_read_extract(struct archive *_a, struct archive_entry *entry, int flags) { - struct extract *extract; + struct archive_read_extract *extract; + struct archive_read * a = (struct archive_read *)_a; - extract = get_extract((struct archive_read *)_a); + extract = __archive_read_get_extract(a); if (extract == NULL) return (ARCHIVE_FATAL); - archive_write_disk_set_options(extract->ad, flags); - return (archive_read_extract2(_a, entry, extract->ad)); -} -int -archive_read_extract2(struct archive *_a, struct archive_entry *entry, - struct archive *ad) -{ - struct archive_read *a = (struct archive_read *)_a; - int r, r2; - - /* Set up for this particular entry. */ - if (a->skip_file_set) - archive_write_disk_set_skip_file(ad, - a->skip_file_dev, a->skip_file_ino); - r = archive_write_header(ad, entry); - if (r < ARCHIVE_WARN) - r = ARCHIVE_WARN; - if (r != ARCHIVE_OK) - /* If _write_header failed, copy the error. */ - archive_copy_error(&a->archive, ad); - else if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) > 0) - /* Otherwise, pour data into the entry. */ - r = copy_data(_a, ad); - r2 = archive_write_finish_entry(ad); - if (r2 < ARCHIVE_WARN) - r2 = ARCHIVE_WARN; - /* Use the first message. */ - if (r2 != ARCHIVE_OK && r == ARCHIVE_OK) - archive_copy_error(&a->archive, ad); - /* Use the worst error return. */ - if (r2 < r) - r = r2; - return (r); -} - -void -archive_read_extract_set_progress_callback(struct archive *_a, - void (*progress_func)(void *), void *user_data) -{ - struct archive_read *a = (struct archive_read *)_a; - struct extract *extract = get_extract(a); - if (extract != NULL) { - extract->extract_progress = progress_func; - extract->extract_progress_user_data = user_data; - } -} - -static int -copy_data(struct archive *ar, struct archive *aw) -{ - int64_t offset; - const void *buff; - struct extract *extract; - size_t size; - int r; - - extract = get_extract((struct archive_read *)ar); - if (extract == NULL) - return (ARCHIVE_FATAL); - for (;;) { - r = archive_read_data_block(ar, &buff, &size, &offset); - if (r == ARCHIVE_EOF) - return (ARCHIVE_OK); - if (r != ARCHIVE_OK) - return (r); - r = (int)archive_write_data_block(aw, buff, size, offset); - if (r < ARCHIVE_WARN) - r = ARCHIVE_WARN; - if (r != ARCHIVE_OK) { - archive_set_error(ar, archive_errno(aw), - "%s", archive_error_string(aw)); - return (r); + /* If we haven't initialized the archive_write_disk object, do it now. */ + if (extract->ad == NULL) { + extract->ad = archive_write_disk_new(); + if (extract->ad == NULL) { + archive_set_error(&a->archive, ENOMEM, "Can't extract"); + return (ARCHIVE_FATAL); } - if (extract->extract_progress) - (extract->extract_progress) - (extract->extract_progress_user_data); + archive_write_disk_set_standard_lookup(extract->ad); } -} -/* - * Cleanup function for archive_extract. - */ -static int -archive_read_extract_cleanup(struct archive_read *a) -{ - int ret = ARCHIVE_OK; - - ret = archive_write_free(a->extract->ad); - free(a->extract); - a->extract = NULL; - return (ret); + archive_write_disk_set_options(extract->ad, flags); + return (archive_read_extract2(&a->archive, entry, extract->ad)); } diff --git a/libarchive/archive_read_extract2.c b/libarchive/archive_read_extract2.c new file mode 100644 index 000000000000..62a46bef01d2 --- /dev/null +++ b/libarchive/archive_read_extract2.c @@ -0,0 +1,156 @@ +/*- + * 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_SYS_TYPES_H +#include +#endif +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include "archive.h" +#include "archive_entry.h" +#include "archive_private.h" +#include "archive_read_private.h" + +static int copy_data(struct archive *ar, struct archive *aw); +static int archive_read_extract_cleanup(struct archive_read *); + + +/* Retrieve an extract object without initialising the associated + * archive_write_disk object. + */ +struct archive_read_extract * +__archive_read_get_extract(struct archive_read *a) +{ + if (a->extract == NULL) { + a->extract = (struct archive_read_extract *)malloc(sizeof(*a->extract)); + if (a->extract == NULL) { + archive_set_error(&a->archive, ENOMEM, "Can't extract"); + return (NULL); + } + memset(a->extract, 0, sizeof(*a->extract)); + a->cleanup_archive_extract = archive_read_extract_cleanup; + } + return (a->extract); +} + +/* + * Cleanup function for archive_extract. + */ +static int +archive_read_extract_cleanup(struct archive_read *a) +{ + int ret = ARCHIVE_OK; + + if (a->extract->ad != NULL) { + ret = archive_write_free(a->extract->ad); + } + free(a->extract); + a->extract = NULL; + return (ret); +} + +int +archive_read_extract2(struct archive *_a, struct archive_entry *entry, + struct archive *ad) +{ + struct archive_read *a = (struct archive_read *)_a; + int r, r2; + + /* Set up for this particular entry. */ + if (a->skip_file_set) + archive_write_disk_set_skip_file(ad, + a->skip_file_dev, a->skip_file_ino); + r = archive_write_header(ad, entry); + if (r < ARCHIVE_WARN) + r = ARCHIVE_WARN; + if (r != ARCHIVE_OK) + /* If _write_header failed, copy the error. */ + archive_copy_error(&a->archive, ad); + else if (!archive_entry_size_is_set(entry) || archive_entry_size(entry) > 0) + /* Otherwise, pour data into the entry. */ + r = copy_data(_a, ad); + r2 = archive_write_finish_entry(ad); + if (r2 < ARCHIVE_WARN) + r2 = ARCHIVE_WARN; + /* Use the first message. */ + if (r2 != ARCHIVE_OK && r == ARCHIVE_OK) + archive_copy_error(&a->archive, ad); + /* Use the worst error return. */ + if (r2 < r) + r = r2; + return (r); +} + +void +archive_read_extract_set_progress_callback(struct archive *_a, + void (*progress_func)(void *), void *user_data) +{ + struct archive_read *a = (struct archive_read *)_a; + struct archive_read_extract *extract = __archive_read_get_extract(a); + if (extract != NULL) { + extract->extract_progress = progress_func; + extract->extract_progress_user_data = user_data; + } +} + +static int +copy_data(struct archive *ar, struct archive *aw) +{ + int64_t offset; + const void *buff; + struct archive_read_extract *extract; + size_t size; + int r; + + extract = __archive_read_get_extract((struct archive_read *)ar); + if (extract == NULL) + return (ARCHIVE_FATAL); + for (;;) { + r = archive_read_data_block(ar, &buff, &size, &offset); + if (r == ARCHIVE_EOF) + return (ARCHIVE_OK); + if (r != ARCHIVE_OK) + return (r); + r = (int)archive_write_data_block(aw, buff, size, offset); + if (r < ARCHIVE_WARN) + r = ARCHIVE_WARN; + if (r < ARCHIVE_OK) { + archive_set_error(ar, archive_errno(aw), + "%s", archive_error_string(aw)); + return (r); + } + if (extract->extract_progress) + (extract->extract_progress) + (extract->extract_progress_user_data); + } +} diff --git a/libarchive/archive_read_filter.3 b/libarchive/archive_read_filter.3 index 8761127d96db..7f020e3734b8 100644 --- a/libarchive/archive_read_filter.3 +++ b/libarchive/archive_read_filter.3 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 2, 2012 +.Dd August 14, 2014 .Dt ARCHIVE_READ_FILTER 3 .Os .Sh NAME @@ -32,8 +32,11 @@ .Nm archive_read_support_filter_bzip2 , .Nm archive_read_support_filter_compress , .Nm archive_read_support_filter_gzip , +.Nm archive_read_support_filter_lz4 , .Nm archive_read_support_filter_lzma , .Nm archive_read_support_filter_none , +.Nm archive_read_support_filter_rpm , +.Nm archive_read_support_filter_uu , .Nm archive_read_support_filter_xz , .Nm archive_read_support_filter_program , .Nm archive_read_support_filter_program_signature @@ -50,12 +53,24 @@ Streaming Archive Library (libarchive, -larchive) .Ft int .Fn archive_read_support_filter_compress "struct archive *" .Ft int +.Fn archive_read_support_filter_grzip "struct archive *" +.Ft int .Fn archive_read_support_filter_gzip "struct archive *" .Ft int +.Fn archive_read_support_filter_lrzip "struct archive *" +.Ft int +.Fn archive_read_support_filter_lz4 "struct archive *" +.Ft int .Fn archive_read_support_filter_lzma "struct archive *" .Ft int +.Fn archive_read_support_filter_lzop "struct archive *" +.Ft int .Fn archive_read_support_filter_none "struct archive *" .Ft int +.Fn archive_read_support_filter_rpm "struct archive *" +.Ft int +.Fn archive_read_support_filter_uu "struct archive *" +.Ft int .Fn archive_read_support_filter_xz "struct archive *" .Ft int .Fo archive_read_support_filter_program @@ -75,9 +90,15 @@ Streaming Archive Library (libarchive, -larchive) .It Xo .Fn archive_read_support_filter_bzip2 , .Fn archive_read_support_filter_compress , +.Fn archive_read_support_filter_grzip , .Fn archive_read_support_filter_gzip , +.Fn archive_read_support_filter_lrzip , +.Fn archive_read_support_filter_lz4 , .Fn archive_read_support_filter_lzma , +.Fn archive_read_support_filter_lzop , .Fn archive_read_support_filter_none , +.Fn archive_read_support_filter_rpm , +.Fn archive_read_support_filter_uu , .Fn archive_read_support_filter_xz .Xc Enables auto-detection code and decompression support for the diff --git a/libarchive/archive_read_open.3 b/libarchive/archive_read_open.3 index 30a740bef13f..4d8272cac873 100644 --- a/libarchive/archive_read_open.3 +++ b/libarchive/archive_read_open.3 @@ -130,14 +130,14 @@ objects can be found in the overview manual page for The callback functions must match the following prototypes: .Bl -item -offset indent .It -.Ft typedef ssize_t +.Ft typedef la_ssize_t .Fo archive_read_callback .Fa "struct archive *" .Fa "void *client_data" .Fa "const void **buffer" .Fc .It -.Ft typedef off_t +.Ft typedef la_int64_t .Fo archive_skip_callback .Fa "struct archive *" .Fa "void *client_data" diff --git a/libarchive/archive_read_open_fd.c b/libarchive/archive_read_open_fd.c index e0f95bf41b65..f59cd07fe6c0 100644 --- a/libarchive/archive_read_open_fd.c +++ b/libarchive/archive_read_open_fd.c @@ -59,6 +59,7 @@ struct read_fd_data { static int file_close(struct archive *, void *); static ssize_t file_read(struct archive *, void *, const void **buff); +static int64_t file_seek(struct archive *, void *, int64_t request, int); static int64_t file_skip(struct archive *, void *, int64_t request); int @@ -102,6 +103,7 @@ archive_read_open_fd(struct archive *a, int fd, size_t block_size) archive_read_set_read_callback(a, file_read); archive_read_set_skip_callback(a, file_skip); + archive_read_set_seek_callback(a, file_seek); archive_read_set_close_callback(a, file_close); archive_read_set_callback_data(a, mine); return (archive_read_open1(a)); @@ -170,6 +172,33 @@ file_skip(struct archive *a, void *client_data, int64_t request) return (-1); } +/* + * TODO: Store the offset and use it in the read callback. + */ +static int64_t +file_seek(struct archive *a, void *client_data, int64_t request, int whence) +{ + struct read_fd_data *mine = (struct read_fd_data *)client_data; + int64_t r; + + /* We use off_t here because lseek() is declared that way. */ + /* See above for notes about when off_t is less than 64 bits. */ + r = lseek(mine->fd, request, whence); + if (r >= 0) + return r; + + if (errno == ESPIPE) { + archive_set_error(a, errno, + "A file descriptor(%d) is not seekable(PIPE)", mine->fd); + return (ARCHIVE_FAILED); + } else { + /* If the input is corrupted or truncated, fail. */ + archive_set_error(a, errno, + "Error seeking in a file descriptor(%d)", mine->fd); + return (ARCHIVE_FATAL); + } +} + static int file_close(struct archive *a, void *client_data) { diff --git a/libarchive/archive_read_open_file.c b/libarchive/archive_read_open_file.c index 3a33c258ee70..bfe933bf32e9 100644 --- a/libarchive/archive_read_open_file.c +++ b/libarchive/archive_read_open_file.c @@ -83,8 +83,9 @@ archive_read_open_FILE(struct archive *a, FILE *f) mine->f = f; /* * If we can't fstat() the file, it may just be that it's not - * a file. (FILE * objects can wrap many kinds of I/O - * streams, some of which don't support fileno()).) + * a file. (On some platforms, FILE * objects can wrap I/O + * streams that don't support fileno()). As a result, fileno() + * should be used cautiously.) */ if (fstat(fileno(mine->f), &st) == 0 && S_ISREG(st.st_mode)) { archive_read_extract_set_skip_file(a, st.st_dev, st.st_ino); @@ -150,7 +151,10 @@ file_skip(struct archive *a, void *client_data, int64_t request) skip = max_skip; } -#if HAVE_FSEEKO +#ifdef __ANDROID__ + /* fileno() isn't safe on all platforms ... see above. */ + if (lseek(fileno(mine->f), skip, SEEK_CUR) < 0) +#elif HAVE_FSEEKO if (fseeko(mine->f, skip, SEEK_CUR) != 0) #elif HAVE__FSEEKI64 if (_fseeki64(mine->f, skip, SEEK_CUR) != 0) diff --git a/libarchive/archive_read_open_filename.c b/libarchive/archive_read_open_filename.c index fefcd904d2c4..5611aa85aa45 100644 --- a/libarchive/archive_read_open_filename.c +++ b/libarchive/archive_read_open_filename.c @@ -103,7 +103,9 @@ int archive_read_open_filename(struct archive *a, const char *filename, size_t block_size) { - const char *filenames[2] = { filename, NULL }; + const char *filenames[2]; + filenames[0] = filename; + filenames[1] = NULL; return archive_read_open_filenames(a, filenames, block_size); } @@ -176,7 +178,7 @@ archive_read_open_filename_w(struct archive *a, const wchar_t *wfilename, #else /* * POSIX system does not support a wchar_t interface for - * open() system call, so we have to translate a whcar_t + * open() system call, so we have to translate a wchar_t * filename to multi-byte one and use it. */ struct archive_string fn; diff --git a/libarchive/archive_read_open_memory.c b/libarchive/archive_read_open_memory.c index bcc7d6f78e30..ff935a708f59 100644 --- a/libarchive/archive_read_open_memory.c +++ b/libarchive/archive_read_open_memory.c @@ -41,9 +41,9 @@ __FBSDID("$FreeBSD: src/lib/libarchive/archive_read_open_memory.c,v 1.6 2007/07/ */ struct read_memory_data { - unsigned char *start; - unsigned char *p; - unsigned char *end; + const unsigned char *start; + const unsigned char *p; + const unsigned char *end; ssize_t read_size; }; @@ -54,7 +54,7 @@ static int64_t memory_read_skip(struct archive *, void *, int64_t request); static ssize_t memory_read(struct archive *, void *, const void **buff); int -archive_read_open_memory(struct archive *a, void *buff, size_t size) +archive_read_open_memory(struct archive *a, const void *buff, size_t size) { return archive_read_open_memory2(a, buff, size, size); } @@ -65,7 +65,7 @@ archive_read_open_memory(struct archive *a, void *buff, size_t size) * test harnesses can exercise block operations inside the library. */ int -archive_read_open_memory2(struct archive *a, void *buff, +archive_read_open_memory2(struct archive *a, const void *buff, size_t size, size_t read_size) { struct read_memory_data *mine; @@ -76,7 +76,7 @@ archive_read_open_memory2(struct archive *a, void *buff, return (ARCHIVE_FATAL); } memset(mine, 0, sizeof(*mine)); - mine->start = mine->p = (unsigned char *)buff; + mine->start = mine->p = (const unsigned char *)buff; mine->end = mine->start + size; mine->read_size = read_size; archive_read_set_open_callback(a, memory_read_open); diff --git a/libarchive/archive_read_private.h b/libarchive/archive_read_private.h index 8a6c859a8a14..9b61a5380a2e 100644 --- a/libarchive/archive_read_private.h +++ b/libarchive/archive_read_private.h @@ -26,8 +26,10 @@ */ #ifndef __LIBARCHIVE_BUILD +#ifndef __LIBARCHIVE_TEST #error This header is only to be used internally to libarchive. #endif +#endif #ifndef ARCHIVE_READ_PRIVATE_H_INCLUDED #define ARCHIVE_READ_PRIVATE_H_INCLUDED @@ -141,6 +143,18 @@ struct archive_read_client { int64_t position; struct archive_read_data_node *dataset; }; +struct archive_read_passphrase { + char *passphrase; + struct archive_read_passphrase *next; +}; + +struct archive_read_extract { + struct archive *ad; /* archive_write_disk object */ + + /* Progress function invoked during extract. */ + void (*extract_progress)(void *); + void *extract_progress_user_data; +}; struct archive_read { struct archive archive; @@ -152,28 +166,11 @@ struct archive_read { int64_t skip_file_dev; int64_t skip_file_ino; - /* - * Used by archive_read_data() to track blocks and copy - * data to client buffers, filling gaps with zero bytes. - */ - const char *read_data_block; - int64_t read_data_offset; - int64_t read_data_output_offset; - size_t read_data_remaining; - - /* - * Used by formats/filters to determine the amount of data - * requested from a call to archive_read_data(). This is only - * useful when the format/filter has seek support. - */ - char read_data_is_posix_read; - size_t read_data_requested; - /* Callbacks to open/read/write/close client archive streams. */ struct archive_read_client client; /* Registered filter bidders. */ - struct archive_read_filter_bidder bidders[14]; + struct archive_read_filter_bidder bidders[16]; /* Last filter in chain */ struct archive_read_filter *filter; @@ -207,26 +204,41 @@ struct archive_read { int (*read_data_skip)(struct archive_read *); int64_t (*seek_data)(struct archive_read *, int64_t, int); int (*cleanup)(struct archive_read *); + int (*format_capabilties)(struct archive_read *); + int (*has_encrypted_entries)(struct archive_read *); } formats[16]; struct archive_format_descriptor *format; /* Active format. */ /* * Various information needed by archive_extract. */ - struct extract *extract; + struct archive_read_extract *extract; int (*cleanup_archive_extract)(struct archive_read *); + + /* + * Decryption passphrase. + */ + struct { + struct archive_read_passphrase *first; + struct archive_read_passphrase **last; + int candiate; + archive_passphrase_callback *callback; + void *client_data; + } passphrases; }; int __archive_read_register_format(struct archive_read *a, - void *format_data, - const char *name, - int (*bid)(struct archive_read *, int), - int (*options)(struct archive_read *, const char *, const char *), - int (*read_header)(struct archive_read *, struct archive_entry *), - int (*read_data)(struct archive_read *, const void **, size_t *, int64_t *), - int (*read_data_skip)(struct archive_read *), - int64_t (*seek_data)(struct archive_read *, int64_t, int), - int (*cleanup)(struct archive_read *)); + void *format_data, + const char *name, + int (*bid)(struct archive_read *, int), + int (*options)(struct archive_read *, const char *, const char *), + int (*read_header)(struct archive_read *, struct archive_entry *), + int (*read_data)(struct archive_read *, const void **, size_t *, int64_t *), + int (*read_data_skip)(struct archive_read *), + int64_t (*seek_data)(struct archive_read *, int64_t, int), + int (*cleanup)(struct archive_read *), + int (*format_capabilities)(struct archive_read *), + int (*has_encrypted_entries)(struct archive_read *)); int __archive_read_get_bidder(struct archive_read *a, struct archive_read_filter_bidder **bidder); @@ -241,4 +253,12 @@ int64_t __archive_read_filter_consume(struct archive_read_filter *, int64_t); int __archive_read_program(struct archive_read_filter *, const char *); void __archive_read_free_filters(struct archive_read *); int __archive_read_close_filters(struct archive_read *); +struct archive_read_extract *__archive_read_get_extract(struct archive_read *); + + +/* + * Get a decryption passphrase. + */ +void __archive_read_reset_passphrase(struct archive_read *a); +const char * __archive_read_next_passphrase(struct archive_read *a); #endif diff --git a/libarchive/archive_read_set_options.3 b/libarchive/archive_read_set_options.3 index 6fe9f90f8f38..1a251cefecd1 100644 --- a/libarchive/archive_read_set_options.3 +++ b/libarchive/archive_read_set_options.3 @@ -193,6 +193,28 @@ Defaults to enabled, use .Cm !rockridge to disable. .El +.It Format tar +.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 filenames. +.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. +.It Cm read_concatenated_archives +Ignore zeroed blocks in the archive, which occurs when multiple tar archives +have been concatenated together. Without this option, only the contents of +the first concatenated archive would be read. +.El .El .\" .Sh ERRORS diff --git a/libarchive/archive_read_set_options.c b/libarchive/archive_read_set_options.c index 793f8f73e53e..2e2eea69058d 100644 --- a/libarchive/archive_read_set_options.c +++ b/libarchive/archive_read_set_options.c @@ -76,18 +76,20 @@ archive_set_format_option(struct archive *_a, const char *m, const char *o, const char *v) { struct archive_read *a = (struct archive_read *)_a; - struct archive_format_descriptor *format; size_t i; - int r, rv = ARCHIVE_WARN; + int r, rv = ARCHIVE_WARN, matched_modules = 0; for (i = 0; i < sizeof(a->formats)/sizeof(a->formats[0]); i++) { - format = &a->formats[i]; - if (format == NULL || format->options == NULL || - format->name == NULL) + struct archive_format_descriptor *format = &a->formats[i]; + + if (format->options == NULL || format->name == NULL) /* This format does not support option. */ continue; - if (m != NULL && strcmp(format->name, m) != 0) - continue; + if (m != NULL) { + if (strcmp(format->name, m) != 0) + continue; + ++matched_modules; + } a->format = format; r = format->options(a, o, v); @@ -96,16 +98,13 @@ archive_set_format_option(struct archive *_a, const char *m, const char *o, if (r == ARCHIVE_FATAL) return (ARCHIVE_FATAL); - if (m != NULL) - return (r); - if (r == ARCHIVE_OK) rv = ARCHIVE_OK; } /* If the format name didn't match, return a special code for * _archive_set_option[s]. */ - if (rv == ARCHIVE_WARN && m != NULL) - rv = ARCHIVE_WARN - 1; + if (m != NULL && matched_modules == 0) + return ARCHIVE_WARN - 1; return (rv); } @@ -116,7 +115,7 @@ archive_set_filter_option(struct archive *_a, const char *m, const char *o, struct archive_read *a = (struct archive_read *)_a; struct archive_read_filter *filter; struct archive_read_filter_bidder *bidder; - int r, rv = ARCHIVE_WARN; + int r, rv = ARCHIVE_WARN, matched_modules = 0; for (filter = a->filter; filter != NULL; filter = filter->upstream) { bidder = filter->bidder; @@ -125,24 +124,24 @@ archive_set_filter_option(struct archive *_a, const char *m, const char *o, if (bidder->options == NULL) /* This bidder does not support option */ continue; - if (m != NULL && strcmp(filter->name, m) != 0) - continue; + if (m != NULL) { + if (strcmp(filter->name, m) != 0) + continue; + ++matched_modules; + } r = bidder->options(bidder, o, v); if (r == ARCHIVE_FATAL) return (ARCHIVE_FATAL); - if (m != NULL) - return (r); - if (r == ARCHIVE_OK) rv = ARCHIVE_OK; } /* If the filter name didn't match, return a special code for * _archive_set_option[s]. */ - if (rv == ARCHIVE_WARN && m != NULL) - rv = ARCHIVE_WARN - 1; + if (m != NULL && matched_modules == 0) + return ARCHIVE_WARN - 1; return (rv); } diff --git a/libarchive/archive_read_support_filter_all.c b/libarchive/archive_read_support_filter_all.c index b778cfb79215..68c53de41f2d 100644 --- a/libarchive/archive_read_support_filter_all.c +++ b/libarchive/archive_read_support_filter_all.c @@ -69,6 +69,8 @@ archive_read_support_filter_all(struct archive *a) archive_read_support_filter_lzop(a); /* The decode code always uses "grzip -d" command-line. */ archive_read_support_filter_grzip(a); + /* Lz4 falls back to "lz4 -d" command-line program. */ + archive_read_support_filter_lz4(a); /* Note: We always return ARCHIVE_OK here, even if some of the * above return ARCHIVE_WARN. The intent here is to enable diff --git a/libarchive/archive_read_support_filter_compress.c b/libarchive/archive_read_support_filter_compress.c index 3f5d1f37eab3..e05132dbfaec 100644 --- a/libarchive/archive_read_support_filter_compress.c +++ b/libarchive/archive_read_support_filter_compress.c @@ -185,19 +185,22 @@ compress_bidder_bid(struct archive_read_filter_bidder *self, (void)self; /* UNUSED */ - buffer = __archive_read_filter_ahead(filter, 2, &avail); + /* Shortest valid compress file is 3 bytes. */ + buffer = __archive_read_filter_ahead(filter, 3, &avail); if (buffer == NULL) return (0); bits_checked = 0; + /* First two bytes are the magic value */ if (buffer[0] != 0x1F || buffer[1] != 0x9D) return (0); - bits_checked += 16; - - /* - * TODO: Verify more. - */ + /* Third byte holds compression parameters. */ + if (buffer[2] & 0x20) /* Reserved bit, must be zero. */ + return (0); + if (buffer[2] & 0x40) /* Reserved bit, must be zero. */ + return (0); + bits_checked += 18; return (bits_checked); } @@ -239,7 +242,13 @@ compress_bidder_init(struct archive_read_filter *self) (void)getbits(self, 8); /* Skip first signature byte. */ (void)getbits(self, 8); /* Skip second signature byte. */ + /* Get compression parameters. */ code = getbits(self, 8); + if ((code & 0x1f) > 16) { + archive_set_error(&self->archive->archive, -1, + "Invalid compressed data"); + return (ARCHIVE_FATAL); + } state->maxcode_bits = code & 0x1f; state->maxcode = (1 << state->maxcode_bits); state->use_reset_code = code & 0x80; @@ -368,7 +377,8 @@ next_code(struct archive_read_filter *self) return (next_code(self)); } - if (code > state->free_ent) { + if (code > state->free_ent + || (code == state->free_ent && state->oldcode < 0)) { /* An invalid code is a fatal error. */ archive_set_error(&(self->archive->archive), -1, "Invalid compressed data"); diff --git a/libarchive/archive_read_support_filter_lz4.c b/libarchive/archive_read_support_filter_lz4.c new file mode 100644 index 000000000000..e877917b940b --- /dev/null +++ b/libarchive/archive_read_support_filter_lz4.c @@ -0,0 +1,737 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * 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 "archive_platform.h" + +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_ERRNO_H +#include +#endif +#include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_LZ4_H +#include +#endif + +#include "archive.h" +#include "archive_endian.h" +#include "archive_private.h" +#include "archive_read_private.h" +#include "archive_xxhash.h" + +#define LZ4_MAGICNUMBER 0x184d2204 +#define LZ4_SKIPPABLED 0x184d2a50 +#define LZ4_LEGACY 0x184c2102 + +#if defined(HAVE_LIBLZ4) +struct private_data { + enum { SELECT_STREAM, + READ_DEFAULT_STREAM, + READ_DEFAULT_BLOCK, + READ_LEGACY_STREAM, + READ_LEGACY_BLOCK, + } stage; + struct { + unsigned block_independence:1; + unsigned block_checksum:3; + unsigned stream_size:1; + unsigned stream_checksum:1; + unsigned preset_dictionary:1; + int block_maximum_size; + } flags; + int64_t stream_size; + uint32_t dict_id; + char *out_block; + size_t out_block_size; + + /* Bytes read but not yet consumed via __archive_read_consume() */ + size_t unconsumed; + size_t decoded_size; + void *xxh32_state; + + char valid; /* True = decompressor is initialized */ + char eof; /* True = found end of compressed data. */ +}; + +#define LEGACY_BLOCK_SIZE (8 * 1024 * 1024) + +/* Lz4 filter */ +static ssize_t lz4_filter_read(struct archive_read_filter *, const void **); +static int lz4_filter_close(struct archive_read_filter *); +#endif + +/* + * Note that we can detect lz4 archives even if we can't decompress + * them. (In fact, we like detecting them because we can give better + * error messages.) So the bid framework here gets compiled even + * if liblz4 is unavailable. + */ +static int lz4_reader_bid(struct archive_read_filter_bidder *, struct archive_read_filter *); +static int lz4_reader_init(struct archive_read_filter *); +static int lz4_reader_free(struct archive_read_filter_bidder *); +#if defined(HAVE_LIBLZ4) +static ssize_t lz4_filter_read_default_stream(struct archive_read_filter *, + const void **); +static ssize_t lz4_filter_read_legacy_stream(struct archive_read_filter *, + const void **); +#endif + +int +archive_read_support_filter_lz4(struct archive *_a) +{ + struct archive_read *a = (struct archive_read *)_a; + struct archive_read_filter_bidder *reader; + + archive_check_magic(_a, ARCHIVE_READ_MAGIC, + ARCHIVE_STATE_NEW, "archive_read_support_filter_lz4"); + + if (__archive_read_get_bidder(a, &reader) != ARCHIVE_OK) + return (ARCHIVE_FATAL); + + reader->data = NULL; + reader->name = "lz4"; + reader->bid = lz4_reader_bid; + reader->init = lz4_reader_init; + reader->options = NULL; + reader->free = lz4_reader_free; +#if defined(HAVE_LIBLZ4) + return (ARCHIVE_OK); +#else + archive_set_error(_a, ARCHIVE_ERRNO_MISC, + "Using external lz4 program"); + return (ARCHIVE_WARN); +#endif +} + +static int +lz4_reader_free(struct archive_read_filter_bidder *self){ + (void)self; /* UNUSED */ + return (ARCHIVE_OK); +} + +/* + * Test whether we can handle this data. + * + * This logic returns zero if any part of the signature fails. It + * also tries to Do The Right Thing if a very short buffer prevents us + * from verifying as much as we would like. + */ +static int +lz4_reader_bid(struct archive_read_filter_bidder *self, + struct archive_read_filter *filter) +{ + const unsigned char *buffer; + ssize_t avail; + int bits_checked; + uint32_t number; + + (void)self; /* UNUSED */ + + /* Minimal lz4 archive is 11 bytes. */ + buffer = __archive_read_filter_ahead(filter, 11, &avail); + if (buffer == NULL) + return (0); + + /* First four bytes must be LZ4 magic numbers. */ + bits_checked = 0; + if ((number = archive_le32dec(buffer)) == LZ4_MAGICNUMBER) { + unsigned char flag, BD; + + bits_checked += 32; + /* Next follows a stream descriptor. */ + /* Descriptor Flags. */ + flag = buffer[4]; + /* A version number must be "01". */ + if (((flag & 0xc0) >> 6) != 1) + return (0); + /* A reserved bit must be "0". */ + if (flag & 2) + return (0); + bits_checked += 8; + BD = buffer[5]; + /* A block maximum size shuld be more than 3. */ + if (((BD & 0x70) >> 4) < 4) + return (0); + /* Reserved bits must be "0". */ + if (BD & ~0x70) + return (0); + bits_checked += 8; + } else if (number == LZ4_LEGACY) { + bits_checked += 32; + } + + return (bits_checked); +} + +#if !defined(HAVE_LIBLZ4) + +/* + * If we don't have the library on this system, we can't actually do the + * decompression. We can, however, still detect compressed archives + * and emit a useful message. + */ +static int +lz4_reader_init(struct archive_read_filter *self) +{ + int r; + + r = __archive_read_program(self, "lz4 -d -q"); + /* Note: We set the format here even if __archive_read_program() + * above fails. We do, after all, know what the format is + * even if we weren't able to read it. */ + self->code = ARCHIVE_FILTER_LZ4; + self->name = "lz4"; + return (r); +} + + +#else + +/* + * Setup the callbacks. + */ +static int +lz4_reader_init(struct archive_read_filter *self) +{ + struct private_data *state; + + self->code = ARCHIVE_FILTER_LZ4; + self->name = "lz4"; + + state = (struct private_data *)calloc(sizeof(*state), 1); + if (state == NULL) { + archive_set_error(&self->archive->archive, ENOMEM, + "Can't allocate data for lz4 decompression"); + return (ARCHIVE_FATAL); + } + + self->data = state; + state->stage = SELECT_STREAM; + self->read = lz4_filter_read; + self->skip = NULL; /* not supported */ + self->close = lz4_filter_close; + + return (ARCHIVE_OK); +} + +static int +lz4_allocate_out_block(struct archive_read_filter *self) +{ + struct private_data *state = (struct private_data *)self->data; + size_t out_block_size = state->flags.block_maximum_size; + void *out_block; + + if (!state->flags.block_independence) + out_block_size += 64 * 1024; + if (state->out_block_size < out_block_size) { + free(state->out_block); + out_block = (unsigned char *)malloc(out_block_size); + state->out_block_size = out_block_size; + if (out_block == NULL) { + archive_set_error(&self->archive->archive, ENOMEM, + "Can't allocate data for lz4 decompression"); + return (ARCHIVE_FATAL); + } + state->out_block = out_block; + } + if (!state->flags.block_independence) + memset(state->out_block, 0, 64 * 1024); + return (ARCHIVE_OK); +} + +static int +lz4_allocate_out_block_for_legacy(struct archive_read_filter *self) +{ + struct private_data *state = (struct private_data *)self->data; + size_t out_block_size = LEGACY_BLOCK_SIZE; + void *out_block; + + if (state->out_block_size < out_block_size) { + free(state->out_block); + out_block = (unsigned char *)malloc(out_block_size); + state->out_block_size = out_block_size; + if (out_block == NULL) { + archive_set_error(&self->archive->archive, ENOMEM, + "Can't allocate data for lz4 decompression"); + return (ARCHIVE_FATAL); + } + state->out_block = out_block; + } + return (ARCHIVE_OK); +} + +/* + * Return the next block of decompressed data. + */ +static ssize_t +lz4_filter_read(struct archive_read_filter *self, const void **p) +{ + struct private_data *state = (struct private_data *)self->data; + ssize_t ret; + + if (state->eof) { + *p = NULL; + return (0); + } + + __archive_read_filter_consume(self->upstream, state->unconsumed); + state->unconsumed = 0; + + switch (state->stage) { + case SELECT_STREAM: + break; + case READ_DEFAULT_STREAM: + case READ_LEGACY_STREAM: + /* Reading a lz4 stream already failed. */ + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, "Invalid sequence."); + return (ARCHIVE_FATAL); + case READ_DEFAULT_BLOCK: + ret = lz4_filter_read_default_stream(self, p); + if (ret != 0 || state->stage != SELECT_STREAM) + return ret; + break; + case READ_LEGACY_BLOCK: + ret = lz4_filter_read_legacy_stream(self, p); + if (ret != 0 || state->stage != SELECT_STREAM) + return ret; + break; + default: + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, "Program error."); + return (ARCHIVE_FATAL); + break; + } + + while (state->stage == SELECT_STREAM) { + const char *read_buf; + + /* Read a magic number. */ + read_buf = __archive_read_filter_ahead(self->upstream, 4, + NULL); + if (read_buf == NULL) { + state->eof = 1; + *p = NULL; + return (0); + } + uint32_t number = archive_le32dec(read_buf); + __archive_read_filter_consume(self->upstream, 4); + if (number == LZ4_MAGICNUMBER) + return lz4_filter_read_default_stream(self, p); + else if (number == LZ4_LEGACY) + return lz4_filter_read_legacy_stream(self, p); + else if ((number & ~0xF) == LZ4_SKIPPABLED) { + read_buf = __archive_read_filter_ahead( + self->upstream, 4, NULL); + if (read_buf == NULL) { + archive_set_error( + &self->archive->archive, + ARCHIVE_ERRNO_MISC, + "Malformed lz4 data"); + return (ARCHIVE_FATAL); + } + uint32_t skip_bytes = archive_le32dec(read_buf); + __archive_read_filter_consume(self->upstream, + 4 + skip_bytes); + } else { + /* Ignore following unrecognized data. */ + state->eof = 1; + *p = NULL; + return (0); + } + } + state->eof = 1; + *p = NULL; + return (0); +} + +static int +lz4_filter_read_descriptor(struct archive_read_filter *self) +{ + struct private_data *state = (struct private_data *)self->data; + const char *read_buf; + ssize_t bytes_remaining; + ssize_t descriptor_bytes; + unsigned char flag, bd; + unsigned int chsum, chsum_verifier; + + /* Make sure we have 2 bytes for flags. */ + read_buf = __archive_read_filter_ahead(self->upstream, 2, + &bytes_remaining); + if (read_buf == NULL) { + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "truncated lz4 input"); + return (ARCHIVE_FATAL); + } + + /* + Parse flags. + */ + flag = (unsigned char)read_buf[0]; + /* Verify version number. */ + if ((flag & 0xc0) != 1<<6) + goto malformed_error; + /* A reserved bit must be zero. */ + if (flag & 0x02) + goto malformed_error; + state->flags.block_independence = (flag & 0x20) != 0; + state->flags.block_checksum = (flag & 0x10)?4:0; + state->flags.stream_size = (flag & 0x08) != 0; + state->flags.stream_checksum = (flag & 0x04) != 0; + state->flags.preset_dictionary = (flag & 0x01) != 0; + + /* BD */ + bd = (unsigned char)read_buf[1]; + /* Reserved bits must be zero. */ + if (bd & 0x8f) + goto malformed_error; + /* Get a maxinum block size. */ + switch (read_buf[1] >> 4) { + case 4: /* 64 KB */ + state->flags.block_maximum_size = 64 * 1024; + break; + case 5: /* 256 KB */ + state->flags.block_maximum_size = 256 * 1024; + break; + case 6: /* 1 MB */ + state->flags.block_maximum_size = 1024 * 1024; + break; + case 7: /* 4 MB */ + state->flags.block_maximum_size = 4 * 1024 * 1024; + break; + default: + goto malformed_error; + } + + /* Read the whole descriptor in a stream block. */ + descriptor_bytes = 3; + if (state->flags.stream_size) + descriptor_bytes += 8; + if (state->flags.preset_dictionary) + descriptor_bytes += 4; + if (bytes_remaining < descriptor_bytes) { + read_buf = __archive_read_filter_ahead(self->upstream, + descriptor_bytes, &bytes_remaining); + if (read_buf == NULL) { + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "truncated lz4 input"); + return (ARCHIVE_FATAL); + } + } + /* Check if a descriptor is corrupted */ + chsum = __archive_xxhash.XXH32(read_buf, (int)descriptor_bytes -1, 0); + chsum = (chsum >> 8) & 0xff; + chsum_verifier = read_buf[descriptor_bytes-1] & 0xff; + if (chsum != chsum_verifier) + goto malformed_error; + + __archive_read_filter_consume(self->upstream, descriptor_bytes); + + /* Make sure we have an enough buffer for uncompressed data. */ + if (lz4_allocate_out_block(self) != ARCHIVE_OK) + return (ARCHIVE_FATAL); + if (state->flags.stream_checksum) + state->xxh32_state = __archive_xxhash.XXH32_init(0); + + state->decoded_size = 0; + /* Success */ + return (ARCHIVE_OK); +malformed_error: + archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC, + "malformed lz4 data"); + return (ARCHIVE_FATAL); +} + +static ssize_t +lz4_filter_read_data_block(struct archive_read_filter *self, const void **p) +{ + struct private_data *state = (struct private_data *)self->data; + ssize_t compressed_size; + const char *read_buf; + ssize_t bytes_remaining; + int checksum_size; + ssize_t uncompressed_size; + size_t prefix64k; + + *p = NULL; + + /* Make sure we have 4 bytes for a block size. */ + read_buf = __archive_read_filter_ahead(self->upstream, 4, + &bytes_remaining); + if (read_buf == NULL) + goto truncated_error; + compressed_size = archive_le32dec(read_buf); + if ((compressed_size & ~(1 << 31)) > state->flags.block_maximum_size) + goto malformed_error; + /* A compressed size == 0 means the end of stream blocks. */ + if (compressed_size == 0) { + __archive_read_filter_consume(self->upstream, 4); + return 0; + } + + checksum_size = state->flags.block_checksum; + /* Check if the block is uncompressed. */ + if (compressed_size & (1 << 31)) { + compressed_size &= ~(1 << 31); + uncompressed_size = compressed_size; + } else + uncompressed_size = 0;/* Unknown yet. */ + + /* + Unfortunately, lz4 decompression API requires a whole block + for its decompression speed, so we read a whole block and allocate + a huge buffer used for decoded data. + */ + read_buf = __archive_read_filter_ahead(self->upstream, + 4 + compressed_size + checksum_size, &bytes_remaining); + if (read_buf == NULL) + goto truncated_error; + + /* Optional process, checking a block sum. */ + if (checksum_size) { + unsigned int chsum = __archive_xxhash.XXH32( + read_buf + 4, (int)compressed_size, 0); + unsigned int chsum_block = + archive_le32dec(read_buf + 4 + compressed_size); + if (chsum != chsum_block) + goto malformed_error; + } + + + /* If the block is uncompressed, there is nothing to do. */ + if (uncompressed_size) { + /* Prepare a prefix 64k block for next block. */ + if (!state->flags.block_independence) { + prefix64k = 64 * 1024; + if (uncompressed_size < (ssize_t)prefix64k) { + memcpy(state->out_block + + prefix64k - uncompressed_size, + read_buf + 4, + uncompressed_size); + memset(state->out_block, 0, + prefix64k - uncompressed_size); + } else { + memcpy(state->out_block, + read_buf + 4 + + uncompressed_size - prefix64k, + prefix64k); + } + state->decoded_size = 0; + } + state->unconsumed = 4 + uncompressed_size + checksum_size; + *p = read_buf + 4; + return uncompressed_size; + } + + /* + Decompress a block data. + */ + if (state->flags.block_independence) { + prefix64k = 0; + uncompressed_size = LZ4_decompress_safe(read_buf + 4, + state->out_block, (int)compressed_size, + state->flags.block_maximum_size); + } else { + prefix64k = 64 * 1024; + if (state->decoded_size) { + if (state->decoded_size < prefix64k) { + memmove(state->out_block + + prefix64k - state->decoded_size, + state->out_block + prefix64k, + state->decoded_size); + memset(state->out_block, 0, + prefix64k - state->decoded_size); + } else { + memmove(state->out_block, + state->out_block + state->decoded_size, + prefix64k); + } + } +#if LZ4_VERSION_MAJOR >= 1 && LZ4_VERSION_MINOR >= 7 + uncompressed_size = LZ4_decompress_safe_usingDict( + read_buf + 4, + state->out_block + prefix64k, (int)compressed_size, + state->flags.block_maximum_size, + state->out_block, + prefix64k); +#else + uncompressed_size = LZ4_decompress_safe_withPrefix64k( + read_buf + 4, + state->out_block + prefix64k, (int)compressed_size, + state->flags.block_maximum_size); +#endif + } + + /* Check if an error happend in decompression process. */ + if (uncompressed_size < 0) { + archive_set_error(&(self->archive->archive), + ARCHIVE_ERRNO_MISC, "lz4 decompression failed"); + return (ARCHIVE_FATAL); + } + + state->unconsumed = 4 + compressed_size + checksum_size; + *p = state->out_block + prefix64k; + state->decoded_size = uncompressed_size; + return uncompressed_size; + +malformed_error: + archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC, + "malformed lz4 data"); + return (ARCHIVE_FATAL); +truncated_error: + archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC, + "truncated lz4 input"); + return (ARCHIVE_FATAL); +} + +static ssize_t +lz4_filter_read_default_stream(struct archive_read_filter *self, const void **p) +{ + struct private_data *state = (struct private_data *)self->data; + const char *read_buf; + ssize_t bytes_remaining; + ssize_t ret; + + if (state->stage == SELECT_STREAM) { + state->stage = READ_DEFAULT_STREAM; + /* First, read a desciprtor. */ + if((ret = lz4_filter_read_descriptor(self)) != ARCHIVE_OK) + return (ret); + state->stage = READ_DEFAULT_BLOCK; + } + /* Decompress a block. */ + ret = lz4_filter_read_data_block(self, p); + + /* If the end of block is detected, change the filter status + to read next stream. */ + if (ret == 0 && *p == NULL) + state->stage = SELECT_STREAM; + + /* Optional process, checking a stream sum. */ + if (state->flags.stream_checksum) { + if (state->stage == SELECT_STREAM) { + unsigned int checksum; + unsigned int checksum_stream; + read_buf = __archive_read_filter_ahead(self->upstream, + 4, &bytes_remaining); + if (read_buf == NULL) { + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, "truncated lz4 input"); + return (ARCHIVE_FATAL); + } + checksum = archive_le32dec(read_buf); + __archive_read_filter_consume(self->upstream, 4); + checksum_stream = __archive_xxhash.XXH32_digest( + state->xxh32_state); + state->xxh32_state = NULL; + if (checksum != checksum_stream) { + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "lz4 stream cheksum error"); + return (ARCHIVE_FATAL); + } + } else if (ret > 0) + __archive_xxhash.XXH32_update(state->xxh32_state, + *p, (int)ret); + } + return (ret); +} + +static ssize_t +lz4_filter_read_legacy_stream(struct archive_read_filter *self, const void **p) +{ + struct private_data *state = (struct private_data *)self->data; + int compressed; + const char *read_buf; + ssize_t ret; + + *p = NULL; + ret = lz4_allocate_out_block_for_legacy(self); + if (ret != ARCHIVE_OK) + return ret; + + /* Make sure we have 4 bytes for a block size. */ + read_buf = __archive_read_filter_ahead(self->upstream, 4, NULL); + if (read_buf == NULL) { + if (state->stage == SELECT_STREAM) { + state->stage = READ_LEGACY_STREAM; + archive_set_error(&self->archive->archive, + ARCHIVE_ERRNO_MISC, + "truncated lz4 input"); + return (ARCHIVE_FATAL); + } + state->stage = SELECT_STREAM; + return 0; + } + state->stage = READ_LEGACY_BLOCK; + compressed = archive_le32dec(read_buf); + if (compressed > LZ4_COMPRESSBOUND(LEGACY_BLOCK_SIZE)) { + state->stage = SELECT_STREAM; + return 0; + } + + /* Make sure we have a whole block. */ + read_buf = __archive_read_filter_ahead(self->upstream, + 4 + compressed, NULL); + ret = LZ4_decompress_safe(read_buf + 4, state->out_block, + compressed, (int)state->out_block_size); + if (ret < 0) { + archive_set_error(&(self->archive->archive), + ARCHIVE_ERRNO_MISC, "lz4 decompression failed"); + return (ARCHIVE_FATAL); + } + *p = state->out_block; + state->unconsumed = 4 + compressed; + return ret; +} + +/* + * Clean up the decompressor. + */ +static int +lz4_filter_close(struct archive_read_filter *self) +{ + struct private_data *state; + int ret = ARCHIVE_OK; + + state = (struct private_data *)self->data; + free(state->xxh32_state); + free(state->out_block); + free(state); + return (ret); +} + +#endif /* HAVE_LIBLZ4 */ diff --git a/libarchive/archive_read_support_filter_lzop.c b/libarchive/archive_read_support_filter_lzop.c index 713af31e99f0..44ac9964ae11 100644 --- a/libarchive/archive_read_support_filter_lzop.c +++ b/libarchive/archive_read_support_filter_lzop.c @@ -242,10 +242,18 @@ consume_header(struct archive_read_filter *self) if (version >= 0x940) { unsigned level = *p++; - if (method == 1 && level == 0) level = 3; - if (method == 2 && level == 0) level = 1; - if (method == 3 && level == 0) level = 9; - if (level < 1 && level > 9) { +#if 0 + unsigned default_level[] = {0, 3, 1, 9}; +#endif + if (level == 0) + /* Method is 1..3 here due to check above. */ +#if 0 /* Avoid an error Clang Static Analyzer claims + "Value stored to 'level' is never read". */ + level = default_level[method]; +#else + ;/* NOP */ +#endif + else if (level > 9) { archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC, "Invalid level"); return (ARCHIVE_FAILED); diff --git a/libarchive/archive_read_support_filter_uu.c b/libarchive/archive_read_support_filter_uu.c index 471771b6f469..787a619f2f3a 100644 --- a/libarchive/archive_read_support_filter_uu.c +++ b/libarchive/archive_read_support_filter_uu.c @@ -509,7 +509,7 @@ uudecode_filter_read(struct archive_read_filter *self, const void **buff) return (ARCHIVE_FATAL); } llen = len; - if (nl == 0) { + if ((nl == 0) && (uudecode->state != ST_UUEND)) { /* * Save remaining data which does not contain * NL('\n','\r'). @@ -527,6 +527,7 @@ uudecode_filter_read(struct archive_read_filter *self, const void **buff) self->upstream, ravail); goto read_more; } + used += len; break; } switch (uudecode->state) { diff --git a/libarchive/archive_read_support_filter_xz.c b/libarchive/archive_read_support_filter_xz.c index 15824b1d0974..4e0a95feeb0f 100644 --- a/libarchive/archive_read_support_filter_xz.c +++ b/libarchive/archive_read_support_filter_xz.c @@ -601,7 +601,7 @@ lzip_init(struct archive_read_filter *self) return (ARCHIVE_FATAL); } ret = lzma_raw_decoder(&(state->stream), filters); -#if LZMA_VERSION < 50000030 +#if LZMA_VERSION < 50010000 free(filters[0].options); #endif if (ret != LZMA_OK) { @@ -627,7 +627,7 @@ lzip_tail(struct archive_read_filter *self) f = __archive_read_filter_ahead(self->upstream, tail, &avail_in); if (f == NULL && avail_in < 0) return (ARCHIVE_FATAL); - if (avail_in < tail) { + if (f == NULL || avail_in < tail) { archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC, "Lzip: Remaining data is less bytes"); return (ARCHIVE_FAILED); diff --git a/libarchive/archive_read_support_format_7zip.c b/libarchive/archive_read_support_format_7zip.c index 194b8d51c96a..90901acb710f 100644 --- a/libarchive/archive_read_support_format_7zip.c +++ b/libarchive/archive_read_support_format_7zip.c @@ -69,7 +69,11 @@ __FBSDID("$FreeBSD$"); #define _7Z_BZ2 0x040202 #define _7Z_PPMD 0x030401 #define _7Z_DELTA 0x03 -#define _7Z_CRYPTO 0x06F10701 +#define _7Z_CRYPTO_MAIN_ZIP 0x06F10101 /* Main Zip crypto algo */ +#define _7Z_CRYPTO_RAR_29 0x06F10303 /* Rar29 AES-128 + (modified SHA-1) */ +#define _7Z_CRYPTO_AES_256_SHA_256 0x06F10701 /* AES-256 + SHA-256 */ + + #define _7Z_X86 0x03030103 #define _7Z_X86_BCJ2 0x0303011B #define _7Z_POWERPC 0x03030205 @@ -104,6 +108,7 @@ __FBSDID("$FreeBSD$"); #define kMTime 0x14 #define kAttributes 0x15 #define kEncodedHeader 0x17 +#define kDummy 0x19 struct _7z_digests { unsigned char *defineds; @@ -322,8 +327,18 @@ struct _7zip { struct archive_string_conv *sconv; char format_name[64]; + + /* Custom value that is non-zero if this archive contains encrypted entries. */ + int has_encrypted_entries; }; +/* Maximum entry size. This limitation prevents reading intentional + * corrupted 7-zip files on assuming there are not so many entries in + * the files. */ +#define UMAX_ENTRY ARCHIVE_LITERAL_ULL(100000000) + +static int archive_read_format_7zip_has_encrypted_entries(struct archive_read *); +static int archive_read_support_format_7zip_capabilities(struct archive_read *a); static int archive_read_format_7zip_bid(struct archive_read *, int); static int archive_read_format_7zip_cleanup(struct archive_read *); static int archive_read_format_7zip_read_data(struct archive_read *, @@ -401,6 +416,13 @@ archive_read_support_format_7zip(struct archive *_a) return (ARCHIVE_FATAL); } + /* + * Until enough data has been read, we cannot tell about + * any encrypted entries yet. + */ + zip->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW; + + r = __archive_read_register_format(a, zip, "7zip", @@ -410,13 +432,36 @@ archive_read_support_format_7zip(struct archive *_a) archive_read_format_7zip_read_data, archive_read_format_7zip_read_data_skip, NULL, - archive_read_format_7zip_cleanup); + archive_read_format_7zip_cleanup, + archive_read_support_format_7zip_capabilities, + archive_read_format_7zip_has_encrypted_entries); if (r != ARCHIVE_OK) free(zip); return (ARCHIVE_OK); } +static int +archive_read_support_format_7zip_capabilities(struct archive_read * a) +{ + (void)a; /* UNUSED */ + return (ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA | + ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA); +} + + +static int +archive_read_format_7zip_has_encrypted_entries(struct archive_read *_a) +{ + if (_a && _a->format) { + struct _7zip * zip = (struct _7zip *)_a->format->data; + if (zip) { + return zip->has_encrypted_entries; + } + } + return ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW; +} + static int archive_read_format_7zip_bid(struct archive_read *a, int best_bid) { @@ -476,7 +521,7 @@ check_7zip_header_in_sfx(const char *p) switch ((unsigned char)p[5]) { case 0x1C: if (memcmp(p, _7ZIP_SIGNATURE, 6) != 0) - return (6); + return (6); /* * Test the CRC because its extraction code has 7-Zip * Magic Code, so we should do this in order not to @@ -484,15 +529,15 @@ check_7zip_header_in_sfx(const char *p) */ if (crc32(0, (const unsigned char *)p + 12, 20) != archive_le32dec(p + 8)) - return (6); + return (6); /* Hit the header! */ return (0); - case 0x37: return (5); - case 0x7A: return (4); - case 0xBC: return (3); - case 0xAF: return (2); - case 0x27: return (1); - default: return (6); + case 0x37: return (5); + case 0x7A: return (4); + case 0xBC: return (3); + case 0xAF: return (2); + case 0x27: return (1); + default: return (6); } } @@ -568,6 +613,19 @@ archive_read_format_7zip_read_header(struct archive_read *a, struct _7zip *zip = (struct _7zip *)a->format->data; struct _7zip_entry *zip_entry; int r, ret = ARCHIVE_OK; + struct _7z_folder *folder = 0; + uint64_t fidx = 0; + + /* + * It should be sufficient to call archive_read_next_header() for + * a reader to determine if an entry is encrypted or not. If the + * encryption of an entry is only detectable when calling + * archive_read_data(), so be it. We'll do the same check there + * as well. + */ + if (zip->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) { + zip->has_encrypted_entries = 0; + } a->archive.archive_format = ARCHIVE_FORMAT_7ZIP; if (a->archive.archive_format_name == NULL) @@ -588,7 +646,7 @@ archive_read_format_7zip_read_header(struct archive_read *a, } zip_entry = zip->entry; - if (zip->entries_remaining <= 0) + if (zip->entries_remaining <= 0 || zip_entry == NULL) return ARCHIVE_EOF; --zip->entries_remaining; @@ -604,6 +662,32 @@ archive_read_format_7zip_read_header(struct archive_read *a, return (ARCHIVE_FATAL); } + /* Figure out if the entry is encrypted by looking at the folder + that is associated to the current 7zip entry. If the folder + has a coder with a _7Z_CRYPTO codec then the folder is encrypted. + Hence the entry must also be encrypted. */ + if (zip_entry && zip_entry->folderIndex < zip->si.ci.numFolders) { + folder = &(zip->si.ci.folders[zip_entry->folderIndex]); + for (fidx=0; folder && fidxnumCoders; fidx++) { + switch(folder->coders[fidx].codec) { + case _7Z_CRYPTO_MAIN_ZIP: + case _7Z_CRYPTO_RAR_29: + case _7Z_CRYPTO_AES_256_SHA_256: { + archive_entry_set_is_data_encrypted(entry, 1); + zip->has_encrypted_entries = 1; + break; + } + } + } + } + + /* Now that we've checked for encryption, if there were still no + * encrypted entries found we can say for sure that there are none. + */ + if (zip->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) { + zip->has_encrypted_entries = 0; + } + if (archive_entry_copy_pathname_l(entry, (const char *)zip_entry->utf16name, zip_entry->name_len, zip->sconv) != 0) { @@ -707,6 +791,10 @@ archive_read_format_7zip_read_data(struct archive_read *a, zip = (struct _7zip *)(a->format->data); + if (zip->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) { + zip->has_encrypted_entries = 0; + } + if (zip->pack_stream_bytes_unconsumed) read_consume(a); @@ -969,7 +1057,7 @@ init_decompression(struct archive_read *a, struct _7zip *zip, { lzma_options_delta delta_opt; lzma_filter filters[LZMA_FILTERS_MAX]; -#if LZMA_VERSION < 50000030 +#if LZMA_VERSION < 50010000 lzma_filter *ff; #endif int fi = 0; @@ -994,7 +1082,7 @@ init_decompression(struct archive_read *a, struct _7zip *zip, * for BCJ+LZMA. If we were able to tell the uncompressed * size to liblzma when using lzma_raw_decoder() liblzma * could correctly deal with BCJ+LZMA. But unfortunately - * there is no way to do that. + * there is no way to do that. * Discussion about this can be found at XZ Utils forum. */ if (coder2 != NULL) { @@ -1056,7 +1144,7 @@ init_decompression(struct archive_read *a, struct _7zip *zip, else filters[fi].id = LZMA_FILTER_LZMA1; filters[fi].options = NULL; -#if LZMA_VERSION < 50000030 +#if LZMA_VERSION < 50010000 ff = &filters[fi]; #endif r = lzma_properties_decode(&filters[fi], NULL, @@ -1070,7 +1158,7 @@ init_decompression(struct archive_read *a, struct _7zip *zip, filters[fi].id = LZMA_VLI_UNKNOWN; filters[fi].options = NULL; r = lzma_raw_decoder(&(zip->lzstream), filters); -#if LZMA_VERSION < 50000030 +#if LZMA_VERSION < 50010000 free(ff->options); #endif if (r != LZMA_OK) { @@ -1113,7 +1201,7 @@ init_decompression(struct archive_read *a, struct _7zip *zip, } archive_set_error(&a->archive, err, "Internal error initializing decompressor: %s", - detail == NULL ? "??" : detail); + detail != NULL ? detail : "??"); zip->bzstream_valid = 0; return (ARCHIVE_FAILED); } @@ -1203,6 +1291,17 @@ init_decompression(struct archive_read *a, struct _7zip *zip, archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Unexpected codec ID: %lX", zip->codec); return (ARCHIVE_FAILED); + case _7Z_CRYPTO_MAIN_ZIP: + case _7Z_CRYPTO_RAR_29: + case _7Z_CRYPTO_AES_256_SHA_256: + if (a->entry) { + archive_entry_set_is_metadata_encrypted(a->entry, 1); + archive_entry_set_is_data_encrypted(a->entry, 1); + zip->has_encrypted_entries = 1; + } + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Crypto codec not supported yet (ID: 0x%lX)", zip->codec); + return (ARCHIVE_FAILED); default: archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Unknown codec ID: %lX", zip->codec); @@ -1426,7 +1525,7 @@ decompress(struct archive_read *a, struct _7zip *zip, do { int sym; - + sym = __archive_ppmd7_functions.Ppmd7_DecodeSymbol( &(zip->ppmd7_context), &(zip->range_dec.p)); if (sym < 0) { @@ -1570,7 +1669,7 @@ parse_7zip_uint64(struct archive_read *a, uint64_t *val) mask >>= 1; continue; } - *val += (avail & (mask -1)) << (8 * i); + *val += ((uint64_t)(avail & (mask -1))) << (8 * i); break; } return (0); @@ -1670,7 +1769,7 @@ read_PackInfo(struct archive_read *a, struct _7z_pack_info *pi) return (-1); if (pi->numPackStreams == 0) return (-1); - if (1000000 < pi->numPackStreams) + if (UMAX_ENTRY < pi->numPackStreams) return (-1); /* @@ -1799,12 +1898,12 @@ read_Folder(struct archive_read *a, struct _7z_folder *f) if (parse_7zip_uint64( a, &(f->coders[i].numInStreams)) < 0) return (-1); - if (1000000 < f->coders[i].numInStreams) + if (UMAX_ENTRY < f->coders[i].numInStreams) return (-1); if (parse_7zip_uint64( a, &(f->coders[i].numOutStreams)) < 0) return (-1); - if (1000000 < f->coders[i].numOutStreams) + if (UMAX_ENTRY < f->coders[i].numOutStreams) return (-1); } @@ -1844,11 +1943,11 @@ read_Folder(struct archive_read *a, struct _7z_folder *f) for (i = 0; i < f->numBindPairs; i++) { if (parse_7zip_uint64(a, &(f->bindPairs[i].inIndex)) < 0) return (-1); - if (1000000 < f->bindPairs[i].inIndex) + if (UMAX_ENTRY < f->bindPairs[i].inIndex) return (-1); if (parse_7zip_uint64(a, &(f->bindPairs[i].outIndex)) < 0) return (-1); - if (1000000 < f->bindPairs[i].outIndex) + if (UMAX_ENTRY < f->bindPairs[i].outIndex) return (-1); } @@ -1874,7 +1973,7 @@ read_Folder(struct archive_read *a, struct _7z_folder *f) for (i = 0; i < f->numPackedStreams; i++) { if (parse_7zip_uint64(a, &(f->packedStreams[i])) < 0) return (-1); - if (1000000 < f->packedStreams[i]) + if (UMAX_ENTRY < f->packedStreams[i]) return (-1); } } @@ -1916,8 +2015,8 @@ read_CodersInfo(struct archive_read *a, struct _7z_coders_info *ci) */ if (parse_7zip_uint64(a, &(ci->numFolders)) < 0) goto failed; - if (1000000 < ci->numFolders) - return (-1); + if (UMAX_ENTRY < ci->numFolders) + return (-1); /* * Read External. @@ -1938,9 +2037,18 @@ read_CodersInfo(struct archive_read *a, struct _7z_coders_info *ci) case 1: if (parse_7zip_uint64(a, &(ci->dataStreamIndex)) < 0) return (-1); - if (1000000 < ci->dataStreamIndex) + if (UMAX_ENTRY < ci->dataStreamIndex) return (-1); + if (ci->numFolders > 0) { + archive_set_error(&a->archive, -1, + "Malformed 7-Zip archive"); + goto failed; + } break; + default: + archive_set_error(&a->archive, -1, + "Malformed 7-Zip archive"); + goto failed; } if ((p = header_bytes(a, 1)) == NULL) @@ -2043,7 +2151,7 @@ read_SubStreamsInfo(struct archive_read *a, struct _7z_substream_info *ss, for (i = 0; i < numFolders; i++) { if (parse_7zip_uint64(a, &(f[i].numUnpackStreams)) < 0) return (-1); - if (1000000 < f[i].numUnpackStreams) + if (UMAX_ENTRY < f[i].numUnpackStreams) return (-1); unpack_streams += (size_t)f[i].numUnpackStreams; } @@ -2292,8 +2400,8 @@ read_Header(struct archive_read *a, struct _7z_header_info *h, if (parse_7zip_uint64(a, &(zip->numFiles)) < 0) return (-1); - if (1000000 < zip->numFiles) - return (-1); + if (UMAX_ENTRY < zip->numFiles) + return (-1); zip->entries = calloc((size_t)zip->numFiles, sizeof(*zip->entries)); if (zip->entries == NULL) @@ -2452,6 +2560,9 @@ read_Header(struct archive_read *a, struct _7z_header_info *h, } break; } + case kDummy: + if (ll == 0) + break; default: if (header_bytes(a, ll) == NULL) return (-1); @@ -2591,7 +2702,7 @@ read_Times(struct archive_read *a, struct _7z_header_info *h, int type) if (*p) { if (parse_7zip_uint64(a, &(h->dataIndex)) < 0) goto failed; - if (1000000 < h->dataIndex) + if (UMAX_ENTRY < h->dataIndex) goto failed; } @@ -2755,6 +2866,7 @@ slurp_central_directory(struct archive_read *a, struct _7zip *zip, zip->header_crc32 = 0; zip->header_is_encoded = 0; zip->header_is_being_read = 1; + zip->has_encrypted_entries = 0; check_header_crc = 1; if ((p = header_bytes(a, 1)) == NULL) { @@ -3170,7 +3282,7 @@ read_stream(struct archive_read *a, const void **buff, size_t size, return (r); /* - * Skip the bytes we alrady has skipped in skip_stream(). + * Skip the bytes we alrady has skipped in skip_stream(). */ while (skip_bytes) { ssize_t skipped; @@ -3235,16 +3347,36 @@ setup_decode_folder(struct archive_read *a, struct _7z_folder *folder, * Check coder types. */ for (i = 0; i < folder->numCoders; i++) { - if (folder->coders[i].codec == _7Z_CRYPTO) { - archive_set_error(&(a->archive), - ARCHIVE_ERRNO_MISC, - "The %s is encrypted, " - "but currently not supported", cname); - return (ARCHIVE_FATAL); + switch(folder->coders[i].codec) { + case _7Z_CRYPTO_MAIN_ZIP: + case _7Z_CRYPTO_RAR_29: + case _7Z_CRYPTO_AES_256_SHA_256: { + /* For entry that is associated with this folder, mark + it as encrypted (data+metadata). */ + zip->has_encrypted_entries = 1; + if (a->entry) { + archive_entry_set_is_data_encrypted(a->entry, 1); + archive_entry_set_is_metadata_encrypted(a->entry, 1); + } + archive_set_error(&(a->archive), + ARCHIVE_ERRNO_MISC, + "The %s is encrypted, " + "but currently not supported", cname); + return (ARCHIVE_FATAL); + } + case _7Z_X86_BCJ2: { + found_bcj2++; + break; + } } - if (folder->coders[i].codec == _7Z_X86_BCJ2) - found_bcj2++; } + /* Now that we've checked for encryption, if there were still no + * encrypted entries found we can say for sure that there are none. + */ + if (zip->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) { + zip->has_encrypted_entries = 0; + } + if ((folder->numCoders > 2 && !found_bcj2) || found_bcj2 > 1) { archive_set_error(&(a->archive), ARCHIVE_ERRNO_MISC, diff --git a/libarchive/archive_read_support_format_all.c b/libarchive/archive_read_support_format_all.c index 53fe6fa391a2..2127ebd33538 100644 --- a/libarchive/archive_read_support_format_all.c +++ b/libarchive/archive_read_support_format_all.c @@ -61,6 +61,7 @@ archive_read_support_format_all(struct archive *a) archive_read_support_format_mtree(a); archive_read_support_format_tar(a); archive_read_support_format_xar(a); + archive_read_support_format_warc(a); /* * Install expensive bidders last. By doing them last, we diff --git a/libarchive/archive_read_support_format_ar.c b/libarchive/archive_read_support_format_ar.c index 40be18c0cce2..4b5b66bd50a6 100644 --- a/libarchive/archive_read_support_format_ar.c +++ b/libarchive/archive_read_support_format_ar.c @@ -122,7 +122,9 @@ archive_read_support_format_ar(struct archive *_a) archive_read_format_ar_read_data, archive_read_format_ar_skip, NULL, - archive_read_format_ar_cleanup); + archive_read_format_ar_cleanup, + NULL, + NULL); if (r != ARCHIVE_OK) { free(ar); @@ -178,7 +180,7 @@ _ar_read_header(struct archive_read *a, struct archive_entry *entry, if (strncmp(h + AR_fmag_offset, "`\n", 2) != 0) { archive_set_error(&a->archive, EINVAL, "Incorrect file header signature"); - return (ARCHIVE_WARN); + return (ARCHIVE_FATAL); } /* Copy filename into work buffer. */ @@ -237,8 +239,15 @@ _ar_read_header(struct archive_read *a, struct archive_entry *entry, * and are not terminated in '/', so we don't trim anything * that starts with '/'.) */ - if (filename[0] != '/' && *p == '/') + if (filename[0] != '/' && p > filename && *p == '/') { *p = '\0'; + } + + if (p < filename) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Found entry with empty filename"); + return (ARCHIVE_FATAL); + } /* * '//' is the GNU filename table. @@ -260,12 +269,12 @@ _ar_read_header(struct archive_read *a, struct archive_entry *entry, if (entry_size == 0) { archive_set_error(&a->archive, EINVAL, "Invalid string table"); - return (ARCHIVE_WARN); + return (ARCHIVE_FATAL); } if (ar->strtab != NULL) { archive_set_error(&a->archive, EINVAL, "More than one string tables exist"); - return (ARCHIVE_WARN); + return (ARCHIVE_FATAL); } /* Read the filename table into memory. */ @@ -309,11 +318,11 @@ _ar_read_header(struct archive_read *a, struct archive_entry *entry, */ if (ar->strtab == NULL || number > ar->strtab_size) { archive_set_error(&a->archive, EINVAL, - "Can't find long filename for entry"); + "Can't find long filename for GNU/SVR4 archive entry"); archive_entry_copy_pathname(entry, filename); /* Parse the time, owner, mode, size fields. */ ar_parse_common_header(ar, entry, h); - return (ARCHIVE_WARN); + return (ARCHIVE_FATAL); } archive_entry_copy_pathname(entry, &ar->strtab[(size_t)number]); @@ -571,7 +580,7 @@ ar_parse_gnu_filename_table(struct archive_read *a) "Invalid string table"); free(ar->strtab); ar->strtab = NULL; - return (ARCHIVE_WARN); + return (ARCHIVE_FATAL); } static uint64_t diff --git a/libarchive/archive_read_support_format_cab.c b/libarchive/archive_read_support_format_cab.c index 3c9f94ca6ba3..fc70684afa04 100644 --- a/libarchive/archive_read_support_format_cab.c +++ b/libarchive/archive_read_support_format_cab.c @@ -383,7 +383,9 @@ archive_read_support_format_cab(struct archive *_a) archive_read_format_cab_read_data, archive_read_format_cab_read_data_skip, NULL, - archive_read_format_cab_cleanup); + archive_read_format_cab_cleanup, + NULL, + NULL); if (r != ARCHIVE_OK) free(cab); diff --git a/libarchive/archive_read_support_format_cpio.c b/libarchive/archive_read_support_format_cpio.c index 1dabc4786d28..c2ca85bd3ad9 100644 --- a/libarchive/archive_read_support_format_cpio.c +++ b/libarchive/archive_read_support_format_cpio.c @@ -243,7 +243,9 @@ archive_read_support_format_cpio(struct archive *_a) archive_read_format_cpio_read_data, archive_read_format_cpio_skip, NULL, - archive_read_format_cpio_cleanup); + archive_read_format_cpio_cleanup, + NULL, + NULL); if (r != ARCHIVE_OK) free(cpio); diff --git a/libarchive/archive_read_support_format_empty.c b/libarchive/archive_read_support_format_empty.c index 366073820975..c641eb9b150e 100644 --- a/libarchive/archive_read_support_format_empty.c +++ b/libarchive/archive_read_support_format_empty.c @@ -54,6 +54,8 @@ archive_read_support_format_empty(struct archive *_a) archive_read_format_empty_read_data, NULL, NULL, + NULL, + NULL, NULL); return (r); diff --git a/libarchive/archive_read_support_format_iso9660.c b/libarchive/archive_read_support_format_iso9660.c index 914bc71dfed5..6934ceefe9db 100644 --- a/libarchive/archive_read_support_format_iso9660.c +++ b/libarchive/archive_read_support_format_iso9660.c @@ -387,7 +387,7 @@ static int archive_read_format_iso9660_read_data(struct archive_read *, static int archive_read_format_iso9660_read_data_skip(struct archive_read *); static int archive_read_format_iso9660_read_header(struct archive_read *, struct archive_entry *); -static const char *build_pathname(struct archive_string *, struct file_info *); +static const char *build_pathname(struct archive_string *, struct file_info *, int); static int build_pathname_utf16be(unsigned char *, size_t, size_t *, struct file_info *); #if DEBUG @@ -478,7 +478,9 @@ archive_read_support_format_iso9660(struct archive *_a) archive_read_format_iso9660_read_data, archive_read_format_iso9660_read_data_skip, NULL, - archive_read_format_iso9660_cleanup); + archive_read_format_iso9660_cleanup, + NULL, + NULL); if (r != ARCHIVE_OK) { free(iso9660); @@ -1223,6 +1225,7 @@ archive_read_format_iso9660_read_header(struct archive_read *a, archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Pathname is too long"); + return (ARCHIVE_FATAL); } r = archive_entry_copy_pathname_l(entry, @@ -1245,9 +1248,16 @@ archive_read_format_iso9660_read_header(struct archive_read *a, rd_r = ARCHIVE_WARN; } } else { - archive_string_empty(&iso9660->pathname); - archive_entry_set_pathname(entry, - build_pathname(&iso9660->pathname, file)); + const char *path = build_pathname(&iso9660->pathname, file, 0); + if (path == NULL) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Pathname is too long"); + return (ARCHIVE_FATAL); + } else { + archive_string_empty(&iso9660->pathname); + archive_entry_set_pathname(entry, path); + } } iso9660->entry_bytes_remaining = file->size; @@ -1742,12 +1752,12 @@ parse_file_info(struct archive_read *a, struct file_info *parent, const unsigned char *isodirrec) { struct iso9660 *iso9660; - struct file_info *file; + struct file_info *file, *filep; size_t name_len; const unsigned char *rr_start, *rr_end; const unsigned char *p; size_t dr_len; - uint64_t fsize; + uint64_t fsize, offset; int32_t location; int flags; @@ -1791,6 +1801,16 @@ parse_file_info(struct archive_read *a, struct file_info *parent, return (NULL); } + /* Sanity check that this entry does not create a cycle. */ + offset = iso9660->logical_block_size * (uint64_t)location; + for (filep = parent; filep != NULL; filep = filep->parent) { + if (filep->offset == offset) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Directory structure contains loop"); + return (NULL); + } + } + /* Create a new file entry and copy data from the ISO dir record. */ file = (struct file_info *)calloc(1, sizeof(*file)); if (file == NULL) { @@ -1799,7 +1819,7 @@ parse_file_info(struct archive_read *a, struct file_info *parent, return (NULL); } file->parent = parent; - file->offset = iso9660->logical_block_size * (uint64_t)location; + file->offset = offset; file->size = fsize; file->mtime = isodate7(isodirrec + DR_date_offset); file->ctime = file->atime = file->mtime; @@ -3145,29 +3165,39 @@ static time_t time_from_tm(struct tm *t) { #if HAVE_TIMEGM - /* Use platform timegm() if available. */ - return (timegm(t)); + /* Use platform timegm() if available. */ + return (timegm(t)); #elif HAVE__MKGMTIME64 - return (_mkgmtime64(t)); + return (_mkgmtime64(t)); #else - /* Else use direct calculation using POSIX assumptions. */ - /* First, fix up tm_yday based on the year/month/day. */ - if (mktime(t) == (time_t)-1) - return ((time_t)-1); - /* Then we can compute timegm() from first principles. */ - return (t->tm_sec + t->tm_min * 60 + t->tm_hour * 3600 - + t->tm_yday * 86400 + (t->tm_year - 70) * 31536000 - + ((t->tm_year - 69) / 4) * 86400 - - ((t->tm_year - 1) / 100) * 86400 - + ((t->tm_year + 299) / 400) * 86400); + /* Else use direct calculation using POSIX assumptions. */ + /* First, fix up tm_yday based on the year/month/day. */ + if (mktime(t) == (time_t)-1) + return ((time_t)-1); + /* Then we can compute timegm() from first principles. */ + return (t->tm_sec + + t->tm_min * 60 + + t->tm_hour * 3600 + + t->tm_yday * 86400 + + (t->tm_year - 70) * 31536000 + + ((t->tm_year - 69) / 4) * 86400 + - ((t->tm_year - 1) / 100) * 86400 + + ((t->tm_year + 299) / 400) * 86400); #endif } static const char * -build_pathname(struct archive_string *as, struct file_info *file) +build_pathname(struct archive_string *as, struct file_info *file, int depth) { + // Plain ISO9660 only allows 8 dir levels; if we get + // to 1000, then something is very, very wrong. + if (depth > 1000) { + return NULL; + } if (file->parent != NULL && archive_strlen(&file->parent->name) > 0) { - build_pathname(as, file->parent); + if (build_pathname(as, file->parent, depth + 1) == NULL) { + return NULL; + } archive_strcat(as, "/"); } if (archive_strlen(&file->name) == 0) diff --git a/libarchive/archive_read_support_format_lha.c b/libarchive/archive_read_support_format_lha.c index f702949fb8c1..c359d83ef97a 100644 --- a/libarchive/archive_read_support_format_lha.c +++ b/libarchive/archive_read_support_format_lha.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2012 Michihiro NAKAJIMA + * Copyright (c) 2008-2014 Michihiro NAKAJIMA * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -82,9 +82,6 @@ struct lzh_dec { /* The length how many bytes we can copy decoded code from * the window. */ int copy_len; - /* The remaining bytes that we have not copied decoded data from - * the window to an output buffer. */ - int w_remaining; /* * Bit stream reader. @@ -140,10 +137,10 @@ struct lzh_dec { struct lzh_stream { const unsigned char *next_in; - int64_t avail_in; + int avail_in; int64_t total_in; - unsigned char *next_out; - int64_t avail_out; + const unsigned char *ref_ptr; + int avail_out; int64_t total_out; struct lzh_dec *ds; }; @@ -198,9 +195,6 @@ struct lha { char end_of_entry_cleanup; char entry_is_compressed; - unsigned char *uncompressed_buffer; - size_t uncompressed_buffer_size; - char format_name[64]; struct lzh_stream strm; @@ -214,41 +208,6 @@ struct lha { #define H_LEVEL_OFFSET 20 /* Header Level. */ #define H_SIZE 22 /* Minimum header size. */ -static const uint16_t crc16tbl[256] = { - 0x0000,0xC0C1,0xC181,0x0140,0xC301,0x03C0,0x0280,0xC241, - 0xC601,0x06C0,0x0780,0xC741,0x0500,0xC5C1,0xC481,0x0440, - 0xCC01,0x0CC0,0x0D80,0xCD41,0x0F00,0xCFC1,0xCE81,0x0E40, - 0x0A00,0xCAC1,0xCB81,0x0B40,0xC901,0x09C0,0x0880,0xC841, - 0xD801,0x18C0,0x1980,0xD941,0x1B00,0xDBC1,0xDA81,0x1A40, - 0x1E00,0xDEC1,0xDF81,0x1F40,0xDD01,0x1DC0,0x1C80,0xDC41, - 0x1400,0xD4C1,0xD581,0x1540,0xD701,0x17C0,0x1680,0xD641, - 0xD201,0x12C0,0x1380,0xD341,0x1100,0xD1C1,0xD081,0x1040, - 0xF001,0x30C0,0x3180,0xF141,0x3300,0xF3C1,0xF281,0x3240, - 0x3600,0xF6C1,0xF781,0x3740,0xF501,0x35C0,0x3480,0xF441, - 0x3C00,0xFCC1,0xFD81,0x3D40,0xFF01,0x3FC0,0x3E80,0xFE41, - 0xFA01,0x3AC0,0x3B80,0xFB41,0x3900,0xF9C1,0xF881,0x3840, - 0x2800,0xE8C1,0xE981,0x2940,0xEB01,0x2BC0,0x2A80,0xEA41, - 0xEE01,0x2EC0,0x2F80,0xEF41,0x2D00,0xEDC1,0xEC81,0x2C40, - 0xE401,0x24C0,0x2580,0xE541,0x2700,0xE7C1,0xE681,0x2640, - 0x2200,0xE2C1,0xE381,0x2340,0xE101,0x21C0,0x2080,0xE041, - 0xA001,0x60C0,0x6180,0xA141,0x6300,0xA3C1,0xA281,0x6240, - 0x6600,0xA6C1,0xA781,0x6740,0xA501,0x65C0,0x6480,0xA441, - 0x6C00,0xACC1,0xAD81,0x6D40,0xAF01,0x6FC0,0x6E80,0xAE41, - 0xAA01,0x6AC0,0x6B80,0xAB41,0x6900,0xA9C1,0xA881,0x6840, - 0x7800,0xB8C1,0xB981,0x7940,0xBB01,0x7BC0,0x7A80,0xBA41, - 0xBE01,0x7EC0,0x7F80,0xBF41,0x7D00,0xBDC1,0xBC81,0x7C40, - 0xB401,0x74C0,0x7580,0xB541,0x7700,0xB7C1,0xB681,0x7640, - 0x7200,0xB2C1,0xB381,0x7340,0xB101,0x71C0,0x7080,0xB041, - 0x5000,0x90C1,0x9181,0x5140,0x9301,0x53C0,0x5280,0x9241, - 0x9601,0x56C0,0x5780,0x9741,0x5500,0x95C1,0x9481,0x5440, - 0x9C01,0x5CC0,0x5D80,0x9D41,0x5F00,0x9FC1,0x9E81,0x5E40, - 0x5A00,0x9AC1,0x9B81,0x5B40,0x9901,0x59C0,0x5880,0x9841, - 0x8801,0x48C0,0x4980,0x8941,0x4B00,0x8BC1,0x8A81,0x4A40, - 0x4E00,0x8EC1,0x8F81,0x4F40,0x8D01,0x4DC0,0x4C80,0x8C41, - 0x4400,0x84C1,0x8581,0x4540,0x8701,0x47C0,0x4680,0x8641, - 0x8201,0x42C0,0x4380,0x8341,0x4100,0x81C1,0x8081,0x4040 -}; - static int archive_read_format_lha_bid(struct archive_read *, int); static int archive_read_format_lha_options(struct archive_read *, const char *, const char *); @@ -279,6 +238,7 @@ static int lha_read_data_none(struct archive_read *, const void **, size_t *, int64_t *); static int lha_read_data_lzh(struct archive_read *, const void **, size_t *, int64_t *); +static void lha_crc16_init(void); static uint16_t lha_crc16(uint16_t, const void *, size_t); static int lzh_decode_init(struct lzh_stream *, const char *); static void lzh_decode_free(struct lzh_stream *); @@ -320,7 +280,9 @@ archive_read_support_format_lha(struct archive *_a) archive_read_format_lha_read_data, archive_read_format_lha_read_data_skip, NULL, - archive_read_format_lha_cleanup); + archive_read_format_lha_cleanup, + NULL, + NULL); if (r != ARCHIVE_OK) free(lha); @@ -518,6 +480,8 @@ archive_read_format_lha_read_header(struct archive_read *a, const char *signature; int err; + lha_crc16_init(); + a->archive.archive_format = ARCHIVE_FORMAT_LHA; if (a->archive.archive_format_name == NULL) a->archive.archive_format_name = "lha"; @@ -1230,13 +1194,15 @@ lha_read_file_extended_header(struct archive_read *a, struct lha *lha, archive_string_empty(&lha->filename); break; } + if (extdheader[0] == '\0') + goto invalid; archive_strncpy(&lha->filename, (const char *)extdheader, datasize); break; case EXT_DIRECTORY: - if (datasize == 0) + if (datasize == 0 || extdheader[0] == '\0') /* no directory name data. exit this case. */ - break; + goto invalid; archive_strncpy(&lha->dirname, (const char *)extdheader, datasize); @@ -1375,6 +1341,26 @@ lha_read_file_extended_header(struct archive_read *a, struct lha *lha, return (ARCHIVE_FATAL); } +static int +lha_end_of_entry(struct archive_read *a) +{ + struct lha *lha = (struct lha *)(a->format->data); + int r = ARCHIVE_EOF; + + if (!lha->end_of_entry_cleanup) { + if ((lha->setflag & CRC_IS_SET) && + lha->crc != lha->entry_crc_calculated) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "LHa data CRC error"); + r = ARCHIVE_WARN; + } + + /* End-of-entry cleanup done. */ + lha->end_of_entry_cleanup = 1; + } + return (r); +} + static int archive_read_format_lha_read_data(struct archive_read *a, const void **buff, size_t *size, int64_t *offset) @@ -1388,22 +1374,10 @@ archive_read_format_lha_read_data(struct archive_read *a, lha->entry_unconsumed = 0; } if (lha->end_of_entry) { - if (!lha->end_of_entry_cleanup) { - if ((lha->setflag & CRC_IS_SET) && - lha->crc != lha->entry_crc_calculated) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_MISC, - "LHa data CRC error"); - return (ARCHIVE_WARN); - } - - /* End-of-entry cleanup done. */ - lha->end_of_entry_cleanup = 1; - } *offset = lha->entry_offset; *size = 0; *buff = NULL; - return (ARCHIVE_EOF); + return (lha_end_of_entry(a)); } if (lha->entry_is_compressed) @@ -1475,18 +1449,6 @@ lha_read_data_lzh(struct archive_read *a, const void **buff, ssize_t bytes_avail; int r; - /* If the buffer hasn't been allocated, allocate it now. */ - if (lha->uncompressed_buffer == NULL) { - lha->uncompressed_buffer_size = 64 * 1024; - lha->uncompressed_buffer - = (unsigned char *)malloc(lha->uncompressed_buffer_size); - if (lha->uncompressed_buffer == NULL) { - archive_set_error(&a->archive, ENOMEM, - "No memory for lzh decompression"); - return (ARCHIVE_FATAL); - } - } - /* If we haven't yet read any data, initialize the decompressor. */ if (!lha->decompress_init) { r = lzh_decode_init(&(lha->strm), lha->method); @@ -1532,12 +1494,9 @@ lha_read_data_lzh(struct archive_read *a, const void **buff, if (bytes_avail > lha->entry_bytes_remaining) bytes_avail = (ssize_t)lha->entry_bytes_remaining; - lha->strm.avail_in = bytes_avail; + lha->strm.avail_in = (int)bytes_avail; lha->strm.total_in = 0; - if (lha->strm.avail_out == 0) { - lha->strm.next_out = lha->uncompressed_buffer; - lha->strm.avail_out = lha->uncompressed_buffer_size; - } + lha->strm.avail_out = 0; r = lzh_decode(&(lha->strm), bytes_avail == lha->entry_bytes_remaining); switch (r) { @@ -1554,10 +1513,10 @@ lha_read_data_lzh(struct archive_read *a, const void **buff, lha->entry_unconsumed = lha->strm.total_in; lha->entry_bytes_remaining -= lha->strm.total_in; - if (lha->strm.avail_out == 0 || lha->end_of_entry) { + if (lha->strm.avail_out) { *offset = lha->entry_offset; - *size = lha->strm.next_out - lha->uncompressed_buffer; - *buff = lha->uncompressed_buffer; + *size = lha->strm.avail_out; + *buff = lha->strm.ref_ptr; lha->entry_crc_calculated = lha_crc16(lha->entry_crc_calculated, *buff, *size); lha->entry_offset += *size; @@ -1565,6 +1524,8 @@ lha_read_data_lzh(struct archive_read *a, const void **buff, *offset = lha->entry_offset; *size = 0; *buff = NULL; + if (lha->end_of_entry) + return (lha_end_of_entry(a)); } return (ARCHIVE_OK); } @@ -1609,7 +1570,6 @@ archive_read_format_lha_cleanup(struct archive_read *a) struct lha *lha = (struct lha *)(a->format->data); lzh_decode_free(&(lha->strm)); - free(lha->uncompressed_buffer); archive_string_free(&(lha->dirname)); archive_string_free(&(lha->filename)); archive_string_free(&(lha->uname)); @@ -1700,51 +1660,88 @@ lha_calcsum(unsigned char sum, const void *pp, int offset, size_t size) return (sum); } -#define CRC16(crc, v) do { \ - (crc) = crc16tbl[((crc) ^ v) & 0xFF] ^ ((crc) >> 8); \ -} while (0) +static uint16_t crc16tbl[2][256]; +static void +lha_crc16_init(void) +{ + unsigned int i; + static int crc16init = 0; + + if (crc16init) + return; + crc16init = 1; + + for (i = 0; i < 256; i++) { + unsigned int j; + uint16_t crc = (uint16_t)i; + for (j = 8; j; j--) + crc = (crc >> 1) ^ ((crc & 1) * 0xA001); + crc16tbl[0][i] = crc; + } + + for (i = 0; i < 256; i++) { + crc16tbl[1][i] = (crc16tbl[0][i] >> 8) + ^ crc16tbl[0][crc16tbl[0][i] & 0xff]; + } +} static uint16_t lha_crc16(uint16_t crc, const void *pp, size_t len) { - const unsigned char *buff = (const unsigned char *)pp; + const unsigned char *p = (const unsigned char *)pp; + const uint16_t *buff; + const union { + uint32_t i; + char c[4]; + } u = { 0x01020304 }; - while (len >= 8) { - CRC16(crc, *buff++); CRC16(crc, *buff++); - CRC16(crc, *buff++); CRC16(crc, *buff++); - CRC16(crc, *buff++); CRC16(crc, *buff++); - CRC16(crc, *buff++); CRC16(crc, *buff++); - len -= 8; + if (len == 0) + return crc; + + /* Process unaligned address. */ + if (((uintptr_t)p) & (uintptr_t)0x1) { + crc = (crc >> 8) ^ crc16tbl[0][(crc ^ *p++) & 0xff]; + len--; } - switch (len) { - case 7: - CRC16(crc, *buff++); - /* FALL THROUGH */ - case 6: - CRC16(crc, *buff++); - /* FALL THROUGH */ - case 5: - CRC16(crc, *buff++); - /* FALL THROUGH */ - case 4: - CRC16(crc, *buff++); - /* FALL THROUGH */ - case 3: - CRC16(crc, *buff++); - /* FALL THROUGH */ - case 2: - CRC16(crc, *buff++); - /* FALL THROUGH */ - case 1: - CRC16(crc, *buff); - /* FALL THROUGH */ - case 0: - break; + buff = (const uint16_t *)p; + /* + * Modern C compiler such as GCC does not unroll automatically yet + * without unrolling pragma, and Clang is so. So we should + * unroll this loop for its performance. + */ + for (;len >= 8; len -= 8) { + /* This if statement expects compiler optimization will + * remove the stament which will not be executed. */ +#if defined(_MSC_VER) && _MSC_VER >= 1400 /* Visual Studio */ +# define bswap16(x) _byteswap_ushort(x) +#elif (defined(__GNUC__) && __GNUC__ >= 4 && __GNUC_MINOR__ >= 8) \ + || defined(__clang__) +# define bswap16(x) __builtin_bswap16(x) +#else +# define bswap16(x) ((((x) >> 8) & 0xff) | ((x) << 8)) +#endif +#define CRC16W do { \ + if(u.c[0] == 1) { /* Big endian */ \ + crc ^= bswap16(*buff); buff++; \ + } else \ + crc ^= *buff++; \ + crc = crc16tbl[1][crc & 0xff] ^ crc16tbl[0][crc >> 8];\ +} while (0) + CRC16W; + CRC16W; + CRC16W; + CRC16W; +#undef CRC16W +#undef bswap16 } - return (crc); + + p = (const unsigned char *)buff; + for (;len; len--) { + crc = (crc >> 8) ^ crc16tbl[0][(crc ^ *p++) & 0xff]; + } + return crc; } - /* * Initialize LZHUF decoder. * @@ -1782,18 +1779,18 @@ lzh_decode_init(struct lzh_stream *strm, const char *method) return (ARCHIVE_FAILED);/* Not supported. */ } ds->error = ARCHIVE_FATAL; - w_size = ds->w_size; - ds->w_size = 1U << w_bits; + /* Expand a window size up to 128 KiB for decompressing process + * performance whatever its original window size is. */ + ds->w_size = 1U << 17; ds->w_mask = ds->w_size -1; - if (ds->w_buff == NULL || w_size != ds->w_size) { - free(ds->w_buff); + if (ds->w_buff == NULL) { ds->w_buff = malloc(ds->w_size); if (ds->w_buff == NULL) return (ARCHIVE_FATAL); } - memset(ds->w_buff, 0x20, ds->w_size); + w_size = 1U << w_bits; + memset(ds->w_buff + ds->w_size - w_size, 0x20, w_size); ds->w_pos = 0; - ds->w_remaining = 0; ds->state = 0; ds->pos_pt_len_size = w_bits + 1; ds->pos_pt_len_bits = (w_bits == 15 || w_bits == 16)? 5: 4; @@ -1880,9 +1877,10 @@ lzh_br_fillup(struct lzh_stream *strm, struct lzh_br *br) int n = CACHE_BITS - br->cache_avail; for (;;) { - switch (n >> 3) { - case 8: - if (strm->avail_in >= 8) { + const int x = n >> 3; + if (strm->avail_in >= x) { + switch (x) { + case 8: br->cache_buffer = ((uint64_t)strm->next_in[0]) << 56 | ((uint64_t)strm->next_in[1]) << 48 | @@ -1896,10 +1894,7 @@ lzh_br_fillup(struct lzh_stream *strm, struct lzh_br *br) strm->avail_in -= 8; br->cache_avail += 8 * 8; return (1); - } - break; - case 7: - if (strm->avail_in >= 7) { + case 7: br->cache_buffer = (br->cache_buffer << 56) | ((uint64_t)strm->next_in[0]) << 48 | @@ -1913,10 +1908,7 @@ lzh_br_fillup(struct lzh_stream *strm, struct lzh_br *br) strm->avail_in -= 7; br->cache_avail += 7 * 8; return (1); - } - break; - case 6: - if (strm->avail_in >= 6) { + case 6: br->cache_buffer = (br->cache_buffer << 48) | ((uint64_t)strm->next_in[0]) << 40 | @@ -1929,14 +1921,13 @@ lzh_br_fillup(struct lzh_stream *strm, struct lzh_br *br) strm->avail_in -= 6; br->cache_avail += 6 * 8; return (1); + case 0: + /* We have enough compressed data in + * the cache buffer.*/ + return (1); + default: + break; } - break; - case 0: - /* We have enough compressed data in - * the cache buffer.*/ - return (1); - default: - break; } if (strm->avail_in == 0) { /* There is not enough compressed data to fill up the @@ -1991,7 +1982,7 @@ static int lzh_decode(struct lzh_stream *strm, int last) { struct lzh_dec *ds = strm->ds; - int64_t avail_in; + int avail_in; int r; if (ds->error) @@ -2008,35 +1999,12 @@ lzh_decode(struct lzh_stream *strm, int last) return (r); } -static int -lzh_copy_from_window(struct lzh_stream *strm, struct lzh_dec *ds) +static void +lzh_emit_window(struct lzh_stream *strm, size_t s) { - size_t copy_bytes; - - if (ds->w_remaining == 0 && ds->w_pos > 0) { - if (ds->w_pos - ds->copy_pos <= strm->avail_out) - copy_bytes = ds->w_pos - ds->copy_pos; - else - copy_bytes = (size_t)strm->avail_out; - memcpy(strm->next_out, - ds->w_buff + ds->copy_pos, copy_bytes); - ds->copy_pos += (int)copy_bytes; - } else { - if (ds->w_remaining <= strm->avail_out) - copy_bytes = ds->w_remaining; - else - copy_bytes = (size_t)strm->avail_out; - memcpy(strm->next_out, - ds->w_buff + ds->w_size - ds->w_remaining, copy_bytes); - ds->w_remaining -= (int)copy_bytes; - } - strm->next_out += copy_bytes; - strm->avail_out -= copy_bytes; - strm->total_out += copy_bytes; - if (strm->avail_out == 0) - return (0); - else - return (1); + strm->ref_ptr = strm->ds->w_buff; + strm->avail_out = (int)s; + strm->total_out += s; } static int @@ -2071,8 +2039,9 @@ lzh_read_blocks(struct lzh_stream *strm, int last) goto failed; } if (ds->w_pos > 0) { - if (!lzh_copy_from_window(strm, ds)) - return (ARCHIVE_OK); + lzh_emit_window(strm, ds->w_pos); + ds->w_pos = 0; + return (ARCHIVE_OK); } /* End of compressed data; we have completely * handled all compressed data. */ @@ -2289,10 +2258,6 @@ lzh_decode_blocks(struct lzh_stream *strm, int last) int lt_max_bits = lt->max_bits, pt_max_bits = pt->max_bits; int state = ds->state; - if (ds->w_remaining > 0) { - if (!lzh_copy_from_window(strm, ds)) - goto next_data; - } for (;;) { switch (state) { case ST_GET_LITERAL: @@ -2347,9 +2312,8 @@ lzh_decode_blocks(struct lzh_stream *strm, int last) w_buff[w_pos] = c; if (++w_pos >= w_size) { w_pos = 0; - ds->w_remaining = w_size; - if (!lzh_copy_from_window(strm, ds)) - goto next_data; + lzh_emit_window(strm, w_size); + goto next_data; } } /* 'c' is the length of a match pattern we have @@ -2427,25 +2391,26 @@ lzh_decode_blocks(struct lzh_stream *strm, int last) d = w_buff + w_pos; s = w_buff + copy_pos; - for (li = 0; li < l; li++) + for (li = 0; li < l-1;) { + d[li] = s[li];li++; + d[li] = s[li];li++; + } + if (li < l) d[li] = s[li]; } - w_pos = (w_pos + l) & w_mask; - if (w_pos == 0) { - ds->w_remaining = w_size; - if (!lzh_copy_from_window(strm, ds)) { - if (copy_len <= l) - state = ST_GET_LITERAL; - else { - state = ST_COPY_DATA; - ds->copy_len = - copy_len - l; - ds->copy_pos = - (copy_pos + l) - & w_mask; - } - goto next_data; + w_pos += l; + if (w_pos == w_size) { + w_pos = 0; + lzh_emit_window(strm, w_size); + if (copy_len <= l) + state = ST_GET_LITERAL; + else { + state = ST_COPY_DATA; + ds->copy_len = copy_len - l; + ds->copy_pos = + (copy_pos + l) & w_mask; } + goto next_data; } if (copy_len <= l) /* A copy of current pattern ended. */ @@ -2505,14 +2470,80 @@ lzh_huffman_free(struct huffman *hf) free(hf->tree); } +static char bitlen_tbl[0x400] = { + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 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 9, 9, 9, 9, 9, 9, 9, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, + 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 16, 0 +}; static int lzh_read_pt_bitlen(struct lzh_stream *strm, int start, int end) { struct lzh_dec *ds = strm->ds; - struct lzh_br * br = &(ds->br); + struct lzh_br *br = &(ds->br); int c, i; - for (i = start; i < end;) { + for (i = start; i < end; ) { /* * bit pattern the number we need * 000 -> 0 @@ -2528,17 +2559,13 @@ lzh_read_pt_bitlen(struct lzh_stream *strm, int start, int end) if (!lzh_br_read_ahead(strm, br, 3)) return (i); if ((c = lzh_br_bits(br, 3)) == 7) { - int d; if (!lzh_br_read_ahead(strm, br, 13)) return (i); - d = lzh_br_bits(br, 13); - while (d & 0x200) { - c++; - d <<= 1; - } - if (c > 16) + c = bitlen_tbl[lzh_br_bits(br, 13) & 0x3FF]; + if (c) + lzh_br_consume(br, c - 3); + else return (-1);/* Invalid data. */ - lzh_br_consume(br, c - 3); } else lzh_br_consume(br, 3); ds->pt.bitlen[i++] = c; @@ -2601,7 +2628,7 @@ lzh_make_huffman_table(struct huffman *hf) } } if (maxbits > HTBL_BITS) { - int htbl_max; + unsigned htbl_max; uint16_t *p; diffbits = maxbits - HTBL_BITS; @@ -2645,8 +2672,40 @@ lzh_make_huffman_table(struct huffman *hf) return (0);/* Invalid */ /* Update the table */ p = &(tbl[ptn]); - while (--cnt >= 0) - p[cnt] = (uint16_t)i; + if (cnt > 7) { + uint16_t *pc; + + cnt -= 8; + pc = &p[cnt]; + pc[0] = (uint16_t)i; + pc[1] = (uint16_t)i; + pc[2] = (uint16_t)i; + pc[3] = (uint16_t)i; + pc[4] = (uint16_t)i; + pc[5] = (uint16_t)i; + pc[6] = (uint16_t)i; + pc[7] = (uint16_t)i; + if (cnt > 7) { + cnt -= 8; + memcpy(&p[cnt], pc, + 8 * sizeof(uint16_t)); + pc = &p[cnt]; + while (cnt > 15) { + cnt -= 16; + memcpy(&p[cnt], pc, + 16 * sizeof(uint16_t)); + } + } + if (cnt) + memcpy(p, pc, cnt * sizeof(uint16_t)); + } else { + while (cnt > 1) { + p[--cnt] = (uint16_t)i; + p[--cnt] = (uint16_t)i; + } + if (cnt) + p[--cnt] = (uint16_t)i; + } continue; } @@ -2740,7 +2799,7 @@ lzh_decode_huffman(struct huffman *hf, unsigned rbits) * If it fails, search a huffman tree for. */ c = hf->tbl[rbits >> hf->shift_bits]; - if (c < hf->len_avail) + if (c < hf->len_avail || hf->len_avail == 0) return (c); /* This bit pattern needs to be found out at a huffman tree. */ return (lzh_decode_huffman_tree(hf, rbits, c)); diff --git a/libarchive/archive_read_support_format_mtree.c b/libarchive/archive_read_support_format_mtree.c index c4e7021a869b..81d96521138e 100644 --- a/libarchive/archive_read_support_format_mtree.c +++ b/libarchive/archive_read_support_format_mtree.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_mtree.c 2011 #include "archive_private.h" #include "archive_read_private.h" #include "archive_string.h" +#include "archive_pack_dev.h" #ifndef O_BINARY #define O_BINARY 0 @@ -103,6 +104,7 @@ struct mtree { struct archive_entry_linkresolver *resolver; int64_t cur_size; + char checkfs; }; static int bid_keycmp(const char *, const char *, ssize_t); @@ -137,16 +139,22 @@ get_time_t_max(void) #if defined(TIME_T_MAX) return TIME_T_MAX; #else - static time_t t; - time_t a; - if (t == 0) { - a = 1; - while (a > t) { - t = a; - a = a * 2 + 1; + /* ISO C allows time_t to be a floating-point type, + but POSIX requires an integer type. The following + should work on any system that follows the POSIX + conventions. */ + if (((time_t)0) < ((time_t)-1)) { + /* Time_t is unsigned */ + return (~(time_t)0); + } else { + /* Time_t is signed. */ + /* Assume it's the same as int64_t or int32_t */ + if (sizeof(time_t) == sizeof(int64_t)) { + return (time_t)INT64_MAX; + } else { + return (time_t)INT32_MAX; } } - return t; #endif } @@ -156,23 +164,43 @@ get_time_t_min(void) #if defined(TIME_T_MIN) return TIME_T_MIN; #else - /* 't' will hold the minimum value, which will be zero (if - * time_t is unsigned) or -2^n (if time_t is signed). */ - static int computed; - static time_t t; - time_t a; - if (computed == 0) { - a = (time_t)-1; - while (a < t) { - t = a; - a = a * 2; - } - computed = 1; + if (((time_t)0) < ((time_t)-1)) { + /* Time_t is unsigned */ + return (time_t)0; + } else { + /* Time_t is signed. */ + if (sizeof(time_t) == sizeof(int64_t)) { + return (time_t)INT64_MIN; + } else { + return (time_t)INT32_MIN; + } } - return t; #endif } +static int +archive_read_format_mtree_options(struct archive_read *a, + const char *key, const char *val) +{ + struct mtree *mtree; + + mtree = (struct mtree *)(a->format->data); + if (strcmp(key, "checkfs") == 0) { + /* Allows to read information missing from the mtree from the file system */ + if (val == NULL || val[0] == 0) { + mtree->checkfs = 0; + } else { + mtree->checkfs = 1; + } + return (ARCHIVE_OK); + } + + /* Note: The "warn" return is just to inform the options + * supervisor that we didn't handle it. It will generate + * a suitable error if no one used this option. */ + return (ARCHIVE_WARN); +} + static void free_options(struct mtree_option *head) { @@ -205,7 +233,7 @@ archive_read_support_format_mtree(struct archive *_a) mtree->fd = -1; r = __archive_read_register_format(a, mtree, "mtree", - mtree_bid, NULL, read_header, read_data, skip, NULL, cleanup); + mtree_bid, archive_read_format_mtree_options, read_header, read_data, skip, NULL, cleanup, NULL, NULL); if (r != ARCHIVE_OK) free(mtree); @@ -367,7 +395,7 @@ bid_keyword(const char *p, ssize_t len) "gid", "gname", NULL }; static const char *keys_il[] = { - "ignore", "link", NULL + "ignore", "inode", "link", NULL }; static const char *keys_m[] = { "md5", "md5digest", "mode", NULL @@ -376,7 +404,7 @@ bid_keyword(const char *p, ssize_t len) "nlink", "nochange", "optional", NULL }; static const char *keys_r[] = { - "rmd160", "rmd160digest", NULL + "resdevice", "rmd160", "rmd160digest", NULL }; static const char *keys_s[] = { "sha1", "sha1digest", @@ -507,32 +535,34 @@ bid_entry(const char *p, ssize_t len, ssize_t nl, int *last_is_path) 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* E0 - EF */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* F0 - FF */ }; - ssize_t ll = len; + ssize_t ll; const char *pp = p; + const char * const pp_end = pp + len; *last_is_path = 0; /* * Skip the path-name which is quoted. */ - while (ll > 0 && *pp != ' ' &&*pp != '\t' && *pp != '\r' && - *pp != '\n') { + for (;pp < pp_end; ++pp) { if (!safe_char[*(const unsigned char *)pp]) { - f = 0; + if (*pp != ' ' && *pp != '\t' && *pp != '\r' + && *pp != '\n') + f = 0; break; } - ++pp; - --ll; - ++f; + f = 1; } + ll = pp_end - pp; + /* If a path-name was not found at the first, try to check - * a mtree format ``NetBSD's mtree -D'' creates, which - * places the path-name at the last. */ + * a mtree format(a.k.a form D) ``NetBSD's mtree -D'' creates, + * which places the path-name at the last. */ if (f == 0) { const char *pb = p + len - nl; int name_len = 0; int slash; - /* Do not accept multi lines for form D. */ + /* The form D accepts only a single line for an entry. */ if (pb-2 >= p && pb[-1] == '\\' && (pb[-2] == ' ' || pb[-2] == '\t')) return (-1); @@ -826,8 +856,8 @@ process_add_entry(struct archive_read *a, struct mtree *mtree, struct mtree_entry *entry; struct mtree_option *iter; const char *next, *eq, *name, *end; - size_t len; - int r; + size_t name_len, len; + int r, i; if ((entry = malloc(sizeof(*entry))) == NULL) { archive_set_error(&a->archive, errno, "Can't allocate memory"); @@ -847,43 +877,48 @@ process_add_entry(struct archive_read *a, struct mtree *mtree, *last_entry = entry; if (is_form_d) { - /* - * This form places the file name as last parameter. - */ - name = line + line_len -1; + /* Filename is last item on line. */ + /* Adjust line_len to trim trailing whitespace */ while (line_len > 0) { - if (*name != '\r' && *name != '\n' && - *name != '\t' && *name != ' ') - break; - name--; - line_len--; - } - len = 0; - while (line_len > 0) { - if (*name == '\r' || *name == '\n' || - *name == '\t' || *name == ' ') { - name++; + char last_character = line[line_len - 1]; + if (last_character == '\r' + || last_character == '\n' + || last_character == '\t' + || last_character == ' ') { + line_len--; + } else { break; } - name--; - line_len--; - len++; } + /* Name starts after the last whitespace separator */ + name = line; + for (i = 0; i < line_len; i++) { + if (line[i] == '\r' + || line[i] == '\n' + || line[i] == '\t' + || line[i] == ' ') { + name = line + i + 1; + } + } + name_len = line + line_len - name; end = name; } else { - len = strcspn(line, " \t\r\n"); + /* Filename is first item on line */ + name_len = strcspn(line, " \t\r\n"); name = line; - line += len; + line += name_len; end = line + line_len; } + /* name/name_len is the name within the line. */ + /* line..end brackets the entire line except the name */ - if ((entry->name = malloc(len + 1)) == NULL) { + if ((entry->name = malloc(name_len + 1)) == NULL) { archive_set_error(&a->archive, errno, "Can't allocate memory"); return (ARCHIVE_FATAL); } - memcpy(entry->name, name, len); - entry->name[len] = '\0'; + memcpy(entry->name, name, name_len); + entry->name[name_len] = '\0'; parse_escapes(entry->name, entry); for (iter = *global; iter != NULL; iter = iter->next) { @@ -1031,7 +1066,8 @@ read_header(struct archive_read *a, struct archive_entry *entry) } if (!mtree->this_entry->used) { use_next = 0; - r = parse_file(a, entry, mtree, mtree->this_entry, &use_next); + r = parse_file(a, entry, mtree, mtree->this_entry, + &use_next); if (use_next == 0) return (r); } @@ -1103,162 +1139,168 @@ parse_file(struct archive_read *a, struct archive_entry *entry, mtree->current_dir.length = n; } - /* - * Try to open and stat the file to get the real size - * and other file info. It would be nice to avoid - * this here so that getting a listing of an mtree - * wouldn't require opening every referenced contents - * file. But then we wouldn't know the actual - * contents size, so I don't see a really viable way - * around this. (Also, we may want to someday pull - * other unspecified info from the contents file on - * disk.) - */ - mtree->fd = -1; - if (archive_strlen(&mtree->contents_name) > 0) - path = mtree->contents_name.s; - else - path = archive_entry_pathname(entry); + if (mtree->checkfs) { + /* + * Try to open and stat the file to get the real size + * and other file info. It would be nice to avoid + * this here so that getting a listing of an mtree + * wouldn't require opening every referenced contents + * file. But then we wouldn't know the actual + * contents size, so I don't see a really viable way + * around this. (Also, we may want to someday pull + * other unspecified info from the contents file on + * disk.) + */ + mtree->fd = -1; + if (archive_strlen(&mtree->contents_name) > 0) + path = mtree->contents_name.s; + else + path = archive_entry_pathname(entry); - if (archive_entry_filetype(entry) == AE_IFREG || - archive_entry_filetype(entry) == AE_IFDIR) { - mtree->fd = open(path, O_RDONLY | O_BINARY | O_CLOEXEC); - __archive_ensure_cloexec_flag(mtree->fd); - if (mtree->fd == -1 && - (errno != ENOENT || - archive_strlen(&mtree->contents_name) > 0)) { - archive_set_error(&a->archive, errno, - "Can't open %s", path); - r = ARCHIVE_WARN; - } - } - - st = &st_storage; - if (mtree->fd >= 0) { - if (fstat(mtree->fd, st) == -1) { - archive_set_error(&a->archive, errno, - "Could not fstat %s", path); - r = ARCHIVE_WARN; - /* If we can't stat it, don't keep it open. */ - close(mtree->fd); - mtree->fd = -1; - st = NULL; - } - } else if (lstat(path, st) == -1) { - st = NULL; - } - - /* - * Check for a mismatch between the type in the specification and - * the type of the contents object on disk. - */ - if (st != NULL) { - if ( - ((st->st_mode & S_IFMT) == S_IFREG && - archive_entry_filetype(entry) == AE_IFREG) -#ifdef S_IFLNK - || ((st->st_mode & S_IFMT) == S_IFLNK && - archive_entry_filetype(entry) == AE_IFLNK) -#endif -#ifdef S_IFSOCK - || ((st->st_mode & S_IFSOCK) == S_IFSOCK && - archive_entry_filetype(entry) == AE_IFSOCK) -#endif -#ifdef S_IFCHR - || ((st->st_mode & S_IFMT) == S_IFCHR && - archive_entry_filetype(entry) == AE_IFCHR) -#endif -#ifdef S_IFBLK - || ((st->st_mode & S_IFMT) == S_IFBLK && - archive_entry_filetype(entry) == AE_IFBLK) -#endif - || ((st->st_mode & S_IFMT) == S_IFDIR && - archive_entry_filetype(entry) == AE_IFDIR) -#ifdef S_IFIFO - || ((st->st_mode & S_IFMT) == S_IFIFO && - archive_entry_filetype(entry) == AE_IFIFO) -#endif - ) { - /* Types match. */ - } else { - /* Types don't match; bail out gracefully. */ - if (mtree->fd >= 0) - close(mtree->fd); - mtree->fd = -1; - if (parsed_kws & MTREE_HAS_OPTIONAL) { - /* It's not an error for an optional entry - to not match disk. */ - *use_next = 1; - } else if (r == ARCHIVE_OK) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_MISC, - "mtree specification has different type for %s", - archive_entry_pathname(entry)); + if (archive_entry_filetype(entry) == AE_IFREG || + archive_entry_filetype(entry) == AE_IFDIR) { + mtree->fd = open(path, O_RDONLY | O_BINARY | O_CLOEXEC); + __archive_ensure_cloexec_flag(mtree->fd); + if (mtree->fd == -1 && + (errno != ENOENT || + archive_strlen(&mtree->contents_name) > 0)) { + archive_set_error(&a->archive, errno, + "Can't open %s", path); r = ARCHIVE_WARN; } - return r; } - } - /* - * If there is a contents file on disk, pick some of the metadata - * from that file. For most of these, we only set it from the contents - * if it wasn't already parsed from the specification. - */ - if (st != NULL) { - if (((parsed_kws & MTREE_HAS_DEVICE) == 0 || - (parsed_kws & MTREE_HAS_NOCHANGE) != 0) && - (archive_entry_filetype(entry) == AE_IFCHR || - archive_entry_filetype(entry) == AE_IFBLK)) - archive_entry_set_rdev(entry, st->st_rdev); - if ((parsed_kws & (MTREE_HAS_GID | MTREE_HAS_GNAME)) == 0 || - (parsed_kws & MTREE_HAS_NOCHANGE) != 0) - archive_entry_set_gid(entry, st->st_gid); - if ((parsed_kws & (MTREE_HAS_UID | MTREE_HAS_UNAME)) == 0 || - (parsed_kws & MTREE_HAS_NOCHANGE) != 0) - archive_entry_set_uid(entry, st->st_uid); - if ((parsed_kws & MTREE_HAS_MTIME) == 0 || - (parsed_kws & MTREE_HAS_NOCHANGE) != 0) { -#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC - archive_entry_set_mtime(entry, st->st_mtime, - st->st_mtimespec.tv_nsec); -#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC - archive_entry_set_mtime(entry, st->st_mtime, - st->st_mtim.tv_nsec); -#elif HAVE_STRUCT_STAT_ST_MTIME_N - archive_entry_set_mtime(entry, st->st_mtime, - st->st_mtime_n); -#elif HAVE_STRUCT_STAT_ST_UMTIME - archive_entry_set_mtime(entry, st->st_mtime, - st->st_umtime*1000); -#elif HAVE_STRUCT_STAT_ST_MTIME_USEC - archive_entry_set_mtime(entry, st->st_mtime, - st->st_mtime_usec*1000); -#else - archive_entry_set_mtime(entry, st->st_mtime, 0); -#endif + st = &st_storage; + if (mtree->fd >= 0) { + if (fstat(mtree->fd, st) == -1) { + archive_set_error(&a->archive, errno, + "Could not fstat %s", path); + r = ARCHIVE_WARN; + /* If we can't stat it, don't keep it open. */ + close(mtree->fd); + mtree->fd = -1; + st = NULL; + } + } else if (lstat(path, st) == -1) { + st = NULL; } - if ((parsed_kws & MTREE_HAS_NLINK) == 0 || - (parsed_kws & MTREE_HAS_NOCHANGE) != 0) - archive_entry_set_nlink(entry, st->st_nlink); - if ((parsed_kws & MTREE_HAS_PERM) == 0 || - (parsed_kws & MTREE_HAS_NOCHANGE) != 0) - archive_entry_set_perm(entry, st->st_mode); - if ((parsed_kws & MTREE_HAS_SIZE) == 0 || - (parsed_kws & MTREE_HAS_NOCHANGE) != 0) - archive_entry_set_size(entry, st->st_size); - archive_entry_set_ino(entry, st->st_ino); - archive_entry_set_dev(entry, st->st_dev); - archive_entry_linkify(mtree->resolver, &entry, &sparse_entry); - } else if (parsed_kws & MTREE_HAS_OPTIONAL) { /* - * Couldn't open the entry, stat it or the on-disk type - * didn't match. If this entry is optional, just ignore it - * and read the next header entry. + * Check for a mismatch between the type in the specification + * and the type of the contents object on disk. */ - *use_next = 1; - return ARCHIVE_OK; + if (st != NULL) { + if (((st->st_mode & S_IFMT) == S_IFREG && + archive_entry_filetype(entry) == AE_IFREG) +#ifdef S_IFLNK + ||((st->st_mode & S_IFMT) == S_IFLNK && + archive_entry_filetype(entry) == AE_IFLNK) +#endif +#ifdef S_IFSOCK + ||((st->st_mode & S_IFSOCK) == S_IFSOCK && + archive_entry_filetype(entry) == AE_IFSOCK) +#endif +#ifdef S_IFCHR + ||((st->st_mode & S_IFMT) == S_IFCHR && + archive_entry_filetype(entry) == AE_IFCHR) +#endif +#ifdef S_IFBLK + ||((st->st_mode & S_IFMT) == S_IFBLK && + archive_entry_filetype(entry) == AE_IFBLK) +#endif + ||((st->st_mode & S_IFMT) == S_IFDIR && + archive_entry_filetype(entry) == AE_IFDIR) +#ifdef S_IFIFO + ||((st->st_mode & S_IFMT) == S_IFIFO && + archive_entry_filetype(entry) == AE_IFIFO) +#endif + ) { + /* Types match. */ + } else { + /* Types don't match; bail out gracefully. */ + if (mtree->fd >= 0) + close(mtree->fd); + mtree->fd = -1; + if (parsed_kws & MTREE_HAS_OPTIONAL) { + /* It's not an error for an optional + * entry to not match disk. */ + *use_next = 1; + } else if (r == ARCHIVE_OK) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "mtree specification has different" + " type for %s", + archive_entry_pathname(entry)); + r = ARCHIVE_WARN; + } + return (r); + } + } + + /* + * If there is a contents file on disk, pick some of the + * metadata from that file. For most of these, we only + * set it from the contents if it wasn't already parsed + * from the specification. + */ + if (st != NULL) { + if (((parsed_kws & MTREE_HAS_DEVICE) == 0 || + (parsed_kws & MTREE_HAS_NOCHANGE) != 0) && + (archive_entry_filetype(entry) == AE_IFCHR || + archive_entry_filetype(entry) == AE_IFBLK)) + archive_entry_set_rdev(entry, st->st_rdev); + if ((parsed_kws & (MTREE_HAS_GID | MTREE_HAS_GNAME)) + == 0 || + (parsed_kws & MTREE_HAS_NOCHANGE) != 0) + archive_entry_set_gid(entry, st->st_gid); + if ((parsed_kws & (MTREE_HAS_UID | MTREE_HAS_UNAME)) + == 0 || + (parsed_kws & MTREE_HAS_NOCHANGE) != 0) + archive_entry_set_uid(entry, st->st_uid); + if ((parsed_kws & MTREE_HAS_MTIME) == 0 || + (parsed_kws & MTREE_HAS_NOCHANGE) != 0) { +#if HAVE_STRUCT_STAT_ST_MTIMESPEC_TV_NSEC + archive_entry_set_mtime(entry, st->st_mtime, + st->st_mtimespec.tv_nsec); +#elif HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC + archive_entry_set_mtime(entry, st->st_mtime, + st->st_mtim.tv_nsec); +#elif HAVE_STRUCT_STAT_ST_MTIME_N + archive_entry_set_mtime(entry, st->st_mtime, + st->st_mtime_n); +#elif HAVE_STRUCT_STAT_ST_UMTIME + archive_entry_set_mtime(entry, st->st_mtime, + st->st_umtime*1000); +#elif HAVE_STRUCT_STAT_ST_MTIME_USEC + archive_entry_set_mtime(entry, st->st_mtime, + st->st_mtime_usec*1000); +#else + archive_entry_set_mtime(entry, st->st_mtime, 0); +#endif + } + if ((parsed_kws & MTREE_HAS_NLINK) == 0 || + (parsed_kws & MTREE_HAS_NOCHANGE) != 0) + archive_entry_set_nlink(entry, st->st_nlink); + if ((parsed_kws & MTREE_HAS_PERM) == 0 || + (parsed_kws & MTREE_HAS_NOCHANGE) != 0) + archive_entry_set_perm(entry, st->st_mode); + if ((parsed_kws & MTREE_HAS_SIZE) == 0 || + (parsed_kws & MTREE_HAS_NOCHANGE) != 0) + archive_entry_set_size(entry, st->st_size); + archive_entry_set_ino(entry, st->st_ino); + archive_entry_set_dev(entry, st->st_dev); + + archive_entry_linkify(mtree->resolver, &entry, + &sparse_entry); + } else if (parsed_kws & MTREE_HAS_OPTIONAL) { + /* + * Couldn't open the entry, stat it or the on-disk type + * didn't match. If this entry is optional, just + * ignore it and read the next header entry. + */ + *use_next = 1; + return ARCHIVE_OK; + } } mtree->cur_size = archive_entry_size(entry); @@ -1292,33 +1334,82 @@ parse_line(struct archive_read *a, struct archive_entry *entry, /* * Device entries have one of the following forms: - * raw dev_t - * format,major,minor[,subdevice] - * - * Just use major and minor, no translation etc is done - * between formats. + * - raw dev_t + * - format,major,minor[,subdevice] + * When parsing succeeded, `pdev' will contain the appropriate dev_t value. */ -static int -parse_device(struct archive *a, struct archive_entry *entry, char *val) -{ - char *comma1, *comma2; - comma1 = strchr(val, ','); - if (comma1 == NULL) { - archive_entry_set_dev(entry, (dev_t)mtree_atol10(&val)); - return (ARCHIVE_OK); +/* strsep() is not in C90, but strcspn() is. */ +/* Taken from http://unixpapa.com/incnote/string.html */ +static char * +la_strsep(char **sp, char *sep) +{ + char *p, *s; + if (sp == NULL || *sp == NULL || **sp == '\0') + return(NULL); + s = *sp; + p = s + strcspn(s, sep); + if (*p != '\0') + *p++ = '\0'; + *sp = p; + return(s); +} + +static int +parse_device(dev_t *pdev, struct archive *a, char *val) +{ +#define MAX_PACK_ARGS 3 + unsigned long numbers[MAX_PACK_ARGS]; + char *p, *dev; + int argc; + pack_t *pack; + dev_t result; + const char *error = NULL; + + memset(pdev, 0, sizeof(*pdev)); + if ((dev = strchr(val, ',')) != NULL) { + /* + * Device's major/minor are given in a specified format. + * Decode and pack it accordingly. + */ + *dev++ = '\0'; + if ((pack = pack_find(val)) == NULL) { + archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, + "Unknown format `%s'", val); + return ARCHIVE_WARN; + } + argc = 0; + while ((p = la_strsep(&dev, ",")) != NULL) { + if (*p == '\0') { + archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, + "Missing number"); + return ARCHIVE_WARN; + } + numbers[argc++] = (unsigned long)mtree_atol(&p); + if (argc > MAX_PACK_ARGS) { + archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, + "Too many arguments"); + return ARCHIVE_WARN; + } + } + if (argc < 2) { + archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, + "Not enough arguments"); + return ARCHIVE_WARN; + } + result = (*pack)(argc, numbers, &error); + if (error != NULL) { + archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, + "%s", error); + return ARCHIVE_WARN; + } + } else { + /* file system raw value. */ + result = (dev_t)mtree_atol(&val); } - ++comma1; - comma2 = strchr(comma1, ','); - if (comma2 == NULL) { - archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, - "Malformed device attribute"); - return (ARCHIVE_WARN); - } - ++comma2; - archive_entry_set_rdevmajor(entry, (dev_t)mtree_atol(&comma1)); - archive_entry_set_rdevminor(entry, (dev_t)mtree_atol(&comma2)); - return (ARCHIVE_OK); + *pdev = result; + return ARCHIVE_OK; +#undef MAX_PACK_ARGS } /* @@ -1374,8 +1465,16 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, break; case 'd': if (strcmp(key, "device") == 0) { + /* stat(2) st_rdev field, e.g. the major/minor IDs + * of a char/block special file */ + int r; + dev_t dev; + *parsed_kws |= MTREE_HAS_DEVICE; - return parse_device(&a->archive, entry, val); + r = parse_device(&dev, &a->archive, val); + if (r == ARCHIVE_OK) + archive_entry_set_rdev(entry, dev); + return r; } case 'f': if (strcmp(key, "flags") == 0) { @@ -1394,6 +1493,11 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, archive_entry_copy_gname(entry, val); break; } + case 'i': + if (strcmp(key, "inode") == 0) { + archive_entry_set_ino(entry, mtree_atol10(&val)); + break; + } case 'l': if (strcmp(key, "link") == 0) { archive_entry_copy_symlink(entry, val); @@ -1423,6 +1527,17 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, break; } case 'r': + if (strcmp(key, "resdevice") == 0) { + /* stat(2) st_dev field, e.g. the device ID where the + * inode resides */ + int r; + dev_t dev; + + r = parse_device(&dev, &a->archive, val); + if (r == ARCHIVE_OK) + archive_entry_set_dev(entry, dev); + return r; + } if (strcmp(key, "rmd160") == 0 || strcmp(key, "rmd160digest") == 0) break; @@ -1455,7 +1570,7 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, int64_t m; int64_t my_time_t_max = get_time_t_max(); int64_t my_time_t_min = get_time_t_min(); - long ns; + long ns = 0; *parsed_kws |= MTREE_HAS_MTIME; m = mtree_atol10(&val); @@ -1483,32 +1598,38 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, } case 'c': if (strcmp(val, "char") == 0) { - archive_entry_set_filetype(entry, AE_IFCHR); + archive_entry_set_filetype(entry, + AE_IFCHR); break; } case 'd': if (strcmp(val, "dir") == 0) { - archive_entry_set_filetype(entry, AE_IFDIR); + archive_entry_set_filetype(entry, + AE_IFDIR); break; } case 'f': if (strcmp(val, "fifo") == 0) { - archive_entry_set_filetype(entry, AE_IFIFO); + archive_entry_set_filetype(entry, + AE_IFIFO); break; } if (strcmp(val, "file") == 0) { - archive_entry_set_filetype(entry, AE_IFREG); + archive_entry_set_filetype(entry, + AE_IFREG); break; } case 'l': if (strcmp(val, "link") == 0) { - archive_entry_set_filetype(entry, AE_IFLNK); + archive_entry_set_filetype(entry, + AE_IFLNK); break; } default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Unrecognized file type \"%s\"; assuming \"file\"", val); + "Unrecognized file type \"%s\"; " + "assuming \"file\"", val); archive_entry_set_filetype(entry, AE_IFREG); return (ARCHIVE_WARN); } @@ -1535,7 +1656,8 @@ parse_keyword(struct archive_read *a, struct mtree *mtree, } static int -read_data(struct archive_read *a, const void **buff, size_t *size, int64_t *offset) +read_data(struct archive_read *a, const void **buff, size_t *size, + int64_t *offset) { size_t bytes_to_read; ssize_t bytes_read; @@ -1661,6 +1783,10 @@ parse_escapes(char *src, struct mtree_entry *mentry) c = '\v'; ++src; break; + case '\\': + c = '\\'; + ++src; + break; } } *dest++ = c; @@ -1798,14 +1924,14 @@ mtree_atol(char **p) * point to first character of line. */ static ssize_t -readline(struct archive_read *a, struct mtree *mtree, char **start, ssize_t limit) +readline(struct archive_read *a, struct mtree *mtree, char **start, + ssize_t limit) { ssize_t bytes_read; ssize_t total_size = 0; ssize_t find_off = 0; const void *t; - const char *s; - void *p; + void *nl; char *u; /* Accumulate line in a line buffer. */ @@ -1816,11 +1942,10 @@ readline(struct archive_read *a, struct mtree *mtree, char **start, ssize_t limi return (0); if (bytes_read < 0) return (ARCHIVE_FATAL); - s = t; /* Start of line? */ - p = memchr(t, '\n', bytes_read); - /* If we found '\n', trim the read. */ - if (p != NULL) { - bytes_read = 1 + ((const char *)p) - s; + nl = memchr(t, '\n', bytes_read); + /* If we found '\n', trim the read to end exactly there. */ + if (nl != NULL) { + bytes_read = ((const char *)nl) - ((const char *)t) + 1; } if (total_size + bytes_read + 1 > limit) { archive_set_error(&a->archive, @@ -1834,38 +1959,34 @@ readline(struct archive_read *a, struct mtree *mtree, char **start, ssize_t limi "Can't allocate working buffer"); return (ARCHIVE_FATAL); } + /* Append new bytes to string. */ memcpy(mtree->line.s + total_size, t, bytes_read); __archive_read_consume(a, bytes_read); total_size += bytes_read; - /* Null terminate. */ mtree->line.s[total_size] = '\0'; - /* If we found an unescaped '\n', clean up and return. */ + for (u = mtree->line.s + find_off; *u; ++u) { if (u[0] == '\n') { + /* Ends with unescaped newline. */ *start = mtree->line.s; return total_size; - } - if (u[0] == '#') { - if (p == NULL) + } else if (u[0] == '#') { + /* Ends with comment sequence #...\n */ + if (nl == NULL) { + /* But we've not found the \n yet */ break; - *start = mtree->line.s; - return total_size; + } + } else if (u[0] == '\\') { + if (u[1] == '\n') { + /* Trim escaped newline. */ + total_size -= 2; + mtree->line.s[total_size] = '\0'; + break; + } else if (u[1] != '\0') { + /* Skip the two-char escape sequence */ + ++u; + } } - if (u[0] != '\\') - continue; - if (u[1] == '\\') { - ++u; - continue; - } - if (u[1] == '\n') { - memmove(u, u + 1, - total_size - (u - mtree->line.s) + 1); - --total_size; - ++u; - break; - } - if (u[1] == '\0') - break; } find_off = u - mtree->line.s; } diff --git a/libarchive/archive_read_support_format_rar.c b/libarchive/archive_read_support_format_rar.c index 99c57a0fc0eb..6450aac82785 100644 --- a/libarchive/archive_read_support_format_rar.c +++ b/libarchive/archive_read_support_format_rar.c @@ -186,6 +186,7 @@ struct huffman_code { struct huffman_tree_node *tree; int numentries; + int numallocatedentries; int minlength; int maxlength; int tablesize; @@ -225,6 +226,7 @@ struct rar mode_t mode; char *filename; char *filename_save; + size_t filename_save_size; size_t filename_allocated; /* File header optional entries */ @@ -304,8 +306,15 @@ struct rar ssize_t avail_in; const unsigned char *next_in; } br; + + /* + * Custom field to denote that this archive contains encrypted entries + */ + int has_encrypted_entries; }; +static int archive_read_support_format_rar_capabilities(struct archive_read *); +static int archive_read_format_rar_has_encrypted_entries(struct archive_read *); static int archive_read_format_rar_bid(struct archive_read *, int); static int archive_read_format_rar_options(struct archive_read *, const char *, const char *); @@ -646,6 +655,12 @@ archive_read_support_format_rar(struct archive *_a) } memset(rar, 0, sizeof(*rar)); + /* + * Until enough data has been read, we cannot tell about + * any encrypted entries yet. + */ + rar->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW; + r = __archive_read_register_format(a, rar, "rar", @@ -655,13 +670,36 @@ archive_read_support_format_rar(struct archive *_a) archive_read_format_rar_read_data, archive_read_format_rar_read_data_skip, archive_read_format_rar_seek_data, - archive_read_format_rar_cleanup); + archive_read_format_rar_cleanup, + archive_read_support_format_rar_capabilities, + archive_read_format_rar_has_encrypted_entries); if (r != ARCHIVE_OK) free(rar); return (r); } +static int +archive_read_support_format_rar_capabilities(struct archive_read * a) +{ + (void)a; /* UNUSED */ + return (ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA + | ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA); +} + +static int +archive_read_format_rar_has_encrypted_entries(struct archive_read *_a) +{ + if (_a && _a->format) { + struct rar * rar = (struct rar *)_a->format->data; + if (rar) { + return rar->has_encrypted_entries; + } + } + return ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW; +} + + static int archive_read_format_rar_bid(struct archive_read *a, int best_bid) { @@ -755,7 +793,7 @@ archive_read_format_rar_options(struct archive_read *a, { struct rar *rar; int ret = ARCHIVE_FAILED; - + rar = (struct rar *)(a->format->data); if (strcmp(key, "hdrcharset") == 0) { if (val == NULL || val[0] == 0) @@ -790,6 +828,7 @@ archive_read_format_rar_read_header(struct archive_read *a, char head_type; int ret; unsigned flags; + unsigned long crc32_expected; a->archive.archive_format = ARCHIVE_FORMAT_RAR; if (a->archive.archive_format_name == NULL) @@ -797,6 +836,17 @@ archive_read_format_rar_read_header(struct archive_read *a, rar = (struct rar *)(a->format->data); + /* + * It should be sufficient to call archive_read_next_header() for + * a reader to determine if an entry is encrypted or not. If the + * encryption of an entry is only detectable when calling + * archive_read_data(), so be it. We'll do the same check there + * as well. + */ + if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) { + rar->has_encrypted_entries = 0; + } + /* RAR files can be generated without EOF headers, so return ARCHIVE_EOF if * this fails. */ @@ -857,9 +907,14 @@ archive_read_format_rar_read_header(struct archive_read *a, sizeof(rar->reserved2)); } + /* Main header is password encrytped, so we cannot read any + file names or any other info about files from the header. */ if (rar->main_flags & MHD_PASSWORD) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + archive_entry_set_is_metadata_encrypted(entry, 1); + archive_entry_set_is_data_encrypted(entry, 1); + rar->has_encrypted_entries = 1; + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "RAR encryption support unavailable."); return (ARCHIVE_FATAL); } @@ -886,36 +941,50 @@ archive_read_format_rar_read_header(struct archive_read *a, skip = archive_le16dec(p + 5); if (skip < 7) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Invalid header size"); + "Invalid header size too small"); return (ARCHIVE_FATAL); } - if (skip > 7) { - if ((h = __archive_read_ahead(a, skip, NULL)) == NULL) - return (ARCHIVE_FATAL); - p = h; - } if (flags & HD_ADD_SIZE_PRESENT) { if (skip < 7 + 4) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Invalid header size"); + "Invalid header size too small"); return (ARCHIVE_FATAL); } - skip += archive_le32dec(p + 7); if ((h = __archive_read_ahead(a, skip, NULL)) == NULL) return (ARCHIVE_FATAL); p = h; + skip += archive_le32dec(p + 7); } - crc32_val = crc32(0, (const unsigned char *)p + 2, (unsigned)skip - 2); - if ((crc32_val & 0xffff) != archive_le16dec(p)) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Header CRC error"); - return (ARCHIVE_FATAL); + /* Skip over the 2-byte CRC at the beginning of the header. */ + crc32_expected = archive_le16dec(p); + __archive_read_consume(a, 2); + skip -= 2; + + /* Skim the entire header and compute the CRC. */ + crc32_val = 0; + while (skip > 0) { + size_t to_read = skip; + ssize_t did_read; + if (to_read > 32 * 1024) { + to_read = 32 * 1024; + } + if ((h = __archive_read_ahead(a, to_read, &did_read)) == NULL) { + return (ARCHIVE_FATAL); + } + p = h; + crc32_val = crc32(crc32_val, (const unsigned char *)p, (unsigned)did_read); + __archive_read_consume(a, did_read); + skip -= did_read; + } + if ((crc32_val & 0xffff) != crc32_expected) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Header CRC error"); + return (ARCHIVE_FATAL); } - __archive_read_consume(a, skip); if (head_type == ENDARC_HEAD) - return (ARCHIVE_EOF); + return (ARCHIVE_EOF); break; case NEWSUB_HEAD: @@ -938,14 +1007,18 @@ archive_read_format_rar_read_data(struct archive_read *a, const void **buff, struct rar *rar = (struct rar *)(a->format->data); int ret; + if (rar->has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) { + rar->has_encrypted_entries = 0; + } + if (rar->bytes_unconsumed > 0) { /* Consume as much as the decompressor actually used. */ __archive_read_consume(a, rar->bytes_unconsumed); rar->bytes_unconsumed = 0; } + *buff = NULL; if (rar->entry_eof || rar->offset_seek >= rar->unp_size) { - *buff = NULL; *size = 0; *offset = rar->offset; if (*offset < rar->unp_size) @@ -957,7 +1030,7 @@ archive_read_format_rar_read_data(struct archive_read *a, const void **buff, { case COMPRESS_METHOD_STORE: ret = read_data_stored(a, buff, size, offset); - break; + break; case COMPRESS_METHOD_FASTEST: case COMPRESS_METHOD_FAST: @@ -967,13 +1040,13 @@ archive_read_format_rar_read_data(struct archive_read *a, const void **buff, ret = read_data_compressed(a, buff, size, offset); if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN) __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context, &g_szalloc); - break; + break; default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Unsupported compression method for RAR file."); ret = ARCHIVE_FATAL; - break; + break; } return (ret); } @@ -1145,10 +1218,8 @@ archive_read_format_rar_seek_data(struct archive_read *a, int64_t offset, ret -= rar->dbo[0].start_offset; /* Always restart reading the file after a seek */ - a->read_data_block = NULL; - a->read_data_offset = 0; - a->read_data_output_offset = 0; - a->read_data_remaining = 0; + __archive_reset_read_data(&a->archive); + rar->bytes_unconsumed = 0; rar->offset = 0; @@ -1290,9 +1361,14 @@ read_header(struct archive_read *a, struct archive_entry *entry, if (rar->file_flags & FHD_PASSWORD) { + archive_entry_set_is_data_encrypted(entry, 1); + rar->has_encrypted_entries = 1; archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "RAR encryption support unavailable."); - return (ARCHIVE_FATAL); + /* Since it is only the data part itself that is encrypted we can at least + extract information about the currently processed entry and don't need + to return ARCHIVE_FATAL here. */ + /*return (ARCHIVE_FATAL);*/ } if (rar->file_flags & FHD_LARGE) @@ -1377,7 +1453,7 @@ read_header(struct archive_read *a, struct archive_entry *entry, flagbyte = *(p + offset++); flagbits = 8; } - + flagbits -= 2; switch((flagbyte >> flagbits) & 3) { @@ -1469,6 +1545,7 @@ read_header(struct archive_read *a, struct archive_entry *entry, /* Split file in multivolume RAR. No more need to process header. */ if (rar->filename_save && + filename_size == rar->filename_save_size && !memcmp(rar->filename, rar->filename_save, filename_size + 1)) { __archive_read_consume(a, header_size - 7); @@ -1498,6 +1575,7 @@ read_header(struct archive_read *a, struct archive_entry *entry, rar->filename_save = (char*)realloc(rar->filename_save, filename_size + 1); memcpy(rar->filename_save, rar->filename, filename_size + 1); + rar->filename_save_size = filename_size; /* Set info for seeking */ free(rar->dbo); @@ -2345,6 +2423,8 @@ create_code(struct archive_read *a, struct huffman_code *code, { int i, j, codebits = 0, symbolsleft = numsymbols; + code->numentries = 0; + code->numallocatedentries = 0; if (new_node(code) < 0) { archive_set_error(&a->archive, ENOMEM, "Unable to allocate memory for node data."); @@ -2473,11 +2553,17 @@ static int new_node(struct huffman_code *code) { void *new_tree; - - new_tree = realloc(code->tree, (code->numentries + 1) * sizeof(*code->tree)); - if (new_tree == NULL) - return (-1); - code->tree = (struct huffman_tree_node *)new_tree; + if (code->numallocatedentries == code->numentries) { + int new_num_entries = 256; + if (code->numentries > 0) { + new_num_entries = code->numentries * 2; + } + new_tree = realloc(code->tree, new_num_entries * sizeof(*code->tree)); + if (new_tree == NULL) + return (-1); + code->tree = (struct huffman_tree_node *)new_tree; + code->numallocatedentries = new_num_entries; + } code->tree[code->numentries].branches[0] = -1; code->tree[code->numentries].branches[1] = -2; return 1; @@ -2611,7 +2697,7 @@ expand(struct archive_read *a, int64_t end) if ((symbol = read_next_symbol(a, &rar->maincode)) < 0) return (ARCHIVE_FATAL); rar->output_last_match = 0; - + if (symbol < 256) { lzss_emit_literal(rar, symbol); @@ -2834,8 +2920,8 @@ rar_read_ahead(struct archive_read *a, size_t min, ssize_t *avail) int ret; if (avail) { - if (a->read_data_is_posix_read && *avail > (ssize_t)a->read_data_requested) - *avail = a->read_data_requested; + if (a->archive.read_data_is_posix_read && *avail > (ssize_t)a->archive.read_data_requested) + *avail = a->archive.read_data_requested; if (*avail > rar->bytes_remaining) *avail = (ssize_t)rar->bytes_remaining; if (*avail < 0) diff --git a/libarchive/archive_read_support_format_raw.c b/libarchive/archive_read_support_format_raw.c index 843497878a36..efa2c6a33c7e 100644 --- a/libarchive/archive_read_support_format_raw.c +++ b/libarchive/archive_read_support_format_raw.c @@ -78,7 +78,9 @@ archive_read_support_format_raw(struct archive *_a) archive_read_format_raw_read_data, archive_read_format_raw_read_data_skip, NULL, - archive_read_format_raw_cleanup); + archive_read_format_raw_cleanup, + NULL, + NULL); if (r != ARCHIVE_OK) free(info); return (r); diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index c6f405da6e3f..b0521a627ce3 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -151,6 +151,8 @@ struct tar { struct archive_string_conv *sconv_default; int init_default_conversion; int compat_2x; + int process_mac_extensions; + int read_concatenated_archives; }; static int archive_block_is_null(const char *p); @@ -200,7 +202,7 @@ static int archive_read_format_tar_read_header(struct archive_read *, struct archive_entry *); static int checksum(struct archive_read *, const void *); static int pax_attribute(struct archive_read *, struct tar *, - struct archive_entry *, char *key, char *value); + struct archive_entry *, const char *key, const char *value); static int pax_header(struct archive_read *, struct tar *, struct archive_entry *, char *attr); static void pax_time(const char *, int64_t *sec, long *nanos); @@ -241,6 +243,10 @@ archive_read_support_format_tar(struct archive *_a) ARCHIVE_STATE_NEW, "archive_read_support_format_tar"); tar = (struct tar *)calloc(1, sizeof(*tar)); +#ifdef HAVE_COPYFILE_H + /* Set this by default on Mac OS. */ + tar->process_mac_extensions = 1; +#endif if (tar == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate tar data"); @@ -254,7 +260,9 @@ archive_read_support_format_tar(struct archive *_a) archive_read_format_tar_read_data, archive_read_format_tar_skip, NULL, - archive_read_format_tar_cleanup); + archive_read_format_tar_cleanup, + NULL, + NULL); if (r != ARCHIVE_OK) free(tar); @@ -368,7 +376,7 @@ archive_read_format_tar_options(struct archive_read *a, tar = (struct tar *)(a->format->data); if (strcmp(key, "compat-2x") == 0) { /* Handle UTF-8 filnames as libarchive 2.x */ - tar->compat_2x = (val != NULL)?1:0; + tar->compat_2x = (val != NULL && val[0] != 0); tar->init_default_conversion = tar->compat_2x; return (ARCHIVE_OK); } else if (strcmp(key, "hdrcharset") == 0) { @@ -385,6 +393,12 @@ archive_read_format_tar_options(struct archive_read *a, ret = ARCHIVE_FATAL; } return (ret); + } else if (strcmp(key, "mac-ext") == 0) { + tar->process_mac_extensions = (val != NULL && val[0] != 0); + return (ARCHIVE_OK); + } else if (strcmp(key, "read_concatenated_archives") == 0) { + tar->read_concatenated_archives = (val != NULL && val[0] != 0); + return (ARCHIVE_OK); } /* Note: The "warn" return is just to inform the options @@ -397,7 +411,7 @@ archive_read_format_tar_options(struct archive_read *a, * how much unconsumed data we have floating around, and to consume * anything outstanding since we're going to do read_aheads */ -static void +static void tar_flush_unconsumed(struct archive_read *a, size_t *unconsumed) { if (*unconsumed) { @@ -442,6 +456,7 @@ archive_read_format_tar_read_header(struct archive_read *a, static int default_dev; struct tar *tar; const char *p; + const wchar_t *wp; int r; size_t l, unconsumed = 0; @@ -492,27 +507,22 @@ archive_read_format_tar_read_header(struct archive_read *a, } } - if (r == ARCHIVE_OK) { + if (r == ARCHIVE_OK && archive_entry_filetype(entry) == AE_IFREG) { /* * "Regular" entry with trailing '/' is really * directory: This is needed for certain old tar * variants and even for some broken newer ones. */ - const wchar_t *wp; - wp = archive_entry_pathname_w(entry); - if (wp != NULL) { + if ((wp = archive_entry_pathname_w(entry)) != NULL) { l = wcslen(wp); - if (archive_entry_filetype(entry) == AE_IFREG - && wp[l-1] == L'/') + if (l > 0 && wp[l - 1] == L'/') { archive_entry_set_filetype(entry, AE_IFDIR); - } else { - p = archive_entry_pathname(entry); - if (p == NULL) - return (ARCHIVE_FAILED); + } + } else if ((p = archive_entry_pathname(entry)) != NULL) { l = strlen(p); - if (archive_entry_filetype(entry) == AE_IFREG - && p[l-1] == '/') + if (l > 0 && p[l - 1] == '/') { archive_entry_set_filetype(entry, AE_IFDIR); + } } } return (r); @@ -594,8 +604,12 @@ archive_read_format_tar_skip(struct archive_read *a) /* Do not consume the hole of a sparse file. */ request = 0; for (p = tar->sparse_list; p != NULL; p = p->next) { - if (!p->hole) + if (!p->hole) { + if (p->remaining >= INT64_MAX - request) { + return ARCHIVE_FATAL; + } request += p->remaining; + } } if (request > tar->entry_bytes_remaining) request = tar->entry_bytes_remaining; @@ -629,36 +643,50 @@ tar_read_header(struct archive_read *a, struct tar *tar, const struct archive_entry_header_ustar *header; const struct archive_entry_header_gnutar *gnuheader; - tar_flush_unconsumed(a, unconsumed); - - /* Read 512-byte header record */ - h = __archive_read_ahead(a, 512, &bytes); - if (bytes < 0) - return ((int)bytes); - if (bytes == 0) { /* EOF at a block boundary. */ - /* Some writers do omit the block of nulls. */ - return (ARCHIVE_EOF); - } - if (bytes < 512) { /* Short block at EOF; this is bad. */ - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated tar archive"); - return (ARCHIVE_FATAL); - } - *unconsumed = 512; - - /* Check for end-of-archive mark. */ - if (h[0] == 0 && archive_block_is_null(h)) { - /* Try to consume a second all-null record, as well. */ + /* Loop until we find a workable header record. */ + for (;;) { tar_flush_unconsumed(a, unconsumed); - h = __archive_read_ahead(a, 512, NULL); - if (h != NULL) - __archive_read_consume(a, 512); - archive_clear_error(&a->archive); + + /* Read 512-byte header record */ + h = __archive_read_ahead(a, 512, &bytes); + if (bytes < 0) + return ((int)bytes); + if (bytes == 0) { /* EOF at a block boundary. */ + /* Some writers do omit the block of nulls. */ + return (ARCHIVE_EOF); + } + if (bytes < 512) { /* Short block at EOF; this is bad. */ + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated tar archive"); + return (ARCHIVE_FATAL); + } + *unconsumed = 512; + + /* Header is workable if it's not an end-of-archive mark. */ + if (h[0] != 0 || !archive_block_is_null(h)) + break; + + /* Ensure format is set for archives with only null blocks. */ if (a->archive.archive_format_name == NULL) { a->archive.archive_format = ARCHIVE_FORMAT_TAR; a->archive.archive_format_name = "tar"; } - return (ARCHIVE_EOF); + + if (!tar->read_concatenated_archives) { + /* Try to consume a second all-null record, as well. */ + tar_flush_unconsumed(a, unconsumed); + h = __archive_read_ahead(a, 512, NULL); + if (h != NULL && h[0] == 0 && archive_block_is_null(h)) + __archive_read_consume(a, 512); + archive_clear_error(&a->archive); + return (ARCHIVE_EOF); + } + + /* + * We're reading concatenated archives, ignore this block and + * loop to get the next. + */ } /* @@ -693,6 +721,8 @@ tar_read_header(struct archive_read *a, struct tar *tar, a->archive.archive_format = ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE; a->archive.archive_format_name = "POSIX pax interchange format"; err = header_pax_global(a, tar, entry, h, unconsumed); + if (err == ARCHIVE_EOF) + return (err); break; case 'K': /* Long link name (GNU tar, others) */ err = header_longlink(a, tar, entry, h, unconsumed); @@ -745,9 +775,9 @@ tar_read_header(struct archive_read *a, struct tar *tar, * extensions for both the AppleDouble extension entry and the * regular entry. */ - /* TODO: Should this be disabled on non-Mac platforms? */ if ((err == ARCHIVE_WARN || err == ARCHIVE_OK) && - tar->header_recursion_depth == 0) { + tar->header_recursion_depth == 0 && + tar->process_mac_extensions) { int err2 = read_mac_metadata_blob(a, tar, entry, h, unconsumed); if (err2 < err) err = err2; @@ -790,12 +820,20 @@ checksum(struct archive_read *a, const void *h) { const unsigned char *bytes; const struct archive_entry_header_ustar *header; - int check, i, sum; + int check, sum; + size_t i; (void)a; /* UNUSED */ bytes = (const unsigned char *)h; header = (const struct archive_entry_header_ustar *)h; + /* Checksum field must hold an octal number */ + for (i = 0; i < sizeof(header->checksum); ++i) { + char c = header->checksum[i]; + if (c != ' ' && c != '\0' && (c < '0' || c > '7')) + return 0; + } + /* * Test the checksum. Note that POSIX specifies _unsigned_ * bytes for this calculation. @@ -1287,7 +1325,7 @@ read_mac_metadata_blob(struct archive_read *a, struct tar *tar, if (wp[0] == '/' && wp[1] != L'\0') wname = wp + 1; } - /* + /* * If last path element starts with "._", then * this is a Mac extension. */ @@ -1302,7 +1340,7 @@ read_mac_metadata_blob(struct archive_read *a, struct tar *tar, if (p[0] == '/' && p[1] != '\0') name = p + 1; } - /* + /* * If last path element starts with "._", then * this is a Mac extension. */ @@ -1626,7 +1664,7 @@ pax_header(struct archive_read *a, struct tar *tar, static int pax_attribute_xattr(struct archive_entry *entry, - char *name, char *value) + const char *name, const char *value) { char *name_decoded; void *value_decoded; @@ -1672,7 +1710,7 @@ pax_attribute_xattr(struct archive_entry *entry, */ static int pax_attribute(struct archive_read *a, struct tar *tar, - struct archive_entry *entry, char *key, char *value) + struct archive_entry *entry, const char *key, const char *value) { int64_t s; long n; @@ -2089,6 +2127,10 @@ gnu_add_sparse_entry(struct archive_read *a, struct tar *tar, else tar->sparse_list = p; tar->sparse_last = p; + if (remaining < 0 || offset < 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Malformed sparse map data"); + return (ARCHIVE_FATAL); + } p->offset = offset; p->remaining = remaining; return (ARCHIVE_OK); @@ -2422,9 +2464,10 @@ tar_atol(const char *p, size_t char_cnt) static int64_t tar_atol_base_n(const char *p, size_t char_cnt, int base) { - int64_t l, limit, last_digit_limit; + int64_t l, maxval, limit, last_digit_limit; int digit, sign; + maxval = INT64_MAX; limit = INT64_MAX / base; last_digit_limit = INT64_MAX % base; @@ -2441,6 +2484,10 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base) sign = -1; p++; char_cnt--; + + maxval = INT64_MIN; + limit = -(INT64_MIN / base); + last_digit_limit = INT64_MIN % base; } l = 0; @@ -2448,8 +2495,7 @@ tar_atol_base_n(const char *p, size_t char_cnt, int base) digit = *p - '0'; while (digit >= 0 && digit < base && char_cnt != 0) { if (l>limit || (l == limit && digit > last_digit_limit)) { - l = INT64_MAX; /* Truncate on overflow. */ - break; + return maxval; /* Truncate on overflow. */ } l = (l * base) + digit; digit = *++p - '0'; @@ -2472,36 +2518,56 @@ tar_atol10(const char *p, size_t char_cnt) } /* - * Parse a base-256 integer. This is just a straight signed binary - * value in big-endian order, except that the high-order bit is - * ignored. + * Parse a base-256 integer. This is just a variable-length + * twos-complement signed binary value in big-endian order, except + * that the high-order bit is ignored. The values here can be up to + * 12 bytes, so we need to be careful about overflowing 64-bit + * (8-byte) integers. + * + * This code unashamedly assumes that the local machine uses 8-bit + * bytes and twos-complement arithmetic. */ static int64_t tar_atol256(const char *_p, size_t char_cnt) { - int64_t l, upper_limit, lower_limit; + uint64_t l; const unsigned char *p = (const unsigned char *)_p; + unsigned char c, neg; - upper_limit = INT64_MAX / 256; - lower_limit = INT64_MIN / 256; - - /* Pad with 1 or 0 bits, depending on sign. */ - if ((0x40 & *p) == 0x40) - l = (int64_t)-1; - else + /* Extend 7-bit 2s-comp to 8-bit 2s-comp, decide sign. */ + c = *p; + if (c & 0x40) { + neg = 0xff; + c |= 0x80; + l = ~ARCHIVE_LITERAL_ULL(0); + } else { + neg = 0; + c &= 0x7f; l = 0; - l = (l << 6) | (0x3f & *p++); - while (--char_cnt > 0) { - if (l > upper_limit) { - l = INT64_MAX; /* Truncate on overflow */ - break; - } else if (l < lower_limit) { - l = INT64_MIN; - break; - } - l = (l << 8) | (0xff & (int64_t)*p++); } - return (l); + + /* If more than 8 bytes, check that we can ignore + * high-order bits without overflow. */ + while (char_cnt > sizeof(int64_t)) { + --char_cnt; + if (c != neg) + return neg ? INT64_MIN : INT64_MAX; + c = *++p; + } + + /* c is first byte that fits; if sign mismatch, return overflow */ + if ((c ^ neg) & 0x80) { + return neg ? INT64_MIN : INT64_MAX; + } + + /* Accumulate remaining bytes. */ + while (--char_cnt > 0) { + l = (l << 8) | c; + c = *++p; + } + l = (l << 8) | c; + /* Return signed twos-complement value. */ + return (int64_t)(l); } /* diff --git a/libarchive/archive_read_support_format_warc.c b/libarchive/archive_read_support_format_warc.c new file mode 100644 index 000000000000..46a59ea14ba8 --- /dev/null +++ b/libarchive/archive_read_support_format_warc.c @@ -0,0 +1,795 @@ +/*- + * Copyright (c) 2014 Sebastian Freundt + * 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +/** + * WARC is standardised by ISO TC46/SC4/WG12 and currently available as + * ISO 28500:2009. + * For the purposes of this file we used the final draft from: + * http://bibnum.bnf.fr/warc/WARC_ISO_28500_version1_latestdraft.pdf + * + * Todo: + * [ ] real-world warcs can contain resources at endpoints ending in / + * e.g. http://bibnum.bnf.fr/warc/ + * if you're lucky their response contains a Content-Location: header + * pointing to a unix-compliant filename, in the example above it's + * Content-Location: http://bibnum.bnf.fr/warc/index.html + * however, that's not mandated and github for example doesn't follow + * this convention. + * We need a set of archive options to control what to do with + * entries like these, at the moment care is taken to skip them. + * + **/ + +#ifdef HAVE_SYS_STAT_H +#include +#endif +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_LIMITS_H +#include +#endif +#ifdef HAVE_CTYPE_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif + +#include "archive.h" +#include "archive_entry.h" +#include "archive_private.h" +#include "archive_read_private.h" + +typedef enum { + WT_NONE, + /* warcinfo */ + WT_INFO, + /* metadata */ + WT_META, + /* resource */ + WT_RSRC, + /* request, unsupported */ + WT_REQ, + /* response, unsupported */ + WT_RSP, + /* revisit, unsupported */ + WT_RVIS, + /* conversion, unsupported */ + WT_CONV, + /* continutation, unsupported at the moment */ + WT_CONT, + /* invalid type */ + LAST_WT +} warc_type_t; + +typedef struct { + size_t len; + const char *str; +} warc_string_t; + +typedef struct { + size_t len; + char *str; +} warc_strbuf_t; + +struct warc_s { + /* content length ahead */ + size_t cntlen; + /* and how much we've processed so far */ + size_t cntoff; + /* and how much we need to consume between calls */ + size_t unconsumed; + + /* string pool */ + warc_strbuf_t pool; + /* previous version */ + unsigned int pver; + /* stringified format name */ + struct archive_string sver; +}; + +static int _warc_bid(struct archive_read *a, int); +static int _warc_cleanup(struct archive_read *a); +static int _warc_read(struct archive_read*, const void**, size_t*, int64_t*); +static int _warc_skip(struct archive_read *a); +static int _warc_rdhdr(struct archive_read *a, struct archive_entry *e); + +/* private routines */ +static unsigned int _warc_rdver(const char buf[10], size_t bsz); +static unsigned int _warc_rdtyp(const char *buf, size_t bsz); +static warc_string_t _warc_rduri(const char *buf, size_t bsz); +static ssize_t _warc_rdlen(const char *buf, size_t bsz); +static time_t _warc_rdrtm(const char *buf, size_t bsz); +static time_t _warc_rdmtm(const char *buf, size_t bsz); +static const char *_warc_find_eoh(const char *buf, size_t bsz); + + +int +archive_read_support_format_warc(struct archive *_a) +{ + struct archive_read *a = (struct archive_read *)_a; + struct warc_s *w; + int r; + + archive_check_magic(_a, ARCHIVE_READ_MAGIC, + ARCHIVE_STATE_NEW, "archive_read_support_format_warc"); + + if ((w = malloc(sizeof(*w))) == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate warc data"); + return (ARCHIVE_FATAL); + } + memset(w, 0, sizeof(*w)); + + r = __archive_read_register_format( + a, w, "warc", + _warc_bid, NULL, _warc_rdhdr, _warc_read, + _warc_skip, NULL, _warc_cleanup, NULL, NULL); + + if (r != ARCHIVE_OK) { + free(w); + return (r); + } + return (ARCHIVE_OK); +} + +static int +_warc_cleanup(struct archive_read *a) +{ + struct warc_s *w = a->format->data; + + if (w->pool.len > 0U) { + free(w->pool.str); + } + archive_string_free(&w->sver); + free(w); + a->format->data = NULL; + return (ARCHIVE_OK); +} + +static int +_warc_bid(struct archive_read *a, int best_bid) +{ + const char *hdr; + ssize_t nrd; + unsigned int ver; + + (void)best_bid; /* UNUSED */ + + /* check first line of file, it should be a record already */ + if ((hdr = __archive_read_ahead(a, 12U, &nrd)) == NULL) { + /* no idea what to do */ + return -1; + } else if (nrd < 12) { + /* nah, not for us, our magic cookie is at least 12 bytes */ + return -1; + } + + /* otherwise snarf the record's version number */ + ver = _warc_rdver(hdr, nrd); + if (ver == 0U || ver > 10000U) { + /* oh oh oh, best not to wager ... */ + return -1; + } + + /* otherwise be confident */ + return (64); +} + +static int +_warc_rdhdr(struct archive_read *a, struct archive_entry *entry) +{ +#define HDR_PROBE_LEN (12U) + struct warc_s *w = a->format->data; + unsigned int ver; + const char *buf; + ssize_t nrd; + const char *eoh; + /* for the file name, saves some strndup()'ing */ + warc_string_t fnam; + /* warc record type, not that we really use it a lot */ + warc_type_t ftyp; + /* content-length+error monad */ + ssize_t cntlen; + /* record time is the WARC-Date time we reinterpret it as ctime */ + time_t rtime; + /* mtime is the Last-Modified time which will be the entry's mtime */ + time_t mtime; + +start_over: + /* just use read_ahead() they keep track of unconsumed + * bits and bobs for us; no need to put an extra shift in + * and reproduce that functionality here */ + buf = __archive_read_ahead(a, HDR_PROBE_LEN, &nrd); + + if (nrd < 0) { + /* no good */ + archive_set_error( + &a->archive, ARCHIVE_ERRNO_MISC, + "Bad record header"); + return (ARCHIVE_FATAL); + } else if (buf == NULL) { + /* there should be room for at least WARC/bla\r\n + * must be EOF therefore */ + return (ARCHIVE_EOF); + } + /* looks good so far, try and find the end of the header now */ + eoh = _warc_find_eoh(buf, nrd); + if (eoh == NULL) { + /* still no good, the header end might be beyond the + * probe we've requested, but then again who'd cram + * so much stuff into the header *and* be 28500-compliant */ + archive_set_error( + &a->archive, ARCHIVE_ERRNO_MISC, + "Bad record header"); + return (ARCHIVE_FATAL); + } else if ((ver = _warc_rdver(buf, eoh - buf)) > 10000U) { + /* nawww, I wish they promised backward compatibility + * anyhoo, in their infinite wisdom the 28500 guys might + * come up with something we can't possibly handle so + * best end things here */ + archive_set_error( + &a->archive, ARCHIVE_ERRNO_MISC, + "Unsupported record version"); + return (ARCHIVE_FATAL); + } else if ((cntlen = _warc_rdlen(buf, eoh - buf)) < 0) { + /* nightmare! the specs say content-length is mandatory + * so I don't feel overly bad stopping the reader here */ + archive_set_error( + &a->archive, EINVAL, + "Bad content length"); + return (ARCHIVE_FATAL); + } else if ((rtime = _warc_rdrtm(buf, eoh - buf)) == (time_t)-1) { + /* record time is mandatory as per WARC/1.0, + * so just barf here, fast and loud */ + archive_set_error( + &a->archive, EINVAL, + "Bad record time"); + return (ARCHIVE_FATAL); + } + + /* let the world know we're a WARC archive */ + a->archive.archive_format = ARCHIVE_FORMAT_WARC; + if (ver != w->pver) { + /* stringify this entry's version */ + archive_string_sprintf(&w->sver, + "WARC/%u.%u", ver / 10000, ver % 10000); + /* remember the version */ + w->pver = ver; + } + /* start off with the type */ + ftyp = _warc_rdtyp(buf, eoh - buf); + /* and let future calls know about the content */ + w->cntlen = cntlen; + w->cntoff = 0U; + mtime = 0;/* Avoid compiling error on some platform. */ + + switch (ftyp) { + case WT_RSRC: + case WT_RSP: + /* only try and read the filename in the cases that are + * guaranteed to have one */ + fnam = _warc_rduri(buf, eoh - buf); + /* check the last character in the URI to avoid creating + * directory endpoints as files, see Todo above */ + if (fnam.len == 0 || fnam.str[fnam.len - 1] == '/') { + /* break here for now */ + fnam.len = 0U; + fnam.str = NULL; + break; + } + /* bang to our string pool, so we save a + * malloc()+free() roundtrip */ + if (fnam.len + 1U > w->pool.len) { + w->pool.len = ((fnam.len + 64U) / 64U) * 64U; + w->pool.str = realloc(w->pool.str, w->pool.len); + } + memcpy(w->pool.str, fnam.str, fnam.len); + w->pool.str[fnam.len] = '\0'; + /* let noone else know about the pool, it's a secret, shhh */ + fnam.str = w->pool.str; + + /* snarf mtime or deduce from rtime + * this is a custom header added by our writer, it's quite + * hard to believe anyone else would go through with it + * (apart from being part of some http responses of course) */ + if ((mtime = _warc_rdmtm(buf, eoh - buf)) == (time_t)-1) { + mtime = rtime; + } + break; + default: + fnam.len = 0U; + fnam.str = NULL; + break; + } + + /* now eat some of those delicious buffer bits */ + __archive_read_consume(a, eoh - buf); + + switch (ftyp) { + case WT_RSRC: + case WT_RSP: + if (fnam.len > 0U) { + /* populate entry object */ + archive_entry_set_filetype(entry, AE_IFREG); + archive_entry_copy_pathname(entry, fnam.str); + archive_entry_set_size(entry, cntlen); + archive_entry_set_perm(entry, 0644); + /* rtime is the new ctime, mtime stays mtime */ + archive_entry_set_ctime(entry, rtime, 0L); + archive_entry_set_mtime(entry, mtime, 0L); + break; + } + /* FALLTHROUGH */ + default: + /* consume the content and start over */ + _warc_skip(a); + goto start_over; + } + return (ARCHIVE_OK); +} + +static int +_warc_read(struct archive_read *a, const void **buf, size_t *bsz, int64_t *off) +{ + struct warc_s *w = a->format->data; + const char *rab; + ssize_t nrd; + + if (w->cntoff >= w->cntlen) { + eof: + /* it's our lucky day, no work, we can leave early */ + *buf = NULL; + *bsz = 0U; + *off = w->cntoff + 4U/*for \r\n\r\n separator*/; + w->unconsumed = 0U; + return (ARCHIVE_EOF); + } + + rab = __archive_read_ahead(a, 1U, &nrd); + if (nrd < 0) { + *bsz = 0U; + /* big catastrophe */ + return (int)nrd; + } else if (nrd == 0) { + goto eof; + } else if ((size_t)nrd > w->cntlen - w->cntoff) { + /* clamp to content-length */ + nrd = w->cntlen - w->cntoff; + } + *off = w->cntoff; + *bsz = nrd; + *buf = rab; + + w->cntoff += nrd; + w->unconsumed = (size_t)nrd; + return (ARCHIVE_OK); +} + +static int +_warc_skip(struct archive_read *a) +{ + struct warc_s *w = a->format->data; + + __archive_read_consume(a, w->cntlen + 4U/*\r\n\r\n separator*/); + w->cntlen = 0U; + w->cntoff = 0U; + return (ARCHIVE_OK); +} + + +/* private routines */ +static void* +deconst(const void *c) +{ + return (char *)0x1 + (((const char *)c) - (const char *)0x1); +} + +static char* +xmemmem(const char *hay, const size_t haysize, + const char *needle, const size_t needlesize) +{ + const char *const eoh = hay + haysize; + const char *const eon = needle + needlesize; + const char *hp; + const char *np; + const char *cand; + unsigned int hsum; + unsigned int nsum; + unsigned int eqp; + + /* trivial checks first + * a 0-sized needle is defined to be found anywhere in haystack + * then run strchr() to find a candidate in HAYSTACK (i.e. a portion + * that happens to begin with *NEEDLE) */ + if (needlesize == 0UL) { + return deconst(hay); + } else if ((hay = memchr(hay, *needle, haysize)) == NULL) { + /* trivial */ + return NULL; + } + + /* First characters of haystack and needle are the same now. Both are + * guaranteed to be at least one character long. Now computes the sum + * of characters values of needle together with the sum of the first + * needle_len characters of haystack. */ + for (hp = hay + 1U, np = needle + 1U, hsum = *hay, nsum = *hay, eqp = 1U; + hp < eoh && np < eon; + hsum ^= *hp, nsum ^= *np, eqp &= *hp == *np, hp++, np++); + + /* HP now references the (NEEDLESIZE + 1)-th character. */ + if (np < eon) { + /* haystack is smaller than needle, :O */ + return NULL; + } else if (eqp) { + /* found a match */ + return deconst(hay); + } + + /* now loop through the rest of haystack, + * updating the sum iteratively */ + for (cand = hay; hp < eoh; hp++) { + hsum ^= *cand++; + hsum ^= *hp; + + /* Since the sum of the characters is already known to be + * equal at that point, it is enough to check just NEEDLESIZE - 1 + * characters for equality, + * also CAND is by design < HP, so no need for range checks */ + if (hsum == nsum && memcmp(cand, needle, needlesize - 1U) == 0) { + return deconst(cand); + } + } + return NULL; +} + +static int +strtoi_lim(const char *str, const char **ep, int llim, int ulim) +{ + int res = 0; + const char *sp; + /* we keep track of the number of digits via rulim */ + int rulim; + + for (sp = str, rulim = ulim > 10 ? ulim : 10; + res * 10 <= ulim && rulim && *sp >= '0' && *sp <= '9'; + sp++, rulim /= 10) { + res *= 10; + res += *sp - '0'; + } + if (sp == str) { + res = -1; + } else if (res < llim || res > ulim) { + res = -2; + } + *ep = (const char*)sp; + return res; +} + +static time_t +time_from_tm(struct tm *t) +{ +#if HAVE_TIMEGM + /* Use platform timegm() if available. */ + return (timegm(t)); +#elif HAVE__MKGMTIME64 + return (_mkgmtime64(t)); +#else + /* Else use direct calculation using POSIX assumptions. */ + /* First, fix up tm_yday based on the year/month/day. */ + if (mktime(t) == (time_t)-1) + return ((time_t)-1); + /* Then we can compute timegm() from first principles. */ + return (t->tm_sec + + t->tm_min * 60 + + t->tm_hour * 3600 + + t->tm_yday * 86400 + + (t->tm_year - 70) * 31536000 + + ((t->tm_year - 69) / 4) * 86400 + - ((t->tm_year - 1) / 100) * 86400 + + ((t->tm_year + 299) / 400) * 86400); +#endif +} + +static time_t +xstrpisotime(const char *s, char **endptr) +{ +/** like strptime() but strictly for ISO 8601 Zulu strings */ + struct tm tm; + time_t res = (time_t)-1; + + /* make sure tm is clean */ + memset(&tm, 0, sizeof(tm)); + + /* as a courtesy to our callers, and since this is a non-standard + * routine, we skip leading whitespace */ + for (; isspace(*s); s++); + + /* read year */ + if ((tm.tm_year = strtoi_lim(s, &s, 1583, 4095)) < 0 || *s++ != '-') { + goto out; + } + /* read month */ + if ((tm.tm_mon = strtoi_lim(s, &s, 1, 12)) < 0 || *s++ != '-') { + goto out; + } + /* read day-of-month */ + if ((tm.tm_mday = strtoi_lim(s, &s, 1, 31)) < 0 || *s++ != 'T') { + goto out; + } + /* read hour */ + if ((tm.tm_hour = strtoi_lim(s, &s, 0, 23)) < 0 || *s++ != ':') { + goto out; + } + /* read minute */ + if ((tm.tm_min = strtoi_lim(s, &s, 0, 59)) < 0 || *s++ != ':') { + goto out; + } + /* read second */ + if ((tm.tm_sec = strtoi_lim(s, &s, 0, 60)) < 0 || *s++ != 'Z') { + goto out; + } + + /* massage TM to fulfill some of POSIX' contraints */ + tm.tm_year -= 1900; + tm.tm_mon--; + + /* now convert our custom tm struct to a unix stamp using UTC */ + res = time_from_tm(&tm); + +out: + if (endptr != NULL) { + *endptr = deconst(s); + } + return res; +} + +static unsigned int +_warc_rdver(const char buf[10], size_t bsz) +{ + static const char magic[] = "WARC/"; + unsigned int ver; + + (void)bsz; /* UNUSED */ + + if (memcmp(buf, magic, sizeof(magic) - 1U) != 0) { + /* nope */ + return 99999U; + } + /* looks good so far, read the version number for a laugh */ + buf += sizeof(magic) - 1U; + /* most common case gets a quick-check here */ + if (memcmp(buf, "1.0\r\n", 5U) == 0) { + ver = 10000U; + } else { + switch (*buf) { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + if (buf[1U] == '.') { + char *on; + + /* set up major version */ + ver = (buf[0U] - '0') * 10000U; + /* minor version, anyone? */ + ver += (strtol(buf + 2U, &on, 10)) * 100U; + /* don't parse anything else */ + if (on > buf + 2U) { + break; + } + } + /* FALLTHROUGH */ + case '9': + default: + /* just make the version ridiculously high */ + ver = 999999U; + break; + } + } + return ver; +} + +static unsigned int +_warc_rdtyp(const char *buf, size_t bsz) +{ + static const char _key[] = "\r\nWARC-Type:"; + const char *const eob = buf + bsz; + const char *val; + + if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) { + /* no bother */ + return WT_NONE; + } + /* overread whitespace */ + for (val += sizeof(_key) - 1U; val < eob && isspace(*val); val++); + + if (val + 8U > eob) { + ; + } else if (memcmp(val, "resource", 8U) == 0) { + return WT_RSRC; + } else if (memcmp(val, "warcinfo", 8U) == 0) { + return WT_INFO; + } else if (memcmp(val, "metadata", 8U) == 0) { + return WT_META; + } else if (memcmp(val, "request", 7U) == 0) { + return WT_REQ; + } else if (memcmp(val, "response", 8U) == 0) { + return WT_RSP; + } else if (memcmp(val, "conversi", 8U) == 0) { + return WT_CONV; + } else if (memcmp(val, "continua", 8U) == 0) { + return WT_CONT; + } + return WT_NONE; +} + +static warc_string_t +_warc_rduri(const char *buf, size_t bsz) +{ + static const char _key[] = "\r\nWARC-Target-URI:"; + const char *const eob = buf + bsz; + const char *val; + const char *uri; + const char *eol; + warc_string_t res = {0U, NULL}; + + if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) { + /* no bother */ + return res; + } + /* overread whitespace */ + for (val += sizeof(_key) - 1U; val < eob && isspace(*val); val++); + + /* overread URL designators */ + if ((uri = xmemmem(val, eob - val, "://", 3U)) == NULL) { + /* not touching that! */ + return res; + } else if ((eol = memchr(uri, '\n', eob - uri)) == NULL) { + /* no end of line? :O */ + return res; + } + + /* massage uri to point to after :// */ + uri += 3U; + /* also massage eol to point to the first whitespace + * after the last non-whitespace character before + * the end of the line */ + for (; eol > uri && isspace(eol[-1]); eol--); + + /* now then, inspect the URI */ + if (memcmp(val, "file", 4U) == 0) { + /* perfect, nothing left to do here */ + + } else if (memcmp(val, "http", 4U) == 0 || + memcmp(val, "ftp", 3U) == 0) { + /* overread domain, and the first / */ + while (uri < eol && *uri++ != '/'); + } else { + /* not sure what to do? best to bugger off */ + return res; + } + res.str = uri; + res.len = eol - uri; + return res; +} + +static ssize_t +_warc_rdlen(const char *buf, size_t bsz) +{ + static const char _key[] = "\r\nContent-Length:"; + const char *val; + char *on = NULL; + long int len; + + if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) { + /* no bother */ + return -1; + } + + /* strtol kindly overreads whitespace for us, so use that */ + val += sizeof(_key) - 1U; + len = strtol(val, &on, 10); + if (on == NULL || !isspace(*on)) { + /* hm, can we trust that number? Best not. */ + return -1; + } + return (size_t)len; +} + +static time_t +_warc_rdrtm(const char *buf, size_t bsz) +{ + static const char _key[] = "\r\nWARC-Date:"; + const char *val; + char *on = NULL; + time_t res; + + if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) { + /* no bother */ + return (time_t)-1; + } + + /* xstrpisotime() kindly overreads whitespace for us, so use that */ + val += sizeof(_key) - 1U; + res = xstrpisotime(val, &on); + if (on == NULL || !isspace(*on)) { + /* hm, can we trust that number? Best not. */ + return (time_t)-1; + } + return res; +} + +static time_t +_warc_rdmtm(const char *buf, size_t bsz) +{ + static const char _key[] = "\r\nLast-Modified:"; + const char *val; + char *on = NULL; + time_t res; + + if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) { + /* no bother */ + return (time_t)-1; + } + + /* xstrpisotime() kindly overreads whitespace for us, so use that */ + val += sizeof(_key) - 1U; + res = xstrpisotime(val, &on); + if (on == NULL || !isspace(*on)) { + /* hm, can we trust that number? Best not. */ + return (time_t)-1; + } + return res; +} + +static const char* +_warc_find_eoh(const char *buf, size_t bsz) +{ + static const char _marker[] = "\r\n\r\n"; + const char *hit = xmemmem(buf, bsz, _marker, sizeof(_marker) - 1U); + + if (hit != NULL) { + hit += sizeof(_marker) - 1U; + } + return hit; +} + +/* archive_read_support_format_warc.c ends here */ diff --git a/libarchive/archive_read_support_format_xar.c b/libarchive/archive_read_support_format_xar.c index 780e749d7096..ab887505ce17 100644 --- a/libarchive/archive_read_support_format_xar.c +++ b/libarchive/archive_read_support_format_xar.c @@ -51,7 +51,7 @@ __FBSDID("$FreeBSD$"); #endif #include "archive.h" -#include "archive_crypto_private.h" +#include "archive_digest_private.h" #include "archive_endian.h" #include "archive_entry.h" #include "archive_entry_locale.h" @@ -468,7 +468,9 @@ archive_read_support_format_xar(struct archive *_a) xar_read_data, xar_read_data_skip, NULL, - xar_cleanup); + xar_cleanup, + NULL, + NULL); if (r != ARCHIVE_OK) free(xar); return (r); @@ -967,10 +969,14 @@ move_reading_point(struct archive_read *a, uint64_t offset) return ((int)step); xar->offset += step; } else { - archive_set_error(&(a->archive), - ARCHIVE_ERRNO_MISC, - "Cannot seek."); - return (ARCHIVE_FAILED); + int64_t pos = __archive_read_seek(a, offset, SEEK_SET); + if (pos == ARCHIVE_FAILED) { + archive_set_error(&(a->archive), + ARCHIVE_ERRNO_MISC, + "Cannot seek."); + return (ARCHIVE_FAILED); + } + xar->offset = pos; } } return (ARCHIVE_OK); @@ -1101,20 +1107,23 @@ static time_t time_from_tm(struct tm *t) { #if HAVE_TIMEGM - /* Use platform timegm() if available. */ - return (timegm(t)); + /* Use platform timegm() if available. */ + return (timegm(t)); #elif HAVE__MKGMTIME64 - return (_mkgmtime64(t)); + return (_mkgmtime64(t)); #else - /* Else use direct calculation using POSIX assumptions. */ - /* First, fix up tm_yday based on the year/month/day. */ - mktime(t); - /* Then we can compute timegm() from first principles. */ - return (t->tm_sec + t->tm_min * 60 + t->tm_hour * 3600 - + t->tm_yday * 86400 + (t->tm_year - 70) * 31536000 - + ((t->tm_year - 69) / 4) * 86400 - - ((t->tm_year - 1) / 100) * 86400 - + ((t->tm_year + 299) / 400) * 86400); + /* Else use direct calculation using POSIX assumptions. */ + /* First, fix up tm_yday based on the year/month/day. */ + mktime(t); + /* Then we can compute timegm() from first principles. */ + return (t->tm_sec + + t->tm_min * 60 + + t->tm_hour * 3600 + + t->tm_yday * 86400 + + (t->tm_year - 70) * 31536000 + + ((t->tm_year - 69) / 4) * 86400 + - ((t->tm_year - 1) / 100) * 86400 + + ((t->tm_year + 299) / 400) * 86400); #endif } @@ -1930,9 +1939,6 @@ unknowntag_start(struct archive_read *a, struct xar *xar, const char *name) { struct unknown_tag *tag; -#if DEBUG - fprintf(stderr, "unknowntag_start:%s\n", name); -#endif tag = malloc(sizeof(*tag)); if (tag == NULL) { archive_set_error(&a->archive, ENOMEM, "Out of memory"); @@ -1942,6 +1948,9 @@ unknowntag_start(struct archive_read *a, struct xar *xar, const char *name) archive_string_init(&(tag->name)); archive_strcpy(&(tag->name), name); if (xar->unknowntags == NULL) { +#if DEBUG + fprintf(stderr, "UNKNOWNTAG_START:%s\n", name); +#endif xar->xmlsts_unknown = xar->xmlsts; xar->xmlsts = UNKNOWN; } @@ -1954,9 +1963,6 @@ unknowntag_end(struct xar *xar, const char *name) { struct unknown_tag *tag; -#if DEBUG - fprintf(stderr, "unknowntag_end:%s\n", name); -#endif tag = xar->unknowntags; if (tag == NULL || name == NULL) return; @@ -1964,8 +1970,12 @@ unknowntag_end(struct xar *xar, const char *name) xar->unknowntags = tag->next; archive_string_free(&(tag->name)); free(tag); - if (xar->unknowntags == NULL) + if (xar->unknowntags == NULL) { +#if DEBUG + fprintf(stderr, "UNKNOWNTAG_END:%s\n", name); +#endif xar->xmlsts = xar->xmlsts_unknown; + } } } @@ -2159,7 +2169,7 @@ xml_start(struct archive_read *a, const char *name, struct xmlattr_list *list) case FILE_ACL: if (strcmp(name, "appleextended") == 0) xar->xmlsts = FILE_ACL_APPLEEXTENDED; - if (strcmp(name, "default") == 0) + else if (strcmp(name, "default") == 0) xar->xmlsts = FILE_ACL_DEFAULT; else if (strcmp(name, "access") == 0) xar->xmlsts = FILE_ACL_ACCESS; @@ -2681,9 +2691,9 @@ xml_data(void *userData, const char *s, int len) #if DEBUG { char buff[1024]; - if (len > sizeof(buff)-1) - len = sizeof(buff)-1; - memcpy(buff, s, len); + if (len > (int)(sizeof(buff)-1)) + len = (int)(sizeof(buff)-1); + strncpy(buff, s, len); buff[len] = 0; fprintf(stderr, "\tlen=%d:\"%s\"\n", len, buff); } @@ -3183,9 +3193,8 @@ xml2_read_toc(struct archive_read *a) case XML_READER_TYPE_ELEMENT: empty = xmlTextReaderIsEmptyElement(reader); r = xml2_xmlattr_setup(a, &list, reader); - if (r != ARCHIVE_OK) - return (r); - r = xml_start(a, name, &list); + if (r == ARCHIVE_OK) + r = xml_start(a, name, &list); xmlattr_cleanup(&list); if (r != ARCHIVE_OK) return (r); diff --git a/libarchive/archive_read_support_format_zip.c b/libarchive/archive_read_support_format_zip.c index 450a6f7da519..0a0be96b5990 100644 --- a/libarchive/archive_read_support_format_zip.c +++ b/libarchive/archive_read_support_format_zip.c @@ -1,6 +1,7 @@ /*- - * Copyright (c) 2004 Tim Kientzle - * Copyright (c) 2011-2012 Michihiro NAKAJIMA + * Copyright (c) 2004-2013 Tim Kientzle + * Copyright (c) 2011-2012,2014 Michihiro NAKAJIMA + * Copyright (c) 2013 Konrad Kleine * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -27,6 +28,21 @@ #include "archive_platform.h" __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_zip.c 201102 2009-12-28 03:11:36Z kientzle $"); +/* + * The definitive documentation of the Zip file format is: + * http://www.pkware.com/documents/casestudies/APPNOTE.TXT + * + * The Info-Zip project has pioneered various extensions to better + * support Zip on Unix, including the 0x5455 "UT", 0x5855 "UX", 0x7855 + * "Ux", and 0x7875 "ux" extensions for time and ownership + * information. + * + * History of this code: The streaming Zip reader was first added to + * libarchive in January 2005. Support for seekable input sources was + * added in Nov 2011. Zip64 support (including a significant code + * refactoring) was added in 2014. + */ + #ifdef HAVE_ERRNO_H #include #endif @@ -38,9 +54,12 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_zip.c 201102 #endif #include "archive.h" +#include "archive_digest_private.h" +#include "archive_cryptor_private.h" #include "archive_endian.h" #include "archive_entry.h" #include "archive_entry_locale.h" +#include "archive_hmac_private.h" #include "archive_private.h" #include "archive_rb.h" #include "archive_read_private.h" @@ -51,42 +70,85 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_read_support_format_zip.c 201102 struct zip_entry { struct archive_rb_node node; + struct zip_entry *next; int64_t local_header_offset; int64_t compressed_size; int64_t uncompressed_size; int64_t gid; int64_t uid; - struct archive_entry *entry; struct archive_string rsrcname; time_t mtime; time_t atime; time_t ctime; uint32_t crc32; uint16_t mode; - uint16_t flags; - char compression; - char system; + uint16_t zip_flags; /* From GP Flags Field */ + unsigned char compression; + unsigned char system; /* From "version written by" */ + unsigned char flags; /* Our extra markers. */ + unsigned char decdat;/* Used for Decryption check */ + + /* WinZip AES encryption extra field should be available + * when compression is 99. */ + struct { + /* Vendor version: AE-1 - 0x0001, AE-2 - 0x0002 */ + unsigned vendor; +#define AES_VENDOR_AE_1 0x0001 +#define AES_VENDOR_AE_2 0x0002 + /* AES encryption strength: + * 1 - 128 bits, 2 - 192 bits, 2 - 256 bits. */ + unsigned strength; + /* Actual compression method. */ + unsigned char compression; + } aes_extra; }; +struct trad_enc_ctx { + uint32_t keys[3]; +}; + +/* Bits used in zip_flags. */ +#define ZIP_ENCRYPTED (1 << 0) +#define ZIP_LENGTH_AT_END (1 << 3) +#define ZIP_STRONG_ENCRYPTED (1 << 6) +#define ZIP_UTF8_NAME (1 << 11) +/* See "7.2 Single Password Symmetric Encryption Method" + in http://www.pkware.com/documents/casestudies/APPNOTE.TXT */ +#define ZIP_CENTRAL_DIRECTORY_ENCRYPTED (1 << 13) + +/* Bits used in flags. */ +#define LA_USED_ZIP64 (1 << 0) +#define LA_FROM_CENTRAL_DIRECTORY (1 << 1) + +/* + * See "WinZip - AES Encryption Information" + * http://www.winzip.com/aes_info.htm + */ +/* Value used in compression method. */ +#define WINZIP_AES_ENCRYPTION 99 +/* Authentication code size. */ +#define AUTH_CODE_SIZE 10 +/**/ +#define MAX_DERIVED_KEY_BUF_SIZE (AES_MAX_KEY_SIZE * 2 + 2) + struct zip { /* Structural information about the archive. */ - int64_t end_of_central_directory_offset; + struct archive_string format_name; int64_t central_directory_offset; - size_t central_directory_size; - size_t central_directory_entries; - char have_central_directory; - int64_t offset; + size_t central_directory_entries_total; + size_t central_directory_entries_on_this_disk; + int has_encrypted_entries; /* List of entries (seekable Zip only) */ - size_t entries_remaining; struct zip_entry *zip_entries; - struct zip_entry *entry; struct archive_rb_tree tree; struct archive_rb_tree tree_rsrc; + /* Bytes read but not yet consumed via __archive_read_consume() */ size_t unconsumed; - /* entry_bytes_remaining is the number of bytes we expect. */ + /* Information about entry we're currently reading. */ + struct zip_entry *entry; int64_t entry_bytes_remaining; /* These count the number of bytes actually read for the entry. */ @@ -95,1059 +157,231 @@ struct zip { /* Running CRC32 of the decompressed data */ unsigned long entry_crc32; + unsigned long (*crc32func)(unsigned long, const void *, + size_t); + char ignore_crc32; /* Flags to mark progress of decompression. */ char decompress_init; char end_of_entry; - ssize_t filename_length; - ssize_t extra_length; - +#ifdef HAVE_ZLIB_H unsigned char *uncompressed_buffer; size_t uncompressed_buffer_size; -#ifdef HAVE_ZLIB_H z_stream stream; char stream_valid; #endif - struct archive_string extra; struct archive_string_conv *sconv; struct archive_string_conv *sconv_default; struct archive_string_conv *sconv_utf8; int init_default_conversion; - char format_name[64]; + int process_mac_extensions; + + char init_decryption; + + /* Decryption buffer. */ + unsigned char *decrypted_buffer; + unsigned char *decrypted_ptr; + size_t decrypted_buffer_size; + size_t decrypted_bytes_remaining; + size_t decrypted_unconsumed_bytes; + + /* Traditional PKWARE decryption. */ + struct trad_enc_ctx tctx; + char tctx_valid; + + /* WinZip AES decyption. */ + /* Contexts used for AES decryption. */ + archive_crypto_ctx cctx; + char cctx_valid; + archive_hmac_sha1_ctx hctx; + char hctx_valid; + + /* Strong encryption's decryption header information. */ + unsigned iv_size; + unsigned alg_id; + unsigned bit_len; + unsigned flags; + unsigned erd_size; + unsigned v_size; + unsigned v_crc32; + uint8_t *iv; + uint8_t *erd; + uint8_t *v_data; }; -#define ZIP_LENGTH_AT_END 8 -#define ZIP_ENCRYPTED (1<<0) -#define ZIP_STRONG_ENCRYPTED (1<<6) -#define ZIP_UTF8_NAME (1<<11) +/* Many systems define min or MIN, but not all. */ +#define zipmin(a,b) ((a) < (b) ? (a) : (b)) -static int archive_read_format_zip_streamable_bid(struct archive_read *, - int); -static int archive_read_format_zip_seekable_bid(struct archive_read *, - int); -static int archive_read_format_zip_options(struct archive_read *, - const char *, const char *); -static int archive_read_format_zip_cleanup(struct archive_read *); -static int archive_read_format_zip_read_data(struct archive_read *, - const void **, size_t *, int64_t *); -static int archive_read_format_zip_read_data_skip(struct archive_read *a); -static int archive_read_format_zip_seekable_read_header( - struct archive_read *, struct archive_entry *); -static int archive_read_format_zip_streamable_read_header( - struct archive_read *, struct archive_entry *); -static ssize_t zip_get_local_file_header_size(struct archive_read *, size_t); -#ifdef HAVE_ZLIB_H -static int zip_deflate_init(struct archive_read *, struct zip *); -static int zip_read_data_deflate(struct archive_read *a, const void **buff, - size_t *size, int64_t *offset); -#endif -static int zip_read_data_none(struct archive_read *a, const void **buff, - size_t *size, int64_t *offset); -static int zip_read_local_file_header(struct archive_read *a, - struct archive_entry *entry, struct zip *); -static time_t zip_time(const char *); -static const char *compression_name(int compression); -static void process_extra(const char *, size_t, struct zip_entry *); - -int archive_read_support_format_zip_streamable(struct archive *); -int archive_read_support_format_zip_seekable(struct archive *); - -int -archive_read_support_format_zip_streamable(struct archive *_a) -{ - struct archive_read *a = (struct archive_read *)_a; - struct zip *zip; - int r; - - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_format_zip"); - - zip = (struct zip *)malloc(sizeof(*zip)); - if (zip == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate zip data"); - return (ARCHIVE_FATAL); - } - memset(zip, 0, sizeof(*zip)); - - r = __archive_read_register_format(a, - zip, - "zip", - archive_read_format_zip_streamable_bid, - archive_read_format_zip_options, - archive_read_format_zip_streamable_read_header, - archive_read_format_zip_read_data, - archive_read_format_zip_read_data_skip, - NULL, - archive_read_format_zip_cleanup); - - if (r != ARCHIVE_OK) - free(zip); - return (ARCHIVE_OK); -} - -int -archive_read_support_format_zip_seekable(struct archive *_a) -{ - struct archive_read *a = (struct archive_read *)_a; - struct zip *zip; - int r; - - archive_check_magic(_a, ARCHIVE_READ_MAGIC, - ARCHIVE_STATE_NEW, "archive_read_support_format_zip_seekable"); - - zip = (struct zip *)malloc(sizeof(*zip)); - if (zip == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate zip data"); - return (ARCHIVE_FATAL); - } - memset(zip, 0, sizeof(*zip)); - - r = __archive_read_register_format(a, - zip, - "zip", - archive_read_format_zip_seekable_bid, - archive_read_format_zip_options, - archive_read_format_zip_seekable_read_header, - archive_read_format_zip_read_data, - archive_read_format_zip_read_data_skip, - NULL, - archive_read_format_zip_cleanup); - - if (r != ARCHIVE_OK) - free(zip); - return (ARCHIVE_OK); -} - -int -archive_read_support_format_zip(struct archive *a) -{ - int r; - r = archive_read_support_format_zip_streamable(a); - if (r != ARCHIVE_OK) - return r; - return (archive_read_support_format_zip_seekable(a)); -} +/* ------------------------------------------------------------------------ */ /* - * TODO: This is a performance sink because it forces the read core to - * drop buffered data from the start of file, which will then have to - * be re-read again if this bidder loses. - * - * We workaround this a little by passing in the best bid so far so - * that later bidders can do nothing if they know they'll never - * outbid. But we can certainly do better... + Traditional PKWARE Decryption functions. */ -static int -archive_read_format_zip_seekable_bid(struct archive_read *a, int best_bid) + +static void +trad_enc_update_keys(struct trad_enc_ctx *ctx, uint8_t c) { - struct zip *zip = (struct zip *)a->format->data; - int64_t filesize; - const char *p; + uint8_t t; +#define CRC32(c, b) (crc32(c ^ 0xffffffffUL, &b, 1) ^ 0xffffffffUL) - /* If someone has already bid more than 32, then avoid - trashing the look-ahead buffers with a seek. */ - if (best_bid > 32) - return (-1); - - filesize = __archive_read_seek(a, -22, SEEK_END); - /* If we can't seek, then we can't bid. */ - if (filesize <= 0) - return 0; - - /* TODO: More robust search for end of central directory record. */ - if ((p = __archive_read_ahead(a, 22, NULL)) == NULL) - return 0; - /* First four bytes are signature for end of central directory - record. Four zero bytes ensure this isn't a multi-volume - Zip file (which we don't yet support). */ - if (memcmp(p, "PK\005\006\000\000\000\000", 8) != 0) { - int64_t i, tail; - int found; - - /* - * If there is a comment in end of central directory - * record, 22 bytes are too short. we have to read more - * to properly detect the record. Hopefully, a length - * of the comment is not longer than 16362 bytes(16K-22). - */ - if (filesize + 22 > 1024 * 16) { - tail = 1024 * 16; - filesize = __archive_read_seek(a, tail * -1, SEEK_END); - } else { - tail = filesize + 22; - filesize = __archive_read_seek(a, 0, SEEK_SET); - } - if (filesize < 0) - return 0; - if ((p = __archive_read_ahead(a, (size_t)tail, NULL)) == NULL) - return 0; - for (found = 0, i = 0;!found && i < tail - 22;) { - switch (p[i]) { - case 'P': - if (memcmp(p+i, - "PK\005\006\000\000\000\000", 8) == 0) { - p += i; - filesize += tail - - (22 + archive_le16dec(p+20)); - found = 1; - } else - i += 8; - break; - case 'K': i += 7; break; - case 005: i += 6; break; - case 006: i += 5; break; - default: i += 1; break; - } - } - if (!found) - return 0; - } - - /* Since we've already done the hard work of finding the - end of central directory record, let's save the important - information. */ - zip->central_directory_entries = archive_le16dec(p + 10); - zip->central_directory_size = archive_le32dec(p + 12); - zip->central_directory_offset = archive_le32dec(p + 16); - zip->end_of_central_directory_offset = filesize; - - /* Just one volume, so central dir must all be on this volume. */ - if (zip->central_directory_entries != archive_le16dec(p + 8)) - return 0; - /* Central directory can't extend beyond end of this file. */ - if (zip->central_directory_offset + - (int64_t)zip->central_directory_size > filesize) - return 0; - - /* This is just a tiny bit higher than the maximum returned by - the streaming Zip bidder. This ensures that the more accurate - seeking Zip parser wins whenever seek is available. */ - return 32; + ctx->keys[0] = CRC32(ctx->keys[0], c); + ctx->keys[1] = (ctx->keys[1] + (ctx->keys[0] & 0xff)) * 134775813L + 1; + t = (ctx->keys[1] >> 24) & 0xff; + ctx->keys[2] = CRC32(ctx->keys[2], t); +#undef CRC32 } -static int -cmp_node(const struct archive_rb_node *n1, const struct archive_rb_node *n2) +static uint8_t +trad_enc_decypt_byte(struct trad_enc_ctx *ctx) { - const struct zip_entry *e1 = (const struct zip_entry *)n1; - const struct zip_entry *e2 = (const struct zip_entry *)n2; - - return ((int)(e2->local_header_offset - e1->local_header_offset)); -} - -static int -cmp_key(const struct archive_rb_node *n, const void *key) -{ - /* This function won't be called */ - (void)n; /* UNUSED */ - (void)key; /* UNUSED */ - return 1; -} - -static int -rsrc_cmp_node(const struct archive_rb_node *n1, - const struct archive_rb_node *n2) -{ - const struct zip_entry *e1 = (const struct zip_entry *)n1; - const struct zip_entry *e2 = (const struct zip_entry *)n2; - - return (strcmp(e2->rsrcname.s, e1->rsrcname.s)); -} - -static int -rsrc_cmp_key(const struct archive_rb_node *n, const void *key) -{ - const struct zip_entry *e = (const struct zip_entry *)n; - return (strcmp((const char *)key, e->rsrcname.s)); -} - -static const char * -rsrc_basename(const char *name, size_t name_length) -{ - const char *s, *r; - - r = s = name; - for (;;) { - s = memchr(s, '/', name_length - (s - name)); - if (s == NULL) - break; - r = ++s; - } - return (r); + unsigned temp = ctx->keys[2] | 2; + return (uint8_t)((temp * (temp ^ 1)) >> 8) & 0xff; } static void -expose_parent_dirs(struct zip *zip, const char *name, size_t name_length) +trad_enc_decrypt_update(struct trad_enc_ctx *ctx, const uint8_t *in, + size_t in_len, uint8_t *out, size_t out_len) { - struct archive_string str; - struct zip_entry *dir; - char *s; + unsigned i, max; - archive_string_init(&str); - archive_strncpy(&str, name, name_length); - for (;;) { - s = strrchr(str.s, '/'); - if (s == NULL) - break; - *s = '\0'; - /* Transfer the parent directory from zip->tree_rsrc RB - * tree to zip->tree RB tree to expose. */ - dir = (struct zip_entry *) - __archive_rb_tree_find_node(&zip->tree_rsrc, str.s); - if (dir == NULL) - break; - __archive_rb_tree_remove_node(&zip->tree_rsrc, &dir->node); - archive_string_free(&dir->rsrcname); - __archive_rb_tree_insert_node(&zip->tree, &dir->node); + max = (unsigned)((in_len < out_len)? in_len: out_len); + + for (i = 0; i < max; i++) { + uint8_t t = in[i] ^ trad_enc_decypt_byte(ctx); + out[i] = t; + trad_enc_update_keys(ctx, t); } - archive_string_free(&str); } static int -slurp_central_directory(struct archive_read *a, struct zip *zip) +trad_enc_init(struct trad_enc_ctx *ctx, const char *pw, size_t pw_len, + const uint8_t *key, size_t key_len, uint8_t *crcchk) { - unsigned i; - int64_t correction; - static const struct archive_rb_tree_ops rb_ops = { - &cmp_node, &cmp_key - }; - static const struct archive_rb_tree_ops rb_rsrc_ops = { - &rsrc_cmp_node, &rsrc_cmp_key - }; + uint8_t header[12]; - /* - * Consider the archive file we are reading may be SFX. - * So we have to calculate a SFX header size to revise - * ZIP header offsets. - */ - correction = zip->end_of_central_directory_offset - - (zip->central_directory_offset + zip->central_directory_size); - /* The central directory offset is relative value, and so - * we revise this offset for SFX. */ - zip->central_directory_offset += correction; - - __archive_read_seek(a, zip->central_directory_offset, SEEK_SET); - zip->offset = zip->central_directory_offset; - __archive_rb_tree_init(&zip->tree, &rb_ops); - __archive_rb_tree_init(&zip->tree_rsrc, &rb_rsrc_ops); - - zip->zip_entries = calloc(zip->central_directory_entries, - sizeof(struct zip_entry)); - for (i = 0; i < zip->central_directory_entries; ++i) { - struct zip_entry *zip_entry = &zip->zip_entries[i]; - size_t filename_length, extra_length, comment_length; - uint32_t external_attributes; - const char *name, *p, *r; - - if ((p = __archive_read_ahead(a, 46, NULL)) == NULL) - return ARCHIVE_FATAL; - if (memcmp(p, "PK\001\002", 4) != 0) { - archive_set_error(&a->archive, - -1, "Invalid central directory signature"); - return ARCHIVE_FATAL; - } - zip->have_central_directory = 1; - /* version = p[4]; */ - zip_entry->system = p[5]; - /* version_required = archive_le16dec(p + 6); */ - zip_entry->flags = archive_le16dec(p + 8); - zip_entry->compression = (char)archive_le16dec(p + 10); - zip_entry->mtime = zip_time(p + 12); - zip_entry->crc32 = archive_le32dec(p + 16); - zip_entry->compressed_size = archive_le32dec(p + 20); - zip_entry->uncompressed_size = archive_le32dec(p + 24); - filename_length = archive_le16dec(p + 28); - extra_length = archive_le16dec(p + 30); - comment_length = archive_le16dec(p + 32); - /* disk_start = archive_le16dec(p + 34); */ /* Better be zero. */ - /* internal_attributes = archive_le16dec(p + 36); */ /* text bit */ - external_attributes = archive_le32dec(p + 38); - zip_entry->local_header_offset = - archive_le32dec(p + 42) + correction; - - /* If we can't guess the mode, leave it zero here; - when we read the local file header we might get - more information. */ - zip_entry->mode = 0; - if (zip_entry->system == 3) { - zip_entry->mode = external_attributes >> 16; - } - - /* - * Mac resource fork files are stored under the - * "__MACOSX/" directory, so we should check if - * it is. - */ - /* Make sure we have the file name. */ - if ((p = __archive_read_ahead(a, 46 + filename_length, NULL)) - == NULL) - return ARCHIVE_FATAL; - name = p + 46; - r = rsrc_basename(name, filename_length); - if (filename_length >= 9 && - strncmp("__MACOSX/", name, 9) == 0) { - /* If this file is not a resource fork nor - * a directory. We should treat it as a non - * resource fork file to expose it. */ - if (name[filename_length-1] != '/' && - (r - name < 3 || r[0] != '.' || r[1] != '_')) { - __archive_rb_tree_insert_node(&zip->tree, - &zip_entry->node); - /* Expose its parent directories. */ - expose_parent_dirs(zip, name, filename_length); - } else { - /* This file is a resource fork file or - * a directory. */ - archive_strncpy(&(zip_entry->rsrcname), name, - filename_length); - __archive_rb_tree_insert_node(&zip->tree_rsrc, - &zip_entry->node); - } - } else { - /* Generate resource fork name to find its resource - * file at zip->tree_rsrc. */ - archive_strcpy(&(zip_entry->rsrcname), "__MACOSX/"); - archive_strncat(&(zip_entry->rsrcname), name, r - name); - archive_strcat(&(zip_entry->rsrcname), "._"); - archive_strncat(&(zip_entry->rsrcname), - name + (r - name), filename_length - (r - name)); - /* Register an entry to RB tree to sort it by - * file offset. */ - __archive_rb_tree_insert_node(&zip->tree, - &zip_entry->node); - } - - /* We don't read the filename until we get to the - local file header. Reading it here would speed up - table-of-contents operations (removing the need to - find and read local file header to get the - filename) at the cost of requiring a lot of extra - space. */ - /* We don't read the extra block here. We assume it - will be duplicated at the local file header. */ - __archive_read_consume(a, - 46 + filename_length + extra_length + comment_length); + if (key_len < 12) { + *crcchk = 0xff; + return -1; } - return ARCHIVE_OK; + ctx->keys[0] = 305419896L; + ctx->keys[1] = 591751049L; + ctx->keys[2] = 878082192L; + + for (;pw_len; --pw_len) + trad_enc_update_keys(ctx, *pw++); + + trad_enc_decrypt_update(ctx, key, 12, header, 12); + /* Return the last byte for CRC check. */ + *crcchk = header[11]; + return 0; } -static int64_t -zip_read_consume(struct archive_read *a, int64_t bytes) +#if 0 +static void +crypt_derive_key_sha1(const void *p, int size, unsigned char *key, + int key_size) { - struct zip *zip = (struct zip *)a->format->data; - int64_t skip; +#define MD_SIZE 20 + archive_sha1_ctx ctx; + unsigned char md1[MD_SIZE]; + unsigned char md2[MD_SIZE * 2]; + unsigned char mkb[64]; + int i; - skip = __archive_read_consume(a, bytes); - if (skip > 0) - zip->offset += skip; - return (skip); + archive_sha1_init(&ctx); + archive_sha1_update(&ctx, p, size); + archive_sha1_final(&ctx, md1); + + memset(mkb, 0x36, sizeof(mkb)); + for (i = 0; i < MD_SIZE; i++) + mkb[i] ^= md1[i]; + archive_sha1_init(&ctx); + archive_sha1_update(&ctx, mkb, sizeof(mkb)); + archive_sha1_final(&ctx, md2); + + memset(mkb, 0x5C, sizeof(mkb)); + for (i = 0; i < MD_SIZE; i++) + mkb[i] ^= md1[i]; + archive_sha1_init(&ctx); + archive_sha1_update(&ctx, mkb, sizeof(mkb)); + archive_sha1_final(&ctx, md2 + MD_SIZE); + + if (key_size > 32) + key_size = 32; + memcpy(key, md2, key_size); +#undef MD_SIZE } - -static int -zip_read_mac_metadata(struct archive_read *a, struct archive_entry *entry, - struct zip_entry *rsrc) -{ - struct zip *zip = (struct zip *)a->format->data; - unsigned char *metadata, *mp; - int64_t offset = zip->offset; - size_t remaining_bytes, metadata_bytes; - ssize_t hsize; - int ret = ARCHIVE_OK, eof; - - switch(rsrc->compression) { - case 0: /* No compression. */ -#ifdef HAVE_ZLIB_H - case 8: /* Deflate compression. */ #endif - break; - default: /* Unsupported compression. */ - /* Return a warning. */ - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Unsupported ZIP compression method (%s)", - compression_name(rsrc->compression)); - /* We can't decompress this entry, but we will - * be able to skip() it and try the next entry. */ - return (ARCHIVE_WARN); - } - - if (rsrc->uncompressed_size > (128 * 1024)) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Mac metadata is too large: %jd > 128K bytes", - (intmax_t)rsrc->uncompressed_size); - return (ARCHIVE_WARN); - } - - metadata = malloc((size_t)rsrc->uncompressed_size); - if (metadata == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate memory for Mac metadata"); - return (ARCHIVE_FATAL); - } - - if (zip->offset < rsrc->local_header_offset) - zip_read_consume(a, rsrc->local_header_offset - zip->offset); - else if (zip->offset != rsrc->local_header_offset) { - __archive_read_seek(a, rsrc->local_header_offset, SEEK_SET); - zip->offset = zip->entry->local_header_offset; - } - - hsize = zip_get_local_file_header_size(a, 0); - zip_read_consume(a, hsize); - - remaining_bytes = (size_t)rsrc->compressed_size; - metadata_bytes = (size_t)rsrc->uncompressed_size; - mp = metadata; - eof = 0; - while (!eof && remaining_bytes) { - const unsigned char *p; - ssize_t bytes_avail; - size_t bytes_used; - - p = __archive_read_ahead(a, 1, &bytes_avail); - if (p == NULL) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP file header"); - ret = ARCHIVE_WARN; - goto exit_mac_metadata; - } - if ((size_t)bytes_avail > remaining_bytes) - bytes_avail = remaining_bytes; - switch(rsrc->compression) { - case 0: /* No compression. */ - memcpy(mp, p, bytes_avail); - bytes_used = (size_t)bytes_avail; - metadata_bytes -= bytes_used; - mp += bytes_used; - if (metadata_bytes == 0) - eof = 1; - break; -#ifdef HAVE_ZLIB_H - case 8: /* Deflate compression. */ - { - int r; - - ret = zip_deflate_init(a, zip); - if (ret != ARCHIVE_OK) - goto exit_mac_metadata; - zip->stream.next_in = - (Bytef *)(uintptr_t)(const void *)p; - zip->stream.avail_in = (uInt)bytes_avail; - zip->stream.total_in = 0; - zip->stream.next_out = mp; - zip->stream.avail_out = (uInt)metadata_bytes; - zip->stream.total_out = 0; - - r = inflate(&zip->stream, 0); - switch (r) { - case Z_OK: - break; - case Z_STREAM_END: - eof = 1; - break; - case Z_MEM_ERROR: - archive_set_error(&a->archive, ENOMEM, - "Out of memory for ZIP decompression"); - ret = ARCHIVE_FATAL; - goto exit_mac_metadata; - default: - archive_set_error(&a->archive, - ARCHIVE_ERRNO_MISC, - "ZIP decompression failed (%d)", r); - ret = ARCHIVE_FATAL; - goto exit_mac_metadata; - } - bytes_used = zip->stream.total_in; - metadata_bytes -= zip->stream.total_out; - mp += zip->stream.total_out; - break; - } -#endif - default: - bytes_used = 0; - break; - } - zip_read_consume(a, bytes_used); - remaining_bytes -= bytes_used; - } - archive_entry_copy_mac_metadata(entry, metadata, - (size_t)rsrc->uncompressed_size - metadata_bytes); - - __archive_read_seek(a, offset, SEEK_SET); - zip->offset = offset; -exit_mac_metadata: - zip->decompress_init = 0; - free(metadata); - return (ret); -} - -static int -archive_read_format_zip_seekable_read_header(struct archive_read *a, - struct archive_entry *entry) -{ - struct zip *zip = (struct zip *)a->format->data; - struct zip_entry *rsrc; - int r, ret = ARCHIVE_OK; - - a->archive.archive_format = ARCHIVE_FORMAT_ZIP; - if (a->archive.archive_format_name == NULL) - a->archive.archive_format_name = "ZIP"; - - if (zip->zip_entries == NULL) { - r = slurp_central_directory(a, zip); - zip->entries_remaining = zip->central_directory_entries; - if (r != ARCHIVE_OK) - return r; - /* Get first entry whose local header offset is lower than - * other entries in the archive file. */ - zip->entry = - (struct zip_entry *)ARCHIVE_RB_TREE_MIN(&zip->tree); - } else if (zip->entry != NULL) { - /* Get next entry in local header offset order. */ - zip->entry = (struct zip_entry *)__archive_rb_tree_iterate( - &zip->tree, &zip->entry->node, ARCHIVE_RB_DIR_RIGHT); - } - - if (zip->entries_remaining <= 0 || zip->entry == NULL) - return ARCHIVE_EOF; - --zip->entries_remaining; - - if (zip->entry->rsrcname.s) - rsrc = (struct zip_entry *)__archive_rb_tree_find_node( - &zip->tree_rsrc, zip->entry->rsrcname.s); - else - rsrc = NULL; - - /* File entries are sorted by the header offset, we should mostly - * use zip_read_consume to advance a read point to avoid redundant - * data reading. */ - if (zip->offset < zip->entry->local_header_offset) - zip_read_consume(a, - zip->entry->local_header_offset - zip->offset); - else if (zip->offset != zip->entry->local_header_offset) { - __archive_read_seek(a, zip->entry->local_header_offset, - SEEK_SET); - zip->offset = zip->entry->local_header_offset; - } - zip->unconsumed = 0; - r = zip_read_local_file_header(a, entry, zip); - if (r != ARCHIVE_OK) - return r; - if ((zip->entry->mode & AE_IFMT) == AE_IFLNK) { - const void *p; - struct archive_string_conv *sconv; - size_t linkname_length = (size_t)archive_entry_size(entry); - - archive_entry_set_size(entry, 0); - p = __archive_read_ahead(a, linkname_length, NULL); - if (p == NULL) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Truncated Zip file"); - return ARCHIVE_FATAL; - } - - sconv = zip->sconv; - if (sconv == NULL && (zip->entry->flags & ZIP_UTF8_NAME)) - sconv = zip->sconv_utf8; - if (sconv == NULL) - sconv = zip->sconv_default; - if (archive_entry_copy_symlink_l(entry, p, linkname_length, - sconv) != 0) { - if (errno != ENOMEM && sconv == zip->sconv_utf8 && - (zip->entry->flags & ZIP_UTF8_NAME)) - archive_entry_copy_symlink_l(entry, p, - linkname_length, NULL); - if (errno == ENOMEM) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate memory for Symlink"); - return (ARCHIVE_FATAL); - } - /* - * Since there is no character-set regulation for - * symlink name, do not report the conversion error - * in an automatic conversion. - */ - if (sconv != zip->sconv_utf8 || - (zip->entry->flags & ZIP_UTF8_NAME) == 0) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Symlink cannot be converted " - "from %s to current locale.", - archive_string_conversion_charset_name( - sconv)); - ret = ARCHIVE_WARN; - } - } - } - if (rsrc) { - int ret2 = zip_read_mac_metadata(a, entry, rsrc); - if (ret2 < ret) - ret = ret2; - } - return (ret); -} - -static int -archive_read_format_zip_streamable_bid(struct archive_read *a, int best_bid) -{ - const char *p; - - (void)best_bid; /* UNUSED */ - - if ((p = __archive_read_ahead(a, 4, NULL)) == NULL) - return (-1); - - /* - * Bid of 30 here is: 16 bits for "PK", - * next 16-bit field has four options (-2 bits). - * 16 + 16-2 = 30. - */ - if (p[0] == 'P' && p[1] == 'K') { - if ((p[2] == '\001' && p[3] == '\002') - || (p[2] == '\003' && p[3] == '\004') - || (p[2] == '\005' && p[3] == '\006') - || (p[2] == '\007' && p[3] == '\010') - || (p[2] == '0' && p[3] == '0')) - return (30); - } - - /* TODO: It's worth looking ahead a little bit for a valid - * PK signature. In particular, that would make it possible - * to read some UUEncoded SFX files or SFX files coming from - * a network socket. */ - - return (0); -} - -static int -archive_read_format_zip_options(struct archive_read *a, - const char *key, const char *val) -{ - struct zip *zip; - int ret = ARCHIVE_FAILED; - - zip = (struct zip *)(a->format->data); - if (strcmp(key, "compat-2x") == 0) { - /* Handle filnames as libarchive 2.x */ - zip->init_default_conversion = (val != NULL) ? 1 : 0; - return (ARCHIVE_OK); - } else if (strcmp(key, "hdrcharset") == 0) { - if (val == NULL || val[0] == 0) - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "zip: hdrcharset option needs a character-set name" - ); - else { - zip->sconv = archive_string_conversion_from_charset( - &a->archive, val, 0); - if (zip->sconv != NULL) { - if (strcmp(val, "UTF-8") == 0) - zip->sconv_utf8 = zip->sconv; - ret = ARCHIVE_OK; - } else - ret = ARCHIVE_FATAL; - } - return (ret); - } - - /* Note: The "warn" return is just to inform the options - * supervisor that we didn't handle it. It will generate - * a suitable error if no one used this option. */ - return (ARCHIVE_WARN); -} - -static int -archive_read_format_zip_streamable_read_header(struct archive_read *a, - struct archive_entry *entry) -{ - struct zip *zip; - - a->archive.archive_format = ARCHIVE_FORMAT_ZIP; - if (a->archive.archive_format_name == NULL) - a->archive.archive_format_name = "ZIP"; - - zip = (struct zip *)(a->format->data); - - /* Make sure we have a zip_entry structure to use. */ - if (zip->zip_entries == NULL) { - zip->zip_entries = malloc(sizeof(struct zip_entry)); - if (zip->zip_entries == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Out of memory"); - return ARCHIVE_FATAL; - } - } - zip->entry = zip->zip_entries; - memset(zip->entry, 0, sizeof(struct zip_entry)); - - /* Search ahead for the next local file header. */ - zip_read_consume(a, zip->unconsumed); - zip->unconsumed = 0; - for (;;) { - int64_t skipped = 0; - const char *p, *end; - ssize_t bytes; - - p = __archive_read_ahead(a, 4, &bytes); - if (p == NULL) - return (ARCHIVE_FATAL); - end = p + bytes; - - while (p + 4 <= end) { - if (p[0] == 'P' && p[1] == 'K') { - if (p[2] == '\001' && p[3] == '\002') - /* Beginning of central directory. */ - return (ARCHIVE_EOF); - - if (p[2] == '\003' && p[3] == '\004') { - /* Regular file entry. */ - zip_read_consume(a, skipped); - return zip_read_local_file_header(a, - entry, zip); - } - - if (p[2] == '\005' && p[3] == '\006') - /* End of central directory. */ - return (ARCHIVE_EOF); - } - ++p; - ++skipped; - } - zip_read_consume(a, skipped); - } -} - -static ssize_t -zip_get_local_file_header_size(struct archive_read *a, size_t extra) -{ - const char *p; - ssize_t filename_length, extra_length; - - if ((p = __archive_read_ahead(a, extra + 30, NULL)) == NULL) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP file header"); - return (ARCHIVE_WARN); - } - p += extra; - - if (memcmp(p, "PK\003\004", 4) != 0) { - archive_set_error(&a->archive, -1, "Damaged Zip archive"); - return ARCHIVE_WARN; - } - filename_length = archive_le16dec(p + 26); - extra_length = archive_le16dec(p + 28); - - return (30 + filename_length + extra_length); -} /* - * Assumes file pointer is at beginning of local file header. + * Common code for streaming or seeking modes. + * + * Includes code to read local file headers, decompress data + * from entry bodies, and common API. */ -static int -zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry, - struct zip *zip) + +static unsigned long +real_crc32(unsigned long crc, const void *buff, size_t len) { - const char *p; - const void *h; - const wchar_t *wp; - const char *cp; - size_t len, filename_length, extra_length; - struct archive_string_conv *sconv; - struct zip_entry *zip_entry = zip->entry; - uint32_t local_crc32; - int64_t compressed_size, uncompressed_size; - int ret = ARCHIVE_OK; - char version; - - zip->decompress_init = 0; - zip->end_of_entry = 0; - zip->entry_uncompressed_bytes_read = 0; - zip->entry_compressed_bytes_read = 0; - zip->entry_crc32 = crc32(0, NULL, 0); - - /* Setup default conversion. */ - if (zip->sconv == NULL && !zip->init_default_conversion) { - zip->sconv_default = - archive_string_default_conversion_for_read(&(a->archive)); - zip->init_default_conversion = 1; - } - - if ((p = __archive_read_ahead(a, 30, NULL)) == NULL) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP file header"); - return (ARCHIVE_FATAL); - } - - if (memcmp(p, "PK\003\004", 4) != 0) { - archive_set_error(&a->archive, -1, "Damaged Zip archive"); - return ARCHIVE_FATAL; - } - version = p[4]; - zip_entry->system = p[5]; - zip_entry->flags = archive_le16dec(p + 6); - zip_entry->compression = (char)archive_le16dec(p + 8); - zip_entry->mtime = zip_time(p + 10); - local_crc32 = archive_le32dec(p + 14); - compressed_size = archive_le32dec(p + 18); - uncompressed_size = archive_le32dec(p + 22); - filename_length = archive_le16dec(p + 26); - extra_length = archive_le16dec(p + 28); - - zip_read_consume(a, 30); - - if (zip->have_central_directory) { - /* If we read the central dir entry, we must have size - * information as well, so ignore the length-at-end flag. */ - zip_entry->flags &= ~ZIP_LENGTH_AT_END; - /* If we have values from both the local file header - and the central directory, warn about mismatches - which might indicate a damaged file. But some - writers always put zero in the local header; don't - bother warning about that. */ - if (local_crc32 != 0 && local_crc32 != zip_entry->crc32) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Inconsistent CRC32 values"); - ret = ARCHIVE_WARN; - } - if (compressed_size != 0 - && compressed_size != zip_entry->compressed_size) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Inconsistent compressed size"); - ret = ARCHIVE_WARN; - } - if (uncompressed_size != 0 - && uncompressed_size != zip_entry->uncompressed_size) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Inconsistent uncompressed size"); - ret = ARCHIVE_WARN; - } - } else { - /* If we don't have the CD info, use whatever we do have. */ - zip_entry->crc32 = local_crc32; - zip_entry->compressed_size = compressed_size; - zip_entry->uncompressed_size = uncompressed_size; - } - - /* Read the filename. */ - if ((h = __archive_read_ahead(a, filename_length, NULL)) == NULL) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP file header"); - return (ARCHIVE_FATAL); - } - if (zip_entry->flags & ZIP_UTF8_NAME) { - /* The filename is stored to be UTF-8. */ - if (zip->sconv_utf8 == NULL) { - zip->sconv_utf8 = - archive_string_conversion_from_charset( - &a->archive, "UTF-8", 1); - if (zip->sconv_utf8 == NULL) - return (ARCHIVE_FATAL); - } - sconv = zip->sconv_utf8; - } else if (zip->sconv != NULL) - sconv = zip->sconv; - else - sconv = zip->sconv_default; - - if (archive_entry_copy_pathname_l(entry, - h, filename_length, sconv) != 0) { - if (errno == ENOMEM) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate memory for Pathname"); - return (ARCHIVE_FATAL); - } - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Pathname cannot be converted " - "from %s to current locale.", - archive_string_conversion_charset_name(sconv)); - ret = ARCHIVE_WARN; - } - zip_read_consume(a, filename_length); - - if (zip_entry->mode == 0) { - /* Especially in streaming mode, we can end up - here without having seen any mode information. - Guess from the filename. */ - wp = archive_entry_pathname_w(entry); - if (wp != NULL) { - len = wcslen(wp); - if (len > 0 && wp[len - 1] == L'/') - zip_entry->mode = AE_IFDIR | 0777; - else - zip_entry->mode = AE_IFREG | 0666; - } else { - cp = archive_entry_pathname(entry); - len = (cp != NULL)?strlen(cp):0; - if (len > 0 && cp[len - 1] == '/') - zip_entry->mode = AE_IFDIR | 0777; - else - zip_entry->mode = AE_IFREG | 0666; - } - } - - /* Read the extra data. */ - if ((h = __archive_read_ahead(a, extra_length, NULL)) == NULL) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP file header"); - return (ARCHIVE_FATAL); - } - process_extra(h, extra_length, zip_entry); - zip_read_consume(a, extra_length); - - /* Populate some additional entry fields: */ - archive_entry_set_mode(entry, zip_entry->mode); - archive_entry_set_uid(entry, zip_entry->uid); - archive_entry_set_gid(entry, zip_entry->gid); - archive_entry_set_mtime(entry, zip_entry->mtime, 0); - archive_entry_set_ctime(entry, zip_entry->ctime, 0); - archive_entry_set_atime(entry, zip_entry->atime, 0); - /* Set the size only if it's meaningful. */ - if (0 == (zip_entry->flags & ZIP_LENGTH_AT_END)) - archive_entry_set_size(entry, zip_entry->uncompressed_size); - - zip->entry_bytes_remaining = zip_entry->compressed_size; - - /* If there's no body, force read_data() to return EOF immediately. */ - if (0 == (zip_entry->flags & ZIP_LENGTH_AT_END) - && zip->entry_bytes_remaining < 1) - zip->end_of_entry = 1; - - /* Set up a more descriptive format name. */ - sprintf(zip->format_name, "ZIP %d.%d (%s)", - version / 10, version % 10, - compression_name(zip->entry->compression)); - a->archive.archive_format_name = zip->format_name; - - return (ret); + return crc32(crc, buff, (unsigned int)len); } -static const char * -compression_name(int compression) +/* Used by "ignorecrc32" option to speed up tests. */ +static unsigned long +fake_crc32(unsigned long crc, const void *buff, size_t len) { - static const char *compression_names[] = { - "uncompressed", - "shrinking", - "reduced-1", - "reduced-2", - "reduced-3", - "reduced-4", - "imploded", - "reserved", - "deflation" - }; + (void)crc; /* UNUSED */ + (void)buff; /* UNUSED */ + (void)len; /* UNUSED */ + return 0; +} - if (0 <= compression && compression < - (int)(sizeof(compression_names)/sizeof(compression_names[0]))) - return compression_names[compression]; - else - return "??"; +static struct { + int id; + const char * name; +} compression_methods[] = { + {0, "uncompressed"}, /* The file is stored (no compression) */ + {1, "shrinking"}, /* The file is Shrunk */ + {2, "reduced-1"}, /* The file is Reduced with compression factor 1 */ + {3, "reduced-2"}, /* The file is Reduced with compression factor 2 */ + {4, "reduced-3"}, /* The file is Reduced with compression factor 3 */ + {5, "reduced-4"}, /* The file is Reduced with compression factor 4 */ + {6, "imploded"}, /* The file is Imploded */ + {7, "reserved"}, /* Reserved for Tokenizing compression algorithm */ + {8, "deflation"}, /* The file is Deflated */ + {9, "deflation-64-bit"}, /* Enhanced Deflating using Deflate64(tm) */ + {10, "ibm-terse"},/* PKWARE Data Compression Library Imploding + * (old IBM TERSE) */ + {11, "reserved"}, /* Reserved by PKWARE */ + {12, "bzip"}, /* File is compressed using BZIP2 algorithm */ + {13, "reserved"}, /* Reserved by PKWARE */ + {14, "lzma"}, /* LZMA (EFS) */ + {15, "reserved"}, /* Reserved by PKWARE */ + {16, "reserved"}, /* Reserved by PKWARE */ + {17, "reserved"}, /* Reserved by PKWARE */ + {18, "ibm-terse-new"}, /* File is compressed using IBM TERSE (new) */ + {19, "ibm-lz777"},/* IBM LZ77 z Architecture (PFS) */ + {97, "wav-pack"}, /* WavPack compressed data */ + {98, "ppmd-1"}, /* PPMd version I, Rev 1 */ + {99, "aes"} /* WinZip AES encryption */ +}; + +static const char * +compression_name(const int compression) +{ + static const int num_compression_methods = + sizeof(compression_methods)/sizeof(compression_methods[0]); + int i=0; + + while(compression >= 0 && i < num_compression_methods) { + if (compression_methods[i].id == compression) + return compression_methods[i].name; + i++; + } + return "??"; } /* Convert an MSDOS-style date/time into Unix-style time. */ @@ -1171,430 +405,6 @@ zip_time(const char *p) return mktime(&ts); } -static int -archive_read_format_zip_read_data(struct archive_read *a, - const void **buff, size_t *size, int64_t *offset) -{ - int r; - struct zip *zip = (struct zip *)(a->format->data); - - *offset = zip->entry_uncompressed_bytes_read; - *size = 0; - *buff = NULL; - - /* If we hit end-of-entry last time, return ARCHIVE_EOF. */ - if (zip->end_of_entry) - return (ARCHIVE_EOF); - - /* Return EOF immediately if this is a non-regular file. */ - if (AE_IFREG != (zip->entry->mode & AE_IFMT)) - return (ARCHIVE_EOF); - - if (zip->entry->flags & (ZIP_ENCRYPTED | ZIP_STRONG_ENCRYPTED)) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Encrypted file is unsupported"); - return (ARCHIVE_FAILED); - } - - zip_read_consume(a, zip->unconsumed); - zip->unconsumed = 0; - - switch(zip->entry->compression) { - case 0: /* No compression. */ - r = zip_read_data_none(a, buff, size, offset); - break; -#ifdef HAVE_ZLIB_H - case 8: /* Deflate compression. */ - r = zip_read_data_deflate(a, buff, size, offset); - break; -#endif - default: /* Unsupported compression. */ - /* Return a warning. */ - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Unsupported ZIP compression method (%s)", - compression_name(zip->entry->compression)); - /* We can't decompress this entry, but we will - * be able to skip() it and try the next entry. */ - return (ARCHIVE_FAILED); - break; - } - if (r != ARCHIVE_OK) - return (r); - /* Update checksum */ - if (*size) - zip->entry_crc32 = crc32(zip->entry_crc32, *buff, - (unsigned)*size); - /* If we hit the end, swallow any end-of-data marker. */ - if (zip->end_of_entry) { - /* Check file size, CRC against these values. */ - if (zip->entry->compressed_size != - zip->entry_compressed_bytes_read) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "ZIP compressed data is wrong size " - "(read %jd, expected %jd)", - (intmax_t)zip->entry_compressed_bytes_read, - (intmax_t)zip->entry->compressed_size); - return (ARCHIVE_WARN); - } - /* Size field only stores the lower 32 bits of the actual - * size. */ - if ((zip->entry->uncompressed_size & UINT32_MAX) - != (zip->entry_uncompressed_bytes_read & UINT32_MAX)) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "ZIP uncompressed data is wrong size " - "(read %jd, expected %jd)", - (intmax_t)zip->entry_uncompressed_bytes_read, - (intmax_t)zip->entry->uncompressed_size); - return (ARCHIVE_WARN); - } - /* Check computed CRC against header */ - if (zip->entry->crc32 != zip->entry_crc32) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "ZIP bad CRC: 0x%lx should be 0x%lx", - (unsigned long)zip->entry_crc32, - (unsigned long)zip->entry->crc32); - return (ARCHIVE_WARN); - } - } - - return (ARCHIVE_OK); -} - -/* - * Read "uncompressed" data. There are three cases: - * 1) We know the size of the data. This is always true for the - * seeking reader (we've examined the Central Directory already). - * 2) ZIP_LENGTH_AT_END was set, but only the CRC was deferred. - * Info-ZIP seems to do this; we know the size but have to grab - * the CRC from the data descriptor afterwards. - * 3) We're streaming and ZIP_LENGTH_AT_END was specified and - * we have no size information. In this case, we can do pretty - * well by watching for the data descriptor record. The data - * descriptor is 16 bytes and includes a computed CRC that should - * provide a strong check. - * - * TODO: Technically, the PK\007\010 signature is optional. - * In the original spec, the data descriptor contained CRC - * and size fields but had no leading signature. In practice, - * newer writers seem to provide the signature pretty consistently, - * but we might need to do something more complex here if - * we want to handle older archives that lack that signature. - * - * Returns ARCHIVE_OK if successful, ARCHIVE_FATAL otherwise, sets - * zip->end_of_entry if it consumes all of the data. - */ -static int -zip_read_data_none(struct archive_read *a, const void **_buff, - size_t *size, int64_t *offset) -{ - struct zip *zip; - const char *buff; - ssize_t bytes_avail; - - (void)offset; /* UNUSED */ - - zip = (struct zip *)(a->format->data); - - if (zip->entry->flags & ZIP_LENGTH_AT_END) { - const char *p; - - /* Grab at least 16 bytes. */ - buff = __archive_read_ahead(a, 16, &bytes_avail); - if (bytes_avail < 16) { - /* Zip archives have end-of-archive markers - that are longer than this, so a failure to get at - least 16 bytes really does indicate a truncated - file. */ - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP file data"); - return (ARCHIVE_FATAL); - } - /* Check for a complete PK\007\010 signature. */ - p = buff; - if (p[0] == 'P' && p[1] == 'K' - && p[2] == '\007' && p[3] == '\010' - && archive_le32dec(p + 4) == zip->entry_crc32 - && archive_le32dec(p + 8) == - zip->entry_compressed_bytes_read - && archive_le32dec(p + 12) == - zip->entry_uncompressed_bytes_read) { - zip->entry->crc32 = archive_le32dec(p + 4); - zip->entry->compressed_size = archive_le32dec(p + 8); - zip->entry->uncompressed_size = archive_le32dec(p + 12); - zip->end_of_entry = 1; - zip->unconsumed = 16; - return (ARCHIVE_OK); - } - /* If not at EOF, ensure we consume at least one byte. */ - ++p; - - /* Scan forward until we see where a PK\007\010 signature - * might be. */ - /* Return bytes up until that point. On the next call, - * the code above will verify the data descriptor. */ - while (p < buff + bytes_avail - 4) { - if (p[3] == 'P') { p += 3; } - else if (p[3] == 'K') { p += 2; } - else if (p[3] == '\007') { p += 1; } - else if (p[3] == '\010' && p[2] == '\007' - && p[1] == 'K' && p[0] == 'P') { - break; - } else { p += 4; } - } - bytes_avail = p - buff; - } else { - if (zip->entry_bytes_remaining == 0) { - zip->end_of_entry = 1; - return (ARCHIVE_OK); - } - /* Grab a bunch of bytes. */ - buff = __archive_read_ahead(a, 1, &bytes_avail); - if (bytes_avail <= 0) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP file data"); - return (ARCHIVE_FATAL); - } - if (bytes_avail > zip->entry_bytes_remaining) - bytes_avail = (ssize_t)zip->entry_bytes_remaining; - } - *size = bytes_avail; - zip->entry_bytes_remaining -= bytes_avail; - zip->entry_uncompressed_bytes_read += bytes_avail; - zip->entry_compressed_bytes_read += bytes_avail; - zip->unconsumed += bytes_avail; - *_buff = buff; - return (ARCHIVE_OK); -} - -#ifdef HAVE_ZLIB_H -static int -zip_deflate_init(struct archive_read *a, struct zip *zip) -{ - int r; - - /* If we haven't yet read any data, initialize the decompressor. */ - if (!zip->decompress_init) { - if (zip->stream_valid) - r = inflateReset(&zip->stream); - else - r = inflateInit2(&zip->stream, - -15 /* Don't check for zlib header */); - if (r != Z_OK) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "Can't initialize ZIP decompression."); - return (ARCHIVE_FATAL); - } - /* Stream structure has been set up. */ - zip->stream_valid = 1; - /* We've initialized decompression for this stream. */ - zip->decompress_init = 1; - } - return (ARCHIVE_OK); -} - -static int -zip_read_data_deflate(struct archive_read *a, const void **buff, - size_t *size, int64_t *offset) -{ - struct zip *zip; - ssize_t bytes_avail; - const void *compressed_buff; - int r; - - (void)offset; /* UNUSED */ - - zip = (struct zip *)(a->format->data); - - /* If the buffer hasn't been allocated, allocate it now. */ - if (zip->uncompressed_buffer == NULL) { - zip->uncompressed_buffer_size = 256 * 1024; - zip->uncompressed_buffer - = (unsigned char *)malloc(zip->uncompressed_buffer_size); - if (zip->uncompressed_buffer == NULL) { - archive_set_error(&a->archive, ENOMEM, - "No memory for ZIP decompression"); - return (ARCHIVE_FATAL); - } - } - - r = zip_deflate_init(a, zip); - if (r != ARCHIVE_OK) - return (r); - - /* - * Note: '1' here is a performance optimization. - * Recall that the decompression layer returns a count of - * available bytes; asking for more than that forces the - * decompressor to combine reads by copying data. - */ - compressed_buff = __archive_read_ahead(a, 1, &bytes_avail); - if (0 == (zip->entry->flags & ZIP_LENGTH_AT_END) - && bytes_avail > zip->entry_bytes_remaining) { - bytes_avail = (ssize_t)zip->entry_bytes_remaining; - } - if (bytes_avail <= 0) { - archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP file body"); - return (ARCHIVE_FATAL); - } - - /* - * A bug in zlib.h: stream.next_in should be marked 'const' - * but isn't (the library never alters data through the - * next_in pointer, only reads it). The result: this ugly - * cast to remove 'const'. - */ - zip->stream.next_in = (Bytef *)(uintptr_t)(const void *)compressed_buff; - zip->stream.avail_in = (uInt)bytes_avail; - zip->stream.total_in = 0; - zip->stream.next_out = zip->uncompressed_buffer; - zip->stream.avail_out = (uInt)zip->uncompressed_buffer_size; - zip->stream.total_out = 0; - - r = inflate(&zip->stream, 0); - switch (r) { - case Z_OK: - break; - case Z_STREAM_END: - zip->end_of_entry = 1; - break; - case Z_MEM_ERROR: - archive_set_error(&a->archive, ENOMEM, - "Out of memory for ZIP decompression"); - return (ARCHIVE_FATAL); - default: - archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, - "ZIP decompression failed (%d)", r); - return (ARCHIVE_FATAL); - } - - /* Consume as much as the compressor actually used. */ - bytes_avail = zip->stream.total_in; - zip_read_consume(a, bytes_avail); - zip->entry_bytes_remaining -= bytes_avail; - zip->entry_compressed_bytes_read += bytes_avail; - - *size = zip->stream.total_out; - zip->entry_uncompressed_bytes_read += zip->stream.total_out; - *buff = zip->uncompressed_buffer; - - if (zip->end_of_entry && (zip->entry->flags & ZIP_LENGTH_AT_END)) { - const char *p; - - if (NULL == (p = __archive_read_ahead(a, 16, NULL))) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP end-of-file record"); - return (ARCHIVE_FATAL); - } - /* Consume the optional PK\007\010 marker. */ - if (p[0] == 'P' && p[1] == 'K' && - p[2] == '\007' && p[3] == '\010') { - zip->entry->crc32 = archive_le32dec(p + 4); - zip->entry->compressed_size = archive_le32dec(p + 8); - zip->entry->uncompressed_size = archive_le32dec(p + 12); - zip->unconsumed = 16; - } - } - - return (ARCHIVE_OK); -} -#endif - -static int -archive_read_format_zip_read_data_skip(struct archive_read *a) -{ - struct zip *zip; - - zip = (struct zip *)(a->format->data); - - /* If we've already read to end of data, we're done. */ - if (zip->end_of_entry) - return (ARCHIVE_OK); - - /* So we know we're streaming... */ - if (0 == (zip->entry->flags & ZIP_LENGTH_AT_END)) { - /* We know the compressed length, so we can just skip. */ - int64_t bytes_skipped = zip_read_consume(a, - zip->entry_bytes_remaining + zip->unconsumed); - if (bytes_skipped < 0) - return (ARCHIVE_FATAL); - zip->unconsumed = 0; - return (ARCHIVE_OK); - } - - /* We're streaming and we don't know the length. */ - /* If the body is compressed and we know the format, we can - * find an exact end-of-entry by decompressing it. */ - switch (zip->entry->compression) { -#ifdef HAVE_ZLIB_H - case 8: /* Deflate compression. */ - while (!zip->end_of_entry) { - int64_t offset = 0; - const void *buff = NULL; - size_t size = 0; - int r; - r = zip_read_data_deflate(a, &buff, &size, &offset); - if (r != ARCHIVE_OK) - return (r); - } - return ARCHIVE_OK; -#endif - default: /* Uncompressed or unknown. */ - /* Scan for a PK\007\010 signature. */ - zip_read_consume(a, zip->unconsumed); - zip->unconsumed = 0; - for (;;) { - const char *p, *buff; - ssize_t bytes_avail; - buff = __archive_read_ahead(a, 16, &bytes_avail); - if (bytes_avail < 16) { - archive_set_error(&a->archive, - ARCHIVE_ERRNO_FILE_FORMAT, - "Truncated ZIP file data"); - return (ARCHIVE_FATAL); - } - p = buff; - while (p <= buff + bytes_avail - 16) { - if (p[3] == 'P') { p += 3; } - else if (p[3] == 'K') { p += 2; } - else if (p[3] == '\007') { p += 1; } - else if (p[3] == '\010' && p[2] == '\007' - && p[1] == 'K' && p[0] == 'P') { - zip_read_consume(a, p - buff + 16); - return ARCHIVE_OK; - } else { p += 4; } - } - zip_read_consume(a, p - buff); - } - } -} - -static int -archive_read_format_zip_cleanup(struct archive_read *a) -{ - struct zip *zip; - - zip = (struct zip *)(a->format->data); -#ifdef HAVE_ZLIB_H - if (zip->stream_valid) - inflateEnd(&zip->stream); -#endif - if (zip->zip_entries && zip->central_directory_entries) { - unsigned i; - for (i = 0; i < zip->central_directory_entries; i++) - archive_string_free(&(zip->zip_entries[i].rsrcname)); - } - free(zip->zip_entries); - free(zip->uncompressed_buffer); - archive_string_free(&(zip->extra)); - free(zip); - (a->format->data) = NULL; - return (ARCHIVE_OK); -} - /* * The extra data is stored as a list of * id1+size1+data1 + id2+size2+data2 ... @@ -1605,27 +415,67 @@ process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry) { unsigned offset = 0; - while (offset < extra_length - 4) - { + while (offset < extra_length - 4) { unsigned short headerid = archive_le16dec(p + offset); unsigned short datasize = archive_le16dec(p + offset + 2); + offset += 4; - if (offset + datasize > extra_length) + if (offset + datasize > extra_length) { break; + } #ifdef DEBUG - fprintf(stderr, "Header id 0x%x, length %d\n", + fprintf(stderr, "Header id 0x%04x, length %d\n", headerid, datasize); #endif switch (headerid) { case 0x0001: /* Zip64 extended information extra field. */ - if (datasize >= 8) + zip_entry->flags |= LA_USED_ZIP64; + if (zip_entry->uncompressed_size == 0xffffffff) { + if (datasize < 8) + break; zip_entry->uncompressed_size = archive_le64dec(p + offset); - if (datasize >= 16) + offset += 8; + datasize -= 8; + } + if (zip_entry->compressed_size == 0xffffffff) { + if (datasize < 8) + break; zip_entry->compressed_size = - archive_le64dec(p + offset + 8); + archive_le64dec(p + offset); + offset += 8; + datasize -= 8; + } + if (zip_entry->local_header_offset == 0xffffffff) { + if (datasize < 8) + break; + zip_entry->local_header_offset = + archive_le64dec(p + offset); + offset += 8; + datasize -= 8; + } + /* archive_le32dec(p + offset) gives disk + * on which file starts, but we don't handle + * multi-volume Zip files. */ break; +#ifdef DEBUG + case 0x0017: + { + /* Strong encryption field. */ + if (archive_le16dec(p + offset) == 2) { + unsigned algId = + archive_le16dec(p + offset + 2); + unsigned bitLen = + archive_le16dec(p + offset + 4); + int flags = + archive_le16dec(p + offset + 6); + fprintf(stderr, "algId=0x%04x, bitLen=%u, " + "flgas=%d\n", algId, bitLen,flags); + } + break; + } +#endif case 0x5455: { /* Extended time field "UT". */ @@ -1680,6 +530,117 @@ process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry) } break; } + case 0x6c78: + { + /* Experimental 'xl' field */ + /* + * Introduced Dec 2013 to provide a way to + * include external file attributes (and other + * fields that ordinarily appear only in + * central directory) in local file header. + * This provides file type and permission + * information necessary to support full + * streaming extraction. Currently being + * discussed with other Zip developers + * ... subject to change. + * + * Format: + * The field starts with a bitmap that specifies + * which additional fields are included. The + * bitmap is variable length and can be extended in + * the future. + * + * n bytes - feature bitmap: first byte has low-order + * 7 bits. If high-order bit is set, a subsequent + * byte holds the next 7 bits, etc. + * + * if bitmap & 1, 2 byte "version made by" + * if bitmap & 2, 2 byte "internal file attributes" + * if bitmap & 4, 4 byte "external file attributes" + * if bitmap & 8, 2 byte comment length + n byte comment + */ + int bitmap, bitmap_last; + + if (datasize < 1) + break; + bitmap_last = bitmap = 0xff & p[offset]; + offset += 1; + datasize -= 1; + + /* We only support first 7 bits of bitmap; skip rest. */ + while ((bitmap_last & 0x80) != 0 + && datasize >= 1) { + bitmap_last = p[offset]; + offset += 1; + datasize -= 1; + } + + if (bitmap & 1) { + /* 2 byte "version made by" */ + if (datasize < 2) + break; + zip_entry->system + = archive_le16dec(p + offset) >> 8; + offset += 2; + datasize -= 2; + } + if (bitmap & 2) { + /* 2 byte "internal file attributes" */ + uint32_t internal_attributes; + if (datasize < 2) + break; + internal_attributes + = archive_le16dec(p + offset); + /* Not used by libarchive at present. */ + (void)internal_attributes; /* UNUSED */ + offset += 2; + datasize -= 2; + } + if (bitmap & 4) { + /* 4 byte "external file attributes" */ + uint32_t external_attributes; + if (datasize < 4) + break; + external_attributes + = archive_le32dec(p + offset); + if (zip_entry->system == 3) { + zip_entry->mode + = external_attributes >> 16; + } else if (zip_entry->system == 0) { + // Interpret MSDOS directory bit + if (0x10 == (external_attributes & 0x10)) { + zip_entry->mode = AE_IFDIR | 0775; + } else { + zip_entry->mode = AE_IFREG | 0664; + } + if (0x01 == (external_attributes & 0x01)) { + // Read-only bit; strip write permissions + zip_entry->mode &= 0555; + } + } else { + zip_entry->mode = 0; + } + offset += 4; + datasize -= 4; + } + if (bitmap & 8) { + /* 2 byte comment length + comment */ + uint32_t comment_length; + if (datasize < 2) + break; + comment_length + = archive_le16dec(p + offset); + offset += 2; + datasize -= 2; + + if (datasize < comment_length) + break; + /* Comment is not supported by libarchive */ + offset += comment_length; + datasize -= comment_length; + } + break; + } case 0x7855: /* Info-ZIP Unix Extra Field (type 2) "Ux". */ #ifdef DEBUG @@ -1698,10 +659,11 @@ process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry) /* Info-Zip Unix Extra Field (type 3) "ux". */ int uidsize = 0, gidsize = 0; + /* TODO: support arbitrary uidsize/gidsize. */ if (datasize >= 1 && p[offset] == 1) {/* version=1 */ if (datasize >= 4) { /* get a uid size. */ - uidsize = p[offset+1]; + uidsize = 0xff & (int)p[offset+1]; if (uidsize == 2) zip_entry->uid = archive_le16dec( @@ -1713,7 +675,7 @@ process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry) } if (datasize >= (2 + uidsize + 3)) { /* get a gid size. */ - gidsize = p[offset+2+uidsize]; + gidsize = 0xff & (int)p[offset+2+uidsize]; if (gidsize == 2) zip_entry->gid = archive_le16dec( @@ -1727,6 +689,19 @@ process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry) } break; } + case 0x9901: + /* WinZIp AES extra data field. */ + if (p[offset + 2] == 'A' && p[offset + 3] == 'E') { + /* Vendor version. */ + zip_entry->aes_extra.vendor = + archive_le16dec(p + offset); + /* AES encryption strength. */ + zip_entry->aes_extra.strength = p[offset + 4]; + /* Actual compression method. */ + zip_entry->aes_extra.compression = + p[offset + 5]; + } + break; default: break; } @@ -1740,3 +715,2339 @@ process_extra(const char *p, size_t extra_length, struct zip_entry* zip_entry) } #endif } + +/* + * Assumes file pointer is at beginning of local file header. + */ +static int +zip_read_local_file_header(struct archive_read *a, struct archive_entry *entry, + struct zip *zip) +{ + const char *p; + const void *h; + const wchar_t *wp; + const char *cp; + size_t len, filename_length, extra_length; + struct archive_string_conv *sconv; + struct zip_entry *zip_entry = zip->entry; + struct zip_entry zip_entry_central_dir; + int ret = ARCHIVE_OK; + char version; + + /* Save a copy of the original for consistency checks. */ + zip_entry_central_dir = *zip_entry; + + zip->decompress_init = 0; + zip->end_of_entry = 0; + zip->entry_uncompressed_bytes_read = 0; + zip->entry_compressed_bytes_read = 0; + zip->entry_crc32 = zip->crc32func(0, NULL, 0); + + /* Setup default conversion. */ + if (zip->sconv == NULL && !zip->init_default_conversion) { + zip->sconv_default = + archive_string_default_conversion_for_read(&(a->archive)); + zip->init_default_conversion = 1; + } + + if ((p = __archive_read_ahead(a, 30, NULL)) == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file header"); + return (ARCHIVE_FATAL); + } + + if (memcmp(p, "PK\003\004", 4) != 0) { + archive_set_error(&a->archive, -1, "Damaged Zip archive"); + return ARCHIVE_FATAL; + } + version = p[4]; + zip_entry->system = p[5]; + zip_entry->zip_flags = archive_le16dec(p + 6); + if (zip_entry->zip_flags & (ZIP_ENCRYPTED | ZIP_STRONG_ENCRYPTED)) { + zip->has_encrypted_entries = 1; + archive_entry_set_is_data_encrypted(entry, 1); + if (zip_entry->zip_flags & ZIP_CENTRAL_DIRECTORY_ENCRYPTED && + zip_entry->zip_flags & ZIP_ENCRYPTED && + zip_entry->zip_flags & ZIP_STRONG_ENCRYPTED) { + archive_entry_set_is_metadata_encrypted(entry, 1); + return ARCHIVE_FATAL; + } + } + zip->init_decryption = (zip_entry->zip_flags & ZIP_ENCRYPTED); + zip_entry->compression = (char)archive_le16dec(p + 8); + zip_entry->mtime = zip_time(p + 10); + zip_entry->crc32 = archive_le32dec(p + 14); + if (zip_entry->zip_flags & ZIP_LENGTH_AT_END) + zip_entry->decdat = p[11]; + else + zip_entry->decdat = p[17]; + zip_entry->compressed_size = archive_le32dec(p + 18); + zip_entry->uncompressed_size = archive_le32dec(p + 22); + filename_length = archive_le16dec(p + 26); + extra_length = archive_le16dec(p + 28); + + __archive_read_consume(a, 30); + + /* Read the filename. */ + if ((h = __archive_read_ahead(a, filename_length, NULL)) == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file header"); + return (ARCHIVE_FATAL); + } + if (zip_entry->zip_flags & ZIP_UTF8_NAME) { + /* The filename is stored to be UTF-8. */ + if (zip->sconv_utf8 == NULL) { + zip->sconv_utf8 = + archive_string_conversion_from_charset( + &a->archive, "UTF-8", 1); + if (zip->sconv_utf8 == NULL) + return (ARCHIVE_FATAL); + } + sconv = zip->sconv_utf8; + } else if (zip->sconv != NULL) + sconv = zip->sconv; + else + sconv = zip->sconv_default; + + if (archive_entry_copy_pathname_l(entry, + h, filename_length, sconv) != 0) { + if (errno == ENOMEM) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate memory for Pathname"); + return (ARCHIVE_FATAL); + } + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Pathname cannot be converted " + "from %s to current locale.", + archive_string_conversion_charset_name(sconv)); + ret = ARCHIVE_WARN; + } + __archive_read_consume(a, filename_length); + + /* Read the extra data. */ + if ((h = __archive_read_ahead(a, extra_length, NULL)) == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file header"); + return (ARCHIVE_FATAL); + } + + process_extra(h, extra_length, zip_entry); + __archive_read_consume(a, extra_length); + + /* Work around a bug in Info-Zip: When reading from a pipe, it + * stats the pipe instead of synthesizing a file entry. */ + if ((zip_entry->mode & AE_IFMT) == AE_IFIFO) { + zip_entry->mode &= ~ AE_IFMT; + zip_entry->mode |= AE_IFREG; + } + + if ((zip_entry->mode & AE_IFMT) == 0) { + /* Especially in streaming mode, we can end up + here without having seen proper mode information. + Guess from the filename. */ + wp = archive_entry_pathname_w(entry); + if (wp != NULL) { + len = wcslen(wp); + if (len > 0 && wp[len - 1] == L'/') + zip_entry->mode |= AE_IFDIR; + else + zip_entry->mode |= AE_IFREG; + } else { + cp = archive_entry_pathname(entry); + len = (cp != NULL)?strlen(cp):0; + if (len > 0 && cp[len - 1] == '/') + zip_entry->mode |= AE_IFDIR; + else + zip_entry->mode |= AE_IFREG; + } + if (zip_entry->mode == AE_IFDIR) { + zip_entry->mode |= 0775; + } else if (zip_entry->mode == AE_IFREG) { + zip_entry->mode |= 0664; + } + } + + /* Make sure directories end in '/' */ + if ((zip_entry->mode & AE_IFMT) == AE_IFDIR) { + wp = archive_entry_pathname_w(entry); + if (wp != NULL) { + len = wcslen(wp); + if (len > 0 && wp[len - 1] != L'/') { + struct archive_wstring s; + archive_string_init(&s); + archive_wstrcat(&s, wp); + archive_wstrappend_wchar(&s, L'/'); + archive_entry_copy_pathname_w(entry, s.s); + } + } else { + cp = archive_entry_pathname(entry); + len = (cp != NULL)?strlen(cp):0; + if (len > 0 && cp[len - 1] != '/') { + struct archive_string s; + archive_string_init(&s); + archive_strcat(&s, cp); + archive_strappend_char(&s, '/'); + archive_entry_set_pathname(entry, s.s); + } + } + } + + if (zip_entry->flags & LA_FROM_CENTRAL_DIRECTORY) { + /* If this came from the central dir, it's size info + * is definitive, so ignore the length-at-end flag. */ + zip_entry->zip_flags &= ~ZIP_LENGTH_AT_END; + /* If local header is missing a value, use the one from + the central directory. If both have it, warn about + mismatches. */ + if (zip_entry->crc32 == 0) { + zip_entry->crc32 = zip_entry_central_dir.crc32; + } else if (!zip->ignore_crc32 + && zip_entry->crc32 != zip_entry_central_dir.crc32) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Inconsistent CRC32 values"); + ret = ARCHIVE_WARN; + } + if (zip_entry->compressed_size == 0) { + zip_entry->compressed_size + = zip_entry_central_dir.compressed_size; + } else if (zip_entry->compressed_size + != zip_entry_central_dir.compressed_size) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Inconsistent compressed size: " + "%jd in central directory, %jd in local header", + (intmax_t)zip_entry_central_dir.compressed_size, + (intmax_t)zip_entry->compressed_size); + ret = ARCHIVE_WARN; + } + if (zip_entry->uncompressed_size == 0) { + zip_entry->uncompressed_size + = zip_entry_central_dir.uncompressed_size; + } else if (zip_entry->uncompressed_size + != zip_entry_central_dir.uncompressed_size) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Inconsistent uncompressed size: " + "%jd in central directory, %jd in local header", + (intmax_t)zip_entry_central_dir.uncompressed_size, + (intmax_t)zip_entry->uncompressed_size); + ret = ARCHIVE_WARN; + } + } + + /* Populate some additional entry fields: */ + archive_entry_set_mode(entry, zip_entry->mode); + archive_entry_set_uid(entry, zip_entry->uid); + archive_entry_set_gid(entry, zip_entry->gid); + archive_entry_set_mtime(entry, zip_entry->mtime, 0); + archive_entry_set_ctime(entry, zip_entry->ctime, 0); + archive_entry_set_atime(entry, zip_entry->atime, 0); + + if ((zip->entry->mode & AE_IFMT) == AE_IFLNK) { + size_t linkname_length; + + if (zip_entry->compressed_size > 64 * 1024) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Zip file with oversized link entry"); + return ARCHIVE_FATAL; + } + + linkname_length = (size_t)zip_entry->compressed_size; + + archive_entry_set_size(entry, 0); + p = __archive_read_ahead(a, linkname_length, NULL); + if (p == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Truncated Zip file"); + return ARCHIVE_FATAL; + } + + sconv = zip->sconv; + if (sconv == NULL && (zip->entry->zip_flags & ZIP_UTF8_NAME)) + sconv = zip->sconv_utf8; + if (sconv == NULL) + sconv = zip->sconv_default; + if (archive_entry_copy_symlink_l(entry, p, linkname_length, + sconv) != 0) { + if (errno != ENOMEM && sconv == zip->sconv_utf8 && + (zip->entry->zip_flags & ZIP_UTF8_NAME)) + archive_entry_copy_symlink_l(entry, p, + linkname_length, NULL); + if (errno == ENOMEM) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate memory for Symlink"); + return (ARCHIVE_FATAL); + } + /* + * Since there is no character-set regulation for + * symlink name, do not report the conversion error + * in an automatic conversion. + */ + if (sconv != zip->sconv_utf8 || + (zip->entry->zip_flags & ZIP_UTF8_NAME) == 0) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Symlink cannot be converted " + "from %s to current locale.", + archive_string_conversion_charset_name( + sconv)); + ret = ARCHIVE_WARN; + } + } + zip_entry->uncompressed_size = zip_entry->compressed_size = 0; + + if (__archive_read_consume(a, linkname_length) < 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Read error skipping symlink target name"); + return ARCHIVE_FATAL; + } + } else if (0 == (zip_entry->zip_flags & ZIP_LENGTH_AT_END) + || zip_entry->uncompressed_size > 0) { + /* Set the size only if it's meaningful. */ + archive_entry_set_size(entry, zip_entry->uncompressed_size); + } + zip->entry_bytes_remaining = zip_entry->compressed_size; + + /* If there's no body, force read_data() to return EOF immediately. */ + if (0 == (zip_entry->zip_flags & ZIP_LENGTH_AT_END) + && zip->entry_bytes_remaining < 1) + zip->end_of_entry = 1; + + /* Set up a more descriptive format name. */ + archive_string_sprintf(&zip->format_name, "ZIP %d.%d (%s)", + version / 10, version % 10, + compression_name(zip->entry->compression)); + a->archive.archive_format_name = zip->format_name.s; + + return (ret); +} + +static int +check_authentication_code(struct archive_read *a, const void *_p) +{ + struct zip *zip = (struct zip *)(a->format->data); + + /* Check authentication code. */ + if (zip->hctx_valid) { + const void *p; + uint8_t hmac[20]; + size_t hmac_len = 20; + int cmp; + + archive_hmac_sha1_final(&zip->hctx, hmac, &hmac_len); + if (_p == NULL) { + /* Read authentication code. */ + p = __archive_read_ahead(a, AUTH_CODE_SIZE, NULL); + if (p == NULL) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file data"); + return (ARCHIVE_FATAL); + } + } else { + p = _p; + } + cmp = memcmp(hmac, p, AUTH_CODE_SIZE); + __archive_read_consume(a, AUTH_CODE_SIZE); + if (cmp != 0) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "ZIP bad Authentication code"); + return (ARCHIVE_WARN); + } + } + return (ARCHIVE_OK); +} + +/* + * Read "uncompressed" data. There are three cases: + * 1) We know the size of the data. This is always true for the + * seeking reader (we've examined the Central Directory already). + * 2) ZIP_LENGTH_AT_END was set, but only the CRC was deferred. + * Info-ZIP seems to do this; we know the size but have to grab + * the CRC from the data descriptor afterwards. + * 3) We're streaming and ZIP_LENGTH_AT_END was specified and + * we have no size information. In this case, we can do pretty + * well by watching for the data descriptor record. The data + * descriptor is 16 bytes and includes a computed CRC that should + * provide a strong check. + * + * TODO: Technically, the PK\007\010 signature is optional. + * In the original spec, the data descriptor contained CRC + * and size fields but had no leading signature. In practice, + * newer writers seem to provide the signature pretty consistently. + * + * For uncompressed data, the PK\007\010 marker seems essential + * to be sure we've actually seen the end of the entry. + * + * Returns ARCHIVE_OK if successful, ARCHIVE_FATAL otherwise, sets + * zip->end_of_entry if it consumes all of the data. + */ +static int +zip_read_data_none(struct archive_read *a, const void **_buff, + size_t *size, int64_t *offset) +{ + struct zip *zip; + const char *buff; + ssize_t bytes_avail; + int r; + + (void)offset; /* UNUSED */ + + zip = (struct zip *)(a->format->data); + + if (zip->entry->zip_flags & ZIP_LENGTH_AT_END) { + const char *p; + ssize_t grabbing_bytes = 24; + + if (zip->hctx_valid) + grabbing_bytes += AUTH_CODE_SIZE; + /* Grab at least 24 bytes. */ + buff = __archive_read_ahead(a, grabbing_bytes, &bytes_avail); + if (bytes_avail < grabbing_bytes) { + /* Zip archives have end-of-archive markers + that are longer than this, so a failure to get at + least 24 bytes really does indicate a truncated + file. */ + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file data"); + return (ARCHIVE_FATAL); + } + /* Check for a complete PK\007\010 signature, followed + * by the correct 4-byte CRC. */ + p = buff; + if (zip->hctx_valid) + p += AUTH_CODE_SIZE; + if (p[0] == 'P' && p[1] == 'K' + && p[2] == '\007' && p[3] == '\010' + && (archive_le32dec(p + 4) == zip->entry_crc32 + || zip->ignore_crc32 + || (zip->hctx_valid + && zip->entry->aes_extra.vendor == AES_VENDOR_AE_2))) { + if (zip->entry->flags & LA_USED_ZIP64) { + zip->entry->crc32 = archive_le32dec(p + 4); + zip->entry->compressed_size = + archive_le64dec(p + 8); + zip->entry->uncompressed_size = + archive_le64dec(p + 16); + zip->unconsumed = 24; + } else { + zip->entry->crc32 = archive_le32dec(p + 4); + zip->entry->compressed_size = + archive_le32dec(p + 8); + zip->entry->uncompressed_size = + archive_le32dec(p + 12); + zip->unconsumed = 16; + } + if (zip->hctx_valid) { + r = check_authentication_code(a, buff); + if (r != ARCHIVE_OK) + return (r); + } + zip->end_of_entry = 1; + return (ARCHIVE_OK); + } + /* If not at EOF, ensure we consume at least one byte. */ + ++p; + + /* Scan forward until we see where a PK\007\010 signature + * might be. */ + /* Return bytes up until that point. On the next call, + * the code above will verify the data descriptor. */ + while (p < buff + bytes_avail - 4) { + if (p[3] == 'P') { p += 3; } + else if (p[3] == 'K') { p += 2; } + else if (p[3] == '\007') { p += 1; } + else if (p[3] == '\010' && p[2] == '\007' + && p[1] == 'K' && p[0] == 'P') { + if (zip->hctx_valid) + p -= AUTH_CODE_SIZE; + break; + } else { p += 4; } + } + bytes_avail = p - buff; + } else { + if (zip->entry_bytes_remaining == 0) { + zip->end_of_entry = 1; + if (zip->hctx_valid) { + r = check_authentication_code(a, NULL); + if (r != ARCHIVE_OK) + return (r); + } + return (ARCHIVE_OK); + } + /* Grab a bunch of bytes. */ + buff = __archive_read_ahead(a, 1, &bytes_avail); + if (bytes_avail <= 0) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file data"); + return (ARCHIVE_FATAL); + } + if (bytes_avail > zip->entry_bytes_remaining) + bytes_avail = (ssize_t)zip->entry_bytes_remaining; + } + if (zip->tctx_valid || zip->cctx_valid) { + size_t dec_size = bytes_avail; + + if (dec_size > zip->decrypted_buffer_size) + dec_size = zip->decrypted_buffer_size; + if (zip->tctx_valid) { + trad_enc_decrypt_update(&zip->tctx, + (const uint8_t *)buff, dec_size, + zip->decrypted_buffer, dec_size); + } else { + size_t dsize = dec_size; + archive_hmac_sha1_update(&zip->hctx, + (const uint8_t *)buff, dec_size); + archive_decrypto_aes_ctr_update(&zip->cctx, + (const uint8_t *)buff, dec_size, + zip->decrypted_buffer, &dsize); + } + bytes_avail = dec_size; + buff = (const char *)zip->decrypted_buffer; + } + *size = bytes_avail; + zip->entry_bytes_remaining -= bytes_avail; + zip->entry_uncompressed_bytes_read += bytes_avail; + zip->entry_compressed_bytes_read += bytes_avail; + zip->unconsumed += bytes_avail; + *_buff = buff; + return (ARCHIVE_OK); +} + +#ifdef HAVE_ZLIB_H +static int +zip_deflate_init(struct archive_read *a, struct zip *zip) +{ + int r; + + /* If we haven't yet read any data, initialize the decompressor. */ + if (!zip->decompress_init) { + if (zip->stream_valid) + r = inflateReset(&zip->stream); + else + r = inflateInit2(&zip->stream, + -15 /* Don't check for zlib header */); + if (r != Z_OK) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Can't initialize ZIP decompression."); + return (ARCHIVE_FATAL); + } + /* Stream structure has been set up. */ + zip->stream_valid = 1; + /* We've initialized decompression for this stream. */ + zip->decompress_init = 1; + } + return (ARCHIVE_OK); +} + +static int +zip_read_data_deflate(struct archive_read *a, const void **buff, + size_t *size, int64_t *offset) +{ + struct zip *zip; + ssize_t bytes_avail; + const void *compressed_buff, *sp; + int r; + + (void)offset; /* UNUSED */ + + zip = (struct zip *)(a->format->data); + + /* If the buffer hasn't been allocated, allocate it now. */ + if (zip->uncompressed_buffer == NULL) { + zip->uncompressed_buffer_size = 256 * 1024; + zip->uncompressed_buffer + = (unsigned char *)malloc(zip->uncompressed_buffer_size); + if (zip->uncompressed_buffer == NULL) { + archive_set_error(&a->archive, ENOMEM, + "No memory for ZIP decompression"); + return (ARCHIVE_FATAL); + } + } + + r = zip_deflate_init(a, zip); + if (r != ARCHIVE_OK) + return (r); + + /* + * Note: '1' here is a performance optimization. + * Recall that the decompression layer returns a count of + * available bytes; asking for more than that forces the + * decompressor to combine reads by copying data. + */ + compressed_buff = sp = __archive_read_ahead(a, 1, &bytes_avail); + if (0 == (zip->entry->zip_flags & ZIP_LENGTH_AT_END) + && bytes_avail > zip->entry_bytes_remaining) { + bytes_avail = (ssize_t)zip->entry_bytes_remaining; + } + if (bytes_avail <= 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file body"); + return (ARCHIVE_FATAL); + } + + if (zip->tctx_valid || zip->cctx_valid) { + if (zip->decrypted_bytes_remaining < (size_t)bytes_avail) { + size_t buff_remaining = zip->decrypted_buffer_size + - (zip->decrypted_ptr - zip->decrypted_buffer); + + if (buff_remaining > (size_t)bytes_avail) + buff_remaining = (size_t)bytes_avail; + + if (0 == (zip->entry->zip_flags & ZIP_LENGTH_AT_END) && + zip->entry_bytes_remaining > 0) { + if ((int64_t)(zip->decrypted_bytes_remaining + + buff_remaining) + > zip->entry_bytes_remaining) { + if (zip->entry_bytes_remaining < + (int64_t)zip->decrypted_bytes_remaining) + buff_remaining = 0; + else + buff_remaining = + (size_t)zip->entry_bytes_remaining + - zip->decrypted_bytes_remaining; + } + } + if (buff_remaining > 0) { + if (zip->tctx_valid) { + trad_enc_decrypt_update(&zip->tctx, + compressed_buff, buff_remaining, + zip->decrypted_ptr + + zip->decrypted_bytes_remaining, + buff_remaining); + } else { + size_t dsize = buff_remaining; + archive_decrypto_aes_ctr_update( + &zip->cctx, + compressed_buff, buff_remaining, + zip->decrypted_ptr + + zip->decrypted_bytes_remaining, + &dsize); + } + zip->decrypted_bytes_remaining += buff_remaining; + } + } + bytes_avail = zip->decrypted_bytes_remaining; + compressed_buff = (const char *)zip->decrypted_ptr; + } + + /* + * A bug in zlib.h: stream.next_in should be marked 'const' + * but isn't (the library never alters data through the + * next_in pointer, only reads it). The result: this ugly + * cast to remove 'const'. + */ + zip->stream.next_in = (Bytef *)(uintptr_t)(const void *)compressed_buff; + zip->stream.avail_in = (uInt)bytes_avail; + zip->stream.total_in = 0; + zip->stream.next_out = zip->uncompressed_buffer; + zip->stream.avail_out = (uInt)zip->uncompressed_buffer_size; + zip->stream.total_out = 0; + + r = inflate(&zip->stream, 0); + switch (r) { + case Z_OK: + break; + case Z_STREAM_END: + zip->end_of_entry = 1; + break; + case Z_MEM_ERROR: + archive_set_error(&a->archive, ENOMEM, + "Out of memory for ZIP decompression"); + return (ARCHIVE_FATAL); + default: + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "ZIP decompression failed (%d)", r); + return (ARCHIVE_FATAL); + } + + /* Consume as much as the compressor actually used. */ + bytes_avail = zip->stream.total_in; + if (zip->tctx_valid || zip->cctx_valid) { + zip->decrypted_bytes_remaining -= bytes_avail; + if (zip->decrypted_bytes_remaining == 0) + zip->decrypted_ptr = zip->decrypted_buffer; + else + zip->decrypted_ptr += bytes_avail; + } + /* Calculate compressed data as much as we used.*/ + if (zip->hctx_valid) + archive_hmac_sha1_update(&zip->hctx, sp, bytes_avail); + __archive_read_consume(a, bytes_avail); + zip->entry_bytes_remaining -= bytes_avail; + zip->entry_compressed_bytes_read += bytes_avail; + + *size = zip->stream.total_out; + zip->entry_uncompressed_bytes_read += zip->stream.total_out; + *buff = zip->uncompressed_buffer; + + if (zip->end_of_entry && zip->hctx_valid) { + r = check_authentication_code(a, NULL); + if (r != ARCHIVE_OK) + return (r); + } + + if (zip->end_of_entry && (zip->entry->zip_flags & ZIP_LENGTH_AT_END)) { + const char *p; + + if (NULL == (p = __archive_read_ahead(a, 24, NULL))) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP end-of-file record"); + return (ARCHIVE_FATAL); + } + /* Consume the optional PK\007\010 marker. */ + if (p[0] == 'P' && p[1] == 'K' && + p[2] == '\007' && p[3] == '\010') { + p += 4; + zip->unconsumed = 4; + } + if (zip->entry->flags & LA_USED_ZIP64) { + zip->entry->crc32 = archive_le32dec(p); + zip->entry->compressed_size = archive_le64dec(p + 4); + zip->entry->uncompressed_size = archive_le64dec(p + 12); + zip->unconsumed += 20; + } else { + zip->entry->crc32 = archive_le32dec(p); + zip->entry->compressed_size = archive_le32dec(p + 4); + zip->entry->uncompressed_size = archive_le32dec(p + 8); + zip->unconsumed += 12; + } + } + + return (ARCHIVE_OK); +} +#endif + +static int +read_decryption_header(struct archive_read *a) +{ + struct zip *zip = (struct zip *)(a->format->data); + const char *p; + unsigned int remaining_size; + unsigned int ts; + + /* + * Read an initialization vector data field. + */ + p = __archive_read_ahead(a, 2, NULL); + if (p == NULL) + goto truncated; + ts = zip->iv_size; + zip->iv_size = archive_le16dec(p); + __archive_read_consume(a, 2); + if (ts < zip->iv_size) { + free(zip->iv); + zip->iv = NULL; + } + p = __archive_read_ahead(a, zip->iv_size, NULL); + if (p == NULL) + goto truncated; + if (zip->iv == NULL) { + zip->iv = malloc(zip->iv_size); + if (zip->iv == NULL) + goto nomem; + } + memcpy(zip->iv, p, zip->iv_size); + __archive_read_consume(a, zip->iv_size); + + /* + * Read a size of remaining decryption header field. + */ + p = __archive_read_ahead(a, 14, NULL); + if (p == NULL) + goto truncated; + remaining_size = archive_le32dec(p); + if (remaining_size < 16 || remaining_size > (1 << 18)) + goto corrupted; + + /* Check if format version is supported. */ + if (archive_le16dec(p+4) != 3) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Unsupported encryption format version: %u", + archive_le16dec(p+4)); + return (ARCHIVE_FAILED); + } + + /* + * Read an encryption algorithm field. + */ + zip->alg_id = archive_le16dec(p+6); + switch (zip->alg_id) { + case 0x6601:/* DES */ + case 0x6602:/* RC2 */ + case 0x6603:/* 3DES 168 */ + case 0x6609:/* 3DES 112 */ + case 0x660E:/* AES 128 */ + case 0x660F:/* AES 192 */ + case 0x6610:/* AES 256 */ + case 0x6702:/* RC2 (version >= 5.2) */ + case 0x6720:/* Blowfish */ + case 0x6721:/* Twofish */ + case 0x6801:/* RC4 */ + /* Suuported encryption algorithm. */ + break; + default: + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Unknown encryption algorithm: %u", zip->alg_id); + return (ARCHIVE_FAILED); + } + + /* + * Read a bit length field. + */ + zip->bit_len = archive_le16dec(p+8); + + /* + * Read a flags field. + */ + zip->flags = archive_le16dec(p+10); + switch (zip->flags & 0xf000) { + case 0x0001: /* Password is required to decrypt. */ + case 0x0002: /* Certificates only. */ + case 0x0003: /* Password or certificate required to decrypt. */ + break; + default: + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Unknown encryption flag: %u", zip->flags); + return (ARCHIVE_FAILED); + } + if ((zip->flags & 0xf000) == 0 || + (zip->flags & 0xf000) == 0x4000) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Unknown encryption flag: %u", zip->flags); + return (ARCHIVE_FAILED); + } + + /* + * Read an encrypted random data field. + */ + ts = zip->erd_size; + zip->erd_size = archive_le16dec(p+12); + __archive_read_consume(a, 14); + if ((zip->erd_size & 0xf) != 0 || + (zip->erd_size + 16) > remaining_size || + (zip->erd_size + 16) < zip->erd_size) + goto corrupted; + + if (ts < zip->erd_size) { + free(zip->erd); + zip->erd = NULL; + } + p = __archive_read_ahead(a, zip->erd_size, NULL); + if (p == NULL) + goto truncated; + if (zip->erd == NULL) { + zip->erd = malloc(zip->erd_size); + if (zip->erd == NULL) + goto nomem; + } + memcpy(zip->erd, p, zip->erd_size); + __archive_read_consume(a, zip->erd_size); + + /* + * Read a reserved data field. + */ + p = __archive_read_ahead(a, 4, NULL); + if (p == NULL) + goto truncated; + /* Reserved data size should be zero. */ + if (archive_le32dec(p) != 0) + goto corrupted; + __archive_read_consume(a, 4); + + /* + * Read a password validation data field. + */ + p = __archive_read_ahead(a, 2, NULL); + if (p == NULL) + goto truncated; + ts = zip->v_size; + zip->v_size = archive_le16dec(p); + __archive_read_consume(a, 2); + if ((zip->v_size & 0x0f) != 0 || + (zip->erd_size + zip->v_size + 16) > remaining_size || + (zip->erd_size + zip->v_size + 16) < (zip->erd_size + zip->v_size)) + goto corrupted; + if (ts < zip->v_size) { + free(zip->v_data); + zip->v_data = NULL; + } + p = __archive_read_ahead(a, zip->v_size, NULL); + if (p == NULL) + goto truncated; + if (zip->v_data == NULL) { + zip->v_data = malloc(zip->v_size); + if (zip->v_data == NULL) + goto nomem; + } + memcpy(zip->v_data, p, zip->v_size); + __archive_read_consume(a, zip->v_size); + + p = __archive_read_ahead(a, 4, NULL); + if (p == NULL) + goto truncated; + zip->v_crc32 = archive_le32dec(p); + __archive_read_consume(a, 4); + + /*return (ARCHIVE_OK); + * This is not fully implemnted yet.*/ + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Encrypted file is unsupported"); + return (ARCHIVE_FAILED); +truncated: + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file data"); + return (ARCHIVE_FATAL); +corrupted: + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Corrupted ZIP file data"); + return (ARCHIVE_FATAL); +nomem: + archive_set_error(&a->archive, ENOMEM, + "No memory for ZIP decryption"); + return (ARCHIVE_FATAL); +} + +static int +zip_alloc_decryption_buffer(struct archive_read *a) +{ + struct zip *zip = (struct zip *)(a->format->data); + size_t bs = 256 * 1024; + + if (zip->decrypted_buffer == NULL) { + zip->decrypted_buffer_size = bs; + zip->decrypted_buffer = malloc(bs); + if (zip->decrypted_buffer == NULL) { + archive_set_error(&a->archive, ENOMEM, + "No memory for ZIP decryption"); + return (ARCHIVE_FATAL); + } + } + zip->decrypted_ptr = zip->decrypted_buffer; + return (ARCHIVE_OK); +} + +static int +init_traditional_PKWARE_decryption(struct archive_read *a) +{ + struct zip *zip = (struct zip *)(a->format->data); + const void *p; + int retry; + int r; + + if (zip->tctx_valid) + return (ARCHIVE_OK); + + /* + Read the 12 bytes encryption header stored at + the start of the data area. + */ +#define ENC_HEADER_SIZE 12 + if (0 == (zip->entry->zip_flags & ZIP_LENGTH_AT_END) + && zip->entry_bytes_remaining < ENC_HEADER_SIZE) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated Zip encrypted body: only %jd bytes available", + (intmax_t)zip->entry_bytes_remaining); + return (ARCHIVE_FATAL); + } + + p = __archive_read_ahead(a, ENC_HEADER_SIZE, NULL); + if (p == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file data"); + return (ARCHIVE_FATAL); + } + + for (retry = 0;; retry++) { + const char *passphrase; + uint8_t crcchk; + + passphrase = __archive_read_next_passphrase(a); + if (passphrase == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + (retry > 0)? + "Incorrect passphrase": + "Passphrase required for this entry"); + return (ARCHIVE_FAILED); + } + + /* + * Initialize ctx for Traditional PKWARE Decyption. + */ + r = trad_enc_init(&zip->tctx, passphrase, strlen(passphrase), + p, ENC_HEADER_SIZE, &crcchk); + if (r == 0 && crcchk == zip->entry->decdat) + break;/* The passphrase is OK. */ + if (retry > 10000) { + /* Avoid infinity loop. */ + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Too many incorrect passphrases"); + return (ARCHIVE_FAILED); + } + } + + __archive_read_consume(a, ENC_HEADER_SIZE); + zip->tctx_valid = 1; + if (0 == (zip->entry->zip_flags & ZIP_LENGTH_AT_END)) { + zip->entry_bytes_remaining -= ENC_HEADER_SIZE; + } + /*zip->entry_uncompressed_bytes_read += ENC_HEADER_SIZE;*/ + zip->entry_compressed_bytes_read += ENC_HEADER_SIZE; + zip->decrypted_bytes_remaining = 0; + + return (zip_alloc_decryption_buffer(a)); +#undef ENC_HEADER_SIZE +} + +static int +init_WinZip_AES_decryption(struct archive_read *a) +{ + struct zip *zip = (struct zip *)(a->format->data); + const void *p; + const uint8_t *pv; + size_t key_len, salt_len; + uint8_t derived_key[MAX_DERIVED_KEY_BUF_SIZE]; + int retry; + int r; + + if (zip->cctx_valid || zip->hctx_valid) + return (ARCHIVE_OK); + + switch (zip->entry->aes_extra.strength) { + case 1: salt_len = 8; key_len = 16; break; + case 2: salt_len = 12; key_len = 24; break; + case 3: salt_len = 16; key_len = 32; break; + default: goto corrupted; + } + p = __archive_read_ahead(a, salt_len + 2, NULL); + if (p == NULL) + goto truncated; + + for (retry = 0;; retry++) { + const char *passphrase; + + passphrase = __archive_read_next_passphrase(a); + if (passphrase == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + (retry > 0)? + "Incorrect passphrase": + "Passphrase required for this entry"); + return (ARCHIVE_FAILED); + } + memset(derived_key, 0, sizeof(derived_key)); + r = archive_pbkdf2_sha1(passphrase, strlen(passphrase), + p, salt_len, 1000, derived_key, key_len * 2 + 2); + if (r != 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Decryption is unsupported due to lack of " + "crypto library"); + return (ARCHIVE_FAILED); + } + + /* Check password verification value. */ + pv = ((const uint8_t *)p) + salt_len; + if (derived_key[key_len * 2] == pv[0] && + derived_key[key_len * 2 + 1] == pv[1]) + break;/* The passphrase is OK. */ + if (retry > 10000) { + /* Avoid infinity loop. */ + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Too many incorrect passphrases"); + return (ARCHIVE_FAILED); + } + } + + r = archive_decrypto_aes_ctr_init(&zip->cctx, derived_key, key_len); + if (r != 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Decryption is unsupported due to lack of crypto library"); + return (ARCHIVE_FAILED); + } + r = archive_hmac_sha1_init(&zip->hctx, derived_key + key_len, key_len); + if (r != 0) { + archive_decrypto_aes_ctr_release(&zip->cctx); + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Failed to initialize HMAC-SHA1"); + return (ARCHIVE_FAILED); + } + zip->cctx_valid = zip->hctx_valid = 1; + __archive_read_consume(a, salt_len + 2); + zip->entry_bytes_remaining -= salt_len + 2 + AUTH_CODE_SIZE; + if (0 == (zip->entry->zip_flags & ZIP_LENGTH_AT_END) + && zip->entry_bytes_remaining < 0) + goto corrupted; + zip->entry_compressed_bytes_read += salt_len + 2 + AUTH_CODE_SIZE; + zip->decrypted_bytes_remaining = 0; + + zip->entry->compression = zip->entry->aes_extra.compression; + return (zip_alloc_decryption_buffer(a)); + +truncated: + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file data"); + return (ARCHIVE_FATAL); +corrupted: + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Corrupted ZIP file data"); + return (ARCHIVE_FATAL); +} + +static int +archive_read_format_zip_read_data(struct archive_read *a, + const void **buff, size_t *size, int64_t *offset) +{ + int r; + struct zip *zip = (struct zip *)(a->format->data); + + if (zip->has_encrypted_entries == + ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) { + zip->has_encrypted_entries = 0; + } + + *offset = zip->entry_uncompressed_bytes_read; + *size = 0; + *buff = NULL; + + /* If we hit end-of-entry last time, return ARCHIVE_EOF. */ + if (zip->end_of_entry) + return (ARCHIVE_EOF); + + /* Return EOF immediately if this is a non-regular file. */ + if (AE_IFREG != (zip->entry->mode & AE_IFMT)) + return (ARCHIVE_EOF); + + __archive_read_consume(a, zip->unconsumed); + zip->unconsumed = 0; + + if (zip->init_decryption) { + zip->has_encrypted_entries = 1; + if (zip->entry->zip_flags & ZIP_STRONG_ENCRYPTED) + r = read_decryption_header(a); + else if (zip->entry->compression == WINZIP_AES_ENCRYPTION) + r = init_WinZip_AES_decryption(a); + else + r = init_traditional_PKWARE_decryption(a); + if (r != ARCHIVE_OK) + return (r); + zip->init_decryption = 0; + } + + switch(zip->entry->compression) { + case 0: /* No compression. */ + r = zip_read_data_none(a, buff, size, offset); + break; +#ifdef HAVE_ZLIB_H + case 8: /* Deflate compression. */ + r = zip_read_data_deflate(a, buff, size, offset); + break; +#endif + default: /* Unsupported compression. */ + /* Return a warning. */ + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Unsupported ZIP compression method (%s)", + compression_name(zip->entry->compression)); + /* We can't decompress this entry, but we will + * be able to skip() it and try the next entry. */ + return (ARCHIVE_FAILED); + break; + } + if (r != ARCHIVE_OK) + return (r); + /* Update checksum */ + if (*size) + zip->entry_crc32 = zip->crc32func(zip->entry_crc32, *buff, + (unsigned)*size); + /* If we hit the end, swallow any end-of-data marker. */ + if (zip->end_of_entry) { + /* Check file size, CRC against these values. */ + if (zip->entry->compressed_size != + zip->entry_compressed_bytes_read) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "ZIP compressed data is wrong size " + "(read %jd, expected %jd)", + (intmax_t)zip->entry_compressed_bytes_read, + (intmax_t)zip->entry->compressed_size); + return (ARCHIVE_WARN); + } + /* Size field only stores the lower 32 bits of the actual + * size. */ + if ((zip->entry->uncompressed_size & UINT32_MAX) + != (zip->entry_uncompressed_bytes_read & UINT32_MAX)) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "ZIP uncompressed data is wrong size " + "(read %jd, expected %jd)\n", + (intmax_t)zip->entry_uncompressed_bytes_read, + (intmax_t)zip->entry->uncompressed_size); + return (ARCHIVE_WARN); + } + /* Check computed CRC against header */ + if ((!zip->hctx_valid || + zip->entry->aes_extra.vendor != AES_VENDOR_AE_2) && + zip->entry->crc32 != zip->entry_crc32 + && !zip->ignore_crc32) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "ZIP bad CRC: 0x%lx should be 0x%lx", + (unsigned long)zip->entry_crc32, + (unsigned long)zip->entry->crc32); + return (ARCHIVE_WARN); + } + } + + return (ARCHIVE_OK); +} + +static int +archive_read_format_zip_cleanup(struct archive_read *a) +{ + struct zip *zip; + struct zip_entry *zip_entry, *next_zip_entry; + + zip = (struct zip *)(a->format->data); +#ifdef HAVE_ZLIB_H + if (zip->stream_valid) + inflateEnd(&zip->stream); + free(zip->uncompressed_buffer); +#endif + if (zip->zip_entries) { + zip_entry = zip->zip_entries; + while (zip_entry != NULL) { + next_zip_entry = zip_entry->next; + archive_string_free(&zip_entry->rsrcname); + free(zip_entry); + zip_entry = next_zip_entry; + } + } + free(zip->decrypted_buffer); + if (zip->cctx_valid) + archive_decrypto_aes_ctr_release(&zip->cctx); + if (zip->hctx_valid) + archive_hmac_sha1_cleanup(&zip->hctx); + free(zip->iv); + free(zip->erd); + free(zip->v_data); + archive_string_free(&zip->format_name); + free(zip); + (a->format->data) = NULL; + return (ARCHIVE_OK); +} + +static int +archive_read_format_zip_has_encrypted_entries(struct archive_read *_a) +{ + if (_a && _a->format) { + struct zip * zip = (struct zip *)_a->format->data; + if (zip) { + return zip->has_encrypted_entries; + } + } + return ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW; +} + +static int +archive_read_format_zip_options(struct archive_read *a, + const char *key, const char *val) +{ + struct zip *zip; + int ret = ARCHIVE_FAILED; + + zip = (struct zip *)(a->format->data); + if (strcmp(key, "compat-2x") == 0) { + /* Handle filenames as libarchive 2.x */ + zip->init_default_conversion = (val != NULL) ? 1 : 0; + return (ARCHIVE_OK); + } else if (strcmp(key, "hdrcharset") == 0) { + if (val == NULL || val[0] == 0) + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "zip: hdrcharset option needs a character-set name" + ); + else { + zip->sconv = archive_string_conversion_from_charset( + &a->archive, val, 0); + if (zip->sconv != NULL) { + if (strcmp(val, "UTF-8") == 0) + zip->sconv_utf8 = zip->sconv; + ret = ARCHIVE_OK; + } else + ret = ARCHIVE_FATAL; + } + return (ret); + } else if (strcmp(key, "ignorecrc32") == 0) { + /* Mostly useful for testing. */ + if (val == NULL || val[0] == 0) { + zip->crc32func = real_crc32; + zip->ignore_crc32 = 0; + } else { + zip->crc32func = fake_crc32; + zip->ignore_crc32 = 1; + } + return (ARCHIVE_OK); + } else if (strcmp(key, "mac-ext") == 0) { + zip->process_mac_extensions = (val != NULL && val[0] != 0); + return (ARCHIVE_OK); + } + + /* Note: The "warn" return is just to inform the options + * supervisor that we didn't handle it. It will generate + * a suitable error if no one used this option. */ + return (ARCHIVE_WARN); +} + +int +archive_read_support_format_zip(struct archive *a) +{ + int r; + r = archive_read_support_format_zip_streamable(a); + if (r != ARCHIVE_OK) + return r; + return (archive_read_support_format_zip_seekable(a)); +} + +/* ------------------------------------------------------------------------ */ + +/* + * Streaming-mode support + */ + + +static int +archive_read_support_format_zip_capabilities_streamable(struct archive_read * a) +{ + (void)a; /* UNUSED */ + return (ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA | + ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA); +} + +static int +archive_read_format_zip_streamable_bid(struct archive_read *a, int best_bid) +{ + const char *p; + + (void)best_bid; /* UNUSED */ + + if ((p = __archive_read_ahead(a, 4, NULL)) == NULL) + return (-1); + + /* + * Bid of 29 here comes from: + * + 16 bits for "PK", + * + next 16-bit field has 6 options so contributes + * about 16 - log_2(6) ~= 16 - 2.6 ~= 13 bits + * + * So we've effectively verified ~29 total bits of check data. + */ + if (p[0] == 'P' && p[1] == 'K') { + if ((p[2] == '\001' && p[3] == '\002') + || (p[2] == '\003' && p[3] == '\004') + || (p[2] == '\005' && p[3] == '\006') + || (p[2] == '\006' && p[3] == '\006') + || (p[2] == '\007' && p[3] == '\010') + || (p[2] == '0' && p[3] == '0')) + return (29); + } + + /* TODO: It's worth looking ahead a little bit for a valid + * PK signature. In particular, that would make it possible + * to read some UUEncoded SFX files or SFX files coming from + * a network socket. */ + + return (0); +} + +static int +archive_read_format_zip_streamable_read_header(struct archive_read *a, + struct archive_entry *entry) +{ + struct zip *zip; + + a->archive.archive_format = ARCHIVE_FORMAT_ZIP; + if (a->archive.archive_format_name == NULL) + a->archive.archive_format_name = "ZIP"; + + zip = (struct zip *)(a->format->data); + + /* + * It should be sufficient to call archive_read_next_header() for + * a reader to determine if an entry is encrypted or not. If the + * encryption of an entry is only detectable when calling + * archive_read_data(), so be it. We'll do the same check there + * as well. + */ + if (zip->has_encrypted_entries == + ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) + zip->has_encrypted_entries = 0; + + /* Make sure we have a zip_entry structure to use. */ + if (zip->zip_entries == NULL) { + zip->zip_entries = malloc(sizeof(struct zip_entry)); + if (zip->zip_entries == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Out of memory"); + return ARCHIVE_FATAL; + } + } + zip->entry = zip->zip_entries; + memset(zip->entry, 0, sizeof(struct zip_entry)); + + if (zip->cctx_valid) + archive_decrypto_aes_ctr_release(&zip->cctx); + if (zip->hctx_valid) + archive_hmac_sha1_cleanup(&zip->hctx); + zip->tctx_valid = zip->cctx_valid = zip->hctx_valid = 0; + __archive_read_reset_passphrase(a); + + /* Search ahead for the next local file header. */ + __archive_read_consume(a, zip->unconsumed); + zip->unconsumed = 0; + for (;;) { + int64_t skipped = 0; + const char *p, *end; + ssize_t bytes; + + p = __archive_read_ahead(a, 4, &bytes); + if (p == NULL) + return (ARCHIVE_FATAL); + end = p + bytes; + + while (p + 4 <= end) { + if (p[0] == 'P' && p[1] == 'K') { + if (p[2] == '\003' && p[3] == '\004') { + /* Regular file entry. */ + __archive_read_consume(a, skipped); + return zip_read_local_file_header(a, + entry, zip); + } + + /* + * TODO: We cannot restore permissions + * based only on the local file headers. + * Consider scanning the central + * directory and returning additional + * entries for at least directories. + * This would allow us to properly set + * directory permissions. + * + * This won't help us fix symlinks + * and may not help with regular file + * permissions, either. + */ + if (p[2] == '\001' && p[3] == '\002') { + return (ARCHIVE_EOF); + } + + /* End of central directory? Must be an + * empty archive. */ + if ((p[2] == '\005' && p[3] == '\006') + || (p[2] == '\006' && p[3] == '\006')) + return (ARCHIVE_EOF); + } + ++p; + ++skipped; + } + __archive_read_consume(a, skipped); + } +} + +static int +archive_read_format_zip_read_data_skip_streamable(struct archive_read *a) +{ + struct zip *zip; + int64_t bytes_skipped; + + zip = (struct zip *)(a->format->data); + bytes_skipped = __archive_read_consume(a, zip->unconsumed); + zip->unconsumed = 0; + if (bytes_skipped < 0) + return (ARCHIVE_FATAL); + + /* If we've already read to end of data, we're done. */ + if (zip->end_of_entry) + return (ARCHIVE_OK); + + /* So we know we're streaming... */ + if (0 == (zip->entry->zip_flags & ZIP_LENGTH_AT_END) + || zip->entry->compressed_size > 0) { + /* We know the compressed length, so we can just skip. */ + bytes_skipped = __archive_read_consume(a, + zip->entry_bytes_remaining); + if (bytes_skipped < 0) + return (ARCHIVE_FATAL); + return (ARCHIVE_OK); + } + + if (zip->init_decryption) { + int r; + + zip->has_encrypted_entries = 1; + if (zip->entry->zip_flags & ZIP_STRONG_ENCRYPTED) + r = read_decryption_header(a); + else if (zip->entry->compression == WINZIP_AES_ENCRYPTION) + r = init_WinZip_AES_decryption(a); + else + r = init_traditional_PKWARE_decryption(a); + if (r != ARCHIVE_OK) + return (r); + zip->init_decryption = 0; + } + + /* We're streaming and we don't know the length. */ + /* If the body is compressed and we know the format, we can + * find an exact end-of-entry by decompressing it. */ + switch (zip->entry->compression) { +#ifdef HAVE_ZLIB_H + case 8: /* Deflate compression. */ + while (!zip->end_of_entry) { + int64_t offset = 0; + const void *buff = NULL; + size_t size = 0; + int r; + r = zip_read_data_deflate(a, &buff, &size, &offset); + if (r != ARCHIVE_OK) + return (r); + } + return ARCHIVE_OK; +#endif + default: /* Uncompressed or unknown. */ + /* Scan for a PK\007\010 signature. */ + for (;;) { + const char *p, *buff; + ssize_t bytes_avail; + buff = __archive_read_ahead(a, 16, &bytes_avail); + if (bytes_avail < 16) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file data"); + return (ARCHIVE_FATAL); + } + p = buff; + while (p <= buff + bytes_avail - 16) { + if (p[3] == 'P') { p += 3; } + else if (p[3] == 'K') { p += 2; } + else if (p[3] == '\007') { p += 1; } + else if (p[3] == '\010' && p[2] == '\007' + && p[1] == 'K' && p[0] == 'P') { + if (zip->entry->flags & LA_USED_ZIP64) + __archive_read_consume(a, + p - buff + 24); + else + __archive_read_consume(a, + p - buff + 16); + return ARCHIVE_OK; + } else { p += 4; } + } + __archive_read_consume(a, p - buff); + } + } +} + +int +archive_read_support_format_zip_streamable(struct archive *_a) +{ + struct archive_read *a = (struct archive_read *)_a; + struct zip *zip; + int r; + + archive_check_magic(_a, ARCHIVE_READ_MAGIC, + ARCHIVE_STATE_NEW, "archive_read_support_format_zip"); + + zip = (struct zip *)calloc(1, sizeof(*zip)); + if (zip == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate zip data"); + return (ARCHIVE_FATAL); + } + + /* Streamable reader doesn't support mac extensions. */ + zip->process_mac_extensions = 0; + + /* + * Until enough data has been read, we cannot tell about + * any encrypted entries yet. + */ + zip->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW; + zip->crc32func = real_crc32; + + r = __archive_read_register_format(a, + zip, + "zip", + archive_read_format_zip_streamable_bid, + archive_read_format_zip_options, + archive_read_format_zip_streamable_read_header, + archive_read_format_zip_read_data, + archive_read_format_zip_read_data_skip_streamable, + NULL, + archive_read_format_zip_cleanup, + archive_read_support_format_zip_capabilities_streamable, + archive_read_format_zip_has_encrypted_entries); + + if (r != ARCHIVE_OK) + free(zip); + return (ARCHIVE_OK); +} + +/* ------------------------------------------------------------------------ */ + +/* + * Seeking-mode support + */ + +static int +archive_read_support_format_zip_capabilities_seekable(struct archive_read * a) +{ + (void)a; /* UNUSED */ + return (ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_DATA | + ARCHIVE_READ_FORMAT_CAPS_ENCRYPT_METADATA); +} + +/* + * TODO: This is a performance sink because it forces the read core to + * drop buffered data from the start of file, which will then have to + * be re-read again if this bidder loses. + * + * We workaround this a little by passing in the best bid so far so + * that later bidders can do nothing if they know they'll never + * outbid. But we can certainly do better... + */ +static int +read_eocd(struct zip *zip, const char *p, int64_t current_offset) +{ + /* Sanity-check the EOCD we've found. */ + + /* This must be the first volume. */ + if (archive_le16dec(p + 4) != 0) + return 0; + /* Central directory must be on this volume. */ + if (archive_le16dec(p + 4) != archive_le16dec(p + 6)) + return 0; + /* All central directory entries must be on this volume. */ + if (archive_le16dec(p + 10) != archive_le16dec(p + 8)) + return 0; + /* Central directory can't extend beyond start of EOCD record. */ + if (archive_le32dec(p + 16) + archive_le32dec(p + 12) + > current_offset) + return 0; + + /* Save the central directory location for later use. */ + zip->central_directory_offset = archive_le32dec(p + 16); + + /* This is just a tiny bit higher than the maximum + returned by the streaming Zip bidder. This ensures + that the more accurate seeking Zip parser wins + whenever seek is available. */ + return 32; +} + +/* + * Examine Zip64 EOCD locator: If it's valid, store the information + * from it. + */ +static void +read_zip64_eocd(struct archive_read *a, struct zip *zip, const char *p) +{ + int64_t eocd64_offset; + int64_t eocd64_size; + + /* Sanity-check the locator record. */ + + /* Central dir must be on first volume. */ + if (archive_le32dec(p + 4) != 0) + return; + /* Must be only a single volume. */ + if (archive_le32dec(p + 16) != 1) + return; + + /* Find the Zip64 EOCD record. */ + eocd64_offset = archive_le64dec(p + 8); + if (__archive_read_seek(a, eocd64_offset, SEEK_SET) < 0) + return; + if ((p = __archive_read_ahead(a, 56, NULL)) == NULL) + return; + /* Make sure we can read all of it. */ + eocd64_size = archive_le64dec(p + 4) + 12; + if (eocd64_size < 56 || eocd64_size > 16384) + return; + if ((p = __archive_read_ahead(a, (size_t)eocd64_size, NULL)) == NULL) + return; + + /* Sanity-check the EOCD64 */ + if (archive_le32dec(p + 16) != 0) /* Must be disk #0 */ + return; + if (archive_le32dec(p + 20) != 0) /* CD must be on disk #0 */ + return; + /* CD can't be split. */ + if (archive_le64dec(p + 24) != archive_le64dec(p + 32)) + return; + + /* Save the central directory offset for later use. */ + zip->central_directory_offset = archive_le64dec(p + 48); +} + +static int +archive_read_format_zip_seekable_bid(struct archive_read *a, int best_bid) +{ + struct zip *zip = (struct zip *)a->format->data; + int64_t file_size, current_offset; + const char *p; + int i, tail; + + /* If someone has already bid more than 32, then avoid + trashing the look-ahead buffers with a seek. */ + if (best_bid > 32) + return (-1); + + file_size = __archive_read_seek(a, 0, SEEK_END); + if (file_size <= 0) + return 0; + + /* Search last 16k of file for end-of-central-directory + * record (which starts with PK\005\006) */ + tail = (int)zipmin(1024 * 16, file_size); + current_offset = __archive_read_seek(a, -tail, SEEK_END); + if (current_offset < 0) + return 0; + if ((p = __archive_read_ahead(a, (size_t)tail, NULL)) == NULL) + return 0; + /* Boyer-Moore search backwards from the end, since we want + * to match the last EOCD in the file (there can be more than + * one if there is an uncompressed Zip archive as a member + * within this Zip archive). */ + for (i = tail - 22; i > 0;) { + switch (p[i]) { + case 'P': + if (memcmp(p + i, "PK\005\006", 4) == 0) { + int ret = read_eocd(zip, p + i, + current_offset + i); + if (ret > 0) { + /* Zip64 EOCD locator precedes + * regular EOCD if present. */ + if (i >= 20 + && memcmp(p + i - 20, "PK\006\007", 4) == 0) { + read_zip64_eocd(a, zip, p + i - 20); + } + return (ret); + } + } + i -= 4; + break; + case 'K': i -= 1; break; + case 005: i -= 2; break; + case 006: i -= 3; break; + default: i -= 4; break; + } + } + return 0; +} + +/* The red-black trees are only used in seeking mode to manage + * the in-memory copy of the central directory. */ + +static int +cmp_node(const struct archive_rb_node *n1, const struct archive_rb_node *n2) +{ + const struct zip_entry *e1 = (const struct zip_entry *)n1; + const struct zip_entry *e2 = (const struct zip_entry *)n2; + + if (e1->local_header_offset > e2->local_header_offset) + return -1; + if (e1->local_header_offset < e2->local_header_offset) + return 1; + return 0; +} + +static int +cmp_key(const struct archive_rb_node *n, const void *key) +{ + /* This function won't be called */ + (void)n; /* UNUSED */ + (void)key; /* UNUSED */ + return 1; +} + +static const struct archive_rb_tree_ops rb_ops = { + &cmp_node, &cmp_key +}; + +static int +rsrc_cmp_node(const struct archive_rb_node *n1, + const struct archive_rb_node *n2) +{ + const struct zip_entry *e1 = (const struct zip_entry *)n1; + const struct zip_entry *e2 = (const struct zip_entry *)n2; + + return (strcmp(e2->rsrcname.s, e1->rsrcname.s)); +} + +static int +rsrc_cmp_key(const struct archive_rb_node *n, const void *key) +{ + const struct zip_entry *e = (const struct zip_entry *)n; + return (strcmp((const char *)key, e->rsrcname.s)); +} + +static const struct archive_rb_tree_ops rb_rsrc_ops = { + &rsrc_cmp_node, &rsrc_cmp_key +}; + +static const char * +rsrc_basename(const char *name, size_t name_length) +{ + const char *s, *r; + + r = s = name; + for (;;) { + s = memchr(s, '/', name_length - (s - name)); + if (s == NULL) + break; + r = ++s; + } + return (r); +} + +static void +expose_parent_dirs(struct zip *zip, const char *name, size_t name_length) +{ + struct archive_string str; + struct zip_entry *dir; + char *s; + + archive_string_init(&str); + archive_strncpy(&str, name, name_length); + for (;;) { + s = strrchr(str.s, '/'); + if (s == NULL) + break; + *s = '\0'; + /* Transfer the parent directory from zip->tree_rsrc RB + * tree to zip->tree RB tree to expose. */ + dir = (struct zip_entry *) + __archive_rb_tree_find_node(&zip->tree_rsrc, str.s); + if (dir == NULL) + break; + __archive_rb_tree_remove_node(&zip->tree_rsrc, &dir->node); + archive_string_free(&dir->rsrcname); + __archive_rb_tree_insert_node(&zip->tree, &dir->node); + } + archive_string_free(&str); +} + +static int +slurp_central_directory(struct archive_read *a, struct zip *zip) +{ + ssize_t i; + unsigned found; + int64_t correction; + ssize_t bytes_avail; + const char *p; + + /* + * Find the start of the central directory. The end-of-CD + * record has our starting point, but there are lots of + * Zip archives which have had other data prepended to the + * file, which makes the recorded offsets all too small. + * So we search forward from the specified offset until we + * find the real start of the central directory. Then we + * know the correction we need to apply to account for leading + * padding. + */ + if (__archive_read_seek(a, zip->central_directory_offset, SEEK_SET) < 0) + return ARCHIVE_FATAL; + + found = 0; + while (!found) { + if ((p = __archive_read_ahead(a, 20, &bytes_avail)) == NULL) + return ARCHIVE_FATAL; + for (found = 0, i = 0; !found && i < bytes_avail - 4;) { + switch (p[i + 3]) { + case 'P': i += 3; break; + case 'K': i += 2; break; + case 001: i += 1; break; + case 002: + if (memcmp(p + i, "PK\001\002", 4) == 0) { + p += i; + found = 1; + } else + i += 4; + break; + case 005: i += 1; break; + case 006: + if (memcmp(p + i, "PK\005\006", 4) == 0) { + p += i; + found = 1; + } else if (memcmp(p + i, "PK\006\006", 4) == 0) { + p += i; + found = 1; + } else + i += 1; + break; + default: i += 4; break; + } + } + __archive_read_consume(a, i); + } + correction = archive_filter_bytes(&a->archive, 0) + - zip->central_directory_offset; + + __archive_rb_tree_init(&zip->tree, &rb_ops); + __archive_rb_tree_init(&zip->tree_rsrc, &rb_rsrc_ops); + + zip->central_directory_entries_total = 0; + while (1) { + struct zip_entry *zip_entry; + size_t filename_length, extra_length, comment_length; + uint32_t external_attributes; + const char *name, *r; + + if ((p = __archive_read_ahead(a, 4, NULL)) == NULL) + return ARCHIVE_FATAL; + if (memcmp(p, "PK\006\006", 4) == 0 + || memcmp(p, "PK\005\006", 4) == 0) { + break; + } else if (memcmp(p, "PK\001\002", 4) != 0) { + archive_set_error(&a->archive, + -1, "Invalid central directory signature"); + return ARCHIVE_FATAL; + } + if ((p = __archive_read_ahead(a, 46, NULL)) == NULL) + return ARCHIVE_FATAL; + + zip_entry = calloc(1, sizeof(struct zip_entry)); + zip_entry->next = zip->zip_entries; + zip_entry->flags |= LA_FROM_CENTRAL_DIRECTORY; + zip->zip_entries = zip_entry; + zip->central_directory_entries_total++; + + /* version = p[4]; */ + zip_entry->system = p[5]; + /* version_required = archive_le16dec(p + 6); */ + zip_entry->zip_flags = archive_le16dec(p + 8); + if (zip_entry->zip_flags + & (ZIP_ENCRYPTED | ZIP_STRONG_ENCRYPTED)){ + zip->has_encrypted_entries = 1; + } + zip_entry->compression = (char)archive_le16dec(p + 10); + zip_entry->mtime = zip_time(p + 12); + zip_entry->crc32 = archive_le32dec(p + 16); + if (zip_entry->zip_flags & ZIP_LENGTH_AT_END) + zip_entry->decdat = p[13]; + else + zip_entry->decdat = p[19]; + zip_entry->compressed_size = archive_le32dec(p + 20); + zip_entry->uncompressed_size = archive_le32dec(p + 24); + filename_length = archive_le16dec(p + 28); + extra_length = archive_le16dec(p + 30); + comment_length = archive_le16dec(p + 32); + /* disk_start = archive_le16dec(p + 34); */ /* Better be zero. */ + /* internal_attributes = archive_le16dec(p + 36); */ /* text bit */ + external_attributes = archive_le32dec(p + 38); + zip_entry->local_header_offset = + archive_le32dec(p + 42) + correction; + + /* If we can't guess the mode, leave it zero here; + when we read the local file header we might get + more information. */ + if (zip_entry->system == 3) { + zip_entry->mode = external_attributes >> 16; + } else if (zip_entry->system == 0) { + // Interpret MSDOS directory bit + if (0x10 == (external_attributes & 0x10)) { + zip_entry->mode = AE_IFDIR | 0775; + } else { + zip_entry->mode = AE_IFREG | 0664; + } + if (0x01 == (external_attributes & 0x01)) { + // Read-only bit; strip write permissions + zip_entry->mode &= 0555; + } + } else { + zip_entry->mode = 0; + } + + /* We're done with the regular data; get the filename and + * extra data. */ + __archive_read_consume(a, 46); + p = __archive_read_ahead(a, filename_length + extra_length, + NULL); + if (p == NULL) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file header"); + return ARCHIVE_FATAL; + } + process_extra(p + filename_length, extra_length, zip_entry); + + /* + * Mac resource fork files are stored under the + * "__MACOSX/" directory, so we should check if + * it is. + */ + if (!zip->process_mac_extensions) { + /* Treat every entry as a regular entry. */ + __archive_rb_tree_insert_node(&zip->tree, + &zip_entry->node); + } else { + name = p; + r = rsrc_basename(name, filename_length); + if (filename_length >= 9 && + strncmp("__MACOSX/", name, 9) == 0) { + /* If this file is not a resource fork nor + * a directory. We should treat it as a non + * resource fork file to expose it. */ + if (name[filename_length-1] != '/' && + (r - name < 3 || r[0] != '.' || r[1] != '_')) { + __archive_rb_tree_insert_node( + &zip->tree, &zip_entry->node); + /* Expose its parent directories. */ + expose_parent_dirs(zip, name, + filename_length); + } else { + /* This file is a resource fork file or + * a directory. */ + archive_strncpy(&(zip_entry->rsrcname), + name, filename_length); + __archive_rb_tree_insert_node( + &zip->tree_rsrc, &zip_entry->node); + } + } else { + /* Generate resource fork name to find its + * resource file at zip->tree_rsrc. */ + archive_strcpy(&(zip_entry->rsrcname), + "__MACOSX/"); + archive_strncat(&(zip_entry->rsrcname), + name, r - name); + archive_strcat(&(zip_entry->rsrcname), "._"); + archive_strncat(&(zip_entry->rsrcname), + name + (r - name), + filename_length - (r - name)); + /* Register an entry to RB tree to sort it by + * file offset. */ + __archive_rb_tree_insert_node(&zip->tree, + &zip_entry->node); + } + } + + /* Skip the comment too ... */ + __archive_read_consume(a, + filename_length + extra_length + comment_length); + } + + return ARCHIVE_OK; +} + +static ssize_t +zip_get_local_file_header_size(struct archive_read *a, size_t extra) +{ + const char *p; + ssize_t filename_length, extra_length; + + if ((p = __archive_read_ahead(a, extra + 30, NULL)) == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file header"); + return (ARCHIVE_WARN); + } + p += extra; + + if (memcmp(p, "PK\003\004", 4) != 0) { + archive_set_error(&a->archive, -1, "Damaged Zip archive"); + return ARCHIVE_WARN; + } + filename_length = archive_le16dec(p + 26); + extra_length = archive_le16dec(p + 28); + + return (30 + filename_length + extra_length); +} + +static int +zip_read_mac_metadata(struct archive_read *a, struct archive_entry *entry, + struct zip_entry *rsrc) +{ + struct zip *zip = (struct zip *)a->format->data; + unsigned char *metadata, *mp; + int64_t offset = archive_filter_bytes(&a->archive, 0); + size_t remaining_bytes, metadata_bytes; + ssize_t hsize; + int ret = ARCHIVE_OK, eof; + + switch(rsrc->compression) { + case 0: /* No compression. */ + if (rsrc->uncompressed_size != rsrc->compressed_size) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Malformed OS X metadata entry: inconsistent size"); + return (ARCHIVE_FATAL); + } +#ifdef HAVE_ZLIB_H + case 8: /* Deflate compression. */ +#endif + break; + default: /* Unsupported compression. */ + /* Return a warning. */ + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Unsupported ZIP compression method (%s)", + compression_name(rsrc->compression)); + /* We can't decompress this entry, but we will + * be able to skip() it and try the next entry. */ + return (ARCHIVE_WARN); + } + + if (rsrc->uncompressed_size > (4 * 1024 * 1024)) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Mac metadata is too large: %jd > 4M bytes", + (intmax_t)rsrc->uncompressed_size); + return (ARCHIVE_WARN); + } + if (rsrc->compressed_size > (4 * 1024 * 1024)) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "Mac metadata is too large: %jd > 4M bytes", + (intmax_t)rsrc->compressed_size); + return (ARCHIVE_WARN); + } + + metadata = malloc((size_t)rsrc->uncompressed_size); + if (metadata == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate memory for Mac metadata"); + return (ARCHIVE_FATAL); + } + + if (offset < rsrc->local_header_offset) + __archive_read_consume(a, rsrc->local_header_offset - offset); + else if (offset != rsrc->local_header_offset) { + __archive_read_seek(a, rsrc->local_header_offset, SEEK_SET); + } + + hsize = zip_get_local_file_header_size(a, 0); + __archive_read_consume(a, hsize); + + remaining_bytes = (size_t)rsrc->compressed_size; + metadata_bytes = (size_t)rsrc->uncompressed_size; + mp = metadata; + eof = 0; + while (!eof && remaining_bytes) { + const unsigned char *p; + ssize_t bytes_avail; + size_t bytes_used; + + p = __archive_read_ahead(a, 1, &bytes_avail); + if (p == NULL) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "Truncated ZIP file header"); + ret = ARCHIVE_WARN; + goto exit_mac_metadata; + } + if ((size_t)bytes_avail > remaining_bytes) + bytes_avail = remaining_bytes; + switch(rsrc->compression) { + case 0: /* No compression. */ + if ((size_t)bytes_avail > metadata_bytes) + bytes_avail = metadata_bytes; + memcpy(mp, p, bytes_avail); + bytes_used = (size_t)bytes_avail; + metadata_bytes -= bytes_used; + mp += bytes_used; + if (metadata_bytes == 0) + eof = 1; + break; +#ifdef HAVE_ZLIB_H + case 8: /* Deflate compression. */ + { + int r; + + ret = zip_deflate_init(a, zip); + if (ret != ARCHIVE_OK) + goto exit_mac_metadata; + zip->stream.next_in = + (Bytef *)(uintptr_t)(const void *)p; + zip->stream.avail_in = (uInt)bytes_avail; + zip->stream.total_in = 0; + zip->stream.next_out = mp; + zip->stream.avail_out = (uInt)metadata_bytes; + zip->stream.total_out = 0; + + r = inflate(&zip->stream, 0); + switch (r) { + case Z_OK: + break; + case Z_STREAM_END: + eof = 1; + break; + case Z_MEM_ERROR: + archive_set_error(&a->archive, ENOMEM, + "Out of memory for ZIP decompression"); + ret = ARCHIVE_FATAL; + goto exit_mac_metadata; + default: + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "ZIP decompression failed (%d)", r); + ret = ARCHIVE_FATAL; + goto exit_mac_metadata; + } + bytes_used = zip->stream.total_in; + metadata_bytes -= zip->stream.total_out; + mp += zip->stream.total_out; + break; + } +#endif + default: + bytes_used = 0; + break; + } + __archive_read_consume(a, bytes_used); + remaining_bytes -= bytes_used; + } + archive_entry_copy_mac_metadata(entry, metadata, + (size_t)rsrc->uncompressed_size - metadata_bytes); + +exit_mac_metadata: + __archive_read_seek(a, offset, SEEK_SET); + zip->decompress_init = 0; + free(metadata); + return (ret); +} + +static int +archive_read_format_zip_seekable_read_header(struct archive_read *a, + struct archive_entry *entry) +{ + struct zip *zip = (struct zip *)a->format->data; + struct zip_entry *rsrc; + int64_t offset; + int r, ret = ARCHIVE_OK; + + /* + * It should be sufficient to call archive_read_next_header() for + * a reader to determine if an entry is encrypted or not. If the + * encryption of an entry is only detectable when calling + * archive_read_data(), so be it. We'll do the same check there + * as well. + */ + if (zip->has_encrypted_entries == + ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW) + zip->has_encrypted_entries = 0; + + a->archive.archive_format = ARCHIVE_FORMAT_ZIP; + if (a->archive.archive_format_name == NULL) + a->archive.archive_format_name = "ZIP"; + + if (zip->zip_entries == NULL) { + r = slurp_central_directory(a, zip); + if (r != ARCHIVE_OK) + return r; + /* Get first entry whose local header offset is lower than + * other entries in the archive file. */ + zip->entry = + (struct zip_entry *)ARCHIVE_RB_TREE_MIN(&zip->tree); + } else if (zip->entry != NULL) { + /* Get next entry in local header offset order. */ + zip->entry = (struct zip_entry *)__archive_rb_tree_iterate( + &zip->tree, &zip->entry->node, ARCHIVE_RB_DIR_RIGHT); + } + + if (zip->entry == NULL) + return ARCHIVE_EOF; + + if (zip->entry->rsrcname.s) + rsrc = (struct zip_entry *)__archive_rb_tree_find_node( + &zip->tree_rsrc, zip->entry->rsrcname.s); + else + rsrc = NULL; + + if (zip->cctx_valid) + archive_decrypto_aes_ctr_release(&zip->cctx); + if (zip->hctx_valid) + archive_hmac_sha1_cleanup(&zip->hctx); + zip->tctx_valid = zip->cctx_valid = zip->hctx_valid = 0; + __archive_read_reset_passphrase(a); + + /* File entries are sorted by the header offset, we should mostly + * use __archive_read_consume to advance a read point to avoid redundant + * data reading. */ + offset = archive_filter_bytes(&a->archive, 0); + if (offset < zip->entry->local_header_offset) + __archive_read_consume(a, + zip->entry->local_header_offset - offset); + else if (offset != zip->entry->local_header_offset) { + __archive_read_seek(a, zip->entry->local_header_offset, + SEEK_SET); + } + zip->unconsumed = 0; + r = zip_read_local_file_header(a, entry, zip); + if (r != ARCHIVE_OK) + return r; + if (rsrc) { + int ret2 = zip_read_mac_metadata(a, entry, rsrc); + if (ret2 < ret) + ret = ret2; + } + return (ret); +} + +/* + * We're going to seek for the next header anyway, so we don't + * need to bother doing anything here. + */ +static int +archive_read_format_zip_read_data_skip_seekable(struct archive_read *a) +{ + struct zip *zip; + zip = (struct zip *)(a->format->data); + + zip->unconsumed = 0; + return (ARCHIVE_OK); +} + +int +archive_read_support_format_zip_seekable(struct archive *_a) +{ + struct archive_read *a = (struct archive_read *)_a; + struct zip *zip; + int r; + + archive_check_magic(_a, ARCHIVE_READ_MAGIC, + ARCHIVE_STATE_NEW, "archive_read_support_format_zip_seekable"); + + zip = (struct zip *)calloc(1, sizeof(*zip)); + if (zip == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate zip data"); + return (ARCHIVE_FATAL); + } + +#ifdef HAVE_COPYFILE_H + /* Set this by default on Mac OS. */ + zip->process_mac_extensions = 1; +#endif + + /* + * Until enough data has been read, we cannot tell about + * any encrypted entries yet. + */ + zip->has_encrypted_entries = ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW; + zip->crc32func = real_crc32; + + r = __archive_read_register_format(a, + zip, + "zip", + archive_read_format_zip_seekable_bid, + archive_read_format_zip_options, + archive_read_format_zip_seekable_read_header, + archive_read_format_zip_read_data, + archive_read_format_zip_read_data_skip_seekable, + NULL, + archive_read_format_zip_cleanup, + archive_read_support_format_zip_capabilities_seekable, + archive_read_format_zip_has_encrypted_entries); + + if (r != ARCHIVE_OK) + free(zip); + return (ARCHIVE_OK); +} diff --git a/libarchive/archive_string.c b/libarchive/archive_string.c index 87f9288f1966..282c58e1eb9f 100644 --- a/libarchive/archive_string.c +++ b/libarchive/archive_string.c @@ -71,6 +71,10 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_string.c 201095 2009-12-28 02:33 #define wmemcpy(a,b,i) (wchar_t *)memcpy((a), (b), (i) * sizeof(wchar_t)) #endif +#if !defined(HAVE_WMEMMOVE) && !defined(wmemmove) +#define wmemmove(a,b,i) (wchar_t *)memmove((a), (b), (i) * sizeof(wchar_t)) +#endif + struct archive_string_conv { struct archive_string_conv *next; char *from_charset; @@ -127,12 +131,7 @@ struct archive_string_conv { #define UNICODE_MAX 0x10FFFF #define UNICODE_R_CHAR 0xFFFD /* Replacement character. */ /* Set U+FFFD(Replacement character) in UTF-8. */ -#define UTF8_SET_R_CHAR(outp) do { \ - (outp)[0] = 0xef; \ - (outp)[1] = 0xbf; \ - (outp)[2] = 0xbd; \ -} while (0) -#define UTF8_R_CHAR_SIZE 3 +static const char utf8_replacement_char[] = {0xef, 0xbf, 0xbd}; static struct archive_string_conv *find_sconv_object(struct archive *, const char *, const char *); @@ -203,7 +202,7 @@ archive_string_append(struct archive_string *as, const char *p, size_t s) { if (archive_string_ensure(as, as->length + s + 1) == NULL) return (NULL); - memcpy(as->s + as->length, p, s); + memmove(as->s + as->length, p, s); as->length += s; as->s[as->length] = 0; return (as); @@ -214,7 +213,7 @@ archive_wstring_append(struct archive_wstring *as, const wchar_t *p, size_t s) { if (archive_wstring_ensure(as, as->length + s + 1) == NULL) return (NULL); - wmemcpy(as->s + as->length, p, s); + wmemmove(as->s + as->length, p, s); as->length += s; as->s[as->length] = 0; return (as); @@ -738,7 +737,8 @@ archive_string_append_from_wcs_in_codepage(struct archive_string *as, } if (count == 0) ret = -1; - } while (0); + break; + } while (1); } as->length += count; as->s[as->length] = '\0'; @@ -2037,7 +2037,7 @@ iconv_strncat_in_locale(struct archive_string *as, const void *_p, if (sc->flag & (SCONV_TO_UTF8 | SCONV_TO_UTF16)) { size_t rbytes; if (sc->flag & SCONV_TO_UTF8) - rbytes = UTF8_R_CHAR_SIZE; + rbytes = sizeof(utf8_replacement_char); else rbytes = 2; @@ -2053,7 +2053,7 @@ iconv_strncat_in_locale(struct archive_string *as, const void *_p, - as->length - to_size; } if (sc->flag & SCONV_TO_UTF8) - UTF8_SET_R_CHAR(outp); + memcpy(outp, utf8_replacement_char, sizeof(utf8_replacement_char)); else if (sc->flag & SCONV_TO_UTF16BE) archive_be16enc(outp, UNICODE_R_CHAR); else @@ -2202,9 +2202,7 @@ best_effort_strncat_in_locale(struct archive_string *as, const void *_p, size_t length, struct archive_string_conv *sc) { size_t remaining; - char *otp; const uint8_t *itp; - size_t avail; int return_value = 0; /* success */ /* @@ -2223,46 +2221,25 @@ best_effort_strncat_in_locale(struct archive_string *as, const void *_p, * byte sequence 0xEF 0xBD 0xBD, which are code point U+FFFD, * a Replacement Character in Unicode. */ - if (archive_string_ensure(as, as->length + length + 1) == NULL) - return (-1); remaining = length; itp = (const uint8_t *)_p; - otp = as->s + as->length; - avail = as->buffer_length - as->length -1; while (*itp && remaining > 0) { - if (*itp > 127 && (sc->flag & SCONV_TO_UTF8)) { - if (avail < UTF8_R_CHAR_SIZE) { - as->length = otp - as->s; - if (NULL == archive_string_ensure(as, - as->buffer_length + remaining + - UTF8_R_CHAR_SIZE)) - return (-1); - otp = as->s + as->length; - avail = as->buffer_length - as->length -1; + if (*itp > 127) { + // Non-ASCII: Substitute with suitable replacement + if (sc->flag & SCONV_TO_UTF8) { + if (archive_string_append(as, utf8_replacement_char, sizeof(utf8_replacement_char)) == NULL) { + __archive_errx(1, "Out of memory"); + } + } else { + archive_strappend_char(as, '?'); } - /* - * When coping a string in UTF-8, unknown character - * should be U+FFFD (replacement character). - */ - UTF8_SET_R_CHAR(otp); - otp += UTF8_R_CHAR_SIZE; - avail -= UTF8_R_CHAR_SIZE; - itp++; - remaining--; - return_value = -1; - } else if (*itp > 127) { - *otp++ = '?'; - itp++; - remaining--; return_value = -1; } else { - *otp++ = (char)*itp++; - remaining--; + archive_strappend_char(as, *itp); } + ++itp; } - as->length = otp - as->s; - as->s[as->length] = '\0'; return (return_value); } @@ -2488,6 +2465,9 @@ unicode_to_utf8(char *p, size_t remaining, uint32_t uc) { char *_p = p; + /* Invalid Unicode char maps to Replacement character */ + if (uc > UNICODE_MAX) + uc = UNICODE_R_CHAR; /* Translate code point to UTF8 */ if (uc <= 0x7f) { if (remaining == 0) @@ -2504,22 +2484,13 @@ unicode_to_utf8(char *p, size_t remaining, uint32_t uc) *p++ = 0xe0 | ((uc >> 12) & 0x0f); *p++ = 0x80 | ((uc >> 6) & 0x3f); *p++ = 0x80 | (uc & 0x3f); - } else if (uc <= UNICODE_MAX) { + } else { if (remaining < 4) return (0); *p++ = 0xf0 | ((uc >> 18) & 0x07); *p++ = 0x80 | ((uc >> 12) & 0x3f); *p++ = 0x80 | ((uc >> 6) & 0x3f); *p++ = 0x80 | (uc & 0x3f); - } else { - /* - * Undescribed code point should be U+FFFD - * (replacement character). - */ - if (remaining < UTF8_R_CHAR_SIZE) - return (0); - UTF8_SET_R_CHAR(p); - p += UTF8_R_CHAR_SIZE; } return (p - _p); } @@ -3887,7 +3858,7 @@ archive_mstring_get_utf8(struct archive *a, struct archive_mstring *aes, sc = archive_string_conversion_to_charset(a, "UTF-8", 1); if (sc == NULL) return (-1);/* Couldn't allocate memory for sc. */ - r = archive_strncpy_l(&(aes->aes_mbs), aes->aes_mbs.s, + r = archive_strncpy_l(&(aes->aes_utf8), aes->aes_mbs.s, aes->aes_mbs.length, sc); if (a == NULL) free_sconv_object(sc); @@ -4061,6 +4032,19 @@ archive_mstring_copy_wcs(struct archive_mstring *aes, const wchar_t *wcs) wcs == NULL ? 0 : wcslen(wcs)); } +int +archive_mstring_copy_utf8(struct archive_mstring *aes, const char *utf8) +{ + if (utf8 == NULL) { + aes->aes_set = 0; + } + aes->aes_set = AES_SET_UTF8; + archive_string_empty(&(aes->aes_mbs)); + archive_string_empty(&(aes->aes_wcs)); + archive_strncpy(&(aes->aes_utf8), utf8, strlen(utf8)); + return (int)strlen(utf8); +} + int archive_mstring_copy_wcs_len(struct archive_mstring *aes, const wchar_t *wcs, size_t len) diff --git a/libarchive/archive_util.c b/libarchive/archive_util.c index 34d8081cbce9..cc3d1c460728 100644 --- a/libarchive/archive_util.c +++ b/libarchive/archive_util.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2012 Michihiro NAKAJIMA + * Copyright (c) 2009-2012,2014 Michihiro NAKAJIMA * Copyright (c) 2003-2007 Tim Kientzle * All rights reserved. * @@ -45,15 +45,30 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_util.c 201098 2009-12-28 02:58:1 #if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__) #include #endif +#ifdef HAVE_ZLIB_H +#include +#endif +#ifdef HAVE_LZMA_H +#include +#endif +#ifdef HAVE_BZLIB_H +#include +#endif +#ifdef HAVE_LZ4_H +#include +#endif #include "archive.h" #include "archive_private.h" +#include "archive_random_private.h" #include "archive_string.h" #ifndef O_CLOEXEC #define O_CLOEXEC 0 #endif +static int archive_utility_string_sort_helper(char **, unsigned int); + /* Generic initialization of 'struct archive' objects. */ int __archive_clean(struct archive *a) @@ -74,6 +89,88 @@ archive_version_string(void) return (ARCHIVE_VERSION_STRING); } +const char * +archive_version_details(void) +{ + static struct archive_string str; + static int init = 0; + const char *zlib = archive_zlib_version(); + const char *liblzma = archive_liblzma_version(); + const char *bzlib = archive_bzlib_version(); + const char *liblz4 = archive_liblz4_version(); + + if (!init) { + archive_string_init(&str); + + archive_strcat(&str, ARCHIVE_VERSION_STRING); + if (zlib != NULL) { + archive_strcat(&str, " zlib/"); + archive_strcat(&str, zlib); + } + if (liblzma) { + archive_strcat(&str, " liblzma/"); + archive_strcat(&str, liblzma); + } + if (bzlib) { + const char *p = bzlib; + const char *sep = strchr(p, ','); + if (sep == NULL) + sep = p + strlen(p); + archive_strcat(&str, " bz2lib/"); + archive_strncat(&str, p, sep - p); + } + if (liblz4) { + archive_strcat(&str, " liblz4/"); + archive_strcat(&str, liblz4); + } + } + return str.s; +} + +const char * +archive_zlib_version(void) +{ +#ifdef HAVE_ZLIB_H + return ZLIB_VERSION; +#else + return NULL; +#endif +} + +const char * +archive_liblzma_version(void) +{ +#ifdef HAVE_LZMA_H + return LZMA_VERSION_STRING; +#else + return NULL; +#endif +} + +const char * +archive_bzlib_version(void) +{ +#ifdef HAVE_BZLIB_H + return BZ2_bzlibVersion(); +#else + return NULL; +#endif +} + +const char * +archive_liblz4_version(void) +{ +#if defined(HAVE_LZ4_H) && defined(HAVE_LIBLZ4) +#define str(s) #s +#define NUMBER(x) str(x) + return NUMBER(LZ4_VERSION_MAJOR) "." NUMBER(LZ4_VERSION_MINOR) "." NUMBER(LZ4_VERSION_RELEASE); +#undef NUMBER +#undef str +#else + return NULL; +#endif +} + int archive_errno(struct archive *a) { @@ -206,6 +303,8 @@ __archive_errx(int retvalue, const char *msg) int __archive_mktemp(const char *tmpdir) { + static const wchar_t *prefix = L"libarchive_"; + static const wchar_t *suffix = L"XXXXXXXXXX"; static const wchar_t num[] = { L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9', L'A', L'B', L'C', L'D', L'E', L'F', @@ -280,10 +379,10 @@ __archive_mktemp(const char *tmpdir) /* * Create a temporary file. */ - archive_wstrcat(&temp_name, L"libarchive_"); - xp = temp_name.s + archive_strlen(&temp_name); - archive_wstrcat(&temp_name, L"XXXXXXXXXX"); + archive_wstrcat(&temp_name, prefix); + archive_wstrcat(&temp_name, suffix); ep = temp_name.s + archive_strlen(&temp_name); + xp = ep - wcslen(suffix); if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) { @@ -420,7 +519,6 @@ __archive_mktemp(const char *tmpdir) struct stat st; int fd; char *tp, *ep; - unsigned seed; fd = -1; archive_string_init(&temp_name); @@ -444,21 +542,15 @@ __archive_mktemp(const char *tmpdir) archive_strcat(&temp_name, "XXXXXXXXXX"); ep = temp_name.s + archive_strlen(&temp_name); - fd = open("/dev/random", O_RDONLY | O_CLOEXEC); - __archive_ensure_cloexec_flag(fd); - if (fd < 0) - seed = time(NULL); - else { - if (read(fd, &seed, sizeof(seed)) < 0) - seed = time(NULL); - close(fd); - } do { char *p; p = tp; - while (p < ep) - *p++ = num[((unsigned)rand_r(&seed)) % sizeof(num)]; + archive_random(p, ep - p); + while (p < ep) { + int d = *((unsigned char *)p) % sizeof(num); + *p++ = num[d]; + } fd = open(temp_name.s, O_CREAT | O_EXCL | O_RDWR | O_CLOEXEC, 0600); } while (fd < 0 && errno == EEXIST); @@ -499,3 +591,77 @@ __archive_ensure_cloexec_flag(int fd) } #endif } + +/* + * Utility function to sort a group of strings using quicksort. + */ +static int +archive_utility_string_sort_helper(char **strings, unsigned int n) +{ + unsigned int i, lesser_count, greater_count; + char **lesser, **greater, **tmp, *pivot; + int retval1, retval2; + + /* A list of 0 or 1 elements is already sorted */ + if (n <= 1) + return (ARCHIVE_OK); + + lesser_count = greater_count = 0; + lesser = greater = NULL; + pivot = strings[0]; + for (i = 1; i < n; i++) + { + if (strcmp(strings[i], pivot) < 0) + { + lesser_count++; + tmp = (char **)realloc(lesser, + lesser_count * sizeof(char *)); + if (!tmp) { + free(greater); + free(lesser); + return (ARCHIVE_FATAL); + } + lesser = tmp; + lesser[lesser_count - 1] = strings[i]; + } + else + { + greater_count++; + tmp = (char **)realloc(greater, + greater_count * sizeof(char *)); + if (!tmp) { + free(greater); + free(lesser); + return (ARCHIVE_FATAL); + } + greater = tmp; + greater[greater_count - 1] = strings[i]; + } + } + + /* quicksort(lesser) */ + retval1 = archive_utility_string_sort_helper(lesser, lesser_count); + for (i = 0; i < lesser_count; i++) + strings[i] = lesser[i]; + free(lesser); + + /* pivot */ + strings[lesser_count] = pivot; + + /* quicksort(greater) */ + retval2 = archive_utility_string_sort_helper(greater, greater_count); + for (i = 0; i < greater_count; i++) + strings[lesser_count + 1 + i] = greater[i]; + free(greater); + + return (retval1 < retval2) ? retval1 : retval2; +} + +int +archive_utility_string_sort(char **strings) +{ + unsigned int size = 0; + while (strings[size] != NULL) + size++; + return archive_utility_string_sort_helper(strings, size); +} diff --git a/libarchive/archive_virtual.c b/libarchive/archive_virtual.c index 0c4155f21e3b..de2595a9ead5 100644 --- a/libarchive/archive_virtual.c +++ b/libarchive/archive_virtual.c @@ -54,6 +54,14 @@ archive_filter_bytes(struct archive *a, int n) return ((a->vtable->archive_filter_bytes)(a, n)); } +int +archive_free(struct archive *a) +{ + if (a == NULL) + return (ARCHIVE_OK); + return ((a->vtable->archive_free)(a)); +} + int archive_write_close(struct archive *a) { @@ -76,9 +84,7 @@ archive_write_fail(struct archive *a) int archive_write_free(struct archive *a) { - if (a == NULL) - return (ARCHIVE_OK); - return ((a->vtable->archive_free)(a)); + return archive_free(a); } #if ARCHIVE_VERSION_NUMBER < 4000000 @@ -93,9 +99,7 @@ archive_write_finish(struct archive *a) int archive_read_free(struct archive *a) { - if (a == NULL) - return (ARCHIVE_OK); - return ((a->vtable->archive_free)(a)); + return archive_free(a); } #if ARCHIVE_VERSION_NUMBER < 4000000 diff --git a/libarchive/archive_windows.c b/libarchive/archive_windows.c index d3bf758bb39e..d4e93fe78aaa 100644 --- a/libarchive/archive_windows.c +++ b/libarchive/archive_windows.c @@ -301,7 +301,7 @@ __la_open(const char *path, int flags, ...) ws = NULL; if ((flags & ~O_BINARY) == O_RDONLY) { /* - * When we open a directory, _open function returns + * When we open a directory, _open function returns * "Permission denied" error. */ attr = GetFileAttributesA(path); @@ -515,9 +515,9 @@ __hstat(HANDLE handle, struct ustat *st) else mode |= S_IFREG; st->st_mode = mode; - + fileTimeToUTC(&info.ftLastAccessTime, &t, &ns); - st->st_atime = t; + st->st_atime = t; st->st_atime_nsec = ns; fileTimeToUTC(&info.ftLastWriteTime, &t, &ns); st->st_mtime = t; @@ -525,7 +525,7 @@ __hstat(HANDLE handle, struct ustat *st) fileTimeToUTC(&info.ftCreationTime, &t, &ns); st->st_ctime = t; st->st_ctime_nsec = ns; - st->st_size = + st->st_size = ((int64_t)(info.nFileSizeHigh) * ((int64_t)MAXDWORD + 1)) + (int64_t)(info.nFileSizeLow); #ifdef SIMULATE_WIN_STAT @@ -599,7 +599,7 @@ __la_stat(const char *path, struct stat *st) struct ustat u; int ret; - handle = la_CreateFile(path, 0, 0, NULL, OPEN_EXISTING, + handle = la_CreateFile(path, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); if (handle == INVALID_HANDLE_VALUE) { diff --git a/libarchive/archive_windows.h b/libarchive/archive_windows.h index c6f5bc510513..8cf1c56d89d1 100644 --- a/libarchive/archive_windows.h +++ b/libarchive/archive_windows.h @@ -89,7 +89,7 @@ /* Alias the Windows _function to the POSIX equivalent. */ #define close _close -#define fcntl(fd, cmd, flg) /* No operation. */ +#define fcntl(fd, cmd, flg) /* No operation. */ #ifndef fileno #define fileno _fileno #endif @@ -109,13 +109,14 @@ #define lstat __la_stat #define open __la_open #define read __la_read -#if !defined(__BORLANDC__) +#if !defined(__BORLANDC__) && !defined(__WATCOMC__) #define setmode _setmode #endif #ifdef stat #undef stat #endif #define stat(path,stref) __la_stat(path,stref) +#if !defined(__WATCOMC__) #if !defined(__BORLANDC__) #define strdup _strdup #endif @@ -123,9 +124,12 @@ #if !defined(__BORLANDC__) #define umask _umask #endif +#endif #define waitpid __la_waitpid #define write __la_write +#if !defined(__WATCOMC__) + #ifndef O_RDONLY #define O_RDONLY _O_RDONLY #define O_WRONLY _O_WRONLY @@ -203,7 +207,7 @@ #define _S_IXGRP (_S_IXUSR >> 3) /* read permission, group */ #define _S_IWGRP (_S_IWUSR >> 3) /* write permission, group */ #define _S_IRGRP (_S_IRUSR >> 3) /* execute/search permission, group */ -#define _S_IRWXO (_S_IRWXG >> 3) +#define _S_IRWXO (_S_IRWXG >> 3) #define _S_IXOTH (_S_IXGRP >> 3) /* read permission, other */ #define _S_IWOTH (_S_IWGRP >> 3) /* write permission, other */ #define _S_IROTH (_S_IRGRP >> 3) /* execute/search permission, other */ @@ -217,12 +221,16 @@ #define S_IRWXG _S_IRWXG #define S_IXGRP _S_IXGRP #define S_IWGRP _S_IWGRP +#ifndef S_IRGRP #define S_IRGRP _S_IRGRP +#endif #define S_IRWXO _S_IRWXO #define S_IXOTH _S_IXOTH #define S_IWOTH _S_IWOTH #define S_IROTH _S_IROTH +#endif + #define F_DUPFD 0 /* Duplicate file descriptor. */ #define F_GETFD 1 /* Get file descriptor flags. */ #define F_SETFD 2 /* Set file descriptor flags. */ diff --git a/libarchive/archive_write.3 b/libarchive/archive_write.3 index 228bc2cb8821..376d71dee20e 100644 --- a/libarchive/archive_write.3 +++ b/libarchive/archive_write.3 @@ -155,7 +155,7 @@ myopen(struct archive *a, void *client_data) return (ARCHIVE_FATAL); } -ssize_t +la_ssize_t mywrite(struct archive *a, void *client_data, const void *buff, size_t n) { struct mydata *mydata = client_data; @@ -186,8 +186,13 @@ write_archive(const char *outname, const char **filename) a = archive_write_new(); mydata->name = outname; - archive_write_add_filter_gzip(a); - archive_write_set_format_ustar(a); + /* Set archive format and filter according to output file extension. + * If it fails, set default format. Platform depended function. + * See supported formats in archive_write_set_format_filter_by_ext.c */ + if (archive_write_set_format_filter_by_ext(a, outname) != ARCHIVE_OK) { + archive_write_add_filter_gzip(a); + archive_write_set_format_ustar(a); + } archive_write_open(a, mydata, myopen, mywrite, myclose); while (*filename) { stat(*filename, &st); @@ -197,7 +202,7 @@ write_archive(const char *outname, const char **filename) archive_write_header(a, entry); if ((fd = open(*filename, O_RDONLY)) != -1) { len = read(fd, buff, sizeof(buff)); - while ( len > 0 ) { + while (len > 0) { archive_write_data(a, buff, len); len = read(fd, buff, sizeof(buff)); } @@ -213,7 +218,7 @@ int main(int argc, const char **argv) { const char *outname; argv++; - outname = argv++; + outname = *argv++; write_archive(outname, argv); return 0; } diff --git a/libarchive/archive_write.c b/libarchive/archive_write.c index a3d1a3380c05..e3fa3357ba7b 100644 --- a/libarchive/archive_write.c +++ b/libarchive/archive_write.c @@ -444,6 +444,12 @@ archive_write_client_close(struct archive_write_filter *f) /* Clear the close handler myself not to be called again. */ f->close = NULL; a->client_data = NULL; + /* Clear passphrase. */ + if (a->passphrase != NULL) { + memset(a->passphrase, 0, strlen(a->passphrase)); + free(a->passphrase); + a->passphrase = NULL; + } return (ret); } @@ -503,8 +509,9 @@ _archive_write_close(struct archive *_a) archive_clear_error(&a->archive); - /* Finish the last entry. */ - if (a->archive.state == ARCHIVE_STATE_DATA) + /* Finish the last entry if a finish callback is specified */ + if (a->archive.state == ARCHIVE_STATE_DATA + && a->format_finish_entry != NULL) r = ((a->format_finish_entry)(a)); /* Finish off the archive. */ @@ -591,6 +598,11 @@ _archive_write_free(struct archive *_a) /* Release various dynamic buffers. */ free((void *)(uintptr_t)(const void *)a->nulls); archive_string_free(&a->archive.error_string); + if (a->passphrase != NULL) { + /* A passphrase should be cleaned. */ + memset(a->passphrase, 0, strlen(a->passphrase)); + free(a->passphrase); + } a->archive.magic = 0; __archive_clean(&a->archive); free(a); @@ -638,6 +650,9 @@ _archive_write_header(struct archive *_a, struct archive_entry *entry) /* Format and write header. */ r2 = ((a->format_write_header)(a, entry)); + if (r2 == ARCHIVE_FAILED) { + return (ARCHIVE_FAILED); + } if (r2 == ARCHIVE_FATAL) { a->archive.state = ARCHIVE_STATE_FATAL; return (ARCHIVE_FATAL); @@ -658,7 +673,8 @@ _archive_write_finish_entry(struct archive *_a) archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, "archive_write_finish_entry"); - if (a->archive.state & ARCHIVE_STATE_DATA) + if (a->archive.state & ARCHIVE_STATE_DATA + && a->format_finish_entry != NULL) ret = (a->format_finish_entry)(a); a->archive.state = ARCHIVE_STATE_HEADER; return (ret); @@ -671,8 +687,13 @@ static ssize_t _archive_write_data(struct archive *_a, const void *buff, size_t s) { struct archive_write *a = (struct archive_write *)_a; + const size_t max_write = INT_MAX; + archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, ARCHIVE_STATE_DATA, "archive_write_data"); + /* In particular, this catches attempts to pass negative values. */ + if (s > max_write) + s = max_write; archive_clear_error(&a->archive); return ((a->format_write_data)(a, buff, s)); } @@ -704,7 +725,7 @@ static const char * _archive_filter_name(struct archive *_a, int n) { struct archive_write_filter *f = filter_lookup(_a, n); - return f == NULL ? NULL : f->name; + return f != NULL ? f->name : NULL; } static int64_t diff --git a/libarchive/archive_write_add_filter.c b/libarchive/archive_write_add_filter.c index 81dd683aacc7..ad5dc832fdae 100644 --- a/libarchive/archive_write_add_filter.c +++ b/libarchive/archive_write_add_filter.c @@ -47,6 +47,7 @@ struct { int code; int (*setter)(struct archive *); } codes[] = { ARCHIVE_FILTER_COMPRESS, archive_write_add_filter_compress }, { ARCHIVE_FILTER_GRZIP, archive_write_add_filter_grzip }, { ARCHIVE_FILTER_LRZIP, archive_write_add_filter_lrzip }, + { ARCHIVE_FILTER_LZ4, archive_write_add_filter_lz4 }, { ARCHIVE_FILTER_LZIP, archive_write_add_filter_lzip }, { ARCHIVE_FILTER_LZMA, archive_write_add_filter_lzma }, { ARCHIVE_FILTER_LZOP, archive_write_add_filter_lzip }, diff --git a/libarchive/archive_write_add_filter_by_name.c b/libarchive/archive_write_add_filter_by_name.c index e4cba4afa01c..eac4011cb2ee 100644 --- a/libarchive/archive_write_add_filter_by_name.c +++ b/libarchive/archive_write_add_filter_by_name.c @@ -51,6 +51,7 @@ struct { const char *name; int (*setter)(struct archive *); } names[] = { "grzip", archive_write_add_filter_grzip }, { "gzip", archive_write_add_filter_gzip }, { "lrzip", archive_write_add_filter_lrzip }, + { "lz4", archive_write_add_filter_lz4 }, { "lzip", archive_write_add_filter_lzip }, { "lzma", archive_write_add_filter_lzma }, { "lzop", archive_write_add_filter_lzop }, diff --git a/libarchive/archive_write_add_filter_bzip2.c b/libarchive/archive_write_add_filter_bzip2.c index 88da803a395a..68ed9579b027 100644 --- a/libarchive/archive_write_add_filter_bzip2.c +++ b/libarchive/archive_write_add_filter_bzip2.c @@ -105,7 +105,7 @@ archive_write_add_filter_bzip2(struct archive *_a) #if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR) return (ARCHIVE_OK); #else - data->pdata = __archive_write_program_allocate(); + data->pdata = __archive_write_program_allocate("bzip2"); if (data->pdata == NULL) { free(data); archive_set_error(&a->archive, ENOMEM, "Out of memory"); diff --git a/libarchive/archive_write_add_filter_grzip.c b/libarchive/archive_write_add_filter_grzip.c index 8dc287eae033..371102d74c05 100644 --- a/libarchive/archive_write_add_filter_grzip.c +++ b/libarchive/archive_write_add_filter_grzip.c @@ -63,7 +63,7 @@ archive_write_add_filter_grzip(struct archive *_a) archive_set_error(_a, ENOMEM, "Can't allocate memory"); return (ARCHIVE_FATAL); } - data->pdata = __archive_write_program_allocate(); + data->pdata = __archive_write_program_allocate("grzip"); if (data->pdata == NULL) { free(data); archive_set_error(_a, ENOMEM, "Can't allocate memory"); diff --git a/libarchive/archive_write_add_filter_gzip.c b/libarchive/archive_write_add_filter_gzip.c index da4607bb934c..04eb06c1c06f 100644 --- a/libarchive/archive_write_add_filter_gzip.c +++ b/libarchive/archive_write_add_filter_gzip.c @@ -119,7 +119,7 @@ archive_write_add_filter_gzip(struct archive *_a) data->compression_level = Z_DEFAULT_COMPRESSION; return (ARCHIVE_OK); #else - data->pdata = __archive_write_program_allocate(); + data->pdata = __archive_write_program_allocate("gzip"); if (data->pdata == NULL) { free(data); archive_set_error(&a->archive, ENOMEM, "Out of memory"); diff --git a/libarchive/archive_write_add_filter_lrzip.c b/libarchive/archive_write_add_filter_lrzip.c index 85fdf6af57f5..e215f8903259 100644 --- a/libarchive/archive_write_add_filter_lrzip.c +++ b/libarchive/archive_write_add_filter_lrzip.c @@ -44,7 +44,7 @@ __FBSDID("$FreeBSD$"); struct write_lrzip { struct archive_write_program_data *pdata; int compression_level; - enum { lzma = 0, bzip2, gzip, lzo, zpaq } compression; + enum { lzma = 0, bzip2, gzip, lzo, none, zpaq } compression; }; static int archive_write_lrzip_open(struct archive_write_filter *); @@ -69,7 +69,7 @@ archive_write_add_filter_lrzip(struct archive *_a) archive_set_error(_a, ENOMEM, "Can't allocate memory"); return (ARCHIVE_FATAL); } - data->pdata = __archive_write_program_allocate(); + data->pdata = __archive_write_program_allocate("lrzip"); if (data->pdata == NULL) { free(data); archive_set_error(_a, ENOMEM, "Can't allocate memory"); @@ -107,6 +107,8 @@ archive_write_lrzip_options(struct archive_write_filter *f, const char *key, data->compression = gzip; else if (strcmp(value, "lzo") == 0) data->compression = lzo; + else if (strcmp(value, "none") == 0) + data->compression = none; else if (strcmp(value, "zpaq") == 0) data->compression = zpaq; else @@ -148,6 +150,9 @@ archive_write_lrzip_open(struct archive_write_filter *f) case lzo: archive_strcat(&as, " -l"); break; + case none: + archive_strcat(&as, " -n"); + break; case zpaq: archive_strcat(&as, " -z"); break; diff --git a/libarchive/archive_write_add_filter_lz4.c b/libarchive/archive_write_add_filter_lz4.c new file mode 100644 index 000000000000..1d0ab8c56a16 --- /dev/null +++ b/libarchive/archive_write_add_filter_lz4.c @@ -0,0 +1,707 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * 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 "archive_platform.h" + +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_ERRNO_H +#include +#endif +#include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_LZ4_H +#include +#endif +#ifdef HAVE_LZ4HC_H +#include +#endif + +#include "archive.h" +#include "archive_endian.h" +#include "archive_private.h" +#include "archive_write_private.h" +#include "archive_xxhash.h" + +#define LZ4_MAGICNUMBER 0x184d2204 + +struct private_data { + int compression_level; + unsigned header_written:1; + unsigned version_number:1; + unsigned block_independence:1; + unsigned block_checksum:1; + unsigned stream_size:1; + unsigned stream_checksum:1; + unsigned preset_dictionary:1; + unsigned block_maximum_size:3; +#if defined(HAVE_LIBLZ4) && LZ4_VERSION_MAJOR >= 1 && LZ4_VERSION_MINOR >= 2 + int64_t total_in; + char *out; + char *out_buffer; + size_t out_buffer_size; + size_t out_block_size; + char *in; + char *in_buffer_allocated; + char *in_buffer; + size_t in_buffer_size; + size_t block_size; + + void *xxh32_state; + void *lz4_stream; +#else + struct archive_write_program_data *pdata; +#endif +}; + +static int archive_filter_lz4_close(struct archive_write_filter *); +static int archive_filter_lz4_free(struct archive_write_filter *); +static int archive_filter_lz4_open(struct archive_write_filter *); +static int archive_filter_lz4_options(struct archive_write_filter *, + const char *, const char *); +static int archive_filter_lz4_write(struct archive_write_filter *, + const void *, size_t); + +/* + * Add a lz4 compression filter to this write handle. + */ +int +archive_write_add_filter_lz4(struct archive *_a) +{ + struct archive_write *a = (struct archive_write *)_a; + struct archive_write_filter *f = __archive_write_allocate_filter(_a); + struct private_data *data; + + archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC, + ARCHIVE_STATE_NEW, "archive_write_add_filter_lz4"); + + data = calloc(1, sizeof(*data)); + if (data == NULL) { + archive_set_error(&a->archive, ENOMEM, "Out of memory"); + return (ARCHIVE_FATAL); + } + + /* + * Setup default settings. + */ + data->compression_level = 1; + data->version_number = 0x01; + data->block_independence = 1; + data->block_checksum = 0; + data->stream_size = 0; + data->stream_checksum = 1; + data->preset_dictionary = 0; + data->block_maximum_size = 7; + + /* + * Setup a filter setting. + */ + f->data = data; + f->options = &archive_filter_lz4_options; + f->close = &archive_filter_lz4_close; + f->free = &archive_filter_lz4_free; + f->open = &archive_filter_lz4_open; + f->code = ARCHIVE_FILTER_LZ4; + f->name = "lz4"; +#if defined(HAVE_LIBLZ4) && LZ4_VERSION_MAJOR >= 1 && LZ4_VERSION_MINOR >= 2 + return (ARCHIVE_OK); +#else + /* + * We don't have lz4 library, and execute external lz4 program + * instead. + */ + data->pdata = __archive_write_program_allocate("lz4"); + if (data->pdata == NULL) { + free(data); + archive_set_error(&a->archive, ENOMEM, "Out of memory"); + return (ARCHIVE_FATAL); + } + data->compression_level = 0; + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Using external lz4 program"); + return (ARCHIVE_WARN); +#endif +} + +/* + * Set write options. + */ +static int +archive_filter_lz4_options(struct archive_write_filter *f, + const char *key, const char *value) +{ + struct private_data *data = (struct private_data *)f->data; + + if (strcmp(key, "compression-level") == 0) { + int val; + if (value == NULL || !((val = value[0] - '0') >= 1 && val <= 9) || + value[1] != '\0') + return (ARCHIVE_WARN); + +#ifndef HAVE_LZ4HC_H + if(val >= 3) + { + archive_set_error(f->archive, ARCHIVE_ERRNO_PROGRAMMER, + "High compression not included in this build"); + return (ARCHIVE_FATAL); + } +#endif + data->compression_level = val; + return (ARCHIVE_OK); + } + if (strcmp(key, "stream-checksum") == 0) { + data->stream_checksum = value != NULL; + return (ARCHIVE_OK); + } + if (strcmp(key, "block-checksum") == 0) { + data->block_checksum = value != NULL; + return (ARCHIVE_OK); + } + if (strcmp(key, "block-size") == 0) { + if (value == NULL || !(value[0] >= '4' && value[0] <= '7') || + value[1] != '\0') + return (ARCHIVE_WARN); + data->block_maximum_size = value[0] - '0'; + return (ARCHIVE_OK); + } + if (strcmp(key, "block-dependence") == 0) { + data->block_independence = value == NULL; + return (ARCHIVE_OK); + } + + /* Note: The "warn" return is just to inform the options + * supervisor that we didn't handle it. It will generate + * a suitable error if no one used this option. */ + return (ARCHIVE_WARN); +} + +#if defined(HAVE_LIBLZ4) && LZ4_VERSION_MAJOR >= 1 && LZ4_VERSION_MINOR >= 2 +/* Don't compile this if we don't have liblz4. */ + +static int drive_compressor(struct archive_write_filter *, const char *, + size_t); +static int drive_compressor_independence(struct archive_write_filter *, + const char *, size_t); +static int drive_compressor_dependence(struct archive_write_filter *, + const char *, size_t); +static int lz4_write_stream_descriptor(struct archive_write_filter *); +static ssize_t lz4_write_one_block(struct archive_write_filter *, const char *, + size_t); + + +/* + * Setup callback. + */ +static int +archive_filter_lz4_open(struct archive_write_filter *f) +{ + struct private_data *data = (struct private_data *)f->data; + int ret; + size_t required_size; + static size_t bkmap[] = { 64 * 1024, 256 * 1024, 1 * 1024 * 1024, + 4 * 1024 * 1024 }; + size_t pre_block_size; + + ret = __archive_write_open_filter(f->next_filter); + if (ret != 0) + return (ret); + + if (data->block_maximum_size < 4) + data->block_size = bkmap[0]; + else + data->block_size = bkmap[data->block_maximum_size - 4]; + + required_size = 4 + 15 + 4 + data->block_size + 4 + 4; + if (data->out_buffer_size < required_size) { + size_t bs = required_size, bpb; + free(data->out_buffer); + if (f->archive->magic == ARCHIVE_WRITE_MAGIC) { + /* Buffer size should be a multiple number of + * the of bytes per block for performance. */ + bpb = archive_write_get_bytes_per_block(f->archive); + if (bpb > bs) + bs = bpb; + else if (bpb != 0) { + bs += bpb; + bs -= bs % bpb; + } + } + data->out_block_size = bs; + bs += required_size; + data->out_buffer = malloc(bs); + data->out = data->out_buffer; + data->out_buffer_size = bs; + } + + pre_block_size = (data->block_independence)? 0: 64 * 1024; + if (data->in_buffer_size < data->block_size + pre_block_size) { + free(data->in_buffer_allocated); + data->in_buffer_size = data->block_size; + data->in_buffer_allocated = + malloc(data->in_buffer_size + pre_block_size); + data->in_buffer = data->in_buffer_allocated + pre_block_size; + if (!data->block_independence && data->compression_level >= 3) + data->in_buffer = data->in_buffer_allocated; + data->in = data->in_buffer; + data->in_buffer_size = data->block_size; + } + + if (data->out_buffer == NULL || data->in_buffer_allocated == NULL) { + archive_set_error(f->archive, ENOMEM, + "Can't allocate data for compression buffer"); + return (ARCHIVE_FATAL); + } + + f->write = archive_filter_lz4_write; + + return (ARCHIVE_OK); +} + +/* + * Write data to the out stream. + * + * Returns ARCHIVE_OK if all data written, error otherwise. + */ +static int +archive_filter_lz4_write(struct archive_write_filter *f, + const void *buff, size_t length) +{ + struct private_data *data = (struct private_data *)f->data; + int ret = ARCHIVE_OK; + const char *p; + size_t remaining; + ssize_t size; + + /* If we haven't written a stream descriptor, we have to do it first. */ + if (!data->header_written) { + ret = lz4_write_stream_descriptor(f); + if (ret != ARCHIVE_OK) + return (ret); + data->header_written = 1; + } + + /* Update statistics */ + data->total_in += length; + + p = (const char *)buff; + remaining = length; + while (remaining) { + size_t l; + /* Compress input data to output buffer */ + size = lz4_write_one_block(f, p, remaining); + if (size < ARCHIVE_OK) + return (ARCHIVE_FATAL); + l = data->out - data->out_buffer; + if (l >= data->out_block_size) { + ret = __archive_write_filter(f->next_filter, + data->out_buffer, data->out_block_size); + l -= data->out_block_size; + memcpy(data->out_buffer, + data->out_buffer + data->out_block_size, l); + data->out = data->out_buffer + l; + if (ret < ARCHIVE_WARN) + break; + } + p += size; + remaining -= size; + } + + return (ret); +} + +/* + * Finish the compression. + */ +static int +archive_filter_lz4_close(struct archive_write_filter *f) +{ + struct private_data *data = (struct private_data *)f->data; + int ret, r1; + + /* Finish compression cycle. */ + ret = (int)lz4_write_one_block(f, NULL, 0); + if (ret >= 0) { + /* + * Write the last block and the end of the stream data. + */ + + /* Write End Of Stream. */ + memset(data->out, 0, 4); data->out += 4; + /* Write Stream checksum if needed. */ + if (data->stream_checksum) { + unsigned int checksum; + checksum = __archive_xxhash.XXH32_digest( + data->xxh32_state); + data->xxh32_state = NULL; + archive_le32enc(data->out, checksum); + data->out += 4; + } + ret = __archive_write_filter(f->next_filter, + data->out_buffer, data->out - data->out_buffer); + } + + r1 = __archive_write_close_filter(f->next_filter); + return (r1 < ret ? r1 : ret); +} + +static int +archive_filter_lz4_free(struct archive_write_filter *f) +{ + struct private_data *data = (struct private_data *)f->data; + + if (data->lz4_stream != NULL) { +#ifdef HAVE_LZ4HC_H + if (data->compression_level >= 3) +#if LZ4_VERSION_MAJOR >= 1 && LZ4_VERSION_MINOR >= 7 + LZ4_freeStreamHC(data->lz4_stream); +#else + LZ4_freeHC(data->lz4_stream); +#endif + else +#endif +#if LZ4_VERSION_MINOR >= 3 + LZ4_freeStream(data->lz4_stream); +#else + LZ4_free(data->lz4_stream); +#endif + } + free(data->out_buffer); + free(data->in_buffer_allocated); + free(data->xxh32_state); + free(data); + f->data = NULL; + return (ARCHIVE_OK); +} + +static int +lz4_write_stream_descriptor(struct archive_write_filter *f) +{ + struct private_data *data = (struct private_data *)f->data; + uint8_t *sd; + + sd = (uint8_t *)data->out; + /* Write Magic Number. */ + archive_le32enc(&sd[0], LZ4_MAGICNUMBER); + /* FLG */ + sd[4] = (data->version_number << 6) + | (data->block_independence << 5) + | (data->block_checksum << 4) + | (data->stream_size << 3) + | (data->stream_checksum << 2) + | (data->preset_dictionary << 0); + /* BD */ + sd[5] = (data->block_maximum_size << 4); + sd[6] = (__archive_xxhash.XXH32(&sd[4], 2, 0) >> 8) & 0xff; + data->out += 7; + if (data->stream_checksum) + data->xxh32_state = __archive_xxhash.XXH32_init(0); + else + data->xxh32_state = NULL; + return (ARCHIVE_OK); +} + +static ssize_t +lz4_write_one_block(struct archive_write_filter *f, const char *p, + size_t length) +{ + struct private_data *data = (struct private_data *)f->data; + ssize_t r; + + if (p == NULL) { + /* Compress remaining uncompressed data. */ + if (data->in_buffer == data->in) + return 0; + else { + size_t l = data->in - data->in_buffer; + r = drive_compressor(f, data->in_buffer, l); + if (r == ARCHIVE_OK) + r = (ssize_t)l; + } + } else if ((data->block_independence || data->compression_level < 3) && + data->in_buffer == data->in && length >= data->block_size) { + r = drive_compressor(f, p, data->block_size); + if (r == ARCHIVE_OK) + r = (ssize_t)data->block_size; + } else { + size_t remaining_size = data->in_buffer_size - + (data->in - data->in_buffer); + size_t l = (remaining_size > length)? length: remaining_size; + memcpy(data->in, p, l); + data->in += l; + if (l == remaining_size) { + r = drive_compressor(f, data->in_buffer, + data->block_size); + if (r == ARCHIVE_OK) + r = (ssize_t)l; + data->in = data->in_buffer; + } else + r = (ssize_t)l; + } + + return (r); +} + + +/* + * Utility function to push input data through compressor, writing + * full output blocks as necessary. + * + * Note that this handles both the regular write case (finishing == + * false) and the end-of-archive case (finishing == true). + */ +static int +drive_compressor(struct archive_write_filter *f, const char *p, size_t length) +{ + struct private_data *data = (struct private_data *)f->data; + + if (data->stream_checksum) + __archive_xxhash.XXH32_update(data->xxh32_state, + p, (int)length); + if (data->block_independence) + return drive_compressor_independence(f, p, length); + else + return drive_compressor_dependence(f, p, length); +} + +static int +drive_compressor_independence(struct archive_write_filter *f, const char *p, + size_t length) +{ + struct private_data *data = (struct private_data *)f->data; + unsigned int outsize; + +#ifdef HAVE_LZ4HC_H + if (data->compression_level >= 3) +#if LZ4_VERSION_MAJOR >= 1 && LZ4_VERSION_MINOR >= 7 + outsize = LZ4_compress_HC(p, data->out + 4, + (int)length, (int)data->block_size, + data->compression_level); +#else + outsize = LZ4_compressHC2_limitedOutput(p, data->out + 4, + (int)length, (int)data->block_size, + data->compression_level); +#endif + else +#endif +#if LZ4_VERSION_MAJOR >= 1 && LZ4_VERSION_MINOR >= 7 + outsize = LZ4_compress_default(p, data->out + 4, + (int)length, (int)data->block_size); +#else + outsize = LZ4_compress_limitedOutput(p, data->out + 4, + (int)length, (int)data->block_size); +#endif + + if (outsize) { + /* The buffer is compressed. */ + archive_le32enc(data->out, outsize); + data->out += 4; + } else { + /* The buffer is not compressed. The commpressed size was + * bigger than its uncompressed size. */ + archive_le32enc(data->out, length | 0x80000000); + data->out += 4; + memcpy(data->out, p, length); + outsize = length; + } + data->out += outsize; + if (data->block_checksum) { + unsigned int checksum = + __archive_xxhash.XXH32(data->out - outsize, outsize, 0); + archive_le32enc(data->out, checksum); + data->out += 4; + } + return (ARCHIVE_OK); +} + +static int +drive_compressor_dependence(struct archive_write_filter *f, const char *p, + size_t length) +{ + struct private_data *data = (struct private_data *)f->data; + int outsize; + +#define DICT_SIZE (64 * 1024) +#ifdef HAVE_LZ4HC_H + if (data->compression_level >= 3) { + if (data->lz4_stream == NULL) { +#if LZ4_VERSION_MAJOR >= 1 && LZ4_VERSION_MINOR >= 7 + data->lz4_stream = LZ4_createStreamHC(); + LZ4_resetStreamHC(data->lz4_stream, data->compression_level); +#else + data->lz4_stream = + LZ4_createHC(data->in_buffer_allocated); +#endif + if (data->lz4_stream == NULL) { + archive_set_error(f->archive, ENOMEM, + "Can't allocate data for compression" + " buffer"); + return (ARCHIVE_FATAL); + } + } + else + LZ4_loadDictHC(data->lz4_stream, data->in_buffer_allocated, DICT_SIZE); + +#if LZ4_VERSION_MAJOR >= 1 && LZ4_VERSION_MINOR >= 7 + outsize = LZ4_compress_HC_continue( + data->lz4_stream, p, data->out + 4, (int)length, + (int)data->block_size); +#else + outsize = LZ4_compressHC2_limitedOutput_continue( + data->lz4_stream, p, data->out + 4, (int)length, + (int)data->block_size, data->compression_level); +#endif + } else +#endif + { + if (data->lz4_stream == NULL) { + data->lz4_stream = LZ4_createStream(); + if (data->lz4_stream == NULL) { + archive_set_error(f->archive, ENOMEM, + "Can't allocate data for compression" + " buffer"); + return (ARCHIVE_FATAL); + } + } + else + LZ4_loadDict(data->lz4_stream, data->in_buffer_allocated, DICT_SIZE); + +#if LZ4_VERSION_MAJOR >= 1 && LZ4_VERSION_MINOR >= 7 + outsize = LZ4_compress_fast_continue( + data->lz4_stream, p, data->out + 4, (int)length, + (int)data->block_size, 1); +#else + outsize = LZ4_compress_limitedOutput_continue( + data->lz4_stream, p, data->out + 4, (int)length, + (int)data->block_size); +#endif + } + + if (outsize) { + /* The buffer is compressed. */ + archive_le32enc(data->out, outsize); + data->out += 4; + } else { + /* The buffer is not compressed. The commpressed size was + * bigger than its uncompressed size. */ + archive_le32enc(data->out, length | 0x80000000); + data->out += 4; + memcpy(data->out, p, length); + outsize = length; + } + data->out += outsize; + if (data->block_checksum) { + unsigned int checksum = + __archive_xxhash.XXH32(data->out - outsize, outsize, 0); + archive_le32enc(data->out, checksum); + data->out += 4; + } + + if (length == data->block_size) { +#ifdef HAVE_LZ4HC_H + if (data->compression_level >= 3) { +#if LZ4_VERSION_MAJOR >= 1 && LZ4_VERSION_MINOR >= 7 + LZ4_saveDictHC(data->lz4_stream, data->in_buffer_allocated, DICT_SIZE); +#else + LZ4_slideInputBufferHC(data->lz4_stream); +#endif + data->in_buffer = data->in_buffer_allocated + DICT_SIZE; + } + else +#endif + LZ4_saveDict(data->lz4_stream, + data->in_buffer_allocated, DICT_SIZE); +#undef DICT_SIZE + } + return (ARCHIVE_OK); +} + +#else /* HAVE_LIBLZ4 */ + +static int +archive_filter_lz4_open(struct archive_write_filter *f) +{ + struct private_data *data = (struct private_data *)f->data; + struct archive_string as; + int r; + + archive_string_init(&as); + archive_strcpy(&as, "lz4 -z -q -q"); + + /* Specify a compression level. */ + if (data->compression_level > 0) { + archive_strcat(&as, " -"); + archive_strappend_char(&as, '0' + data->compression_level); + } + /* Specify a block size. */ + archive_strcat(&as, " -B"); + archive_strappend_char(&as, '0' + data->block_maximum_size); + + if (data->block_checksum) + archive_strcat(&as, " -BX"); + if (data->stream_checksum == 0) + archive_strcat(&as, " --no-frame-crc"); + if (data->block_independence == 0) + archive_strcat(&as, " -BD"); + + f->write = archive_filter_lz4_write; + + r = __archive_write_program_open(f, data->pdata, as.s); + archive_string_free(&as); + return (r); +} + +static int +archive_filter_lz4_write(struct archive_write_filter *f, const void *buff, + size_t length) +{ + struct private_data *data = (struct private_data *)f->data; + + return __archive_write_program_write(f, data->pdata, buff, length); +} + +static int +archive_filter_lz4_close(struct archive_write_filter *f) +{ + struct private_data *data = (struct private_data *)f->data; + + return __archive_write_program_close(f, data->pdata); +} + +static int +archive_filter_lz4_free(struct archive_write_filter *f) +{ + struct private_data *data = (struct private_data *)f->data; + + __archive_write_program_free(data->pdata); + free(data); + return (ARCHIVE_OK); +} + +#endif /* HAVE_LIBLZ4 */ diff --git a/libarchive/archive_write_add_filter_lzop.c b/libarchive/archive_write_add_filter_lzop.c index 088ecea5167a..ad705c4a0687 100644 --- a/libarchive/archive_write_add_filter_lzop.c +++ b/libarchive/archive_write_add_filter_lzop.c @@ -85,7 +85,7 @@ static int archive_write_lzop_free(struct archive_write_filter *); #if defined(HAVE_LZO_LZOCONF_H) && defined(HAVE_LZO_LZO1X_H) /* Maximum block size. */ #define BLOCK_SIZE (256 * 1024) -/* Block infomation is composed of uncompressed size(4 bytes), +/* Block information is composed of uncompressed size(4 bytes), * compressed size(4 bytes) and the checksum of uncompressed data(4 bytes) * in this lzop writer. */ #define BLOCK_INfO_SIZE 12 @@ -173,7 +173,7 @@ archive_write_add_filter_lzop(struct archive *_a) data->compression_level = 5; return (ARCHIVE_OK); #else - data->pdata = __archive_write_program_allocate(); + data->pdata = __archive_write_program_allocate("lzop"); if (data->pdata == NULL) { free(data); archive_set_error(_a, ENOMEM, "Can't allocate memory"); diff --git a/libarchive/archive_write_add_filter_program.c b/libarchive/archive_write_add_filter_program.c index fc232da0cb5e..31a1b6f96786 100644 --- a/libarchive/archive_write_add_filter_program.c +++ b/libarchive/archive_write_add_filter_program.c @@ -68,6 +68,7 @@ struct archive_write_program_data { char *child_buf; size_t child_buf_len, child_buf_avail; + char *program_name; }; struct private_data { @@ -105,7 +106,7 @@ archive_write_add_filter_program(struct archive *_a, const char *cmd) if (data->cmd == NULL) goto memerr; - data->pdata = __archive_write_program_allocate(); + data->pdata = __archive_write_program_allocate(cmd); if (data->pdata == NULL) goto memerr; @@ -174,7 +175,7 @@ archive_compressor_program_free(struct archive_write_filter *f) * Allocate resources for executing an external program. */ struct archive_write_program_data * -__archive_write_program_allocate(void) +__archive_write_program_allocate(const char *program) { struct archive_write_program_data *data; @@ -183,6 +184,7 @@ __archive_write_program_allocate(void) return (data); data->child_stdin = -1; data->child_stdout = -1; + data->program_name = strdup(program); return (data); } @@ -231,7 +233,7 @@ __archive_write_program_open(struct archive_write_filter *f, &data->child_stdout); if (child == -1) { archive_set_error(f->archive, EINVAL, - "Can't initialise filter"); + "Can't launch external program: %s", cmd); return (ARCHIVE_FATAL); } #if defined(_WIN32) && !defined(__CYGWIN__) @@ -242,7 +244,7 @@ __archive_write_program_open(struct archive_write_filter *f, close(data->child_stdout); data->child_stdout = -1; archive_set_error(f->archive, EINVAL, - "Can't initialise filter"); + "Can't launch external program: %s", cmd); return (ARCHIVE_FATAL); } #else @@ -334,7 +336,7 @@ __archive_write_program_write(struct archive_write_filter *f, ret = child_write(f, data, buf, length); if (ret == -1 || ret == 0) { archive_set_error(f->archive, EIO, - "Can't write to filter"); + "Can't write to program: %s", data->program_name); return (ARCHIVE_FATAL); } length -= ret; @@ -373,7 +375,7 @@ __archive_write_program_close(struct archive_write_filter *f, if (bytes_read == -1) { archive_set_error(f->archive, errno, - "Read from filter failed unexpectedly."); + "Error reading from program: %s", data->program_name); ret = ARCHIVE_FATAL; goto cleanup; } @@ -403,7 +405,7 @@ __archive_write_program_close(struct archive_write_filter *f, if (status != 0) { archive_set_error(f->archive, EIO, - "Filter exited with failure."); + "Error closing program: %s", data->program_name); ret = ARCHIVE_FATAL; } r1 = __archive_write_close_filter(f->next_filter); diff --git a/libarchive/archive_write_add_filter_xz.c b/libarchive/archive_write_add_filter_xz.c index fa73311e7ef4..46a6c38aa6e1 100644 --- a/libarchive/archive_write_add_filter_xz.c +++ b/libarchive/archive_write_add_filter_xz.c @@ -100,6 +100,7 @@ archive_write_add_filter_lzip(struct archive *a) struct private_data { int compression_level; + uint32_t threads; lzma_stream stream; lzma_filter lzmafilters[2]; lzma_options_lzma lzma_opt; @@ -151,6 +152,7 @@ common_setup(struct archive_write_filter *f) } f->data = data; data->compression_level = LZMA_PRESET_DEFAULT; + data->threads = 1; f->open = &archive_compressor_xz_open; f->close = archive_compressor_xz_close; f->free = archive_compressor_xz_free; @@ -221,23 +223,37 @@ archive_compressor_xz_init_stream(struct archive_write_filter *f, { static const lzma_stream lzma_stream_init_data = LZMA_STREAM_INIT; int ret; +#ifdef HAVE_LZMA_STREAM_ENCODER_MT + lzma_mt mt_options; +#endif data->stream = lzma_stream_init_data; data->stream.next_out = data->compressed; data->stream.avail_out = data->compressed_buffer_size; - if (f->code == ARCHIVE_FILTER_XZ) - ret = lzma_stream_encoder(&(data->stream), - data->lzmafilters, LZMA_CHECK_CRC64); - else if (f->code == ARCHIVE_FILTER_LZMA) + if (f->code == ARCHIVE_FILTER_XZ) { +#ifdef HAVE_LZMA_STREAM_ENCODER_MT + if (data->threads != 1) { + bzero(&mt_options, sizeof(mt_options)); + mt_options.threads = data->threads; + mt_options.timeout = 300; + mt_options.filters = data->lzmafilters; + mt_options.check = LZMA_CHECK_CRC64; + ret = lzma_stream_encoder_mt(&(data->stream), + &mt_options); + } else +#endif + ret = lzma_stream_encoder(&(data->stream), + data->lzmafilters, LZMA_CHECK_CRC64); + } else if (f->code == ARCHIVE_FILTER_LZMA) { ret = lzma_alone_encoder(&(data->stream), &data->lzma_opt); - else { /* ARCHIVE_FILTER_LZIP */ + } else { /* ARCHIVE_FILTER_LZIP */ int dict_size = data->lzma_opt.dict_size; int ds, log2dic, wedges; /* Calculate a coded dictionary size */ if (dict_size < (1 << 12) || dict_size > (1 << 27)) { archive_set_error(f->archive, ARCHIVE_ERRNO_MISC, - "Unacceptable dictionary dize for lzip: %d", + "Unacceptable dictionary size for lzip: %d", dict_size); return (ARCHIVE_FATAL); } @@ -373,6 +389,22 @@ archive_compressor_xz_options(struct archive_write_filter *f, if (data->compression_level > 6) data->compression_level = 6; return (ARCHIVE_OK); + } else if (strcmp(key, "threads") == 0) { + if (value == NULL) + return (ARCHIVE_WARN); + data->threads = (int)strtoul(value, NULL, 10); + if (data->threads == 0 && errno != 0) { + data->threads = 1; + return (ARCHIVE_WARN); + } + if (data->threads == 0) { +#ifdef HAVE_LZMA_STREAM_ENCODER_MT + data->threads = lzma_cputhreads(); +#else + data->threads = 1; +#endif + } + return (ARCHIVE_OK); } /* Note: The "warn" return is just to inform the options diff --git a/libarchive/archive_write_data.3 b/libarchive/archive_write_data.3 index cfd5cd552d05..0cdd25f1f923 100644 --- a/libarchive/archive_write_data.3 +++ b/libarchive/archive_write_data.3 @@ -34,7 +34,7 @@ Streaming Archive Library (libarchive, -larchive) .Sh SYNOPSIS .In archive.h -.Ft ssize_t +.Ft la_ssize_t .Fn archive_write_data "struct archive *" "const void *" "size_t" .Sh DESCRIPTION Write data corresponding to the header just written. @@ -42,8 +42,7 @@ Write data corresponding to the header just written. .\" .Sh RETURN VALUES This function returns the number of bytes actually written, or -.Li -1 -on error. +a negative error code on error. .\" .Sh ERRORS Detailed error codes and textual descriptions are available from the @@ -52,6 +51,15 @@ and .Fn archive_error_string functions. .\" +.Sh BUGS +In libarchive 3.x, this function sometimes returns +zero on success instead of returning the number of bytes written. +Specifically, this occurs when writing to an +.Vt archive_write_disk +handle. +Clients should treat any value less than zero as an error +and consider any non-negative value as success. +.\" .Sh SEE ALSO .Xr tar 1 , .Xr libarchive 3 , diff --git a/libarchive/archive_write_disk.3 b/libarchive/archive_write_disk.3 index fa925cc543dc..ba6c9706e8a3 100644 --- a/libarchive/archive_write_disk.3 +++ b/libarchive/archive_write_disk.3 @@ -70,9 +70,9 @@ Streaming Archive Library (libarchive, -larchive) .Fc .Ft int .Fn archive_write_header "struct archive *" "struct archive_entry *" -.Ft ssize_t +.Ft la_ssize_t .Fn archive_write_data "struct archive *" "const void *" "size_t" -.Ft ssize_t +.Ft la_ssize_t .Fn archive_write_data_block "struct archive *" "const void *" "size_t size" "int64_t offset" .Ft int .Fn archive_write_finish_entry "struct archive *" @@ -177,10 +177,16 @@ The default is to not refuse such paths. Note that paths ending in .Pa .. always cause an error, regardless of this flag. +.It Cm ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS +Refuse to extract an absolute path. +The default is to not refuse such paths. .It Cm ARCHIVE_EXTRACT_SPARSE Scan data for blocks of NUL bytes and try to recreate them with holes. This results in sparse files, independent of whether the archive format supports or uses them. +.It Cm ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS +Before removing a file system object prior to replacing it, clear +platform-specific file flags which might prevent its removal. .El .It Xo .Fn archive_write_disk_set_group_lookup , diff --git a/libarchive/archive_write_disk_acl.c b/libarchive/archive_write_disk_acl.c index 97972033c080..5cbba54f08fd 100644 --- a/libarchive/archive_write_disk_acl.c +++ b/libarchive/archive_write_disk_acl.c @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_disk.c 201159 2009-12-29 0 #include "archive_acl_private.h" #include "archive_write_disk_private.h" -#if !defined(HAVE_POSIX_ACL) || !defined(ACL_TYPE_NFS4) +#ifndef HAVE_POSIX_ACL /* Default empty function body to satisfy mainline code. */ int archive_write_disk_set_acls(struct archive *a, int fd, const char *name, @@ -79,10 +79,12 @@ archive_write_disk_set_acls(struct archive *a, int fd, const char *name, ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_DEFAULT, ARCHIVE_ENTRY_ACL_TYPE_DEFAULT, "default"); return (ret); +#ifdef ACL_TYPE_NFS4 } else if (archive_acl_count(abstract_acl, ARCHIVE_ENTRY_ACL_TYPE_NFS4) > 0) { ret = set_acl(a, fd, name, abstract_acl, ACL_TYPE_NFS4, ARCHIVE_ENTRY_ACL_TYPE_NFS4, "nfs4"); return (ret); +#endif } else return ARCHIVE_OK; } @@ -94,6 +96,7 @@ static struct { {ARCHIVE_ENTRY_ACL_EXECUTE, ACL_EXECUTE}, {ARCHIVE_ENTRY_ACL_WRITE, ACL_WRITE}, {ARCHIVE_ENTRY_ACL_READ, ACL_READ}, +#ifdef ACL_TYPE_NFS4 {ARCHIVE_ENTRY_ACL_READ_DATA, ACL_READ_DATA}, {ARCHIVE_ENTRY_ACL_LIST_DIRECTORY, ACL_LIST_DIRECTORY}, {ARCHIVE_ENTRY_ACL_WRITE_DATA, ACL_WRITE_DATA}, @@ -110,8 +113,10 @@ static struct { {ARCHIVE_ENTRY_ACL_WRITE_ACL, ACL_WRITE_ACL}, {ARCHIVE_ENTRY_ACL_WRITE_OWNER, ACL_WRITE_OWNER}, {ARCHIVE_ENTRY_ACL_SYNCHRONIZE, ACL_SYNCHRONIZE} +#endif }; +#ifdef ACL_TYPE_NFS4 static struct { int archive_inherit; int platform_inherit; @@ -121,6 +126,7 @@ static struct { {ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT, ACL_ENTRY_NO_PROPAGATE_INHERIT}, {ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY, ACL_ENTRY_INHERIT_ONLY} }; +#endif static int set_acl(struct archive *a, int fd, const char *name, @@ -130,7 +136,9 @@ set_acl(struct archive *a, int fd, const char *name, acl_t acl; acl_entry_t acl_entry; acl_permset_t acl_permset; +#ifdef ACL_TYPE_NFS4 acl_flagset_t acl_flagset; +#endif int ret; int ae_type, ae_permset, ae_tag, ae_id; uid_t ae_uid; @@ -171,14 +179,17 @@ set_acl(struct archive *a, int fd, const char *name, case ARCHIVE_ENTRY_ACL_OTHER: acl_set_tag_type(acl_entry, ACL_OTHER); break; +#ifdef ACL_TYPE_NFS4 case ARCHIVE_ENTRY_ACL_EVERYONE: acl_set_tag_type(acl_entry, ACL_EVERYONE); break; +#endif default: /* XXX */ break; } +#ifdef ACL_TYPE_NFS4 switch (ae_type) { case ARCHIVE_ENTRY_ACL_TYPE_ALLOW: acl_set_entry_type_np(acl_entry, ACL_ENTRY_TYPE_ALLOW); @@ -200,6 +211,7 @@ set_acl(struct archive *a, int fd, const char *name, // XXX error handling here. break; } +#endif acl_get_permset(acl_entry, &acl_permset); acl_clear_perms(acl_permset); @@ -210,6 +222,7 @@ set_acl(struct archive *a, int fd, const char *name, acl_perm_map[i].platform_perm); } +#ifdef ACL_TYPE_NFS4 acl_get_flagset_np(acl_entry, &acl_flagset); acl_clear_flags_np(acl_flagset); for (i = 0; i < (int)(sizeof(acl_inherit_map) / sizeof(acl_inherit_map[0])); ++i) { @@ -217,6 +230,7 @@ set_acl(struct archive *a, int fd, const char *name, acl_add_flag_np(acl_flagset, acl_inherit_map[i].platform_inherit); } +#endif } /* Try restoring the ACL through 'fd' if we can. */ diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c index bbd50a637648..6737cd755b22 100644 --- a/libarchive/archive_write_disk_posix.c +++ b/libarchive/archive_write_disk_posix.c @@ -343,6 +343,7 @@ static int restore_entry(struct archive_write_disk *); static int set_mac_metadata(struct archive_write_disk *, const char *, const void *, size_t); static int set_xattrs(struct archive_write_disk *); +static int clear_nochange_fflags(struct archive_write_disk *); static int set_fflags(struct archive_write_disk *); static int set_fflags_platform(struct archive_write_disk *, int fd, const char *name, mode_t mode, @@ -1467,10 +1468,14 @@ _archive_write_disk_data_block(struct archive *_a, return (r); if ((size_t)r < size) { archive_set_error(&a->archive, 0, - "Write request too large"); + "Too much data: Truncating file at %ju bytes", (uintmax_t)a->filesize); return (ARCHIVE_WARN); } +#if ARCHIVE_VERSION_NUMBER < 3999000 return (ARCHIVE_OK); +#else + return (size); +#endif } static ssize_t @@ -1842,6 +1847,8 @@ restore_entry(struct archive_write_disk *a) * object is a dir, but that doesn't mean the old * object isn't a dir. */ + if (a->flags & ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS) + (void)clear_nochange_fflags(a); if (unlink(a->name) == 0) { /* We removed it, reset cached stat. */ a->pst = NULL; @@ -1869,6 +1876,13 @@ restore_entry(struct archive_write_disk *a) en = create_filesystem_object(a); } + if ((en == ENOENT) && (archive_entry_hardlink(a->entry) != NULL)) { + archive_set_error(&a->archive, en, + "Hard-link target '%s' does not exist.", + archive_entry_hardlink(a->entry)); + return (ARCHIVE_FAILED); + } + if ((en == EISDIR || en == EEXIST) && (a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE)) { /* If we're not overwriting, we're done. */ @@ -1940,6 +1954,8 @@ restore_entry(struct archive_write_disk *a) if (!S_ISDIR(a->st.st_mode)) { /* A non-dir is in the way, unlink it. */ + if (a->flags & ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS) + (void)clear_nochange_fflags(a); if (unlink(a->name) != 0) { archive_set_error(&a->archive, errno, "Can't unlink already-existing object"); @@ -1950,6 +1966,8 @@ restore_entry(struct archive_write_disk *a) en = create_filesystem_object(a); } else if (!S_ISDIR(a->mode)) { /* A dir is in the way of a non-dir, rmdir it. */ + if (a->flags & ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS) + (void)clear_nochange_fflags(a); if (rmdir(a->name) != 0) { archive_set_error(&a->archive, errno, "Can't replace existing directory with non-directory"); @@ -2215,7 +2233,8 @@ _archive_write_disk_free(struct archive *_a) free(a->resource_fork); free(a->compressed_buffer); free(a->uncompressed_buffer); -#ifdef HAVE_ZLIB_H +#if defined(__APPLE__) && defined(UF_COMPRESSED) && defined(HAVE_SYS_XATTR_H)\ + && defined(HAVE_ZLIB_H) if (a->stream_valid) { switch (deflateEnd(&a->stream)) { case Z_OK: @@ -2367,6 +2386,9 @@ check_symlinks(struct archive_write_disk *a) while ((*pn != '\0') && (*p == *pn)) ++p, ++pn; } + /* Skip the root directory if the path is absolute. */ + if(pn == a->name && pn[0] == '/') + ++pn; c = pn[0]; /* Keep going until we've checked the entire name. */ while (pn[0] != '\0' && (pn[0] != '/' || pn[1] != '\0')) { @@ -2428,6 +2450,9 @@ check_symlinks(struct archive_write_disk *a) return (ARCHIVE_FAILED); } } + pn[0] = c; + if (pn[0] != '\0') + pn++; /* Advance to the next segment. */ } pn[0] = c; /* We've checked and/or cleaned the whole path, so remember it. */ @@ -2504,8 +2529,9 @@ cleanup_pathname_win(struct archive_write_disk *a) /* * Canonicalize the pathname. In particular, this strips duplicate * '/' characters, '.' elements, and trailing '/'. It also raises an - * error for an empty path, a trailing '..' or (if _SECURE_NODOTDOT is - * set) any '..' in the path. + * error for an empty path, a trailing '..', (if _SECURE_NODOTDOT is + * set) any '..' in the path or (if ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS + * is set) if the path is absolute. */ static int cleanup_pathname(struct archive_write_disk *a) @@ -2524,8 +2550,15 @@ cleanup_pathname(struct archive_write_disk *a) cleanup_pathname_win(a); #endif /* Skip leading '/'. */ - if (*src == '/') + if (*src == '/') { + if (a->flags & ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Path is absolute"); + return (ARCHIVE_FAILED); + } + separator = *src++; + } /* Scan the pathname one element at a time. */ for (;;) { @@ -2861,7 +2894,7 @@ set_time(int fd, int mode, const char *name, #endif } -#ifdef F_SETTIMES /* Tru64 */ +#ifdef F_SETTIMES static int set_time_tru64(int fd, int mode, const char *name, time_t atime, long atime_nsec, @@ -2869,19 +2902,21 @@ set_time_tru64(int fd, int mode, const char *name, time_t ctime, long ctime_nsec) { struct attr_timbuf tstamp; - struct timeval times[3]; - times[0].tv_sec = atime; - times[0].tv_usec = atime_nsec / 1000; - times[1].tv_sec = mtime; - times[1].tv_usec = mtime_nsec / 1000; - times[2].tv_sec = ctime; - times[2].tv_usec = ctime_nsec / 1000; - tstamp.atime = times[0]; - tstamp.mtime = times[1]; - tstamp.ctime = times[2]; + tstamp.atime.tv_sec = atime; + tstamp.mtime.tv_sec = mtime; + tstamp.ctime.tv_sec = ctime; +#if defined (__hpux) && defined (__ia64) + tstamp.atime.tv_nsec = atime_nsec; + tstamp.mtime.tv_nsec = mtime_nsec; + tstamp.ctime.tv_nsec = ctime_nsec; +#else + tstamp.atime.tv_usec = atime_nsec / 1000; + tstamp.mtime.tv_usec = mtime_nsec / 1000; + tstamp.ctime.tv_usec = ctime_nsec / 1000; +#endif return (fcntl(fd,F_SETTIMES,&tstamp)); } -#endif /* Tru64 */ +#endif /* F_SETTIMES */ static int set_times(struct archive_write_disk *a, @@ -3053,9 +3088,23 @@ set_mode(struct archive_write_disk *a, int mode) * impact. */ if (lchmod(a->name, mode) != 0) { - archive_set_error(&a->archive, errno, - "Can't set permissions to 0%o", (int)mode); - r = ARCHIVE_WARN; + switch (errno) { + case ENOTSUP: + case ENOSYS: +#if ENOTSUP != EOPNOTSUPP + case EOPNOTSUPP: +#endif + /* + * if lchmod is defined but the platform + * doesn't support it, silently ignore + * error + */ + break; + default: + archive_set_error(&a->archive, errno, + "Can't set permissions to 0%o", (int)mode); + r = ARCHIVE_WARN; + } } #endif } else if (!S_ISDIR(a->mode)) { @@ -3156,6 +3205,36 @@ set_fflags(struct archive_write_disk *a) return (ARCHIVE_OK); } +static int +clear_nochange_fflags(struct archive_write_disk *a) +{ + int nochange_flags; + mode_t mode = archive_entry_mode(a->entry); + + /* Hopefully, the compiler will optimize this mess into a constant. */ + nochange_flags = 0; +#ifdef SF_IMMUTABLE + nochange_flags |= SF_IMMUTABLE; +#endif +#ifdef UF_IMMUTABLE + nochange_flags |= UF_IMMUTABLE; +#endif +#ifdef SF_APPEND + nochange_flags |= SF_APPEND; +#endif +#ifdef UF_APPEND + nochange_flags |= UF_APPEND; +#endif +#ifdef EXT2_APPEND_FL + nochange_flags |= EXT2_APPEND_FL; +#endif +#ifdef EXT2_IMMUTABLE_FL + nochange_flags |= EXT2_IMMUTABLE_FL; +#endif + + return (set_fflags_platform(a, a->fd, a->name, mode, 0, nochange_flags)); +} + #if ( defined(HAVE_LCHFLAGS) || defined(HAVE_CHFLAGS) || defined(HAVE_FCHFLAGS) ) && defined(HAVE_STRUCT_STAT_ST_FLAGS) /* @@ -3363,6 +3442,7 @@ copy_xattrs(struct archive_write_disk *a, int tmpfd, int dffd) } for (xattr_i = 0; xattr_i < xattr_size; xattr_i += strlen(xattr_names + xattr_i) + 1) { + char *xattr_val_saved; ssize_t s; int f; @@ -3373,11 +3453,13 @@ copy_xattrs(struct archive_write_disk *a, int tmpfd, int dffd) ret = ARCHIVE_WARN; goto exit_xattr; } + xattr_val_saved = xattr_val; xattr_val = realloc(xattr_val, s); if (xattr_val == NULL) { archive_set_error(&a->archive, ENOMEM, "Failed to get metadata(xattr)"); ret = ARCHIVE_WARN; + free(xattr_val_saved); goto exit_xattr; } s = fgetxattr(tmpfd, xattr_names + xattr_i, xattr_val, s, 0, 0); diff --git a/libarchive/archive_write_disk_set_standard_lookup.c b/libarchive/archive_write_disk_set_standard_lookup.c index e79008ef6b25..3b868fbad195 100644 --- a/libarchive/archive_write_disk_set_standard_lookup.c +++ b/libarchive/archive_write_disk_set_standard_lookup.c @@ -67,7 +67,7 @@ static void cleanup(void *); * a simple cache to accelerate such lookups---into the archive_write_disk * object. This is in a separate file because getpwnam()/getgrnam() * can pull in a LOT of library code (including NIS/LDAP functions, which - * pull in DNS resolveers, etc). This can easily top 500kB, which makes + * pull in DNS resolvers, etc). This can easily top 500kB, which makes * it inappropriate for some space-constrained applications. * * Applications that are size-sensitive may want to just use the @@ -86,6 +86,11 @@ archive_write_disk_set_standard_lookup(struct archive *a) { struct bucket *ucache = malloc(cache_size * sizeof(struct bucket)); struct bucket *gcache = malloc(cache_size * sizeof(struct bucket)); + if (ucache == NULL || gcache == NULL) { + free(ucache); + free(gcache); + return (ARCHIVE_FATAL); + } memset(ucache, 0, cache_size * sizeof(struct bucket)); memset(gcache, 0, cache_size * sizeof(struct bucket)); archive_write_disk_set_group_lookup(a, gcache, lookup_gid, cleanup); diff --git a/libarchive/archive_write_disk_windows.c b/libarchive/archive_write_disk_windows.c index 0f0780a8e47e..800aa893f420 100644 --- a/libarchive/archive_write_disk_windows.c +++ b/libarchive/archive_write_disk_windows.c @@ -330,8 +330,6 @@ file_information(struct archive_write_disk *a, wchar_t *path, break; case L'C': case L'c': if (((p[2] == L'M' || p[2] == L'm' ) && - (p[3] == L'D' || p[3] == L'd' )) || - ((p[2] == L'M' || p[2] == L'm' ) && (p[3] == L'D' || p[3] == L'd' ))) *mode |= S_IXUSR | S_IXGRP | S_IXOTH; break; @@ -525,7 +523,7 @@ la_GetFunctionKernel32(const char *name) static int set; if (!set) { set = 1; - lib = LoadLibrary("kernel32.dll"); + lib = LoadLibrary(TEXT("kernel32.dll")); } if (lib == NULL) { fprintf(stderr, "Can't load kernel32.dll?!\n"); @@ -1011,7 +1009,11 @@ _archive_write_disk_data_block(struct archive *_a, "Write request too large"); return (ARCHIVE_WARN); } +#if ARCHIVE_VERSION_NUMBER < 3999000 return (ARCHIVE_OK); +#else + return (size); +#endif } static ssize_t diff --git a/libarchive/archive_write_filter.3 b/libarchive/archive_write_filter.3 index 3ca248b72a9d..869dc46b6977 100644 --- a/libarchive/archive_write_filter.3 +++ b/libarchive/archive_write_filter.3 @@ -24,50 +24,79 @@ .\" .\" $FreeBSD$ .\" -.Dd February 2, 2012 +.Dd August 14, 2014 .Dt ARCHIVE_WRITE_FILTER 3 .Os .Sh NAME +.Nm archive_write_add_filter_b64encode , +.Nm archive_write_add_filter_by_name , .Nm archive_write_add_filter_bzip2 , .Nm archive_write_add_filter_compress , +.Nm archive_write_add_filter_grzip , .Nm archive_write_add_filter_gzip , +.Nm archive_write_add_filter_lrzip , +.Nm archive_write_add_filter_lz4 , .Nm archive_write_add_filter_lzip , .Nm archive_write_add_filter_lzma , +.Nm archive_write_add_filter_lzop , .Nm archive_write_add_filter_none , .Nm archive_write_add_filter_program , +.Nm archive_write_add_filter_uuencode , .Nm archive_write_add_filter_xz .Sh LIBRARY Streaming Archive Library (libarchive, -larchive) .Sh SYNOPSIS .In archive.h .Ft int +.Fn archive_write_add_filter_b64encode "struct archive *" +.Ft int .Fn archive_write_add_filter_bzip2 "struct archive *" .Ft int .Fn archive_write_add_filter_compress "struct archive *" .Ft int +.Fn archive_write_add_filter_grzip "struct archive *" +.Ft int .Fn archive_write_add_filter_gzip "struct archive *" .Ft int +.Fn archive_write_add_filter_lrzip "struct archive *" +.Ft int +.Fn archive_write_add_filter_lz4 "struct archive *" +.Ft int .Fn archive_write_add_filter_lzip "struct archive *" .Ft int .Fn archive_write_add_filter_lzma "struct archive *" .Ft int +.Fn archive_write_add_filter_lzop "struct archive *" +.Ft int .Fn archive_write_add_filter_none "struct archive *" .Ft int .Fn archive_write_add_filter_program "struct archive *" "const char * cmd" .Ft int +.Fn archive_write_add_filter_uuencode "struct archive *" +.Ft int .Fn archive_write_add_filter_xz "struct archive *" .Sh DESCRIPTION .Bl -tag -width indent .It Xo .Fn archive_write_add_filter_bzip2 , .Fn archive_write_add_filter_compress , +.Fn archive_write_add_filter_grzip , .Fn archive_write_add_filter_gzip , +.Fn archive_write_add_filter_lrzip , +.Fn archive_write_add_filter_lz4 , .Fn archive_write_add_filter_lzip , .Fn archive_write_add_filter_lzma , +.Fn archive_write_add_filter_lzop , .Fn archive_write_add_filter_xz , .Xc The resulting archive will be compressed as specified. Note that the compressed output is always properly blocked. +.It Xo +.Fn archive_write_add_filter_b64encode , +.Fn archive_write_add_filter_uuencode , +.Xc +The output will be encoded as specified. +The encoded output is always properly blocked. .It Fn archive_write_add_filter_none This is never necessary. It is provided only for backwards compatibility. diff --git a/libarchive/archive_write_finish_entry.3 b/libarchive/archive_write_finish_entry.3 index d881c80ea4a8..c5ef69ebc941 100644 --- a/libarchive/archive_write_finish_entry.3 +++ b/libarchive/archive_write_finish_entry.3 @@ -41,7 +41,7 @@ Close out the entry just written. In particular, this writes out the final padding required by some formats. Ordinarily, clients never need to call this, as it is called automatically by -.Fn archive_write_next_header +.Fn archive_write_header and .Fn archive_write_close as needed. diff --git a/libarchive/archive_write_format.3 b/libarchive/archive_write_format.3 index dad2f7d7eb31..d4ba6abff5a0 100644 --- a/libarchive/archive_write_format.3 +++ b/libarchive/archive_write_format.3 @@ -24,58 +24,133 @@ .\" .\" $FreeBSD$ .\" -.Dd February 2, 2012 +.Dd February 14, 2013 .Dt ARCHIVE_WRITE_FORMAT 3 .Os .Sh NAME +.Nm archive_write_set_format , +.Nm archive_write_set_format_7zip , +.Nm archive_write_set_format_ar , +.Nm archive_write_set_format_ar_bsd , +.Nm archive_write_set_format_ar_svr4 , +.Nm archive_write_set_format_by_name , .Nm archive_write_set_format_cpio , +.Nm archive_write_set_format_cpio_newc , +.Nm archive_write_set_format_filter_by_ext , +.Nm archive_write_set_format_filter_by_ext_def , +.Nm archive_write_set_format_gnutar , +.Nm archive_write_set_format_iso9660 , +.Nm archive_write_set_format_mtree , +.Nm archive_write_set_format_mtree_classic , +.Nm archive_write_set_format_mtree_default , .Nm archive_write_set_format_pax , .Nm archive_write_set_format_pax_restricted , +.Nm archive_write_set_format_raw , .Nm archive_write_set_format_shar , .Nm archive_write_set_format_shar_dump , -.Nm archive_write_set_format_ustar +.Nm archive_write_set_format_ustar , +.Nm archive_write_set_format_v7tar , +.Nm archive_write_set_format_warc , +.Nm archive_write_set_format_xar , +.Nm archive_write_set_format_zip , .Nd functions for creating archives .Sh LIBRARY Streaming Archive Library (libarchive, -larchive) .Sh SYNOPSIS .In archive.h .Ft int +.Fn archive_write_set_format "struct archive *" "int code" +.Ft int +.Fn archive_write_set_format_7zip "struct archive *" +.Ft int +.Fn archive_write_set_format_ar "struct archive *" +.Ft int +.Fn archive_write_set_format_ar_bsd "struct archive *" +.Ft int +.Fn archive_write_set_format_ar_svr4 "struct archive *" +.Ft int +.Fn archive_write_set_format_by_name "struct archive *" "const char *name" +.Ft int .Fn archive_write_set_format_cpio "struct archive *" .Ft int +.Fn archive_write_set_format_cpio_newc "struct archive *" +.Ft int +.Fn archive_write_set_format_filter_by_ext "struct archive *" "const char *filename" +.Ft int +.Fn archive_write_set_format_filter_by_ext_def "struct archive *" "const char *filename" "const char *def_ext" +.Ft int +.Fn archive_write_set_format_gnutar "struct archive *" +.Ft int +.Fn archive_write_set_format_iso9660 "struct archive *" +.Ft int +.Fn archive_write_set_format_mtree "struct archive *" +.Ft int .Fn archive_write_set_format_pax "struct archive *" .Ft int .Fn archive_write_set_format_pax_restricted "struct archive *" .Ft int +.Fn archive_write_set_format_raw "struct archive *" +.Ft int .Fn archive_write_set_format_shar "struct archive *" .Ft int .Fn archive_write_set_format_shar_dump "struct archive *" .Ft int .Fn archive_write_set_format_ustar "struct archive *" +.Ft int +.Fn archive_write_set_format_v7tar "struct archive *" +.Ft int +.Fn archive_write_set_format_warc "struct archive *" +.Ft int +.Fn archive_write_set_format_xar "struct archive *" +.Ft int +.Fn archive_write_set_format_zip "struct archive *" .Sh DESCRIPTION These functions set the format that will be used for the archive. .Pp -The library can write -POSIX octet-oriented cpio format archives, -POSIX-standard -.Dq pax interchange -format archives, -traditional -.Dq shar -archives, -enhanced -.Dq dump -shar archives that store a variety of file attributes and handle binary files, -and -POSIX-standard -.Dq ustar -archives. -The pax interchange format is a backwards-compatible tar format that -adds key/value attributes to each entry and supports arbitrary -filenames, linknames, uids, sizes, etc. -.Dq Restricted pax interchange format -is the library default; this is the same as pax format, but suppresses -the pax extended header for most normal files. -In most cases, this will result in ordinary ustar archives. +The library can write a variety of common archive formats. + +.Bl -tag -width indent +.It Fn archive_write_set_format +Sets the format based on the format code (see +.Pa archive.h +for the full list of format codes). +In particular, this can be used in conjunction with +.Fn archive_format +to create a new archive with the same format as an existing archive. +.It Fn archive_write_set_format_by_name +Sets the corresponding format based on the common name. +.It Xo +.Fn archive_write_set_format_filter_by_ext , +.Fn archive_write_set_format_filter_by_ext_def +.Xc +Sets both filters and format based on the output filename. +Supported extensions: .7z, .zip, .jar, .cpio, .iso, .a, .ar, .tar, .tgz, .tar.gz, .tar.bz2, .tar.xz +.It Xo +.Fn archive_write_set_format_7zip +.Fn archive_write_set_format_ar_bsd , +.Fn archive_write_set_format_ar_svr4 , +.Fn archive_write_set_format_cpio +.Fn archive_write_set_format_cpio_newc +.Fn archive_write_set_format_gnutar +.Fn archive_write_set_format_iso9660 +.Fn archive_write_set_format_mtree +.Fn archive_write_set_format_mtree_classic +.Fn archive_write_set_format_pax +.Fn archive_write_set_format_pax_restricted +.Fn archive_write_set_format_raw +.Fn archive_write_set_format_shar +.Fn archive_write_set_format_shar_dump +.Fn archive_write_set_format_ustar +.Fn archive_write_set_format_v7tar +.Fn archive_write_set_format_warc +.Fn archive_write_set_format_xar +.Fn archive_write_set_format_zip +.Xc +Set the format as specified. +More details on the formats supported by libarchive can be found in the +.Xr libarchive-formats 5 +manual page. +.El .\" .Sh RETURN VALUES These functions return @@ -96,5 +171,6 @@ functions. .Xr archive_write 3 , .Xr archive_write_set_options 3 , .Xr cpio 5 , +.Xr libarchive-formats 5 , .Xr mtree 5 , .Xr tar 5 diff --git a/libarchive/archive_write_open.3 b/libarchive/archive_write_open.3 index 4037248e0e04..a52959b98fcb 100644 --- a/libarchive/archive_write_open.3 +++ b/libarchive/archive_write_open.3 @@ -154,7 +154,7 @@ to register an error code and message and return .Cm ARCHIVE_FATAL . .Bl -item -offset indent .It -.Ft typedef ssize_t +.Ft typedef la_ssize_t .Fo archive_write_callback .Fa "struct archive *" .Fa "void *client_data" diff --git a/libarchive/archive_write_open_filename.c b/libarchive/archive_write_open_filename.c index 196b770e8e83..66e0dfee9f3d 100644 --- a/libarchive/archive_write_open_filename.c +++ b/libarchive/archive_write_open_filename.c @@ -243,7 +243,10 @@ file_close(struct archive *a, void *client_data) struct write_file_data *mine = (struct write_file_data *)client_data; (void)a; /* UNUSED */ - close(mine->fd); + + if (mine->fd >= 0) + close(mine->fd); + archive_mstring_clean(&mine->filename); free(mine); return (ARCHIVE_OK); diff --git a/libarchive/archive_write_private.h b/libarchive/archive_write_private.h index e600d54749bb..0dfd1b1bca91 100644 --- a/libarchive/archive_write_private.h +++ b/libarchive/archive_write_private.h @@ -26,8 +26,10 @@ */ #ifndef __LIBARCHIVE_BUILD +#ifndef __LIBARCHIVE_TEST #error This header is only to be used internally to libarchive. #endif +#endif #ifndef ARCHIVE_WRITE_PRIVATE_H_INCLUDED #define ARCHIVE_WRITE_PRIVATE_H_INCLUDED @@ -116,6 +118,14 @@ struct archive_write { const void *buff, size_t); int (*format_close)(struct archive_write *); int (*format_free)(struct archive_write *); + + + /* + * Encryption passphrase. + */ + char *passphrase; + archive_passphrase_callback *passphrase_callback; + void *passphrase_client_data; }; /* @@ -134,7 +144,7 @@ __archive_write_format_header_ustar(struct archive_write *, char buff[512], struct archive_string_conv *); struct archive_write_program_data; -struct archive_write_program_data * __archive_write_program_allocate(void); +struct archive_write_program_data * __archive_write_program_allocate(const char *program_name); int __archive_write_program_free(struct archive_write_program_data *); int __archive_write_program_open(struct archive_write_filter *, struct archive_write_program_data *, const char *); @@ -142,4 +152,9 @@ int __archive_write_program_close(struct archive_write_filter *, struct archive_write_program_data *); int __archive_write_program_write(struct archive_write_filter *, struct archive_write_program_data *, const void *, size_t); + +/* + * Get a encryption passphrase. + */ +const char * __archive_write_get_passphrase(struct archive_write *a); #endif diff --git a/libarchive/archive_write_set_format.c b/libarchive/archive_write_set_format.c index 641d56f6c27e..744302d06775 100644 --- a/libarchive/archive_write_set_format.c +++ b/libarchive/archive_write_set_format.c @@ -47,6 +47,7 @@ struct { int code; int (*setter)(struct archive *); } codes[] = { ARCHIVE_FORMAT_CPIO_SVR4_NOCRC, archive_write_set_format_cpio_newc }, { ARCHIVE_FORMAT_ISO9660, archive_write_set_format_iso9660 }, { ARCHIVE_FORMAT_MTREE, archive_write_set_format_mtree }, + { ARCHIVE_FORMAT_RAW, archive_write_set_format_raw }, { ARCHIVE_FORMAT_SHAR, archive_write_set_format_shar }, { ARCHIVE_FORMAT_SHAR_BASE, archive_write_set_format_shar }, { ARCHIVE_FORMAT_SHAR_DUMP, archive_write_set_format_shar_dump }, @@ -56,8 +57,9 @@ struct { int code; int (*setter)(struct archive *); } codes[] = { ARCHIVE_FORMAT_TAR_PAX_RESTRICTED, archive_write_set_format_pax_restricted }, { ARCHIVE_FORMAT_TAR_USTAR, archive_write_set_format_ustar }, + { ARCHIVE_FORMAT_WARC, archive_write_set_format_warc }, { ARCHIVE_FORMAT_XAR, archive_write_set_format_xar }, - { ARCHIVE_FORMAT_ZIP, archive_write_set_format_zip }, + { ARCHIVE_FORMAT_ZIP, archive_write_set_format_zip }, { 0, NULL } }; diff --git a/libarchive/archive_write_set_format_7zip.c b/libarchive/archive_write_set_format_7zip.c index 7847cb3c5994..fc6ccfe0ba83 100644 --- a/libarchive/archive_write_set_format_7zip.c +++ b/libarchive/archive_write_set_format_7zip.c @@ -1450,6 +1450,10 @@ _7z_free(struct archive_write *a) { struct _7zip *zip = (struct _7zip *)a->format_data; + /* Close the temporary file. */ + if (zip->temp_fd >= 0) + close(zip->temp_fd); + file_free_register(zip); compression_end(&(a->archive), &(zip->stream)); free(zip->coder.props); diff --git a/libarchive/archive_write_set_format_by_name.c b/libarchive/archive_write_set_format_by_name.c index af3105e482d6..a2ce7c6cde4e 100644 --- a/libarchive/archive_write_set_format_by_name.c +++ b/libarchive/archive_write_set_format_by_name.c @@ -63,12 +63,14 @@ struct { const char *name; int (*setter)(struct archive *); } names[] = { "pax", archive_write_set_format_pax }, { "paxr", archive_write_set_format_pax_restricted }, { "posix", archive_write_set_format_pax }, + { "raw", archive_write_set_format_raw }, { "rpax", archive_write_set_format_pax_restricted }, { "shar", archive_write_set_format_shar }, { "shardump", archive_write_set_format_shar_dump }, { "ustar", archive_write_set_format_ustar }, { "v7tar", archive_write_set_format_v7tar }, { "v7", archive_write_set_format_v7tar }, + { "warc", archive_write_set_format_warc }, { "xar", archive_write_set_format_xar }, { "zip", archive_write_set_format_zip }, { NULL, NULL } diff --git a/libarchive/archive_write_set_format_filter_by_ext.c b/libarchive/archive_write_set_format_filter_by_ext.c new file mode 100644 index 000000000000..3f3aeddef090 --- /dev/null +++ b/libarchive/archive_write_set_format_filter_by_ext.c @@ -0,0 +1,142 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2015 Okhotnikov Kirill + * 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_SYS_TYPES_H +#include +#endif + +#ifdef HAVE_ERRNO_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif + +#include "archive.h" +#include "archive_private.h" + +/* A table that maps names to functions. */ +static +struct { const char *name; int (*format)(struct archive *); int (*filter)(struct archive *); } names[] = +{ + { ".7z", archive_write_set_format_7zip, archive_write_add_filter_none}, + { ".zip", archive_write_set_format_zip, archive_write_add_filter_none}, + { ".jar", archive_write_set_format_zip, archive_write_add_filter_none}, + { ".cpio", archive_write_set_format_cpio, archive_write_add_filter_none}, + { ".iso", archive_write_set_format_iso9660, archive_write_add_filter_none}, +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) + { ".a", archive_write_set_format_ar_bsd, archive_write_add_filter_none}, + { ".ar", archive_write_set_format_ar_bsd, archive_write_add_filter_none}, +#else + { ".a", archive_write_set_format_ar_svr4, archive_write_add_filter_none}, + { ".ar", archive_write_set_format_ar_svr4, archive_write_add_filter_none}, +#endif + { ".tar", archive_write_set_format_pax_restricted, archive_write_add_filter_none}, + { ".tgz", archive_write_set_format_pax_restricted, archive_write_add_filter_gzip}, + { ".tar.gz", archive_write_set_format_pax_restricted, archive_write_add_filter_gzip}, + { ".tar.bz2", archive_write_set_format_pax_restricted, archive_write_add_filter_bzip2}, + { ".tar.xz", archive_write_set_format_pax_restricted, archive_write_add_filter_xz}, + { NULL, NULL, NULL } +}; + +static +int cmpsuff(const char *str, const char *suffix) +{ + size_t length_str, length_suffix; + + if ((str == NULL) || (suffix == NULL)) + return -1; + + length_str = strlen(str); + length_suffix = strlen(suffix); + + if (length_str >= length_suffix) { + return strcmp(str + (length_str - length_suffix), suffix); + } else { + return -1; + } +} + +static int get_array_index(const char *name) +{ + int i; + + for (i = 0; names[i].name != NULL; i++) + { + if (cmpsuff(name, names[i].name) == 0) + return i; + } + return -1; + +} + +int +archive_write_set_format_filter_by_ext(struct archive *a, const char *filename) +{ + int names_index = get_array_index(filename); + + if (names_index >= 0) + { + int format_state = (names[names_index].format)(a); + if (format_state == ARCHIVE_OK) + return ((names[names_index].filter)(a)); + else + return format_state; + } + + archive_set_error(a, EINVAL, "No such format '%s'", filename); + a->state = ARCHIVE_STATE_FATAL; + return (ARCHIVE_FATAL); +} + +int +archive_write_set_format_filter_by_ext_def(struct archive *a, const char *filename, const char * def_ext) +{ + int names_index = get_array_index(filename); + + if (names_index < 0) + names_index = get_array_index(def_ext); + + if (names_index >= 0) + { + int format_state = (names[names_index].format)(a); + if (format_state == ARCHIVE_OK) + return ((names[names_index].filter)(a)); + else + return format_state; + } + + archive_set_error(a, EINVAL, "No such format '%s'", filename); + a->state = ARCHIVE_STATE_FATAL; + return (ARCHIVE_FATAL); +} + + + + diff --git a/libarchive/archive_write_set_format_gnutar.c b/libarchive/archive_write_set_format_gnutar.c index 13942c132b18..647079de6320 100644 --- a/libarchive/archive_write_set_format_gnutar.c +++ b/libarchive/archive_write_set_format_gnutar.c @@ -644,18 +644,18 @@ archive_format_gnutar_header(struct archive_write *a, char h[512], format_octal(archive_entry_mode(entry) & 07777, h + GNUTAR_mode_offset, GNUTAR_mode_size); - /* TODO: How does GNU tar handle large UIDs? */ - if (format_octal(archive_entry_uid(entry), - h + GNUTAR_uid_offset, GNUTAR_uid_size)) { + /* GNU tar supports base-256 here, so should never overflow. */ + if (format_number(archive_entry_uid(entry), h + GNUTAR_uid_offset, + GNUTAR_uid_size, GNUTAR_uid_max_size)) { archive_set_error(&a->archive, ERANGE, "Numeric user ID %jd too large", (intmax_t)archive_entry_uid(entry)); ret = ARCHIVE_FAILED; } - /* TODO: How does GNU tar handle large GIDs? */ - if (format_octal(archive_entry_gid(entry), - h + GNUTAR_gid_offset, GNUTAR_gid_size)) { + /* GNU tar supports base-256 here, so should never overflow. */ + if (format_number(archive_entry_gid(entry), h + GNUTAR_gid_offset, + GNUTAR_gid_size, GNUTAR_gid_max_size)) { archive_set_error(&a->archive, ERANGE, "Numeric group ID %jd too large", (intmax_t)archive_entry_gid(entry)); diff --git a/libarchive/archive_write_set_format_iso9660.c b/libarchive/archive_write_set_format_iso9660.c index 591370298d51..4d832fb6e6e0 100644 --- a/libarchive/archive_write_set_format_iso9660.c +++ b/libarchive/archive_write_set_format_iso9660.c @@ -197,7 +197,7 @@ struct isofile { enum { NO = 0, BOOT_CATALOG, - BOOT_IMAGE, + BOOT_IMAGE } boot; /* @@ -850,7 +850,7 @@ enum dir_rec_type { DIR_REC_VD, /* Stored in Volume Descriptor. */ DIR_REC_SELF, /* Stored as Current Directory. */ DIR_REC_PARENT, /* Stored as Parent Directory. */ - DIR_REC_NORMAL, /* Stored as Child. */ + DIR_REC_NORMAL /* Stored as Child. */ }; /* @@ -860,7 +860,7 @@ enum vdc { VDC_STD, VDC_LOWERCASE, VDC_UCS2, - VDC_UCS2_DIRECT, + VDC_UCS2_DIRECT }; /* @@ -897,7 +897,7 @@ struct idr { enum char_type { A_CHAR, - D_CHAR, + D_CHAR }; @@ -2719,6 +2719,16 @@ extra_get_record(struct isoent *isoent, int *space, int *off, int *loc) rec->offset = 0; /* Insert `rec` into the tail of isoent->extr_rec_list */ rec->next = NULL; + /* + * Note: testing isoent->extr_rec_list.last == NULL + * here is really unneeded since it has been already + * initialized at isoent_new function but Clang Static + * Analyzer claims that it is dereference of null + * pointer. + */ + if (isoent->extr_rec_list.last == NULL) + isoent->extr_rec_list.last = + &(isoent->extr_rec_list.first); *isoent->extr_rec_list.last = rec; isoent->extr_rec_list.last = &(rec->next); } @@ -3994,7 +4004,7 @@ enum keytype { KEY_FLG, KEY_STR, KEY_INT, - KEY_HEX, + KEY_HEX }; static void set_option_info(struct archive_string *info, int *opt, const char *key, diff --git a/libarchive/archive_write_set_format_mtree.c b/libarchive/archive_write_set_format_mtree.c index 9c0613c9b025..b686303d9a4d 100644 --- a/libarchive/archive_write_set_format_mtree.c +++ b/libarchive/archive_write_set_format_mtree.c @@ -35,7 +35,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_mtree.c 201171 #include #include "archive.h" -#include "archive_crypto_private.h" +#include "archive_digest_private.h" #include "archive_entry.h" #include "archive_private.h" #include "archive_rb.h" @@ -128,6 +128,9 @@ struct mtree_entry { unsigned long fflags_clear; dev_t rdevmajor; dev_t rdevminor; + dev_t devmajor; + dev_t devminor; + int64_t ino; }; struct mtree_writer { @@ -210,6 +213,9 @@ struct mtree_writer { #define F_SHA256 0x00800000 /* SHA-256 digest */ #define F_SHA384 0x01000000 /* SHA-384 digest */ #define F_SHA512 0x02000000 /* SHA-512 digest */ +#define F_INO 0x04000000 /* inode number */ +#define F_RESDEV 0x08000000 /* device ID on which the + * entry resides */ /* Options */ int dironly; /* If it is set, ignore all files except @@ -633,7 +639,7 @@ attr_counter_inc(struct attr_counter **top, struct attr_counter *ac, *top = ac; ac->next->prev = ac; } - } else { + } else if (last != NULL) { ac = attr_counter_new(me, last); if (ac == NULL) return (-1); @@ -823,8 +829,11 @@ mtree_entry_new(struct archive_write *a, struct archive_entry *entry, archive_entry_fflags(entry, &me->fflags_set, &me->fflags_clear); me->mtime = archive_entry_mtime(entry); me->mtime_nsec = archive_entry_mtime_nsec(entry); - me->rdevmajor = archive_entry_rdevmajor(entry); + me->rdevmajor = archive_entry_rdevmajor(entry); me->rdevminor = archive_entry_rdevminor(entry); + me->devmajor = archive_entry_devmajor(entry); + me->devminor = archive_entry_devminor(entry); + me->ino = archive_entry_ino(entry); me->size = archive_entry_size(entry); if (me->filetype == AE_IFDIR) { me->dir_info = calloc(1, sizeof(*me->dir_info)); @@ -882,7 +891,7 @@ archive_write_mtree_header(struct archive_write *a, mtree->first = 0; archive_strcat(&mtree->buf, "#mtree\n"); if ((mtree->keys & SET_KEYS) == 0) - mtree->output_global_set = 0;/* Disalbed. */ + mtree->output_global_set = 0;/* Disabled. */ } mtree->entry_bytes_remaining = archive_entry_size(entry); @@ -983,6 +992,15 @@ write_mtree_entry(struct archive_write *a, struct mtree_entry *me) if ((keys & F_UID) != 0) archive_string_sprintf(str, " uid=%jd", (intmax_t)me->uid); + if ((keys & F_INO) != 0) + archive_string_sprintf(str, " inode=%jd", (intmax_t)me->ino); + if ((keys & F_RESDEV) != 0) { + archive_string_sprintf(str, + " resdevice=native,%ju,%ju", + (uintmax_t)me->devmajor, + (uintmax_t)me->devminor); + } + switch (me->filetype) { case AE_IFLNK: if ((keys & F_TYPE) != 0) @@ -1097,7 +1115,7 @@ write_mtree_entry_tree(struct archive_write *a) do { if (mtree->output_global_set) { /* - * Collect attribute infomation to know which value + * Collect attribute information to know which value * is frequently used among the children. */ attr_counter_set_reset(mtree); @@ -1117,7 +1135,7 @@ write_mtree_entry_tree(struct archive_write *a) } else { /* Whenever output_global_set is enabled * output global value(/set keywords) - * even if the directory entry is not allowd + * even if the directory entry is not allowed * to be written because the global values * can be used for the children. */ if (mtree->output_global_set) @@ -1296,6 +1314,8 @@ archive_write_mtree_options(struct archive_write *a, const char *key, if (strcmp(key, "indent") == 0) { mtree->indent = (value != NULL)? 1: 0; return (ARCHIVE_OK); + } else if (strcmp(key, "inode") == 0) { + keybit = F_INO; } break; case 'l': @@ -1314,7 +1334,9 @@ archive_write_mtree_options(struct archive_write *a, const char *key, keybit = F_NLINK; break; case 'r': - if (strcmp(key, "ripemd160digest") == 0 || + if (strcmp(key, "resdevice") == 0) { + keybit = F_RESDEV; + } else if (strcmp(key, "ripemd160digest") == 0 || strcmp(key, "rmd160") == 0 || strcmp(key, "rmd160digest") == 0) keybit = F_RMD160; @@ -1855,9 +1877,9 @@ mtree_entry_setup_filenames(struct archive_write *a, struct mtree_entry *file, return (ret); } - /* Make a basename from dirname and slash */ + /* Make a basename from file->parentdir.s and slash */ *slash = '\0'; - file->parentdir.length = slash - dirname; + file->parentdir.length = slash - file->parentdir.s; archive_strcpy(&(file->basename), slash + 1); return (ret); } @@ -2198,6 +2220,9 @@ mtree_entry_exchange_same_entry(struct archive_write *a, struct mtree_entry *np, np->mtime_nsec = file->mtime_nsec; np->rdevmajor = file->rdevmajor; np->rdevminor = file->rdevminor; + np->devmajor = file->devmajor; + np->devminor = file->devminor; + np->ino = file->ino; return (ARCHIVE_WARN); } diff --git a/libarchive/archive_write_set_format_pax.c b/libarchive/archive_write_set_format_pax.c index 687f8e48a9b7..6f7fe7839001 100644 --- a/libarchive/archive_write_set_format_pax.c +++ b/libarchive/archive_write_set_format_pax.c @@ -1036,22 +1036,12 @@ archive_write_pax_header(struct archive_write *a, need_extension = 1; /* - * The following items are handled differently in "pax - * restricted" format. In particular, in "pax restricted" - * format they won't be added unless need_extension is - * already set (we're already generating an extended header, so - * may as well include these). + * Libarchive used to include these in extended headers for + * restricted pax format, but that confused people who + * expected ustar-like time semantics. So now we only include + * them in full pax format. */ - if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_RESTRICTED || - need_extension) { - - if (archive_entry_mtime(entry_main) < 0 || - archive_entry_mtime(entry_main) >= 0x7fffffff || - archive_entry_mtime_nsec(entry_main) != 0) - add_pax_attr_time(&(pax->pax_header), "mtime", - archive_entry_mtime(entry_main), - archive_entry_mtime_nsec(entry_main)); - + if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_RESTRICTED) { if (archive_entry_ctime(entry_main) != 0 || archive_entry_ctime_nsec(entry_main) != 0) add_pax_attr_time(&(pax->pax_header), "ctime", @@ -1072,6 +1062,23 @@ archive_write_pax_header(struct archive_write *a, "LIBARCHIVE.creationtime", archive_entry_birthtime(entry_main), archive_entry_birthtime_nsec(entry_main)); + } + + /* + * The following items are handled differently in "pax + * restricted" format. In particular, in "pax restricted" + * format they won't be added unless need_extension is + * already set (we're already generating an extended header, so + * may as well include these). + */ + if (a->archive.archive_format != ARCHIVE_FORMAT_TAR_PAX_RESTRICTED || + need_extension) { + if (archive_entry_mtime(entry_main) < 0 || + archive_entry_mtime(entry_main) >= 0x7fffffff || + archive_entry_mtime_nsec(entry_main) != 0) + add_pax_attr_time(&(pax->pax_header), "mtime", + archive_entry_mtime(entry_main), + archive_entry_mtime_nsec(entry_main)); /* I use a star-compatible file flag attribute. */ p = archive_entry_fflags_text(entry_main); diff --git a/libarchive/archive_write_set_format_raw.c b/libarchive/archive_write_set_format_raw.c new file mode 100644 index 000000000000..feff93697736 --- /dev/null +++ b/libarchive/archive_write_set_format_raw.c @@ -0,0 +1,125 @@ +/*- + * Copyright (c) 2013 Marek Kubica + * 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 "archive_platform.h" + +#ifdef HAVE_ERRNO_H +#include +#endif + +#include "archive_entry.h" +#include "archive_write_private.h" + +static ssize_t archive_write_raw_data(struct archive_write *, + const void *buff, size_t s); +static int archive_write_raw_free(struct archive_write *); +static int archive_write_raw_header(struct archive_write *, + struct archive_entry *); + +struct raw { + int entries_written; +}; + +/* + * Set output format to 'raw' format. + */ +int +archive_write_set_format_raw(struct archive *_a) +{ + struct archive_write *a = (struct archive_write *)_a; + struct raw *raw; + + archive_check_magic(_a, ARCHIVE_WRITE_MAGIC, + ARCHIVE_STATE_NEW, "archive_write_set_format_raw"); + + /* If someone else was already registered, unregister them. */ + if (a->format_free != NULL) + (a->format_free)(a); + + raw = (struct raw *)calloc(1, sizeof(*raw)); + if (raw == NULL) { + archive_set_error(&a->archive, ENOMEM, "Can't allocate raw data"); + return (ARCHIVE_FATAL); + } + raw->entries_written = 0; + a->format_data = raw; + a->format_name = "raw"; + /* no options exist for this format */ + a->format_options = NULL; + a->format_write_header = archive_write_raw_header; + a->format_write_data = archive_write_raw_data; + a->format_finish_entry = NULL; + /* nothing needs to be done on closing */ + a->format_close = NULL; + a->format_free = archive_write_raw_free; + a->archive.archive_format = ARCHIVE_FORMAT_RAW; + a->archive.archive_format_name = "RAW"; + return (ARCHIVE_OK); +} + +static int +archive_write_raw_header(struct archive_write *a, struct archive_entry *entry) +{ + struct raw *raw = (struct raw *)a->format_data; + + if (archive_entry_filetype(entry) != AE_IFREG) { + archive_set_error(&a->archive, ERANGE, + "Raw format only supports filetype AE_IFREG"); + return (ARCHIVE_FATAL); + } + + + if (raw->entries_written > 0) { + archive_set_error(&a->archive, ERANGE, + "Raw format only supports one entry per archive"); + return (ARCHIVE_FATAL); + } + raw->entries_written++; + + return (ARCHIVE_OK); +} + +static ssize_t +archive_write_raw_data(struct archive_write *a, const void *buff, size_t s) +{ + int ret; + + ret = __archive_write_output(a, buff, s); + if (ret >= 0) + return (s); + else + return (ret); +} + +static int +archive_write_raw_free(struct archive_write *a) +{ + struct raw *raw; + + raw = (struct raw *)a->format_data; + free(raw); + a->format_data = NULL; + return (ARCHIVE_OK); +} diff --git a/libarchive/archive_write_set_format_shar.c b/libarchive/archive_write_set_format_shar.c index 9ec15f915c9d..c033fb32f7ef 100644 --- a/libarchive/archive_write_set_format_shar.c +++ b/libarchive/archive_write_set_format_shar.c @@ -548,6 +548,7 @@ archive_write_shar_finish_entry(struct archive_write *a) archive_strcat(&shar->work, ":"); shar_quote(&shar->work, g, 1); } + archive_strcat(&shar->work, " "); shar_quote(&shar->work, archive_entry_pathname(shar->entry), 1); archive_strcat(&shar->work, "\n"); diff --git a/libarchive/archive_write_set_format_warc.c b/libarchive/archive_write_set_format_warc.c new file mode 100644 index 000000000000..ea66929a9767 --- /dev/null +++ b/libarchive/archive_write_set_format_warc.c @@ -0,0 +1,445 @@ +/*- + * Copyright (c) 2014 Sebastian Freundt + * Author: Sebastian Freundt + * + * 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_ERRNO_H +#include +#endif +#include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_STRING_H +#include +#endif +#ifdef HAVE_TIME_H +#include +#endif + +#include "archive.h" +#include "archive_entry.h" +#include "archive_entry_locale.h" +#include "archive_private.h" +#include "archive_random_private.h" +#include "archive_write_private.h" + +struct warc_s { + unsigned int omit_warcinfo:1; + + time_t now; + mode_t typ; + unsigned int rng; + /* populated size */ + uint64_t populz; +}; + +static const char warcinfo[] = + "software: libarchive/" ARCHIVE_VERSION_ONLY_STRING "\r\n" + "format: WARC file version 1.0\r\n"; + +typedef enum { + WT_NONE, + /* warcinfo */ + WT_INFO, + /* metadata */ + WT_META, + /* resource */ + WT_RSRC, + /* request, unsupported */ + WT_REQ, + /* response, unsupported */ + WT_RSP, + /* revisit, unsupported */ + WT_RVIS, + /* conversion, unsupported */ + WT_CONV, + /* continutation, unsupported at the moment */ + WT_CONT, + /* invalid type */ + LAST_WT +} warc_type_t; + +typedef struct { + warc_type_t type; + const char *tgturi; + const char *recid; + time_t rtime; + time_t mtime; + const char *cnttyp; + uint64_t cntlen; +} warc_essential_hdr_t; + +typedef struct { + unsigned int u[4U]; +} warc_uuid_t; + +static int _warc_options(struct archive_write*, const char *key, const char *v); +static int _warc_header(struct archive_write *a, struct archive_entry *entry); +static ssize_t _warc_data(struct archive_write *a, const void *buf, size_t sz); +static int _warc_finish_entry(struct archive_write *a); +static int _warc_close(struct archive_write *a); +static int _warc_free(struct archive_write *a); + +/* private routines */ +static ssize_t _popul_ehdr(struct archive_string *t, size_t z, warc_essential_hdr_t); +static int _gen_uuid(warc_uuid_t *tgt); + + +/* + * Set output format to ISO 28500 (aka WARC) format. + */ +int +archive_write_set_format_warc(struct archive *_a) +{ + struct archive_write *a = (struct archive_write *)_a; + struct warc_s *w; + + archive_check_magic(_a, ARCHIVE_WRITE_MAGIC, + ARCHIVE_STATE_NEW, "archive_write_set_format_warc"); + + /* If another format was already registered, unregister it. */ + if (a->format_free != NULL) { + (a->format_free)(a); + } + + w = malloc(sizeof(*w)); + if (w == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate warc data"); + return (ARCHIVE_FATAL); + } + /* by default we're emitting a file wide header */ + w->omit_warcinfo = 0U; + /* obtain current time for date fields */ + w->now = time(NULL); + /* reset file type info */ + w->typ = 0; + /* also initialise our rng */ + w->rng = (unsigned int)w->now; + + a->format_data = w; + a->format_name = "WARC/1.0"; + a->format_options = _warc_options; + a->format_write_header = _warc_header; + a->format_write_data = _warc_data; + a->format_close = _warc_close; + a->format_free = _warc_free; + a->format_finish_entry = _warc_finish_entry; + a->archive.archive_format = ARCHIVE_FORMAT_WARC; + a->archive.archive_format_name = "WARC/1.0"; + return (ARCHIVE_OK); +} + + +/* archive methods */ +static int +_warc_options(struct archive_write *a, const char *key, const char *val) +{ + struct warc_s *w = a->format_data; + + if (strcmp(key, "omit-warcinfo") == 0) { + if (val == NULL || strcmp(val, "true") == 0) { + /* great */ + w->omit_warcinfo = 1U; + return (ARCHIVE_OK); + } + } + + /* Note: The "warn" return is just to inform the options + * supervisor that we didn't handle it. It will generate + * a suitable error if no one used this option. */ + return (ARCHIVE_WARN); +} + +static int +_warc_header(struct archive_write *a, struct archive_entry *entry) +{ + struct warc_s *w = a->format_data; + struct archive_string hdr; +#define MAX_HDR_SIZE 512 + + /* check whether warcinfo record needs outputting */ + if (!w->omit_warcinfo) { + ssize_t r; + warc_essential_hdr_t wi = { + WT_INFO, + /*uri*/NULL, + /*urn*/NULL, + /*rtm*/0, + /*mtm*/0, + /*cty*/"application/warc-fields", + /*len*/sizeof(warcinfo) - 1U, + }; + wi.rtime = w->now; + wi.mtime = w->now; + + archive_string_init(&hdr); + r = _popul_ehdr(&hdr, MAX_HDR_SIZE, wi); + if (r >= 0) { + /* jackpot! */ + /* now also use HDR buffer for the actual warcinfo */ + archive_strncat(&hdr, warcinfo, sizeof(warcinfo) -1); + + /* append end-of-record indicator */ + archive_strncat(&hdr, "\r\n\r\n", 4); + + /* write to output stream */ + __archive_write_output(a, hdr.s, archive_strlen(&hdr)); + } + /* indicate we're done with file header writing */ + w->omit_warcinfo = 1U; + archive_string_free(&hdr); + } + + if (archive_entry_pathname(entry) == NULL) { + archive_set_error(&a->archive, EINVAL, + "Invalid filename"); + return (ARCHIVE_WARN); + } + + w->typ = archive_entry_filetype(entry); + w->populz = 0U; + if (w->typ == AE_IFREG) { + warc_essential_hdr_t rh = { + WT_RSRC, + /*uri*/NULL, + /*urn*/NULL, + /*rtm*/0, + /*mtm*/0, + /*cty*/NULL, + /*len*/0, + }; + ssize_t r; + rh.tgturi = archive_entry_pathname(entry); + rh.rtime = w->now; + rh.mtime = archive_entry_mtime(entry); + rh.cntlen = (size_t)archive_entry_size(entry); + + archive_string_init(&hdr); + r = _popul_ehdr(&hdr, MAX_HDR_SIZE, rh); + if (r < 0) { + /* don't bother */ + archive_set_error( + &a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "cannot archive file"); + return (ARCHIVE_WARN); + } + /* otherwise append to output stream */ + __archive_write_output(a, hdr.s, r); + /* and let subsequent calls to _data() know about the size */ + w->populz = rh.cntlen; + archive_string_free(&hdr); + return (ARCHIVE_OK); + } + /* just resort to erroring as per Tim's advice */ + archive_set_error( + &a->archive, + ARCHIVE_ERRNO_FILE_FORMAT, + "WARC can only process regular files"); + return (ARCHIVE_FAILED); +} + +static ssize_t +_warc_data(struct archive_write *a, const void *buf, size_t len) +{ + struct warc_s *w = a->format_data; + + if (w->typ == AE_IFREG) { + int rc; + + /* never write more bytes than announced */ + if (len > w->populz) { + len = (size_t)w->populz; + } + + /* now then, out we put the whole shebang */ + rc = __archive_write_output(a, buf, len); + if (rc != ARCHIVE_OK) { + return rc; + } + } + return len; +} + +static int +_warc_finish_entry(struct archive_write *a) +{ + static const char _eor[] = "\r\n\r\n"; + struct warc_s *w = a->format_data; + + if (w->typ == AE_IFREG) { + int rc = __archive_write_output(a, _eor, sizeof(_eor) - 1U); + + if (rc != ARCHIVE_OK) { + return rc; + } + } + /* reset type info */ + w->typ = 0; + return (ARCHIVE_OK); +} + +static int +_warc_close(struct archive_write *a) +{ + (void)a; /* UNUSED */ + return (ARCHIVE_OK); +} + +static int +_warc_free(struct archive_write *a) +{ + struct warc_s *w = a->format_data; + + free(w); + a->format_data = NULL; + return (ARCHIVE_OK); +} + + +/* private routines */ +static void +xstrftime(struct archive_string *as, const char *fmt, time_t t) +{ +/** like strftime(3) but for time_t objects */ + struct tm *rt; +#if defined(HAVE_GMTIME_R) || defined(HAVE__GMTIME64_S) + struct tm timeHere; +#endif + char strtime[100]; + size_t len; + +#ifdef HAVE_GMTIME_R + if ((rt = gmtime_r(&t, &timeHere)) == NULL) + return; +#elif defined(HAVE__GMTIME64_S) + _gmtime64_s(&timeHere, &t); +#else + if ((rt = gmtime(&t)) == NULL) + return; +#endif + /* leave the hard yacker to our role model strftime() */ + len = strftime(strtime, sizeof(strtime)-1, fmt, rt); + archive_strncat(as, strtime, len); +} + +static ssize_t +_popul_ehdr(struct archive_string *tgt, size_t tsz, warc_essential_hdr_t hdr) +{ + static const char _ver[] = "WARC/1.0\r\n"; + static const char *_typ[LAST_WT] = { + NULL, "warcinfo", "metadata", "resource", NULL + }; + char std_uuid[48U]; + + if (hdr.type == WT_NONE || hdr.type > WT_RSRC) { + /* brilliant, how exactly did we get here? */ + return -1; + } + + archive_strcpy(tgt, _ver); + + archive_string_sprintf(tgt, "WARC-Type: %s\r\n", _typ[hdr.type]); + + if (hdr.tgturi != NULL) { + /* check if there's a xyz:// */ + static const char _uri[] = ""; + static const char _fil[] = "file://"; + const char *u; + char *chk = strchr(hdr.tgturi, ':'); + + if (chk != NULL && chk[1U] == '/' && chk[2U] == '/') { + /* yep, it's definitely a URI */ + u = _uri; + } else { + /* hm, best to prepend file:// then */ + u = _fil; + } + archive_string_sprintf(tgt, + "WARC-Target-URI: %s%s\r\n", u, hdr.tgturi); + } + + /* record time is usually when the http is sent off, + * just treat the archive writing as such for a moment */ + xstrftime(tgt, "WARC-Date: %Y-%m-%dT%H:%M:%SZ\r\n", hdr.rtime); + + /* while we're at it, record the mtime */ + xstrftime(tgt, "Last-Modified: %Y-%m-%dT%H:%M:%SZ\r\n", hdr.mtime); + + if (hdr.recid == NULL) { + /* generate one, grrrr */ + warc_uuid_t u; + + _gen_uuid(&u); + /* Unfortunately, archive_string_sprintf does not + * handle the minimum number following '%'. + * So we have to use snprintf function here instead + * of archive_string_snprintf function. */ +#if defined(_WIN32) && !defined(__CYGWIN__) && !( defined(_MSC_VER) && _MSC_VER >= 1900) +#define snprintf _snprintf +#endif + snprintf( + std_uuid, sizeof(std_uuid), + "", + u.u[0U], + u.u[1U] >> 16U, u.u[1U] & 0xffffU, + u.u[2U] >> 16U, u.u[2U] & 0xffffU, + u.u[3U]); + hdr.recid = std_uuid; + } + + /* record-id is mandatory, fingers crossed we won't fail */ + archive_string_sprintf(tgt, "WARC-Record-ID: %s\r\n", hdr.recid); + + if (hdr.cnttyp != NULL) { + archive_string_sprintf(tgt, "Content-Type: %s\r\n", hdr.cnttyp); + } + + /* next one is mandatory */ + archive_string_sprintf(tgt, "Content-Length: %ju\r\n", (uintmax_t)hdr.cntlen); + /**/ + archive_strncat(tgt, "\r\n", 2); + + return (archive_strlen(tgt) >= tsz)? -1: (ssize_t)archive_strlen(tgt); +} + +static int +_gen_uuid(warc_uuid_t *tgt) +{ + archive_random(tgt->u, sizeof(tgt->u)); + /* obey uuid version 4 rules */ + tgt->u[1U] &= 0xffff0fffU; + tgt->u[1U] |= 0x4000U; + tgt->u[2U] &= 0x3fffffffU; + tgt->u[2U] |= 0x80000000U; + return 0; +} + +/* archive_write_set_format_warc.c ends here */ diff --git a/libarchive/archive_write_set_format_xar.c b/libarchive/archive_write_set_format_xar.c index 79667e563d7a..a2dbc03991df 100644 --- a/libarchive/archive_write_set_format_xar.c +++ b/libarchive/archive_write_set_format_xar.c @@ -47,7 +47,7 @@ __FBSDID("$FreeBSD$"); #endif #include "archive.h" -#include "archive_crypto_private.h" +#include "archive_digest_private.h" #include "archive_endian.h" #include "archive_entry.h" #include "archive_entry_locale.h" @@ -114,7 +114,7 @@ enum sumalg { #define MAX_SUM_SIZE 20 #define MD5_NAME "md5" #define SHA1_NAME "sha1" - + enum enctype { NONE, GZIP, @@ -242,6 +242,7 @@ struct xar { enum sumalg opt_sumalg; enum enctype opt_compression; int opt_compression_level; + uint32_t opt_threads; struct chksumwork a_sumwrk; /* archived checksum. */ struct chksumwork e_sumwrk; /* extracted checksum. */ @@ -317,7 +318,7 @@ static int compression_end_bzip2(struct archive *, struct la_zstream *); static int compression_init_encoder_lzma(struct archive *, struct la_zstream *, int); static int compression_init_encoder_xz(struct archive *, - struct la_zstream *, int); + struct la_zstream *, int, int); #if defined(HAVE_LZMA_H) static int compression_code_lzma(struct archive *, struct la_zstream *, enum la_zaction); @@ -380,9 +381,10 @@ archive_write_set_format_xar(struct archive *_a) /* Set default checksum type. */ xar->opt_toc_sumalg = CKSUM_SHA1; xar->opt_sumalg = CKSUM_SHA1; - /* Set default compression type and level. */ + /* Set default compression type, level, and number of threads. */ xar->opt_compression = GZIP; xar->opt_compression_level = 6; + xar->opt_threads = 1; a->format_data = xar; @@ -493,6 +495,26 @@ xar_options(struct archive_write *a, const char *key, const char *value) } return (ARCHIVE_OK); } + if (strcmp(key, "threads") == 0) { + if (value == NULL) + return (ARCHIVE_FAILED); + xar->opt_threads = (int)strtoul(value, NULL, 10); + if (xar->opt_threads == 0 && errno != 0) { + xar->opt_threads = 1; + archive_set_error(&(a->archive), + ARCHIVE_ERRNO_MISC, + "Illegal value `%s'", + value); + return (ARCHIVE_FAILED); + } + if (xar->opt_threads == 0) { +#ifdef HAVE_LZMA_STREAM_ENCODER_MT + xar->opt_threads = lzma_cputhreads(); +#else + xar->opt_threads = 1; +#endif + } + } /* Note: The "warn" return is just to inform the options * supervisor that we didn't handle it. It will generate @@ -805,7 +827,7 @@ xmlwrite_string(struct archive_write *a, xmlTextWriterPtr writer, if (value == NULL) return (ARCHIVE_OK); - + r = xmlTextWriterStartElement(writer, BAD_CAST_CONST(key)); if (r < 0) { archive_set_error(&a->archive, @@ -1855,6 +1877,11 @@ xar_free(struct archive_write *a) struct xar *xar; xar = (struct xar *)a->format_data; + + /* Close the temporary file. */ + if (xar->temp_fd >= 0) + close(xar->temp_fd); + archive_string_free(&(xar->cur_dirstr)); archive_string_free(&(xar->tstr)); archive_string_free(&(xar->vstr)); @@ -1875,7 +1902,7 @@ file_cmp_node(const struct archive_rb_node *n1, return (strcmp(f1->basename.s, f2->basename.s)); } - + static int file_cmp_key(const struct archive_rb_node *n, const void *key) { @@ -2154,7 +2181,7 @@ file_gen_utility_names(struct archive_write *a, struct file *file) file->parentdir.length = len; archive_string_copy(&(file->basename), &(file->parentdir)); archive_string_empty(&(file->parentdir)); - file->parentdir.s = '\0'; + *file->parentdir.s = '\0'; return (r); } @@ -2494,7 +2521,7 @@ file_init_hardlinks(struct xar *xar) static const struct archive_rb_tree_ops rb_ops = { file_hd_cmp_node, file_hd_cmp_key, }; - + __archive_rb_tree_init(&(xar->hardlink_rbtree), &rb_ops); } @@ -2848,13 +2875,18 @@ compression_init_encoder_lzma(struct archive *a, static int compression_init_encoder_xz(struct archive *a, - struct la_zstream *lastrm, int level) + struct la_zstream *lastrm, int level, int threads) { static const lzma_stream lzma_init_data = LZMA_STREAM_INIT; lzma_stream *strm; lzma_filter *lzmafilters; lzma_options_lzma lzma_opt; int r; +#ifdef HAVE_LZMA_STREAM_ENCODER_MT + lzma_mt mt_options; +#endif + + (void)threads; /* UNUSED (if multi-threaded LZMA library not avail) */ if (lastrm->valid) compression_end(a, lastrm); @@ -2879,7 +2911,17 @@ compression_init_encoder_xz(struct archive *a, lzmafilters[1].id = LZMA_VLI_UNKNOWN;/* Terminate */ *strm = lzma_init_data; - r = lzma_stream_encoder(strm, lzmafilters, LZMA_CHECK_CRC64); +#ifdef HAVE_LZMA_STREAM_ENCODER_MT + if (threads > 1) { + bzero(&mt_options, sizeof(mt_options)); + mt_options.threads = threads; + mt_options.timeout = 300; + mt_options.filters = lzmafilters; + mt_options.check = LZMA_CHECK_CRC64; + r = lzma_stream_encoder_mt(strm, &mt_options); + } else +#endif + r = lzma_stream_encoder(strm, lzmafilters, LZMA_CHECK_CRC64); switch (r) { case LZMA_OK: lastrm->real_stream = strm; @@ -2979,10 +3021,11 @@ compression_init_encoder_lzma(struct archive *a, } static int compression_init_encoder_xz(struct archive *a, - struct la_zstream *lastrm, int level) + struct la_zstream *lastrm, int level, int threads) { (void) level; /* UNUSED */ + (void) threads; /* UNUSED */ if (lastrm->valid) compression_end(a, lastrm); return (compression_unsupported_encoder(a, lastrm, "xz")); @@ -3015,7 +3058,7 @@ xar_compression_init_encoder(struct archive_write *a) case XZ: r = compression_init_encoder_xz( &(a->archive), &(xar->stream), - xar->opt_compression_level); + xar->opt_compression_level, xar->opt_threads); break; default: r = ARCHIVE_OK; @@ -3178,4 +3221,3 @@ getalgname(enum sumalg sumalg) } #endif /* Support xar format */ - diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c index 3d8b3b5f9ca7..e4edb818819a 100644 --- a/libarchive/archive_write_set_format_zip.c +++ b/libarchive/archive_write_set_format_zip.c @@ -1,7 +1,7 @@ /*- * Copyright (c) 2008 Anselm Strauss * Copyright (c) 2009 Joerg Sonnenberger - * Copyright (c) 2011-2012 Michihiro NAKAJIMA + * Copyright (c) 2011-2012,2014 Michihiro NAKAJIMA * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -29,24 +29,6 @@ * Development supported by Google Summer of Code 2008. */ -/* - * The current implementation is very limited: - * - * - No encryption support. - * - No ZIP64 support. - * - No support for splitting and spanning. - * - Only supports regular file and folder entries. - * - * Note that generally data in ZIP files is little-endian encoded, - * with some exceptions. - * - * TODO: Since Libarchive is generally 64bit oriented, but this implementation - * does not yet support sizes exceeding 32bit, it is highly fragile for - * big archives. This should change when ZIP64 is finally implemented, otherwise - * some serious checking has to be done. - * - */ - #include "archive_platform.h" __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_zip.c 201168 2009-12-29 06:15:32Z kientzle $"); @@ -67,35 +49,133 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_zip.c 201168 20 #endif #include "archive.h" +#include "archive_cryptor_private.h" #include "archive_endian.h" #include "archive_entry.h" #include "archive_entry_locale.h" +#include "archive_hmac_private.h" #include "archive_private.h" +#include "archive_random_private.h" #include "archive_write_private.h" #ifndef HAVE_ZLIB_H #include "archive_crc32.h" #endif -#define ZIP_SIGNATURE_LOCAL_FILE_HEADER 0x04034b50 -#define ZIP_SIGNATURE_DATA_DESCRIPTOR 0x08074b50 -#define ZIP_SIGNATURE_FILE_HEADER 0x02014b50 -#define ZIP_SIGNATURE_CENTRAL_DIRECTORY_END 0x06054b50 -#define ZIP_SIGNATURE_EXTRA_TIMESTAMP 0x5455 -#define ZIP_SIGNATURE_EXTRA_NEW_UNIX 0x7875 -#define ZIP_VERSION_EXTRACT 0x0014 /* ZIP version 2.0 is needed. */ -#define ZIP_VERSION_BY 0x0314 /* Made by UNIX, using ZIP version 2.0. */ -#define ZIP_FLAGS 0x08 /* Flagging bit 3 (count from 0) for using data descriptor. */ -#define ZIP_FLAGS_UTF8_NAME (1 << 11) +#define ZIP_ENTRY_FLAG_ENCRYPTED (1<<0) +#define ZIP_ENTRY_FLAG_LENGTH_AT_END (1<<3) +#define ZIP_ENTRY_FLAG_UTF8_NAME (1 << 11) + +#define ZIP_4GB_MAX ARCHIVE_LITERAL_LL(0xffffffff) +#define ZIP_4GB_MAX_UNCOMPRESSED ARCHIVE_LITERAL_LL(0xff000000) enum compression { - COMPRESSION_STORE = 0 -#ifdef HAVE_ZLIB_H - , + COMPRESSION_UNSPECIFIED = -1, + COMPRESSION_STORE = 0, COMPRESSION_DEFLATE = 8 -#endif }; +#ifdef HAVE_ZLIB_H +#define COMPRESSION_DEFAULT COMPRESSION_DEFLATE +#else +#define COMPRESSION_DEFAULT COMPRESSION_STORE +#endif + +enum encryption { + ENCRYPTION_NONE = 0, + ENCRYPTION_TRADITIONAL, /* Traditional PKWARE encryption. */ + ENCRYPTION_WINZIP_AES128, /* WinZIP AES-128 encryption. */ + ENCRYPTION_WINZIP_AES256, /* WinZIP AES-256 encryption. */ +}; + +#define TRAD_HEADER_SIZE 12 +/* + * See "WinZip - AES Encryption Information" + * http://www.winzip.com/aes_info.htm + */ +/* Value used in compression method. */ +#define WINZIP_AES_ENCRYPTION 99 +/* A WinZip AES header size which is stored at the beginning of + * file contents. */ +#define WINZIP_AES128_HEADER_SIZE (8 + 2) +#define WINZIP_AES256_HEADER_SIZE (16 + 2) +/* AES vendor version. */ +#define AES_VENDOR_AE_1 0x0001 +#define AES_VENDOR_AE_2 0x0002 +/* Authentication code size. */ +#define AUTH_CODE_SIZE 10 +/**/ +#define MAX_DERIVED_KEY_BUF_SIZE (AES_MAX_KEY_SIZE * 2 + 2) + +struct cd_segment { + struct cd_segment *next; + size_t buff_size; + unsigned char *buff; + unsigned char *p; +}; + +struct trad_enc_ctx { + uint32_t keys[3]; +}; + +struct zip { + + int64_t entry_offset; + int64_t entry_compressed_size; + int64_t entry_uncompressed_size; + int64_t entry_compressed_written; + int64_t entry_uncompressed_written; + int64_t entry_uncompressed_limit; + struct archive_entry *entry; + uint32_t entry_crc32; + enum compression entry_compression; + enum encryption entry_encryption; + int entry_flags; + int entry_uses_zip64; + int experiments; + struct trad_enc_ctx tctx; + char tctx_valid; + unsigned char trad_chkdat; + unsigned aes_vendor; + archive_crypto_ctx cctx; + char cctx_valid; + archive_hmac_sha1_ctx hctx; + char hctx_valid; + + unsigned char *file_header; + size_t file_header_extra_offset; + unsigned long (*crc32func)(unsigned long crc, const void *buff, size_t len); + + struct cd_segment *central_directory; + struct cd_segment *central_directory_last; + size_t central_directory_bytes; + size_t central_directory_entries; + + int64_t written_bytes; /* Overall position in file. */ + + struct archive_string_conv *opt_sconv; + struct archive_string_conv *sconv_default; + enum compression requested_compression; + int deflate_compression_level; + int init_default_conversion; + enum encryption encryption_type; + +#define ZIP_FLAG_AVOID_ZIP64 1 +#define ZIP_FLAG_FORCE_ZIP64 2 +#define ZIP_FLAG_EXPERIMENT_xl 4 + int flags; + +#ifdef HAVE_ZLIB_H + z_stream stream; +#endif + size_t len_buf; + unsigned char *buf; +}; + +/* Don't call this min or MIN, since those are already defined + on lots of platforms (but not all). */ +#define zipmin(a, b) ((a) > (b) ? (b) : (a)) + static ssize_t archive_write_zip_data(struct archive_write *, const void *buff, size_t s); static int archive_write_zip_close(struct archive_write *); @@ -108,106 +188,65 @@ static int archive_write_zip_options(struct archive_write *, static unsigned int dos_time(const time_t); static size_t path_length(struct archive_entry *); static int write_path(struct archive_entry *, struct archive_write *); +static void copy_path(struct archive_entry *, unsigned char *); +static struct archive_string_conv *get_sconv(struct archive_write *, struct zip *); +static int trad_enc_init(struct trad_enc_ctx *, const char *, size_t); +static unsigned trad_enc_encrypt_update(struct trad_enc_ctx *, const uint8_t *, + size_t, uint8_t *, size_t); +static int init_traditional_pkware_encryption(struct archive_write *); +static int is_traditional_pkware_encryption_supported(void); +static int init_winzip_aes_encryption(struct archive_write *); +static int is_winzip_aes_encryption_supported(int encryption); -#define LOCAL_FILE_HEADER_SIGNATURE 0 -#define LOCAL_FILE_HEADER_VERSION 4 -#define LOCAL_FILE_HEADER_FLAGS 6 -#define LOCAL_FILE_HEADER_COMPRESSION 8 -#define LOCAL_FILE_HEADER_TIMEDATE 10 -#define LOCAL_FILE_HEADER_CRC32 14 -#define LOCAL_FILE_HEADER_COMPRESSED_SIZE 18 -#define LOCAL_FILE_HEADER_UNCOMPRESSED_SIZE 22 -#define LOCAL_FILE_HEADER_FILENAME_LENGTH 26 -#define LOCAL_FILE_HEADER_EXTRA_LENGTH 28 -#define SIZE_LOCAL_FILE_HEADER 30 +static unsigned char * +cd_alloc(struct zip *zip, size_t length) +{ + unsigned char *p; -#define FILE_HEADER_SIGNATURE 0 -#define FILE_HEADER_VERSION_BY 4 -#define FILE_HEADER_VERSION_EXTRACT 6 -#define FILE_HEADER_FLAGS 8 -#define FILE_HEADER_COMPRESSION 10 -#define FILE_HEADER_TIMEDATE 12 -#define FILE_HEADER_CRC32 16 -#define FILE_HEADER_COMPRESSED_SIZE 20 -#define FILE_HEADER_UNCOMPRESSED_SIZE 24 -#define FILE_HEADER_FILENAME_LENGTH 28 -#define FILE_HEADER_EXTRA_LENGTH 30 -#define FILE_HEADER_COMMENT_LENGTH 32 -#define FILE_HEADER_DISK_NUMBER 34 -#define FILE_HEADER_ATTRIBUTES_INTERNAL 36 -#define FILE_HEADER_ATTRIBUTES_EXTERNAL 38 -#define FILE_HEADER_OFFSET 42 -#define SIZE_FILE_HEADER 46 + if (zip->central_directory == NULL + || (zip->central_directory_last->p + length + > zip->central_directory_last->buff + zip->central_directory_last->buff_size)) { + struct cd_segment *segment = calloc(1, sizeof(*segment)); + if (segment == NULL) + return NULL; + segment->buff_size = 64 * 1024; + segment->buff = malloc(segment->buff_size); + if (segment->buff == NULL) { + free(segment); + return NULL; + } + segment->p = segment->buff; - /* Not mandatory, but recommended by specification. */ -#define DATA_DESCRIPTOR_SIGNATURE 0 -#define DATA_DESCRIPTOR_CRC32 4 -#define DATA_DESCRIPTOR_COMPRESSED_SIZE 8 -#define DATA_DESCRIPTOR_UNCOMPRESSED_SIZE 12 -#define SIZE_DATA_DESCRIPTOR 16 + if (zip->central_directory == NULL) { + zip->central_directory + = zip->central_directory_last + = segment; + } else { + zip->central_directory_last->next = segment; + zip->central_directory_last = segment; + } + } -#define EXTRA_DATA_LOCAL_TIME_ID 0 -#define EXTRA_DATA_LOCAL_TIME_SIZE 2 -#define EXTRA_DATA_LOCAL_TIME_FLAG 4 -#define EXTRA_DATA_LOCAL_MTIME 5 -#define EXTRA_DATA_LOCAL_ATIME 9 -#define EXTRA_DATA_LOCAL_CTIME 13 -#define EXTRA_DATA_LOCAL_UNIX_ID 17 -#define EXTRA_DATA_LOCAL_UNIX_SIZE 19 -#define EXTRA_DATA_LOCAL_UNIX_VERSION 21 -#define EXTRA_DATA_LOCAL_UNIX_UID_SIZE 22 -#define EXTRA_DATA_LOCAL_UNIX_UID 23 -#define EXTRA_DATA_LOCAL_UNIX_GID_SIZE 27 -#define EXTRA_DATA_LOCAL_UNIX_GID 28 -#define SIZE_EXTRA_DATA_LOCAL 32 + p = zip->central_directory_last->p; + zip->central_directory_last->p += length; + zip->central_directory_bytes += length; + return (p); +} -#define EXTRA_DATA_CENTRAL_TIME_ID 0 -#define EXTRA_DATA_CENTRAL_TIME_SIZE 2 -#define EXTRA_DATA_CENTRAL_TIME_FLAG 4 -#define EXTRA_DATA_CENTRAL_MTIME 5 -#define EXTRA_DATA_CENTRAL_UNIX_ID 9 -#define EXTRA_DATA_CENTRAL_UNIX_SIZE 11 -#define SIZE_EXTRA_DATA_CENTRAL 13 +static unsigned long +real_crc32(unsigned long crc, const void *buff, size_t len) +{ + return crc32(crc, buff, (unsigned int)len); +} -#define CENTRAL_DIRECTORY_END_SIGNATURE 0 -#define CENTRAL_DIRECTORY_END_DISK 4 -#define CENTRAL_DIRECTORY_END_START_DISK 6 -#define CENTRAL_DIRECTORY_END_ENTRIES_DISK 8 -#define CENTRAL_DIRECTORY_END_ENTRIES 10 -#define CENTRAL_DIRECTORY_END_SIZE 12 -#define CENTRAL_DIRECTORY_END_OFFSET 16 -#define CENTRAL_DIRECTORY_END_COMMENT_LENGTH 20 -#define SIZE_CENTRAL_DIRECTORY_END 22 - -struct zip_file_header_link { - struct zip_file_header_link *next; - struct archive_entry *entry; - int64_t offset; - unsigned long crc32; - int64_t compressed_size; - enum compression compression; - int flags; -}; - -struct zip { - uint8_t data_descriptor[SIZE_DATA_DESCRIPTOR]; - struct zip_file_header_link *central_directory; - struct zip_file_header_link *central_directory_end; - int64_t offset; - int64_t written_bytes; - int64_t remaining_data_bytes; - enum compression compression; - int flags; - struct archive_string_conv *opt_sconv; - struct archive_string_conv *sconv_default; - int init_default_conversion; - -#ifdef HAVE_ZLIB_H - z_stream stream; - size_t len_buf; - unsigned char *buf; -#endif -}; +static unsigned long +fake_crc32(unsigned long crc, const void *buff, size_t len) +{ + (void)crc; /* UNUSED */ + (void)buff; /* UNUSED */ + (void)len; /* UNUSED */ + return 0; +} static int archive_write_zip_options(struct archive_write *a, const char *key, @@ -217,24 +256,108 @@ archive_write_zip_options(struct archive_write *a, const char *key, int ret = ARCHIVE_FAILED; if (strcmp(key, "compression") == 0) { + /* + * Set compression to use on all future entries. + * This only affects regular files. + */ if (val == NULL || val[0] == 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "%s: compression option needs a compression name", a->format_name); } else if (strcmp(val, "deflate") == 0) { #ifdef HAVE_ZLIB_H - zip->compression = COMPRESSION_DEFLATE; + zip->requested_compression = COMPRESSION_DEFLATE; ret = ARCHIVE_OK; #else archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "deflate compression not supported"); #endif } else if (strcmp(val, "store") == 0) { - zip->compression = COMPRESSION_STORE; + zip->requested_compression = COMPRESSION_STORE; ret = ARCHIVE_OK; } return (ret); + } else if (strcmp(key, "compression-level") == 0) { + if (val == NULL || !(val[0] >= '0' && val[0] <= '9') || val[1] != '\0') { + return ARCHIVE_WARN; + } + + if (val[0] == '0') { + zip->requested_compression = COMPRESSION_STORE; + return ARCHIVE_OK; + } else { +#ifdef HAVE_ZLIB_H + zip->requested_compression = COMPRESSION_DEFLATE; + zip->deflate_compression_level = val[0] - '0'; + return ARCHIVE_OK; +#else + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "deflate compression not supported"); +#endif + } + } else if (strcmp(key, "encryption") == 0) { + if (val == NULL) { + zip->encryption_type = ENCRYPTION_NONE; + ret = ARCHIVE_OK; + } else if (val[0] == '1' || strcmp(val, "traditional") == 0 + || strcmp(val, "zipcrypt") == 0 + || strcmp(val, "ZipCrypt") == 0) { + if (is_traditional_pkware_encryption_supported()) { + zip->encryption_type = ENCRYPTION_TRADITIONAL; + ret = ARCHIVE_OK; + } else { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "encryption not supported"); + } + } else if (strcmp(val, "aes128") == 0) { + if (is_winzip_aes_encryption_supported( + ENCRYPTION_WINZIP_AES128)) { + zip->encryption_type = ENCRYPTION_WINZIP_AES128; + ret = ARCHIVE_OK; + } else { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "encryption not supported"); + } + } else if (strcmp(val, "aes256") == 0) { + if (is_winzip_aes_encryption_supported( + ENCRYPTION_WINZIP_AES256)) { + zip->encryption_type = ENCRYPTION_WINZIP_AES256; + ret = ARCHIVE_OK; + } else { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "encryption not supported"); + } + } else { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "%s: unknown encryption '%s'", + a->format_name, val); + } + return (ret); + } else if (strcmp(key, "experimental") == 0) { + if (val == NULL || val[0] == 0) { + zip->flags &= ~ ZIP_FLAG_EXPERIMENT_xl; + } else { + zip->flags |= ZIP_FLAG_EXPERIMENT_xl; + } + return (ARCHIVE_OK); + } else if (strcmp(key, "fakecrc32") == 0) { + /* + * FOR TESTING ONLY: disable CRC calculation to speed up + * certain complex tests. + */ + if (val == NULL || val[0] == 0) { + zip->crc32func = real_crc32; + } else { + zip->crc32func = fake_crc32; + } + return (ARCHIVE_OK); } else if (strcmp(key, "hdrcharset") == 0) { + /* + * Set the character set used in translating filenames. + */ if (val == NULL || val[0] == 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "%s: hdrcharset option needs a character-set name", @@ -248,6 +371,21 @@ archive_write_zip_options(struct archive_write *a, const char *key, ret = ARCHIVE_FATAL; } return (ret); + } else if (strcmp(key, "zip64") == 0) { + /* + * Bias decisions about Zip64: force them to be + * generated in certain cases where they are not + * forbidden or avoid them in certain cases where they + * are not strictly required. + */ + if (val != NULL && *val != '\0') { + zip->flags |= ZIP_FLAG_FORCE_ZIP64; + zip->flags &= ~ZIP_FLAG_AVOID_ZIP64; + } else { + zip->flags &= ~ZIP_FLAG_FORCE_ZIP64; + zip->flags |= ZIP_FLAG_AVOID_ZIP64; + } + return (ARCHIVE_OK); } /* Note: The "warn" return is just to inform the options @@ -261,9 +399,9 @@ archive_write_zip_set_compression_deflate(struct archive *_a) { struct archive_write *a = (struct archive_write *)_a; int ret = ARCHIVE_FAILED; - + archive_check_magic(_a, ARCHIVE_WRITE_MAGIC, - ARCHIVE_STATE_NEW | ARCHIVE_STATE_HEADER, + ARCHIVE_STATE_NEW | ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, "archive_write_zip_set_compression_deflate"); if (a->archive.archive_format != ARCHIVE_FORMAT_ZIP) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, @@ -273,11 +411,12 @@ archive_write_zip_set_compression_deflate(struct archive *_a) } else { #ifdef HAVE_ZLIB_H struct zip *zip = a->format_data; - zip->compression = COMPRESSION_DEFLATE; + zip->requested_compression = COMPRESSION_DEFLATE; ret = ARCHIVE_OK; #else archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "deflate compression not supported"); + ret = ARCHIVE_FAILED; #endif } return (ret); @@ -289,9 +428,9 @@ archive_write_zip_set_compression_store(struct archive *_a) struct archive_write *a = (struct archive_write *)_a; struct zip *zip = a->format_data; int ret = ARCHIVE_FAILED; - + archive_check_magic(_a, ARCHIVE_WRITE_MAGIC, - ARCHIVE_STATE_NEW | ARCHIVE_STATE_HEADER, + ARCHIVE_STATE_NEW | ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA, "archive_write_zip_set_compression_deflate"); if (a->archive.archive_format != ARCHIVE_FORMAT_ZIP) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, @@ -299,7 +438,7 @@ archive_write_zip_set_compression_store(struct archive *_a) " with zip format"); ret = ARCHIVE_FATAL; } else { - zip->compression = COMPRESSION_STORE; + zip->requested_compression = COMPRESSION_STORE; ret = ARCHIVE_OK; } return (ret); @@ -324,14 +463,15 @@ archive_write_set_format_zip(struct archive *_a) "Can't allocate zip data"); return (ARCHIVE_FATAL); } - zip->central_directory = NULL; - zip->central_directory_end = NULL; - zip->offset = 0; - zip->written_bytes = 0; - zip->remaining_data_bytes = 0; + /* "Unspecified" lets us choose the appropriate compression. */ + zip->requested_compression = COMPRESSION_UNSPECIFIED; #ifdef HAVE_ZLIB_H - zip->compression = COMPRESSION_DEFLATE; + zip->deflate_compression_level = Z_DEFAULT_COMPRESSION; +#endif + zip->crc32func = real_crc32; + + /* A buffer used for both compression and encryption. */ zip->len_buf = 65536; zip->buf = malloc(zip->len_buf); if (zip->buf == NULL) { @@ -340,9 +480,6 @@ archive_write_set_format_zip(struct archive *_a) "Can't allocate compression buffer"); return (ARCHIVE_FATAL); } -#else - zip->compression = COMPRESSION_STORE; -#endif a->format_data = zip; a->format_name = "zip"; @@ -355,9 +492,6 @@ archive_write_set_format_zip(struct archive *_a) a->archive.archive_format = ARCHIVE_FORMAT_ZIP; a->archive.archive_format_name = "ZIP"; - archive_le32enc(&zip->data_descriptor[DATA_DESCRIPTOR_SIGNATURE], - ZIP_SIGNATURE_DATA_DESCRIPTOR); - return (ARCHIVE_OK); } @@ -376,17 +510,20 @@ is_all_ascii(const char *p) static int archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) { - struct zip *zip; - uint8_t h[SIZE_LOCAL_FILE_HEADER]; - uint8_t e[SIZE_EXTRA_DATA_LOCAL]; - uint8_t *d; - struct zip_file_header_link *l; - struct archive_string_conv *sconv; + unsigned char local_header[32]; + unsigned char local_extra[144]; + struct zip *zip = a->format_data; + unsigned char *e; + unsigned char *cd_extra; + size_t filename_length; + const char *slink = NULL; + size_t slink_size = 0; + struct archive_string_conv *sconv = get_sconv(a, zip); int ret, ret2 = ARCHIVE_OK; - int64_t size; mode_t type; + int version_needed = 10; - /* Entries other than a regular file or a folder are skipped. */ + /* Ignore types of entries that we don't support. */ type = archive_entry_filetype(entry); if (type != AE_IFREG && type != AE_IFDIR && type != AE_IFLNK) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, @@ -394,70 +531,87 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) return ARCHIVE_FAILED; }; - /* Directory entries should have a size of 0. */ - if (type == AE_IFDIR) - archive_entry_set_size(entry, 0); - - zip = a->format_data; - /* Setup default conversion. */ - if (zip->opt_sconv == NULL && !zip->init_default_conversion) { - zip->sconv_default = - archive_string_default_conversion_for_write(&(a->archive)); - zip->init_default_conversion = 1; - } - - if (zip->flags == 0) { - /* Initialize the general purpose flags. */ - zip->flags = ZIP_FLAGS; - if (zip->opt_sconv != NULL) { - if (strcmp(archive_string_conversion_charset_name( - zip->opt_sconv), "UTF-8") == 0) - zip->flags |= ZIP_FLAGS_UTF8_NAME; -#if HAVE_NL_LANGINFO - } else if (strcmp(nl_langinfo(CODESET), "UTF-8") == 0) { - zip->flags |= ZIP_FLAGS_UTF8_NAME; -#endif + /* If we're not using Zip64, reject large files. */ + if (zip->flags & ZIP_FLAG_AVOID_ZIP64) { + /* Reject entries over 4GB. */ + if (archive_entry_size_is_set(entry) + && (archive_entry_size(entry) > ZIP_4GB_MAX)) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Files > 4GB require Zip64 extensions"); + return ARCHIVE_FAILED; + } + /* Reject entries if archive is > 4GB. */ + if (zip->written_bytes > ZIP_4GB_MAX) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Archives > 4GB require Zip64 extensions"); + return ARCHIVE_FAILED; } } - d = zip->data_descriptor; - size = archive_entry_size(entry); - zip->remaining_data_bytes = size; - /* Append archive entry to the central directory data. */ - l = (struct zip_file_header_link *) malloc(sizeof(*l)); - if (l == NULL) { - archive_set_error(&a->archive, ENOMEM, - "Can't allocate zip header data"); - return (ARCHIVE_FATAL); + /* Only regular files can have size > 0. */ + if (type != AE_IFREG) + archive_entry_set_size(entry, 0); + + + /* Reset information from last entry. */ + zip->entry_offset = zip->written_bytes; + zip->entry_uncompressed_limit = INT64_MAX; + zip->entry_compressed_size = 0; + zip->entry_uncompressed_size = 0; + zip->entry_compressed_written = 0; + zip->entry_uncompressed_written = 0; + zip->entry_flags = 0; + zip->entry_uses_zip64 = 0; + zip->entry_crc32 = zip->crc32func(0, NULL, 0); + zip->entry_encryption = 0; + if (zip->entry != NULL) { + archive_entry_free(zip->entry); + zip->entry = NULL; } + + if (zip->cctx_valid) + archive_encrypto_aes_ctr_release(&zip->cctx); + if (zip->hctx_valid) + archive_hmac_sha1_cleanup(&zip->hctx); + zip->tctx_valid = zip->cctx_valid = zip->hctx_valid = 0; + + if (type == AE_IFREG + &&(!archive_entry_size_is_set(entry) + || archive_entry_size(entry) > 0)) { + switch (zip->encryption_type) { + case ENCRYPTION_TRADITIONAL: + case ENCRYPTION_WINZIP_AES128: + case ENCRYPTION_WINZIP_AES256: + zip->entry_flags |= ZIP_ENTRY_FLAG_ENCRYPTED; + zip->entry_encryption = zip->encryption_type; + break; + default: + break; + } + } + + #if defined(_WIN32) && !defined(__CYGWIN__) /* Make sure the path separators in pahtname, hardlink and symlink * are all slash '/', not the Windows path separator '\'. */ - l->entry = __la_win_entry_in_posix_pathseparator(entry); - if (l->entry == entry) - l->entry = archive_entry_clone(entry); + zip->entry = __la_win_entry_in_posix_pathseparator(entry); + if (zip->entry == entry) + zip->entry = archive_entry_clone(entry); #else - l->entry = archive_entry_clone(entry); + zip->entry = archive_entry_clone(entry); #endif - if (l->entry == NULL) { + if (zip->entry == NULL) { archive_set_error(&a->archive, ENOMEM, "Can't allocate zip header data"); - free(l); return (ARCHIVE_FATAL); } - l->flags = zip->flags; - if (zip->opt_sconv != NULL) - sconv = zip->opt_sconv; - else - sconv = zip->sconv_default; + if (sconv != NULL) { const char *p; size_t len; if (archive_entry_pathname_l(entry, &p, &len, sconv) != 0) { if (errno == ENOMEM) { - archive_entry_free(l->entry); - free(l); archive_set_error(&a->archive, ENOMEM, "Can't allocate memory for Pathname"); return (ARCHIVE_FATAL); @@ -470,163 +624,378 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry) ret2 = ARCHIVE_WARN; } if (len > 0) - archive_entry_set_pathname(l->entry, p); + archive_entry_set_pathname(zip->entry, p); /* - * Although there is no character-set regulation for Symlink, - * it is suitable to convert a character-set of Symlinke to - * what those of the Pathname has been converted to. + * There is no standard for symlink handling; we convert + * it using the same character-set translation that we use + * for filename. */ if (type == AE_IFLNK) { if (archive_entry_symlink_l(entry, &p, &len, sconv)) { if (errno == ENOMEM) { - archive_entry_free(l->entry); - free(l); archive_set_error(&a->archive, ENOMEM, "Can't allocate memory " " for Symlink"); return (ARCHIVE_FATAL); } - /* - * Even if the strng conversion failed, - * we should not report the error since - * thre is no regulation for. - */ + /* No error if we can't convert. */ } else if (len > 0) - archive_entry_set_symlink(l->entry, p); + archive_entry_set_symlink(zip->entry, p); } } - /* If all characters in a filename are ASCII, Reset UTF-8 Name flag. */ - if ((l->flags & ZIP_FLAGS_UTF8_NAME) != 0 && - is_all_ascii(archive_entry_pathname(l->entry))) - l->flags &= ~ZIP_FLAGS_UTF8_NAME; - /* Initialize the CRC variable and potentially the local crc32(). */ - l->crc32 = crc32(0, NULL, 0); + /* If filename isn't ASCII and we can use UTF-8, set the UTF-8 flag. */ + if (!is_all_ascii(archive_entry_pathname(zip->entry))) { + if (zip->opt_sconv != NULL) { + if (strcmp(archive_string_conversion_charset_name( + zip->opt_sconv), "UTF-8") == 0) + zip->entry_flags |= ZIP_ENTRY_FLAG_UTF8_NAME; +#if HAVE_NL_LANGINFO + } else if (strcmp(nl_langinfo(CODESET), "UTF-8") == 0) { + zip->entry_flags |= ZIP_ENTRY_FLAG_UTF8_NAME; +#endif + } + } + filename_length = path_length(zip->entry); + + /* Determine appropriate compression and size for this entry. */ if (type == AE_IFLNK) { - const char *p = archive_entry_symlink(l->entry); - if (p != NULL) - size = strlen(p); + slink = archive_entry_symlink(zip->entry); + if (slink != NULL) + slink_size = strlen(slink); else - size = 0; - zip->remaining_data_bytes = 0; - archive_entry_set_size(l->entry, size); - l->compression = COMPRESSION_STORE; - l->compressed_size = size; + slink_size = 0; + zip->entry_uncompressed_limit = slink_size; + zip->entry_compressed_size = slink_size; + zip->entry_uncompressed_size = slink_size; + zip->entry_crc32 = zip->crc32func(zip->entry_crc32, + (const unsigned char *)slink, slink_size); + zip->entry_compression = COMPRESSION_STORE; + version_needed = 20; + } else if (type != AE_IFREG) { + zip->entry_compression = COMPRESSION_STORE; + zip->entry_uncompressed_limit = 0; + version_needed = 20; + } else if (archive_entry_size_is_set(zip->entry)) { + int64_t size = archive_entry_size(zip->entry); + int64_t additional_size = 0; + + zip->entry_uncompressed_limit = size; + zip->entry_compression = zip->requested_compression; + if (zip->entry_compression == COMPRESSION_UNSPECIFIED) { + zip->entry_compression = COMPRESSION_DEFAULT; + } + if (zip->entry_compression == COMPRESSION_STORE) { + zip->entry_compressed_size = size; + zip->entry_uncompressed_size = size; + version_needed = 10; + } else { + zip->entry_uncompressed_size = size; + version_needed = 20; + } + + if (zip->entry_flags & ZIP_ENTRY_FLAG_ENCRYPTED) { + switch (zip->entry_encryption) { + case ENCRYPTION_TRADITIONAL: + additional_size = TRAD_HEADER_SIZE; + version_needed = 20; + break; + case ENCRYPTION_WINZIP_AES128: + additional_size = WINZIP_AES128_HEADER_SIZE + + AUTH_CODE_SIZE; + version_needed = 20; + break; + case ENCRYPTION_WINZIP_AES256: + additional_size = WINZIP_AES256_HEADER_SIZE + + AUTH_CODE_SIZE; + version_needed = 20; + break; + default: + break; + } + if (zip->entry_compression == COMPRESSION_STORE) + zip->entry_compressed_size += additional_size; + } + + /* + * Set Zip64 extension in any of the following cases + * (this was suggested by discussion on info-zip-dev + * mailing list): + * = Zip64 is being forced by user + * = File is over 4GiB uncompressed + * (including encryption header, if any) + * = File is close to 4GiB and is being compressed + * (compression might make file larger) + */ + if ((zip->flags & ZIP_FLAG_FORCE_ZIP64) + || (zip->entry_uncompressed_size + additional_size > ZIP_4GB_MAX) + || (zip->entry_uncompressed_size > ZIP_4GB_MAX_UNCOMPRESSED + && zip->entry_compression != COMPRESSION_STORE)) { + zip->entry_uses_zip64 = 1; + version_needed = 45; + } + + /* We may know the size, but never the CRC. */ + zip->entry_flags |= ZIP_ENTRY_FLAG_LENGTH_AT_END; } else { - l->compression = zip->compression; - l->compressed_size = 0; + /* We don't know the size. In this case, we prefer + * deflate (it has a clear end-of-data marker which + * makes length-at-end more reliable) and will + * enable Zip64 extensions unless we're told not to. + */ + zip->entry_compression = COMPRESSION_DEFAULT; + zip->entry_flags |= ZIP_ENTRY_FLAG_LENGTH_AT_END; + if ((zip->flags & ZIP_FLAG_AVOID_ZIP64) == 0) { + zip->entry_uses_zip64 = 1; + version_needed = 45; + } else if (zip->entry_compression == COMPRESSION_STORE) { + version_needed = 10; + } else { + version_needed = 20; + } + + if (zip->entry_flags & ZIP_ENTRY_FLAG_ENCRYPTED) { + switch (zip->entry_encryption) { + case ENCRYPTION_TRADITIONAL: + case ENCRYPTION_WINZIP_AES128: + case ENCRYPTION_WINZIP_AES256: + if (version_needed < 20) + version_needed = 20; + break; + default: + break; + } + } } - l->next = NULL; - if (zip->central_directory == NULL) { - zip->central_directory = l; + + /* Format the local header. */ + memset(local_header, 0, sizeof(local_header)); + memcpy(local_header, "PK\003\004", 4); + archive_le16enc(local_header + 4, version_needed); + archive_le16enc(local_header + 6, zip->entry_flags); + if (zip->entry_encryption == ENCRYPTION_WINZIP_AES128 + || zip->entry_encryption == ENCRYPTION_WINZIP_AES256) + archive_le16enc(local_header + 8, WINZIP_AES_ENCRYPTION); + else + archive_le16enc(local_header + 8, zip->entry_compression); + archive_le32enc(local_header + 10, + dos_time(archive_entry_mtime(zip->entry))); + archive_le32enc(local_header + 14, zip->entry_crc32); + if (zip->entry_uses_zip64) { + /* Zip64 data in the local header "must" include both + * compressed and uncompressed sizes AND those fields + * are included only if these are 0xffffffff; + * THEREFORE these must be set this way, even if we + * know one of them is smaller. */ + archive_le32enc(local_header + 18, ZIP_4GB_MAX); + archive_le32enc(local_header + 22, ZIP_4GB_MAX); } else { - zip->central_directory_end->next = l; + archive_le32enc(local_header + 18, (uint32_t)zip->entry_compressed_size); + archive_le32enc(local_header + 22, (uint32_t)zip->entry_uncompressed_size); } - zip->central_directory_end = l; + archive_le16enc(local_header + 26, (uint16_t)filename_length); - /* Store the offset of this header for later use in central - * directory. */ - l->offset = zip->written_bytes; + if (zip->entry_encryption == ENCRYPTION_TRADITIONAL) { + if (zip->entry_flags & ZIP_ENTRY_FLAG_LENGTH_AT_END) + zip->trad_chkdat = local_header[11]; + else + zip->trad_chkdat = local_header[17]; + } - memset(h, 0, sizeof(h)); - archive_le32enc(&h[LOCAL_FILE_HEADER_SIGNATURE], - ZIP_SIGNATURE_LOCAL_FILE_HEADER); - archive_le16enc(&h[LOCAL_FILE_HEADER_VERSION], ZIP_VERSION_EXTRACT); - archive_le16enc(&h[LOCAL_FILE_HEADER_FLAGS], l->flags); - archive_le16enc(&h[LOCAL_FILE_HEADER_COMPRESSION], l->compression); - archive_le32enc(&h[LOCAL_FILE_HEADER_TIMEDATE], - dos_time(archive_entry_mtime(entry))); - archive_le16enc(&h[LOCAL_FILE_HEADER_FILENAME_LENGTH], - (uint16_t)path_length(l->entry)); + /* Format as much of central directory file header as we can: */ + zip->file_header = cd_alloc(zip, 46); + /* If (zip->file_header == NULL) XXXX */ + ++zip->central_directory_entries; + memset(zip->file_header, 0, 46); + memcpy(zip->file_header, "PK\001\002", 4); + /* "Made by PKZip 2.0 on Unix." */ + archive_le16enc(zip->file_header + 4, 3 * 256 + version_needed); + archive_le16enc(zip->file_header + 6, version_needed); + archive_le16enc(zip->file_header + 8, zip->entry_flags); + if (zip->entry_encryption == ENCRYPTION_WINZIP_AES128 + || zip->entry_encryption == ENCRYPTION_WINZIP_AES256) + archive_le16enc(zip->file_header + 10, WINZIP_AES_ENCRYPTION); + else + archive_le16enc(zip->file_header + 10, zip->entry_compression); + archive_le32enc(zip->file_header + 12, + dos_time(archive_entry_mtime(zip->entry))); + archive_le16enc(zip->file_header + 28, (uint16_t)filename_length); + /* Following Info-Zip, store mode in the "external attributes" field. */ + archive_le32enc(zip->file_header + 38, + ((uint32_t)archive_entry_mode(zip->entry)) << 16); + e = cd_alloc(zip, filename_length); + /* If (e == NULL) XXXX */ + copy_path(zip->entry, e); + + /* Format extra data. */ + memset(local_extra, 0, sizeof(local_extra)); + e = local_extra; + + /* First, extra blocks that are the same between + * the local file header and the central directory. + * We format them once and then duplicate them. */ + + /* UT timestamp, length depends on what timestamps are set. */ + memcpy(e, "UT", 2); + archive_le16enc(e + 2, + 1 + + (archive_entry_mtime_is_set(entry) ? 4 : 0) + + (archive_entry_atime_is_set(entry) ? 4 : 0) + + (archive_entry_ctime_is_set(entry) ? 4 : 0)); + e += 4; + *e++ = + (archive_entry_mtime_is_set(entry) ? 1 : 0) + | (archive_entry_atime_is_set(entry) ? 2 : 0) + | (archive_entry_ctime_is_set(entry) ? 4 : 0); + if (archive_entry_mtime_is_set(entry)) { + archive_le32enc(e, (uint32_t)archive_entry_mtime(entry)); + e += 4; + } + if (archive_entry_atime_is_set(entry)) { + archive_le32enc(e, (uint32_t)archive_entry_atime(entry)); + e += 4; + } + if (archive_entry_ctime_is_set(entry)) { + archive_le32enc(e, (uint32_t)archive_entry_ctime(entry)); + e += 4; + } + + /* ux Unix extra data, length 11, version 1 */ + /* TODO: If uid < 64k, use 2 bytes, ditto for gid. */ + memcpy(e, "ux\013\000\001", 5); + e += 5; + *e++ = 4; /* Length of following UID */ + archive_le32enc(e, (uint32_t)archive_entry_uid(entry)); + e += 4; + *e++ = 4; /* Length of following GID */ + archive_le32enc(e, (uint32_t)archive_entry_gid(entry)); + e += 4; + + /* AES extra data field: WinZIP AES information, ID=0x9901 */ + if ((zip->entry_flags & ZIP_ENTRY_FLAG_ENCRYPTED) + && (zip->entry_encryption == ENCRYPTION_WINZIP_AES128 + || zip->entry_encryption == ENCRYPTION_WINZIP_AES256)) { + + memcpy(e, "\001\231\007\000\001\000AE", 8); + /* AES vendoer version AE-2 does not store a CRC. + * WinZip 11 uses AE-1, which does store the CRC, + * but it does not store the CRC when the file size + * is less than 20 bytes. So we simulate what + * WinZip 11 does. + * NOTE: WinZip 9.0 and 10.0 uses AE-2 by default. */ + if (archive_entry_size_is_set(zip->entry) + && archive_entry_size(zip->entry) < 20) { + archive_le16enc(e+4, AES_VENDOR_AE_2); + zip->aes_vendor = AES_VENDOR_AE_2;/* no CRC. */ + } else + zip->aes_vendor = AES_VENDOR_AE_1; + e += 8; + /* AES encryption strength. */ + *e++ = (zip->entry_encryption == ENCRYPTION_WINZIP_AES128)?1:3; + /* Actual compression method. */ + archive_le16enc(e, zip->entry_compression); + e += 2; + } + + /* Copy UT ,ux, and AES-extra into central directory as well. */ + zip->file_header_extra_offset = zip->central_directory_bytes; + cd_extra = cd_alloc(zip, e - local_extra); + memcpy(cd_extra, local_extra, e - local_extra); + + /* + * Following extra blocks vary between local header and + * central directory. These are the local header versions. + * Central directory versions get formatted in + * archive_write_zip_finish_entry() below. + */ + + /* "[Zip64 entry] in the local header MUST include BOTH + * original [uncompressed] and compressed size fields." */ + if (zip->entry_uses_zip64) { + unsigned char *zip64_start = e; + memcpy(e, "\001\000\020\000", 4); + e += 4; + archive_le64enc(e, zip->entry_uncompressed_size); + e += 8; + archive_le64enc(e, zip->entry_compressed_size); + e += 8; + archive_le16enc(zip64_start + 2, (uint16_t)(e - (zip64_start + 4))); + } + + if (zip->flags & ZIP_FLAG_EXPERIMENT_xl) { + /* Experimental 'xl' extension to improve streaming. */ + unsigned char *external_info = e; + int included = 7; + memcpy(e, "xl\000\000", 4); // 0x6c65 + 2-byte length + e += 4; + e[0] = included; /* bitmap of included fields */ + e += 1; + if (included & 1) { + archive_le16enc(e, /* "Version created by" */ + 3 * 256 + version_needed); + e += 2; + } + if (included & 2) { + archive_le16enc(e, 0); /* internal file attributes */ + e += 2; + } + if (included & 4) { + archive_le32enc(e, /* external file attributes */ + ((uint32_t)archive_entry_mode(zip->entry)) << 16); + e += 4; + } + if (included & 8) { + // Libarchive does not currently support file comments. + } + archive_le16enc(external_info + 2, (uint16_t)(e - (external_info + 4))); + } + + /* Update local header with size of extra data and write it all out: */ + archive_le16enc(local_header + 28, (uint16_t)(e - local_extra)); + + ret = __archive_write_output(a, local_header, 30); + if (ret != ARCHIVE_OK) + return (ARCHIVE_FATAL); + zip->written_bytes += 30; + + ret = write_path(zip->entry, a); + if (ret <= ARCHIVE_OK) + return (ARCHIVE_FATAL); + zip->written_bytes += ret; + + ret = __archive_write_output(a, local_extra, e - local_extra); + if (ret != ARCHIVE_OK) + return (ARCHIVE_FATAL); + zip->written_bytes += e - local_extra; + + /* For symlinks, write the body now. */ + if (slink != NULL) { + ret = __archive_write_output(a, slink, slink_size); + if (ret != ARCHIVE_OK) + return (ARCHIVE_FATAL); + zip->entry_compressed_written += slink_size; + zip->entry_uncompressed_written += slink_size; + zip->written_bytes += slink_size; + } - switch (l->compression) { - case COMPRESSION_STORE: - /* Setting compressed and uncompressed sizes even when - * specification says to set to zero when using data - * descriptors. Otherwise the end of the data for an - * entry is rather difficult to find. */ - archive_le32enc(&h[LOCAL_FILE_HEADER_COMPRESSED_SIZE], - (uint32_t)size); - archive_le32enc(&h[LOCAL_FILE_HEADER_UNCOMPRESSED_SIZE], - (uint32_t)size); - break; #ifdef HAVE_ZLIB_H - case COMPRESSION_DEFLATE: - archive_le32enc(&h[LOCAL_FILE_HEADER_UNCOMPRESSED_SIZE], - (uint32_t)size); - + if (zip->entry_compression == COMPRESSION_DEFLATE) { zip->stream.zalloc = Z_NULL; zip->stream.zfree = Z_NULL; zip->stream.opaque = Z_NULL; zip->stream.next_out = zip->buf; zip->stream.avail_out = (uInt)zip->len_buf; - if (deflateInit2(&zip->stream, Z_DEFAULT_COMPRESSION, + if (deflateInit2(&zip->stream, zip->deflate_compression_level, Z_DEFLATED, -15, 8, Z_DEFAULT_STRATEGY) != Z_OK) { archive_set_error(&a->archive, ENOMEM, "Can't init deflate compressor"); return (ARCHIVE_FATAL); } - break; + } #endif - } - /* Formatting extra data. */ - archive_le16enc(&h[LOCAL_FILE_HEADER_EXTRA_LENGTH], sizeof(e)); - archive_le16enc(&e[EXTRA_DATA_LOCAL_TIME_ID], - ZIP_SIGNATURE_EXTRA_TIMESTAMP); - archive_le16enc(&e[EXTRA_DATA_LOCAL_TIME_SIZE], 1 + 4 * 3); - e[EXTRA_DATA_LOCAL_TIME_FLAG] = 0x07; - archive_le32enc(&e[EXTRA_DATA_LOCAL_MTIME], - (uint32_t)archive_entry_mtime(entry)); - archive_le32enc(&e[EXTRA_DATA_LOCAL_ATIME], - (uint32_t)archive_entry_atime(entry)); - archive_le32enc(&e[EXTRA_DATA_LOCAL_CTIME], - (uint32_t)archive_entry_ctime(entry)); - - archive_le16enc(&e[EXTRA_DATA_LOCAL_UNIX_ID], - ZIP_SIGNATURE_EXTRA_NEW_UNIX); - archive_le16enc(&e[EXTRA_DATA_LOCAL_UNIX_SIZE], 1 + (1 + 4) * 2); - e[EXTRA_DATA_LOCAL_UNIX_VERSION] = 1; - e[EXTRA_DATA_LOCAL_UNIX_UID_SIZE] = 4; - archive_le32enc(&e[EXTRA_DATA_LOCAL_UNIX_UID], - (uint32_t)archive_entry_uid(entry)); - e[EXTRA_DATA_LOCAL_UNIX_GID_SIZE] = 4; - archive_le32enc(&e[EXTRA_DATA_LOCAL_UNIX_GID], - (uint32_t)archive_entry_gid(entry)); - - archive_le32enc(&d[DATA_DESCRIPTOR_UNCOMPRESSED_SIZE], - (uint32_t)size); - - ret = __archive_write_output(a, h, sizeof(h)); - if (ret != ARCHIVE_OK) - return (ARCHIVE_FATAL); - zip->written_bytes += sizeof(h); - - ret = write_path(l->entry, a); - if (ret <= ARCHIVE_OK) - return (ARCHIVE_FATAL); - zip->written_bytes += ret; - - ret = __archive_write_output(a, e, sizeof(e)); - if (ret != ARCHIVE_OK) - return (ARCHIVE_FATAL); - zip->written_bytes += sizeof(e); - - if (type == AE_IFLNK) { - const unsigned char *p; - - p = (const unsigned char *)archive_entry_symlink(l->entry); - ret = __archive_write_output(a, p, (size_t)size); - if (ret != ARCHIVE_OK) - return (ARCHIVE_FATAL); - zip->written_bytes += size; - l->crc32 = crc32(l->crc32, p, (unsigned)size); - } - - if (ret2 != ARCHIVE_OK) - return (ret2); - return (ARCHIVE_OK); + return (ret2); } static ssize_t @@ -634,22 +1003,80 @@ archive_write_zip_data(struct archive_write *a, const void *buff, size_t s) { int ret; struct zip *zip = a->format_data; - struct zip_file_header_link *l = zip->central_directory_end; - if ((int64_t)s > zip->remaining_data_bytes) - s = (size_t)zip->remaining_data_bytes; + if ((int64_t)s > zip->entry_uncompressed_limit) + s = (size_t)zip->entry_uncompressed_limit; + zip->entry_uncompressed_written += s; if (s == 0) return 0; - switch (l->compression) { + if (zip->entry_flags & ZIP_ENTRY_FLAG_ENCRYPTED) { + switch (zip->entry_encryption) { + case ENCRYPTION_TRADITIONAL: + /* Initialize traditoinal PKWARE encryption context. */ + if (!zip->tctx_valid) { + ret = init_traditional_pkware_encryption(a); + if (ret != ARCHIVE_OK) + return (ret); + zip->tctx_valid = 1; + } + break; + case ENCRYPTION_WINZIP_AES128: + case ENCRYPTION_WINZIP_AES256: + if (!zip->cctx_valid) { + ret = init_winzip_aes_encryption(a); + if (ret != ARCHIVE_OK) + return (ret); + zip->cctx_valid = zip->hctx_valid = 1; + } + break; + default: + break; + } + } + + switch (zip->entry_compression) { case COMPRESSION_STORE: - ret = __archive_write_output(a, buff, s); - if (ret != ARCHIVE_OK) return (ret); - zip->written_bytes += s; - zip->remaining_data_bytes -= s; - l->compressed_size += s; - l->crc32 = crc32(l->crc32, buff, (unsigned)s); - return (s); + if (zip->tctx_valid || zip->cctx_valid) { + const uint8_t *rb = (const uint8_t *)buff; + const uint8_t * const re = rb + s; + + while (rb < re) { + size_t l; + + if (zip->tctx_valid) { + l = trad_enc_encrypt_update(&zip->tctx, + rb, re - rb, + zip->buf, zip->len_buf); + } else { + l = zip->len_buf; + ret = archive_encrypto_aes_ctr_update( + &zip->cctx, + rb, re - rb, zip->buf, &l); + if (ret < 0) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Failed to encrypt file"); + return (ARCHIVE_FAILED); + } + archive_hmac_sha1_update(&zip->hctx, + zip->buf, l); + } + ret = __archive_write_output(a, zip->buf, l); + if (ret != ARCHIVE_OK) + return (ret); + zip->entry_compressed_written += l; + zip->written_bytes += l; + rb += l; + } + } else { + ret = __archive_write_output(a, buff, s); + if (ret != ARCHIVE_OK) + return (ret); + zip->written_bytes += s; + zip->entry_compressed_written += s; + } + break; #if HAVE_ZLIB_H case COMPRESSION_DEFLATE: zip->stream.next_in = (unsigned char*)(uintptr_t)buff; @@ -659,20 +1086,36 @@ archive_write_zip_data(struct archive_write *a, const void *buff, size_t s) if (ret == Z_STREAM_ERROR) return (ARCHIVE_FATAL); if (zip->stream.avail_out == 0) { + if (zip->tctx_valid) { + trad_enc_encrypt_update(&zip->tctx, + zip->buf, zip->len_buf, + zip->buf, zip->len_buf); + } else if (zip->cctx_valid) { + size_t outl = zip->len_buf; + ret = archive_encrypto_aes_ctr_update( + &zip->cctx, + zip->buf, zip->len_buf, + zip->buf, &outl); + if (ret < 0) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Failed to encrypt file"); + return (ARCHIVE_FAILED); + } + archive_hmac_sha1_update(&zip->hctx, + zip->buf, zip->len_buf); + } ret = __archive_write_output(a, zip->buf, zip->len_buf); if (ret != ARCHIVE_OK) return (ret); - l->compressed_size += zip->len_buf; + zip->entry_compressed_written += zip->len_buf; zip->written_bytes += zip->len_buf; zip->stream.next_out = zip->buf; zip->stream.avail_out = (uInt)zip->len_buf; } } while (zip->stream.avail_in != 0); - zip->remaining_data_bytes -= s; - /* If we have it, use zlib's fast crc32() */ - l->crc32 = crc32(l->crc32, buff, (uInt)s); - return (s); + break; #endif default: @@ -680,153 +1123,222 @@ archive_write_zip_data(struct archive_write *a, const void *buff, size_t s) "Invalid ZIP compression type"); return ARCHIVE_FATAL; } + + zip->entry_uncompressed_limit -= s; + if (!zip->cctx_valid || zip->aes_vendor != AES_VENDOR_AE_2) + zip->entry_crc32 = + zip->crc32func(zip->entry_crc32, buff, (unsigned)s); + return (s); + } static int archive_write_zip_finish_entry(struct archive_write *a) { - /* Write the data descripter after file data has been written. */ - int ret; struct zip *zip = a->format_data; - uint8_t *d = zip->data_descriptor; - struct zip_file_header_link *l = zip->central_directory_end; -#if HAVE_ZLIB_H - size_t reminder; -#endif + int ret; - switch(l->compression) { - case COMPRESSION_STORE: - break; #if HAVE_ZLIB_H - case COMPRESSION_DEFLATE: + if (zip->entry_compression == COMPRESSION_DEFLATE) { for (;;) { + size_t remainder; + ret = deflate(&zip->stream, Z_FINISH); if (ret == Z_STREAM_ERROR) return (ARCHIVE_FATAL); - reminder = zip->len_buf - zip->stream.avail_out; - ret = __archive_write_output(a, zip->buf, reminder); + remainder = zip->len_buf - zip->stream.avail_out; + if (zip->tctx_valid) { + trad_enc_encrypt_update(&zip->tctx, + zip->buf, remainder, zip->buf, remainder); + } else if (zip->cctx_valid) { + size_t outl = remainder; + ret = archive_encrypto_aes_ctr_update( + &zip->cctx, zip->buf, remainder, + zip->buf, &outl); + if (ret < 0) { + archive_set_error(&a->archive, + ARCHIVE_ERRNO_MISC, + "Failed to encrypt file"); + return (ARCHIVE_FAILED); + } + archive_hmac_sha1_update(&zip->hctx, + zip->buf, remainder); + } + ret = __archive_write_output(a, zip->buf, remainder); if (ret != ARCHIVE_OK) return (ret); - l->compressed_size += reminder; - zip->written_bytes += reminder; + zip->entry_compressed_written += remainder; + zip->written_bytes += remainder; zip->stream.next_out = zip->buf; if (zip->stream.avail_out != 0) break; zip->stream.avail_out = (uInt)zip->len_buf; } deflateEnd(&zip->stream); - break; + } #endif + if (zip->hctx_valid) { + uint8_t hmac[20]; + size_t hmac_len = 20; + + archive_hmac_sha1_final(&zip->hctx, hmac, &hmac_len); + ret = __archive_write_output(a, hmac, AUTH_CODE_SIZE); + if (ret != ARCHIVE_OK) + return (ret); + zip->entry_compressed_written += AUTH_CODE_SIZE; + zip->written_bytes += AUTH_CODE_SIZE; } - archive_le32enc(&d[DATA_DESCRIPTOR_CRC32], l->crc32); - archive_le32enc(&d[DATA_DESCRIPTOR_COMPRESSED_SIZE], - (uint32_t)l->compressed_size); - ret = __archive_write_output(a, d, SIZE_DATA_DESCRIPTOR); - if (ret != ARCHIVE_OK) - return (ARCHIVE_FATAL); - zip->written_bytes += SIZE_DATA_DESCRIPTOR; + /* Write trailing data descriptor. */ + if ((zip->entry_flags & ZIP_ENTRY_FLAG_LENGTH_AT_END) != 0) { + char d[24]; + memcpy(d, "PK\007\010", 4); + if (zip->cctx_valid && zip->aes_vendor == AES_VENDOR_AE_2) + archive_le32enc(d + 4, 0);/* no CRC.*/ + else + archive_le32enc(d + 4, zip->entry_crc32); + if (zip->entry_uses_zip64) { + archive_le64enc(d + 8, + (uint64_t)zip->entry_compressed_written); + archive_le64enc(d + 16, + (uint64_t)zip->entry_uncompressed_written); + ret = __archive_write_output(a, d, 24); + zip->written_bytes += 24; + } else { + archive_le32enc(d + 8, + (uint32_t)zip->entry_compressed_written); + archive_le32enc(d + 12, + (uint32_t)zip->entry_uncompressed_written); + ret = __archive_write_output(a, d, 16); + zip->written_bytes += 16; + } + if (ret != ARCHIVE_OK) + return (ARCHIVE_FATAL); + } + + /* Append Zip64 extra data to central directory information. */ + if (zip->entry_compressed_written > ZIP_4GB_MAX + || zip->entry_uncompressed_written > ZIP_4GB_MAX + || zip->entry_offset > ZIP_4GB_MAX) { + unsigned char zip64[32]; + unsigned char *z = zip64, *zd; + memcpy(z, "\001\000\000\000", 4); + z += 4; + if (zip->entry_uncompressed_written >= ZIP_4GB_MAX) { + archive_le64enc(z, zip->entry_uncompressed_written); + z += 8; + } + if (zip->entry_compressed_written >= ZIP_4GB_MAX) { + archive_le64enc(z, zip->entry_compressed_written); + z += 8; + } + if (zip->entry_offset >= ZIP_4GB_MAX) { + archive_le64enc(z, zip->entry_offset); + z += 8; + } + archive_le16enc(zip64 + 2, (uint16_t)(z - (zip64 + 4))); + zd = cd_alloc(zip, z - zip64); + if (zd == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate zip data"); + return (ARCHIVE_FATAL); + } + memcpy(zd, zip64, z - zip64); + /* Zip64 means version needs to be set to at least 4.5 */ + if (archive_le16dec(zip->file_header + 6) < 45) + archive_le16enc(zip->file_header + 6, 45); + } + + /* Fix up central directory file header. */ + if (zip->cctx_valid && zip->aes_vendor == AES_VENDOR_AE_2) + archive_le32enc(zip->file_header + 16, 0);/* no CRC.*/ + else + archive_le32enc(zip->file_header + 16, zip->entry_crc32); + archive_le32enc(zip->file_header + 20, + (uint32_t)zipmin(zip->entry_compressed_written, + ZIP_4GB_MAX)); + archive_le32enc(zip->file_header + 24, + (uint32_t)zipmin(zip->entry_uncompressed_written, + ZIP_4GB_MAX)); + archive_le16enc(zip->file_header + 30, + (uint16_t)(zip->central_directory_bytes - zip->file_header_extra_offset)); + archive_le32enc(zip->file_header + 42, + (uint32_t)zipmin(zip->entry_offset, + ZIP_4GB_MAX)); + return (ARCHIVE_OK); } static int archive_write_zip_close(struct archive_write *a) { - struct zip *zip; - struct zip_file_header_link *l; - uint8_t h[SIZE_FILE_HEADER]; - uint8_t end[SIZE_CENTRAL_DIRECTORY_END]; - uint8_t e[SIZE_EXTRA_DATA_CENTRAL]; + uint8_t buff[64]; int64_t offset_start, offset_end; - int entries; + struct zip *zip = a->format_data; + struct cd_segment *segment; int ret; - zip = a->format_data; - l = zip->central_directory; - - /* - * Formatting central directory file header fields that are - * fixed for all entries. - * Fields not used (and therefor 0) are: - * - * - comment_length - * - disk_number - * - attributes_internal - */ - memset(h, 0, sizeof(h)); - archive_le32enc(&h[FILE_HEADER_SIGNATURE], ZIP_SIGNATURE_FILE_HEADER); - archive_le16enc(&h[FILE_HEADER_VERSION_BY], ZIP_VERSION_BY); - archive_le16enc(&h[FILE_HEADER_VERSION_EXTRACT], ZIP_VERSION_EXTRACT); - - entries = 0; offset_start = zip->written_bytes; - - /* Formatting individual header fields per entry and - * writing each entry. */ - while (l != NULL) { - archive_le16enc(&h[FILE_HEADER_FLAGS], l->flags); - archive_le16enc(&h[FILE_HEADER_COMPRESSION], l->compression); - archive_le32enc(&h[FILE_HEADER_TIMEDATE], - dos_time(archive_entry_mtime(l->entry))); - archive_le32enc(&h[FILE_HEADER_CRC32], l->crc32); - archive_le32enc(&h[FILE_HEADER_COMPRESSED_SIZE], - (uint32_t)l->compressed_size); - archive_le32enc(&h[FILE_HEADER_UNCOMPRESSED_SIZE], - (uint32_t)archive_entry_size(l->entry)); - archive_le16enc(&h[FILE_HEADER_FILENAME_LENGTH], - (uint16_t)path_length(l->entry)); - archive_le16enc(&h[FILE_HEADER_EXTRA_LENGTH], sizeof(e)); - archive_le16enc(&h[FILE_HEADER_ATTRIBUTES_EXTERNAL+2], - archive_entry_mode(l->entry)); - archive_le32enc(&h[FILE_HEADER_OFFSET], (uint32_t)l->offset); - - /* Formatting extra data. */ - archive_le16enc(&e[EXTRA_DATA_CENTRAL_TIME_ID], - ZIP_SIGNATURE_EXTRA_TIMESTAMP); - archive_le16enc(&e[EXTRA_DATA_CENTRAL_TIME_SIZE], 1 + 4); - e[EXTRA_DATA_CENTRAL_TIME_FLAG] = 0x07; - archive_le32enc(&e[EXTRA_DATA_CENTRAL_MTIME], - (uint32_t)archive_entry_mtime(l->entry)); - archive_le16enc(&e[EXTRA_DATA_CENTRAL_UNIX_ID], - ZIP_SIGNATURE_EXTRA_NEW_UNIX); - archive_le16enc(&e[EXTRA_DATA_CENTRAL_UNIX_SIZE], 0x0000); - - ret = __archive_write_output(a, h, sizeof(h)); + segment = zip->central_directory; + while (segment != NULL) { + ret = __archive_write_output(a, + segment->buff, segment->p - segment->buff); if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); - zip->written_bytes += sizeof(h); - - ret = write_path(l->entry, a); - if (ret <= ARCHIVE_OK) - return (ARCHIVE_FATAL); - zip->written_bytes += ret; - - ret = __archive_write_output(a, e, sizeof(e)); - if (ret != ARCHIVE_OK) - return (ARCHIVE_FATAL); - zip->written_bytes += sizeof(e); - - l = l->next; - entries++; + zip->written_bytes += segment->p - segment->buff; + segment = segment->next; } offset_end = zip->written_bytes; - /* Formatting end of central directory. */ - memset(end, 0, sizeof(end)); - archive_le32enc(&end[CENTRAL_DIRECTORY_END_SIGNATURE], - ZIP_SIGNATURE_CENTRAL_DIRECTORY_END); - archive_le16enc(&end[CENTRAL_DIRECTORY_END_ENTRIES_DISK], entries); - archive_le16enc(&end[CENTRAL_DIRECTORY_END_ENTRIES], entries); - archive_le32enc(&end[CENTRAL_DIRECTORY_END_SIZE], - (uint32_t)(offset_end - offset_start)); - archive_le32enc(&end[CENTRAL_DIRECTORY_END_OFFSET], - (uint32_t)offset_start); + /* If central dir info is too large, write Zip64 end-of-cd */ + if (offset_end - offset_start > ZIP_4GB_MAX + || offset_start > ZIP_4GB_MAX + || zip->central_directory_entries > 0xffffUL + || (zip->flags & ZIP_FLAG_FORCE_ZIP64)) { + /* Zip64 end-of-cd record */ + memset(buff, 0, 56); + memcpy(buff, "PK\006\006", 4); + archive_le64enc(buff + 4, 44); + archive_le16enc(buff + 12, 45); + archive_le16enc(buff + 14, 45); + /* This is disk 0 of 0. */ + archive_le64enc(buff + 24, zip->central_directory_entries); + archive_le64enc(buff + 32, zip->central_directory_entries); + archive_le64enc(buff + 40, offset_end - offset_start); + archive_le64enc(buff + 48, offset_start); + ret = __archive_write_output(a, buff, 56); + if (ret != ARCHIVE_OK) + return (ARCHIVE_FATAL); + zip->written_bytes += 56; - /* Writing end of central directory. */ - ret = __archive_write_output(a, end, sizeof(end)); + /* Zip64 end-of-cd locator record. */ + memset(buff, 0, 20); + memcpy(buff, "PK\006\007", 4); + archive_le32enc(buff + 4, 0); + archive_le64enc(buff + 8, offset_end); + archive_le32enc(buff + 16, 1); + ret = __archive_write_output(a, buff, 20); + if (ret != ARCHIVE_OK) + return (ARCHIVE_FATAL); + zip->written_bytes += 20; + + } + + /* Format and write end of central directory. */ + memset(buff, 0, sizeof(buff)); + memcpy(buff, "PK\005\006", 4); + archive_le16enc(buff + 8, (uint16_t)zipmin(0xffffU, + zip->central_directory_entries)); + archive_le16enc(buff + 10, (uint16_t)zipmin(0xffffU, + zip->central_directory_entries)); + archive_le32enc(buff + 12, + (uint32_t)zipmin(ZIP_4GB_MAX, (offset_end - offset_start))); + archive_le32enc(buff + 16, + (uint32_t)zipmin(ZIP_4GB_MAX, offset_start)); + ret = __archive_write_output(a, buff, 22); if (ret != ARCHIVE_OK) return (ARCHIVE_FATAL); - zip->written_bytes += sizeof(end); + zip->written_bytes += 22; return (ARCHIVE_OK); } @@ -834,18 +1346,23 @@ static int archive_write_zip_free(struct archive_write *a) { struct zip *zip; - struct zip_file_header_link *l; + struct cd_segment *segment; zip = a->format_data; while (zip->central_directory != NULL) { - l = zip->central_directory; - zip->central_directory = l->next; - archive_entry_free(l->entry); - free(l); + segment = zip->central_directory; + zip->central_directory = segment->next; + free(segment->buff); + free(segment); } -#ifdef HAVE_ZLIB_H free(zip->buf); -#endif + archive_entry_free(zip->entry); + if (zip->cctx_valid) + archive_encrypto_aes_ctr_release(&zip->cctx); + if (zip->hctx_valid) + archive_hmac_sha1_cleanup(&zip->hctx); + /* TODO: Free opt_sconv, sconv_default */ + free(zip); a->format_data = NULL; return (ARCHIVE_OK); @@ -918,7 +1435,7 @@ write_path(struct archive_entry *entry, struct archive_write *archive) return (ARCHIVE_FATAL); written_bytes += strlen(path); - /* Folders are recognized by a traling slash. */ + /* Folders are recognized by a trailing slash. */ if ((type == AE_IFDIR) & (path[strlen(path) - 1] != '/')) { ret = __archive_write_output(archive, "/", 1); if (ret != ARCHIVE_OK) @@ -928,3 +1445,234 @@ write_path(struct archive_entry *entry, struct archive_write *archive) return ((int)written_bytes); } + +static void +copy_path(struct archive_entry *entry, unsigned char *p) +{ + const char *path; + size_t pathlen; + mode_t type; + + path = archive_entry_pathname(entry); + pathlen = strlen(path); + type = archive_entry_filetype(entry); + + memcpy(p, path, pathlen); + + /* Folders are recognized by a trailing slash. */ + if ((type == AE_IFDIR) & (path[pathlen - 1] != '/')) { + p[pathlen] = '/'; + p[pathlen + 1] = '\0'; + } +} + + +static struct archive_string_conv * +get_sconv(struct archive_write *a, struct zip *zip) +{ + if (zip->opt_sconv != NULL) + return (zip->opt_sconv); + + if (!zip->init_default_conversion) { + zip->sconv_default = + archive_string_default_conversion_for_write(&(a->archive)); + zip->init_default_conversion = 1; + } + return (zip->sconv_default); +} + +/* + Traditional PKWARE Decryption functions. + */ + +static void +trad_enc_update_keys(struct trad_enc_ctx *ctx, uint8_t c) +{ + uint8_t t; +#define CRC32(c, b) (crc32(c ^ 0xffffffffUL, &b, 1) ^ 0xffffffffUL) + + ctx->keys[0] = CRC32(ctx->keys[0], c); + ctx->keys[1] = (ctx->keys[1] + (ctx->keys[0] & 0xff)) * 134775813L + 1; + t = (ctx->keys[1] >> 24) & 0xff; + ctx->keys[2] = CRC32(ctx->keys[2], t); +#undef CRC32 +} + +static uint8_t +trad_enc_decypt_byte(struct trad_enc_ctx *ctx) +{ + unsigned temp = ctx->keys[2] | 2; + return (uint8_t)((temp * (temp ^ 1)) >> 8) & 0xff; +} + +static unsigned +trad_enc_encrypt_update(struct trad_enc_ctx *ctx, const uint8_t *in, + size_t in_len, uint8_t *out, size_t out_len) +{ + unsigned i, max; + + max = (unsigned)((in_len < out_len)? in_len: out_len); + + for (i = 0; i < max; i++) { + uint8_t t = in[i]; + out[i] = t ^ trad_enc_decypt_byte(ctx); + trad_enc_update_keys(ctx, t); + } + return i; +} + +static int +trad_enc_init(struct trad_enc_ctx *ctx, const char *pw, size_t pw_len) +{ + + ctx->keys[0] = 305419896L; + ctx->keys[1] = 591751049L; + ctx->keys[2] = 878082192L; + + for (;pw_len; --pw_len) + trad_enc_update_keys(ctx, *pw++); + return 0; +} + +static int +is_traditional_pkware_encryption_supported(void) +{ + uint8_t key[TRAD_HEADER_SIZE]; + + if (archive_random(key, sizeof(key)-1) != ARCHIVE_OK) + return (0); + return (1); +} + +static int +init_traditional_pkware_encryption(struct archive_write *a) +{ + struct zip *zip = a->format_data; + const char *passphrase; + uint8_t key[TRAD_HEADER_SIZE]; + uint8_t key_encrypted[TRAD_HEADER_SIZE]; + int ret; + + passphrase = __archive_write_get_passphrase(a); + if (passphrase == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Encryption needs passphrase"); + return ARCHIVE_FAILED; + } + if (archive_random(key, sizeof(key)-1) != ARCHIVE_OK) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Can't generate random number for encryption"); + return ARCHIVE_FATAL; + } + trad_enc_init(&zip->tctx, passphrase, strlen(passphrase)); + /* Set the last key code which will be used as a check code + * for verifying passphrase in decryption. */ + key[TRAD_HEADER_SIZE-1] = zip->trad_chkdat; + trad_enc_encrypt_update(&zip->tctx, key, TRAD_HEADER_SIZE, + key_encrypted, TRAD_HEADER_SIZE); + /* Write encrypted keys in the top of the file content. */ + ret = __archive_write_output(a, key_encrypted, TRAD_HEADER_SIZE); + if (ret != ARCHIVE_OK) + return (ret); + zip->written_bytes += TRAD_HEADER_SIZE; + zip->entry_compressed_written += TRAD_HEADER_SIZE; + return (ret); +} + +static int +init_winzip_aes_encryption(struct archive_write *a) +{ + struct zip *zip = a->format_data; + const char *passphrase; + size_t key_len, salt_len; + uint8_t salt[16 + 2]; + uint8_t derived_key[MAX_DERIVED_KEY_BUF_SIZE]; + int ret; + + passphrase = __archive_write_get_passphrase(a); + if (passphrase == NULL) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Encryption needs passphrase"); + return (ARCHIVE_FAILED); + } + if (zip->entry_encryption == ENCRYPTION_WINZIP_AES128) { + salt_len = 8; + key_len = 16; + } else { + /* AES 256 */ + salt_len = 16; + key_len = 32; + } + if (archive_random(salt, salt_len) != ARCHIVE_OK) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Can't generate random number for encryption"); + return (ARCHIVE_FATAL); + } + archive_pbkdf2_sha1(passphrase, strlen(passphrase), + salt, salt_len, 1000, derived_key, key_len * 2 + 2); + + ret = archive_encrypto_aes_ctr_init(&zip->cctx, derived_key, key_len); + if (ret != 0) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Decryption is unsupported due to lack of crypto library"); + return (ARCHIVE_FAILED); + } + ret = archive_hmac_sha1_init(&zip->hctx, derived_key + key_len, + key_len); + if (ret != 0) { + archive_encrypto_aes_ctr_release(&zip->cctx); + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Failed to initialize HMAC-SHA1"); + return (ARCHIVE_FAILED); + } + + /* Set a passowrd verification value after the 'salt'. */ + salt[salt_len] = derived_key[key_len * 2]; + salt[salt_len + 1] = derived_key[key_len * 2 + 1]; + + /* Write encrypted keys in the top of the file content. */ + ret = __archive_write_output(a, salt, salt_len + 2); + if (ret != ARCHIVE_OK) + return (ret); + zip->written_bytes += salt_len + 2; + zip->entry_compressed_written += salt_len + 2; + + return (ARCHIVE_OK); +} + +static int +is_winzip_aes_encryption_supported(int encryption) +{ + size_t key_len, salt_len; + uint8_t salt[16 + 2]; + uint8_t derived_key[MAX_DERIVED_KEY_BUF_SIZE]; + archive_crypto_ctx cctx; + archive_hmac_sha1_ctx hctx; + int ret; + + if (encryption == ENCRYPTION_WINZIP_AES128) { + salt_len = 8; + key_len = 16; + } else { + /* AES 256 */ + salt_len = 16; + key_len = 32; + } + if (archive_random(salt, salt_len) != ARCHIVE_OK) + return (0); + ret = archive_pbkdf2_sha1("p", 1, salt, salt_len, 1000, + derived_key, key_len * 2 + 2); + if (ret != 0) + return (0); + + ret = archive_encrypto_aes_ctr_init(&cctx, derived_key, key_len); + if (ret != 0) + return (0); + ret = archive_hmac_sha1_init(&hctx, derived_key + key_len, + key_len); + archive_encrypto_aes_ctr_release(&cctx); + if (ret != 0) + return (0); + archive_hmac_sha1_cleanup(&hctx); + return (1); +} diff --git a/libarchive/archive_write_set_options.3 b/libarchive/archive_write_set_options.3 index 9d605151ac3f..ce7ed89c916d 100644 --- a/libarchive/archive_write_set_options.3 +++ b/libarchive/archive_write_set_options.3 @@ -101,7 +101,12 @@ and .Ar value will be provided to the filter or reader named .Ar module . -The return value will be that of the module. +The return value will be either +.Cm ARCHIVE_OK +if the option was successfully handled or +.Cm ARCHIVE_WARN +if the option was unrecognized by the module or could otherwise +not be handled. If there is no such module, .Cm ARCHIVE_FAILED will be returned. @@ -123,9 +128,7 @@ will be returned if any module accepts the option, and .Cm ARCHIVE_FAILED in all other cases. .\" -.It Xo -.Fn archive_write_set_option -.Xc +.It Fn archive_write_set_option Calls .Fn archive_write_set_format_option , then @@ -137,9 +140,7 @@ will be returned immediately. Otherwise, greater of the two values will be returned. .\" -.It Xo -.Fn archive_write_set_options -.Xc +.It Fn archive_write_set_options .Ar options is a comma-separated list of options. If @@ -255,7 +256,7 @@ If the .Ar value is .Cm hd , -then the the boot image is assumed to be a bootable hard disk image. +then the boot image is assumed to be a bootable hard disk image. If the .Ar value is @@ -397,6 +398,48 @@ Specifies a filename that should not be compressed when using This option can be provided multiple times to suppress compression on many files. .El +.It Format zip +.Bl -tag -compact -width indent +.It Cm compression +The value is either +.Dq store +or +.Dq deflate +to indicate how the following entries should be compressed. +Note that this setting is ignored for directories, symbolic links, +and other special entries. +.It Cm experimental +This boolean option enables or disables experimental Zip features +that may not be compatible with other Zip implementations. +.It Cm fakecrc32 +This boolean option disables CRC calculations. +All CRC fields are set to zero. +It should not be used except for testing purposes. +.It Cm hdrcharset +This sets the character set used for filenames. +.It Cm zip64 +Zip64 extensions provide additional file size information +for entries larger than 4 GiB. +They also provide extended file offset and archive size information +when archives exceed 4 GiB. +By default, the Zip writer selectively enables these extensions only as needed. +In particular, if the file size is unknown, the Zip writer will +include Zip64 extensions to guard against the possibility that the +file might be larger than 4 GiB. +.Pp +Setting this boolean option will force the writer to use Zip64 extensions +even for small files that would not otherwise require them. +This is primarily useful for testing. +.Pp +Disabling this option with +.Cm !zip64 +will force the Zip writer to avoid Zip64 extensions: +It will reject files with size greater than 4 GiB, +it will reject any new entries once the total archive size reaches 4 GiB, +and it will not use Zip64 extensions for files with unknown size. +In particular, this can improve compatibility when generating archives +where the entry sizes are not known in advance. +.El .El .Sh EXAMPLES The following example creates an archive write handle to @@ -414,7 +457,7 @@ archive_write_open_filename(a, filename, blocksize); .Ed .\" .Sh ERRORS -Detailed error codes and textual descriptions are available from the +More detailed error codes and textual descriptions are available from the .Fn archive_errno and .Fn archive_error_string diff --git a/libarchive/archive_write_set_passphrase.3 b/libarchive/archive_write_set_passphrase.3 new file mode 100644 index 000000000000..2585595e331a --- /dev/null +++ b/libarchive/archive_write_set_passphrase.3 @@ -0,0 +1,74 @@ +.\" Copyright (c) 2014 Michihiro NAKAJIMA +.\" 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 September 21, 2014 +.Dt ARCHIVE_WRITE_SET_PASSPHRASE 3 +.Os +.Sh NAME +.Nm archive_write_set_passphrase , +.Nm archive_write_set_passphrase_callback +.Nd functions for writing encrypted archives +.Sh LIBRARY +Streaming Archive Library (libarchive, -larchive) +.Sh SYNOPSIS +.In archive.h +.Ft int +.Fo archive_write_set_passphrase +.Fa "struct archive *" +.Fa "const char *passphrase" +.Fc +.Ft int +.Fo archive_write_set_passphrase_callback +.Fa "struct archive *" +.Fa "void *client_data" +.Fa "archive_passphrase_callback *" +.Fc +.Sh DESCRIPTION +.Bl -tag -width indent +.It Fn archive_write_set_passphrase +Set a passphrase for writing an encryption archive. +If +.Ar passphrase +is +.Dv NULL +or empty, this function will do nothing and +.Cm ARCHIVE_FAILED +will be returned. +Otherwise, +.Cm ARCHIVE_OK +will be returned. +.It Fn archive_write_set_passphrase_callback +Register callback function that will be invoked to get a passphrase +for encrption if the passphrase was not set by the +.Fn archive_write_set_passphrase +function. +.El +.\" .Sh ERRORS +.Sh SEE ALSO +.Xr tar 1 , +.Xr libarchive 3 , +.Xr archive_write 3 , +.Xr archive_write_set_options 3 diff --git a/libarchive/archive_write_set_passphrase.c b/libarchive/archive_write_set_passphrase.c new file mode 100644 index 000000000000..710ecba52c3d --- /dev/null +++ b/libarchive/archive_write_set_passphrase.c @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * 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 "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#ifdef HAVE_ERRNO_H +#include +#endif +#include "archive_write_private.h" + +int +archive_write_set_passphrase(struct archive *_a, const char *p) +{ + struct archive_write *a = (struct archive_write *)_a; + + archive_check_magic(_a, ARCHIVE_WRITE_MAGIC, ARCHIVE_STATE_NEW, + "archive_write_set_passphrase"); + + if (p == NULL || p[0] == '\0') { + archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, + "Empty passphrase is unacceptable"); + return (ARCHIVE_FAILED); + } + free(a->passphrase); + a->passphrase = strdup(p); + if (a->passphrase == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate data for passphrase"); + return (ARCHIVE_FATAL); + } + return (ARCHIVE_OK); +} + + +int +archive_write_set_passphrase_callback(struct archive *_a, void *client_data, + archive_passphrase_callback *cb) +{ + struct archive_write *a = (struct archive_write *)_a; + + archive_check_magic(_a, ARCHIVE_WRITE_MAGIC, ARCHIVE_STATE_NEW, + "archive_write_set_passphrase_callback"); + + a->passphrase_callback = cb; + a->passphrase_client_data = client_data; + return (ARCHIVE_OK); +} + + +const char * +__archive_write_get_passphrase(struct archive_write *a) +{ + + if (a->passphrase != NULL) + return (a->passphrase); + + if (a->passphrase_callback != NULL) { + const char *p; + p = a->passphrase_callback(&a->archive, + a->passphrase_client_data); + if (p != NULL) { + a->passphrase = strdup(p); + if (a->passphrase == NULL) { + archive_set_error(&a->archive, ENOMEM, + "Can't allocate data for passphrase"); + return (NULL); + } + return (a->passphrase); + } + } + return (NULL); +} diff --git a/libarchive/archive_xxhash.h b/libarchive/archive_xxhash.h new file mode 100644 index 000000000000..427241641a02 --- /dev/null +++ b/libarchive/archive_xxhash.h @@ -0,0 +1,47 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * 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. + * + */ + +#ifndef __LIBARCHIVE_BUILD +#error This header is only to be used internally to libarchive. +#endif + +#ifndef ARCHIVE_XXHASH_H +#define ARCHIVE_XXHASH_H + +typedef enum { XXH_OK=0, XXH_ERROR } XXH_errorcode; + +struct archive_xxhash { + unsigned int (*XXH32)(const void* input, unsigned int len, + unsigned int seed); + void* (*XXH32_init)(unsigned int seed); + XXH_errorcode (*XXH32_update)(void* state, const void* input, + unsigned int len); + unsigned int (*XXH32_digest)(void* state); +}; + +extern const struct archive_xxhash __archive_xxhash; + +#endif diff --git a/libarchive/filter_fork_windows.c b/libarchive/filter_fork_windows.c index fa59cc9e90ce..ad271fe68a15 100644 --- a/libarchive/filter_fork_windows.c +++ b/libarchive/filter_fork_windows.c @@ -36,7 +36,7 @@ __archive_create_child(const char *cmd, int *child_stdin, int *child_stdout) { HANDLE childStdout[2], childStdin[2],childStderr; SECURITY_ATTRIBUTES secAtts; - STARTUPINFO staInfo; + STARTUPINFOA staInfo; PROCESS_INFORMATION childInfo; struct archive_string cmdline; struct archive_string fullpath; diff --git a/libarchive/libarchive-formats.5 b/libarchive/libarchive-formats.5 index 4a709b33c949..e619fe540c87 100644 --- a/libarchive/libarchive-formats.5 +++ b/libarchive/libarchive-formats.5 @@ -55,7 +55,7 @@ It can write POSIX-standard .Dq ustar and .Dq pax interchange -formats and a subset of the legacy GNU tar format. +formats as well as v7 tar format and a subset of the legacy GNU tar format. .Pp All tar formats store each entry in one or more 512-byte records. The first record is used for file metadata, including filename, @@ -150,6 +150,30 @@ Archive entries are limited to 8 gigabytes in size. Note that the pax interchange format has none of these restrictions. The ustar format is old and widely supported. It is recommended when compatibility is the primary concern. +.It Cm v7 +The libarchive library can read and write the legacy v7 tar format. +This format has the following limitations: +.Bl -bullet -compact +.It +Only regular files, directories, and symbolic links can be archived. +Block and character device nodes, FIFOs, and sockets cannot be archived. +.It +Path names in the archive are limited to 100 bytes. +.It +Symbolic links and hard links are stored in the archive with +the name of the referenced file. +This name is limited to 100 bytes. +.It +User and group information are stored as numeric IDs; there +is no provision for storing user or group names. +.It +Extended attributes, file flags, and other extended +security information cannot be stored. +.It +Archive entries are limited to 8 gigabytes in size. +.El +Generally, users should prefer the ustar format for portability +as the v7 tar format is both less useful and less portable. .El .Pp The libarchive library also reads a variety of commonly-used extensions to @@ -211,7 +235,7 @@ This format stores the header contents as octal values in ASCII. It is standard, portable, and immune from byte-order confusion. File sizes and mtime are limited to 33 bits (8GB file size), other fields are limited to 18 bits. -.It Cm SVR4 +.It Cm SVR4/newc The libarchive library can read both CRC and non-CRC variants of this format. The SVR4 format uses eight-digit hexadecimal values for @@ -364,8 +388,10 @@ area adjacent to the entry. Libarchive can read both extensions, including archives that may include both types of long filenames. Programs using libarchive can write GNU/SVR4 format -if they provide a filename table to be written into -the archive before any of the entries. +if they provide an entry called +.Pa // +containing a filename table to be written into the archive +before any of the entries. Any entries whose names are not in the filename table will be written using BSD-style long filenames. This can cause problems for programs such as @@ -406,18 +432,29 @@ using libarchive. If it cannot locate and open the file on disk, libarchive will return an error for any attempt to read the entry body. -.Ss LHA -XXX Information about libarchive's LHA support XXX +.Ss 7-Zip +Libarchive can read and write 7-Zip format archives. +TODO: Need more information .Ss CAB -XXX Information about libarchive's CAB support XXX -.Ss XAR -XXX Information about libarchive's XAR support XXX +Libarchive can read Microsoft Cabinet ( +.Dq CAB ) +format archives. +TODO: Need more information. +.Ss LHA +TODO: Information about libarchive's LHA support .Ss RAR Libarchive has limited support for reading RAR format archives. Currently, libarchive can read RARv3 format archives which have been either created uncompressed, or compressed using any of the compression methods supported by the RARv3 format. Libarchive can also read self-extracting RAR archives. +.Ss Warc +Libarchive can read and write +.Dq web archives . +TODO: Need more information +.Ss XAR +Libarchive can read and write the XAR format used by many Apple tools. +TODO: Need more information .Sh SEE ALSO .Xr ar 1 , .Xr cpio 1 , diff --git a/libarchive/libarchive.3 b/libarchive/libarchive.3 index 3a9a841d3b2e..c6894d2d4ffb 100644 --- a/libarchive/libarchive.3 +++ b/libarchive/libarchive.3 @@ -146,11 +146,11 @@ pages for each API or utility function. .\" .Sh READING AN ARCHIVE See -.Xr libarchive_read 3 . +.Xr archive_read 3 . .\" .Sh WRITING AN ARCHIVE See -.Xr libarchive_write 3 . +.Xr archive_write 3 . .\" .Sh WRITING ENTRIES TO DISK The diff --git a/libarchive/libarchive_internals.3 b/libarchive/libarchive_internals.3 index 4aa09f93ea80..8275d66e68f1 100644 --- a/libarchive/libarchive_internals.3 +++ b/libarchive/libarchive_internals.3 @@ -347,11 +347,11 @@ Fortunately, such archives are very rare, and libarchive can read most ZIP archives, though it cannot always extract as much information as a dedicated ZIP program. .Sh SEE ALSO -.Xr archive 3 , .Xr archive_entry 3 , .Xr archive_read 3 , .Xr archive_write 3 , .Xr archive_write_disk 3 +.Xr libarchive 3 , .Sh HISTORY The .Nm libarchive diff --git a/libarchive/mtree.5 b/libarchive/mtree.5 index 983fff723891..16c8abec4cd7 100644 --- a/libarchive/mtree.5 +++ b/libarchive/mtree.5 @@ -28,7 +28,7 @@ .\" From: @(#)mtree.8 8.2 (Berkeley) 12/11/93 .\" $FreeBSD$ .\" -.Dd May 6, 2008 +.Dd September 4, 2013 .Dt MTREE 5 .Os .Sh NAME @@ -56,14 +56,6 @@ corresponding character. .Pp Each line is interpreted independently as one of the following types: .Bl -tag -width Cm -.It Signature -The first line of any mtree file must begin with -.Dq #mtree . -If a file contains any full path entries, the first line should -begin with -.Dq #mtree v2.0 , -otherwise, the first line should begin with -.Dq #mtree v1.0 . .It Blank Blank lines are ignored. .It Comment @@ -134,6 +126,52 @@ The checksum of the file using the default algorithm specified by the .Xr cksum 1 utility. +.It Cm device +The device number for +.Sy block +or +.Sy char +file types. +The value must be one of the following forms: +.Pp +.Bl -tag -width 4n +.It Ar format , Ns Ar major , Ns Ar minor Ns Bo , Ns Ar subunit Bc +A device with +.Ar major , minor +and optional +.Ar subunit +fields. +Their meaning is specified by the operating's system +.Ar format . +See below for valid formats. +.It Ar number +Opaque number (as stored on the file system). +.El +.Pp +The following values for +.Ar format +are recognized: +.Sy native , +.Sy 386bsd , +.Sy 4bsd , +.Sy bsdos , +.Sy freebsd , +.Sy hpux , +.Sy isc , +.Sy linux , +.Sy netbsd , +.Sy osf1 , +.Sy sco , +.Sy solaris , +.Sy sunos , +.Sy svr3 , +.Sy svr4 , +and +.Sy ultrix . +.Pp +See +.Xr mknod 8 +for more details. .It Cm contents The full pathname of a file that holds the contents of this file. .It Cm flags @@ -150,6 +188,8 @@ The file group as a numeric value. The file group as a symbolic name. .It Cm ignore Ignore any file hierarchy below this file. +.It Cm inode +The inode number. .It Cm link The target of the symbolic link when type=link. .It Cm md5 @@ -164,6 +204,16 @@ value. The number of hard links the file is expected to have. .It Cm nochange Make sure this file or directory exists but otherwise ignore all attributes. +.It Cm optional +The file is optional; do not complain about the file if it is not in +the file hierarchy. +.It Cm resdevice +The +.Dq resident +device number of the file, e.g. the ID of the device that +contains the file. +Its format is the same as the one for +.Cm device . .It Cm ripemd160digest The .Tn RIPEMD160 @@ -192,6 +242,24 @@ message digest of the file. .It Cm sha256digest A synonym for .Cm sha256 . +.It Cm sha384 +The +.Tn FIPS +180-2 +.Pq Dq Tn SHA-384 +message digest of the file. +.It Cm sha384digest +A synonym for +.Cm sha384 . +.It Cm sha512 +The +.Tn FIPS +180-2 +.Pq Dq Tn SHA-512 +message digest of the file. +.It Cm sha512digest +A synonym for +.Cm sha512 . .It Cm size The size, in bytes, of the file. .It Cm time @@ -226,16 +294,6 @@ The file owner as a symbolic name. .Xr find 1 , .Xr mtree 8 .Sh BUGS -The -.Fx -implementation of mtree does not currently support -the -.Nm -2.0 -format. -The requirement for a -.Dq #mtree -signature line is new and not yet widely implemented. .Sh HISTORY The .Nm diff --git a/libarchive/tar.5 b/libarchive/tar.5 index 688bb922c353..6e6f0c096c90 100644 --- a/libarchive/tar.5 +++ b/libarchive/tar.5 @@ -935,7 +935,7 @@ and formed the basis of (circa 1988). Joerg Shilling's .Nm star -archiver is another open-source (GPL) archiver (originally developed +archiver is another open-source (CDDL) archiver (originally developed circa 1985) which features complete support for pax interchange format. .Pp diff --git a/libarchive/test/CMakeLists.txt b/libarchive/test/CMakeLists.txt index d2eb2c2f39ef..ae5a1aa8b83b 100644 --- a/libarchive/test/CMakeLists.txt +++ b/libarchive/test/CMakeLists.txt @@ -9,20 +9,21 @@ IF(ENABLE_TEST) main.c read_open_memory.c test.h - test_acl_freebsd_posix1e.c test_acl_freebsd_nfs4.c + test_acl_freebsd_posix1e.c test_acl_nfs4.c test_acl_pax.c test_acl_posix1e.c test_archive_api_feature.c test_archive_clear_error.c test_archive_cmdline.c - test_archive_crypto.c + test_archive_digest.c test_archive_getdate.c test_archive_match_owner.c test_archive_match_path.c test_archive_match_time.c test_archive_pathmatch.c + test_archive_read_add_passphrase.c test_archive_read_close_twice.c test_archive_read_close_twice_open_fd.c test_archive_read_close_twice_open_filename.c @@ -41,23 +42,27 @@ IF(ENABLE_TEST) test_archive_write_add_filter_by_name.c test_archive_write_set_filter_option.c test_archive_write_set_format_by_name.c + test_archive_write_set_format_filter_by_ext.c test_archive_write_set_format_option.c test_archive_write_set_option.c test_archive_write_set_options.c + test_archive_write_set_passphrase.c test_bad_fd.c test_compat_bzip2.c test_compat_cpio.c test_compat_gtar.c test_compat_gzip.c + test_compat_lz4.c test_compat_lzip.c test_compat_lzma.c test_compat_lzop.c test_compat_mac.c test_compat_pax_libarchive_2x.c - test_compat_solaris_tar_acl.c test_compat_solaris_pax_sparse.c + test_compat_solaris_tar_acl.c test_compat_tar_hardlink.c test_compat_uudecode.c + test_compat_uudecode_large.c test_compat_xz.c test_compat_zip.c test_empty_write.c @@ -79,6 +84,7 @@ IF(ENABLE_TEST) test_read_disk_entry_from_file.c test_read_extract.c test_read_file_nonexistent.c + test_read_filter_compress.c test_read_filter_grzip.c test_read_filter_lrzip.c test_read_filter_lzop.c @@ -87,6 +93,10 @@ IF(ENABLE_TEST) test_read_filter_program_signature.c test_read_filter_uudecode.c test_read_format_7zip.c + test_read_format_7zip_encryption_data.c + test_read_format_7zip_encryption_header.c + test_read_format_7zip_encryption_partially.c + test_read_format_7zip_malformed.c test_read_format_ar.c test_read_format_cab.c test_read_format_cab_filename.c @@ -96,6 +106,7 @@ IF(ENABLE_TEST) test_read_format_cpio_bin_be.c test_read_format_cpio_bin_bz2.c test_read_format_cpio_bin_gz.c + test_read_format_cpio_bin_le.c test_read_format_cpio_bin_lzip.c test_read_format_cpio_bin_lzma.c test_read_format_cpio_bin_xz.c @@ -110,6 +121,7 @@ IF(ENABLE_TEST) test_read_format_gtar_gz.c test_read_format_gtar_lzma.c test_read_format_gtar_sparse.c + test_read_format_gtar_sparse_skip_entry.c test_read_format_iso_Z.c test_read_format_iso_multi_extent.c test_read_format_iso_xorriso.c @@ -123,13 +135,19 @@ IF(ENABLE_TEST) test_read_format_isorr_rr_moved.c test_read_format_isozisofs_bz2.c test_read_format_lha.c + test_read_format_lha_bugfix_0.c test_read_format_lha_filename.c test_read_format_mtree.c test_read_format_pax_bz2.c test_read_format_rar.c + test_read_format_rar_encryption_data.c + test_read_format_rar_encryption_header.c + test_read_format_rar_encryption_partially.c test_read_format_raw.c test_read_format_tar.c + test_read_format_tar_concatenated.c test_read_format_tar_empty_filename.c + test_read_format_tar_empty_pax.c test_read_format_tar_filename.c test_read_format_tbz.c test_read_format_tgz.c @@ -137,23 +155,38 @@ IF(ENABLE_TEST) test_read_format_txz.c test_read_format_tz.c test_read_format_ustar_filename.c + test_read_format_warc.c test_read_format_xar.c test_read_format_zip.c test_read_format_zip_comment_stored.c + test_read_format_zip_encryption_data.c + test_read_format_zip_encryption_header.c + test_read_format_zip_encryption_partially.c test_read_format_zip_filename.c test_read_format_zip_mac_metadata.c + test_read_format_zip_malformed.c + test_read_format_zip_msdos.c + test_read_format_zip_nested.c + test_read_format_zip_nofiletype.c + test_read_format_zip_padded.c test_read_format_zip_sfx.c + test_read_format_zip_traditional_encryption_data.c + test_read_format_zip_winzip_aes.c + test_read_format_zip_winzip_aes_large.c + test_read_format_zip_zip64.c test_read_large.c test_read_pax_truncated.c test_read_position.c test_read_set_format.c + test_read_too_many_filters.c test_read_truncated.c test_read_truncated_filter.c test_sparse_basic.c test_tar_filenames.c test_tar_large.c - test_ustar_filenames.c test_ustar_filename_encoding.c + test_ustar_filenames.c + test_warn_missing_hardlink_target.c test_write_disk.c test_write_disk_appledouble.c test_write_disk_failures.c @@ -173,6 +206,7 @@ IF(ENABLE_TEST) test_write_filter_gzip.c test_write_filter_gzip_timestamp.c test_write_filter_lrzip.c + test_write_filter_lz4.c test_write_filter_lzip.c test_write_filter_lzma.c test_write_filter_lzop.c @@ -201,19 +235,28 @@ IF(ENABLE_TEST) test_write_format_mtree_no_separator.c test_write_format_mtree_quoted_filename.c test_write_format_pax.c + test_write_format_raw.c + test_write_format_raw_b64.c test_write_format_shar_empty.c test_write_format_tar.c test_write_format_tar_empty.c test_write_format_tar_sparse.c test_write_format_tar_ustar.c test_write_format_tar_v7tar.c + test_write_format_warc.c + test_write_format_warc_empty.c test_write_format_xar.c test_write_format_xar_empty.c test_write_format_zip.c + test_write_format_zip_compression_store.c test_write_format_zip_empty.c - test_write_format_zip_no_compression.c - test_write_zip_set_compression_store.c + test_write_format_zip_empty_zip64.c + test_write_format_zip_file.c + test_write_format_zip_file_zip64.c + test_write_format_zip_large.c + test_write_format_zip_zip64.c test_write_open_memory.c + test_write_read_format_zip.c test_zip_filename_encoding.c ) @@ -246,7 +289,7 @@ IF(ENABLE_TEST) INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) - INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/test_utils) + INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/test_utils) # Experimental new test handling ADD_CUSTOM_TARGET(run_libarchive_test diff --git a/libarchive/test/README b/libarchive/test/README index 235a70b02334..1b70c7adba73 100644 --- a/libarchive/test/README +++ b/libarchive/test/README @@ -18,10 +18,10 @@ The test function must be declared with a line of this form Nothing else should appear on that line. -When you add a test, please update the Makefile to add your -file to the list of tests. The Makefile and main.c use various -macro trickery to automatically collect a list of test functions -to be invoked. +When you add a test, please update the top-level Makefile.am and the +CMakeLists.txt in this directory to add your file to the list of +tests. The Makefile and main.c use various macro trickery to +automatically collect a list of test functions to be invoked. Each test function can rely on the following: @@ -52,10 +52,10 @@ Each test function can rely on the following: as a result, tests should be careful to release any memory they allocate. - * Disable tests on specific platforms as necessary. Please don't - use config.h to adjust feature requirements, as I want the tests + * Disable tests on specific platforms as necessary. Please avoid + using config.h to adjust feature requirements, as I want the tests to also serve as a check on the configure process. The following - form is appropriate: + form is usually more appropriate: #if !defined(__PLATFORM) && !defined(__Platform2__) assert(xxxx) diff --git a/libarchive/test/main.c b/libarchive/test/main.c index a94fa9251a71..e0af4314ea01 100644 --- a/libarchive/test/main.c +++ b/libarchive/test/main.c @@ -67,7 +67,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/test/main.c 201247 2009-12-30 05:59:21Z #define LIBRARY "libarchive" #define EXTRA_DUMP(x) archive_error_string((struct archive *)(x)) #define EXTRA_ERRNO(x) archive_errno((struct archive *)(x)) -#define EXTRA_VERSION archive_version_string() +#define EXTRA_VERSION archive_version_details() /* * @@ -128,6 +128,16 @@ __FBSDID("$FreeBSD: head/lib/libarchive/test/main.c 201247 2009-12-30 05:59:21Z # include #endif +/* Path to working directory for current test */ +const char *testworkdir; +#ifdef PROGRAM +/* Pathname of exe to be tested. */ +const char *testprogfile; +/* Name of exe to use in printf-formatted command strings. */ +/* On Windows, this includes leading/trailing quotes. */ +const char *testprog; +#endif + #if defined(_WIN32) && !defined(__CYGWIN__) static void *GetFunctionKernel32(const char *); static int my_CreateSymbolicLinkA(const char *, const char *, int); @@ -192,7 +202,7 @@ my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi) } #endif -#if defined(HAVE__CrtSetReportMode) +#if defined(HAVE__CrtSetReportMode) && !defined(__WATCOMC__) static void invalid_parameter_handler(const wchar_t * expression, const wchar_t * function, const wchar_t * file, @@ -563,10 +573,10 @@ static void strdump(const char *e, const char *p, int ewidth, int utf8) while (*p != '\0') { unsigned int c = 0xff & *p++; switch (c) { - case '\a': printf("\a"); break; - case '\b': printf("\b"); break; - case '\n': printf("\n"); break; - case '\r': printf("\r"); break; + case '\a': logprintf("\\a"); break; + case '\b': logprintf("\\b"); break; + case '\n': logprintf("\\n"); break; + case '\r': logprintf("\\r"); break; default: if (c >= 32 && c < 127) logprintf("%c", c); @@ -769,6 +779,34 @@ assertion_equal_mem(const char *file, int line, return (0); } +/* Verify that a block of memory is filled with the specified byte. */ +int +assertion_memory_filled_with(const char *file, int line, + const void *_v1, const char *vd, + size_t l, const char *ld, + char b, const char *bd, void *extra) +{ + const char *v1 = (const char *)_v1; + size_t c = 0; + size_t i; + (void)ld; /* UNUSED */ + + assertion_count(file, line); + + for (i = 0; i < l; ++i) { + if (v1[i] == b) { + ++c; + } + } + if (c == l) + return (1); + + failure_start(file, line, "%s (size %d) not filled with %s", vd, (int)l, bd); + logprintf(" Only %d bytes were correct\n", (int)c); + failure_finish(extra); + return (0); +} + /* Verify that the named file exists and is empty. */ int assertion_empty_file(const char *filename, int line, const char *f1) @@ -1034,6 +1072,7 @@ assertion_file_contains_lines_any_order(const char *file, int line, if (expected == NULL) { failure_start(pathname, line, "Can't allocate memory"); failure_finish(NULL); + free(expected); return (0); } for (i = 0; lines[i] != NULL; ++i) { @@ -1934,6 +1973,21 @@ canLrzip(void) return (value); } +/* + * Can this platform run the lz4 program? + */ +int +canLz4(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("lz4 -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + /* * Can this platform run the lzip program? */ @@ -2146,8 +2200,31 @@ slurpfile(size_t * sizep, const char *fmt, ...) return (p); } +/* + * Slurp a file into memory for ease of comparison and testing. + * Returns size of file in 'sizep' if non-NULL, null-terminates + * data in memory for ease of use. + */ +void +dumpfile(const char *filename, void *data, size_t len) +{ + ssize_t bytes_written; + FILE *f; + + f = fopen(filename, "wb"); + if (f == NULL) { + logprintf("Can't open file %s for writing\n", filename); + return; + } + bytes_written = fwrite(data, 1, len, f); + if (bytes_written < (ssize_t)len) + logprintf("Can't write file %s\n", filename); + fclose(f); +} + /* Read a uuencoded file from the reference directory, decode, and * write the result into the current directory. */ +#define VALID_UUDECODE(c) (c >= 32 && c <= 96) #define UUDECODE(c) (((c) - 0x20) & 0x3f) void extract_reference_file(const char *name) @@ -2171,7 +2248,6 @@ extract_reference_file(const char *name) break; } /* Now, decode the rest and write it. */ - /* Not a lot of error checking here; the input better be right. */ out = fopen(name, "wb"); while (fgets(buff, sizeof(buff), in) != NULL) { char *p = buff; @@ -2185,17 +2261,21 @@ extract_reference_file(const char *name) int n = 0; /* Write out 1-3 bytes from that. */ if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); + assert(VALID_UUDECODE(p[1])); n = UUDECODE(*p++) << 18; n |= UUDECODE(*p++) << 12; fputc(n >> 16, out); --bytes; } if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); n |= UUDECODE(*p++) << 6; fputc((n >> 8) & 0xFF, out); --bytes; } if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); n |= UUDECODE(*p++); fputc(n & 0xFF, out); --bytes; @@ -2206,6 +2286,32 @@ extract_reference_file(const char *name) fclose(in); } +void +copy_reference_file(const char *name) +{ + char buff[1024]; + FILE *in, *out; + size_t rbytes; + + sprintf(buff, "%s/%s", refdir, name); + in = fopen(buff, "rb"); + failure("Couldn't open reference file %s", buff); + assert(in != NULL); + if (in == NULL) + return; + /* Now, decode the rest and write it. */ + /* Not a lot of error checking here; the input better be right. */ + out = fopen(name, "wb"); + while ((rbytes = fread(buff, 1, sizeof(buff), in)) > 0) { + if (fwrite(buff, 1, rbytes, out) != rbytes) { + logprintf("Error: fwrite\n"); + break; + } + } + fclose(out); + fclose(in); +} + int is_LargeInode(const char *file) { @@ -2264,7 +2370,7 @@ struct test_list_t tests[] = { * Summarize repeated failures in the just-completed test. */ static void -test_summarize(int failed) +test_summarize(int failed, int skips_num) { unsigned int i; @@ -2274,7 +2380,7 @@ test_summarize(int failed) fflush(stdout); break; case VERBOSITY_PASSFAIL: - printf(failed ? "FAIL\n" : "ok\n"); + printf(failed ? "FAIL\n" : skips_num ? "ok (S)\n" : "ok\n"); break; } @@ -2299,13 +2405,14 @@ test_run(int i, const char *tmpdir) char workdir[1024]; char logfilename[64]; int failures_before = failures; + int skips_before = skips; int oldumask; switch (verbosity) { case VERBOSITY_SUMMARY_ONLY: /* No per-test reports at all */ break; case VERBOSITY_PASSFAIL: /* rest of line will include ok/FAIL marker */ - printf("%3d: %-50s", i, tests[i].name); + printf("%3d: %-64s", i, tests[i].name); fflush(stdout); break; default: /* Title of test, details will follow */ @@ -2355,7 +2462,7 @@ test_run(int i, const char *tmpdir) } /* Report per-test summaries. */ tests[i].failures = failures - failures_before; - test_summarize(tests[i].failures); + test_summarize(tests[i].failures, skips - skips_before); /* Close the per-test log file. */ fclose(logfile); logfile = NULL; @@ -2498,6 +2605,7 @@ get_refdir(const char *d) failure: printf("Unable to locate known reference file %s\n", KNOWNREF); printf(" Checked following directories:\n%s\n", tried); + printf("Use -r option to specify full path to reference directory\n"); #if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG) DebugBreak(); #endif @@ -2534,7 +2642,7 @@ main(int argc, char **argv) while (pwd[strlen(pwd) - 1] == '\n') pwd[strlen(pwd) - 1] = '\0'; -#if defined(HAVE__CrtSetReportMode) +#if defined(HAVE__CrtSetReportMode) && !defined(__WATCOMC__) /* To stop to run the default invalid parameter handler. */ _set_invalid_parameter_handler(invalid_parameter_handler); /* Disable annoying assertion message box. */ @@ -2581,7 +2689,7 @@ main(int argc, char **argv) exit(1); } memmove(testprogdir + strlen(pwd) + 1, testprogdir, - strlen(testprogdir)); + strlen(testprogdir) + 1); memcpy(testprogdir, pwd, strlen(pwd)); testprogdir[strlen(pwd)] = '/'; } diff --git a/libarchive/test/read_open_memory.c b/libarchive/test/read_open_memory.c index 0bf6f754f6d9..f4162eb4bb49 100644 --- a/libarchive/test/read_open_memory.c +++ b/libarchive/test/read_open_memory.c @@ -39,9 +39,9 @@ __FBSDID("$FreeBSD: head/lib/libarchive/test/read_open_memory.c 191183 2009-04-1 */ struct read_memory_data { - unsigned char *start; - unsigned char *p; - unsigned char *end; + const unsigned char *start; + const unsigned char *p; + const unsigned char *end; size_t read_size; size_t copy_buff_size; size_t copy_buff_offset; @@ -53,12 +53,12 @@ static int memory_read_open(struct archive *, void *); static int64_t memory_read_seek(struct archive *, void *, int64_t request, int whence); static int64_t memory_read_skip(struct archive *, void *, int64_t request); static ssize_t memory_read(struct archive *, void *, const void **buff); -static int read_open_memory_internal(struct archive *a, void *buff, +static int read_open_memory_internal(struct archive *a, const void *buff, size_t size, size_t read_size, int fullapi); int -read_open_memory(struct archive *a, void *buff, size_t size, size_t read_size) +read_open_memory(struct archive *a, const void *buff, size_t size, size_t read_size) { return read_open_memory_internal(a, buff, size, read_size, 2); } @@ -68,7 +68,7 @@ read_open_memory(struct archive *a, void *buff, size_t size, size_t read_size) * that internals work correctly with just the minimal entry points. */ int -read_open_memory_minimal(struct archive *a, void *buff, size_t size, size_t read_size) +read_open_memory_minimal(struct archive *a, const void *buff, size_t size, size_t read_size) { return read_open_memory_internal(a, buff, size, read_size, 1); } @@ -77,13 +77,13 @@ read_open_memory_minimal(struct archive *a, void *buff, size_t size, size_t read * Include a seek callback as well. */ int -read_open_memory_seek(struct archive *a, void *buff, size_t size, size_t read_size) +read_open_memory_seek(struct archive *a, const void *buff, size_t size, size_t read_size) { return read_open_memory_internal(a, buff, size, read_size, 3); } static int -read_open_memory_internal(struct archive *a, void *buff, +read_open_memory_internal(struct archive *a, const void *buff, size_t size, size_t read_size, int level) { struct read_memory_data *mine; @@ -94,7 +94,7 @@ read_open_memory_internal(struct archive *a, void *buff, return (ARCHIVE_FATAL); } memset(mine, 0, sizeof(*mine)); - mine->start = mine->p = (unsigned char *)buff; + mine->start = mine->p = (const unsigned char *)buff; mine->end = mine->start + size; mine->read_size = read_size; mine->copy_buff_offset = 32; diff --git a/libarchive/test/test.h b/libarchive/test/test.h index 7ca2da7ac39e..1117d6a77760 100644 --- a/libarchive/test/test.h +++ b/libarchive/test/test.h @@ -66,6 +66,7 @@ #include #include #include +#include #include #ifdef HAVE_UNISTD_H #include @@ -84,12 +85,14 @@ /* Windows (including Visual Studio and MinGW but not Cygwin) */ #if defined(_WIN32) && !defined(__CYGWIN__) #if !defined(__BORLANDC__) +#undef chdir +#define chdir _chdir #define strdup _strdup #endif #endif /* Visual Studio */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf sprintf_s #endif @@ -142,6 +145,9 @@ /* As above, but raw blocks of bytes. */ #define assertEqualMem(v1, v2, l) \ assertion_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL) +/* Assert that memory is full of a specified byte */ +#define assertMemoryFilledWith(v1, l, b) \ + assertion_memory_filled_with(__FILE__, __LINE__, (v1), #v1, (l), #l, (b), #b, NULL) /* Assert two files are the same. */ #define assertEqualFile(f1, f2) \ assertion_equal_file(__FILE__, __LINE__, (f1), (f2)) @@ -201,7 +207,7 @@ assertion_make_hardlink(__FILE__, __LINE__, newfile, oldfile) #define assertMakeSymlink(newfile, linkto) \ assertion_make_symlink(__FILE__, __LINE__, newfile, linkto) -#define assertNodump(path) \ +#define assertNodump(path) \ assertion_nodump(__FILE__, __LINE__, path) #define assertUmask(mask) \ assertion_umask(__FILE__, __LINE__, mask) @@ -225,6 +231,7 @@ int assertion_empty_file(const char *, int, const char *); int assertion_equal_file(const char *, int, const char *, const char *); int assertion_equal_int(const char *, int, long long, const char *, long long, const char *, void *); int assertion_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *); +int assertion_memory_filled_with(const char *, int, const void *, const char *, size_t, const char *, char, const char *, void *); int assertion_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *, int); int assertion_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *); int assertion_file_atime(const char *, int, const char *, long, long); @@ -281,6 +288,9 @@ int canRunCommand(const char *); /* Return true if this platform can run the "lrzip" program. */ int canLrzip(void); +/* Return true if this platform can run the "lz4" program. */ +int canLz4(void); + /* Return true if this platform can run the "lzip" program. */ int canLzip(void); @@ -303,8 +313,13 @@ int is_LargeInode(const char *); /* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */ char *slurpfile(size_t *, const char *fmt, ...); +/* Dump block of bytes to a file. */ +void dumpfile(const char *filename, void *, size_t); + /* Extracts named reference file to the current directory. */ void extract_reference_file(const char *); +/* Copies named reference file to the current directory. */ +void copy_reference_file(const char *); /* Extracts a list of files to the current directory. * List must be NULL terminated. @@ -312,7 +327,7 @@ void extract_reference_file(const char *); void extract_reference_files(const char **); /* Path to working directory for current test */ -const char *testworkdir; +extern const char *testworkdir; /* * Special interfaces for libarchive test harness. @@ -322,11 +337,11 @@ const char *testworkdir; #include "archive_entry.h" /* Special customized read-from-memory interface. */ -int read_open_memory(struct archive *, void *, size_t, size_t); +int read_open_memory(struct archive *, const void *, size_t, size_t); /* _minimal version exercises a slightly different set of libarchive APIs. */ -int read_open_memory_minimal(struct archive *, void *, size_t, size_t); +int read_open_memory_minimal(struct archive *, const void *, size_t, size_t); /* _seek version produces a seekable file. */ -int read_open_memory_seek(struct archive *, void *, size_t, size_t); +int read_open_memory_seek(struct archive *, const void *, size_t, size_t); /* Versions of above that accept an archive argument for additional info. */ #define assertA(e) assertion_assert(__FILE__, __LINE__, (e), #e, (a)) diff --git a/libarchive/test/test_archive_crypto.c b/libarchive/test/test_archive_digest.c similarity index 98% rename from libarchive/test/test_archive_crypto.c rename to libarchive/test/test_archive_digest.c index a4bf4ec6df5a..a8654ae1f60c 100644 --- a/libarchive/test/test_archive_crypto.c +++ b/libarchive/test/test_archive_digest.c @@ -25,10 +25,10 @@ */ #include "test.h" -/* Sanity test of internal crypto functionality */ +/* Sanity test of internal digest functionality */ #define __LIBARCHIVE_BUILD 1 -#include "archive_crypto_private.h" +#include "archive_digest_private.h" DEFINE_TEST(test_archive_md5) { diff --git a/libarchive/test/test_archive_getdate.c b/libarchive/test/test_archive_getdate.c index 4be359bb356d..9e91b83ba81d 100644 --- a/libarchive/test/test_archive_getdate.c +++ b/libarchive/test/test_archive_getdate.c @@ -27,11 +27,13 @@ __FBSDID("$FreeBSD$"); #include +#define __LIBARCHIVE_BUILD 1 +#include "archive_getdate.h" + /* * Verify that the getdate() function works. */ -time_t __archive_get_date(time_t, const char *); #define get_date __archive_get_date DEFINE_TEST(test_archive_getdate) @@ -43,6 +45,12 @@ DEFINE_TEST(test_archive_getdate) assertEqualInt(get_date(now, "2004/01/29 513 mest"), 1075345980); assertEqualInt(get_date(now, "99/02/17 7pm utc"), 919278000); assertEqualInt(get_date(now, "02/17/99 7:11am est"), 919253460); + assertEqualInt(get_date(now, "now - 2 hours"), + get_date(now, "2 hours ago")); + assertEqualInt(get_date(now, "2 hours ago"), + get_date(now, "+2 hours ago")); + assertEqualInt(get_date(now, "now - 2 hours"), + get_date(now, "-2 hours")); /* It's important that we handle ctime() format. */ assertEqualInt(get_date(now, "Sun Feb 22 17:38:26 PST 2009"), 1235353106); diff --git a/libarchive/test/test_archive_match_time.c b/libarchive/test/test_archive_match_time.c index c951e0dbbc2d..c6864b3265e4 100644 --- a/libarchive/test/test_archive_match_time.c +++ b/libarchive/test/test_archive_match_time.c @@ -26,7 +26,8 @@ #include "test.h" __FBSDID("$FreeBSD$"); -time_t __archive_get_date(time_t, const char *); +#define __LIBARCHIVE_BUILD 1 +#include "archive_getdate.h" static void test_newer_time(void) diff --git a/libarchive/test/test_archive_pathmatch.c b/libarchive/test/test_archive_pathmatch.c index fed6ad781f2f..21cbdd7e0780 100644 --- a/libarchive/test/test_archive_pathmatch.c +++ b/libarchive/test/test_archive_pathmatch.c @@ -207,11 +207,26 @@ DEFINE_TEST(test_archive_pathmatch) archive_pathmatch("^bcd", "abcd", PATHMATCH_NO_ANCHOR_START)); assertEqualInt(1, archive_pathmatch("b/c/d", "a/b/c/d", PATHMATCH_NO_ANCHOR_START)); + assertEqualInt(0, + archive_pathmatch("^b/c/d", "a/b/c/d", PATHMATCH_NO_ANCHOR_START)); + assertEqualInt(0, + archive_pathmatch("/b/c/d", "a/b/c/d", PATHMATCH_NO_ANCHOR_START)); + assertEqualInt(0, + archive_pathmatch("a/b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_START)); + assertEqualInt(1, + archive_pathmatch("a/b/c/d", "a/b/c/d", PATHMATCH_NO_ANCHOR_START)); assertEqualInt(0, archive_pathmatch("b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_START)); assertEqualInt(0, archive_pathmatch("^b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_START)); + + assertEqualInt(1, + archive_pathmatch("b/c/d", "a/b/c/d", PATHMATCH_NO_ANCHOR_START)); + assertEqualInt(1, + archive_pathmatch("b/c/d", "/a/b/c/d", PATHMATCH_NO_ANCHOR_START)); + + /* Matches not anchored at end. */ assertEqualInt(0, archive_pathmatch("bcd", "abcd", PATHMATCH_NO_ANCHOR_END)); @@ -241,4 +256,30 @@ DEFINE_TEST(test_archive_pathmatch) archive_pathmatch("a/b/c/$", "a/b/c", PATHMATCH_NO_ANCHOR_END)); assertEqualInt(0, archive_pathmatch("b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_END)); + + /* Matches not anchored at either end. */ + assertEqualInt(1, + archive_pathmatch("b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); + assertEqualInt(0, + archive_pathmatch("/b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); + assertEqualInt(0, + archive_pathmatch("/a/b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); + assertEqualInt(1, + archive_pathmatch("/a/b/c", "/a/b/c/d", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); + assertEqualInt(0, + archive_pathmatch("/a/b/c$", "a/b/c/d", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); + assertEqualInt(0, + archive_pathmatch("/a/b/c/d$", "a/b/c/d", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); + assertEqualInt(0, + archive_pathmatch("/a/b/c/d$", "/a/b/c/d/e", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); + assertEqualInt(1, + archive_pathmatch("/a/b/c/d$", "/a/b/c/d", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); + assertEqualInt(1, + archive_pathmatch("^a/b/c", "a/b/c/d", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); + assertEqualInt(0, + archive_pathmatch("^a/b/c$", "a/b/c/d", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); + assertEqualInt(0, + archive_pathmatch("a/b/c$", "a/b/c/d", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); + assertEqualInt(1, + archive_pathmatch("b/c/d$", "a/b/c/d", PATHMATCH_NO_ANCHOR_START | PATHMATCH_NO_ANCHOR_END)); } diff --git a/libarchive/test/test_archive_read_add_passphrase.c b/libarchive/test/test_archive_read_add_passphrase.c new file mode 100644 index 000000000000..45f826d17707 --- /dev/null +++ b/libarchive/test/test_archive_read_add_passphrase.c @@ -0,0 +1,260 @@ +/*- + * Copyright (c) 2011 Tim Kientzle + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +struct archive_read; +extern void __archive_read_reset_passphrase(struct archive_read *); +extern const char * __archive_read_next_passphrase(struct archive_read *); + +static void +test(int pristine) +{ + struct archive* a = archive_read_new(); + + if (!pristine) { + archive_read_support_filter_all(a); + archive_read_support_format_all(a); + } + + assertEqualInt(ARCHIVE_OK, archive_read_add_passphrase(a, "pass1")); + /* An empty passphrase cannot be accepted. */ + assertEqualInt(ARCHIVE_FAILED, archive_read_add_passphrase(a, "")); + /* NULL passphrases cannot be accepted. */ + assertEqualInt(ARCHIVE_FAILED, archive_read_add_passphrase(a, NULL)); + + archive_read_free(a); +} + +DEFINE_TEST(test_archive_read_add_passphrase) +{ + test(1); + test(0); +} + +DEFINE_TEST(test_archive_read_add_passphrase_incorrect_sequance) +{ + struct archive* a = archive_read_new(); + struct archive_read *ar = (struct archive_read *)a; + + assertEqualInt(ARCHIVE_OK, archive_read_add_passphrase(a, "pass1")); + + /* No call of __archive_read_reset_passphrase() leads to + * get NULL even if a user has passed a passphrases. */ + assertEqualString(NULL, __archive_read_next_passphrase(ar)); + + archive_read_free(a); +} + +DEFINE_TEST(test_archive_read_add_passphrase_single) +{ + struct archive* a = archive_read_new(); + struct archive_read *ar = (struct archive_read *)a; + + assertEqualInt(ARCHIVE_OK, archive_read_add_passphrase(a, "pass1")); + + __archive_read_reset_passphrase(ar); + /* Fist call, we should get "pass1" as a passphrase. */ + assertEqualString("pass1", __archive_read_next_passphrase(ar)); + /* Second call, we should get NULL which means all the pssphrases + * are passed already. */ + assertEqualString(NULL, __archive_read_next_passphrase(ar)); + + archive_read_free(a); +} + +DEFINE_TEST(test_archive_read_add_passphrase_multiple) +{ + struct archive* a = archive_read_new(); + struct archive_read *ar = (struct archive_read *)a; + + assertEqualInt(ARCHIVE_OK, archive_read_add_passphrase(a, "pass1")); + assertEqualInt(ARCHIVE_OK, archive_read_add_passphrase(a, "pass2")); + + __archive_read_reset_passphrase(ar); + /* Fist call, we should get "pass1" as a passphrase. */ + assertEqualString("pass1", __archive_read_next_passphrase(ar)); + /* Second call, we should get "pass2" as a passphrase. */ + assertEqualString("pass2", __archive_read_next_passphrase(ar)); + /* Third call, we should get NULL which means all the pssphrases + * are passed already. */ + assertEqualString(NULL, __archive_read_next_passphrase(ar)); + + archive_read_free(a); +} + +static const char * +callback1(struct archive *a, void *_client_data) +{ + (void)a; /* UNUSED */ + (void)_client_data; /* UNUSED */ + return ("passCallBack"); +} + +DEFINE_TEST(test_archive_read_add_passphrase_set_callback1) +{ + struct archive* a = archive_read_new(); + struct archive_read *ar = (struct archive_read *)a; + + assertEqualInt(ARCHIVE_OK, + archive_read_set_passphrase_callback(a, NULL, callback1)); + + __archive_read_reset_passphrase(ar); + /* Fist call, we should get "passCallBack" as a passphrase. */ + assertEqualString("passCallBack", __archive_read_next_passphrase(ar)); + /* Second call, we still get "passCallBack" as a passphrase. */ + assertEqualString("passCallBack", __archive_read_next_passphrase(ar)); + + archive_read_free(a); + + /* Without __archive_read_reset_passphrase call, the callback + * should work fine. */ + a = archive_read_new(); + ar = (struct archive_read *)a; + assertEqualInt(ARCHIVE_OK, + archive_read_set_passphrase_callback(a, NULL, callback1)); + /* Fist call, we should get "passCallBack" as a passphrase. */ + assertEqualString("passCallBack", __archive_read_next_passphrase(ar)); + /* Second call, we still get "passCallBack" as a passphrase. */ + assertEqualString("passCallBack", __archive_read_next_passphrase(ar)); + + archive_read_free(a); +} + +static const char * +callback2(struct archive *a, void *_client_data) +{ + int *cd = (int *)_client_data; + + (void)a; /* UNUSED */ + + if (*cd == 0) { + *cd = 1; + return ("passCallBack"); + } + return (NULL); +} + +DEFINE_TEST(test_archive_read_add_passphrase_set_callback2) +{ + struct archive* a = archive_read_new(); + struct archive_read *ar = (struct archive_read *)a; + int client_data = 0; + + assertEqualInt(ARCHIVE_OK, + archive_read_set_passphrase_callback(a, &client_data, callback2)); + + __archive_read_reset_passphrase(ar); + /* Fist call, we should get "passCallBack" as a passphrase. */ + assertEqualString("passCallBack", __archive_read_next_passphrase(ar)); + /* Second call, we should get NULL which means all the pssphrases + * are passed already. */ + assertEqualString(NULL, __archive_read_next_passphrase(ar)); + + archive_read_free(a); +} + +DEFINE_TEST(test_archive_read_add_passphrase_set_callback3) +{ + struct archive* a = archive_read_new(); + struct archive_read *ar = (struct archive_read *)a; + int client_data = 0; + + assertEqualInt(ARCHIVE_OK, + archive_read_set_passphrase_callback(a, &client_data, callback2)); + + __archive_read_reset_passphrase(ar); + /* Fist call, we should get "passCallBack" as a passphrase. */ + assertEqualString("passCallBack", __archive_read_next_passphrase(ar)); + __archive_read_reset_passphrase(ar); + /* After reset passphrase, we should get "passCallBack"passphrase. */ + assertEqualString("passCallBack", __archive_read_next_passphrase(ar)); + /* Second call, we should get NULL which means all the pssphrases + * are passed already. */ + assertEqualString(NULL, __archive_read_next_passphrase(ar)); + + archive_read_free(a); +} + +DEFINE_TEST(test_archive_read_add_passphrase_multiple_with_callback) +{ + struct archive* a = archive_read_new(); + struct archive_read *ar = (struct archive_read *)a; + int client_data = 0; + + assertEqualInt(ARCHIVE_OK, archive_read_add_passphrase(a, "pass1")); + assertEqualInt(ARCHIVE_OK, archive_read_add_passphrase(a, "pass2")); + assertEqualInt(ARCHIVE_OK, + archive_read_set_passphrase_callback(a, &client_data, callback2)); + + __archive_read_reset_passphrase(ar); + /* Fist call, we should get "pass1" as a passphrase. */ + assertEqualString("pass1", __archive_read_next_passphrase(ar)); + /* Second call, we should get "pass2" as a passphrase. */ + assertEqualString("pass2", __archive_read_next_passphrase(ar)); + /* Third call, we should get "passCallBack" as a passphrase. */ + assertEqualString("passCallBack", __archive_read_next_passphrase(ar)); + /* Fourth call, we should get NULL which means all the pssphrases + * are passed already. */ + assertEqualString(NULL, __archive_read_next_passphrase(ar)); + + archive_read_free(a); +} + +DEFINE_TEST(test_archive_read_add_passphrase_multiple_with_callback2) +{ + struct archive* a = archive_read_new(); + struct archive_read *ar = (struct archive_read *)a; + int client_data = 0; + + assertEqualInt(ARCHIVE_OK, archive_read_add_passphrase(a, "pass1")); + assertEqualInt(ARCHIVE_OK, archive_read_add_passphrase(a, "pass2")); + assertEqualInt(ARCHIVE_OK, + archive_read_set_passphrase_callback(a, &client_data, callback2)); + + __archive_read_reset_passphrase(ar); + /* Fist call, we should get "pass1" as a passphrase. */ + assertEqualString("pass1", __archive_read_next_passphrase(ar)); + /* Second call, we should get "pass2" as a passphrase. */ + assertEqualString("pass2", __archive_read_next_passphrase(ar)); + /* Third call, we should get "passCallBack" as a passphrase. */ + assertEqualString("passCallBack", __archive_read_next_passphrase(ar)); + + __archive_read_reset_passphrase(ar); + /* After reset passphrase, we should get "passCallBack" passphrase. */ + assertEqualString("passCallBack", __archive_read_next_passphrase(ar)); + /* Second call, we should get "pass1" as a passphrase. */ + assertEqualString("pass1", __archive_read_next_passphrase(ar)); + /* Third call, we should get "passCallBack" as a passphrase. */ + assertEqualString("pass2", __archive_read_next_passphrase(ar)); + /* Fourth call, we should get NULL which means all the pssphrases + * are passed already. */ + assertEqualString(NULL, __archive_read_next_passphrase(ar)); + + archive_read_free(a); +} + diff --git a/libarchive/test/test_archive_string.c b/libarchive/test/test_archive_string.c index 54f68bdaed1a..9e3f90702dbc 100644 --- a/libarchive/test/test_archive_string.c +++ b/libarchive/test/test_archive_string.c @@ -342,3 +342,66 @@ DEFINE_TEST(test_archive_string) test_archive_string_copy(); test_archive_string_sprintf(); } + +static const char *strings[] = +{ + "dir/path", + "dir/path2", + "dir/path3", + "dir/path4", + "dir/path5", + "dir/path6", + "dir/path7", + "dir/path8", + "dir/path9", + "dir/subdir/path", + "dir/subdir/path2", + "dir/subdir/path3", + "dir/subdir/path4", + "dir/subdir/path5", + "dir/subdir/path6", + "dir/subdir/path7", + "dir/subdir/path8", + "dir/subdir/path9", + "dir2/path", + "dir2/path2", + "dir2/path3", + "dir2/path4", + "dir2/path5", + "dir2/path6", + "dir2/path7", + "dir2/path8", + "dir2/path9", + NULL +}; + +DEFINE_TEST(test_archive_string_sort) +{ + unsigned int i, j, size; + char **test_strings, *tmp; + + srand((unsigned int)time(NULL)); + size = sizeof(strings) / sizeof(char *); + assert((test_strings = (char **)calloc(1, sizeof(strings))) != NULL); + for (i = 0; i < (size - 1); i++) + assert((test_strings[i] = strdup(strings[i])) != NULL); + + /* Shuffle the test strings */ + for (i = 0; i < (size - 1); i++) + { + j = rand() % ((size - 1) - i); + j += i; + tmp = test_strings[i]; + test_strings[i] = test_strings[j]; + test_strings[j] = tmp; + } + + /* Sort and test */ + assertEqualInt(ARCHIVE_OK, archive_utility_string_sort(test_strings)); + for (i = 0; i < (size - 1); i++) + assertEqualString(test_strings[i], strings[i]); + + for (i = 0; i < (size - 1); i++) + free(test_strings[i]); + free(test_strings); +} diff --git a/libarchive/test/test_archive_write_add_filter_by_name.c b/libarchive/test/test_archive_write_add_filter_by_name.c index ff5ca5b1d471..38b606b9d165 100644 --- a/libarchive/test/test_archive_write_add_filter_by_name.c +++ b/libarchive/test/test_archive_write_add_filter_by_name.c @@ -38,7 +38,7 @@ test_filter_by_name(const char *filter_name, int filter_code, char *buff; int r; - assert((buff = malloc(buffsize)) != NULL); + assert((buff = calloc(1, buffsize)) != NULL); if (buff == NULL) return; @@ -70,6 +70,16 @@ test_filter_by_name(const char *filter_name, int filter_code, return; } } + if (filter_code == ARCHIVE_FILTER_LRZIP) + { + /* + * There's a bug in lrzip (as of release 0.612) where 2nd stage + * compression can't be performed on smaller files. Set lrzip to + * use no 2nd stage compression. + */ + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "lrzip:compression=none")); + } assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_per_block(a, 10)); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used)); @@ -168,6 +178,11 @@ DEFINE_TEST(test_archive_write_add_filter_by_name_lrzip) test_filter_by_name("lrzip", ARCHIVE_FILTER_LRZIP, canLrzip); } +DEFINE_TEST(test_archive_write_add_filter_by_name_lz4) +{ + test_filter_by_name("lz4", ARCHIVE_FILTER_LZ4, canLz4); +} + DEFINE_TEST(test_archive_write_add_filter_by_name_lzip) { test_filter_by_name("lzip", ARCHIVE_FILTER_LZIP, cannot); diff --git a/libarchive/test/test_archive_write_set_format_by_name.c b/libarchive/test/test_archive_write_set_format_by_name.c index b5fad2ab6c78..ef1327431b37 100644 --- a/libarchive/test/test_archive_write_set_format_by_name.c +++ b/libarchive/test/test_archive_write_set_format_by_name.c @@ -274,6 +274,11 @@ DEFINE_TEST(test_archive_write_set_format_by_name_v7) test_format_by_name("v7", NULL, ARCHIVE_FORMAT_TAR, 0, NULL, 0); } +DEFINE_TEST(test_archive_write_set_format_by_name_warc) +{ + test_format_by_name("warc", NULL, ARCHIVE_FORMAT_WARC, 0, NULL, 0); +} + DEFINE_TEST(test_archive_write_set_format_by_name_xar) { test_format_by_name("xar", "gzip", ARCHIVE_FORMAT_XAR, 0, NULL, 0); diff --git a/libarchive/test/test_archive_write_set_format_filter_by_ext.c b/libarchive/test/test_archive_write_set_format_filter_by_ext.c new file mode 100644 index 000000000000..c073505f7c97 --- /dev/null +++ b/libarchive/test/test_archive_write_set_format_filter_by_ext.c @@ -0,0 +1,211 @@ +/*- + * Copyright (c) 2012 Michihiro NAKAJIMA + * Copyright (c) 2015 Okhotnikov Kirill + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + + +#include "test.h" +__FBSDID("$FreeBSD$"); + +static void +test_format_filter_by_ext(const char *output_file, + int format_id, int filter_id, int dot_stored, char * def_ext) +{ + struct archive_entry *ae; + struct archive *a; + size_t used; + size_t buffsize = 1024 * 1024; + char *buff; + int r; + + assert((buff = malloc(buffsize)) != NULL); + if (buff == NULL) + return; + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + if( def_ext == NULL) + r = archive_write_set_format_filter_by_ext(a, output_file); + else + r = archive_write_set_format_filter_by_ext_def(a, output_file, def_ext); + if (r == ARCHIVE_WARN) { + skipping("%s format not fully supported on this platform", + archive_format_name(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + free(buff); + return; + } else if (r == ARCHIVE_FATAL && + (strcmp(archive_error_string(a), + "lzma compression not supported on this platform") == 0 || + strcmp(archive_error_string(a), + "xz compression not supported on this platform") == 0)) { + const char *filter_name = archive_filter_name(a, 0); + skipping("%s filter not suported on this platform", filter_name); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + free(buff); + return; + } else { + if (!assertEqualIntA(a, ARCHIVE_OK, r)) { + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + free(buff); + return; + } + } + + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + + /* + * Write a file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 0); + assertEqualInt(1, archive_entry_mtime(ae)); + archive_entry_set_ctime(ae, 1, 0); + assertEqualInt(1, archive_entry_ctime(ae)); + archive_entry_set_atime(ae, 1, 0); + assertEqualInt(1, archive_entry_atime(ae)); + archive_entry_copy_pathname(ae, "file"); + assertEqualString("file", archive_entry_pathname(ae)); + archive_entry_set_mode(ae, AE_IFREG | 0755); + assertEqualInt((AE_IFREG | 0755), archive_entry_mode(ae)); + archive_entry_set_size(ae, 8); + assertEqualInt(0, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(8, archive_write_data(a, "12345678", 8)); + + /* Close out the archive. */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + if (format_id > 0) { + /* + * Now, read the data back. + */ + /* With the test memory reader -- seeking mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + read_open_memory_seek(a, buff, used, 7)); + + if (dot_stored & 1) { + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + assertEqualString(".", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + } + /* + * Read and verify the file. + */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + if (dot_stored & 2) { + assertEqualString("./file", archive_entry_pathname(ae)); + } else { + assertEqualString("file", archive_entry_pathname(ae)); + } + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(8, archive_entry_size(ae)); + + /* Verify the end of the archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualIntA(a, filter_id, + archive_filter_code(a, 0)); + assertEqualIntA(a, format_id, archive_format(a) & ARCHIVE_FORMAT_BASE_MASK ); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + } + free(buff); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_7zip) +{ + test_format_filter_by_ext("./data/test.7z", ARCHIVE_FORMAT_7ZIP, ARCHIVE_FILTER_NONE, 0, NULL); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_zip) +{ + test_format_filter_by_ext("./data/test.zip", ARCHIVE_FORMAT_ZIP, ARCHIVE_FILTER_NONE, 0, NULL); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_jar) +{ + test_format_filter_by_ext("./data/test.jar", ARCHIVE_FORMAT_ZIP, ARCHIVE_FILTER_NONE, 0, NULL); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_a) +{ + test_format_filter_by_ext("./data/test.a", ARCHIVE_FORMAT_AR, ARCHIVE_FILTER_NONE, 0, NULL); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_ar) +{ + test_format_filter_by_ext("./data/test.ar", ARCHIVE_FORMAT_AR, ARCHIVE_FILTER_NONE, 0, NULL); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_cpio) +{ + test_format_filter_by_ext("./data/test.cpio", ARCHIVE_FORMAT_CPIO, ARCHIVE_FILTER_NONE, 0, NULL); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_iso) +{ + test_format_filter_by_ext("./data/test.iso", ARCHIVE_FORMAT_ISO9660, ARCHIVE_FILTER_NONE, 1, NULL); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_tar) +{ + test_format_filter_by_ext("./data/test.tar", ARCHIVE_FORMAT_TAR, ARCHIVE_FILTER_NONE, 0, NULL); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_tar_gz) +{ + test_format_filter_by_ext("./data/test.tar.gz", ARCHIVE_FORMAT_TAR, ARCHIVE_FILTER_GZIP, 20, NULL); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_tar_bz2) +{ + test_format_filter_by_ext("./data/test.tar.bz2", ARCHIVE_FORMAT_TAR, ARCHIVE_FILTER_BZIP2, 0, NULL); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_tar_xz) +{ + test_format_filter_by_ext("./data/test.tar.xz", ARCHIVE_FORMAT_TAR, ARCHIVE_FILTER_XZ, 0, NULL); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_no_ext_def_zip) +{ + test_format_filter_by_ext("./data/test", ARCHIVE_FORMAT_ZIP, ARCHIVE_FILTER_NONE, 0, ".zip"); +} + +DEFINE_TEST(test_archive_write_set_format_filter_by_ext_tar_bz2_def_zip) +{ + test_format_filter_by_ext("./data/test.tar.bz2", ARCHIVE_FORMAT_TAR, ARCHIVE_FILTER_BZIP2, 0, ".zip"); +} diff --git a/libarchive/test/test_archive_write_set_passphrase.c b/libarchive/test/test_archive_write_set_passphrase.c new file mode 100644 index 000000000000..4bfcbb2c2dab --- /dev/null +++ b/libarchive/test/test_archive_write_set_passphrase.c @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 2011 Tim Kientzle + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +struct archive_write; +extern const char * __archive_write_get_passphrase(struct archive_write *); + +static void +test(int pristine) +{ + struct archive* a = archive_write_new(); + struct archive_write* aw = (struct archive_write *)a; + + if (!pristine) { + archive_write_add_filter_gzip(a); + archive_write_set_format_iso9660(a); + } + + assertEqualInt(ARCHIVE_OK, archive_write_set_passphrase(a, "pass1")); + /* An empty passphrase cannot be accepted. */ + assertEqualInt(ARCHIVE_FAILED, archive_write_set_passphrase(a, "")); + /* NULL passphrases cannot be accepted. */ + assertEqualInt(ARCHIVE_FAILED, archive_write_set_passphrase(a, NULL)); + /* Check a passphrase. */ + assertEqualString("pass1", __archive_write_get_passphrase(aw)); + /* Change the passphrase. */ + assertEqualInt(ARCHIVE_OK, archive_write_set_passphrase(a, "pass2")); + assertEqualString("pass2", __archive_write_get_passphrase(aw)); + + archive_write_free(a); +} + +DEFINE_TEST(test_archive_write_set_passphrase) +{ + test(1); + test(0); +} + + +static const char * +callback1(struct archive *a, void *_client_data) +{ + int *cnt; + + (void)a; /* UNUSED */ + + cnt = (int *)_client_data; + *cnt += 1; + return ("passCallBack"); +} + +DEFINE_TEST(test_archive_write_set_passphrase_callback) +{ + struct archive* a = archive_write_new(); + struct archive_write* aw = (struct archive_write *)a; + int cnt = 0; + + archive_write_set_format_zip(a); + + assertEqualInt(ARCHIVE_OK, + archive_write_set_passphrase_callback(a, &cnt, callback1)); + /* Check a passphrase. */ + assertEqualString("passCallBack", __archive_write_get_passphrase(aw)); + assertEqualInt(1, cnt); + /* Callback function should be called just once. */ + assertEqualString("passCallBack", __archive_write_get_passphrase(aw)); + assertEqualInt(1, cnt); + + archive_write_free(a); +} diff --git a/libarchive/test/test_compat_lz4.c b/libarchive/test/test_compat_lz4.c new file mode 100644 index 000000000000..eb763c1a7021 --- /dev/null +++ b/libarchive/test/test_compat_lz4.c @@ -0,0 +1,120 @@ +/*- + * Copyright (c) 2003-2008 Tim Kientzle + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* + * Verify our ability to read sample files compatibly with 'lz4 -d'. + * + * In particular: + * * lz4 -d will read multiple lz4 streams, concatenating the output + * * lz4 -d will stop at the end of a stream if the following data + * doesn't start with a lz4 signature. + */ + +/* + * All of the sample files have the same contents; they're just + * compressed in different ways. + */ +static void +verify(const char *name, const char *n[]) +{ + struct archive_entry *ae; + struct archive *a; + int i,r; + + assert((a = archive_read_new()) != NULL); + r = archive_read_support_filter_lz4(a); + if (r == ARCHIVE_WARN) { + skipping("lz4 reading not fully supported on this platform"); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + return; + } + assertEqualIntA(a, ARCHIVE_OK, r); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + copy_reference_file(name); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 200)); + + /* Read entries, match up names with list above. */ + for (i = 0; n[i] != NULL; ++i) { + failure("Could not read file %d (%s) from %s", i, n[i], name); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + if (r != ARCHIVE_OK) { + archive_read_free(a); + return; + } + assertEqualString(n[i], archive_entry_pathname(ae)); + } + + /* Verify the end-of-archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify that the format detection worked. */ + assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_LZ4); + assertEqualString(archive_filter_name(a, 0), "lz4"); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + + +DEFINE_TEST(test_compat_lz4) +{ + const char *n[7] = { "f1", "f2", "f3", "d1/f1", "d1/f2", "d1/f3", NULL }; + const char *n2[7] = { "xfile", "README", "NEWS", NULL }; + /* This sample has been 'split', each piece compressed separately, + * then concatenated. Lz4 will emit the concatenated result. */ + /* Not supported in libarchive 2.6 and earlier */ + verify("test_compat_lz4_1.tar.lz4.uu", n); + /* This sample has been compressed as a single stream, but then + * some unrelated garbage text has been appended to the end. */ + verify("test_compat_lz4_2.tar.lz4.uu", n); + /* This sample has been compressed as a legacy stream. */ + verify("test_compat_lz4_3.tar.lz4.uu", n); + /* This sample has been compressed with -B4 option. */ + verify("test_compat_lz4_B4.tar.lz4.uu", n2); + /* This sample has been compressed with -B5 option. */ + verify("test_compat_lz4_B5.tar.lz4.uu", n2); + /* This sample has been compressed with -B6 option. */ + verify("test_compat_lz4_B6.tar.lz4.uu", n2); + /* This sample has been compressed with -B7 option. */ + verify("test_compat_lz4_B7.tar.lz4.uu", n2); + /* This sample has been compressed with -B4 and -BD options. */ + verify("test_compat_lz4_B4BD.tar.lz4.uu", n2); + /* This sample has been compressed with -B5 and -BD options. */ + verify("test_compat_lz4_B5BD.tar.lz4.uu", n2); + /* This sample has been compressed with -B6 and -BD options. */ + verify("test_compat_lz4_B6BD.tar.lz4.uu", n2); + /* This sample has been compressed with -B7 and -BD options. */ + verify("test_compat_lz4_B7BD.tar.lz4.uu", n2); + /* This sample has been compressed with -B4 ,-BD and -BX options. */ + verify("test_compat_lz4_B4BDBX.tar.lz4.uu", n2); +} + + diff --git a/libarchive/test/test_compat_lz4_1.tar.lz4.uu b/libarchive/test/test_compat_lz4_1.tar.lz4.uu new file mode 100644 index 000000000000..94c8cec3f7b4 --- /dev/null +++ b/libarchive/test/test_compat_lz4_1.tar.lz4.uu @@ -0,0 +1,12 @@ +begin 644 test_compat_lz4_1.tar.lz4 +M!")-&&1PN:8````_9C$``0!.Z#`P,#8T-"``,#`Q-S4Q"``$`@#_"#,@,3$Q +M,3`U,S8V,3$@,#$Q,C0S`"`PF@!.\00```!UFQE%0`/ +M`@`@`LL``-T```(`'R!"`"`/`@!B/V8Q"G@`8@\"`/]V+V8RB@%/#P`$&Q(S +M``0?-@`$_U4?,@`$_^T?,P`$?1$V``0O-3(`!/]5'S,`!/_G4``````````` +M`";]7\`$(DT89'"YL@```&]D,2]F,0`!`$OH,#`P-C0T(``P,#$W-3$(``0" +M`/\(,R`Q,3$Q,#4S-C8R-R`P,3$U-38`(#"7`$L"`@#R`75S=&%R`#`P:VEE +M;G1Z;&46``\"`!\"RP``W0```@`?($$`'P\"`&,_9C$*>0!C#P(`_W4```0? +M,HP!3`\`!!HB,S``!!\Q``3_51\R``3_\!\S``1Z$C$`!!\S``3_51\S``3_ +6[`\"`/___^M0````````````;,,BR0`` +` +end diff --git a/libarchive/test/test_compat_lz4_2.tar.lz4.uu b/libarchive/test/test_compat_lz4_2.tar.lz4.uu new file mode 100644 index 000000000000..5efdd74a483c --- /dev/null +++ b/libarchive/test/test_compat_lz4_2.tar.lz4.uu @@ -0,0 +1,13 @@ +begin 644 test_compat_lz4_2.tar.lz4 +M!")-&&1PN:8````_9C$``0!.Z#`P,#8T-"``,#`Q-S4Q"``$`@#_"#,@,3$Q +M,3`U,S8V,3$@,#$Q,C0S`"`PF@!.\00```!UFQE%0`/ +M`@`@`LL``-T```(`'R!"`"`/`@!B/V8Q"G@`8@\"`/]V+V8RB@%/#P`$&Q(S +M``0?-@`$_U4?,@`$_^T?,P`$?1$V``0O-3(`!/]5'S,`!/_G4``````````` +M`";]7\`$(DT89'"YL@```&]D,2]F,0`!`$OH,#`P-C0T(``P,#$W-3$(``0" +M`/\(,R`Q,3$Q,#4S-C8R-R`P,3$U-38`(#"7`$L"`@#R`75S=&%R`#`P:VEE +M;G1Z;&46``\"`!\"RP``W0```@`?($$`'P\"`&,_9C$*>0!C#P(`_W4```0? +M,HP!3`\`!!HB,S``!!\Q``3_51\R``3_\!\S``1Z$C$`!!\S``3_51\S``3_ +M[`\"`/___^M0````````````;,,BR51H:7,@:7,@=6YR96QA=&5D(&IU;FL@ +<9&%T82!A="!T:&4@96YD(&]F('1H92!F:6QE"@`` +` +end diff --git a/libarchive/test/test_compat_lz4_3.tar.lz4.uu b/libarchive/test/test_compat_lz4_3.tar.lz4.uu new file mode 100644 index 000000000000..97e79fb6e317 --- /dev/null +++ b/libarchive/test/test_compat_lz4_3.tar.lz4.uu @@ -0,0 +1,9 @@ +begin 644 test_compat_lz4_3.tar.lz4 +M`B%,&/X````_9C$``0!.Z#`P,#8T-"``,#`Q-S4Q"``$`@#_"#,@,3$Q,3`U +M,S8V,3$@,#$Q,C0S`"`PF@!.\00```!UFQE%0`/`@`@ +M`LL``-T```(`'R!"`"`/`@!B/V8Q"G@`8@\"`/]V+V8RB@%/#P`$&Q(S``0? +M-@`$_U4?,@`$_^T?,P`$?1$V``0O-3(`!/]5'S,`!/_L/V0Q+P,,3@\`"!H@ +M,C<`!"\U-0`(_U8/``S_[0``!`\##$T/``0:(C,P``0?,0`(_U4/``S_[0`` +E!`\##$T/``0;`0`4+S4U`!3_5@\`#/_M#P(`____ZU`````````` +` +end diff --git a/libarchive/test/test_compat_lz4_B4.tar.lz4.uu b/libarchive/test/test_compat_lz4_B4.tar.lz4.uu new file mode 100644 index 000000000000..329a85349f30 --- /dev/null +++ b/libarchive/test/test_compat_lz4_B4.tar.lz4.uu @@ -0,0 +1,6739 @@ +begin 644 test_compat_lz4_B4.tar.lz4 +M!")-&&1`IY41``!O>&9I;&4``0!+X3`P,#8T-"``,#`P-S8U"``B,#(0`"(R +M,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!)`0"2 +M"0`G`%`J(&5X84D`0',Z(%,R`U1S;6%L;!4`!#X!`%(#(6%T'`@@;6'F!"!N +M9-`",69U;"\"!D4`$"]#"@&%`1%AG@I186-T('-@`)(@9&5M;VYS=')*#0`I +M!B=O9EX!`TD`,&-O;D,"\`(Z("!687)I;W5S(&ET96US(#,!`'T#0&UE(&(W +M`3)I0&";8"(FENU@0`I`H`ZP4$O0+P`DY% +M5U,@+2!H:6=H;&EG:'1S7`8PH($',+!0$^`0!U```7`@#Y!`%Q +M``%Q"@B7```\"3-Y+C--``#O!#)E(")K`P6K``$D`!0B"PM9(&-L87-$``$? +M"49N86QSG0`2!Q(M@@0U]!9!I;@IA +M(&YU;6+R#!=FD0<$.P''"@I9;W4@ +M`*%35E(T($%30TE)=`(!%``/,@`+$$)M$1%Y+@"Q("AB:6%T`/ +M"Q<`T$UI8W)O"T4``("`+D%!(D1`@L7`UH7`5$`!>D2,',@*%,*`30$`(0!`S,$`/0#8"P@ +M971C*>\+`OH#`&P$`&T``HT``9L!`MH`#\@#"F$B;F5W8R*;`P$S`"=S:+`` +M`1(`#T8#8P0%!`?.``]9`P`*%@,/9!K_____________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________XE!E=&%I;%H1``#U'G,@=&AE +M(")S=')U8W0@87)C:&EV95]E;G1R>2(@=71I;&ET>2!C;&%SP#S"2P@:6YC;'5D:6YG +M(&AA``"/`/0:("=D;V,G +M(&1I2!I;@IA(&YU;6)E6]U(#\!8"X*"D-U\!`DD` +M-%I)4%8#!$``P'5N8V]M<')EB,``!DT%``) +M"`&58V%N(&-R96%TSP`!=00/!@$"`J\!`[\#`KP"#Q\#&,$B!S>7-T96TN("!4 +M:&5R92P`(VYOX@<`@@(#WP@`DP3R`B!I;BUP;&%C92!M;V1I9FECK0CS`F]R +M(')A;F1O;2!A8V-E0`&@`3R`FES(&1EP`#P`!APD!HP!4(&]N;'D*`P`X"`"R``$>`P"F +M!`(,`B$@8C<)<7)E861A8FP`!D%W48!`-T!*F5DB@@"1P"P22=V92!A='1E;7",!^!T;R!M:6YI +M;6EZ92!S=+4(`E((4'!O;&QU(@=1+B`@26;U"$!D;VXGU@7L#$7`U`-%A=&5V97(@8FQO8VMS\``` +M[@2X'<70@82!T:6U7`P!K"S%M87#X`C!E;G21!@/0`@%1`T!G:79EY@$A=&\B +M``6A`&%T(&]N8V6%`"%/;I`#&V7#``+D`C)P@``P0&%82!S;V-K970^`TEW:7-HN@0!)@\# +M60\`0#`',*T2!S87ES+@I214%$3442!@9)$>$@8G5N9&QE+@H*475E<_H" +MH#\@($ES8$(&YDT`(Q9G5L +M+P(&10`0+T,*`84!$6&>"C1A8W1[$W!D96UO;G-T.14@;F<^``"`!094`@-) +M`#!C;VY#`F$Z("!687+N$V!I=&5M$0(8 +M`&!C;VYF:6=^"Q4M#``"1`"UM`Q$SM@L`$!20(&]V97)V:65W\P(`JP`%P`L`<04P=VAOD0(4*J0* +MA5]R96%D+C,L$``!^`@-$0!17V1I2#R`I!I;VYS+@H*5&B=`?("<"UL979E;"!D:7)E8W1O'2(`#!P=71>`H$@(F-M86ME(B0#:60@ +M=&]O;$T``E8!!NL#`2D!,2!I;DP!#VT!`3!A2!N965D?``Q;6%I]@$C97)<`05P`"1I;F0`\@,N:"YI +M;@H)+2!T96UP;&%T97-G`!%B-`(!9@$39;4`8`H*1W5I9/,`4"!$;V-UF04" +M@0$`Q0$R86QL=0`!MP&R'!L@P(#+P,`0@$" +M(0`$F@,#,P``B`0/-``+`"(`##4`+V%T-``,*&%T,P`&`0:`+C,@9VEV97/? +M!H!O=F5R=FEE=_,"`*``!+L%$&%Q!3!W:&^1`B,J("X'A5]R96%D+C,L$``` +MT04=91$`45]D:7-K%@`@;F30`0@^``,<``"9`!!V7P$"MP)A960@8V%LB0<0 +M<]0&06YC97.M`@"3``!U``%'``-"!FAE($%027.7`'-E;G1R>2XS30`"]P,2 +M(FL#!:L``20`4"(@=71II`59(&-L87-$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$6%P$A%O\0T` +M]@`6+G0``]D#`J#B)A;N@"`*4'!C0*$"QC`$!D97-PH@``;`0!Y`,`7,N"B05 +M$6:X#06Y&0*A&$0N"@I1$19`/R`@2:T9(',_4@`4*I491G=W=RXX`$`N;W)G +MDP``2`$0:+@"`%<`0V]N9V]8!Q<@3`<@(&18%B!O<#P%"!D1!+H1`:P(`3<, +M`'$``#H`'VYD&O______________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________:E!I=F4@92@1``#Q$6YT7,@9&5T96-T960@ +M875T;VUA=&EC86QL>4<`L$DG=F4@871T96UP(@#@=&\@;6EN:6UI>F4@6]U(&1O;B=TJ```M@#Q`FEC:71L +M>2!I;G9O:V4@82!PZP#P#G5L87(@9F5A='5R92`H``%1`0.;`%IE;F%B;)L``#X`"W$`*&1E$0`#J@`1 +M+/```H``(FYE)@$`%@$`0`!Q86=A:6YS=,\!V6-O8`0U: +M`)%L:6)R87)I97/#`/$"5&AI3X`!8P``+$!\09P"!I;G1E7,N"E)%041-12X`!^@& +MX2!B=6YD;&4N"@I1=65S^@*@/R`@27-S=65S/U(`UBH@:'1T<#HO+W=W=RY, +M!T`N;W)GDP``2`$0:+@"@V9O0(1.FH` +M$B>7!9`G('!R;V=R86T6`G-A(&9U;&PME@AP9"`G=&%R)WX``P(`4W)E<&QA +M0@%`8G5I;($&`(H``V,``"H`9BH@8W!I;V,```X`"V0`(&1I:P4R96YT,`-# +M9F%C96H#`P(`,&5S`<``$D!`)()`"<` +M4"H@97AA20!`8$(&YDT`(Q +M9G5L+P(&10`0+T,*`84!$6$&"5%A8W0@`0-)`#!C;VY#`O`".B`@5F%R:6]UP``7P%Q875T:&]R<\`%`1\&`?("`DT' +M$`J(!E!T;W`M;`P$`W8%`#`'`4$`$&GD!@FV`B)I;M8$`'$+`.L%!+T"\`). +M15=3("T@:&EG:&QI9VAT=&%R+C54`0CQ!$%A8F]U4P41]!9!I;@IA(&YU;6+R#!=F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7,@97-P96-I;@0!T`$"J@$`.@@P.B`BDPH.V@T3(KD"`-X. +M(F%NZ`(`I0<`$0,"P040+&,`0&1E%E +MF-%#A)B!P`2>`<``$D!`)()`"<`4"H@97AA20!`8$(&YDT`(Q9G5L+P(&10`0+T,* +M`84!$6&>"E%A8W0@'2(`")P==8-(")C-`81(B0#`#@,*6]L30`"5@$&ZP,!*0$` +M%@D`C@$/;0$!`+`,$'4]$P':`31E"B>P`"-E)ZT``#H/,"`J(),``$X`\``N +M86TL(&%C;&]C86PN;30)#0/M`#`N86/_```"`!`MH@(`GP`$J```V0X(H@02 +M+!H.`-<+`%D+$'G*!0'V`2-EH($',+!0$^`0!U```7`@#Y!`%Q``%Q"@B7```\ +M"3!Y+C/T%#!A:6SO!#)E(")K`P6K``$D`!0B"PM9(&-L87-$``$?"49N86QS +MG0`2!Q(M@@0U=H+`#L'`2,)#V0:________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________]I4'(*("`@/A$``!(@`0!R>F-A +M="P@8@<`$G@'`/0386YD('-U8V@*("`@*B!E>&%M<&QE'2( +M`#%P=70I`/D#(F-M86ME(B!B=6EL9"!T;V]L30`"5@$&-0$!*0$Q(&EN3`$/ +M;0$!,&%R91`"$F3:`35E"B>\`!,GK0`2.M0``),``$X`]0$N86TL(&%C;&]C +M86PN;30LX0!`92YA8RL```(`$BU4`"1T;Z@``"`!,&1IM`_`$,R!G:79E2XS!`,!JP(2(FL#!:L``20`Z2(@=71I;&ET>2!C;&%S1`"6:6YT97)N86QS +MG0`P`?$#+@H*66]U('-H;W5L9"!A;'-O(@(!3``Q8V]P=@8R8V]M6P%# +M:6X@(KT",BYH(JD`@&AE"G-O=7)C+P`19'4!`!0`!.D&!30'`"P%-&UO<$",&5C=)D#$635 +M``,<`@7"!A!F+``!MP91*B!'3E5U`0*Z`28@*+D!`!H`06QO;F=5`F)N86UE +M'1E +M;J+``-J`0`9`]$J(%!/4TE8('5S=&%R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HN@0!)@\# +M60\`4X.475S92`B(0$`6@@@+")0"+$L(&-A<&%B +M:6QI=/8"!`,!!?$``O,/`;<$"/8%`9P"`,D*`2L` +M,VEN("#U%F:7)S=)("`*8!$6%P$A%O61$` +M]@`6+G0``]D#`J60! +M`,P``*,!!H`%,7=A;G\%$G0=#P$V`@%;`P$:!!!TC@0#`',* +MT2!S87ES+@I214%$3442!@9)$>$@8G5N9&QE+@H*475E<_H"H#\@($ESF-%#A)B!P`2>`<``$D!`)()`"<`02H@97@;$T!S.B!3,@-4X/\`4@*B!.15=3("T@:&EG:&QI9VAT<]P`,')E8]D4`C$%`Z`" +MDD-/4%E)3D<@+0P%`$(4`,H'(F1OGP``AP4`S@"T*B!)3E-404Q,("V2&`&/ +M!`$-``#Y%@"_``(I``-`!1(M1!D`E0`"&``%=QDE("T,``)$``*W&54L('-E +M96<``"@%`JT7`F,(@2H@0TUA:V5,U`0Q='ATB``A<'5G$#`@(F,T!A0BO!DY +M;V]L30`"5@$&-0$`E```L`H!C@$/;0$!`*(&#V0:____________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________________]G4'1O(&%L+1$` +M`/`@;&]W(&EN9&EV:61U86P@96YT2!A;F0@861D(&ET3`#P!2!T87(@87)C +M:&EV92!W:71H;W5T00!19FER2!F:6QE+G0` +M0F%L8<`\01S;V-K970N("!)9B!Y;W4@=V%NB``2=%T`$B\]``,?`0`S`%!D +M:7-K+$X`\!!R92!A0#P*FES(&5S<&5C:6%L;'D@96%S>2X*"B`J($YO=&4Z(")P87@@:6YT97)C +M:&%N9V4@9F]R;6%T(B!I<^```#,``.(`<7AT96YD960X`0(B`!`L8P!`9&5S +M<-\`0'=H8726`/`#(&YA;64@F-A="P@8@<`$G@'``!)`4!S=6-H)P!0*B!E>&%)`$!S.B!3,@-4`0-)`#!C;VY#`O`".B`@5F%R +M:6]UP``7P%Q875T:&]R<\`%`1\&`?("``$%4"X*"E1HG0$P<"UL#`0#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%`1\&`?("`DT'$`J(!E!T;W`M;`P$`W8%`#`' +M`4$`$&GD!@FV`B)I;M8$`'$+`.L%!+T"\`).15=3("T@:&EG:&QI9VAT=&%R+C54`0CQ!$%A8F]U4P41]!9!I;@IA(&YU;6+R#!=F +MD0<$.P''"@I9;W4@`D09@82`;<&42H@ +M1TY5=0$"-0(F("@$"P`:`"-L;[P%`*T+(G,L$```!0L3(!$``&,`4G-P87)S +M?`(A +M`*%35E(T($%30TE)=`(!%``/,@`+$$)M$1%Y+@"Q("AB:6`@@;W#+`\!A;"!2 +M;V-K[`@0]`5HW+5II<"8`V$UI8W)OFEP/@$@:6]/$WTJ(&)Z:7`R%@`$?`%-+TQ:5QT`HFQZ;6$L +M(&QZ:7`3`R]X>B,``!DT%``)"`$```H"G!`%.@$`=00/!@$"`J\!`[\#`KP" +M#Q\#&#`B\+`OH#`*D"`&@1`HT``9L!`MH`#\@#"F$B;F5W8R*;`P$S`"=S +M:+```1(`#T8#8P0%!`?.``]9`P`*%@,S5VAE`P(`OP@#U`(2<^8%87)E`3AN97>U`P#P!`#]`@.?`0![``&'"0$K +M%0)*#`,*`P`X"`!O$!1T[A("#`(A(&(W"0","@&/&`.X%`$,`!!A#`$"U!`` +M:``".P`199P6`#T!(79E4,`4&EN9&5PJ@`E;G0B`0!$#0]D&O______ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M8U!A;F0@'1E;F1E +M9&0`!#-!0TPS`&%/;&0@5C2!O9K@"X&)E9F]R92!E=F%L=6%TI`(`V`(# +M+P("SP)@=75E;F-O<0(`M@("0P(!"@`1((,!HE)032!WFEP +M/@$Q:6]N!0%=8GII<#(6``1D`4TO3%I7'0"B;'IM82P@;'II0`&EP"0:7,@9&5S +M:6=NH@9";R!B98@%`$`$`3`$.&YE=[4#`*,$`'L``4,`4&EN9&5PJ@`B;G1_`!!R.P0` +M!``P=&EC0@4D;VZ!`02N`/``5VEK:2!E>'!L86EN:6Y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EN:6UI>F4@P,1<#4`T6%T979EP"`,D*`2L`,VEN("#U%F:7)S=)("`*8!$6%P$A%O61$`]@`6+G0``]D# +M`J60!`,P``*,!!H`% +M,7=A;G\%$G0=#P-%`0!@```:!!!TC@0#`',*%EF-%#A)B!P`2>`<``$D!`)()`"<`#V0: +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______]?4'(@8FQO)!$``/%/8VMS('EO=2!H86YD(&ET+@H@("!9;W5R(')E +M860@8V%L;&)A8VL@:7,@9G)E92!T;R!P87-S('1H92!L:6)R87)Y(&$@8GET +M92!A="!A('1I;64*("`@;W(@;6UA<"@`\`!E;G1I7,@<')O +M9'5C97,@8V]R`,`@(&)S9'1A&%)`$!S.B!3,@-4`0-)`#!C;VY#`O`".B`@ +M5F%R:6]UP``7P%Q875T:&]R<\`%`1\&`?("`DT'$`H5"%!T;W`M;`P$`W8% +M`#`'`4$`$&GD!@FV`B)I;O@$(FEOX08$O0+P`DY%5U,@+2!H:6=H;&EG:'1S +M7`8P'2(`#!P=71>`C`@(F,T!A$B)`,`J@2!N965D?``Q;6%I]@$C97*N`05P`"1I;F0`@2YH+FEN"@DM]`=2;&%T97-G +M`!%B-`(#<@$"M0!@"@I'=6ED\P`H($14!@32`0)U``&W`7!S>7-T96TZIPH" +MN`1U+C$@97AP;(,"`R\#`$(!`B$`!)H#`S,``(@$#S0`"P`B``PU`"]A=#0` +M#"AA=#,`!@$&(2XSM@L0<]\&@&]V97)V:65W\P(`H``%G@L`<04P=VAOD0(4 +M*J0*A5]R96%D+C,L$``!^`@-$0!17V1I``'<`%0P#'`(%>`D09BP``;<&42H@1TY5=0$"-0(F("@$"P`:`$%L;VYG4`8` +MK0LB+``-J`0`9`]$J(%!/4TE8('5S=&%R6P`"$``/B@P# +M!R$`P&]C=&5T+6]R:65N=!<$,7!I;QX`IE-64C0@05-#24D4``)3``\R``5A +M0FEN87)Y+@#`("AB:6FEP/@$Q:6]N&`%= +M8GII<#(6``1\`4TO3%I7'0"B;'IM82P@;'IID2,',@*'T'`30$`(0!`S,$`/0#8"P@971C*>\+`OH#`*D"`&@1`HT` +M`88!`MH`#Y8#!0'(`V$B;F5W8R*;`P$S`"=S:+```1(`#T8#8P0%!`?.``]9 +M`P`*%@,S5VAE`P(`-0<#U`(2<^8%87)E`3AN97>U`P#P!`#]`@.?`0![``&'"0$K%0)*#`!-$2)IE(7`+4(`E(( +M07!O;&PV$@;D%$%D;VXG[`&097AP;&EC:71LV0EB=F]K92!A^@\18W\*`\X1 +M("`HTA``=0P('`(08;(!`2<0`BT`",T`%&]S!'`I+"!I="!W<`!0(&=E="#2 +M$@%="@"D!#<@26YN``4F%P&>``%1`0.;`")E;LD!!RT``'P`"W$`*&1E$0`# +MJ@`1+%@1`H```(T.`)8!`!8!`$``,&%G8?,/`5\*D6-O!<1<_```.X'#V0:________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________________]>4'1S(&%N3Q$``/`> +M9"!H86YD;&5S(&%N>2!O9B!T:&4@9F]L;&]W:6YG(&)E9F]R92!E=F%L=6%T +M$@``(`#Q#6%R8VAI=F4Z"B`@*B!U=65N8V]D960@9FEL97,4``$*`/$"('=I +M=&@@4E!-('=R87!P97(;`/$!9WII<"!C;VUPFUA+"!L>FEP+"!A;F0@>'HC```9-!0`]0<*5&AE(&QI +M8G)A"!I;G1E&-E<'0@9F]J`/$'("!E;G1R +M:65S('1H870@.`?$#;F%M +M97,L($%#3',L(&5T8RDND@"P3VQD($=.52!T87)=``2I``+*`/$$;V-T970M +M;W)I96YT960@8W!I;S4`ME-64C0@(FYE=V,B%0`G`'@G;71R964GNP!X25-/.38V,!,`6CT!X'-Y0`&EP#R`FES(&1EP`!S@`4=E@#$G.C`%0@;VYL>0H#0&UE;G2R +M``$>`P"F!`)G`S`@8F5``(!R96%D86)L9:(`07=R:70,`!!A#`$"!`$!1`0! +M.P!$96%C:"8"`98"$WE#`%!I;F1E<*H`(FYT?P`04<`L$DG +M=F4@871T96UPQ`/@=&\@;6EN:6UI>F4@2!I;G9O:V4@82!PZP`@=6PW!"!E +M85D"0"`HD`!RT`!^\%`(`!`ID!<"DL(&ET('=P`.`@9V5T +M('!U;&QE9"!I;J0$-R!);FX`-RP@:9X``5$!`YL`(F5NR0$'+0``?``+<0`H +M9&41``/&`A$L\``"@``B;F6.`@`6`0!``&)A9V%I;G-'`J!C;W)R97-P;VYD +M)P0(20`-6@`">P,Q:65SPP`!;P.A86QS;R!R961U8[D%,&4@`(&5N=FER;V[7`C%S('=N`@&@`A!MV`$3 +M6QE(&%P<')OR`,`R0@"^@#@=&\@:&%V92!M=6QT +M:7`E```A!1!V$@,`!04`N0A5(&]P96Z>`%`@(&)S9",'(75SO`$`/06#;B!I +M=',@(D#E`!(BO01&P`28D(``"P$`-$``#8!(71OFPDP9&%TUP!6=7)C +M93HN`0+("0#"`!)A[`(`R0H!*P`S:6X@)P$`3P@S861DC@(18?P(!*H!`'D& +M(6]U]P119FER0#`',*T"!S87ES+@I214%$346[!@?H!N$@ +M8G5N9&QE+@H*475E<_H"H#\@($ES8N9V]O9VQE+F-O;2]P+VH`$2\Z`"!S+VD``),``6<`47-U8FUI9P!P +M96YH86YC9;L``*8`!C@`@RP@<&QE87-E+```.P``!`,`2P7!1`GH@1` +M9W)A;18"F-%#A)B!P`2>`<``$D!`)()`"<`4"H@97AA20!`8$(&YDT`(Q9G5L+P(&10`0+T,*`84! +M$6&>"E%A8W0@H($',+!0$^`0!U```7`@#Y!`%Q``%Q"@B7```\"3-Y+C-- +M``#O!#)E(")K`P6K``$D`!0B"PM9(&-L87-$``$?"49N86QSG0`2!Q(M@@0U +M"`"X!!,B!0XR+F@BJ0`R +M:&4*7PP0(+`)`/H``!0`!.D&`W((`G\"$&T:%P/[`$(N("!0B@FS;&5T('5S +M"FMN;W>5$P`P%&!E\6`2T5`A``#XH,`P`""(&EN'!L86EN3`1!F+``0'1E;J`*%35E(T($%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.`0]M +M`0$`(`T!$!H!V@$T90HGL``C92>O&0,D!`"3``!.``]D&O______________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________5E`@("!T +M;SL1``#R-B!B92!R96%D(&]R('=R:71T96X@=&\@86YY(&1A=&$@7,N"E)%041-15``1"!L:6)M`=%B=6YD;&4N"@I1=65SK@"@/R`@27-S=65S +M/U(`UBH@:'1T<#HO+W=W=RXX`$`N;W)GDP``2`$Q:&]MIP"`(&]N9V]I;F8$(&YD +MT`(Q9G5L+P(&10!1+VUI;FF%`1%AXP%186-T('-@`+`@9&5M;VYS=')A=+\`!,GK0`#)`0`DP``3@#U`2YA;2P@86-L;V-A;"YM-"SA +M`$!E+F%C_P```@`0+:("`)\`!*@`#*($LBP@;VYL>2!N965D?``Q;6%I]@$C +M97*N`05P`"1I;F0`@2YH+FEN"@DM]`=2;&%T97-G`!%B-`(!9@$39;4`8`H* +M1W5I9/,`*"!$5`8$T@$"=0`!MP%P!1%E^P,`\@"`;6%T``&I`5"`"X!!,B?P(R+F@BJ0`R:&4*7PP0(+`)`'4!`!0`!.D&`W((`G\"-&UO +M2X`P"`H8FEG+65N9&EA;J(!8VQI='1L91$``OH`\0))4T\Y-C8P +M($-$+5)/32!I;;<"$"@X#C`@;W#+`\!A;"!2;V-K[`@0]`5HW+5II<"8` +MV$UI8W)OFEP/@$Q:6]N +M&`%=8GII<#(6``1\`4TO3%I7'0"B;'IM82P@;'II\+`OH#`*D" +M`&@1`HT``88!`MH`#Y8#!0'(`V$B;F5W8R*;`P$S`"=S:+```1(`#T8#8P0% +M!`?.``]9`P`*%@,S5VAE`P(`&@T#U`(2<^8%87)E`3AN97>U`P#P!`#]`@.?`0![ +M``&'"0&C``)*#`!-$2)I7-S""IE9(H(`D<`L$DG=F4@ +M871T96UPC```%1`0.;`")E;LD!!RT``'P`"W$`*&1E$0`#Q@(1+.4)`H```(T. +M`)8!`!8!`$``,&%G8?,/`5\*D6-O7L#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6]UP``7P%V875T:&]R,&`4D!A69I9W5R92`M#``"1`"U'2(`")P==8-(")C-`81 +M(B0#`#@,*6]L30`"5@$&ZP,!*0$`%@D`C@$/;0$!`*(&('5SW0H`V@$T90HG +ML``C92>M``,D!`"3``!.`/``+F%M+"!A8VQO8V%L+FTT"0T#[0`P+F%C%P$` +M`@`0+:("`)\`!*@``-D."*($$BP:#@#7"P)\`#%M86GV`2-EPH"MP(29:`,`!(&0'-E<77J"!!S"P4!/@$`=0``%P(` +M^00!<0`!<0H(EP``/`DS>2XS30``[P0R92`B:P,%JP`!)``4(@L+62!C;&%S +M1``!'PE&;F%L"`"X!!,B!0XR+F@BJ0`R:&4*7PP0(+`)`/H``!0`!.D&`W((`G\"-&UO +M5$P`P%&!E+``-J`0`9`[$J(%!/4TE8('5S=+`1!!``#XH,`P%\``(Q`%9O +M8W1E=*\4`&`"`1X`H5-64C0@05-#24ET`@$4``\R``L00FT1$7DN`+$@*&)I +M9RUE;F1I8=018VQI='1L91$``OH`!%\6D4-$+5)/32!I;;<"$"@X#C`@;W#+ +M`\!A;"!2;V-KC2H`0#E%PD(`0``"@*<$`5+`0!U!`\&`0("@P$#OP," +MO`(/'P,8,")R9:`-`!`6$2)'`P)/`,(L('=H:6-H('=I;&SK&`!P"`###P-? +M`4!S(&5X+10``@(`N04$B1$""Q<#6A4P`T&-P:6\N-2P@;71R964)``!O`%1T87(N-;<`PB!D +M971A:6QE9"!I;E(`D&EO;B!A8F]U=$T`('-EN`"#<&]P=6QA#0#46-H86YG?@$W +M;6%T(0"P;V-T970M;W)I96X!`P!@`@$>`*%35E(T($%30TE)=`(!%``"4P`/ +M,@`%84)I;F%R>2X`P"`H8FEG+65N9&EA;J(!8VQI='1L91$``OH`\0))4T\Y +M-C8P($-$+5)/32!I;;<"@"AW:71H(&]PRP/`86P@4F]C:W)I9&=E10!B2F]L +M:65T*0$![P$"20`T6DE05@,$0`#`=6YC;VUPB,``!DT%``)"`&58V%N(&-R96%TSP`!=00/!@$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 +M("T@:&EG:&QI9VAT<]P`,')E8]D4`C$%`Z`"DD-/4%E)3D<@+0P%`$(4`,H' +M(61O7P8!AP4`S@#`*B!)3E-404Q,("T@9`HQ86QLCP0!#0``BA8`OP`"*0`# +M0`41+3P``5X1`A@`8&-O;F9I9[(6%2T,``)$`+5S8W)I<'0L('-E96<``"@% +M`ED6`F,(@2H@0TUA:V5,U`0Q='ATB``A<'5G$#`@(F,T!A$B)`,`.`PI;VQ- +M``)6`0;K`P$I`0`6"0".`0]M`0$`(`T0=3T3`A`7)`HGL``C92>M``,D!`"3 +M``!.`/``+F%M+"!A8VQO8V%L+FTT"0T#[0`P+F%C_P```@`0+60"`)\`!*@` +M`-D."*($$BP:#@#7"P!9"Q!YR@4!]@$C97*N`05P`"1I;F0`@2YH+FEN"@DM +M]`<`YA,2\%#V0:____________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________]G4&%N(&ES-1$``/`02#R`I!I;VYS+@H*5&B=`?("<"UL979E;"!D:7)E8W1O'2(`#!P=71>`H$@(F-M86ME(B0#:60@ +M=&]O;$T``E8!!NL#`2D!,2!I;DP!#VT!`3!A2!N965D?``Q;6%I]@$C97)<`05P`"1I;F0`\@,N:"YI +M;@H)+2!T96UP;&%T97-G`!%B-`(!9@$39;4`8`H*1W5I9/,`4"!$;V-UF04" +M@0$`Q0$R86QL=0`!MP&R'!L@P(#+P,`0@$" +M(0`$F@,#,P``B`0/-``+`"(`##4`+V%T-``,*&%T,P`&`0:`+C,@9VEV97-X +M!H!O=F5R=FEE=_,"`*``!+L%$&%Q!3!W:&^1`B,J(,0&A5]R96%D+C,L$``` +MT04=91$`45]D:7-K%@`@;F30`0@^``,<``"9`!!V7P$"MP)P960@8V%L;!(& +M$'/4!D%N8V5SK0(`DP``=0`!1P`#0@9H92!!4$ESEP!S96YTP$2+8($ +M4W,N-2!D5@("KP``&0,`\@#$;6%T=&%R+C54`0CQ!$%A8F]U4P4@P`3+/('`(H!@6AA``%4!%#0#`ED'`W@"!R$`L&]C=&5T +M+6]R:65N`0,`8`(!'@"A4U92-"!!4T-)270"`10``E,`#S(`!6%":6YA`@@;W#+`\!A;"!2;V-KFEP/@$Q:6]N&`%=8GII<#(6 +M``1\`4TO3%I7'0"B;'IM82P@;'II`3AN97>U`P#P!`![``.?`0![``&'"0&C``)* +M#`!-$2)IF4@``%1`0.;`")E;LD!!RT``'P`"W$`*&1E$0`#Q@(1+/```H```(T.`)8! +M`!8!`$``,&%G82X.`?$)D6-OP,1<#4`T6%T979E$P$/`P$W%0%1`T!G:79E +MY@$A=&\B``5*``#C$R%C984`(4]ND`,;9<,``N0",G!R;SH!`84!46-T;'DM +MS`"2960@;W5T<'5T[P(`8`3Q`V]B:F5C="US='EL92!A<'!R;\@#`/D4`OH` +MT'1O(&AA=F4@;75L=&G#$P2I``(!!`"Y"%4@;W!E;IX`$R`5$`!J$``*`1%I +M(0AC:71S(")`/``2(KT$$7,P#@)C!098`&!I='-E;&93`5!R96%D+^8`8'1E +M;B!U@``S0*%82!S;V-K970^`TEW:7-HN@0! +M)@\#60\`7,N"B05 +M$6:X#01/&0.A&$0N"@I1$19`/R`@29X9(',_4@`1*@49=CHO+W=W=RXX`$`N +M;W)GDP``2`$0:+@"`%<`0V]N9V]8!Q<@3`<@(&18%B!O<#P%"!D1!+H1`:P( +M`3<,`'$``#H`(&YK-`$!P0`&7,@9&5T96-T960@875T;VUA +M=&EC86QL>4<`L$DG=F4@871T96UP(@#P(71O(&UI;FEM:7IE('-T871I8R!L +M:6YK('!O;&QU=&EO;BX@($EF('EO=2!D;VXG=*@``+8`\"1I8VET;'D@:6YV +M;VME(&$@<&%R=&EC=6QA!E('-O;64@=71I;&ET>3X`!8P``+$!\09P2!D8737`%9UP",B!O9BL`,VEN("X +M`0!V``*4`0```P&^``7+`0#3``.C`0:`!3%W86Z(`!!T-@0#-@(!6P,`'P$` +MN@!!9&ES:RP#`\0!N6-O;G9E;FEE;F-EP`$`B0`P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$#0%Y&0!"!1)O;`T&L`L/9!K_________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_________________________________________________V50=',Z"B`P +M$0``\0T@*B!'3E4@=&%R(&9O`*935E(T($%30TE)%``"8P`/,@`%84)I;F%R>2X`\P<@*&)I +M9RUE;F1I86X@;W(@;&ET=&QE$0`"^@#P'TE33SDV-C`@0T0M4D]-(&EM86=E +MFEP/@$Q:6]N1`!=8GII<#(6``1D`4TO3%I7'0"B +M;'IM82P@;'IID#`*4#`.<#]A)U2!S=')E86VU!>!S>7-T96TN("!4:&5R92P`D&YO(&1I +M-R86YD +M;VT@86-C97-S+GD`!I<`D&ES(&1EU +M`P"C!`![``'.`!!VFP0`-0<2$N("!)9B!Y;W4@ +M9&]N)^P!`+8`\0)I8VET;'D@:6YV;VME(&$@<.L`('5LO0B@96%T=7)E("AS +M=2\!&7,<`A!AZ0`'+0`$10<#(@("F0%P*2P@:70@=W``X"!G970@<'5L;&5D +M(&ENI`0W($EN;@`W+"!IG@`!40$#FP`B96[)`07L#$7`U`-%A=&5V97(@8FQO8VMS\```[@2X'<70@82!T:6U7`W%O8!(71O(@`%H0!A="!O;F-EA0`A3VZ0 +M`QMEPP`"Y`(R<')O.@$!A0%18W1L>2W,``"."5)U='!U=.\"`&`$\0-O8FIE +M8W0M2!B=69F97(@ +M)`@`90`$<@&%82!S;V-K970^`TEW:7-HN@3`P" +M`,D*`2L`,VEN(">D``,P``*,!!H`%,7=A;H@`$'0V!`5%`0!@```:!!!TC@7,N"E)%041-1;L&!^@&X2!B=6YD;&4N"@I1=65S^@*@ +M/R`@27-S=65S/U(`URH@:'1T<#HO+W=W=RX@!S!O3``!(`1!HN`*#9F]R +M(&]N9V]8!Q@@9`!P9&5V96QO<#P%)BP@8`]`9&]C=10``:P(`3<,`'$``#H` +M(6YK70$`70`&8N9V]O9VQE+F-O;2]P+VH` +M$2\Z`"!S+VD``),``6<`47-U8FUI9P!P96YH86YC9;L``#8"!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PD`:@@Q86)L``8`C`H!#``!+`L"!`$`:``".P!" +M96%C:#T!(79E4,`4&EN9&5PJ@`E;G0B`0`8"0`/#Q!C0@42;VP-!C4* +M5"!7:6MI4@PP:6YGR0`P:&]W40\!LP,79)8*`BH!(4]N/P@`]PP"8`8#`P$$ +MS0`!<`!`;'=A>48!`-T!*F5DB@@"1P!P22=V92!A="T-`(P'`,$/D&EN:6UI +M>F4@P,1<#4`T6%T979EP" +M`,D*`2L`,VEN("#U%F:7)S=)("`*8!$6%P +M$A%O61$`]@`6+G0``]D#`J60!`,P``*,!!H`%,7=A;G\%$G0=#P-%`0!@```:!!!TC@0# +M`',*%EF-%#A)B!P`2 +M>`<``$D!`)()`"<`!A\:,#H@4S(##V0:____________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________]J4'(@71E(&%T +M(&$@=&EM90H@("!O2UB;&]C:V5D(&]U='!U="X*"B`J(%1H92!O8FIE8W0M +M'1E;G-I;VZ*``,<```J`#!E;&93`5!R96%D+^8`EG1E;B!U2!B=69F97(@;W+!``!E``1R`3!A(',K`5%T+"!I9@(!8'=I +M2UT;RUU`@#1```V`:!T;R!A;GD@9&%TUP!6=7)C93HN`5%C`@&^``7+`0#3``.C`4,N("!)I`$A86Z(`!)T70`#10$`8``0 +M:84"86\@9&ES:RP#`\0!N6-O;G9E;FEE;F-EP`$`B0`P;6%K>0#1:7,@97-P +M96-I86QL>=`!`JH!\P].;W1E.B`B<&%X(&EN=&5R8VAA;F=E(&9O7,N"E)%041-12X``$0$!&T!T6)U;F1L92X*"E%U97/Z`J`_("!)0(1.FH`$B>7!1`G'@9`9W)A;18"\`9A(&9U +M;&PM9F5A='5R960@)W1A`<``$D!0'-U8V@G`%`J(&5X84D`0',Z(%,R +M`U1S;6%L;!4`!#X!`%(#(6%T(`8@;6'F!"!N9-`",69U;"\"!D4`42]M:6YI +MA0$18>,!46%C="!S8`"P(&1E;6]N0&";8"(FEN^`0B:6_A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@)8V%L=V%YD`!RT`!"T'`,T`%&^5"'`I+"!I="!W<`!Q(&=E="!P=9P-(&EN +MI`0W($EN;@`W+"!IG@`(FP`B96[)`02UV```S#`#W"!%IAP8` +MA`!P96YV:7)O;M<",7,@=Y`#`:`"$&W8`1-R6@,%,`(`6P`"?P`1>7L#$7`U +M`-%A=&5V97(@8FQO8VMS\```[@`A$)P`$`B0`P;6%K>0"0:7,@97-P96-I +M;@0!T`$"J@$`.@@P.B`BDPH!#A$)V@T3(KD"`-X.(F%NZ`(`I0<&-`H0+&,` +M0&1EF-%#A)B!P`2>`<``$D!`)()`"<`02H@ +M97@;$T!S.B!3,@-4'2( +M`"%P=6<0,"`B8S0&%"*\&3EO;VQ-``)6`08U`0"4``"P"@&.`0]M`0$`(`T! +M$!H!V@$T90HGL``C92>O&0,D!`"3``!.`(\N86TL(&%C;&0:____________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________________________]J4&%N +M>2!D,!$``/`<871A('-O=7)C93H@(%EO=2!C86X@8W)E871E"B`@(&$@8FQO +M8VL@;V8@9"L`\!YI;B!M96UO2!E87-Y+@H*("H@3F]T93H@(G!A +M>"!I;G1E'1E;F1E9#@!`B(` +M$"QC`$!D97-PWP!`=VAA=)8`\`,@;F%M92!S87ES+@I214%$3450`$0@;&EB +M;0'18G5N9&QE+@H*475E`<``$D!0'-U8V@G`%`J(&5X84D`0',Z(%,R`U1S +M;6%L;!4`!#X!`%(#(6%T?`0@;6'F!"!N9-`",69U;"\"!D4`42]M:6YIA0$1 +M8>,!46%C="!S8`"A(&1E;6]NM``,D +M!`"3``!.`/4!+F%M+"!A8VQO8V%L+FTT+.$`0&4N86/_```"`!`MH@(`GP`$ +MJ``,H@2R+"!O;FQY(&YE961\`#%M86GV`2-E7-T96TZ<`<"N`1U+C$@97AP;(,"`R\#`$(!`B$`!)H#`S,``(@$#S0` +M"P`B``PU`"]A=#0`#"AA=#,`!@$&@"XS(&=I=F5SWP:`;W9EP$2+8($-7,N-:H(`)X%$67[`P#R +M`(!M871S('-U<'\(!&,"!98!`$P```H"D"XU+"!M=')E90D``&\`7G1A`D09BP``;<& +M42H@1TY5=0$"-0(F("@$"P`:`$%L;VYG50(`K0LB+``-J +M`0`9`]$J(%!/4TE8('5S=&%R6P`"$``/B@P#!R$`P&]C=&5T+6]R:65N=!<$ +M,7!I;QX`IE-64C0@05-#24D4``)3``\R``5A0FEN87)Y+@#`("AB:6FEP,A8`!'P!32],6E<= +M`*)L>FUA+"!L>FEP$P,O>'HC```9-!0`"0@!```*`IP0!3H!`'4$#P8!`@*O +M`0._`P*\`@\?`Q@P(G)EH`U18W1E9")'`P)/`,,L('=H:6-H('=I;&PF$0)U +M`P:0`%%E>&-E<$`%`+D%`?P(-F5A;;4%`A$+ +M<"X@(%1H97(T$2`@;M82,7)E8S`1`]\(`),$02!I;BVW#X(@;6]D:69I8^4, +M\@%OP`!APD!HP`"2@P`31$B:7*"$1!I>0<# +M[A("#`(A(&(W"0","C%A8FP`!@","@$,``$L"P+4$`!H``([`$)E86-H/0$A +M=F5S`Q-Y0P!0:6YD97"J`"5N="(!`$0-``\/$&-"!1)O;`T&-0I4(%=I:VE2 +M#`,,$S!H;W?X``&S`Q!DK0$#V@`"*@$A3VX_"`#W#`)@!@#S#@!0!@/-``%P +M`%-L=V%Y'!L:6-I#16":6YV;VME(&'Z#Q%C +M?PH#SA$@("C2$"4@8?L*`*$!("!AL@$!)Q`"+0`(S0`4;W,$<"DL(&ET('=P +M`%`@9V5T(-(2`5T*`*0$-R!);FX`,BP@:8(5`9X``5$!`YL`(F5NR0$'+0`` +M?``+<0`H9&41``/&`A$LY0D"@```C0X`E@$`%@$`0``P86=A\P\!7PJ18V]R +M"(&5N=FER;VX/"Q%WD`,!H`(0;=@! +M$W):`P4P`@!;``)_`!%Y>P,1<#4`8F%T979E:89`@4.#V0:____________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________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=',@(D`\`!(BO0012!F +M0"0:7,@97-P +M96-I;@0!T`$"J@$`.@@P.B`BDPH!#A$)V@T3(KD"`-X.(F%NZ`(`I0<`$0," +M6@<0+&,`0&1E8N9V]O9VQE +M+F-O;2]P+VH`$2\Z`"!S+VD``),``6<`47-U8FUI9P!P96YH86YC9<\``*8` +M!C@`,BP@<-H0`BP``#L```0#`$L'`1<)X65S="!V:6$@1VET2'5BP@`"D`"A +M7!1`GD1(`\A$`%@)S82!F=6QL+98( +MF-%#A)B!P`2>`<``$D! +M`)()`"<`02H@97@;$T!S.B!3,@-4P``7P%C875T:&]R:1``EPT!\@(`P1,2+NT/ +M4'1O<"UL#`0#Q0P`,`0&";8""',5`.L%`>X/\`4@*B!.15=3("T@ +M:&EG:&QI9VAT<]P`,')E8]D4`C$%`Z`"DD-/4%E)3D<@+0P%`$(4`,H'(61O +M7P8!AP4`S@#`*B!)3E-404Q,("T@9`HQ86QLCP0!#0``BA8`OP`"*0`#0`41 +M+3P``5X1`A@`8&-O;F9I9[(6%2T,``)$`+5S8W)I<'0L('-E96<``"@%`ED6 +M`F,(@2H@0TUA:V5,U`0Q='ATB``A<'5G$#`@(F,T!A$B)`,`.`PI;VQ-``)6 +M`0;K`P$I`0`6"0".`0]M`0$`(`T0=3T3`A`7)`HGL``C92>M``,D!`"3``!. +M`/``+F%M+"!A8VQO8V%L+FTT"0T#[0`P+F%C_P```@`0+60"`)\`!*@``-D. +M"*($$BP:#@#7"P!9"Q!YR@4!]@$C97*N`05P`"1I;F0`@2YH+FEN"@DM]`<` +MYA,2\% +M1FYA;'.=`!)S/@M/:6YS:60:____________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________]J4&ME2!F;W(@:L`D'-A +M;64@9G5N8S`<``$D!0'-U8V@G`%`J(&5X84D`U',Z(%-O +M;64@6]U(&UA>2!F:6YD('5S969U;"\"!D4` +M42]M:6YIA0$18>,!46%C="!S8`"A(&1E;6]N2#R`I!I +M;VYS+@H*5&B=`?("<"UL979E;"!D:7)E8W1O%#36%K +M94QI\`!,GK0`#)`0`DP``3@#U`2YA +M;2P@86-L;V-A;"YM-"SA`$!E+F%C_P```@`2+50`)'1OJ``,H@2R+"!O;FQY +M(&YE961\`#%M86GV`2-E7-T96TZ"B`J(+@$=2XQ(&5X<&R#`@,O`P!"`0(A``2:`P,S``"(!`\T +M``L`(@`,-0`O870T``PH870S``8!!H`N,R!G:79E2XS30`"]P,2(FL#!:L``20`4"(@ +M=71II`59(&-L87-$``'O!49N86QSG0`P`D09BP``;<&42H@1TY5=0$"-0(B("BK"0"Y`0`:`$%L +M;VYG4`9B;F%M97,L$`!3;&EN:R`1``!C`%)S<&%R'1E;J+``-J`0`9`]$J(%!/4TE8 +M('5S=&%R6P`"$``R<&%X-`,"60<#>`('(0"P;V-T970M;W)I96X!`P!@`@$> +M`*%35E(T($%30TE)=`(!%``"4P`/,@`%84)I;F%R>2X`P"`H8FEG+65N9&EA +M;J(!8VQI='1L91$``OH`\0))4T\Y-C8P($-$+5)/32!I;;<"$2AX""!O<,L# +MP&%L(%)O8VMR:61G944`8DIO;&EE="D!`>\!`DD`-%I)4%8#!$``('5N,0LP +MFEP,A8`!'P!32],6E<=`*)L +M>FUA+"!L>FEP$P,O>'HC```9-!0`"0@!```*56-R96%TSP`!=00/!@$"`JH# +M`[\#`KP"#Q\#&#`B&-E<$`%`+D%!&D"42!T:&%T0PXQ:7)E40`!\P,!R@(@("@6!0$T +M!`"$`0,S!`#T`V`L(&5T8REF"@+Z`P"I`@8B!`&&`0+:``^6`P4!R`-A(FYE +M=V,BFP,!,P`GD#`*4#(71EVPAA.@H*("H@+1`0:2`*<&AE879I;'G\"#9E +M86VU!0(1"X`N("!4:&5R9;T/(VYOX@<`@@(#WP@`DP1!(&EN+;D``2<0`BT`",T`%&_Y +M"'`I+"!I="!W<`!!(&=E=!D3`5T*`*0$-R!);FX`-RP@:9X``5$!`YL`(F5N +MR0$'+0``?``+<0`H9&41``/&`A$L\``"@```C0X`E@$`%@$`0``@86<##A%T +M\0F18V]RP,B:67-#P%O`P/G"B!D=1D-`)\#$'.% +M`2-O9H@!`(X2$"UV```S#`#W"!%IM`\`A`!R96YV:7)O;@\+$7>0`P&@`A!M +MV`$3<3`<0-0&)A8VOR`S%F2W,`))E9"!O=71P=73O +M`@!@!/$#;V)J96-T+7-T>6QE(&%P<')OR`,`^10"^@#0=&\@:&%V92!M=6QT +M:<,3!*D``@$$`+D(52!O<&5NG@`3(!40`&H0``H!$6DA"&-I=',@(D`\`!(B +MO0012!F4X.``P1$2(A`0!:""`L(E`(H"P@8V%P86)I;&D2%`8#`07Q +M``+S#P$_#@CV!0&7`8`@:6YD:79I9&P.`]L(`(4``#H2`D(``*P+`-$``#8! +M(71OK`TP9&%TUP``!0X6.BX!`L@)`#T`$F'L`@#)"@$K`#-I;B`G`0!%!3-A +M9&2.`AAA]PP!J0H#'@]19FER41`.'1E;F0@ +M;&EB87)C:&EV92X*"B`J($]N(')E860L(&-O;7!R97-S:6]N(&%N9"!F;W)M +M870@87)E(&%L=V%Y2!A +M8V-E<#4`T6%T979E2W,`))E9"!O=71P=70&`>!4:&4@ +M;V)J96-T+7-T>1`"4'!P!E +M('-O;64@=71I;&ET>3X`!8P``0`"\05R;W9I9&4@96%S>2UT;RUU"!I;G1E0#\`)N86UE('-A>7,N"E)%041-12X`!^@&X2!B=6YD;&4N +M"@I1=65S^@*@/R`@27-S=65S/U(`URH@:'1T<#HO+W=W=RX@!S!O3``!( +M`1!HN`*P9F]R(&]N9V]I;FH&0&%N(&FW`!`L(00!_``!#P"A('1R86-K97(@8B!$!G +MF-A="P@8@<`$G@'``!)`0"2"0`G`%`J(&5X84D`0',Z +M(%,R`U1S;6%L;!4`!#X!`%(#(6%T'`@@;6'F!"!N9-`",69U;"\"!D4`$"]# +M"@&%`1%A!@E186-T('-@`+`@9&5M;VYS=')A=+'2(`")P=;H+(")C-`81(B0#`#@,*6]L30`"5@$&ZP,` +ME``!%@D`C@$/;0$!`&8(('5SW0H`V@$T90HGL``C92>M``-G`0"3``!.`/`` +M+F%M+"!A8VQO8V%L+FTT"0T#[0`P+F%C_P```@`0+:("`)\`!*@``&H+"*($ +M82P@;VYL>=<+`GP`,6UA:?8!(V5RK@$%<``D:6YD`($N:"YI;@H)+?0'4FQA +M=&5S9P`18C0"`W(!`K4`8`H*1W5I9/,`*"!$5`8$T@$"=0`!MP%PP`( +M2PE`:&%R9!8,`3`&!%L!`4<``(X!86UO9&5R;H\``.@!`+P'<"!V87)I86Y( +M"0":!3!M86[X"T%P86=E.```,0XD``$=`U=H+`#L'`2,)"=H1`,$",&5C=)D#$62V#P,<`@5X"1!F +M!A(!MP91*B!'3E5U`0(U`B8@*`0+`!H`(VQOO`4`K0LB+ +M``-J`0`9`[$J(%!/4TE8('5S=+`1!!``#XH,`P%\``(Q`+!O8W1E="UO\!`DD`-%I)4'4$!$``('5N +M,0L`[!,`UA!@"T4``("`+D%!(D1`FL4`$,.`-,3`%$``;$6`0`&@`0I:7-N%")B98@%`$`$`5X!.&YE=[4#`/`$`/T"`Y\! +M`'L``8<)`2L5`DH,`PH#`#@(`&\0%'3N$@(,`B$@8C<)`(P*`8\8`[@4`0P` +M$&$,`0+4$`!H``([`!%EG!8`/0$A=F5S`Q-Y0P!0:6YD97"J`"5N="(!`$0- +M`7D9`$(%$F]L#0:P"U0@5VEK:5(,`PP3,&AO=U$/`;,#$&2M`0/:``+W$P4T +M&`3\!`#S#@!0!@/-``%P``*`%P+$!0]D&O__________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________________________'E!U9&EN9RX1``#R!2!' +M3E4@;&]N9R!F:6QE;F%M97,L$`!3;&EN:R`1`*%A;F0@`*935E(T +M($%30TE)%``"8P`/,@`%84)I;F%R>2X`\P<@*&)I9RUE;F1I86X@;W(@;&ET +M=&QE$0`"^@#P'TE33SDV-C`@0T0M4D]-(&EM86=EFEP/@$Q:6]N1`!=8GII<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@;W#+`\!A;"!2;V-K[`@0]`5HW+5II<"8`V$UI +M8W)OFEP/@$@:6]/$WTJ +M(&)Z:7`R%@`$?`%-+TQ:5QT`HFQZ;6$L(&QZ:7`3`R]X>B,``!DT%``)"`$` +M``H"G!`%.@$`=00/!@$"`J\!`[\#`KP"#Q\#&#`BD6$W,*%P!5"`2`!"EIP`!APD!*Q4"2@P#"@,`.`@`W@`4=.X2`@P"(2!B +M-PD`C`H!CQ@#N!0!#``080P!`M00`&@``CL`$66<%@`]`2%V97,#$WE#`%!I +M;F1E<*H`)6YT(@$`1`U087)T:6-"!1)O;`T&L`M4(%=I:VE2#`,,$S!H;W=1 +M#P&S`Q!DK0$#V@`"]Q,%-!@$_`0`\PX`4`8#S0`!<``"@!<"Q`4/9!K_____ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_SI0;F<@;&DN$0``\SUN:R!N86UE'1E;F1E9"!T87(@9F]R;6%T("AI;F-L=61I;F<@04-, +M,P!A3VQD(%8W)P"!87)C:&EV97-+`+=03U-)6"!U"=M=')E92<]`5HW+5II<"8`V$UI8W)O2!A;'-O(&1E=&5C='--`&!H86YD +M;&4,`'!Y(&]F('1HW`'P!VQL;W=I;F<@8F5F;W)E(&5V86QU8702```@``,O +M`A$ZU`!@=75E;F-O<0(!CP(!%``!"@`1((,!HE)032!WFEP +M/@$Q:6]N,`!=8GII<#(6``1D`4TO3%I7'0"B;'IM82P@;'IIP`!S@`0 +M=IL$`-$&$G.C`%0@;VYL>0H#0&UE;G2R``$>`P"F!`(K`#`@8F5``'%R96%D +M86)L``9!=W)I=`P`$&$,`0($`0!H``([`$)E86-H/0$A=F5S`Q-Y0P!0:6YD +M97"J`")N='\`$'([!``$`#!T:6-"!21O;H$!!*X`\`!7:6MI(&5X<&QA:6YI +M;F>)`#!H;W?X``&S`Q!DE@4#+``"*@$A3VZJ`!PL`P$`!`0R;6%T<`!`;'=A +M>48!`-T!\@%E9"!A=71O;6%T:6-A;&QY1P"P22=V92!A='1E;7",!^!T;R!M +M:6YI;6EZ92!S="L`L"!L:6YK('!O;&QUN`'A+B`@268@>6]U(&1O;B?L`0"V +M`/$":6-I=&QY(&EN=F]K92!A('#K`"!U;%D(H&5A='5R92`HD`!RT`!$4'`R("`ID!<"DL(&ET('=P`.`@9V5T('!U;&QE9"!I;J0$-R!) +M;FX`-RP@:9X``5$!`YL`(F5NR0$'+0``?``+<0`H9&41``.J`!$L\``"@``B +M;F6.`@`6`0!``'%A9V%I;G-TSP&18V]RP,Q:65S +MPP`!;P,!;P=16QE +M(&%P<')OR`,`R0@"^@#@=&\@:&%V92!M=6QT:7`E``-3!`(!!`#\"E4@;W!E +M;IX`4"`@8G-D(P2!F)M96UO7,"!8P``0`"\05R;W9I +M9&4@96%S>2UT;RUU0#`',* +MT"!S87ES+@I214%$346[!@?H!N$@8G5N9&QE+@H*475E<_H"H#\@($ES7!1`GH@1`9W)A;18"&%)`$!S.B!3,@-4 +M`0-)`#!C;VY#`O`".B`@5F%R:6]UP``7P%Q875T:&]R<\`%`1\&`?("`-(1$B[M +M#U!T;W`M;`P$`\4,`#`'`4$`$&GD!@FV`B)I;M8$`*0*`.L%!+T"\`).15=3 +M("T@:&EG:&QI9VATPH"MP(`318A86R)!T!S97%UZ@@0=&%R+C54`0CQ!`4^$A%SU@TQ<&]PY0\# +MG`$$>P`(2PE`:&%R9!8,`3`&`J@!`X42`(X!86UO9&5R;H\``.@!`+P'<"!V +M87)I86Y("0`B##!M86[X"Q%PK1] +M!;!I;@IA(&YU;6)E"`"X!!,BXP`R+F@BJ0`R:&4*7PP0(+`)`/H``!0`!.D&`W((`G\" +M$&T:%P/[`$(N("!0B@FR;&5T('5S"FMN;W<0`0&9!F!E`D09@82`;<&`H<8!JH+"``:`/@5#"`6`1````4+#V0:________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________________________]H4"`J(&5X +M1!$``/$,86UP;&5S+VU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G5L+P(&10`/ +M9!K_________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_________V10=&EM90HH$0``\!0@("!O2UB;&]C:V5D(&]U +M='!U="X*"B`J(%1H92!O8FIE8W0M`@#1```V`:!T +M;R!A;GD@9&%TUP!6=7)C93HN`6!C`@&^``7+ +M`0#3``.C`4,N("!)I`$A86Z(`!)T70`!-@(!6P,`'P$`.P%!9&ES:RP#`\0! +MMF-O;G9E;FEE;F-E3`(P('1OB0`P;6%K>0#1:7,@97-P96-I86QL>=`!`JH! +M\P].;W1E.B`B<&%X(&EN=&5R8VAA;F=E(&9O7,N"E)%041-12X` +M1"!L:6)M`=%B=6YD;&4N"@I1=65S^@*@/R`@27-S=65S/U(`UBH@:'1T<#HO +M+W=W=RXX`$`N;W)GDP``:@00:+@"L&9O&%)`$!S.B!3,@-4`0-)`#!C;VY#`O`".B`@5F%R:6]U +MP``7P%Q875T:&]R<\`%`1\&`?("`DT'$`H5"%!T;W`M;`P$`W8%`#`'`4$` +M$&DD!0FV`B)I;O@$(FEOX08$O0+P`DY%5U,@+2!H:6=H;&EG:'1S7`8P'2(`#!P=71>`C`@(F,T!A$B)`,`J@2!N965D +M?``Q;6%I]@$C97*N`05P`"1I;F0`@2YH+FEN"@DM]`=2;&%T97-G`!%B-`(# +M<@$"M0!@"@I'=6ED\P`H($14!@32`0)U``#S`8`@PH"MP(A +M960N"P!;!!!SU`80;A$,`-8"`),``'4``!<"`/D$`7$``7$*")<``9P)(RXS +M30``[P0R92`B:P,%JP`!)``4(@L+62!C;&%S1``!'PE&;F%L=H+`#L'`2,)@&%U=&]M871I_P(0><$",&5C=)D#$60Y +M"0,<`@5X"1!F+``!MP91*B!'3E5U`0(U`B8@*`0+`!H`06QO;F=5`@"M"R)S +M+!````4+$R`1``!C`%)S<&%RB,``!DT%``)"`$```H" +MG!`%.@$`=00/!@$"`J\!`[\#`KP"#Q\#&#`BP`!APD!*Q4"2@P`31$B:7*"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B!P`2>`<``$D!`)()`"<`02H@97@;$T!S.B!3,@-4 +MO&0,D!`"3``!.`/``+F%M+"!A8VQO8V%L+FTT"0T#[0`P+F%C_P`` +M`@`0+60"`)\`!*@``-D."*($$BP:#@#7"P!9"P]D&O__________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________________________________55!E;6]R>341 +M``#P)B!A;F0@861D(&ET('1O(&$@=&%R(&%R8VAI=F4@=VET:&]U=`H@("!F +M:7)S="!W``-:``!V``!-`/($92!T:&4@9&%T82!D +M:7)E8W1L>8<`\01S;V-K970N("!)9B!Y;W4@=V%NB``2=%T`$B\]``!@`#!I +M97,S`%!D:7-K+$X`\`QR92!A2!E87-Y+@H*("H@3F]T93H@(G!A>"!I +M;G1E'1E;F1E9#@!`B(`$"QC +M`$!D97-PWP!`=VAA=)8`\`,@;F%M92!S87ES+@I214%$3450`$0@;&EB;0'1 +M8G5N9&QE+@H*475E6H`)V%T:0`K871H`&ES:6UP;&6U`$!T;V]L,P$`0``# +M`@!R>F-A="P@8@<`$G@'``!)`4!S=6-H)P!0*B!E>&%)`$!S.B!3,@-4P``7P%Q875T:&]R<\`%42!A;GD@\@(``050+@H*5&B=`3!P+6P, +M!`-V!3!O'2(`#!P=71>`C`@(F,T!A$B)`-I9"!T +M;V]L30`"5@$&ZP,`%`=!'!L@P(#+P,`0@$"(0`$F@,#,P``B`0/ +M-``+`"(`##4`+V%T-``,*&%T,P`&`0:`+C,@9VEV97/?!H!O=F5R=FEE=_," +M`*``!+L%$&%Q!3!W:&^1`A0J[`B%7W)E860N,RP0``&["`T1`%%?9&ES:Q8` +M`GX'`RH)`3X``QP``)D`$'9?`0*W`F%E9"!C86R)!Q!SU`9!;F-E2XS!`,!JP(2(FL#!:L``20`4"(@ +M=71II`59(&-L87-$``$?"49N86QSG0`P=H+`#L'`2,)@&%U=&]M871I_P(0><$",&5C=)D#$60Y"0,<`@5X"1!F +M+``!MP91*B!'3E5U`0(U`B8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O`+$@(&)S9'1A3X`!8P``0`"\05R +M;W9I9&4@96%S>2UT;RUUX`0!V``*4`0"A`P&3 +M``)/!R)L>8<``J,!!H`%,7=A;H@`$'0V!`5%`0!@`!!IA0(`C@%EB!$!G +M&%)`$!S +M.B!3,@-4`0-)`#!C;VY# +M`O`".B`@5F%R:6]UP``7P%V875T:&]R,& +M`4D!A69I9W5R92`M#``"1`"U'2(`")P==8-(")C-`81(B0#`#@,*6]L30`"5@$&ZP,!*0$` +M%@D`C@$/;0$!`*(&('5SW0H`V@$T90HGL``C92>M``,D!`"3``!.`/``+F%M +M+"!A8VQO8V%L+FTT"0T#[0`P+F%C%P$``@`0+:("`)\`!*@``-D."*($$BP: +M#@#7"P)\`#%M86GV`2-EPH"MP(29:`, +M`!(&0'-E<77J"!!S"P4!/@$`=0``%P(`^00!<0`!<0H(EP``/`DS>2XS30`` +M[P0R92`B:P,%JP`!)``4(@L+62!C;&%S1``!'PE&;F%L]!9!I;@IA(&YU;6+R#!=FD0<$.P'' +M"@I9;W4@2X`L2`H8FEG+65N9&EAU!%C;&ET=&QE$0`" +M^@#Q`DE33SDV-C`@0T0M4D]-(&EMMP(0*#@.,"!O<,L#P&%L(%)O8VMR:61G +M9>\!`DD`-%I)4'4$!$``('5N,0L`)18`UA!@C2H`0#E%PD(`0``"@*<$`4Z`0!U!`\&`0("KP$#OP,"O`(/'P,8,")R +M9:`-`!`6$2)'`P)/`,0L('=H:6-H('=I;&R*``%6``:0`"!E>"T4``("`+D% +M!(D1`@L7`UH7`5$`!>D2,',@*%,*`30$`(0!`S,$`/0#8"P@971C*>\+`OH# +M`*D"!C`0`9L!`MH`#\@#"F$B;F5W8R*;`P$S`"=S:+```1(`#T8#8P0%!`); +M`0&)``]9`P`*%@,S5VAE`P(`OP@#U`(2<^8%#V0:____________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________________]34')A=&EO2A$` +M`/,?;BX*("H@;&EB87)C:&EV92UF;W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NL#`2D!`!8)`(X! +M#VT!`0"B!A!U/1,"$!P`"-E)ZT``R0$`),``$X`\``N86TL(&%C;&]C +M86PN;30)#0/M`#`N86/_```"`!`MH@(`GP`$J```V0X(H@02+!H.`-<+`%D+ +M$'G*!0'V`2-E!Q(M +M6`D/9!K_____________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_____________U-0:7-T"B`O$0``\R,@("H@5&\@2!F;W(@ +M:L`D'-A;64@9G5N8S`<``$D!0'-U8V@G`%`J(&5X84D`U',Z(%-O;64@6]U(&UA>2!F:6YD('5S969U;"\"!D4`42]M:6YIA0$1 +M8>,!46%C="!S8`"A(&1E;6]N2#R`I!I;VYS+@H*5&B= +M`?("<"UL979E;"!D:7)E8W1O%#36%K94QI\`!,GK0`#)`0`DP``3@#U`2YA;2P@86-L;V-A +M;"YM-"SA`$!E+F%C_P```@`2+50`)'1OJ``,H@2R+"!O;FQY(&YE961\`#%M +M86GV`2-E7-T96TZ +M"B`J(+@$=2XQ(&5X<&R#`@,O`P!"`0(A``2:`P,S``"(!`\T``L`(@`,-0`O +M870T``PH870S``8!!H`N,R!G:79E2XS30`"]P,2(FL#!:L``20`4"(@=71II`59(&-L +M87-$``'O!49N86QSG0`P`D09BP``;<&42H@1TY5=0$"-0(B("BK"0"Y`0`:`$%L;VYG4`9B;F%M +M97,L$`!3;&EN:R`1``!C`%)S<&%R'1E +M;J+``-J`0`9`]$J(%!/4TE8('5S=&%R6P`" +M$``R<&%X-`,"60<#>`('(0"P;V-T970M;W)I96X!`P!@`@$>`*%35E(T($%3 +M0TE)=`(!%``"4P`/,@`%84)I;F%R>2X`P"`H8FEG+65N9&EA;J(!8VQI='1L +M91$``OH`\0))4T\Y-C8P($-$+5)/32!I;;<"$2AX""!O<,L#P&%L(%)O8VMR +M:61G944`8DIO;&EE="D!`>\!`DD`-%I)4%8#!$``('5N,0LPFEP,A8`!'P!32],6E<=`*)L>FUA+"!L>FEP +M$P,O>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$@8C<)`(P*`8\8 +M`[@4`0P`$&$,`0+4$`!H``([`!%EG!8`/0$A=F5S`Q-Y0P!0:6YD97"J`"5N +M="(!`$0-`7D9`$(%$F]L#0:P"U0@5VEK:5(,`PP3,&AO=U$/`;,#$&2M`0/: +M``+W$P4T&`3\!`#S#@!0!@/-``%P``*`%P+$!0]D&O__________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________________________________5E!L97,I"BP1 +M``#P)"`@*B!3;VQA +M`*935E(T($%30TE)%``"8P`/,@`%84)I;F%R>2X`\P<@*&)I9RUE;F1I86X@ +M;W(@;&ET=&QE$0`"QP#P'TE33SDV-C`@0T0M4D]-(&EM86=EFEP/@$Q:6]N1`!=8GII<#(6``1D`4TO3%I7'0"Q;'IM82P@ +M;'II<"S'`"]X>B,``!DT%``)"`&58V%N(&-R96%TSP!/&-E<'0"`D0*("`@:0+1('1H870@0`&EP"0:7,@9&5S:6=NH@9";R!B98@%`$`$`3`$ +M.&YE=[4#`-P#`'L``4,`4&EN9&5PJ@`B;G1_`!!R.P0`!``P=&EC0@4D;VZ!`02N +M`/``5VEK:2!E>'!L86EN:6YGB0`P:&]W^``!LP,09)8%`RP``BH!(4]NJ@`< +M+`,!``0$,FUA='``0&QW87E&`0#=`?(!960@875T;VUA=&EC86QL>4<`L$DG +M=F4@871T96UPC`?@=&\@;6EN:6UI>F4@2!I;G9O:V4@82!PZP`@=6Q9"*!E +M871UP,1<#4`T6%T979E`%`@(&)S9",'(75SO`$`/06#;B!I=',@(D#E +M`!(BO01&P`28D(``$X&`-$``#8!(71OFPDP9&%TUP!6=7)C93HN`0+( +M"0#"`!)A[`(`R0H!*P`S:6X@)P$`E0LS861DC@(88?<,`=<'(6]U]P119FER +M0"0:7,@97-P96-I +M;@0!T`$"J@$`.@@P.B`BDPH.V@T3(KD"(&QL/`$"Z`(`I0<`$0,"P040+&,` +M0&1E%EF-%#A)B +M!P`2>`<``$D!`)()`"<`4"H@97AA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2YH+FEN"@DM]`=2;&%T97-G`!%B +M-`(#<@$"M0!@"@I'=6ED\P`H($14!@32`0)U``#S`8`@PH" +MMP(A960N"P!;!!!SU`80;A$,`-8"`),``'4``!<"`/D$`7$``7$*")<``9P) +M(RXS30``[P0R92`B:P,%JP`!)``4(@L+62!C;&%S1``!'PE&;F%L]!9!I;@IA +M(&YU;6+R#!=FD0<#HP#7+@H*66]U('-H;W5L9*0+`$P`,6-O<'8&0&-O;6V> +M"`#.#1,BR0TR+F@BJ0`R:&4*7PP0(+`)`'4!`!0`!.D&`W((`G\"-&UO@,QBH@4U92-"!!4T-)210``E,`#S(`!6%" +M:6YA`@@;W#+`\!A;"!2;V-K[`@0]`5HW+5II<"8`V$UI +M8W)OFEP/@$Q:6]N&`%= +M8GII<#(6``1\`4TO3%I7'0"B;'IM82P@;'IIP`!APD!*Q4"2@P`31$B:7*"$1!I>0<#[A(" +M#`(A(&(W"0","C%A8FP`!@","@$,`!!A#`$"U!``:``".P!"96%C:#T!(79E +M4,`4&EN9&5PJ@`E;G0B`0!$#0`/#Q!C0@42;VP-!K`+5"!7:6MI4@P# +M#!,P:&]W40\!LP,09*T!`]H``O<3(4]N/P@`]PP"8`8`\PX`4`8#S0`!<``" +M@!<"Q`4J962*"`)'`'!))W9E(&%T(14`C`'!L:6-I=&S9"6)V;VME(&'Z#Q%C?PH#SA$@ +M("C2$`!U#`@<`A!AL@$!)Q`"+0`(S0`4;W,$<"DL(&ET('=P`%`@9V5T(-(2 +M`5T*`*0$-R!);FX`!287`9X``5$!`YL`(F5NR0$'+0``?``+<0`H9&41``.J +M`!$L6!$"@```C0X`E@$`%@$`0``P86=A\P\!7PJ18V]R7L#$7`U`&)A=&5V97)X%Q%S\```[@$P'Y +M%@*[&0"V`A!GQ!D0:2(3`2(`!4H``.,3#V0:________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________________](4'(*("`J-Q$``/T, +M(&=Z:7`@8V]M<')EFU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7,@=Y`#`:`"$&W8`1-R6@,%,`(`6P`"?P`1>7L#$7`U`-%A=&5V +M97(@8FQO8VMS\```[@@``8P2%82!S;V-K970^`TEW +M:7-HN@0!)@\#60\`4X.475S92`B(0$`6@@@+")0 +M"+$L(&-A<&%B:6QI=/8"!`,!!?$``O,/`;<$"/8%`9P"`,D*`2L`,VEN("#U%F:7)S=)("`*8! +M$6%P$A%O61$`]@`6+G0``]D#`J60!`,P``*,!!H`%,7=A;G\%$G0=#P$V`@%;`P$:!!!TC@0#`',*T2!S87ES+@I214%$3442!@9)$>$@8G5N9&QE+@H*475E<_H" +MH#\@($ES+%1`GD1(`\A$`%@)S82!F=6QL+98(F-%#A)B!P`2>`<``$D!`)()`"<`02H@ +M97@;$T!S.B!3,@-4O&0,D!`"3``!.`/``+F%M+"!A8VQO8V%L+FTT +M"0T#[0`P+F%C_P```@`0+60"`)\`!*@``-D."*($$BP:#@#7"P!9"Q!YR@4! +M]@$/9!K_____________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_____________V=08VAI=F4G$0``\#T@=VET:&]U=`H@("!F:7)S="!W2!F6]U('=A;H@`$G1=`!`OB@`196``,&EE +M7,N"E)%041-12X`1"!L:6(3 +M`=%B=6YD;&4N"@I1=65SK@"@/R`@27-S=65S/U(`UBH@:'1T<#HO+W=W=RXX +M`$`N;W)GDP``2`$Q:&]MIP"`(&]N9V]I;F`<``$D!0'-U8V@G`%`J(&5X84D`0',Z(%,R`U1S +M;6%L;!4`!#X!`%(#(6%T?`2`;6%Y(&9I;F30`C%F=6PO`@9%`%$O;6EN:84! +M$6'C`5%A8W0@2#R`@`!!5`N"@I4:)T!,'`M +M;`P$`W8%,&]R>3$%,'1A:20%";8"(FEN^`0Q:6]NZP4$O0+P"4Y%5U,@+2!H +M:6=H;&EG:'1S(&]F(')E8P8"`C$%`Z`"DD-/4%E)3D<@+0P%`,T%`"@&(F1O +MGP``AP4`S@#R!"H@24Y35$%,3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?L*`*$!("!AL@$!)Q`"+0`(S0`4;_D(<"DL(&ET +M('=P`$$@9V5T&1,!70H`I`0W($EN;@`R+"!I@A4!G@`!40$#FP`B96[)`0"(&5N=FER;VX/"Q%WD`,!H`(0 +M;=@!$W):`P4P`@!;``)_`!%Y>P,1<#4`T6%T979E:89`@4.%CHN`0+("0`]`!)A +M[`(!@`X`T1DS:6X@)P$`104U861D'`$`_`@$J@$`>08/9!K_____________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_____________________________________________________V502!O9B!T:&4@9F]L +M;&]W:6YG.@H@("H@=75E;F-O9&4-`/$!9WII<"!C;VUPFUA+"!L>FEP+"!A;F0@>'HC`,$*3F]T97,@ +M86)O=724`/`[;&EB2!A2!S=')E86TM;W)I96YT960@P`!S@`0=G(!4G)M871SHP#P`B!O;FQY(')E<75I4,`4&EN9&5PJ@`B;G1_`$%R92!A!`"4 +M=&EC;&5S(&]N@0$$K@#P`%=I:VD@97AP;&%I;FEN9\D`,&AO=_@``O4`!RP` +M`BH!(4]NJ@`<+`,!`',!,FUA='``0&QW87E&`0#=`?(!960@875T;VUA=&EC +M86QL>4<`L$DG=F4@871T96UPUP'@=&\@;6EN:6UI>F4@2!I;G9O:V4@82!P +MZP"`=6QA8`0U:``)[`S%I97/#``%O`[!A;'-O(')E9'5C99L" +M,&4@0"0:7,@97-P96-I;@0!T`$"J@$`.@CS`SH@(G!A +M>"!I;G1E7!1`GH@1`9W)A;18"`<``$D!`)()`"<`4"H@97AA20!`8$(&YDT`(Q9G5L+P(&10`0+T,*`84!$6$& +M"5%A8W0@`0-)`#!C;VY#`O`".B`@ +M5F%R:6]UP``7P%V875T:&]R,&`4D!A69I +M9W5R92`M#``"1`"U'2(`")P==8-(")C-`81(B0#`#@,*6]L30`"5@$&ZP,!*0$`%@D`C@$/ +M;0$!`*(&('5SW0H`V@$T90HGL``C92>M``,D!`"3``!.`/``+F%M+"!A8VQO +M8V%L+FTT"0T#[0`P+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*%@,/9!K_____________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________XE!E=&%I;%H1``#U'G,@=&AE +M(")S=')U8W0@87)C:&EV95]E;G1R>2(@=71I;&ET>2!C;&%SP#S"2P@:6YC;'5D:6YG +M(&AA``"/`/0:("=D;V,G +M(&1I2!I;@IA(&YU;6)E6]U(#\!8"X*"D-U\!`DD` +M-%I)4%8#!$``P'5N8V]M<')EB,``!DT%``) +M"`&58V%N(&-R96%TSP`!=00/!@$"`J\!`[\#`KP"#Q\#&,$B!S>7-T96TN("!4 +M:&5R92P`(VYOX@<`@@(#WP@`DP3R`B!I;BUP;&%C92!M;V1I9FECK0CS`F]R +M(')A;F1O;2!A8V-E0`&@`3R`FES(&1EP`#P`!APD!HP!4(&]N;'D*`P`X"`"R``$>`P"F +M!`(,`B$@8C<)<7)E861A8FP`!D%W48!`-T!*F5DB@@"1P"P22=V92!A='1E;7",!^!T;R!M:6YI +M;6EZ92!S=+4(`E((4'!O;&QU(@=1+B`@26;U"$!D;VXGU@7L#$7`U`-%A=&5V97(@8FQO8VMS\``` +M[@2X'<70@82!T:6U7`P!K"S%M87#X`C!E;G21!@/0`@%1`T!G:79EY@$A=&\B +M``6A`&%T(&]N8V6%`"%/;I`#&V7#``+D`C)P@``P0&%82!S;V-K970^`TEW:7-HN@0!)@\# +M60\`0#`',*T2!S87ES+@I214%$3442!@9)$>$@8G5N9&QE+@H*475E<_H" +MH#\@($ES8$(&YDT`(Q9G5L +M+P(&10`0+T,*`84!$6&>"C1A8W1[$W!D96UO;G-T.14@;F<^``"`!094`@-) +M`#!C;VY#`F$Z("!687+N$V!I=&5M$0(8 +M`&!C;VYF:6=^"Q4M#``"1`"UM`Q$SM@L`$!20(&]V97)V:65W\P(`JP`%P`L`<04P=VAOD0(4*J0* +MA5]R96%D+C,L$``!^`@-$0!17V1I2#R`I!I;VYS+@H*5&B=`?("<"UL979E;"!D:7)E8W1O'2(`#!P=71>`H$@(F-M86ME(B0#:60@ +M=&]O;$T``E8!!NL#`2D!,2!I;DP!#VT!`3!A2!N965D?``Q;6%I]@$C97)<`05P`"1I;F0`\@,N:"YI +M;@H)+2!T96UP;&%T97-G`!%B-`(!9@$39;4`8`H*1W5I9/,`4"!$;V-UF04" +M@0$`Q0$R86QL=0`!MP&R'!L@P(#+P,`0@$" +M(0`$F@,#,P``B`0/-``+`"(`##4`+V%T-``,*&%T,P`&`0:`+C,@9VEV97/? +M!H!O=F5R=FEE=_,"`*``!+L%$&%Q!3!W:&^1`B,J("X'A5]R96%D+C,L$``` +MT04=91$`45]D:7-K%@`@;F30`0@^``,<``"9`!!V7P$"MP)A960@8V%LB0<0 +M<]0&06YC97.M`@"3``!U``%'``-"!FAE($%027.7`'-E;G1R>2XS30`"]P,2 +M(FL#!:L``20`4"(@=71II`59(&-L87-$``'O!49N86QSG0`P] +M!;!I;@IA(&YU;6)E`D09BP``;<&42H@1TY5=0$"-0(B +M("BK"0"Y`0`:`$%L;VYG4`9B;F%M97,L$`!3;&EN:R`1``!C`%)S<&%R'1E;J+``-J +M`0`9`]$J(%!/4TE8('5S=&%R6P`"$``R<&%X-`,"60<#>`('(0#`;V-T970M +M;W)I96YT%P0@<&E^"<8J(%-64C0@05-#24D4``)3``\R``5A0FEN87)Y+@#` +M("AB:6B,``!DT%``)"`$```I58W)E873/ +M``%U!`\&`0("J@,#OP,"O`(/'P,8,")R9:`-46-T960B1P,"3P#$+"!W:&EC +M:"!W:6QLB@`!5@`%R@%A(&5X8V5P0`4`N04$:0)1('1H871##C%I\+`OH#`*D"!B($`88!`MH` +M#Y8#!0'(`V$B;F5W8R*;`P$S`"=S:+```1(`#T8#8P0%!`);`0&)``]9`P`* +M%@,S5VAE`P(`?`4#U`(2<^8%87)E`3AN97>U`P#P!`![``.?`0![``&'"0&C``)*#`!- +M$2)IF4@ +M``%1`0.;`")E;LD!!RT``'P`"W$`*&1E$0`#Q@(1+/```H```(T.`)8!`!8! +M`$``,&%G82X.`?$)D6-OP,1<#4`T6%T979E$P$/`P*A%0"V`A!GJA40:2(3 +M`2(`!4H``.,3(6-EA0`A3VZ0`QMEPP`"Y`(R<')O.@$!A0%18W1L>2W,`))E +M9"!O=71P=73O`@!@!/$#;V)J96-T+7-T>6QE(&%P<')OR`,`^10"^@!0=&\@ +M:&$Y%D!U;'1IPQ,$J0`"`00`N0A5(&]P96Z>`!,@%1``:A``"@$`/06#;B!I +M=',@(D`\`!(BO0012!F4X.``P1$2(A`0!:""`L(E`(H"P@8V%P86)I +M;&D2%`8#`07Q``+S#P$_#@CV!0&7`8`@:6YD:79I9&P.`]L(`(4``#H2`D(` +M`*P+`-$``#8!(71OK`TP9&%TUP``!0X6.BX!`L@)`#T`$F'L`@#)"@$K`#-I +M;B`G`0"/`C!A9&1T!`!,``CW#`&I"@,>#U%F:7)S=)("`*8!$6%P$A%O\0T` +M]@`6+G0``]D#`J#B)A;N@"`*4'!C0*$"QC`$!D97-PH@``;`0!Y`,`7,N"B05 +M$6:X#06Y&0*A&$0N"@I1$19`/R`@2:T9(',_4@`4*I491G=W=RXX`$`N;W)G +MDP``2`$0:+@"`%<`0V]N9V]8!Q<@3`<@(&18%B!O<#P%"!D1!+H1`:P(`3<, +M`'$``#H`'VYD&O______________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________:E!I=F4@92@1``#Q$6YT7,@9&5T96-T960@ +M875T;VUA=&EC86QL>4<`L$DG=F4@871T96UP(@#@=&\@;6EN:6UI>F4@6]U(&1O;B=TJ```M@#Q`FEC:71L +M>2!I;G9O:V4@82!PZP#P#G5L87(@9F5A='5R92`H``%1`0.;`%IE;F%B;)L``#X`"W$`*&1E$0`#J@`1 +M+/```H``(FYE)@$`%@$`0`!Q86=A:6YS=,\!V6-O8`0U: +M`)%L:6)R87)I97/#`/$"5&AI3X`!8P``+$!\09P"!I;G1E7,N"E)%041-12X`!^@& +MX2!B=6YD;&4N"@I1=65S^@*@/R`@27-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%`RP``BH!(4]N/P@<+`,!``0$,FUA='`` +M0&QW87E&`0#=`2IE9(H(`D<`L$DG=F4@871T96UPC`?@=&\@;6EN:6UI>F4@ +M2!I +M;G9O:V4@82!PZP`@=6R]"*!E871U``%1 +M`0.;`")E;LD!!RT``'P`"W$`*&1E$0`#J@`1+/```H``(FYEC@(`%@$`0`!Q +M86=A:6YS=,\!D6-OP,1<#4`T6%T979E`%`@(&)S9",' +M(75SO`$`/06#;B!I=',@(D#E`!(BO01&"2`L(E`(<"P@8V%P86)!``'V`@)F!A%E50(!\0!A92!!4$ES +MMP0(]@4!EP&Q(&EN9&EV:61U86QH!1%I0@@`>P`28D(``$X&`-$``#8!(71O +MFPDP9&%TUP!6=7)C93HN`0+("0#"`!)A[`(`R0H!*P`S:6X@)P$`E0LS861D +MC@(88?<,`=<'(6]U]P119FER0"0:7,@97-P96-I;@0!T`$"J@$`.@@P.B`BDPH.V@T3(KD"`-X. +M(F%NZ`(`I0<`$0,"P040+&,`0&1E%E +MF-%#A)B!P`2>`<``$D!`)()`"<`4"H@97AA20!`8$(&YDT`(Q9G5L+P(&10`0+T,* +M`84!$6&>"E%A8W0@'2(`")P==8-(")C-`81(B0#`#@,*6]L30`"5@$&ZP,!*0$` +M%@D`C@$/;0$!`+`,$'4]$P':`31E"B>P`"-E)ZT``#H/,"`J(),``$X`\``N +M86TL(&%C;&]C86PN;30)#0/M`#`N86/_```"`!`MH@(`GP`$J```V0X(H@02 +M+!H.`-<+`%D+$'G*!0'V`2-EH($',+!0$^`0!U```7`@#Y!`%Q``%Q"@B7```\ +M"3!Y+C/T%#!A:6SO!#)E(")K`P6K``$D`!0B"PM9(&-L87-$``$?"49N86QS +MG0`2!Q(M@@0U=H+`#L'`2,)#V0:________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________]I4'(*("`@/A$``!(@`0!R>F-A +M="P@8@<`$G@'`/0386YD('-U8V@*("`@*B!E>&%M<&QE'2( +M`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``#X`"W$` +M*&1E$0`#J@`1+/```H```(T.`)8!`!8!`$``(&%G`PX"4`.18V]R0`P&@`A!MV`$32X'<70@82!T:6U7 +M`W%O8!(71O(@`%2@!2="!O;F-\ +M$B)/;AP."\,``N0",G!R;SH!`84!46-T;'DMS`"2960@;W5T<'5T[P(`8`3Q +M`V]B:F5C="US='EL92!A<'!R;\@#`$,2`OH`X'1O(&AA=F4@;75L=&EP)0`` +M(040=A(#0')E86VY"%4@;W!E;IX`$R`5$`!J$``*`0`]!8-N(&ETP"`,D*`2L`,VEN +M("#U%F:7)S=)("`*8!$6%P$A%O61$`]@`6 +M+G0``]D#`J60!`,P` +M`*,!!H`%,7=A;G\%$G0=#P-%`0!@```:!!!TC@0#`',*%E7,@<')O9'5C97,@8V]R6QE(&%P<')O86-H(&%L;&]W^@#@=&\@:&%V92!M=6QT:7`E +M``.I`'%S=')E86USSP`U<&5NG@#S#2`@8G-D=&%R('5S97,@=&AI2!D8737`%9UP",B!O9BL`,VEN(""!I;G1E7,N"E)%041-12X``$0$!&T!T6)U;F1L92X*"E%U97/Z`J`_("!)!D!G`<``$D!0'-U8V@G`%`J(&5X84D`0',Z(%,R`U1S +M;6%L;!4`!#X!`%(#(6%T(`8@;6'F!"!N9-`",69U;"\"!D4`42]M:6YIA0$1 +M8>,!46%C="!S8`"P(&1E;6]N0&";8"(FEN^`0B:6_A!@2]`O`"3D574R`M(&AI9VAL:6=H +M='-M``,D!`"3``!.`/4! +M+F%M+"!A8VQO8V%L+FTT+.$`0&4N86/_```"`!`MH@(`GP`$J``,H@2R+"!O +M;FQY(&YE961\`#%M86GV`2-E7-T96TZ +MIPH"N`1U+C$@97AP;(,"`R\#`$(!`B$`!)H#`S,``(@$#S0`"P`B``PU`"]A +M=#0`#"AA=#,`!@$&(2XSM@L0<]\&@&]V97)V:65W\P(`H``%G@L`<04P=VAO +MD0(4*J0*A5]R96%D+C,L$``!^`@-$0!17V1I``'<`%0P#'`(%>`D09BP``;<&42H@1TY5=0$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"!A=71O;6%T:6-A;&QY1P"P22=V92!A='1E;7#$ +M`^!T;R!M:6YI;6EZ92!S="L`L"!L:6YK('!O;&QUN`'A+B`@268@>6]U(&1O +M;B?L`0"V`/$":6-I=&QY(&EN=F]K92!A('#K`"!U;#<$H&5A='5R92`HD`!RT`!^\%`(`!`ID!<"DL(&ET('=P`.`@9V5T('!U;&QE9"!I +M;J0$-R!);FX`-RP@:9X``5$!`YL`(F5NR0$'+0``?``+<0`H9&41``/&`A$L +M\``"@``B;F6.`@`6`0!``&)A9V%I;G-'`J!C;W)R97-P;VYD)P0(20`-6@`" +M>P,Q:65SPP`!;P,!;P=1P,1<#4`T6%T979E`%`@(&)S9",'(75SO`$`/06#;B!I=',@(D#E`!(BO01&"2`L(E`(<"P@8V%P86)!``'V +M`@)F!A%E50(!\0!A92!!4$ESMP0(]@4!EP&Q(&EN9&EV:61U86QH!1%IWP<` +M>P`28D(``"P$`-$``#8!(71OFPDP9&%TUP!6=7)C93HN`0+("0#"`!)A[`(` +MR0H!*P`S:6X@)P$`3P@S861DC@(18?P(!*H!`'D&(6]U]P119FER0#`',*T"!S87ES+@I214%$346[!@?H!N$@8G5N9&QE+@H*475E<_H" +MH#\@($ES8N9V]O9VQE+F-O +M;2]P+VH`$2\Z`"!S+VD``),``6<`47-U8FUI9P!P96YH86YC9;L``*8`!C@` +M@RP@<&QE87-E+```.P``!`,`2P7!1`GH@1`9W)A;18"F-%#A)B +M!P`2>`<``$D!`)()`"<`4"H@97AA20!`8$(&YDT`(Q9G5L+P(&10`0+T,*`84!$6&>"E%A8W0@'2(`")P==8- +M(")C-`81(B0#`#@,*6]L30`"5@$&ZP,!*0$`%@D`C@$/;0$!`+`,('5SW0H` +MV@$T90HGL``C92>M``-G`0"3``!.`/``+F%M+"!A8VQO8V%L+FTT"0T#[0`P +M+F%C%P$``@`0+:("`)\`!*@``-D."*($$BP:#@#7"P)\`#%M86GV`2-EPH"MP(`A1(A86R)!T!S97%UZ@@0!Q(M@@0U``&I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W(@U`P#P!`![``.?`0![``&'"0&C``)*#`,*`P`X +M"`"R``$>`P"F!`(,`B$@8C<)<7)E861A8FP`!@","@$,``$L"P($`0!H``([ +M`$)E86-H/0$A=F5S`Q-Y0P!0:6YD97"J`"5N="(!`!@)4&%R=&EC0@4D;VZ! +M`02N`$17:6MI4@PP:6YGR0`P:&]WFPP"I@<'E@H"*@$A3VX_"`#W#`)X!@$" +M"B-N9/@``8@)8V%L=V%YD`!RT`!"T' +M`,T`%&_Y"'`I+"!I="!W<`!Q(&=E="!P=9P-(&ENI`0W($EN;@`W+"!IG@`( +MFP`B96[)`02UV```S#`#W"!%IAP8`A`!P96YV:7)O;M<",7,@ +M=Y`#`:`"$&W8`1-R6@,%,`(`6P`"?P`1>7L#$7`U`-%A=&5V97(@8FQO8VMS +M\```[@@``S0*%82!S;V-K970^`TEW:7-HN@0!)@\# +M60\`4X.475S92`B(0$`6@@@+")0"+$L(&-A<&%B +M:6QI=/8"!`,!!?$``O,/`;<$"/8%`9P"`,D*`2L` +M,VEN("#U%F:7)S=)("`*8!$6%P$A%O61$` +M]@`6+G0``]D#`J60! +M`,P``*,!!H`%,7=A;G\%$G0=#P$V`@%;`P$:!!!TC@0#`',* +MT2!S87ES+@I214%$3442!@9)$>$@8G5N9&QE+@H*475E<_H"H#\@($ESF-%#A)B!P`2>`<``$D!`)()`"<`02H@97@;$T!S.B!3,@-4X/\`4@*B!.15=3("T@:&EG:&QI9VAT<]P`,')E8]D4`C$%`Z`" +MDD-/4%E)3D<@+0P%`$(4`,H'(F1OGP``AP4`S@"T*B!)3E-404Q,("V2&`&/ +M!`$-``#Y%@"_``(I``-`!1(M1!D`E0`"&``%=QDE("T,``)$``*W&54L('-E +M96<``"@%`JT7`F,(@2H@0TUA:V5,U`0Q='ATB``A<'5G$#`@(F,T!A0BO!DY +M;V]L30`"5@$&-0$`E```L`H!C@$/;0$!`*(&#V0:____________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________________]G4'1O(&%L+1$` +M`/`@;&]W(&EN9&EV:61U86P@96YT2!A;F0@861D(&ET3`#P!2!T87(@87)C +M:&EV92!W:71H;W5T00!19FER2!F:6QE+G0` +M0F%L8<`\01S;V-K970N("!)9B!Y;W4@=V%NB``2=%T`$B\]``,?`0`S`%!D +M:7-K+$X`\!!R92!A0#P*FES(&5S<&5C:6%L;'D@96%S>2X*"B`J($YO=&4Z(")P87@@:6YT97)C +M:&%N9V4@9F]R;6%T(B!I<^```#,``.(`<7AT96YD960X`0(B`!`L8P!`9&5S +M<-\`0'=H8726`/`#(&YA;64@F-A="P@8@<`$G@'``!)`4!S=6-H)P!0*B!E>&%)`$!S.B!3,@-4`0-)`#!C;VY#`O`".B`@5F%R +M:6]UP``7P%Q875T:&]R<\`%`1\&`?("``$%4"X*"E1HG0$P<"UL#`0#=@4` +M"08!00`0:20%";8"(FENU@0Q:6]NZP4$O0+P`DY%5U,@+2!H:6=H;&EG:'1S +M7`8PM``,D!`"3``!. +M`/4!+F%M+"!A8VQO8V%L+FTT+.$`0&4N86/_```"`!`MH@(`GP`$J``,H@2R +M+"!O;FQY(&YE961\`#%M86GV`2-E7-T +M96TZ<`<"N`1U+C$@97AP;(,"`R\#`$(!`B$`!)H#`S,``(@$#S0`"P`B``PU +M`"]A=#0`#"AA=#,`!@$&@"XS(&=I=F5SWP:`;W9EP$2+8($-7,N-:H(`)X%$67[`P#R`(!M871S +M('-U<'\(!&,"!98!`$P```H"D"XU+"!M=')E90D``&\`7G1A`D09BP``;<&42H@1TY5 +M=0$"-0(F("@$"P`:`$%L;VYG50(`K0LB+``-J`0`9`]$J +M(%!/4TE8('5S=&%R6P`"$``/B@P#!R$`P&]C=&5T+6]R:65N=!<$('!IZ`S& +M*B!35E(T($%30TE)%``"4P`/,@`%84)I;F%R>2X`P"`H8FEG+65N9&EA;J(! +M8VQI='1L91$``OH`\0))4T\Y-C8P($-$+5)/32!I;;<"$"@X#C`@;W#+`\!A +M;"!2;V-K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"`!O$!1T[A("#`(A(&(W"0","@&/&`.X%`$,`!!A#`$"U!`` +M:``".P`199P6`#T!(79E4,`4&EN9&5PJ@`E;G0B`0!$#0]D&O______ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M8U!A;F0@'1E;F1E +M9&0`!#-!0TPS`&%/;&0@5C2!O9K@"X&)E9F]R92!E=F%L=6%TI`(`V`(# +M+P("SP)@=75E;F-O<0(`M@("0P(!"@`1((,!HE)032!WFEP +M/@$Q:6]N!0%=8GII<#(6``1D`4TO3%I7'0"B;'IM82P@;'II0`&EP"0:7,@9&5S +M:6=NH@9";R!B98@%`$`$`3`$.&YE=[4#`*,$`'L``4,`4&EN9&5PJ@`B;G1_`!!R.P0` +M!``P=&EC0@4D;VZ!`02N`/``5VEK:2!E>'!L86EN:6YGB0`P:&]W^``!LP,0 +M9)8%`RP``BH!(4]NJ@`<+`,!``0$,FUA='``0&QW87E&`0#=`6!E9"!A=71> +M"&)I8V%L;'E'`+!))W9E(&%T=&5M<(P'X'1O(&UI;FEM:7IE('-T*P`"4@A0 +M<&]L;'6X`>$N("!)9B!Y;W4@9&]N)^P!`+8`\0)I8VET;'D@:6YV;VME(&$@ +M<.L`('5LO0B@96%T=7)E("AS=2\!&7,<`A!AZ0`'+0`$10<#(@("F0%P*2P@ +M:70@=W``X"!G970@<'5L;&5D(&ENI`0W($EN;@`W+"!IG@`!40$#FP`B96[) +M`07L#$7`U`-%A=&5V97(@8FQO8VMS\``` +M[@2X'<70@82!T:6U7`W%O8!(71O +M(@`%H0!A="!O;F-EA0`A3VZ0`QMEPP`"Y`(R<')O.@$!A0%18W1L>2W,``". +M"5)U='!U=.\"`&`$\0-O8FIE8W0M2!B=69F97(@)`@`90`$<@&%82!S;V-K970^`TEW:7-HN@3` +MP"`,D*`2L`,VEN(">D``,P``*,!!H`%,7=A;H@`$'0V +M!`5%`0!@```:!!!TC@7,N"E)%041-1;L&!^@& +MX2!B=6YD;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8#!$``('5N3@DPFEP/@$Q:6]N&`%=8GII<#(6``1\`4TO3%I7'0"B;'IM82P@;'II?P(-F5A;;4%`A$+@"X@(%1H97)E +M+``C;F_B!P""`@/?"`"3!/("(&EN+7!L86-E(&UO9&EF:6-D"_``;W(@0`&@`23:7,@9&5S:6=N)0P298@%`$`$`;,%.&YE=[4# +M`/`$`'L``Y\!`'L``8<)`:,``DH,`PH#`#@(`+(`,71H82\)`RL`(2!B-PD` +M:@@Q86)L``8`C`H!#``!+`L"!`$`:``".P!"96%C:#T!(79E4,`4&EN +M9&5PJ@`E;G0B`0`8"0`/#Q!C0@42;VP-!C4*5"!7:6MI4@PP:6YGR0`P:&]W +M40\!LP,79)8*`BH!(4]N/P@`]PP"8`8#`P$$S0`!<`!`;'=A>48!`-T!*F5D +MB@@"1P!P22=V92!A="T-`(P'`,$/D&EN:6UI>F4@P,1<#4`T6%T979EP"`,D*`2L`,VEN("#U%F:7)S=)("`*8!$6%P$A%O61$`]@`6+G0``]D# +M`J60!`,P``*,!!H`% +M,7=A;G\%$G0=#P-%`0!@```:!!!TC@0#`',*%EF-%#A)B!P`2>`<``$D!`)()`"<`#V0: +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______]?4'(@8FQO)!$``/%/8VMS('EO=2!H86YD(&ET+@H@("!9;W5R(')E +M860@8V%L;&)A8VL@:7,@9G)E92!T;R!P87-S('1H92!L:6)R87)Y(&$@8GET +M92!A="!A('1I;64*("`@;W(@;6UA<"@`\`!E;G1I7,@<')O +M9'5C97,@8V]R`,`@(&)S9'1A&%)`$!S.B!3,@-4`0-)`#!C;VY#`O`".B`@ +M5F%R:6]UP``7P%Q875T:&]R<\`%`1\&`?("`DT'$`H5"%!T;W`M;`P$`W8% +M`#`'`4$`$&GD!@FV`B)I;O@$(FEOX08$O0+P`DY%5U,@+2!H:6=H;&EG:'1S +M7`8P'2(`#!P=71>`C`@(F,T!A$B)`,`J@2!N965D?``Q;6%I]@$C97*N`05P`"1I;F0`@2YH+FEN"@DM]`=2;&%T97-G +M`!%B-`(#<@$"M0!@"@I'=6ED\P`H($14!@32`0)U``&W`7!S>7-T96TZIPH" +MN`1U+C$@97AP;(,"`R\#`$(!`B$`!)H#`S,``(@$#S0`"P`B``PU`"]A=#0` +M#"AA=#,`!@$&(2XSM@L0<]\&@&]V97)V:65W\P(`H``%G@L`<04P=VAOD0(4 +M*J0*A5]R96%D+C,L$``!^`@-$0!17V1I``'<`%0P#'`(%>`D09BP``;<&42H@1TY5=0$"-0(F("@$"P`:`$%L;VYG4`8` +MK0LB+``-J`0`9`]$J(%!/4TE8('5S=&%R6P`"$``/B@P# +M!R$`P&]C=&5T+6]R:65N=!<$,7!I;QX`IE-64C0@05-#24D4``)3``\R``5A +M0FEN87)Y+@#`("AB:6FEP/@$Q:6]N&`%= +M8GII<#(6``1\`4TO3%I7'0"B;'IM82P@;'IID2,',@*'T'`30$`(0!`S,$`/0#8"P@971C*>\+`OH#`*D"`&@1`HT` +M`88!`MH`#Y8#!0'(`V$B;F5W8R*;`P$S`"=S:+```1(`#T8#8P0%!`?.``]9 +M`P`*%@,S5VAE`P(`-0<#U`(2<^8%87)E`3AN97>U`P#P!`#]`@.?`0![``&'"0$K%0)*#`!-$2)IE(7`+4(`E(( +M07!O;&PV$@;D%$%D;VXG[`&097AP;&EC:71LV0EB=F]K92!A^@\18W\*`\X1 +M("`HTA``=0P('`(08;(!`2<0`BT`",T`%&]S!'`I+"!I="!W<`!0(&=E="#2 +M$@%="@"D!#<@26YN``4F%P&>``%1`0.;`")E;LD!!RT``'P`"W$`*&1E$0`# +MJ@`1+%@1`H```(T.`)8!`!8!`$``,&%G8?,/`5\*D6-O!<1<_```.X'#V0:________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________________]>4'1S(&%N3Q$``/`> +M9"!H86YD;&5S(&%N>2!O9B!T:&4@9F]L;&]W:6YG(&)E9F]R92!E=F%L=6%T +M$@``(`#Q#6%R8VAI=F4Z"B`@*B!U=65N8V]D960@9FEL97,4``$*`/$"('=I +M=&@@4E!-('=R87!P97(;`/$!9WII<"!C;VUPFUA+"!L>FEP+"!A;F0@>'HC```9-!0`]0<*5&AE(&QI +M8G)A"!I;G1E&-E<'0@9F]J`/$'("!E;G1R +M:65S('1H870@.`?$#;F%M +M97,L($%#3',L(&5T8RDND@"P3VQD($=.52!T87)=``2I``+*`/$$;V-T970M +M;W)I96YT960@8W!I;S4`ME-64C0@(FYE=V,B%0`G`'@G;71R964GNP!X25-/.38V,!,`6CT!X'-Y0`&EP#R`FES(&1EP`!S@`4=E@#$G.C`%0@;VYL>0H#0&UE;G2R +M``$>`P"F!`)G`S`@8F5``(!R96%D86)L9:(`07=R:70,`!!A#`$"!`$!1`0! +M.P!$96%C:"8"`98"$WE#`%!I;F1E<*H`(FYT?P`04<`L$DG +M=F4@871T96UPQ`/@=&\@;6EN:6UI>F4@2!I;G9O:V4@82!PZP`@=6PW!"!E +M85D"0"`HD`!RT`!^\%`(`!`ID!<"DL(&ET('=P`.`@9V5T +M('!U;&QE9"!I;J0$-R!);FX`-RP@:9X``5$!`YL`(F5NR0$'+0``?``+<0`H +M9&41``/&`A$L\``"@``B;F6.`@`6`0!``&)A9V%I;G-'`J!C;W)R97-P;VYD +M)P0(20`-6@`">P,Q:65SPP`!;P.A86QS;R!R961U8[D%,&4@`(&5N=FER;V[7`C%S('=N`@&@`A!MV`$3 +M6QE(&%P<')OR`,`R0@"^@#@=&\@:&%V92!M=6QT +M:7`E```A!1!V$@,`!04`N0A5(&]P96Z>`%`@(&)S9",'(75SO`$`/06#;B!I +M=',@(D#E`!(BO01&P`28D(``"P$`-$``#8!(71OFPDP9&%TUP!6=7)C +M93HN`0+("0#"`!)A[`(`R0H!*P`S:6X@)P$`3P@S861DC@(18?P(!*H!`'D& +M(6]U]P119FER0#`',*T"!S87ES+@I214%$346[!@?H!N$@ +M8G5N9&QE+@H*475E<_H"H#\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:6YGR0`P:&]WFPP" +MI@<'E@H"*@$A3VX_"`#W#`)X!@$""B-N9/@``8@)8V%L=V%YD`!RT`!"T'`,T`%&^5"'`I+"!I="!W<`!Q(&=E="!P +M=9P-(&ENI`0W($EN;@`W+"!IG@`(FP`B96[)`02UV```S#`#W +M"!%IAP8`A`!P96YV:7)O;M<",7,@=Y`#`:`"$&W8`1-R6@,%,`(`6P`"?P`1 +M>7L#$7`U`-%A=&5V97(@8FQO8VMS\```[@`A$)P`$`B0`P;6%K>0"0:7,@ +M97-P96-I;@0!T`$"J@$`.@@P.B`BDPH!#A$)V@T3(KD"`-X.(F%NZ`(`I0<& +M-`H0+&,`0&1EF-%#A)B!P`2>`<``$D!`)() +M`"<`02H@97@;$T!S.B!3,@-4'2(`"%P=6<0,"`B8S0&%"*\&3EO;VQ-``)6`08U`0"4``"P"@&.`0]M +M`0$`(`T!$!H!V@$T90HGL``C92>O&0,D!`"3``!.``]D&O______________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________5E`@("!T +M;SL1``#R-B!B92!R96%D(&]R('=R:71T96X@=&\@86YY(&1A=&$@7,N"E)%041-15``1"!L:6)M`=%B=6YD;&4N"@I1=65SK@"@/R`@27-S=65S +M/U(`UBH@:'1T<#HO+W=W=RXX`$`N;W)GDP``2`$Q:&]MIP"`(&]N9V]I;F8$(&YD +MT`(Q9G5L+P(&10!1+VUI;FF%`1%AXP%186-T('-@`+`@9&5M;VYS=')A=+\`!,GK0`#)`0`DP``3@#U`2YA;2P@86-L;V-A;"YM-"SA +M`$!E+F%C_P```@`0+:("`)\`!*@`#*($LBP@;VYL>2!N965D?``Q;6%I]@$C +M97*N`05P`"1I;F0`@2YH+FEN"@DM]`=2;&%T97-G`!%B-`(!9@$39;4`8`H* +M1W5I9/,`*"!$5`8$T@$"=0`!MP%P!1%E^P,`\@"`;6%T``&I`5"`"X!!,B?P(R+F@BJ0`R:&4*7PP0(+`)`'4!`!0`!.D&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`0!U!`\&`0("@P$#OP," +MO`(/'P,8,")R9:`-`!`6$2)'`P)/`,(L('=H:6-H('=I;&SK&`!P"`###P-? +M`4!S(&5X+10``@(`N04$B1$""Q<#6A4P`T&-P:6\N-2P@;71R964)``!O`%1T87(N-;<`PB!D +M971A:6QE9"!I;E(`D&EO;B!A8F]U=$T`('-EN`"#<&]P=6QA#0#46-H86YG?@$W +M;6%T(0"P;V-T970M;W)I96X!`P!@`@$>`*%35E(T($%30TE)=`(!%``"4P`/ +M,@`%84)I;F%R>2X`P"`H8FEG+65N9&EA;J(!8VQI='1L91$``OH`\0))4T\Y +M-C8P($-$+5)/32!I;;<"@"AW:71H(&]PRP/`86P@4F]C:W)I9&=E10!B2F]L +M:65T*0$![P$"20`T6DE05@,$0`#`=6YC;VUPB,``!DT%``)"`&58V%N(&-R96%TSP`!=00/!@$"`J\!`[\#`KP"#Q\# +M&,$B!S>7-T96TN("!4:&5R92P`(VYOX@<`@@(#WP@`DP3R`B!I;BUP;&%C92!M +M;V1I9FECK0CS`F]R(')A;F1O;2!A8V-E0`&@`3R`FES(&1EP`#P`!APD!HP!4(&]N;'D* +M`P`X"`"R``$>`P"F!`(,`B$@8C<)<7)E861A8FP`!D%W48!`-T!*F5DB@@"1P"P22=V92!A='1E +M;7",!^!T;R!M:6YI;6EZ92!S=+4(`E((4'!O;&QU(@=1+B`@26;U"$!D;VXG +MU@7L#$7`U`-%A=&5V +M97(@8FQO8VMS\```[@2X'<70@82!T:6U7`P!K"S%M87#X`C!E;G21!@/0`@%1 +M`T!G:79EY@$A=&\B``6A`&%T(&]N8V6%`"%/;I`#&V7#``+D`C)P@``P0&%82!S;V-K970^ +M`TEW:7-HN@0!)@]P=71I;&ET>7,"!8P``#\``TP/4"!E87-Y3@Y1=7-E("(A +M`0!:""`L(E`(<"P@8V%P86)!``'V`@0#`07Q`&%E($%027.W!`CV!0&7`8`@ +M:6YD:79I9&P.`]L(`(4``A4&`$(``'(+`-$``#8!(71OK`TP9&%TUP``!0X6 +M.BX!`L@)`#T`$F'L`@#)"@$K`#-I;B`G`0"5"S-A9&2.`AAA]PP!UP<#'@]1 +M9FER0"0:7,@ +M97-P96-I;@0!T`$"J@$`.@@P.B`BDPH!#A$)V@T3(KD"`-X.(F%NZ`(`I0<` +M$0,"6@<0+&,`0&1E8N9V]O +M9VQE+F-O;2]P+VH`$2\Z`"!S+VD``),``6<`47-U8FUI9P!P96YH86YC9<\` +M`*8`!C@`,BP@<-H0`BP``#L```0#`$L'`1<)X65S="!V:6$@1VET2'5BP@`" +MD`"A7!1`GD1(`\A$`%@)S82!F=6QL +M+98(F-%#A)B!P`2>`<` +M`$D!`)()`"<`02H@97@;$T!S.B!3,@-4P``7P%C875T:&]R:1``EPT!\@(`P1,2 +M+NT/4'1O<"UL#`0#Q0P`,`0&";8""',5`.L%`>X/\`4@*B!.15=3 +M("T@:&EG:&QI9VAT<]P`,')E8]D4`C$%`Z`"DD-/4%E)3D<@+0P%`$(4`,H' +M(61O7P8!AP4`S@#`*B!)3E-404Q,("T@9`HQ86QLCP0!#0``BA8`OP`"*0`# +M0`41+3P``5X1`A@`8&-O;F9I9[(6%2T,``)$`+5S8W)I<'0L('-E96<``"@% +M`ED6`F,(@2H@0TUA:V5,U`0Q='ATB``A<'5G$#`@(F,T!A$B)`,`.`PI;VQ- +M``)6`0;K`P$I`0`6"0".`0]M`0$`(`T0=3T3`A`7)`HGL``C92>M``,D!`"3 +M``!.`/``+F%M+"!A8VQO8V%L+FTT"0T#[0`P+F%C_P```@`0+60"`)\`!*@` +M`-D."*($$BP:#@#7"P!9"Q!YR@4!]@$C97*N`05P`"1I;F0`@2YH+FEN"@DM +M]`<`YA,2\%#V0:____________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________]G4&%N(&ES-1$``/`02#R`I!I;VYS+@H*5&B=`?("<"UL979E;"!D:7)E8W1O'2(`#!P=71>`H$@(F-M86ME(B0#:60@ +M=&]O;$T``E8!!NL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%30TE)=`(!%``/,@`+ +M$$)M$1%Y+@"Q("AB:6`@@;W#+`\!A;"!2;V-K[`@0]`5HW+5II<"8`V$UI +M8W)OFEP/@$@:6]/$WTJ +M(&)Z:7`R%@`$?`%-+TQ:5QT`HFQZ;6$L(&QZ:7`3`R]X>B,``!DT%``)"`$` +M``H"G!`%.@$`=00/!@$"`J\!`[\#`KP"#Q\#&#`B\+`OH#`*D"`&@1`HT` +M`9L!`MH`#\@#"F$B;F5W8R*;`P$S`"=S:+```1(`#T8#8P0%!`?.``]9`P`* +M%@,S5VAE`P(`OP@#U`(2<^8%87)E +M`3AN97>U`P#P!`#]`@.?`0![``&'"0$K%0)*#`,*`P`X"`!O$!1T[A("#`(A +M(&(W"0","@&/&`.X%`$,`!!A#`$"U!``:``".P`199P6`#T!(79E4,` +M4&EN9&5PJ@`E;G0B`0!$#0%Y&0!"!1)O;`T&L`L/9!K_________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_________________________________________________V50=',Z"B`P +M$0``\0T@*B!'3E4@=&%R(&9O`*935E(T($%30TE)%``"8P`/,@`%84)I;F%R>2X`\P<@*&)I +M9RUE;F1I86X@;W(@;&ET=&QE$0`"^@#P'TE33SDV-C`@0T0M4D]-(&EM86=E +MFEP/@$Q:6]N1`!=8GII<#(6``1D`4TO3%I7'0"B +M;'IM82P@;'IID#`*4#`.<#]A)U2!S=')E86VU!>!S>7-T96TN("!4:&5R92P`D&YO(&1I +M-R86YD +M;VT@86-C97-S+GD`!I<`D&ES(&1EU +M`P"C!`![``'.`!!VFP0`-0<2$N("!)9B!Y;W4@ +M9&]N)^P!`+8`\0)I8VET;'D@:6YV;VME(&$@<.L`('5LO0B@96%T=7)E("AS +M=2\!&7,<`A!AZ0`'+0`$10<#(@("F0%P*2P@:70@=W``X"!G970@<'5L;&5D +M(&ENI`0W($EN;@`W+"!IG@`!40$#FP`B96[)`07L#$7`U`-%A=&5V97(@8FQO8VMS\```[@2X'<70@82!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E$D#(F5R60<#>`('(0"P;V-T970M;W)I96X! +M`P!@`@$>`*%35E(T($%30TE)=`(!%``"4P`/,@`%,$)I;LH$`$(`H"`H8FEG +M+65N9&GS!(-R(&QI='1L91$``OH`\0))4T\Y-C8P($-$+5)/32!I;;<"$2AX +M""!O<,L#P&%L(%)O8VMR:61G944`8DIO;&EE="D!`>\!`DD`-%I)4%8#!$`` +M('5N3@DPFEP/@$Q:6]N&`%=8GII<#(6``1\`4TO +M3%I7'0"B;'IM82P@;'II?P( +M-F5A;;4%`A$+@"X@(%1H97)E+``C;F_B!P""`@/?"`"3!/("(&EN+7!L86-E +M(&UO9&EF:6-D"_``;W(@0`&@`23:7,@9&5S:6=N +M)0P298@%`$`$`;,%.&YE=[4#`/`$`'L``Y\!`'L``8<)`:,``DH,`PH#`#@( +M`+(`,71H82\)`RL`(2!B-PD`:@@Q86)L``8`C`H!#``!+`L"!`$`:``".P!" +M96%C:#T!(79E4,`4&EN9&5PJ@`E;G0B`0`8"0`/#Q!C0@42;VP-!C4* +M5"!7:6MI4@PP:6YGR0`P:&]W40\!LP,79)8*`BH!(4]N/P@`]PP"8`8#`P$$ +MS0`!<`!`;'=A>48!`-T!*F5DB@@"1P!P22=V92!A="T-`(P'`,$/D&EN:6UI +M>F4@P,1<#4`T6%T979EP" +M`,D*`2L`,VEN("#U%F:7)S=)("`*8!$6%P +M$A%O61$`]@`6+G0``]D#`J60!`,P``*,!!H`%,7=A;G\%$G0=#P-%`0!@```:!!!TC@0# +M`',*%EF-%#A)B!P`2 +M>`<``$D!`)()`"<`!A\:,#H@4S(##V0:____________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________]J4'(@71E(&%T +M(&$@=&EM90H@("!O2UB;&]C:V5D(&]U='!U="X*"B`J(%1H92!O8FIE8W0M +M'1E;G-I;VZ*``,<```J`#!E;&93`5!R96%D+^8`EG1E;B!U2!B=69F97(@;W+!``!E``1R`3!A(',K`5%T+"!I9@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VET;'D@:6YV +M;VME(&$@<.L`('5L-P0@96%9`D`@*'-U+P$9``%1`0.; +M`")E;LD!!RT``'P`"W$`*&1E$0`#Q@(1+/```H``(FYEC@(`%@$`0`!B86=A +M:6YS1P*@8V]RP,1<#4`T6%T979E2!B=69F97(@)`@`90`$<@&%82!S;V-K +M970^`TEW:7-HN@3`P"`,,)`2L`,VEN("0#`',*T"!S87ES +M+@I214%$346[!@?H!N$@8G5N9&QE+@H*475E<_H"H#\@($ES8N9V]O9VQE+F-O;2]P+VH`$2\Z`"!S+VD` +M`),``6<`47-U8FUI9P!P96YH86YC9;L``*8`!C@`@RP@<&QE87-E+```.P`` +M!`,`2P7!1`GH@1`9W)A;18"F-%#A)B!P`2>`<``$D!`)()`"<` +M4"H@97AA20!`8$(&YDT`(Q +M9G5L+P(&10`0+T,*`84!$6&>"E%A8W0@H($',+!0$^`0!U```7`@#Y!`%Q +M``%Q"@B7```\"3-Y+C--``#O!#)E(")K`P6K``$D`!0B"PM9(&-L87-$``$? +M"49N86QSG0`2!Q(M@@0U +M"`"X!!,B!0XR+F@BJ0`R:&4*7PP0(+`)`/H``!0`!.D&`W((`G\"$&T:%P/[ +M`$(N("!0B@FS;&5T('5S"FMN;W>5$P`P%&!E2X`L2`H8FEG+65N +M9&EAU!%C;&ET=&QE$0`"QP`$7Q:10T0M4D]-(&EMMP(0*#@.,"!O<,L#P&%L +M(%)O8VMR:61G9>\!`DD`#QX78P\+%P#036EC84`X"!S8W)I<'0* +M"D=U:61E@@"01&]C=6UE;G1A>`""(&EN'!L86EN3`1!F+``P'1E;J`*%35E(T($%30TE)=`(!%``"4P`/,@`%84)I;F%R>2X` +MH"`H8FEG+65N9&GS!(-R(&QI='1L91$``OH`\0))4T\Y-C8P($-$+5)/32!I +M;;<"@"AW:71H(&]P^@7`86P@4F]C:W)I9&=E10!B2F]L:65T*0$![P$"20`T +M6DE05@,$0`"0=6YC;VUPB,``!DT%``)"`&5 +M8V%N(&-R96%TSP`!=00/!@$"`NP"`[\#`KP"#Q\#&#`B&-E<$`%`+D%!&D"L"!T:&%T +M(')E<75IE@4G87C*`B`@*'T'`30$`(0!`S,$`/0#<2P@971C*2YO`0#Z`P"I +M`@8B!`$7``+:``^6`P4!R`-A(FYE=V,BFP,!,P`G?P(-F5A;;4%`A$+@"X@(%1H97)E+``C;F_B!P"" +M`@/?"`"3!/("(&EN+7!L86-E(&UO9&EF:6.M"/,";W(@U`P#P!`![``.?`0![ +M``&'"0&C``)*#`,*`P`X"`"R``$>`P"F!`(,`B$@8C<)<7)E861A8FP`!@", +M"@$,``$L"P($`0!H``([`$)E86-H/0$A=F5S`Q-Y0P!0:6YD97"J`"5N="(! +M`!@)4&%R=&EC0@4D;VZ!`02N`$17:6MI4@PP:6YGR0`P:&]WFPP"I@<'E@H" +M*@$A3VX_"`#W#`)X!@$""B-N9/@``8@)8V%L=V%YD`!RT`!"T'`,T`%&^5"'`I+"!I="!W<`!Q(&=E="!P=9P-(&EN +MI`0W($EN;@`W+"!IG@`(FP`B96[)`02UV```S#`#W"!%IAP8` +MA`!P96YV:7)O;M<",7,@=Y`#`:`"$&W8`1-R6@,%,`(`6P`"?P`1>7L#$7`U +M`-%A=&5V97(@8FQO8VMS\```[@`A$)P`$`B0`P;6%K>0"0:7,@97-P96-I +M;@0!T`$"J@$`.@@P.B`BDPH!#A$)V@T3(KD"`-X.(F%NZ`(`I0<&-`H0+&,` +M0&1EF-%#A)B!P`2>`<``$D!`)()`"<`02H@ +M97@;$T!S.B!3,@-4'2( +M`"%P=6<0,"`B8S0&%"*\&3EO;VQ-``)6`08U`0"4``"P"@&.`0]M`0$`(`T! +M$!H!V@$T90HGL``C92>O&0,D!`"3``!.`(\N86TL(&%C;&0:____________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________________________]J4&%N +M>2!D,!$``/`<871A('-O=7)C93H@(%EO=2!C86X@8W)E871E"B`@(&$@8FQO +M8VL@;V8@9"L`\!YI;B!M96UO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="(!`$0-``\/$&-"!1)O;`T&-0I4(%=I:VE2 +M#`,,$S!H;W?X``&S`Q!DK0$#V@`"*@$A3VX_"`#W#`)@!@#S#@!0!@/-``%P +M`%-L=V%Y'!L:6-I#16":6YV;VME(&'Z#Q%C +M?PH#SA$@("C2$"4@8?L*`*$!("!AL@$!)Q`"+0`(S0`4;W,$<"DL(&ET('=P +M`%`@9V5T(-(2`5T*`*0$-R!);FX`,BP@:8(5`9X``5$!`YL`(F5NR0$'+0`` +M?``+<0`H9&41``/&`A$LY0D"@```C0X`E@$`%@$`0``P86=A\P\!7PJ18V]R +M"(&5N=FER;VX/"Q%WD`,!H`(0;=@! +M$W):`P4P`@!;``)_`!%Y>P,1<#4`8F%T979E:89`@4.#V0:____________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________________]@4"`@*B!)1!$` +M`/$14T\Y-C8P(&9OFEP,A8`!"8`32],6E<=`/D#;'IM82P@;'II<"P@ +M86YD('AZ(P#!"DYO=&5S(&%B;W5TE`!R;&EB=$`\"YT96-T=7)E.@H* +M("H@5&AI0`&EP#@:7,@9&5S:6=N960@ +M=&]>`61E>'1E;F1>`3AN97?@``#S`#(*("#.`!!V<@$`X0$22!R97%U:7)E;65N=+(`,G1H80D!`BL`("!BCP&0(')E861A8FQEH@!!=W)I +M=`P`$&$,`0($`0!H``([`$5E86-H;P!396YT'!L86EN:6YGR0`P:&]W +M^``"]0`'+``"*@$A3VZJ`!PL`P$`48!`-T!\@%E9"!A +M=71O;6%T:6-A;&QY1P"P22=V92!A='1E;7#7`>!T;R!M:6YI;6EZ92!S="L` +ML"!L:6YK('!O;&QUN`'A+B`@268@>6]U(&1O;B?L`0"V`/$":6-I=&QY(&EN +M=F]K92!A('#K`(!U;&%R(&9E85D"0"`HD`!RT`!P8#`(`! +M`ID!<"DL(&ET('=P`/``(&=E="!P=6QL960@:6XN/@`G26YN`#``%1 +M`0.;`")E;LD!!RT``#X`"W$`*&1E$0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='ATB``A<'5G$#`@(F,T!A$B)`,`.`PI;VQ-``)6 +M`0;K`P$I`0`6"0".`0]M`0$`(`T0=3T3`A`7)`HGL``C92>M``,D!`"3``!. +M`/``+F%M+"!A8VQO8V%L+FTT"0T#[0`P+F%C_P```@`0+60"`)\`!*@``-D. +M"*($$BP:#@#7"P!9"Q!YR@4!]@$C97*N`05P`"1I;F0`@2YH+FEN"@DM]`<` +MYA,2\% +M1FYA;'.=`!)S/@M/:6YS:60:____________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________]J4&ME2!F;W(@:L`D'-A +M;64@9G5N8S`<``$D!0'-U8V@G`%`J(&5X84D`U',Z(%-O +M;64@6]U(&UA>2!F:6YD('5S969U;"\"!D4` +M42]M:6YIA0$18>,!46%C="!S8`"A(&1E;6]N2#R`I!I +M;VYS+@H*5&B=`?("<"UL979E;"!D:7)E8W1O%#36%K +M94QI\`!,GK0`#)`0`DP``3@#U`2YA +M;2P@86-L;V-A;"YM-"SA`$!E+F%C_P```@`2+50`)'1OJ``,H@2R+"!O;FQY +M(&YE961\`#%M86GV`2-E7-T96TZ"B`J(+@$=2XQ(&5X<&R#`@,O`P!"`0(A``2:`P,S``"(!`\T +M``L`(@`,-0`O870T``PH870S``8!!H`N,R!G:79E2XS30`"]P,2(FL#!:L``20`4"(@ +M=71II`59(&-L87-$``'O!49N86QSG0`P`D09BP``;<&42H@1TY5=0$"-0(B("BK"0"Y`0`:`$%L +M;VYG4`9B;F%M97,L$`!3;&EN:R`1``!C`%)S<&%R'1E;J+``-J`0`9`]$J(%!/4TE8 +M('5S=&%R6P`"$``R<&%X-`,"60<#>`('(0"P;V-T970M;W)I96X!`P!@`@$> +M`*%35E(T($%30TE)=`(!%``"4P`/,@`%84)I;F%R>2X`P"`H8FEG+65N9&EA +M;J(!8VQI='1L91$``OH`\0))4T\Y-C8P($-$+5)/32!I;;<"$2AX""!O<,L# +MP&%L(%)O8VMR:61G944`8DIO;&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#`#@(`&\0%'3N$@(,`B$@8C<)`(P*`8\8`[@4`0P` +M$&$,`0+4$`!H``([`!%EG!8`/0$A=F5S`Q-Y0P!0:6YD97"J`"5N="(!`$0- +M`7D9`$(%$F]L#0:P"U0@5VEK:5(,`PP3,&AO=U$/`;,#$&2M`0/:``+W$P4T +M&`3\!`#S#@!0!@/-``%P``*`%P+$!0]D&O__________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________________________'E!U9&EN9RX1``#R!2!' +M3E4@;&]N9R!F:6QE;F%M97,L$`!3;&EN:R`1`*%A;F0@`*935E(T +M($%30TE)%``"8P`/,@`%84)I;F%R>2X`\P<@*&)I9RUE;F1I86X@;W(@;&ET +M=&QE$0`"^@#P'TE33SDV-C`@0T0M4D]-(&EM86=EFEP/@$Q:6]N1`!=8GII<#(6``1D`4TO3%I7'0"B;'IM82P@;'IID#`*4#`.<#]A)U2!S +M=')E86VU!>!S>7-T96TN("!4:&5R92P`D&YO(&1I-R86YD;VT@86-C97-S+GD`!I<` +MD&ES(&1EU`P"C!`![``'.`!!VFP0` +MT082$N("!)9B!Y;W4@9&]N)^P!`+8`\0)I8VET +M;'D@:6YV;VME(&$@<.L`('5L60B@96%T=7)E("AS=2\!&7,<`A!AZ0`'+0`$ +M10<#(@("F0%P*2P@:70@=W``X"!G970@<'5L;&5D(&ENI`0W($EN;@`W+"!I +MG@`!40$#FP`B96[)`07L#$7`U`-%A=&5V +M97(@8FQO8VMS\```[@2X'<70@82!T:6U7`W%O8!(71O(@`%H0!A="!O;F-EA0`A3VZ0`QMEPP`"Y`(R<')O.@$! +MA0%18W1L>2W,``"."5)U='!U=.\"`&`$\0-O8FIE8W0M2!B=69F97(@)`@`90`$<@&%82!S;V-K +M970^`TEW:7-HN@3`P"`,D*`2L`,VEN(">D``,P``*,! +M!H`%,7=A;H@`$'0V!`5%`0!@```:!!!TC@7,N +M"E)%041-1;L&!^@&X2!B=6YD;&4N"@I1=65S^@*@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65S+!``4VQI;FL@ +M$0``8P!A`@@;W#+`\!A;"!2;V-KB,` +M`!DT%``)"`$```I58W)E873/``%U!`\&`0("J@,#OP,"O`(/'P,8,")R9?X( +M46-T960B1P,"3P#$+"!W:&EC:"!W:6QLB@`!5@`%R@%A(&5X8V5P0`4`N04$ +M:0+1('1H870@U`P#P +M!`![``.?`0![``&'"0&C``)*#`,*`P`X"`"R``$>`P"F!`(,`B$@8C<)`&H( +M,6%B;``&`(P*`0P``2P+`@0!`&@``CL`0F5A8V@]`2%V97,#$WE#`%!I;F1E +M<*H`)6YT(@$`&`D`#P\08T(%$F]L#08U"E0@5VEK:5(,,&EN9\D`,&AO=U$/ +M`;,#%V26"@(J`2%/;C\(`/<,`F`&`P,!`_@``8@)4&%L=V%Y1@$`W0$J962* +M"`)'`'!))W9E(&%T+0T`C`<`P0^0:6YI;6EZ92!S#@T28U((07!O;&R4#5$N +M("!)9O4(4&1O;B=TJ`"097AP;&EC:71LV0EB=F]K92!A^@\18W\*,69E830+ +M,"AS=2\!!?L*`*D`("!A00`!)Q`"+0`(S0`4;_D(<"DL(&ET('=P`'$@9V5T +M('!UG`T0:7H+1R`@26YN`#``%1`0.;`")E;LD!!RT``#X`"W$`*&1E +M$0`#Q@(1+/```H```(T.`)8!`!8!`$``(&%G`PX"4`.18V]R0`P&@`A!MV`$32X'<70@82!T:6U7`W%O +M8!(71O(@`%2@!2="!O;F-\$B)/ +M;AP."\,``N0",G!R;SH!`84!46-T;'DMS`"2960@;W5T<'5T[P(`8`3Q`V]B +M:F5C="US='EL92!A<'!R;\@#`$,2`OH`X'1O(&AA=F4@;75L=&EP)0``(040 +M=A(#0')E86VY"`#^#15NG@`3(!40`&H0``H!`#T%@VX@:71S(")`Y0`2(KT$ +M$7,P#@)C!08!`6!I='-E;&93`0!]!!`O=@1@=&5N('5S;P8`-PP!<@$R9G5N +M6!($DP$!=08`,@`U(&%NI``"(Q-0;'D@9G)@``S0*%82!S;V-K970^`TEW:7-HN@0!)@\#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%L;'4```T`(7)U*@(#*0"!4D5!1$U%("T\``&5``*3`+!C +M;VYF:6=UM``,D!`"3``!. +M`/4!+F%M+"!A8VQO8V%L+FTT+.$`0&4N86/_```"`!(M5``D=&^H``RB!+(L +M(&]N;'D@;F5E9'P`,6UA:?8!(V5R7`$%<``D:6YD`/(#+F@N:6X*"2T@=&5M +M<&QA=&5S9P`18C0"`68!$V6U`&`*"D=U:63S`%`@1&]C=9D%`H$!`,4!,F%L +M;'4``;`:`;W9E]!;!I;@IA +M(&YU;6)E"`"X!!,BO0(R+F@BJ0"`:&4*2R"```[!P$C"4!A=71ODP8`_P(0 +M><$",&5C=)D#$635``,<`@5X"1!F+``!MP91*B!'3E5U`0(U`B(@**L)`+D! +M`!H`06QO;F=0!F)N86UEB,``!DT%``)"`$```I58W)E873/``%U!`\& +M`0("J@,#OP,"O`(/'P,8,")R9:`-46-T960B1P,"3P#$+"!W:&EC:"!W:6QL +MB@`!5@`%R@%A(&5X8V5P0`4`N04$:0)1('1H871##C%I`3AN97>U`P#P!`![``.?`0![``&'"0&C``)*#`!-$2)IF4@``%1`0.; +M`")E;LD!!RT``'P`"W$`*&1E$0`#Q@(1+/```H```(T.`)8!`!8!`$``(&%G +M`PX1=/$)D6-OP,1<#4`T6%T979EP"`,D*`2L`,VEN("#U%F:7)S=)("`*8!$6%P$A%O\0T`]@`6+G0` +M`]D#`J +M#@#G&`Y6#A`L8P!`9&5S<*(``&P$`>0#`',*2!I;G9O:V4@82!P87)T:6-U;&%R(&9E +M871U!E('-O;64@=71I;&ET>3X`!8P``+$!\09P2!D8737`%9UP"`&$# +M`2L`,VEN("7,N"E)%041-15``1"!L:6)M +M`=%B=6YD;&4N"@I1=65S^@*@/R`@27-S=65S/U(`UBH@:'1T<#HO+W=W=RXX +M`$`N;W)GDP``2`$0:+@"L&9OF-A="P@8@<`$G@'``!)`4!S=6-H +M)P!0*B!E>&%)`$!S.B!3,@-40&";8"(FEN8PL`<0L`ZP4$O0+P +M`DY%5U,@+2!H:6=H;&EG:'1S7`8P'2(`#!P=71>`C`@(F,T!A$B)`-I +M9"!T;V]L30`"5@$&ZP,`E``!%@D`C@$/;0$!`&8(('5SW0H`V@$T90HGL``C +M92>M``-G`0"3``!.`/``+F%M+"!A8VQO8V%L+FTT"0T#[0`P+F%C_P```@`0 +M+:("`)\`!*@``&H+"*($82P@;VYL>=<+`GP`,6UA:?8!(V5RK@$%<``D:6YD +M`($N:"YI;@H)+?0'4FQA=&5S9P`18C0"`W(!`K4`8`H*1W5I9/,`*"!$5`8$ +MT@$"=0`!MP%P=H+`#L'`2,)"=H1`,$",&5C +M=)D#$62V#P,<`@5X"1!F!A(!MP91*B!'3E5U`0(U`B8@*`0+`!H`(VQOO`4` +MK0LB+``-J`0`9`[$J(%!/4TE8('5S=+`1!!``#XH,`P%\ +M``(Q`+!O8W1E="UO`@@;W#+`\!A;"!2;V-K[`@0]`5HW+5II<"8`V$UI +M8W)OFEP/@$@:6]/$WTJ +M(&)Z:7`R%@`$?`%-+TQ:5QT`HFQZ;6$L(&QZ:7`3`R]X>B,``!DT%``)"`$` +M``H"G!`%.@$`=00/!@$"`J\!`[\#`KP"#Q\#&#`BD6$W,*%P!5"`2`!"EIP`!APD!*Q4"2@P#"@,`.`@`W@`4=.X2`@P"(2!B +M-PD`C`H!CQ@#N!0!#``080P!`M00`&@``CL`$66<%@`]`2%V97,#$WE#`%!I +M;F1E<*H`)6YT(@$`1`U087)T:6-"!1)O;`T&L`M4(%=I:VE2#`,,$S!H;W=1 +M#P&S`Q!DK0$#V@`"]Q,%-!@$_`0`\PX`4`8#S0`!<``"@!<"Q`4/9!K_____ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_SI0;F<@;&DN$0``\SUN:R!N86UE'1E;F1E9"!T87(@9F]R;6%T("AI;F-L=61I;F<@04-, +M,P!A3VQD(%8W)P"!87)C:&EV97-+`+=03U-)6"!U"=M=')E92<]`5HW+5II<"8`V$UI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\4,`#`'`4$`$&GD!@FV`B)I;M8$`*0*`.L%!+T"\`).15=3 +M("T@:&EG:&QI9VATPH"MP(`318A86R)!T!S97%UZ@@0=&%R+C54`0CQ!`4^$A%SU@TQ<&]PY0\# +MG`$$>P`(2PE`:&%R9!8,`3`&`J@!`X42`(X!86UO9&5R;H\``.@!`+P'<"!V +M87)I86Y("0`B##!M86[X"Q%PK1] +M!;!I;@IA(&YU;6)E"`"X!!,BXP`R+F@BJ0`R:&4*7PP0(+`)`/H``!0`!.D&`W((`G\" +M$&T:%P/[`$(N("!0B@FR;&5T('5S"FMN;W<0`0&9!F!E`D09@82`;<&`H<8!JH+"``:`/@5#"`6`1````4+#V0:________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________________________]H4"`J(&5X +M1!$``/$,86UP;&5S+VUI;FET87(Z(&$@8V]M<&%C="!S&P#T3R!D96UO;G-T +MV`'!I;F9O +M6]U(&-A;B!D;Y\`,W1H:2D`\@)) +M3E-404Q,("T@:6YS=&%L;'4```T`,')U8X$``RD`@%)%041-12`M%`$1`?$#+@H*66]U('-H +M;W5L9"!A;'-O(@(!3``Q8V]P=@8R8V]M6P%#:6X@(KT",BYH(JD`@&AE"G-O +M=7)C+P`19'4!`!0`!.D&`YH#`G\"-&UO68!,&5C=)D#$635``,<`@7"!A!F+``!MP91*B!' +M3E5U`0*Z`28@*+D!`!H`06QO;F=5`F)N86UE'1E;J+``-J`0`9`]$J(%!/4TE8('5S=&%R6P`"$``P<&%X20,B97)9!P-X`@FEP,A8`!'P!32],6E<=`*)L>FUA+"!L>FEP$P,O>'HC```9-!0`"0@! +M```*56-R96%TSP`!=00/!@$"`JH#`[\#`KP"#Q\#&#`B&-E<$`%`+D%!&D"T2!T:&%T +M(')E<75IP`# +MGP$`>P`!APD!HP`"2@P#"@,`.`@`L@`!'@,`"0$"#`(A(&(W"0!J"#%A8FP` +M!@","@$,``$L"P($`0!H``([`$)E86-H/0$A=F5S`Q-Y0P!0:6YD97"J`"5N +M="(!`!@)``\/$&-"!1)O;`T&-0I4(%=I:VE2##!I;F?)`&-H;W<@=&_U``>6 +M"@(J`2%/;C\(`/<,`F`&`P,!`_@``8@)4&%L=V%Y1@$`W0$J962*"`)'`'!) +M)W9E(&%T+0T`C`<`P0^0:6YI;6EZ92!S#@T28U((07!O;&R4#5$N("!)9O4( +M4&1O;B=TJ`"097AP;&EC:71LV0EB=F]K92!A^@\18W\*,69E830+,"AS=2\! +M!?L*`*D`("!A00`1P,1<#4`T6%T979EP"`,D*`2L`,VEN("#U%F:7)S=)("`*8!$6%P$A%O61$`]@`6+G0``]D#`J60!`,P``*,!!H`%,7=A +M;G\%$G0=#P-%`0!@```:!!!TC@0#`',*F-%#A)B!P`2>`<``$D!`)()`"<`02H@97@$ +M&D!S.B!3,@-48$(&YDT`(Q9G5L+P(&10`/ +M9!K_________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_________V10=&EM90HH$0``\!0@("!O2UB;&]C:V5D(&]U +M='!U="X*"B`J(%1H92!O8FIE8W0M`@#1```V`:!T +M;R!A;GD@9&%TUP!6=7)C93HN`6!C`@&^``7+ +M`0#3``.C`4,N("!)I`$A86Z(`!)T70`!-@(!6P,`'P$`.P%!9&ES:RP#`\0! +MMF-O;G9E;FEE;F-E3`(P('1OB0`P;6%K>0#1:7,@97-P96-I86QL>=`!`JH! +M\P].;W1E.B`B<&%X(&EN=&5R8VAA;F=E(&9O7,N"E)%041-12X` +M1"!L:6)M`=%B=6YD;&4N"@I1=65S^@*@/R`@27-S=65S/U(`UBH@:'1T<#HO +M+W=W=RXX`$`N;W)GDP``:@00:+@"L&9O&%)`$!S.B!3,@-4`0-)`#!C;VY#`O`".B`@5F%R:6]U +MP``7P%Q875T:&]R<\`%`1\&`?("`DT'$`H5"%!T;W`M;`P$`W8%`#`'`4$` +M$&DD!0FV`B)I;O@$(FEOX08$O0+P`DY%5U,@+2!H:6=H;&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%^PH`J0`@(&'I``0 +M`P&@`A!MV`$32X'<70@82!T:6U7`W%O8!(71O +M(@`%2@!A="!O;F-EA0`B3VX<#@O#``+D`C)P@``S0*%82!S;V-K970^`TEW:7-HN@0!)@\#60\` +M4X.``P1$2(A`0!:""`L(E`(L2P@8V%P86)I;&ET +M]@($`P$%\0`"\P\!MP0(]@4!EP&`(&EN9&EV:61L#@/;"`"%``(5!@!"``!R +M"P#1```V`2%T;W@',&1A=-<```4.%CHN`0+("0`]`!)A[`(`R0H!*P`S:6X@ +M)P$`CP(S861DC@(88?<,`=<'`QX/469I60!`,P` +M`*,!!H`%,7=A;G\%$G0=#P$V`@%;`P$:!!!TC@0#`',*T2!S +M87ES+@I214%$3442!@9)$>$@8G5N9&QE+@H*475E<_H"H#\@($ES+%1`G +MD1(`\A$`%@)S82!F=6QL+98(F-%#A)B!P`2>`<``$D!`)()`"<`02H@97@;$T!S.B!3,@-4 +MO&0,D!`"3``!.`/``+F%M+"!A8VQO8V%L+FTT"0T#[0`P+F%C_P`` +M`@`0+60"`)\`!*@``-D."*($$BP:#@#7"P!9"P]D&O__________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________________________________55!E;6]R>341 +M``#P)B!A;F0@861D(&ET('1O(&$@=&%R(&%R8VAI=F4@=VET:&]U=`H@("!F +M:7)S="!W``-:``!V``!-`/($92!T:&4@9&%T82!D +M:7)E8W1L>8<`\01S;V-K970N("!)9B!Y;W4@=V%NB``2=%T`$B\]``!@`#!I +M97,S`%!D:7-K+$X`\`QR92!A2!E87-Y+@H*("H@3F]T93H@(G!A>"!I +M;G1E'1E;F1E9#@!`B(`$"QC +M`$!D97-PWP!`=VAA=)8`\`,@;F%M92!S87ES+@I214%$3450`$0@;&EB;0'1 +M8G5N9&QE+@H*475E6H`)V%T:0`K871H`&ES:6UP;&6U`$!T;V]L,P$`0``# +M`@!R>F-A="P@8@<`$G@'``!)`4!S=6-H)P!0*B!E>&%)`$!S.B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M4D]-(&EMMP(0*#@.,"!O<,L#P&%L(%)O8VMR:61G +M9>\!`DD`-%I)4'4$!$``('5N,0L`)18`UA!@C2H`0#E%PD(`0``"@*<$`4Z`0!U!`\&`0("KP$#OP,"O`(/'P,8,")R +M9:`-`!`6$2)'`P)/`,0L('=H:6-H('=I;&R*``%6``:0`"!E>"T4``("`+D% +M!(D1`@L7`UH7`5$`!>D2,',@*%,*`30$`(0!`S,$`/0#8"P@971C*>\+`OH# +M`*D"!C`0`9L!`MH`#\@#"F$B;F5W8R*;`P$S`"=S:+```1(`#T8#8P0%!`); +M`0&)``]9`P`*%@,S5VAE`P(`OP@#U`(2<^8%#V0:____________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________________]34')A=&EO2A$` +M`/,?;BX*("H@;&EB87)C:&EV92UF;W)M871S+C4@9&]C=6UE;G1S('1H92!F +M:6QE(!T`T2!S=7!P;W)T960@8GD>`'!L:6)R87)Y3`#08W!I;RXU+"!M=')E +M90D`\@YA;F0@=&%R+C4@<')O=FED92!D971A:6QE9"!I;E(`D&EO;B!A8F]U +M=$T`XW-E"B`@('!O<'5L87(@F``$>P#S"2P@:6YC;'5D:6YG(&AA``"/`/0:("=D;V,G(&1I2!I +M;@IA(&YU;6)E6]U(#\! +M8"X*"D-U"!I;G1E`*%35E(T($%30TE)=`(!%``"8P`/,@`%84)I;F%R>2X`P"`H8FEG+65N +M9&EA;J(!8VQI='1L91$``OH`\0))4T\Y-C8P($-$+5)/32!I;;<"\`DH=VET +M:"!O<'1I;VYA;"!2;V-KFEP/@$Q:6]N!0%=8GII +M<#(6``1\`4TO3%I7'0"B;'IM82P@;'II&-E<$`%`+D%!&D"L"!T:&%T(')E +M<75IE@4G87C*`E(@*&9OU`P#P!`![``-S!`![``&'"0&C`%0@;VYL>0H#`#@(`+(``1X#`*8$`@P" +M(2!B-PEQ4,`4&EN9&5PJ@`E;G0B`0`8"5!A``B; +M`")E;LD!!RT``'P`"W$`*&1E$0`#Q@(1+/```H``(FYEC@(`%@$`0`!B86=A +M:6YS1P*18V]R0 +M`P&@`A!MV`$38!(71O +M(@`%H0!A="!O;F-EA0`A3VZ0`QMEPP`"Y`(R<')O.@$!A0%18W1L>2W,``". +M"5)U='!U=.\"`&`$\0-O8FIE8W0M`%`@(&)S9",'(75SO`$`/06# +M;B!I=',@(D`\`!(BO01&2!F60!`,P``*,!!H`%,7=A;G\%$G0=#P-%`0!@```:!!!TC@0"0:7,@97-P96-I;@0! +MT`$"J@$`.@@P.B`BDPH.V@T3(KD"`-X.(F%NZ`(`I0<`$0,"6@<0+&,`0&1E +M8$(&YDT`(Q9G5L+P(& +M10`0+T,*`84!$6&>"C1A8W1[$X)D96UO;G-T$0(8`+5C;VYF +M:6=U'2(`"%P=6<0,"`B8S0&$2(D`P`X#"EO;$T``E8!!NL#`2D!`!8)`(X! +M#VT!`0"B!A!U/1,"$!P`"-E)ZT``R0$`),``$X`\``N86TL(&%C;&]C +M86PN;30)#0/M`#`N86/_```"`!`MH@(`GP`$J```V0X(H@02+!H.`-<+`%D+ +M$'G*!0'V`2-E!Q(M +M6`D/9!K_____________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_____________U-0:7-T"B`O$0``\R,@("H@5&\@2!F;W(@ +M:L`D'-A;64@9G5N8S`<``$D!0'-U8V@G`%`J(&5X84D`U',Z(%-O;64@6]U(&UA>2!F:6YD('5S969U;"\"!D4`42]M:6YIA0$1 +M8>,!46%C="!S8`"A(&1E;6]N2#R`I!I;VYS+@H*5&B= +M`?("<"UL979E;"!D:7)E8W1O%#36%K94QI\`!,GK0`#)`0`DP``3@#U`2YA;2P@86-L;V-A +M;"YM-"SA`$!E+F%C_P```@`2+50`)'1OJ``,H@2R+"!O;FQY(&YE961\`#%M +M86GV`2-E7-T96TZ +M"B`J(+@$=2XQ(&5X<&R#`@,O`P!"`0(A``2:`P,S``"(!`\T``L`(@`,-0`O +M870T``PH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$DG=F4@870M#0",!S!T;R`A$+)M:7IE('-T871I8U(( +M07!O;&PV$E$N("!)9O4(4&1O;B=TJ`"097AP;&EC:71LV0EB=F]K92!A^@\1 +M8W\*`\X1("`HTA`E(&'["@"A`2`@84$``2<0`BT`",T`%&_Y"'`I+"!I="!W +M<`!!(&=E=!D3`5T*`*0$-R!);FX`-RP@:9X``5$!`YL`(F5NR0$'+0``?``+ +M<0`H9&41``/&`A$L\``"@```C0X`E@$`%@$`0``@86<##A%T\0F18V]RP,B:67-#P&<$P/G"B!D=1D-`)\#$'.%`2-O9H@!`(X2 +M$"UV```S#`#W"!%IM`\`A`!R96YV:7)O;@\+$7>0`P&@`A!MV`$3<3 +M`<0-0&)A8VOR`S%F2W,`))E9"!O=71P=73O`@!@!/$#;V)J +M96-T+7-T>6QE(&%P<')OR`,`^10"^@#0=&\@:&%V92!M=6QT:<,3!*D``@$$ +M`+D(52!O<&5NG@`3(!40`&H0``H!`#T%@VX@:71S(")`/``2(KT$$7,P#@)C +M!098`&!I='-E;&93`5!R96%D+^8`8'1E;B!U@``S0*%82!S;V-K970^`TEW:7-HN@0!)@\#60\`7,N"B05$6:X#007&0.A&$0N"@I1$1:@/R`@ +M27-S=65S/U(`$2H%&78Z+R]W=W7,@9&5T96-T960@875T;VUA +M=&EC86QL>2X*"B`J($DG=F4@871T96UP(@#@=&\@;6EN:6UI>F4@6]U(&1O;B=T"B`@(&5X<&QI8VET;'D@ +M:6YV;VME(&$@<&%R=&EC=6QA2!A8V-E<#4` +MT6%T979E717`G`@82!T:6UEI0!Q;W(@;6UA<'\` +M0&5N=&F?`D!R8VAI?P)`;F0@9PD`(&ET3P``2P$%2@!A="!O;F-EA0"+3VX@ +M=W)I=&7#``+D`C)P2!B=69F97(@;W+!``!E``1R`85A('-O8VME=#X#4'=I2UT;RUU0"0:7,@97-P96-I;@0!T`$"J@'S!TYO +M=&4Z(")P87@@:6YT97)C:&%N9V6?!1,BN0(@;&P\`0+H`A!DO@$`_04!P040 +M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``Q3$A!"@,Z3%I(,@`Z4D%2$0`86!$``1D(!2`&`/42"*\"`'82`"H( +M`,,/`TP&!D4(,&)E9DH#4F5V86QU0@H`K@,#+P(`'P@P*B!U]@40;Q@$``L% +M`D,"`0H``EP)L5)032!WFEP,A8` +M!'P!32],6E<=`*)L>FUA+"!L>FEP$P,O>'HC```9-!0`"0@!```*`IP0!3H! +M`'4$#P8!`@*O`0._`P*\`@\?`Q@P(G)EH`T`$!81(D<#`D\`Q"P@=VAI8V@@ +M=VEL;(H``58`!I``(&5X+10``@(`N04$B1$":Q0`0PX`TQ,`40`%Z1(PA@!+1`0:2`*<&AE879I;'G\"#9E86VU +M!0(1"P6(%$!I0`&@`0I:7-N%")B98@%`$`$`5X!.&YE=[4#`/`$ +M`/T"`Y\!`'L``8<)`2L5`DH,`PH#`#@(`&\0%'3N$@(,`B$@8C<)`(P*`8\8 +M`[@4`0P`$&$,`0+4$`!H``([`!%EG!8`/0$A=F5S`Q-Y0P!0:6YD97"J`"5N +M="(!`$0-`7D9`$(%$F]L#0:P"U0@5VEK:5(,`PP3,&AO=U$/`;,#$&2M`0/: +M``+W$P4T&`3\!`#S#@!0!@/-``%P``*`%P+$!0]D&O__________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________________________________5E!L97,I"BP1 +M``#P)"`@*B!3;VQA +M`*935E(T($%30TE)%``"8P`/,@`%84)I;F%R>2X`\P<@*&)I9RUE;F1I86X@ +M;W(@;&ET=&QE$0`"QP#P'TE33SDV-C`@0T0M4D]-(&EM86=EFEP/@$Q:6]N1`!=8GII<#(6``1D`4TO3%I7'0"Q;'IM82P@ +M;'II<"S'`"]X>B,``!DT%``)"`&58V%N(&-R96%TSP!/&-E<'0"`D0*("`@:0+1('1H870@0`&EP"0:7,@9&5S:6=NH@9";R!B98@%`$`$`3`$ +M.&YE=[4#`-P#`'L``4,`4&EN9&5PJ@`B;G1_`!!R.P0`!``P=&EC0@4D;VZ!`02N +M`/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W40\!LP,09*T!`]H``O<3(4]N/P@`]PP"8`8`\PX`4`8#S0`!<``" +M@!<"Q`4J962*"`)'`'!))W9E(&%T(14`C`'!L:6-I=&S9"6)V;VME(&'Z#Q%C?PH#SA$@ +M("C2$`!U#`@<`A!AL@$!)Q`"+0`(S0`4;W,$<"DL(&ET('=P`%`@9V5T(-(2 +M`5T*`*0$-R!);FX`!287`9X``5$!`YL`(F5NR0$'+0``?``+<0`H9&41``.J +M`!$L6!$"@```C0X`E@$`%@$`0``P86=A\P\!7PJ18V]R7L#$7`U`&)A=&5V97)X%Q%S\```[@$P'Y +M%@*[&0"V`A!GQ!D0:2(3`2(`!4H``.,3#V0:________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________________](4'(*("`J-Q$``/T, +M(&=Z:7`@8V]M<')EFUA +M+"!L>FEP+"!A;F0@>'HC```9-!0`\3(*5&AE(&QI8G)A&-E<'1_`/$* +M"B`@("!E;G1R:65S('1H870@$E33SDV-C`3`%HW +M+5II<#D`-EA!4A$`0PI7:&4#`@#D`00%`A$L_`%A2!S=')E86WM +M`>!S>7-T96TN("!4:&5R92P`D&YO(&1IP`!S@`4=E@#$G.C +M`%0@;VYL>0H#0&UE;G2R``$>`P+``P"#`R`@8H\!D"!R96%D86)L9:(`07=R +M:70,`!!A#`$"!`$!1`0!.P!$96%C:"8"`98"$WE#`%!I;F1E<*H`(FYT?P`0 +M$N("!)9B!Y;W4@9&]N)^P!`+8`\0)I8VET;'D@:6YV +M;VME(&$@<.L`('5L-P0@96%9`D`@*'-U+P$9``%1`0.; +M`")E;LD!!RT``'P`"W$`*&1E$0`#J@`1+/```H``(FYEC@(`%@$`0`!B86=A +M:6YS1P*@8V]RP,1<#4`T6%T979E2!B=69F97(@)`@`90`$<@&%82!S;V-K +M970^`TEW:7-HN@3`P"`,,)`2L`,VEN("0#`',*T"!S87ES +M+@I214%$346[!@?H!N$@8G5N9&QE+@H*475E<_H"H#\@($ES7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58V%N(&-R96%TSP`!=00/!@$" +M`J\!`[\#`KP"#Q\#&,$B0`&EP"P:7,@9&5S +M:6=N962C"R)B9;X"`$`$`3`$.&YE=[4#`/`$`'L``Y\!`'L``8<)`:,`5"!O +M;FQY"@,`.`@`L@`!'@,`"0$"#`(A(&(W"7%R96%D86)L``8`C`H!#``!+`L" +M!`$`:``".P!"96%C:#T!(79E4,`4&EN9&5PJ@`E;G0B`0`8"5!A`8!`@HC;F3X``&("5!A;'=A>48!`-T!*F5DB@@"1P!P22=V92!A="T- +M`(P'T'1O(&UI;FEM:7IE(',.#1)C4@A0<&]L;'4B!U$N("!)9O4(0&1O;B?6 +M!P&V`%!I8VET;-D)@79O:V4@82!PZP`!?PHQ9F5A-`LP*'-U+P$%^PH`J0`@ +M(&'I``2UV```S#`#W"!%IAP8`A`!P96YV +M:7)O;M<",7,@=Y`#`:`"$&W8`1-R6@,%,`(`6P`"?P`1>7L#$7`U`-%A=&5V +M97(@8FQO8VMS\```[@@``8P2%82!S;V-K970^`TEW +M:7-HN@0!)@\#60\`4X.475S92`B(0$`6@@@+")0 +M"+$L(&-A<&%B:6QI=/8"!`,!!?$``O,/`;<$"/8%`9P"`,D*`2L`,VEN("#U%F:7)S=)("`*8! +M$6%P$A%O61$`]@`6+G0``]D#`J60!`,P``*,!!H`%,7=A;G\%$G0=#P$V`@%;`P$:!!!TC@0#`',*T2!S87ES+@I214%$3442!@9)$>$@8G5N9&QE+@H*475E<_H" +MH#\@($ES+%1`GD1(`\A$`%@)S82!F=6QL+98(F-%#A)B!P`2>`<``$D!`)()`"<`02H@ +M97@;$T!S.B!3,@-4O&0,D!`"3``!.`/``+F%M+"!A8VQO8V%L+FTT +M"0T#[0`P+F%C_P```@`0+60"`)\`!*@``-D."*($$BP:#@#7"P!9"Q!YR@4! +M]@$/9!K_____________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_____________V=08VAI=F4G$0``\#T@=VET:&]U=`H@("!F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^@,`J0(&,!`!A@$"V@`/E@,% +M`<@#82)N97=C(IL#`3,`)W-HL``!$@`/1@-C!`4$`EL!`8D`#UD#``H6`S-7 +M:&4#`@C1#@+F!6%R97-U;'1-$A%B:`4@=&6[#@%5!`\C`@$*"P,!@``/Z0)4 +M$`HJ$@&G!P(F"`:A!@`^!R%T9=L($3I4$@$M$!!I(`IP:&5A=FEL>?P(-F5A +M;;4%`A$+<"X@(%1H97(T$2`@;M82,7)E8S`1`]\(`),$02!I;BVW#X(@;6]D +M:69I8^4,\`!O`3AN97>U`P#P!`#]`@-S!`![``&'"0&C``)*#`!-$2)I7-S""IE9(H(`D<`<$DG=F4@870A%0",!S!T;R`A$'!M:7IE +M('-TM0@"4@A!<&]L;#82!N04061O;B?L`7!E>'!L:6-I#15@:6YV;VMEO!(! +MZP`!?PH#SA$@("C2$"4@8?L*`*$!("!AL@$!)Q`"+0`(S0`4;_D(<"DL(&ET +M('=P`$$@9V5T&1,!70H`I`0W($EN;@`R+"!I@A4!G@`!40$#FP`B96[)`0"(&5N=FER;VX/"Q%WD`,!H`(0 +M;=@!$W):`P4P`@!;``)_`!%Y>P,1<#4`T6%T979E:89`@4.%CHN`0+("0`]`!)A +M[`(!@`X`T1DS:6X@)P$`104U861D'`$`_`@$J@$`>08/9!K_____________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_____________________________________________________V502!O9B!T:&4@9F]L +M;&]W:6YG.@H@("H@=75E;F-O9&4-`/$!9WII<"!C;VUPFUA+"!L>FEP+"!A;F0@>'HC`,$*3F]T97,@ +M86)O=724`/`[;&EB2!A2!S=')E86TM;W)I96YT960@P`!S@`0=G(!4G)M871SHP#P`B!O;FQY(')E<75I4,`4&EN9&5PJ@`B;G1_`$%R92!A!`"4 +M=&EC;&5S(&]N@0$$K@#P`%=I:VD@97AP;&%I;FEN9\D`,&AO=_@``O4`!RP` +M`BH!(4]NJ@`<+`,!`',!,FUA='``0&QW87E&`0#=`?(!960@875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``,*&%T,P`& +M`0:`+C,@9VEV97/?!H!O=F5R=FEE=_,"`*``!+L%$&%Q!3!W:&^1`B,J("X' +MA5]R96%D+C,L$```T04=91$`45]D:7-K%@`@;F30`0@^``,<``"9`!!V7P$" +MMP)A960@8V%LB0<0<]0&06YC97.M`@"3``!U``%'``-"!FAE($%027.7`'-E +M;G1R>2XS30`"]P,2(FL#!:L``20`4"(@=71II`59(&-L87-$``'O!49N86QS +MG0`P]!;!I;@IA(&YU;6)E`D09BP``;<& +M42H@1TY5=0$"-0(B("BK"0"Y`0`:`$%L;VYG4`9B;F%M97,L$`!3;&EN:R`1 +M``!C`%)S<&%R'1E;J+``-J`0`9`]$J(%!/4TE8('5S=&%R6P`"$``R<&%X-`,"60<# +M>`('(0#`;V-T970M;W)I96YT%P0@<&E^"<8J(%-64C0@05-#24D4``)3``\R +M``5A0FEN87)Y+@#`("AB:6B,``!DT%``) +M"`$```I58W)E873/``%U!`\&`0("J@,#OP,"O`(/'P,8,")R9:`-46-T960B +M1P,"3P#$+"!W:&EC:"!W:6QLB@`!5@`%R@%A(&5X8V5P0`4`N04$:0)1('1H +M871##C%I\+`OH# +M`*D"!B($`88!`MH`#Y8#!0'(`V$B;F5W8R*;`P$S`"=S:+```1(`#T8#8P0% +M!`);`0&)``]9`P`*%@,S5VAE`P(`?`4#U`(2<^8%87)E`3AN97>U`P#P!`![``.?`0![ +M``&'"0&C``)*#`!-$2)IF4@``%1`0.;`")E;LD!!RT``'P`"W$`*&1E$0`#Q@(1+/`` +M`H```(T.`)8!`!8!`$``,&%G82X.`?$)D6-OP,1<#4` +MT6%T979E$P$/`P*A +M%0"V`A!GJA40:2(3`2(`!4H``.,3(6-EA0`A3VZ0`QMEPP`"Y`(R<')O.@$! +MA0%18W1L>2W,`))E9"!O=71P=73O`@!@!/$#;V)J96-T+7-T>6QE(&%P<')O +MR`,`^10"^@!0=&\@:&$Y%D!U;'1IPQ,$J0`"`00`N0A5(&]P96Z>`!,@%1`` +M:A``"@$`/06#;B!I=',@(D`\`!(BO0012!F4X.``P1$2(A`0!:""`L +M(E`(H"P@8V%P86)I;&D2%`8#`07Q``+S#P$_#@CV!0&7`8`@:6YD:79I9&P. +M`]L(`(4``#H2`D(``*P+`-$``#8!(71OK`TP9&%TUP``!0X6.BX!`L@)`#T` +M$F'L`@#)"@$K`#-I;B`G`0"/`C!A9&1T!`!,``CW#`&I"@,>#U%F:7)S=)(" +M`*8!$6%P$A%O\0T`]@`6+G0``]D#`J#B)A;N@"`*4'!C0*$"QC`$!D97-PH@``;`0!Y`,` +M7,N"B05$6:X#06Y&0*A&$0N"@I1$19`/R`@2:T9(',_4@`4*I49 +M1G=W=RXX`$`N;W)GDP``2`$0:+@"`%<`0V]N9V]8!Q<@3`<@(&18%B!O<#P% +M"!D1!+H1`:P(`3<,`'$``#H`'VYD&O______________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________:E!I=F4@95^*JRTH$0``\1%N +M=')Y(&)E"B`@(&EN9&5P96YD96YT+B`@5&AE'!L86EN:6YG1@#7:&]W('1O(&5X=&5N +M9"P`\A8N"@H@*B!/;B!R96%D+"!C;VUP2!A(&)Y=%<"82!A('1I;10#<6]R(&UM87#:`$%E;G1I +M#P,"_`(`:0`09P4#(&ET3P`)H0!A="!O;F-EA0"+3VX@=W)I=&7#``+D`C)P +M0"0 +M:7,@97-P96-I;@0!T`$"J@'S!TYO=&4Z(")P87@@:6YT97)C:&%N9V6?!1,B +MN0(@;&P\`0+H`A!DO@$`_04!C080+&,`0&1EF-A="P@ +M8@<`$G@'``!)`0"2"0`G`%`J(&5X84D`0',Z(%,R`U1S;6%L;!4`!#X!`%(# +M(6%T'`@@;6'F!"!N9-`",69U;"\"!D4`$"]#"@&%`1%A!@E186-T('-@`+`@ +M9&5M;VYS=')A=+P`"-E)ZT``V7-T96TZ&@D"N`0A+C'!#`!A#`$W`0,O +M`P`+``(A``2:`P,S``"(!`\T``L`(@`,-0`O870T``PH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31$B +M:7*"$1!I>0<#[A("#`(#(1H`C`H!CQ@#N!0!#``080P!`M00`&@``CL`$66< +M%@`]`2%V97,##V0:____________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________]G4&)R87)Y9/.(_"(1``#P(2!A=71O;6%T:6-A +M;&QY(&1E=&5C=',@86YD(')E861S('1H92!F;VQL;W=I;F<@9BP`\`YS.@H@ +M("H@1TY5('1A"!I;G1E +M`*935E(T($%30TE)%``"8P`/,@`%84)I;F%R>2X`\P<@*&)I9RUE;F1I86X@ +M;W(@;&ET=&QE$0`"^@#P'TE33SDV-C`@0T0M4D]-(&EM86=EFEP,A8`!&0!32],6E<=`*)L>FUA+"!L>FEP$P,O>'HC```9-!0`"0@! +ME6-A;B!C&-E<'0"`D0*("`@:0+1 +M('1H870@P`!S@`4=G<&$G.C`%0@;VYL>0H#0&UE +M;G2R``$>`P"F!`(,`C`@8F5``'%R96%D86)L``9!=W)I=`P`$&$,`0($`0!H +M``([`$)E86-H/0$A=F5S`Q-Y0P!0:6YD97"J`")N='\`$'([!``$`#!T:6-" +M!21O;H$!!*X`\`!7:6MI(&5X<&QA:6YI;F>)`#!H;W?X``&S`Q!DE@4#+``" +M*@$A3VX_"!PL`P$`!`0R;6%T<`!`;'=A>48!`-T!*F5DB@@"1P"P22=V92!A +M='1E;7",!^!T;R!M:6YI;6EZ92!S=+4(`E((4'!O;&QUN`'A+B`@268@>6]U +M(&1O;B?L`0"V`/$":6-I=&QY(&EN=F]K92!A('#K`"!U;+T(H&5A='5R92`H +MD`!RT`!$4'`R("`ID!<"DL(&ET('=P`.`@9V5T('!U;&QE +M9"!I;J0$-R!);FX`-RP@:9X``5$!`YL`(F5NR0$'+0``?``+<0`H9&41``.J +M`!$L\``"@``B;F6.`@`6`0!``'%A9V%I;G-TSP&18V]RP,Q:65SPP`!;P,!;P=16QE(&%P<')OR`,`@0L"^@#@=&\@:&%V92!M=6QT:7`E``-3!`(! +M!`#\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CQ!$%A8F]U4P41]!9!I;@IA(&YU;6+R#!=FD0<# +MHP#7+@H*66]U('-H;W5L9*0+`$P`,6-O<'8&0&-O;6V>"`#.#1,B!0XR+F@B +MJ0`R:&4*7PP0(+`)`'4!`!0`!.D&`W((`G\"-&UO2X`P"`H8FEG +M+65N9&EA;J(!8VQI='1L91$``OH`\0))4T\Y-C8P($-$+5)/32!I;;<"$2AX +M""!O<,L#P&%L(%)O8VMR:61G944`8DIO;&EE="D!`>\!`DD`-%I)4'4$!$`` +M('5N3@DPB,``!DT%``)"`$```H"G!`%.@$`=00/!@$" +M`J\!`[\#`KP"#Q\#&#`B`3AN97>U`P#P!`#]`@.? +M`0![``&'"0$K%0)*#`!-$2)IE(7`+4(`E((07!O;&PV$@;D%$%D;VXG[`&0 +M97AP;&EC:71LV0EB=F]K92!A^@\18W\*`\X1("`HTA``=0P('`(08;(!`2<0 +M`BT`",T`%&]S!'`I+"!I="!W<`!0(&=E="#2$@%="@"D!#<@26YN``4F%P&> +M``%1`0.;`")E;LD!!RT``'P`"W$`*&1E$0`#J@`1+%@1`H```(T.`)8!`!8! +M`$``,&%G8?,/`5\*D6-O2!A;'-O(&1E=&5C=',@86YD(&AA;F1L90P` +M\!)Y(&]F('1H92!F;VQL;W=I;F<@8F5F;W)E(&5V86QU8702```@`/$-87)C +M:&EV93H*("`J('5U96YC;V1E9"!F:6QEFEP(&-O;7!R97-S:6]N%0!=8GII<#(6``0F`$TO3%I7'0"Q +M;'IM82P@;'II<"S'`"]X>B,``!DT%``)"`&58V%N(&-R96%TSP!/"!I;G1E&-E<'0@9F]J`/$'("!E;G1R:65S('1H870@.`?$#;F%M97,L($%#3',L(&5T8RDND@"P3VQD($=. +M52!T87)=``2I``+*`/$$;V-T970M;W)I96YT960@8W!I;S4`ME-64C0@(FYE +M=V,B%0`G`'@G;71R964GNP!X25-/ +M.38V,!,`6C) +M`#!H;W?X``+U``"6!0,L``(J`2%/;JH`'"P#`0/9`@)P`$!L=V%Y1@$`W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"!I="!W<`!Q(&=E="!P=9P-(&ENI`0W($EN;@`W+"!IG@`(FP`B96[)`02UV```S#`#W"!%IAP8`A`!P96YV:7)O;M<",7,@=Y`#`:`"$&W8 +M`1-R6@,%,`(`6P`"?P`1>7L#$7`U`-%A=&5V97(@8FQO8VMS\```[@@``S0*%82!S;V-K970^`TEW:7-HN@0!)@\#60\`4X.475S92`B(0$`6@@@+")0"+$L(&-A<&%B:6QI=/8"!`,! +M!?$``O,/`;<$"/8%`9P"`,D*`2L`,VEN("#U%F:7)S=)("`*8!$6%P$A%O61$`]@`6+G0``]D# +M`J60!`,P``*,!!H`% +M,7=A;G\%$G0=#P$V`@%;`P$:!!!TC@0#`',*T2!S87ES+@I2 +M14%$3442!@9)$>$@8G5N9&QE+@H*475E<_H"H#\@($ESF-% +M#A)B!P`2>`<``$D!`)()`"<`02H@97@;$T!S.B!3,@-4P``7P%Q875T:&]R<\`% +M`1\&`?("`,$3$B[M#U!T;W`M;`P$`\4,`#`'`4$`!.$7!K8""',5`.L%`>X/ +M\`4@*B!.15=3("T@:&EG:&QI9VAT<]P`,')E8]D4`C$%`Z`"DD-/4%E)3D<@ +M+0P%`$(4`,H'(F1OGP``AP4`S@"T*B!)3E-404Q,("V2&`&/!`$-``#Y%@"_ +M``(I``-`!1(M1!D`E0`"&``%=QDE("T,``)$``*W&54L('-E96<``"@%`JT7 +M`F,(@2H@0TUA:V5,U`0Q='ATB``A<'5G$#`@(F,T!A0BO!DY;V]L30`"5@$& +M-0$`E```L`H!C@$/;0$!`*(&#V0:________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________]G4'1O(&%L45J)ART1``#P(&QO +M=R!I;F1I=FED=6%L(&5N=')I97,*("`@=&\@8F4@2!D871A('-O=7)C93H@(%EO=2!C86X@8W)E871E/0"B82!B;&]C +M:R!O9BL`\05I;B!M96UO6]U('=A;H@`$G1=`!(O/0`#'P$`,P!09&ES:RQ. +M`/`07,N"E)%041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%8"`J\``!D#`/(`@&UA=',@=&%R+C54`0CQ!$%A8F]U +M4P4@P`3+/('`(H!@6AA``%4!%"`"X!!,BO0(R+F@B +MJ0"`:&4*2R"```[!P$C"4!A=71ODP8`_P(0><$",&5C=)D#$60Y"0,<`@5X +M"1!F+``!MP91*B!'3E5U`0(U`B(@**L)`+D!`!H`06QO;F=0!F)N86UE`@@;W#+`\!A;"!2;V-KFEP/@$Q:6]N&`%=8GII<#(6``1\`4TO3%I7'0"B;'IM82P@;'IIL``7\*`\X1 +M("`HTA`E(&'["@"A`2`@8>D``2<0`BT`",T`%&_Y"'`I+"!I="!W<`!!(&=E +M=!D3`5T*`*0$-R!);FX`-RP@:9X``5$!`YL`(F5NR0$'+0``?``+<0`H9&41 +M``/&`A$L\``"@```C0X`E@$`%@$`0``P86=A+@X!\0F18V]RP,B:67-#P&<$P/G"B!D=1D-`)\#$'.%`2-O9H@!`(X2$"UV```S +M#`#W"!%IM`\`A`!R96YV:7)O;@\+$7>0`P&@`A!MV`$3<3`<0-0&)A +M8VL>!#%F2W,`))E9"!O=71P=73O`@!@!/$#;V)J96-T+7-T +M>6QE(&%P<')OR`,`^10"^@#0=&\@:&%V92!M=6QT:<,3!*D``@$$`+D(52!O +M<&5NG@`3(!40`&H0``H!`#T%@VX@:71S(")`/``2(KT$$7,P#@)C!098`&!I +M='-E;&93`5!R96%D+^8`8'1E;B!U@``S0*% +M82!S;V-K970^`TEW:7-HN@0!)@\#60\`3``!(`1!HN`(`5P!#;VYG;U@'%R!, +M!R`@9%@6(&]P/`4(&1$$NA$!K`@!-PP`<0``.@`@;FLT`0'!``9S`$$@;6%I +MVQ(`^QD"H`,!_1D/9!K_________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_________________________UI0("!4:&44.]4X*A$``$%R92!A!`#W*G1I +M8VQE2W,`))E9"!O=71P=70&`>!4:&4@ +M;V)J96-T+7-T>1`"4'!P3 +M``!(`1!HN`*#9F]R(&]N9V]8!Q@@9`!P9&5V96QO<#P%<2P@:6YC;'6]!4!D +M;V-U%``087<`$"Q8!P!Q```Z`"%N:UT!`%T`!G,`4"!M86EL!P)";&ES=*`# +M,"H@5)D!`>H&0&%N(&FW`!`L(00!_``!#P"A('1R86-K97(@8&%) +M`$!S.B!3,@-40&";8"(FENU@0`<0L`ZP4$O0+P`DY%5U,@+2!H +M:6=H;&EG:'1S7`8P'2(`")P=;H+(")C-`81(B0#`!(+*6]L30`"5@$& +MZP,`E``!%@D`C@$/;0$!`&8(('5SW0H`V@$T90HGL``C92>M``-G`0"3``!. +M`/``+F%M+"!A8VQO8V%L+FTT"0T#[0`P+F%C_P```@`0+:("`)\`!*@``&H+ +M"*($82P@;VYL>=<+`GP`,6UA:?8!(V5RK@$%<``D:6YD`($N:"YI;@H)+?0' +M4FQA=&5S9P`18C0"`W(!`K4`8`H*1W5I9/,`*"!$5`8$T@$"=0`!MP%PP`(2PE`:&%R9!8,`3`&!%L!`4<``(X!86UO9&5R;H\``.@!`+P'<"!V87)I +M86Y("0":!3!M86[X"T%P86=E.```L!`D``$=`U=H+`#L'`2,)"=H1`,$",&5C=)D#$62V#P,<`@5X +M"1!F!A(!MP91*B!'3E5U`0(U`B8@*`0+`!H`(VQOO`4`K0LB+``-J`0`9`[$J(%!/4TE8('5S=+`1!!``#XH,`P%\``(Q`+!O8W1E="UO +M\!`DD`-%I)4'4$!$`` +M('5N,0L`[!,`UA!@"T4``("`+D%!(D1`FL4`$,.`-,3`%$``;$6`0`&@`0I:7-N%")B98@%`$`$`5X!.&YE=[4#`/`$`/T" +M`Y\!`'L``8<)`2L5`DH,`PH#`#@(`&\0%'3N$@(,`B$@8C<)`(P*`8\8`[@4 +M`0P`$&$,`0+4$`!H``([`!%EG!8`/0$A=F5S`Q-Y0P!0:6YD97"J`"5N="(! +M`$0-#V0:____________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________]C4&%N9"!RUWE3_3`1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A,&8P``P1`+9``&TQ(!,`,P9F%C*@<`/0`#`@`` +M*1`B;G1H`P`5`39S86V6`Q!AP!0`+0!7*B!C871I`"MA=&@`(7-ITA((M0!` +M=&]O;#,!`$```P(`('IC10X28@<`$G@'``!)`0"2"0`G`$$J(&5X&Q-`8$(&YDT`(Q9G5L+P(&10`0+T,* +M`84!$6&A"S1A8W1[$W!D96UO;G-T.14@;F<^``"`!094`@-)`#!C;VX%&&$Z +M("!687+N$V!I=&5MP``7P%Q875T:&]R<\`%`1\&`?("`,$3$B[M#U!T;W`M;`P$`\4,`#`' +M`4$`!.$7!K8""',5`.L%`>X/\`4@*B!.15=3("T@:&EG:&QI9VAT<]P`,')E +M8]D4`C$%`Z`"DD-/4%E)3D<@+0P%`$(4`,H'(F1OGP``AP4`S@"T*B!)3E-4 +M04Q,("V2&`&/!`$-``#Y%@"_``(I``-`!1(M1!D`E0`"&``%=QDE("T,``)$ +M``("&54L('-E96<``"@%`JT7`F,(@2H@0TUA:V5,U`0Q='ATB``A<'5G$#`@ +M(F,T!A0BO!DY;V]L30`"5@$&-0$`E```L`H!C@$/;0$!`"`-`1`:`=H!-&4* +M)[``(V4GKQD#)`0`DP``3@`/9!K_________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_________________________________U90("`@=&^SOU&I.Q$``/(V(&)E +M(')E860@;W(@=W)I='1E;B!T;R!A;GD@9&%T82!S;W5R8V4Z("!9;W4@8V%N +M(&-R96%T90H@("!A(&)L;V-K(&]F*P#Q!6EN(&UE;6]R>2!A;F0@861D(&ET +M3`#P!2!T87(@87)C:&EV92!W:71H;W5T00!19FER2!F:6QE+G0`0F%L6]U('=A;H@`$G1= +M`!(O/0``8``P:65S,P!09&ES:RQ.`/`,0#P*FES(&5S<&5C:6%L;'D@96%S>2X*"B`J($YO +M=&4Z(")P87@@:6YT97)C:&%N9V4@9F]R;6%T(B!I<^```#,``.(`<7AT96YD +M960X`0(B`!`L8P!`9&5S<-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H +M`&ES:6UP;&6U`$!T;V]L,P$`0``#`@!R>F-A="P@8@<`$G@'``!)`4!S=6-H +M)P!0*B!E>&%)`-1S.B!3;VUE('-M86QL%0`$/@$`O@'P`&%T('EO=2!M87D@ +M9FEN9-`",69U;"\"!D4`42]M:6YIA0$18>,!46%C="!S8`"A(&1E;6]N4$` +M(&EN^``(M@)P:6YF;W)M8:D!,"!F:34!`'P`\`LJ($Y%5U,@+2!H:6=H;&EG +M:'1S(&]F(')E8P8"5&-H86YGH`*T0T]064E.1R`M('=1`6)C86X@9&^?`#-T +M:&DI`/("24Y35$%,3"`M(&EN%#36%K94QI\`!,G +MK0`#)`0`DP``3@#U`2YA;2P@86-L;V-A;"YM-"SA`$!E+F%C_P```@`2+50` +M)'1OJ``,H@2R+"!O;FQY(&YE961\`#%M86GV`2-E7-T96TZ"B`J(+@$=2XQ(&5X<&R#`@,O`P!" +M`0(A``2:`P,S``"(!`\T``L`(@`,-0`O870T``PH870S``8!!H`N,R!G:79E +M2XS30`" +M]P,2(FL#!:L``20`4"(@=71II`59(&-L87-$``'O!49N86QSG0`P`D09BP``;<&42H@1TY5=0$" +M-0(B("BK"0"Y`0`:`$%L;VYG4`9B;F%M97,L$`!3;&EN:R`1``!C`%)S<&%R +M'1E;J+ +M``-J`0`9`]$J(%!/4TE8('5S=&%R6P`"$``R<&%X-`,"60<#>`('(0"P;V-T +M970M;W)I96X!`P!@`@$>`*%35E(T($%30TE)=`(!%``"4P`/,@`%84)I;F%R +M>2X`P"`H8FEG+65N9&EA;J(!8VQI='1L91$``OH`\0))4T\Y-C8P($-$+5)/ +M32!I;;<"$2AX""!O<,L#P&%L(%)O8VMR:61G944`8DIO;&EE="D!`>\!`DD` +M-%I)4%8#!$``('5N,0LPFEP +M,A8`!'P!32],6E<=`*)L>FUA+"!L>FEP$P,O>'HC```9-!0`"0@!```*56-R +M96%TSP`!=00/!@$"`JH#`[\#`KP"#Q\#&#`B&-E<$`%`+D%!&D"42!T:&%T0PXQ:7)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U`(2<^8%87)E`3AN97>U`P#P!`#]`@.?`0![``&'"0$K%0)*#`,*`P`X"`!O$!1T +M[A("#`(A(&(W"0","@&/&`.X%`$,`!!A#`$"U!``:``".P`199P6`#T!(79E +M4,`4&EN9&5PJ@`E;G0B`0!$#0%Y&0!"!1)O;`T&L`L/9!K_________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_________________________________________________________V50 +M=',Z"B#V/NS(,!$``/$-("H@1TY5('1A'1E;F1E9&0`!#-!0TPS`&%/;&0@5C"!I;G1E"=M=')E92<]`5HW+5II +M<"8`V$UI8W)O2!A;'-O(&1E=&5C='--`&!H86YD;&4,`'!Y(&]F('1HW`%` +M;&QO=Y("X&)E9F]R92!E=F%L=6%T$@``(``#+P(1.M0`8'5U96YC;W$"`+8" +M`D,"`0H`$2"#`:)24$T@=W)A<'!E3@)%9WII<#X!,6EO;D0`76)Z:7`R%@`$ +M9`%-+TQ:5QT`HFQZ;6$L(&QZ:7`3`R]X>B,``!DT%``)"`&58V%N(&-R96%T +MSP!/&-E<'0"`D0*("`@:0+1('1H870@P`!S@`0=IL$`#4'$G.C`%0@;VYL>0H#0&UE;G2R +M``$>`P"F!`(K`#`@8F5``'%R96%D86)L``9!=W)I=`P`$&$,`0($`0!H``([ +M`$)E86-H/0$A=F5S`Q-Y0P!0:6YD97"J`")N='\`$'([!``$`#!T:6-"!21O +M;H$!!*X`\`!7:6MI(&5X<&QA:6YI;F>)`#!H;W?X``&S`Q!DE@4#+``"*@$A +M3VZJ`!PL`P$`!`0R;6%T<`!`;'=A>48!`-T!\@%E9"!A=71O;6%T:6-A;&QY +M1P"P22=V92!A='1E;7",!^!T;R!M:6YI;6EZ92!S="L``E((4'!O;&QUN`'A +M+B`@268@>6]U(&1O;B?L`0"V`/$":6-I=&QY(&EN=F]K92!A('#K`"!U;+T( +MH&5A='5R92`HD`!RT`!$4'`R("`ID!<"DL(&ET('=P`.`@ +M9V5T('!U;&QE9"!I;J0$-R!);FX`-RP@:9X``5$!`YL`(F5NR0$'+0``?``+ +M<0`H9&41``.J`!$L\``"@``B;F6.`@`6`0!``'%A9V%I;G-TSP&18V]RP,Q:65SPP`!;P,!;P=16QE(&%P<')OR`,`R0@"^@#@=&\@:&%V92!M=6QT +M:7`E``-3!`(!!`"Y"%4@;W!E;IX`4"`@8G-D(P2!F)M96UO +M7,"!8P``0`"\05R;W9I9&4@96%S>2UT;RUU0#`*8.T"!S87ES+@I214%$346[!@?H!N$@8G5N9&QE +M+@H*475E<_H"H#\@($ES7!1`GH@1`9W)A;18"&%)`$!S.B!3,@-4`0-)`#!C;VY#`O`".B`@5F%R:6]UP``7P%Q875T +M:&]R<\`%`1\&`?("`-(1$B[M#U!T;W`M;`P$`\4,`#`'`4$`$&GD!@FV`B)I +M;M8$`*0*`.L%!+T"\`).15=3("T@:&EG:&QI9VATT3`A@`8&-O;F9I9WX+%2T,``)$ +M`+5S8W)I<'0L('-E96<``"@%9&1E=&%I;,,$84--86ME3-0$,71X=(@`(G!U +MU@T@(F,T!A$B)`,`.`PI;VQ-``)6`0;K`P$I`0`6"0".`0]M`0$`L`P0=3T3 +M`=H!-&4*)[``(V4GK0``.@\P("H@DP``3@#P`"YA;2P@86-L;V-A;"YM-`D- +M`^T`,"YA8_\```(`$"VB`@"?``2H``#9#@BB!!(L&@X`UPL`60L0>PH"MP(`318A86R)!T!S97%U +MZ@@0=&%R+C54 +M`0CQ!`4^$A%SU@TQ<&]PY0\#G`$$>P`(2PE`:&%R9!8,`3`&`J@!`X42`(X! +M86UO9&5R;H\``.@!`+P'<"!V87)I86Y("0`B##!M86[X"Q%PK1]!;!I;@IA(&YU;6)E"`"X!!,BXP`R+F@BJ0`R:&4*7PP0 +M(+`)`/H``!0`!.D&`W((`G\"$&T:%P/[`$(N("!0B@FR;&5T('5S"FMN;W<0 +M`0&9!F!E`D09@82`;<&`H<8!JH+#V0:____________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________________________]94%-O +M;64@(HLUAC01``#T)G-M86QL(&5X86UP;&4@<')O9W)A;7,@=&AA="!Y;W4@ +M;6%Y(&9I;F0@=7-E9G5L+@H@("`J,`#R!W,O;6EN:71A2!T:&ER9"!P87)T:65S +M.X,``P(`87!L96%S948``'L`\BET:&4@875T:&]R2!Q=65S +M=&EO;G,N"@I4:&4@=&]P+6QE=F5L(&1I4$`(&EN^`"`92!F;VQL +M;W>V`'!I;F9O'2(`#%P=70I`/D#(F-M86ME(B!B +M=6EL9"!T;V]L30`"5@$&-0$!*0$Q(&EN3`$/;0$!,&%R91`"$F3:`35E"B>\ +M`!,GK0`#9P$`DP``3@#U`2YA;2P@86-L;V-A;"YM-"SA`$!E+F%C_P```@`2 +M+50`)'1OJ```(`$P9&ES7P(0=4$!LBP@;VYL>2!N965D?``Q;6%I]@$C97)< +M`05P`"1I;F0`\@,N:"YI;@H)+2!T96UP;&%T97-G`!%B-`(!9@$39;4`8`H* +M1W5I9/,`DB!$;V-U;65N=($!`,4!,F%L;'4``/,!]0H@'!L@P(#+P,`0@$"(0`$F@,#,P!/8W!I;S0`"P`B``PU`"]A +M=#0`#"AA=#,`!ZT#\`0S(&=I=F5S(&%N(&]V97)V:65W\P(`H`#P`6QI8G)A +M`?$#+@H*66]U('-H +M;W5L9"!A;'-O(@(!3``Q8V]P=@8R8V]M6P%#:6X@(KT",BYH(JD`@&AE"G-O +M=7)C+P`19'4!`!0`!.D&!30'`"P%-&UO<$",&5C=)D#$635``,<`@7"!A!F+``!MP91*B!' +M3E5U`0*Z`28@*+D!`!H`06QO;F=5`F)N86UE'1E;J+``-J`0`9`]$J(%!/4TE8('5S=&%R6P`"$``P<&%X20,B97)9!P-X`@FEP,A8`!'P!32],6E<=`*)L>FUA+"!L>FEP$P,O>'HC```9-!0`"0@! +M```*56-R96%TSP`!=00/!@$"`JH#`[\#`KP"#Q\#&#`B&-E<$`%`+D%!&D"`A4,<7)E +M<75IP`#GP$`>P`! +MAPD!HP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=69F97(@;W+!``!E``1R +M`3!A(',K`5%T+"!I9@(!8'=I2UT;RUU`@#1```V`:!T;R!A;GD@9&%T +MUP!6=7)C93HN`5%C`@&^``7+`0#3``.C`4,N("!) +MI`$A86Z(`!)T70`#10$`8``0:84"86\@9&ES:RP#`\0!N6-O;G9E;FEE;F-E +MP`$`B0`P;6%K>0#1:7,@97-P96-I86QL>=`!`JH!\P].;W1E.B`B<&%X(&EN +M=&5R8VAA;F=E(&9O7,N"E)%041-12X``$0$!&T!T6)U;F1L92X* +M"E%U97/Z`J`_("!)3``!( +M!!!HN`*P9F]R(&]N9V]I;F`<``$D!0'-U +M8V@G`%`J(&5X84D`0',Z(%,R`U1S;6%L;!4`!#X!`%(#(6%T(`8@;6'F!"!N +M9-`",69U;"\"!D4`42]M:6YIA0$18>,!46%C="!S8`"P(&1E;6]N0&";8"(FEN^`0B:6_A +M!@2]`O`"3D574R`M(&AI9VAL:6=H='-M``,D!`"3``!.`/4!+F%M+"!A8VQO8V%L+FTT+.$`0&4N86/_ +M```"`!`MH@(`GP`$J``,H@2R+"!O;FQY(&YE961\`#%M86GV`2-E'!L@P(#+P,`0@$"(0`$ +MF@,#,P``B`0/-``+`"(`##4`+V%T-``,*&%T,P`&`08A+C.V"Q!SWP:`;W9E +M"P!Q!3!W:&^1`A0JI`J%7W)E860N,RP0``'X"`T1`%%? +M9&ES:Q8``GX'`X(%`3X``QP``)D``7L*`K<"$F6@#`!;!!!SU`80;A$,`-8" +M`),``'4``!<"`/D$`7$``7$*")<``#P),WDN,TT``.\$,F4@(FL#!:L``20` +M%"(+"UD@8VQA``'<`%`D09BP``;<&42H@ +M1TY5=0$"-0(F("@$"P`:`$%L;VYG4`8`K0LB+``-J`0`9 +M`]$J(%!/4TE8('5S=&%R6P`"$``/B@P#!R$`P&]C=&5T+6]R:65N=!<$,7!I +M;QX`IE-64C0@05-#24D4``)3``\R``5A0FEN87)Y+@#`("AB:6B,``!DT%``)"`$```H"G!`%.@$`=00/!@$"`J\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4`T6%T979E2W,`))E9"!O +M=71P=73O`@!@!/$#;V)J96-T+7-T>6QE(&%P<')OR`,`R0@"^@#0=&\@:&%V +M92!M=6QT:3$,!*D``@$$`+D(52!O<&5NG@`3(!40``80``H!`#T%@VX@:71S +M(")`/``2(KT$$7,P#@)C!098`&!I='-E;&93`0!]!!`O=@1@=&5N('5S;P8% +M<@%`9G5N8Z4*`C0"`"$-(F-A!00U(&%NB`0"9@U0;'D@9G)@``S0*%82!S;V-K970^`TEW:7-HN@0!)@\#60\` +M4X.475S92`B(0$`6@@@+")0"+$L(&-A<&%B:6QI +M=/8"!`,!!?$``O,/`;<$"/8%`9P"`,D*`2L`,VEN +M("#U%F:7)S=)("`*8!$6%P$A%O61$`]@`6 +M+G0``]D#`J60!`,P` +M`*,!!H`%,7=A;G\%$G0=#P$V`@%;`P$:!!!TC@0#`',*T2!S +M87ES+@I214%$3442!@9)$>$@8G5N9&QE+@H*475E<_H"H#\@($ES+%1`GD1(`\A$` +M%@)S82!F=6QL+98(!L30',Z(%,R`U1S;6%L;!4` +M!#X!`%(#(6%T'`@@;6'F!"!N9-`",69U;"\"!D4`$"]#"@&%`1%AH0LT86-T +M>Q-P9&5M;VYS=#D5(&YG/@``@`4&5`(#20`P8V]N!1AA.B`@5F%R[A-@:71E +M;7,@,P$`UP(@;64.&%)T:&ER9,\),&5S.\@``P(``^H"`$8``'L``%\!<6%U +M=&AOP`"-E)Z\9`R0$ +M`),``$X`CRYA;2P@86-L9!K_____________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_____________________________VI086YY(&1:8C!),!$``/`<871A('-O +M=7)C93H@(%EO=2!C86X@8W)E871E"B`@(&$@8FQO8VL@;V8@9"L`\!YI;B!M +M96UO8<`\01S +M;V-K970N("!)9B!Y;W4@=V%NB``2=%T`$B\]``!@`#!I97,S`%!D:7-K+$X` +M\`QR92!A2!E87-Y+@H*("H@3F]T93H@(G!A>"!I;G1E'1E;F1E9#@!`B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D +MK0$#V@`"*@$A3VX_"`#W#`)@!@#S#@!0!@/-``%P`%-L=V%Y'!L:6-I#16":6YV;VME(&'Z#Q%C?PH#SA$@("C2$"4@8?L* +M`*$!("!AL@$!)Q`"+0`(S0`4;W,$<"DL(&ET('=P`%`@9V5T(-(2`5T*`*0$ +M-R!);FX`,BP@:8(5`9X``5$!`YL`(F5NR0$'+0``?``+<0`H9&41``/&`A$L +MY0D"@```C0X`E@$`%@$`0``P86=A\P\!7PJ18V]R"(&5N=FER;VX/"Q%WD`,!H`(0;=@!$W):`P4P`@!;``)_`!%Y +M>P,1<#4`8F%T979E:89`@4.#V0:________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________]@4"`@*B!)&=+.F401``#Q$5-/.38V,"!F +M;W)M870*("`J(#2!O +M9B<`H69O;&QO=VEN9SI@`(%U=65N8V]D90T`\0%G>FEP(&-O;7!R97-S:6]N +M%0!=8GII<#(6``0F`$TO3%I7'0#Y`VQZ;6$L(&QZ:7`L(&%N9"!X>B,`P0I. +M;W1E7-T96TN("!4:&5R92P`@&YO +M(&1IF4@2!I;G9O:V4@82!PZP"` +M=6QA2!F +MP`28D(``"P$`-$``#8!(71O +M>`0#\`)N86UE('-A>7,N"E)%041-15``!^@&X2!B=6YD;&4N"@I1=65S^@*@ +M/R`@27-S=65S/U(`URH@:'1T<#HO+W=W=RX@!S!O3``!(`1!HN`*#9F]R +M(&]N9V]8!Q@@9`!P9&5V96QO<#P%<2P@:6YC;'6]!4!D;V-U%``!K`@!3@D` +M<0``.@`A;FM=`0!=``9S`%`@;6%I;`<"0FQIF-A="P@8@<`$G@'``!)`0"2"0`G`%`J(&5X84D`0',Z(%,R`U1S;6%L;!4` +M!#X!`%(#(6%T'`@@;6'F!"!N9-`",69U;"\"!D4`$"]#"@&%`1%AG@I186-T +M('-@`)(@9&5M;VYS=')*#0`I!B=O9EX!`TD`,&-O;D,"\`(Z("!687)I;W5S +M(&ET96US(#,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+@"Q("AB:6`@@ +M;W#+`\!A;"!2;V-K[`@0]`5HW+5II<"8`V$UI8W)OFEP/@$@:6]/$WTJ(&)Z:7`R%@`$?`%-+TQ: +M5QT`HFQZ;6$L(&QZ:7`3`R]X>B,``!DT%``)"`$```H"G!`%.@$`=00/!@$" +M`J\!`[\#`KP"#Q\#&#`B\+`OH#`*D"`&@1`HT``9L!`MH`#\@#"F$B;F5W +M8R*;`P$S`"=S:+```1(`#T8#8P0%!`?.``]9`P`*%@,S5VAE`P(`OP@#U`(2 +M<^8%87)E`3AN97>U`P#P!`#]`@.? +M`0![``&'"0$K%0)*#`,*`P`X"`!O$!1T[A("#`(A(&(W"0","@&/&`.X%`$, +M`!!A#`$"U!``:``".P`199P6`#T!(79E4,`4&EN9&5PJ@`E;G0B`0!$ +M#0%Y&0!"!1)O;`T&L`M4(%=I:VE2#`,,$S!H;W=1#P&S`Q!DK0$#V@`"]Q,% +M-!@$_`0`\PX`4`8#S0`!<``"@!<"Q`4/9!K_________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_________________________________________QY0=61I;F?\MV+.+A$` +M`/(%($=.52!L;VYG(&9I;&5N86UE'1E;F1E9"!T87(@9F]R;6%T("AI;F-L +M=61I;F<@04-,,P!A3VQD(%8W)P"!87)C:&EV97-+`+=03U-)6"!U2!O9B!T:-P!0&QL;WFEP,A8`!&0!32],6E<=`*)L>FUA+"!L>FEP +M$P,O>'HC```9-!0`"0@!E6-A;B!C0`&EP"0:7,@9&5S:6=NH@9";R!B98@%`$`$`3`$.&YE=[4#`*,$`'L``4,`4&EN +M9&5PJ@`B;G1_`!!R.P0`!``P=&EC0@4D;VZ!`02N`/``5VEK:2!E>'!L86EN +M:6YGB0`P:&]W^``!LP,09)8%`RP``BH!(4]NJ@`<+`,!``0$,FUA='``0&QW +M87E&`0#=`?(!960@875T;VUA=&EC86QL>4<`L$DG=F4@871T96UPC`?@=&\@ +M;6EN:6UI>F4@2!I;G9O:V4@82!PZP`@=6Q9"*!E871U``%1`0.;`")E;LD!!RT``'P`"W$`*&1E$0`#J@`1+/```H``(FYE +MC@(`%@$`0`!Q86=A:6YS=,\!D6-OP,1<#4` +MT6%T979E +M`%`@(&)S9",'(75SO`$`/06#;B!I=',@(D#E`!(BO01&"2`L(E`(<"P@8V%P86)!``'V`@)F!A%E50(! +M\0!A92!!4$ESMP0(]@4!EP&Q(&EN9&EV:61U86QH!1%I0@@`>P`28D(``$X& +M`-$``#8!(71OFPDP9&%TUP!6=7)C93HN`0+("0#"`!)A[`(`R0H!*P`S:6X@ +M)P$`.`LS861DC@(88?<,`=<'(6]U]P119FER0"0:7,@97-P96-I;@0!T`$"J@$`.@@P.B`BDPH. +MV@T3(KD"(&QL/`$"Z`(`I0<`$0,"P040+&,`0&1E%EF-%#A)B!P`2>`<``$D!`)()`"<`4"H@ +M97AA20!`8$(&YDT`(Q9G5L +M+P(&10`0+T,*`84!$6&>"E%A8W0@'2(`")P==8-(")C-`81(B0#`#@,*6]L30`" +M5@$&ZP,!*0$`%@D`C@$/;0$!`+`,$'4]$P':`31E"B>P`"-E)ZT``#H/,"`J +M(),``$X`\``N86TL(&%C;&]C86PN;30)#0/M`#`N86/_```"`!`MH@(`GP`$ +MJ```V0X(H@02+!H.`-<+`%D+$'G*!0'V`2-EH($',+!0$^`0!U```7`@#Y!`%Q +M``%Q"@B7```\"3!Y+C/T%#!A:6SO!#)E(")K`P6K``$D`!0B"PM9(&-L87-$ +M``$?"49N86QSG0`2!Q(M@@0U=H+`#L'`2,)"=H1`,$"!;47`/<"`QP"!7@) +M$&8&$@&W!@*'&`:J"P@`&@#X%0]D&O______________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________95!T:&%T(&%96PM!$0``\2AY +M;W4@;6%Y(&9I;F0@=7-E9G5L+@H@("`J(&5X86UP;&5S+VUI;FET87(Z(&$@ +M8V]M<&%C="!S&P#@(&1E;6]NP#R*71H92!A=71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9V5T(-(2 +M`5T*`*0$-R!);FX`,BP@:8(5`9X``5$!`YL`(F5NR0$'+0``?``+<0`H9&41 +M``/&`A$LY0D"@```C0X`E@$`%@$`0``P86=A\P\!7PJ18V]R"(&5N=FER;VX/"Q%WD`,!H`(0;=@!$W):`P4P`@!; +M``)_`!%Y>P,1<#4`8F%T979E:89`@4.%CHN`0+("0`]``]D&O______________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________9U`@87)C +M:+!C1.Q"$0``\0)I=F5S"B`@*B!805(@87)C:!$`Y0I7:&5N(&-R96%T:6YG +M&`#Q&2P@=&AE(')EFUA+"!L>FEP+"!A;F0@>'HC`,$*3F]T +M97,@86)O=724`')L:6)R87)YT0#P+G1E8W1U2!S=')E86TM;W)I96YT960@P`#MP$`>P!";6%T2!R97%U:7)E;65N +M=+(`,G1H80D!`BL`("!BCP&0(')E861A8FQEH@!!=W)I=`P`$&$,`0($`0!H +M``([`$)E86-H/0&#=F4@96YT$N("!)9B!Y;W4@9&]N)^P!`+8`\0)I8VET;'D@:6YV;VME(&$@<.L`@'5L +M87(@9F5A60)`("AS=2\!&7,<`A!AZ0`'+0`'!@,`@`$"F0%P*2P@:70@=W`` +M\``@9V5T('!U;&QE9"!I;BX^`"=);FX`-RP@:9X``5$!`YL`(F5NR0$'+0`` +M/@`+<0`H9&41``/&`A$L\``"@``B;F6.`@`6`0!``&)A9V%I;G-'`J!C;W)R +M97-P;VYD)P0(20`-6@`">P,Q:65SPP`!;P.P86QS;R!R961U8V6;`C!E('.% +M`2-O9H@!`+,!$"UV`&%E9"!B:6X]`"`@:2P$@"!E;G9IP,1<#4`T6%T979E8!(71O +M(@`%2@!A="!O;F-EA0`A3VZ0`QMEPP`"Y`(R<')O.@$!A0%18W1L>2W,`))E +M9"!O=71P=73O`@!@!/$#;V)J96-T+7-T>6QE(&%P<')OR`,`H`4"^@#@=&\@ +M:&%V92!M=6QT:7`E``-3!`(!!``B!E4@;W!E;IX`L2`@8G-D=&%R('5SO`$` +M/06#;B!I=',@(D#E`!(BR`-&P"`*`'`2L`,VEN("8<``J,!!H`% +M,7=A;H@`$'0V!`5%`0!@`!!IA0(`C@%EB!$!G&%)`$!S.B!3,@-4`0-)`#!C;VY#`O`".B`@5F%R:6]UP``7P%V +M875T:&]R,&`4D!A69I9W5R92`M#``" +M1`"U'2(`")P +M==8-(")C-`81(B0#`#@,*6]L30`"5@$&ZP,!*0$`%@D`C@$/;0$!`*(&('5S +MW0H`V@$T90HGL``C92>M``,D!`"3``!.`/``+F%M+"!A8VQO8V%L+FTT"0T# +M[0`P+F%C%P$``@`0+:("`)\`!*@``-D."*($$BP:#@#7"P)\`#%M86GV`2-E +MPH"MP(29:`,`!(&0'-E<77J"!!S"P4! +M/@$`=0``%P(`^00!<0`!<0H(EP``/`DS>2XS30``[P0R92`B:P,%JP`!)``4 +M(@L+62!C;&%S1``!'PE&;F%L]!9!I;@IA(&YU;6+R#!=FD0<$.P''"@I9;W4@2X`L2`H8FEG+65N9&EAU!%C;&ET=&QE$0`"^@#Q`DE33SDV-C`@0T0M +M4D]-(&EMMP(0*#@.,"!O<,L#P&%L(%)O8VMR:61G9>\! +M`DD`-%I)4'4$!$``('5N,0L`)18`UA!@"T4``("`+D%!(D1`@L7`UH7 +M`5$`!>D2,',@*%,*`30$`(0!`S,$`/0#8"P@971C*>\+`OH#`*D"`&T``HT` +M`9L!`MH`#\@#"F$B;F5W8R*;`P$S`"=S:+```1(`#T8#8P0%!`?.``]9`P`* +M%@,/9!K_____________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_____________U-0("!I;G0:SA?#3!$``/,[97)N86P@4P`T&-P:6\N +M-2P@;71R964)``!O`/(*=&%R+C4@<')O=FED92!D971A:6QE9"!I;E(`D&EO +M;B!A8F]U=$T`XW-E"B`@('!O<'5L87(@F``2("D`\PIS+"!I;F-L=61I;F<@ +M:&%R9"UT;RUF:6YD5``2F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z("!687+N$V!I=&5M +M$0(8`&!C;VYF:6>R%A4M#``"1`"UM`Q$SM@L`$!20(&]V97)V:65W\P(`JP`%P`L`<04P=VAOD0(4 +M*J0*A5]R96%D+C,L$``!^`@-$0!17V1I2!F;W(@:L`D'-A;64@ +M9G5N8S`<``$D!0'-U8V@G`%`J(&5X84D`U',Z(%-O;64@ +M6]U(&UA>2!F:6YD('5S969U;"\"!D4`42]M +M:6YIA0$18>,!46%C="!S8`"A(&1E;6]N2#R`I!I;VYS +M+@H*5&B=`?("<"UL979E;"!D:7)E8W1O%#36%K94QI +M\`!,GK0`#)`0`DP``3@#U`2YA;2P@ +M86-L;V-A;"YM-"SA`$!E+F%C_P```@`2+50`)'1OJ``,H@2R+"!O;FQY(&YE +M961\`#%M86GV`2-E7-T96TZ"B`J(+@$=2XQ(&5X<&R#`@,O`P!"`0(A``2:`P,S``"(!`\T``L` +M(@`,-0`O870T``PH870S``;V!8`N,R!G:79E2XS30`"]P,2(FL#!:L``20`4"(@=71I +MI`59(&-L87-$``'O!49N86QSG0`P`D09BP``;<&42H@1TY5=0$"-0(B("BK"0"Y`0`:`$%L;VYG +M4`9B;F%M97,L$`!3;&EN:R`1``!C`%)S<&%R'1E;J+``-J`0`9`]$J(%!/4TE8('5S +M=&%R6P`"$``R<&%X-`,"60<#>`('(0"P;V-T970M;W)I96X!`P!@`@$>`*%3 +M5E(T($%30TE)=`(!%``"4P`/,@`%84)I;F%R>2X`P"`H8FEG+65N9&EA;J(! +M8VQI='1L91$``OH`\0))4T\Y-C8P($-$+5)/32!I;;<"$2AX""!O<,L#P&%L +M(%)O8VMR:61G944`8DIO;&EE="D!`>\!`DD`-%I)4%8#!$``('5N,0LPFEP,A8`!'P!32],6E<=`*)L>FUA +M+"!L>FEP$P,O>'HC```9-!0`"0@!```*56-R96%TSP`!=00/!@$"`JH#`[\# +M`KP"#Q\#&#`B&-E<$`%`+D%!&D"42!T:&%T0PXQ:7)E40`!\P,!R@(@("@6!0$T!`"$ +M`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!^!T;R!M +M:6YI;6EZ92!S="L`L"!L:6YK('!O;&QUN`'A+B`@268@>6]U(&1O;B?L`0"V +M`/$":6-I=&QY(&EN=F]K92!A('#K`"!U;%D(H&5A='5R92`HD`!RT`!$4'`R("`ID!<"DL(&ET('=P`.`@9V5T('!U;&QE9"!I;J0$-R!) +M;FX`-RP@:9X``5$!`YL`(F5NR0$'+0``?``+<0`H9&41``.J`!$L\``"@``B +M;F6.`@`6`0!``'%A9V%I;G-TSP&18V]RP,Q:65S +MPP`!;P,!;P=16QE +M(&%P<')OR`,`R0@"^@#@=&\@:&%V92!M=6QT:7`E``-3!`(!!`#\"E4@;W!E +M;IX`4"`@8G-D(P2!F)M96UO7,"!8P``0`"\05R;W9I +M9&4@96%S>2UT;RUU0#`',* +MT"!S87ES+@I214%$346[!@?H!N$@8G5N9&QE+@H*475E<_H"H#\@($ES7!1`GH@1`9W)A;18"&%)`$!S.B!3,@-4 +M`0-)`#!C;VY#`O`".B`@5F%R:6]UP``7P%Q875T:&]R<\`%`1\&`?("`-(1$B[M +M#U!T;W`M;`P$`\4,`#`'`4$`$&GD!@FV`B)I;M8$`*0*`.L%!+T"\`).15=3 +M("T@:&EG:&QI9VATPH"MP(`318A86R)!T!S97%UZ@@0=&%R+C54`0CQ!`4^$A%SU@TQ<&]PY0\# +MG`$$>P`(2PE`:&%R9!8,`3`&`J@!`X42`(X!86UO9&5R;H\``.@!`+P'<"!V +M87)I86Y("0`B##!M86[X"Q%PK1] +M!;!I;@IA(&YU;6)E"`"X!!,BXP`R+F@BJ0`R:&4*7PP0(+`)`/H``!0`!.D&`W((`G\" +M$&T:%P/[`$(N("!0B@FR;&5T('5S"FMN;W<0`0&9!F!E`D09@82`;<&`H<8!JH+"``:`/@5#"`6`1````4+#V0:________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________________________]H4"`J(&5X +M7K0(.D01``#Q#&%M<&QEP#R*71H92!A=71H;W)S('=I=&@@86YY('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*B!.15=3("T@:&EG +M:&QI9VAT<]P`,')E8]D4`C$%`Z`"DD-/4%E)3D<@+0P%`$(4`,H'(F1OGP`` +MAP4`S@"T*B!)3E-404Q,("V2&`&/!`$-``#Y%@"_``(I``-`!1$M/``!%!0" +M&``"$QD`?@L5+0P``D0``@(952P@'2(`"%P=6<0,"`B8S0&$2(D`P`X#"EO;$T``E8!!C4!`2D!`!8)`(X! +M#VT!`0"B!@2I&51T:&4*)[``(V4GKQD#)`0`DP``3@#P`"YA;2P@86-L;V-A +M;"YM-`D-`^T`,"YA8_\```(`$"UD`@"?``2H``#9#@BB!!(L&@X`UPL`60L/ +M9!K_________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_________U5096UO7,N"E)%041-15``1"!L:6)M`=%B=6YD;&4N"@I1=65SK@"@/R`@27-S=65S +M/U(`UBH@:'1T<#HO+W=W=RXX`$`N;W)GDP``2`$Q:&]MIP"`(&]N9V]I;F`<``$D!0'-U8V@G +M`%`J(&5X84D`0',Z(%,R`U1S;6%L;!4`!#X!`%(#(6%T?`2`;6%Y(&9I;F30 +M`C%F=6PO`@9%`%$O;6EN:84!$6'C`5%A8W0@2#R`@`!!5`N"@I4:)T!,'`M;`P$`W8%,&]R>3$%,'1A:20%";8"(FENU@0Q +M:6]NZP4$O0+P"4Y%5U,@+2!H:6=H;&EG:'1S(&]F(')E8P8"`C$%`Z`"DD-/ +M4%E)3D<@+0P%`,T%`"@&(F1OGP``AP4`S@#R!"H@24Y35$%,3"`M(&EN\`!,GK0`#)`0`DP``3@#U`2YA;2P@86-L;V-A;"YM +M-"SA`$!E+F%C_P```@`0+:("`)\`!*@`#*($LBP@;VYL>2!N965D?``Q;6%I +M]@$C97*N`05P`"1I;F0`@2YH+FEN"@DM]`=2;&%T97-G`!%B-`(!9@$39;4` +M8`H*1W5I9/,`*"!$5`8$T@$"=0`!MP%P!1%E^P,`\@"`;6%T] +M!;!I;@IA(&YU;6)E2X`P"`H8FEG+65N9&EA;J(!8VQI='1L91$``OH`\0)) +M4T\Y-C8P($-$+5)/32!I;;<"$"@X#C`@;W#+`\!A;"!2;V-KFEP +M/@$Q:6]N!0%=8GII<#(6``1\`4TO3%I7'0"B;'IM82P@;'II\+`OH#`*D"`&@1`HT``88!`MH`#Y8#!0'(`V$B;F5W8R*;`P$S`"=S:+`` +M`1(`#T8#8P0%!`?.``]9`P`*%@,S5VAE`P((T0X"Y@5A4,`4&EN9&5PJ@`E +M;G0B`0!$#0`/#Q!C0@42;VP-!C4*5"!7:6MI4@P##!,P:&]W^``!LP,09*T! +M`]H``BH!(4]N/P@`]PP"8`8`\PX`4`8#S0`!<`!3;'=A>7-S""IE9(H(`D<` +ML$DG=F4@871T96UPC`L``7\*`\X1("`HTA`E(&'["@"A +M`2`@8;(!`2<0`BT`",T`%&]S!'`I+"!I="!W<`!!(&=E=!D3`5T*`*0$-R!) +M;FX`,BP@:8(5`9X``5$!`YL`(F5NR0$'+0``?``+<0`H9&41``/&`A$LY0D" +M@```C0X`E@$`%@$`0``P86=A\P\!7PJ18V]R"(&5N=FER;VX/"Q%WD`,!H`(0;=@!$W):`P4P`@!;``)_`!%Y>P,1 +M<#4`T6%T979E:89`@4.%CHN`0+("0`]`!)A[`(!@`X`T1DS:6X@)P$` +MCP(/9!K_____________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_____________V505VAE;B!$:$ZN-A$``/$J8W)E871I;F<@87)C:&EV97,L +M('1H92!R97-U;'0@8V%N(&)E(&9I;'1EFEP,A8`!"8`32],6E<=`/D#;'IM82P@;'II<"P@86YD('AZ(P#!"DYO=&5S +M(&%B;W5TE`!R;&EB=$`\"YT96-T=7)E.@H*("H@5&AI'!L86EN:6YGR0`P:&]W^``"]0`'+``"*@$A +M3VZJ`!PL`P$#^``"<`!`;'=A>48!`-T!\@%E9"!A=71O;6%T:6-A;&QY1P"P +M22=V92!A='1E;7#7`>!T;R!M:6YI;6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L('=H:6-H +M('=I;&R*``%6``:0`"!E>"T4``("`+D%!(D1`@L7`UH7`5$`!>D2,',@*%,* +M`30$`(0!`S,$`/0#8"P@971C*>\+`OH#`*D"!C`0`9L!`MH`#\@#"F$B;F5W +M8R*;`P$S`"=S:+```1(`#T8#8P0%!`);`0&)``]9`P`*%@,S5VAE`P(`OP@# +MU`(2<^8%#V0:________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________]34')A=&EO,WL/1TH1``#S'VXN"B`J(&QI8F%R8VAI +M=F4M9F]R;6%T4P`T&-P:6\N-2P@;71R964)`/(.86YD('1AP$R+F@BJ0"`:&4*2!E2QN``/2 +M`>`@875T;VUA=&EC86QL>68!065C='.H``#5``,<`E!O;&QO=Y,!$&8L`*!S +M.@H@("H@1TY5^`$`J`!6;6%T("BY`0`:`$%L;VYG50)B;F%M97,L$`!3;&EN +M:R`1``"T`5)S<&%R'1E;J+``-J`1%S2P"W4$]325@@=7-T87(0`.%P87@@:6YT97)C +M:&%N9WX!-VUA="$`L&]C=&5T+6]R:65N`0,`8`(!'@"A4U92-"!!4T-)270" +M`10``F,`#S(`!6%":6YAB,``!DT%``)"`&58V%N(&-R96%TSP`!=00/!@$"`NP" +M`[\#`KP"#Q\#&,$B2!S=')E86VU!>!S>7-T96TN("!4:&5R92P`(VYOX@<`@@(#WP@`DP3R +M`B!I;BUP;&%C92!M;V1I9FECK0CS`F]R(')A;F1O;2!A8V-E0`&@`3R +M`FES(&1EP`#P`! +MAPD!HP!4(&]N;'D*`P`X"`"R``$>`P"F!`(,`B$@8C<)<7)E861A8FP`!D%W +M48!`-T!*F5DB@@" +M1P"P22=V92!A='1E;7",!^!T;R!M:6YI;6EZ92!S=+4(`E((4'!O;&QU(@=1 +M+B`@26;U"$!D;VXGU@D`!RT`!"T'`,\*(&]R(P"@;6%T*2P@:70@=W`` +M@B!G970@<'5L^PH`I`0W($EN;@`W+"!IG@`(FP`B96[)`0P,1<#4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`[@4`0P`$&$, +M`0+4$`!H``([`!%EG!8`/0$A=F5S`Q-Y0P!0:6YD97"J`"5N="(!`$0-`7D9 +M`$(%$F]L#0:P"U0@5VEK:5(,`PP3,&AO=U$/`;,#$&2M`0/:``+W$P4T&`3\ +M!`#S#@!0!@/-``%P``*`%P+$!0]D&O______________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________5E!L97,I"MF.+50L$0``\"0@ +M("H@4V]L87)I"!I;G1E"=M=')E92<]`5HW+5II<"8`V$UI8W)O2!A;'-O(&1E=&5C +M='--`&!H86YD;&4,`'!Y(&]F('1HW`%`;&QO=RX"X&)E9F]R92!E=F%L=6%T +M$@``(``#+P(1.M0`8'5U96YC;W$",V9I;.@``0H`$2"#`:)24$T@=W)A<'!E +M3@)%9WII<#X!,6EO;D0`76)Z:7`R%@`$9`%-+TQ:5QT`L6QZ;6$L(&QZ:7`L +MQP`O>'HC```9-!0`"0@!E6-A;B!C$`6%N86UED#`*4#`.<#]A)U2!S=')E86VU!>!S>7-T96TN("!4:&5R92P`D&YO(&1I +M-R86YD +M;VT@86-C97-S+GD`!I<`D&ES(&1EU +M`P#<`P![``'.`!!VFP0`T082$N("!)9B!Y +M;W4@9&]N)^P!`+8`\0)I8VET;'D@:6YV;VME(&$@<.L`('5L60B@96%T=7)E +M("AS=2\!&7,<`A!AZ0`'+0`$10<#(@("F0%P*2P@:70@=W``X"!G970@<'5L +M;&5D(&ENI`0W($EN;@`W+"!IG@`!40$#FP`B96[)`07L#$7`U`-%A=&5V97(@8FQO8VMS\```[@2X'<70@82!T:6U7`W%O +M8!(71O(@`%H0!A="!O;F-EA0`A +M3VZ0`QMEPP`"Y`(R<')O.@$!A0%18W1L>2W,``"."5)U='!U=.\"`&`$\0-O +M8FIE8W0M2!B=69F +M97(@)`@`90`$<@&%82!S;V-K970^`TEW:7-HN@3`P"`,D*`2L`,VEN(">D``,P``*,!!H`%,7=A;H@`$'0V!`5%`0!@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N@0!)@\#60\`#B)A;N@"`*4'!C0*$"QC`$!D97-PWP``;`0!Y`,`7,N"B05 +M$6:X#01Q%K0@8G5N9&QE+@H*41$6H#\@($ESF-%#A)B!P`2>`<``$D!`)() +M`"<`02H@97@;$T!S.B!3,@-48$(&YDT`(Q +M9G5L+P(&10!1+VUI;FF%`1%AH0L`Z1D#>Q,/9!K_____________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_____________________________________________V507,@<')O9'5C97,@8V]R6]U('1O(&AA=F4@;75L=&EP)0`P +M`/,-("!B2!D8737`%9UX`0!V``*4 +M`0```P&^``7+`0#3``.C`4,N("!)I`$A86Z(`!)T70`!-@(491\!`#L!061I +M"!I;G1E&%)`$!S.B!3,@-4`0-)`#!C;VY#`O`".B`@ +M5F%R:6]UP``7P%Q875T:&]R<\`%`1\&`?("`DT'$`H5"%!T;W`M;`P$`W8% +M`#`'`4$`$&DD!0FV`B)I;O@$(FEOX08$O0+P`DY%5U,@+2!H:6=H;&EG:'1S +M7`8P'2(`#!P=71>`C`@(F,T!A$B)`,`J@2!N965D?``Q;6%I]@$C97*N`05P`"1I;F0`@2YH+FEN"@DM]`=2;&%T97-G +M`!%B-`(#<@$"M0!@"@I'=6ED\P`H($14!@32`0)U``#S`8`@PH"MP(A960N"P!;!!!SU`80;A$,`-8"`),``'4``!<"`/D$`7$``7$*")<` +M`9P)(RXS30``[P0R92`B:P,%JP`!)``4(@L+62!C;&%S1``!'PE&;F%L]!9!I +M;@IA(&YU;6+R#!=FD0<#HP#7+@H*66]U('-H;W5L9*0+`$P`,6-O<'8&0&-O +M;6V>"`#.#1,BR0TR+F@BJ0`R:&4*7PP0(+`)`'4!`!0`!.D&`W((`G\"-&UO +M@,QBH@4U92-"!!4T-)210``E,`#S(` +M!6%":6YA`@@;W#+`\!A;"!2;V-K[`@0]`5HW+5II<"8` +MV$UI8W)OFEP/@$Q:6]N +M&`%=8GII<#(6``1\`4TO3%I7'0"B;'IM82P@;'IIP`!APD!*Q4"2@P`31$B:7*"$1!I>0<# +M[A("#`(A(&(W"0","C%A8FP`!@","@$,`!!A#`$"U!``:``".P!"96%C:#T! +M(79E4,`4&EN9&5PJ@`E;G0B`0!$#0`/#Q!C0@42;VP-!K`+5"!7:6MI +M4@P##!,P:&]W40\!LP,09*T!`]H``O<3(4]N/P@`]PP"8`8`\PX`4`8#S0`! +M<``"@!<"Q`4J962*"`)'`'!))W9E(&%T(14`C`'!L:6-I=&S9"6)V;VME(&'Z#Q%C?PH# +MSA$@("C2$`!U#`@<`A!AL@$!)Q`"+0`(S0`4;W,$<"DL(&ET('=P`%`@9V5T +M(-(2`5T*`*0$-R!);FX`!287`9X``5$!`YL`(F5NR0$'+0``?``+<0`H9&41 +M``.J`!$L6!$"@```C0X`E@$`%@$`0``P86=A\P\!7PJ18V]R7L#$7`U`&)A=&5V97)X%Q%S\```[@ +M$P'Y%@*[&0"V`A!GQ!D0:2(3`2(`!4H``.,3#V0:____________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M______________________________________________](4'(*("`J9;G0 +MKS<1``#]#"!G>FEP(&-O;7!R97-S:6]N"B`@*B!B>FEP,A8`!"8`32],6E<= +M`/\#;'IM82P@;'II<"P@86YD('AZ(P``&304`/$R"E1H92!L:6)R87)Y(&-A +M;B!C"!I;G1E'1E;DT!\1-S +M("AF;W(@;&]N9R!F:6QE;F%M97,L($%#3',L(&5T8RDND@"P3VQD($=.52!T +M87)=``2I``+*`/$$;V-T970M;W)I96YT960@8W!I;S4`ME-64C0@(FYE=V,B +M%0`G +M`21E9-T`$2E%``"=``#5`85"4T0@)V%R)U(``1X`>"=M=')E92>[`'A)4T\Y +M-C8P$P!:-RU::7`Y`#9805(1`$,*5VAE`P(`Y`$$!0(1+/P!87)E0`& +MEP#R`FES(&1E'!L86EN:6YG +MR0`P:&]W^``"]0``C@0#+``"*@$A3VZJ`!PL`P$#V0("<`!`;'=A>48!`-T! +M\@%E9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;&PME@AR9"`G +M=&%R)P\!`0(`(7)EK0H!0@%`8G5I;($&`(H``V,``"H``J(3!F,``,$0"V0` +M!M,2`3`#,&9A8RH'`#T``P(``"D0(FYT:`,`%0$V!L30',Z(%,R`U1S;6%L;!4`!#X!`%(#(6%T'`@@;6'F +M!"!N9-`",69U;"\"!D4`$"]#"@&%`1%AH0LT86-T>Q-P9&5M;VYS=#D5(&YG +M/@``@`4&5`(#20`P8V]N0P)A.B`@5F%R[A-@:71E;7,@,P$`UP(@;67/%U)T +M:&ER9,\),&5S.\@``P(``^H"`$8``'L``%\!<6%U=&AOP`"-E)Z\9`R0$`),``$X`\``N86TL +M(&%C;&]C86PN;30)#0/M`#`N86/_```"`!`M9`(`GP`$J```V0X(H@02+!H. +M`-<+`%D+$'G*!0'V`0]D&O______________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________9U!C:&EV97UVJIXG$0``\#T@=VET:&]U +M=`H@("!F:7)S="!W2!F6]U('=A;H@` +M$G1=`!`OB@`196``,&EE7,N +M"E)%041-12X`1"!L:6(3`=%B=6YD;&4N"@I1=65SK@"@/R`@27-S=65S/U(` +MUBH@:'1T<#HO+W=W=RXX`$`N;W)GDP``2`$Q:&]MIP"`(&]N9V]I;F`<``$D!0'-U8V@G`%`J +M(&5X84D`0',Z(%,R`U1S;6%L;!4`!#X!`%(#(6%T?`2`;6%Y(&9I;F30`C%F +M=6PO`@9%`%$O;6EN:84!$6'C`5%A8W0@2#R +M`@`!!5`N"@I4:)T!,'`M;`P$`W8%,&]R>3$%,'1A:20%";8"(FEN^`0Q:6]N +MZP4$O0+P"4Y%5U,@+2!H:6=H;&EG:'1S(&]F(')E8P8"`C$%`Z`"DD-/4%E) +M3D<@+0P%`,T%`"@&(F1OGP``AP4`S@#R!"H@24Y35$%,3"`M(&EN\`!,GK0`#)`0`DP``3@#U`2YA;2P@86-L;V-A;"YM-"SA +M`$!E+F%C_P```@`0+:("`)\`!*@`#*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! +MG@`!40$#FP`B96[)`0"(&5N +M=FER;VX/"Q%WD`,!H`(0;=@!$W):`P4P`@!;``)_`!%Y>P,1<#4`T6%T979E +M:89 +M`@4.%CHN`0+("0`]`!)A[`(!@`X`T1DS:6X@)P$`104U861D'`$`_`@$J@$` +M>08/9!K_____________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M_____________V50FEP,A8`!"8`32],6E<=`/D#;'IM82P@;'II +M<"P@86YD('AZ(P#!"DYO=&5S(&%B;W5TE`#P.VQI8G)A2!R97%U:7)E;65N=+(`,G1H80D!`BL`("!BCP&0(')E861A +M8FQEH@!!=W)I=`P`$&$,`0($`0!H``([`$)E86-H/0&#=F4@96YT$N("!)9B!Y;W4@9&]N)^P!`+8` +M\0)I8VET;'D@:6YV;VME(&$@<.L`@'5L87(@9F5A60)`("AS=2\!&7,<`A!A +MZ0`'+0`'!@,`@`$"F0%P*2P@:70@=W``\``@9V5T('!U;&QE9"!I;BX^`"=) +M;FX`-RP@:9X``5$!`YL`(F5NR0$'+0``/@`+<0`H9&41``/&`A$L\``"@``B +M;F6.`@`6`0!``&)A9V%I;G-'`MEC;W)R97-P;VYD:6YGF`$-6@`">P,Q:65S +MPP`!;P.P86QS;R!R961U8V6;`C!E('.%`2-O9H@!`+,!$"UV`&%E9"!B:6X] +M`"`@:2P$@"!E;G9IP,1<#4`T6%T979E8!(71O(@`%2@!A="!O;F-EA0`A3VZ0`QME +MPP`"Y`(R<')O.@$!A0%18W1L>2W,`))E9"!O=71P=73O`@!@!/$#;V)J96-T +M+7-T>6QE(&%P<')OR`,`H`4"^@#@=&\@:&%V92!M=6QT:7`E```A!1!V$@,` +M!040<_@!16]P96Z>`+$@(&)S9'1A3X` +M!8P``0`"\05R;W9I9&4@96%S>2UT;RUUP"`*`'`2L`,VEN("0#\`)N86UE('-A>7,N"E)%041- +M15``!^@&X2!B=6YD;&4N"@I1=65S^@*@/R`@27-S=65S/U(`URH@:'1T<#H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`$66<%@`]`2%V9?P4#V0:____ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________]J4&EV97,*4!0``/`5"E1H92!L:6)R87)Y(&%LFEP +M,A8`!"8`32],6E<=`+%L>FUA+"!L>FEP+,<`+WAZ(P``&304``D(`95C86X@ +M8W)E873/`$]S(&EN!@$#`21E9-T`$2E%``"=``"<`H5"4T0@)V%R)U(``1X` +M>"=M=')E92>[`'A)4T\Y-C8P$P!:-RU::7`Y`#9805(1`$,*5VAE`P(`V`($ +M=0$1+`(#87)ED#`*4#`.<#]A)U2!S=')E86WM`>!S>7-T96TN("!4:&5R92P`\01N;R!D:7)E8W0* +M("`@`>-R86YD;VT@ +M86-C97-S+GD`!I<`\@)I4<`L$DG=F4@871T96UP +MQ`/@=&\@;6EN:6UI>F4@2!I;G9O:V4@82!PZP`@=6PW!*!E871U``%1`0.;`")E;LD!!RT``'P`"W$`*&1E$0`#Q@(1 +M+/```H``(FYEC@(`%@$`0`!B86=A:6YS1P*@8V]R7L#$7`U`-%A=&5V97(@8FQO8VMS\```[@2X'<70@82!T:6U7`W%O8!(71O(@`%H0!A="!O;F-EA0`A3VZ0 +M`QMEPP`"Y`(R<')O.@$!A0%18W1L>2W,``!(!E)U='!U=.\"`&`$\0-O8FIE +M8W0M2!B=69F97(@ +M)`@`90`$<@&%82!S;V-K970^`TEW:7-HN@3`P" +M`,D*`2L`,VEN(">D``,P``*,!!H`%,7=A;H@`$'0V!`5%`0!@``'Z"0".!S!S +M:RQ.`P-^!KEC;VYV96YI96YC9<`!`(D`,&UA:WD`D&ES(&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V92!A="T-`(P'`,$/D&EN:6UI>F4@2UV```S#`#W"!%IAP8`A`!P96YV:7)O;M<",7,@=Y`#`:`"$&W8`1-R +M6@,%,`(`6P`"?P`1>7L#$7`U`-%A=&5V97(@8FQO8VMS\```[@2X'<70@82!T +M:6U7`W%O8!(71O(@`%2@!2="!O +M;F-\$B)/;AP."\,``N0",G!R;SH!`84!46-T;'DMS`"2960@;W5T<'5T[P(` +M8`3Q`V]B:F5C="US='EL92!A<'!R;\@#`$,2`OH`X'1O(&AA=F4@;75L=&EP +M)0``(040=A(#0')E86W\"E4@;W!E;IX`$R`5$`!J$``*`0`]!8-N(&ET2!B=6@-$B`D"`!E``!Z``#-`H5A('-O8VME=#X#27=IP`2 +M8D(`!*P%`#8!(71OK`TP9&%TUP``!0X1.L$"`2X!`L@)`,(`$F'L`@!A`P$K +M`#-I;B`G`0"/`C-A9&2.`AAA]PP!UP<#'@]19FER>D` +M`,P``*,!!H`%,7=A;G\%$G0=#P-%`0!@```:!!!TC@A<"+```.P``!`,`2P+%1`G-Q,`)AD`%@)S82!F=6QL +M+98(F-%#A)B!P`2 +M>`<``'`$`)()`"<`%"I/&@]D&O__________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________________________65`@("!T;U04``#R-B!B +M92!R96%D(&]R('=R:71T96X@=&\@86YY(&1A=&$@F-A="P@8@<`$G@'``!)`4!S=6-H)P!0*B!E +M>&%)`$!S.B!3,@-4 +M`0-)`#!C;VY#`O`".B`@5F%R:6]UP``7P%Q875T:&]R<\`%`1\&`?("``$% +M4"X*"E1HG0$P<"UL#`0#=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("$`I;"0-I`@)K%`!##A!IE@4G87C*`B`@*'T'`30$`(0!`T0$`/0# +M8"P@971C*>\+`OH#`*D"`&@1`HT``9L!`MH`#\@#"F$B;F5W8R*;`P$S`"=S +M:+```1(`#T8#8P0%!`?.``]9`P`*%@,S5VAE`P(`OP@#U`(2<^8%87)EP`! +MAPD!*Q4"2@P#"@,0;?8-$&EY!P/N$@(,`B$@8C<)07)E862/&`.X%`$,`!!A +M#`$"U!``:``".P`199P6`#T!(79E_!03>4,`M6EN9&5P96YD96YT(@$`1`T! +M>1D`0@42;VP-!K`+#V0:________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________]H4&QL;W=I410``/$F;F<@8F5F +M;W)E(&5V86QU871I;F<@=&AE(&%R8VAI=F4Z"B`@*B!U=65N8V]D960@9FEL +M97,4``$*`/$"('=I=&@@4E!-('=R87!P97(;`/$!9WII<"!C;VUPFUA+"!L>FEP+"!A;F0@>'HC```9 +M-!0`]0<*5&AE(&QI8G)A"!I;G1E&-E<'0@9F]J`/$'("!E;G1R:65S('1H870@.`?$#;F%M97,L($%#3',L(&5T8RDND@"P +M3VQD($=.52!T87)=``2I``+*`/$$;V-T970M;W)I96YT960@8W!I;S4`ME-6 +M4C0@(FYE=V,B%0`G`'@G;71R964G +MNP!X25-/.38V,!,`6C2!S=')E86WM`>!S>7-T96TN("!4:&5R92P`\01N;R!D:7)E8W0*("`@`>-R86YD;VT@86-C97-S +M+GD`!I<`\@)I'!L +M86EN:6YGB0`P:&]W^``"]0``C@0#+``"*@$A3VZJ`!PL`P$#V0("<`!`;'=A +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I:VE2##!I;F?) +M`#!H;W?X``&S`Q!DK0$#V@`"*@$A3VX_"`#W#`)X!@#S#@!0!@/-``%P`%-L +M=V%YF4@'!L:6-I#16":6YV;VME(&'Z#Q%C?PH# +MSA$@("C2$"4@8?L*`*$!("!AZ0`!)Q`"+0`(S0`4;W,$<"DL(&ET('=P`%`@ +M9V5T(-(2`5T*`*0$-R!);FX`,BP@:8(5`9X``5$!`YL`(F5NR0$'+0``?``+ +M<0`H9&41``/&`A$LY0D"@```C0X`E@$`%@$`0``P86=A\P\!7PJ18V]RP,1<#4`8F%T979E2X'$'2B%R%I;5<# +M<6]R(&UM87`I`0!>$P'Y%@([`P"V`A!GPA<0:2(3`2(`!:$``.,3(6-EA0`A +M3VZ0`QMEPP`"Y`(R<')O.@$!A0$`FA"9"!O=71P=73O`@!@!/$# +M;V)J96-T+7-T>6QE(&%P<')OR`,`@0L"^@#@=&\@:&%V92!M=6QT:7`E```A +M!1!V$@-`:89`@4.%CHN`0+( +M"0#"``]D&O__________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________:E`*("H@3U(4``#XNFX@2!I +M;G9O:V4@82!P87)T:6-U;&%R(&9E871U!E('-O;64@=71I;&ET>3X`!8P` +M`+$!\09P2!D8737`%9U +MP"`&$#`2L`,VEN(""!I;G1E7,N"E)%041-15``1"!L:6)M`=%B=6YD;&4N"@I1=65S^@*@/R`@ +M27-S=65S/U(`UBH@:'1T<#HO+W=W=RXX`$`N;W)GDP``2`$0:+@"L&9O`<``$D!0'-U8V@G`%`J(&5X84D`0',Z(%,R`U1S;6%L +M;!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q\#&,$B,H"4B`H9F]R-`0`A`$#,P0`]`-Q+"!E=&,I+F\!`/H#`*D"!B($ +M`1<``MH`#\@#"F$B;F5W8R*;`P$S`"=S:+```1(`#T8#8P0%!`);`0&)``]9 +M`P`*%@,S5VAE`P(`V`(#U`(2<^8%87)EF4@7L#$7`U`-%A=&5V97(@8FQO8VMS\```[@2X' +M<70@82!T:6U7`P!K"S%M87#X`C!E;G21!@/0`@%1`T!G:79EY@$A=&\B``6A +M`&%T(&]N8V6%`"%/;I`#&V7#``+D`C)P`%`@(&)S9",'(75SO`$`/06#;B!I +M=',@(D#E`!(BO01&2!F4X.475S92`B(0$`6@@@+")0"'`L(&-A +M<&%B00`!]@("9@81954"`?$`864@05!)P" +M`,D*`2L`,VEN("#U%F:7)S=)("`*8!(&$@ +M0P41;U`'`/8`%BYT``/9`P*G`0"_``*<`0&%``:X`0!V``*4`0!*`P&3``(Q +M#R!L>60!`,P``*,!!H`%,7=A;G\%$G0=#P-%`0!@```:!!!TC@!L3 +M0',Z(%,R`U1S;6%L;!4`!#X!`%(#(6%T'`@@;6'F!"!N9-`",69U;"\"!D4` +M$"]#"@&%`1%AXP$T86-T>Q."9&5M;VYS=')*#0`.`R=O9EX!`TD`,&-O;D," +M83H@(%9AP``7P%C875T:&]R:1``EPT!\@(`P1,2+NT/4'1O<"UL#`0#Q0P`,`0&";8""',5`.L%`>X/\`4@*B!.15=3("T@:&EG:&QI9VAT\`!,GK0`#)`0`DP``3@#P`"YA;2P@86-L +M;V-A;"YM-`D-`^T`,"YA8_\```(`$"VB`@"?``2H``#9#@BB!!(L&@X`UPL` +M60L0>\%1FYA;'.=`!)S +M/@MA:6YS:6=H$08(F0<1)V<"!#<``&@1,'5C=+(#`*@`,&]P92L%`#0,"1X' +M$BU8"0]D&O__________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________5E!C="!S85<4``#T4VUP;&4@9&5M;VYS=')A +M=&EN9R!U4$`,6EN'2(`#%P=70I`/D#(F-M86ME(B!B=6EL9"!T +M;V]L30`"5@$&-0$!*0$Q(&EN3`$/;0$!,&%R91`"$F3:`35E"B>\`!,GK0`# +M9P$`DP``3@#U`2YA;2P@86-L;V-A;"YM-"SA`$!E+F%C_P```@`2+50`)'1O +MJ```(`&`9&ES=')I8G5!`;(L(&]N;'D@;F5E9'P`,6UA:?8!(V5R7`$%<``D +M:6YD`/(#+F@N:6X*"2T@=&5M<&QA=&5S9P`18C0"`68!$V6U`/($"@I'=6ED +M92!T;R!$;V-U;65N=($!`,4!,F%L;'4``/,!]0H@'!L@P(#+P,`0@$"(0"#('!R;V=R86TS`$]C<&EO-``+`"(`##4` +M+V%T-``,*&%T,P`'K0/P!#,@9VEV97,@86X@;W9E2!A``"/ +M`&<@)V1O8R>]!;!I;@IA(&YU;6)E2QN``5H`S!U=&^3!@#_`A!Y9@$P96-TF0,19-4``QP"!<(&$&8L``&W +M!E$J($=.574!`KH!)B`HN0$`&@!!;&]N9U4"8FYA;65S+!``4VQI;FL@$0`` +M8P!A@``0H``EP)HE)032!WFEP/@$Q +M:6]N,`!=8GII<#(6``1D`4TO3%I7'0"B;'IM82P@;'IIU`P#P!`![ +M``.?`0![``&'"0&C``)*#`,*`Q!M:P@0:7D'$F$)`0(K`"$@8C<)<7)E861A +M8FP`!@","@$,``$L"P($`0!H``([`$)E86-H/0$A=F5S`Q-Y0P!0:6YD97"J +M`"5N="(!`!@)``\/$&-"!1)O;`T&-0I4(%=I:VE2##!I;F?)`#!H;W>;#`&S +M`Q=DE@H"*@$A3VX_"`#W#`)X!@,#`0/X``&("5!A;'=A>48!`-T!*F5DB@@" +M1P!P22=V92!A="T-`(P'`,$/D&EN:6UI>F4@@M'("!);FX`-RP@:9X``5$!`YL`(F5NR0$'+0``/@`+<0`H +M9&41``/&`A$L\``"@```C0X`E@$`%@$`0``@86<##A%T\0F18V]RP,B:67-#P%O`P/G"C%D=6.Y!5%E('-I>H,1`H@!4&%L +M;'DM=@``,PP`]P@1:8<&`(0`<&5N=FER;V[7`C%S('>0`P&@`A!MV`$3`!,@%1``:A``"@$`/06#;B!I=',@(D#E +M`!(BO0012!F@``S0*%82!S;V-K970^`TEW:7-HN@1$!L30',Z(%,R`U1S;6%L;!4`!#X!`%(# +M`Q,9(&UAY@0@;F30`C%F=6PO`@9%`%$O;6EN:84!$6'C`31A8W1[$P]D&O__ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________:%!C:&EV94<4``#P/2!W:71H;W5T"B`@(&9I0#P*FES(&5S<&5C:6%L;'D@96%S>2X*"B`J($YO=&4Z(")P87@@:6YT +M97)C:&%N9V4@9F]R;6%T(B!I<^```#,`\P!A;B!E>'1E;F1E9"!T87(B`)`L +M"B`@(&1E7,N"E)%041-12X`1"!L:6(3 +M`=%B=6YD;&4N"@I1=65SK@"@/R`@27-S=65S/U(`UBH@:'1T<#HO+W=W=RXX +M`$`N;W)GDP``2`$Q:&]MIP"`(&]N9V]I;F6H`)V%T:0`K871H`&ES:6UP;&6U`$!T;V]L,P$` +M0``#`@!R>F-A="P@8@<`$G@'``!)`4!S=6-H)P!0*B!E>&%)`$!S.B!3,@-4 +M2!F:6YDT`(Q9G5L+P(&10!1+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5A7-$=.5U,`D#`/87`2L2"\`#`W`#`JT-*C4Z,0(#7P8!544` +M7@,!*0\095X)$7G=$0`]`@3N0S%S("@*"`(K'`(0"@8<``*>&$PQ34(I<0"@ +M36%R8W5S($=E:7T'`%8<`!\'`6<1`.,-`;)Z`[PZ!KD#`'D``SP!\PYX(H``$%\0FMT;W!?>P#J&0`O``;'``&%"0*5``!]``". +M!`+*%0`.``$T```J+P.W"P-1#V(U.B!07`F`Z2UW86QK6``!J!\`E@4"DP("70`#X"L1-6!A`/U#`+@'!%4` +M`3(``2%;$#N$(@"4``0/!0"*#`#2`11YHQ(0--(!(6YY*RH0+7<(`,4](6QE +M+P(!U!$`2#D!5@,!&U(#5@`@86PE#@`=`0'5'P/L%@$`&@4Q.P1S``0&.P2_ +M``!]``.'!Q$TBBL`I2H%FW@#;X3Q!2P@2%`M55@L(%5N:7AW87)E+"!S:2D` +JTRH"+@$`?@$1<#T``I(!`'P$'P`!`/______;U````````````",W%#R +` +end diff --git a/libarchive/test/test_compat_lz4_B5BD.tar.lz4.uu b/libarchive/test/test_compat_lz4_B5BD.tar.lz4.uu new file mode 100644 index 000000000000..5ad5469668ea --- /dev/null +++ b/libarchive/test/test_compat_lz4_B5BD.tar.lz4.uu @@ -0,0 +1,2310 @@ +begin 644 test_compat_lz4_B5BD.tar.lz4 +M!")-&&10"+,4``!O>&9I;&4``0!+X3`P,#8T-"``,#`P-S8U"``B,#(0`"(R +M,`$`_P<@,3(S-3,U-3,U,3(@,#$R,#(S`"`PEP!+`@(`KW5S=&%R`#`P8W4' +M`0M2,!46%C="!S8`"A(&1E;6]N4$`(&EN^``(M@)A:6YF;W)M&@00 +M(+@&!+T"\`E.15=3("T@:&EG:&QI9VATP`"-E)ZT``R0$`),``$X`]0$N86TL(&%C;&]C86PN;30L +MX0!`92YA8_\```(`$BU4`"1T;Z@`#*($LBP@;VYL>2!N965D?``Q;6%I]@$C +M97)<`05P`"1I;F0`\@,N:"YI;@H)+2!T96UP;&%T97-G`!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6+R#!=FD0<#'@'7+@H*66]U('-H;W5L9*0+`"@!,6-O<'8&0&-O;6V> +M"`#.#1,B!0XR+F@BJ0`R:&4*7PQ!(&-O9'4!`!0`!.D&`W((`G\"(6UOU@P" +M6@4R("!0B@FR;&5T('5S"FMN;W<0`0&9!G!E2X`L2`H8FEG +M+65N9&EAU!%C;&ET=&QE$0`"^@#Q`DE33SDV-C`@0T0M4D]-(&EMMP*`*'=I +M=&@@;W#+`\!A;"!2;V-KU`P$3`%HW+5II<"8`V$UI8W)OFEP,A8`!'P! +M32],6E<=`*)L>FUA+"!L>FEP$P,O>'HC```9-!0`"0@!```*`IP0!3H!`'4$ +M#P8!`@*J`P._`P*\`@\?`Q@P(G)EH`U18W1E9")'`P)/`,0L('=H:6-H('=I +M;&R*``%6``:0`"!E>"T4``("$`I;"0-I`E$@=&AA=$,.$&F6!2=A>,H"("`H +M?0`3AN97>U +M`P#P!`#]`@.?`0![``&'"0##%Q)E2@P`31%`:7)E;?8-$&EY!P/N$@(,`@,A +M&D%R96%DCQ@#N!0!#``080P!`M00`&@``CL`$66<%@`]`2%V9?P4#V0:____ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________]J4&EV97,*4!0``/`5"E1H92!L:6)R87)Y(&%LFEP +M,A8`!"8`32],6E<=`+%L>FUA+"!L>FEP+,<`+WAZ(P``&304``D(`95C86X@ +M8W)E873/`$]S(&EN!@$#`21E9-T`$2E%``"=``"<`H5"4T0@)V%R)U(``1X` +M>"=M=')E92>[`'A)4T\Y-C8P$P!:-RU::7`Y`#9805(1`$,*5VAE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FER>D` +M`,P``*,!!H`%,7=A;G\%$G0=#P-%`0!@```:!!!TC@A<"+```.P``!`,`2P+%1`G-Q,`)AD`%@)S82!F=6QL +M+98(F-%#A)B!P`2 +M>`<``'`$`)()`"<`%"I/&@]D&O__________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________________________65`@("!T;U04``#R-B!B +M92!R96%D(&]R('=R:71T96X@=&\@86YY(&1A=&$@F-A="P@8@<`$G@'``!)`4!S=6-H)P!0*B!E +M>&%)`$!S.B!3,@-4 +M`0-)`#!C;VY#`O`".B`@5F%R:6]UP``7P%Q875T:&]R<\`%`1\&`?("``$% +M4"X*"E1HG0$P<"UL#`0#=@4P;W)Y,04P=&%I)`4)M@(B:6[6!#%I;V[K!02] +M`O`"3D574R`M(&AI9VAL:6=H='-'2(`#!P=71>`C`@ +M(F,T!A$B)`-I9"!T;V]L30`"5@$&ZP,`%`=!'!L@P(#+P,`0@$" +M(0`$F@,#,P``B`0/-``+`"(`##4`+V%T-``,*&%T,P`&`0:`+C,@9VEV97/? +M!H!O=F5R=FEE=_,"`*``!+L%$&%Q!3!W:&^1`A0J[`B%7W)E860N,RP0``&[ +M"`T1`%%?9&ES:Q8``GX'`X0)`3X``QP``)D`$'9?`0*W`F%E9"!C86R)!Q!S +MU`9!;F-E``&I`5 +M"`"X!!,B?P(R+F@BJ0`R:&4*7PP0(+`)`'4!`!0`!.D&`W((`G\"-&UOFEP/@$Q:6]N +M&`%=8GII<#(6``1D`4TO3%I7'0"B;'IM82P@;'II\+`OH#`*D" +M`&@1`HT``88!`MH`#\@#"F$B;F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AT2XS30``[P0R92`B +M:P,%JP`!)``4(@L+62!C;&%S1``!'PE&;F%L`8`>P`(2PE`:&%R9!8,`3`& +M!%L!`4<``(X!86UO9&5R;H\``.@!`+P'<"!V87)I86Y("0!$!+%M86YU86P@ +M<&%G93@``#$.)')EI@``G@`!'0-7)V1O8R>]!9!I;@IA(&YU;6+R#!=FD0<# +M'@'7+@H*66]U('-H;W5L9*0+`"@!,6-O<'8&0&-O;6V>"`#.#1,B!0XR+F@B +MJ0`R:&4*7PQ!(&-O9'4!`!0`!.D&`W((`G\"-&UO2X`L2`H8FEG+65N9&EAU!%C;&ET +M=&QE$0`"^@#Q`DE33SDV-C`@0T0M4D]-(&EMMP*`*'=I=&@@;W#+`\!A;"!2 +M;V-KU`P$3`%HW+5II<"8`V$UI8W)OFEP,A8`!'P!32],6E<=`*)L>FUA +M+"!L>FEP$P,O>'HC```9-!0`"0@!```*`IP0!3H!`'4$#P8!`@*J`P._`P*\ +M`@\?`Q@P(G)EH`U18W1E9")'`P)/`,0L('=H:6-H('=I;&R*``%6``:0`"!E +M>"T4``("$`I;"0-I`@)K%`!##A!IE@4G87C*`B`@*'T'`30$`(0!`T0$`/0# +M8"P@971C*>\+`OH#`*D"`&@1`HT``9L!`MH`#\@#"F$B;F5W8R*;`P$S`"=S +M:+```1(`#T8#8P0%!`?.``]9`P`*%@,S5VAE`P(`OP@#U`(2<^8%87)EP`! +MAPD!*Q4"2@P#"@,0;?8-$&EY!P/N$@(,`B$@8C<)07)E862/&`.X%`$,`!!A +M#`$"U!``:``".P`199P6`#T!(79E_!03>4,`M6EN9&5P96YD96YT(@$`1`T! +M>1D`0@42;VP-!K`+#V0:________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________]H4&QL;W=I410``/$F;F<@8F5F +M;W)E(&5V86QU871I;F<@=&AE(&%R8VAI=F4Z"B`@*B!U=65N8V]D960@9FEL +M97,4``$*`/$"('=I=&@@4E!-('=R87!P97(;`/$!9WII<"!C;VUPFUA+"!L>FEP+"!A;F0@>'HC```9 +M-!0`]0<*5&AE(&QI8G)A"!I;G1E&-E<'0@9F]J`/$'("!E;G1R:65S('1H870@.`?$#;F%M97,L($%#3',L(&5T8RDND@"P +M3VQD($=.52!T87)=``2I``+*`/$$;V-T970M;W)I96YT960@8W!I;S4`ME-6 +M4C0@(FYE=V,B%0`G`'@G;71R964G +MNP!X25-/.38V,!,`6C2!S=')E86WM`>!S>7-T96TN("!4:&5R92P`\01N;R!D:7)E8W0*("`@`>-R86YD;VT@86-C97-S +M+GD`!I<`\@)I'!L +M86EN:6YGB0`P:&]W^``"]0``C@0#+``"*@$A3VZJ`!PL`P$#V0("<`!`;'=A +M>48!`-T!\@%E9"!A=71O;6%T:6-A;&QY1P"P22=V92!A='1E;7#$`^!T;R!M +M:6YI;6EZ92!S="L`L"!L:6YK('!O;&QUN`'A+B`@268@>6]U(&1O;B?L`0"V +M`/$":6-I=&QY(&EN=F]K92!A('#K`"!U;#<$(&5A60)`("AS=2\!&7,<`A!A +MZ0`'+0`'[P4`@`$"F0%P*2P@:70@=W``X"!G970@<'5L;&5D(&ENI`0W($EN +M;@`W+"!IG@`!40$#FP`B96[)`07L# +M$7`U`-%A=&5V97(@8FQO8VMS\``0:%<%(6ETH0!!66]U2X'<70@82!T:6U7`W%O8!(71O(@`%H0!A="!O;F-EA0`A3VZ0`QMEPP`" +MY`(R<')O.@$!A0%18W1L>2W,``!(!E)U='!U=.\"`&`$\0-O8FIE8W0M2!F)M96UO?<"!8P``0`" +M\05R;W9I9&4@96%S>2UT;RUU8<``J,!!H`%,7=A;H@`$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92!M=6QT:7`E```A +M!1!V$@-`:89`@4.%CHN`0+( +M"0#"``]D&O__________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________:E`*("H@3U(4``#XNFX@2!I +M;G9O:V4@82!P87)T:6-U;&%R(&9E871U!E('-O;64@=71I;&ET>3X`!8P` +M`+$!\09P2!D8737`%9U +MP"`&$#`2L`,VEN(""!I;G1E7,N"E)%041-15``1"!L:6)M`=%B=6YD;&4N"@I1=65S^@*@/R`@ +M27-S=65S/U(`UBH@:'1T<#HO+W=W=RXX`$`N;W)GDP``2`$0:+@"L&9O`<``$D!0'-U8V@G`%`J(&5X84D`0',Z(%,R`U1S;6%L +M;!4`!#X!`%(#(6%T'`@@;6'F!"!N9-`",69U;"\"!D4`$"]#"@&%`1%AXP%1 +M86-T('-@`+`@9&5M;VYS=')A=+P`"-E)ZT``V7-T96TZ&@D"N`0A+C'! +M#`!A#`$W`0,O`P`+``(A``2:`P,S``"(!`\T``L`(@`,-0`O870T``PH870S +M``8!!B$N,[8+$'-E"H!O=F5R=FEE=_,"`*``!0H,`'$%,'=H;Y$"%"JD"H5? +MPH"MP(2 +M9:`,`%L$$'/4!A!N2PT`U@(`DP``=0``%P(`^00!<0`!<0H(EP!S96YT=H+`#L'`2,)"=H1`,$",&5C=)D#$60Y"0,<`@5X"1!F!A(! +MMP91*B!'3E5U`0+4!B8@*`0+`!H`(VQOO`4`K0LB+``-J +M`0`9`[$J(%!/4TE8('5S=+`1!!``#XH,`P%\``(Q`+!O8W1E="UO\!`DD`-5I)4`D!`T``('5N +M3@D`[!,`UA!@FEP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'1O +M<"UL#`0#Q0P`,`0&";8"(FENU@0`=`P`ZP40<],-\`4@*B!.15=3 +M("T@:&EG:&QI9VAT'2(`")P==8-(")C-`81(B0#`#@,*6]L +M30`@"@K>!P;K`P$I`0`6"0".`0]M`0$`^0<@=7/="@#:`31E"B>P`"-E)ZT` +M`V!Q(M@@13``$=`U`=\!`DD`#QX78P\+%P#3 +M36EC4P`T&-P:6\N-2P@;71R964)`/(. +M86YD('1AP$R+F@BJ0"`:&4*2!E2QN``/2`>`@875T;VUA=&EC86QL>68!065C='.H``#5``,<`E!O +M;&QO=Y,!$&8L`*!S.@H@("H@1TY5^`$`J`!6;6%T("BY`0`:`$%L;VYG50)B +M;F%M97,L$`!3;&EN:R`1``"T`5)S<&%R'1E;J+``-J`1%S2P"W4$]325@@=7-T87(0 +M`.%P87@@:6YT97)C:&%N9WX!-VUA="$`L&]C=&5T+6]R:65N`0,`8`(!'@"A +M4U92-"!!4T-)270"`10``F,`#S(`!6%":6YAB,``!DT%``)"`&58V%N(&-R +M96%TSP`!=00/!@$"`NP"`[\#`KP"#Q\#&,$B,H"4B`H9F]R-`0`A`$#,P0`]`-Q+"!E=&,I+F\!`/H#`*D"!B($ +M`1<``MH`#\@#"F$B;F5W8R*;`P$S`"=S:+```1(`#T8#8P0%!`);`0&)``]9 +M`P`*%@,S5VAE`P(`V`(#U`(2<^8%87)EF4@7L#$7`U`-%A=&5V97(@8FQO8VMS\```[@2X' +M<70@82!T:6U7`P!K"S%M87#X`C!E;G21!@/0`@%1`T!G:79EY@$A=&\B``6A +M`&%T(&]N8V6%`"%/;I`#&V7#``+D`C)P`%`@(&)S9",'(75SO`$`/06#;B!I +M=',@(D#E`!(BO01&2!F4X.475S92`B(0$`6@@@+")0"'`L(&-A +M<&%B00`!]@("9@81954"`?$`864@05!)P" +M`,D*`2L`,VEN("#U%F:7)S=)("`*8!(&$@ +M0P41;U`'`/8`%BYT``/9`P*G`0"_``*<`0&%``:X`0!V``*4`0!*`P&3``(Q +M#R!L>60!`,P``*,!!H`%,7=A;G\%$G0=#P-%`0!@```:!!!TC@!L3 +M0',Z(%,R`U1S;6%L;!4`!#X!`%(#(6%T'`@@;6'F!"!N9-`",69U;"\"!D4` +M$"]#"@&%`1%AXP$T86-T>Q."9&5M;VYS=')*#0`.`R=O9EX!`TD`,&-O;D," +M83H@(%9AP``7P%C875T:&]R:1``EPT!\@(`P1,2+NT/4'1O<"UL#`0#Q0P`,`0&";8""',5`.L%`>X/\`4@*B!.15=3("T@:&EG:&QI9VAT\`!,GK0`#)`0`DP``3@#P`"YA;2P@86-L +M;V-A;"YM-`D-`^T`,"YA8_\```(`$"VB`@"?``2H``#9#@BB!!(L&@X`UPL` +M60L0>\%1FYA;'.=`!)S +M/@MA:6YS:6=H$08(F0<1)V<"!#<``&@1,'5C=+(#`*@`,&]P92L%`#0,"1X' +M$BU8"0]D&O__________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________5E!C="!S85<4``#T4VUP;&4@9&5M;VYS=')A +M=&EN9R!U4$`,6EN'2(`#%P=70I`/D#(F-M86ME(B!B=6EL9"!T +M;V]L30`"5@$&-0$!*0$Q(&EN3`$/;0$!,&%R91`"$F3:`35E"B>\`!,GK0`# +M9P$`DP``3@#U`2YA;2P@86-L;V-A;"YM-"SA`$!E+F%C_P```@`2+50`)'1O +MJ```(`&`9&ES=')I8G5!`;(L(&]N;'D@;F5E9'P`,6UA:?8!(V5R7`$%<``D +M:6YD`/(#+F@N:6X*"2T@=&5M<&QA=&5S9P`18C0"`68!$V6U`/($"@I'=6ED +M92!T;R!$;V-U;65N=($!`,4!,F%L;'4``/,!]0H@'!L@P(#+P,`0@$"(0"#('!R;V=R86TS`$]C<&EO-``+`"(`##4` +M+V%T-``,*&%T,P`'K0/P!#,@9VEV97,@86X@;W9E2!A``"/ +M`&<@)V1O8R>]!;!I;@IA(&YU;6)E2QN``5H`S!U=&^3!@#_`A!Y9@$P96-TF0,19-4``QP"!<(&$&8L``&W +M!E$J($=.574!`KH!)B`HN0$`&@!!;&]N9U4"8FYA;65S+!``4VQI;FL@$0`` +M8P!A@``0H``EP)HE)032!WFEP/@$Q +M:6]N,`!=8GII<#(6``1D`4TO3%I7'0"B;'IM82P@;'IIU`P#P!`![ +M``.?`0![``&'"0&C``)*#`,*`Q!M:P@0:7D'$F$)`0(K`"$@8C<)<7)E861A +M8FP`!@","@$,``$L"P($`0!H``([`$)E86-H/0$A=F5S`Q-Y0P!0:6YD97"J +M`"5N="(!`!@)``\/$&-"!1)O;`T&-0I4(%=I:VE2##!I;F?)`#!H;W>;#`&S +M`Q=DE@H"*@$A3VX_"`#W#`)X!@,#`0/X``&("5!A;'=A>48!`-T!*F5DB@@" +M1P!P22=V92!A="T-`(P'`,$/D&EN:6UI>F4@@M'("!);FX`-RP@:9X``5$!`YL`(F5NR0$'+0``/@`+<0`H +M9&41``/&`A$L\``"@```C0X`E@$`%@$`0``@86<##A%T\0F18V]RP,B:67-#P%O`P/G"C%D=6.Y!5%E('-I>H,1`H@!4&%L +M;'DM=@``,PP`]P@1:8<&`(0`<&5N=FER;V[7`C%S('>0`P&@`A!MV`$3`!,@%1``:A``"@$`/06#;B!I=',@(D#E +M`!(BO0012!F@``S0*%82!S;V-K970^`TEW:7-HN@1$!L30',Z(%,R`U1S;6%L;!4`!#X!`%(# +M`Q,9(&UAY@0@;F30`C%F=6PO`@9%`%$O;6EN:84!$6'C`31A8W1[$P]D&O__ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________:%!C:&EV94<4``#P/2!W:71H;W5T"B`@(&9I0#P*FES(&5S<&5C:6%L;'D@96%S>2X*"B`J($YO=&4Z(")P87@@:6YT +M97)C:&%N9V4@9F]R;6%T(B!I<^```#,`\P!A;B!E>'1E;F1E9"!T87(B`)`L +M"B`@(&1E7,N"E)%041-12X`1"!L:6(3 +M`=%B=6YD;&4N"@I1=65SK@"@/R`@27-S=65S/U(`UBH@:'1T<#HO+W=W=RXX +M`$`N;W)GDP``2`$Q:&]MIP"`(&]N9V]I;F6H`)V%T:0`K871H`&ES:6UP;&6U`$!T;V]L,P$` +M0``#`@!R>F-A="P@8@<`$G@'``!)`4!S=6-H)P!0*B!E>&%)`$!S.B!3,@-4 +M2!F:6YDT`(Q9G5L+P(&10!1+VUI;FF% +M`1%AXP%186-T('-@`*$@9&5M;VYS=')A-04`#@,G;V9>`0-)`#!C;VY#`O`" +M.B`@5F%R:6]UP``7P%Q875T:&]R<\`%42!A;GD@\@(``050+@H*5&B=`3!P +M+6P,!`-V!3!O'2(`#!P=71>`C`@(F,T!A$B)`-I +M9"!T;V]L30`"5@$&ZP,`%`=!'!L@P(#+P,`0@$"(0`$F@,#,P`` +MB`0/-``+`"(`##4`+V%T-``,*&%T,P`&`0:`+C,@9VEV97/?!H!O=F5R=FEE +M=_,"`*``!+L%$&%Q!3!W:&^1`A0J[`B%7W)E860N,RP0``&["`T1`%%?9&ES +M:Q8``GX'`Q<(`3X``QP``)D`$'9?`0*W`F%E9"!C86R)!Q!SU`9!;F-EP$2+8($4W,N-2!D5@(` +MG@419?L#`/(`Q&UA=',@``&I`5=H+`#L'`2,)@&%U=&]M871I_P(0><$",&5C=)D#$60Y +M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?@$1<#T``I(!`'P$'P`!`/______;U````````````",W%#R +` +end diff --git a/libarchive/test/test_compat_lz4_B6.tar.lz4.uu b/libarchive/test/test_compat_lz4_B6.tar.lz4.uu new file mode 100644 index 000000000000..97918b91dd84 --- /dev/null +++ b/libarchive/test/test_compat_lz4_B6.tar.lz4.uu @@ -0,0 +1,1197 @@ +begin 644 test_compat_lz4_B6.tar.lz4 +M!")-&&1@A;\@``!O>&9I;&4``0!+X3`P,#8T-"``,#`P-S8U"``B,#(0`"(R +M,`$`_P<@,3(S-3,U-3,U,3(@,#$R,#(S`"`PEP!+`@(`KW5S=&%R`#`P8W4' +M`0M2,!46%C="!S8`"A(&1E;6]N4$`(&EN^``(M@)A:6YF;W)M&@00 +M(+@&!+T"\`E.15=3("T@:&EG:&QI9VATP`"-E)ZT``R0$`),``$X`]0$N86TL(&%C;&]C86PN;30L +MX0!`92YA8_\```(`$BU4`"1T;Z@`#*($LBP@;VYL>2!N965D?``Q;6%I]@$C +M97)<`05P`"1I;F0`\@,N:"YI;@H)+2!T96UP;&%T97-G`!%B-`(!9@$39;4` +M<`H*1W5I9&6V`AA$5`8$T@$"=0`!MP&R'!L +M@P(#+P,`0@$"(0`$F@,#,P``B`0/-``+`"(`##4`+V%T-``,*&%T,P`&`0:` +M+C,@9VEV97/?!H!O=F5R=FEE=_,"`*``!+L%$&%Q!3!W:&^1`B,J(-D'A5]R +M96%D+C,L$```T04=91$`45]D:7-K%@`"?@<(/@`#'```F0`0=E\!`K<"865D +M(&-A;(D'$'/4!D%N8V5SK0(`DP``=0``%P(`^00!<0!8($%027.7`'-E;G1R +M>2XS30`"]P,2(FL#!:L``20`4"(@=71II`59(&-L87-$``'O!49N86QSG0!@ +M]!;!I;@IA(&YU;6)E`D09BP``;<&42H@1TY5 +M=0$"N@$F("@$"P`:`$%L;VYG4`9B;F%M97,L$```!0L3(!$``&,`4G-P87)S +M?`(AB,``!DT%``)"`$```I58W)E +M873/``%U!`\&`0("J@,#OP,"O`(/'P,8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71OK`TP9&%TUP``!0X1.L$"`2X! +M`L@)`,(`$F'L`@!A`P$K`#-I;B`G`0"/`C-A9&2.`AAA]PP!UP<#'@]19FER +M>D``,P``*,!!H`%,7=A;G\%$G0=#P-%`0!@```:!!!T +MC@A<"+``` +M.P``!`,`2P+%1`G +M-Q,`)AD`%@)S82!F=6QL+98(F-%#A)B!P`2>`<``'`$`)()`"<`%"I/&@]D&O______________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________________95`@:6YS:6(@``#P"6=H="!I;G1O +M(&QI8F%R8VAI=F4G1X`<&QI8G)AP#S"2P@:6YC;'5D:6YG(&AA``"/`/0:("=D;V,G(&1I2!I;@IA(&YU +M;6)E6]U(#\!8"X*"D-U +MFEP,A8`!'P! +M32],6E<=`*)L>FUA+"!L>FEP$P,O>'HC```9-!0`"0@!E6-A;B!C?P(-F5A;;4%X'-YU`P#P!`![``-S +M!`![``&'"0&C`%0@;VYL>0H#$&UK"!!I>0<182\)`RL`(2!B-PEQ4,`4&EN9&5P +MJ@`E;G0B`0`8"5!A7L#$7`U`-%A=&5V97(@8FQO8VMS\```[@2X'<70@82!T:6U7`P!K +M"S%M87#X`C!E;G21!@/0`@%1`T!G:79EY@$A=&\B``6A`&%T(&]N8V6%`"%/ +M;I`#&V7#``+D`C)P`%`@(&)S9",'(75SO`$`/06#;B!I=',@(D#E`!(BO001 +M2!F@``P0&%82!S;V-K970^`TEW:7-HN@3`4X.475S92`B(0$`6@@@+")0"'`L(&-A<&%B00`!]@($ +M`P$%\0!A92!!4$ES/PX(]@4!EP&`(&EN9&EV:61L#@/;"`"%``(5!@!"``2L +M!0`V`2%T;ZP-,&1A=-<```4.%CHN`0+("0`]`!)A[`(`R0H!*P`S:6X@)P$` +ME0LS861DC@(88?<,`=<'`QX/469I1$@#R$0`6`G-A(&9U;&PME@AR9"`G=&%R)P\!`0(`(7)EK0H!0@%` +M8G5I;($&`(H``V,``"H``J(3!F,`2V-P:6]D``;3$@$P`S!F86,J!P`]``," +M```I$")N=&@#`!$"-G-A;98#%&%G!5F-%#A)B!P`2>`<``$D!`)()`"<`02H@97@;$T!S.B!3,@-4 +M,!-&%C='L3<&1E;6]NP`` +M7P%C875T:&]R:1``EPT!\@(`P1,2+NT/4'1O<"UL#`0#Q0P`,`0& +M";8""',5`.L%`>X/\`4@*B!.15=3("T@:&EG:&QI9VAT<]P`,')E8VX,`C$% +M`Z`"DD-/4%E)3D<@+0P%`$(4`,H'(61O7P8!AP4`S@#`*B!)3E-404Q,("T@ +M9`HQ86QLCP0!#0``BA8`OP`"*0`#0`41+3P``5X1`A@`8&-O;F9I9[(6$"W_ +M!0$,``)$`+5S8W)I<'0L('-E96<``"@%`ED6`F,(@2H@0TUA:V5,U`0Q='AT +MB``A<'5G$#`@(F,T!A$B)`,`.`PI;VQ-`"`*"N$(!NL#`2D!`!8)`(X!#VT! +M`0"P#!!U/1,"$!\`!,GK0`#)`0`DP``3@#P`"YA;2P@86-L;V-A;"YM +M-`D-`^T`,"YA8_\```(`$"UD`@"?``2H``#9#@BB!!(L&@X`UPL`60M1>2!M +M86GV`2-E!,"(0`$F@,#,P``B`0/-``+`"(`##4`+V%T-``,*&%T,P`'K0,1,[8+ +M`!`4D"!O=F5R=FEE=_,"`*L`!<`+`'$%,'=H;Y$"%"JD"H5?\%1FYA;'.=`!)S/@M/:6YS +M:60:________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________________________]Y4&5S"B`@ +M62```/$>*B!F:6QEFEP(&-O;7!R +M97-S:6]N%0!=8GII<#(6``0F`$TO3%I7'0#_`VQZ;6$L(&QZ:7`L(&%N9"!X +M>B,``!DT%`#Q,@I4:&4@;&EB2!C86X@8W)E871E(&%R8VAI=F5S(&EN +M(&%N>2!O9B!T:&4@9F]L;&]W:6YG(&9O"!I;G1E'1E;DT!L7,@*&9O$E33SDV-C`3`%HW+5II<#D`-EA!4A$`0PI7:&4# +M`@#D`00%`A$L_`%AT!X'-Y +M`>-R86YD;VT@86-C97-S+GD`!I<`\@)I +M`35N97<7`@!2`#!A;F1[``'.`!1V6`,24,`4&EN9&5PJ@`B;G1_`!!R.P0`!``P=&EC\`0D;VZ!`02N +M`/``5VEK:2!E>'!L86EN:6YGR0`P:&]W^``"]0``C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86W\"E4@;W!E;IX`$R`5$`!J +M$``*`0`]!8-N(&ET2!B=6@-$B`D"`!E``!Z``#-`H5A('-O8VME=#X# +M27=IP`28D(`!*P%`#8!(71OK`TP9&%TUP``!0X1.L$"`2X! +M`L@)`,(`$F'L`@!A`P$K`#-I;B`G`0"/`C-A9&2.`AAA]PP!UP<#'@]19FER +M>D``,P``*,!!H`%,7=A;G\%$G0=#P-%`0!@```:!!!T +MC@A<"+``` +M.P``!`,`2P+%1`G +M-Q,`)AD`%@)S82!F=6QL+98(F-%#A)B!P`2>`<``'`$`)()`"<`%"I/&@]D&O______________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M________________________________95`@:6YS:6(@``#P"6=H="!I;G1O +M(&QI8F%R8VAI=F4G1X`<&QI8G)AP#S"2P@:6YC;'5D:6YG(&AA``"/`/0:("=D;V,G(&1I2!I;@IA(&YU +M;6)E6]U(#\!8"X*"D-U +MFEP,A8`!'P! +M32],6E<=`*)L>FUA+"!L>FEP$P,O>'HC```9-!0`"0@!E6-A;B!C?P(-F5A;;4%X'-YU`P#P!`![``-S +M!`![``&'"0&C`%0@;VYL>0H#$&UK"!!I>0<182\)`RL`(2!B-PEQ4,`4&EN9&5P +MJ@`E;G0B`0`8"5!A7L#$7`U`-%A=&5V97(@8FQO8VMS\```[@2X'<70@82!T:6U7`P!K +M"S%M87#X`C!E;G21!@/0`@%1`T!G:79EY@$A=&\B``6A`&%T(&]N8V6%`"%/ +M;I`#&V7#``+D`C)P`%`@(&)S9",'(75SO`$`/06#;B!I=',@(D#E`!(BO001 +M2!F@``P0&%82!S;V-K970^`TEW:7-HN@3`4X.475S92`B(0$`6@@@+")0"'`L(&-A<&%B00`!]@($ +M`P$%\0!A92!!4$ES/PX(]@4!EP&`(&EN9&EV:61L#@/;"`"%``(5!@!"``2L +M!0`V`2%T;ZP-,&1A=-<```4.%CHN`0+("0`]`!)A[`(`R0H!*P`S:6X@)P$` +ME0LS861DC@(88?<,`=<'`QX/469I1$@#R$0`6`G-A(&9U;&PME@AR9"`G=&%R)P\!`0(`(7)EK0H!0@%` +M8G5I;($&`(H``V,``"H``J(3!F,`2V-P:6]D``;3$@$P`S!F86,J!P`]``," +M```I$")N=&@#`!$"-G-A;98#%&%G!5F-%#A)B!P`2>`<``$D!`)()`"<`02H@97@;$T!S.B!3,@-4 +M,!-&%C='L3<&1E;6]NP`` +M7P%C875T:&]R:1``EPT!\@(`P1,2+NT/4'1O<"UL#`0#Q0P`,`0& +M";8""',5`.L%`>X/\`4@*B!.15=3("T@:&EG:&QI9VAT<]P`,')E8VX,`C$% +M`Z`"DD-/4%E)3D<@+0P%`$(4`,H'(61O7P8!AP4`S@#`*B!)3E-404Q,("T@ +M9`HQ86QLCP0!#0``BA8`OP`"*0`#0`41+3P``5X1`A@`8&-O;F9I9[(6$"W_ +M!0$,``)$`+5S8W)I<'0L('-E96<``"@%`ED6`F,(@2H@0TUA:V5,U`0Q='AT +MB``A<'5G$#`@(F,T!A$B)`,`.`PI;VQ-`"`*"N$(!NL#`2D!`!8)`(X!#VT! +M`0"P#!!U/1,"$!\`!,GK0`#)`0`DP``3@#P`"YA;2P@86-L;V-A;"YM +M-`D-`^T`,"YA8_\```(`$"UD`@"?``2H``#9#@BB!!(L&@X`UPL`60M1>2!M +M86GV`2-E!,"(0`$F@,#,P``B`0/-``+`"(`##4`+V%T-``,*&%T,P`'K0,1,[8+ +M`!`4D"!O=F5R=FEE=_,"`*L`!<`+`'$%,'=H;Y$"%"JD"H5?\%1FYA;'.=`!)S/@M/:6YS +M:60:________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M____________________________________________________________ +M__________________________________________________]Y4&5S"B`@ +M62```/$>*B!F:6QEFEP(&-O;7!R +M97-S:6]N%0!=8GII<#(6``0F`$TO3%I7'0#_`VQZ;6$L(&QZ:7`L(&%N9"!X +M>B,``!DT%`#Q,@I4:&4@;&EB2!C86X@8W)E871E(&%R8VAI=F5S(&EN +M(&%N>2!O9B!T:&4@9F]L;&]W:6YG(&9O"!I;G1E'1E;DT!L7,@*&9O$E33SDV-C`3`%HW+5II<#D`-EA!4A$`0PI7:&4# +M`@#D`00%`A$L_`%AT!X'-Y +M`>-R86YD;VT@86-C97-S+GD`!I<`\@)I +M`35N97<7`@!2`#!A;F1[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8!544`7@,!*0\0 +M95X)$7G=$0`]`@3N0S%S("@*"`(K'`(0"@8<``*>&$PQ34(I<0"@36%R8W5S +M($=E:7T'`%8<`!\'`6<1`.,-`;)Z`[PZ!KD#`'D``SP!\PYX(H``$%\0FMT;W!?>P#J&0`O``;'``&%"0*5``!]``".!`+*%0`. +M``$T```J+P.W"P-1#V(U.B!07`F`Z2UW86QK6``!J!\`E@4"DP("70`#X"L1-6!A`/U#`+@'!%4``3(``2%; +M$#N$(@"4``0/!0"*#`#2`11YHQ(0--(!(6YY*RH0+7<(`,4](6QE+P(!U!$` +M2#D!5@,!&U(#5@`@86PE#@`=`0'5'P/L%@$`&@4Q.P1S``0&.P2_``!]``.' +M!Q$TBBL`I2H%FW@#;X3Q!2P@2%`M55@L(%5N:7AW87)E+"!S:2D`TRH"+@$` +D?@$1<#T``I(!`'P$'P`!`/______;U````````````",W%#R +` +end diff --git a/libarchive/test/test_compat_lz4_B7BD.tar.lz4.uu b/libarchive/test/test_compat_lz4_B7BD.tar.lz4.uu new file mode 100644 index 000000000000..ecbd423919ba --- /dev/null +++ b/libarchive/test/test_compat_lz4_B7BD.tar.lz4.uu @@ -0,0 +1,918 @@ +begin 644 test_compat_lz4_B7BD.tar.lz4 +M!")-&&1PN>]0``!O>&9I;&4``0!+X3`P,#8T-"``,#`P-S8U"``B,#(0`"(R +M,`$`_P<@,3(S-3,U-3,U,3(@,#$R,#(S`"`PEP!+`@(`KW5S=&%R`#`P8W4' +M`0M2,!46%C="!S8`"A(&1E;6]N4$`(&EN^``(M@)A:6YF;W)M&@00 +M(+@&!+T"\`E.15=3("T@:&EG:&QI9VATP`"-E)ZT``R0$`),``$X`]0$N86TL(&%C;&]C86PN;30L +MX0!`92YA8_\```(`$BU4`"1T;Z@`#*($LBP@;VYL>2!N965D?``Q;6%I]@$C +M97)<`05P`"1I;F0`\@,N:"YI;@H)+2!T96UP;&%T97-G`!%B-`(!9@$39;4` +M<`H*1W5I9&6V`AA$5`8$T@$"=0`!M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!Y`#=087CZ`0%>'`(6?Q$N_DT"`!L;-=H9`;X!`_8!!+41"4=/ +M`#X.!%T9`!\+!E\9`+L%`$83`K8$`A\2`',-!)0$"NE*`F0``N1*`*X``#P4 +M4&%S($DG'`-`="!Q=;@3`)-&`-A:`:P)`)@"`C8``T&``((!G&AE=7)I8@,!0@' +M`1P)5"X*3V-TZ@(2-5A7-$=.5U,`D#`/87`2L2"\`#`W`#`JT-*C4Z,0(#7P8!544`7@,!*0\0 +M95X)$7G=$0`]`@3N0S%S("@*"`(K'`(0"@8<``*>&$PQ34(I<0"@36%R8W5S +M($=E:7T'`%8<`!\'`6<1`.,-`;)Z`[PZ!KD#`'D``SP!\PYX(H``$%\0FMT;W!?>P#J&0`O``;'``&%"0*5``!]``".!`+*%0`. +M``$T```J+P.W"P-1#V(U.B!07`F`Z2UW86QK6``!J!\`E@4"DP("70`#X"L1-6!A`/U#`+@'!%4``3(``2%; +M$#N$(@"4``0/!0"*#`#2`11YHQ(0--(!(6YY*RH0+7<(`,4](6QE+P(!U!$` +M2#D!5@,!&U(#5@`@86PE#@`=`0'5'P/L%@$`&@4Q.P1S``0&.P2_``!]``.' +M!Q$TBBL`I2H%FW@#;X3Q!2P@2%`M55@L(%5N:7AW87)E+"!S:2D`TRH"+@$` +D?@$1<#T``I(!`'P$'P`!`/______;U````````````",W%#R +` +end diff --git a/libarchive/test/test_compat_mac.c b/libarchive/test/test_compat_mac.c index c7e852521aad..5caa17f83e63 100644 --- a/libarchive/test/test_compat_mac.c +++ b/libarchive/test/test_compat_mac.c @@ -53,6 +53,7 @@ test_compat_mac_1(void) 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_set_options(a, "mac-ext")); extract_reference_file(name); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); @@ -149,6 +150,7 @@ test_compat_mac_2(void) 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_set_options(a, "mac-ext")); extract_reference_file(name); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); diff --git a/libarchive/test/test_compat_pax_libarchive_2x.c b/libarchive/test/test_compat_pax_libarchive_2x.c index 6ea25e4d2501..4830d9e43a17 100644 --- a/libarchive/test/test_compat_pax_libarchive_2x.c +++ b/libarchive/test/test_compat_pax_libarchive_2x.c @@ -119,13 +119,20 @@ DEFINE_TEST(test_compat_pax_libarchive_2x) archive_read_open_filename(a, refname, 10240)); /* We cannot correctly read the filename. */ - assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae)); + // This test used to look for WARN here coming from a + // character-conversion failure. But: Newer iconv tables are + // more tolerant so we can't always detect the conversion + // failures. + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assert(strcmp("\xd0\xd2\xc9\xd7\xc5\xd4", archive_entry_pathname(ae)) != 0); assertEqualInt(6, archive_entry_size(ae)); /* We cannot correctly read the filename. */ - assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae)); + // Same here: The test is still valid (it sill verifies that + // the converted pathname is different), but we can no longer + // rely on WARN here. + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assert(strcmp("\xf0\xf2\xe9\xf7\xe5\xf4", archive_entry_pathname(ae)) != 0); assertEqualInt(6, archive_entry_size(ae)); diff --git a/libarchive/test/test_compat_uudecode_large.c b/libarchive/test/test_compat_uudecode_large.c new file mode 100644 index 000000000000..a2ffd22663a5 --- /dev/null +++ b/libarchive/test/test_compat_uudecode_large.c @@ -0,0 +1,54 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_compat_uudecode_large) +{ + const char *refname = "test_compat_uudecode_large.tar.Z.uu"; + struct archive_entry *ae; + struct archive *a; + + copy_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, 2)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file1", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file2", archive_entry_pathname(ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file3", archive_entry_pathname(ae)); + assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_COMPRESS); + assertEqualInt(archive_filter_code(a, 1), ARCHIVE_FILTER_UU); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + diff --git a/libarchive/test/test_compat_uudecode_large.tar.Z.uu b/libarchive/test/test_compat_uudecode_large.tar.Z.uu new file mode 100644 index 000000000000..8494bafd2a98 --- /dev/null +++ b/libarchive/test/test_compat_uudecode_large.tar.Z.uu @@ -0,0 +1,1087 @@ +begin 644 test_compat_uudecode_large.tar.Z +M'YV09M*P*1,#@,&#"!,J7,BPH<.'$",BA$'1!@T:(`!0A''#1HV,&V'(P*@Q +M)(V0,$#$D#&CQHP;)V/`L`$"1HP8-V+,`%!3HL^?0(,*!5!G#ITPO0Z44"4*D21$09M[(`<$FC1BD8]"DL5,& +MA)@Z;L@,=*%`012F1M.\<3/G!P@02>;,`?Q#P6$0*D"@H4,'CHX7+^YH=M'V +MK9RX<\NX4'L&1)HY(.B@J8OF39NZ:=<./O,FC9LSCA^S=0M7+ET09,K09?,& +MSFLW=%B8=C.&31TRMDN3>;/T^%$Z@MTH#Y,W]^.V;M:@IO,F]>K=GD'_;A-& +M8/3=1N?P?1R92GDY9>"HI0."NVG%3"E75%VJU77:8@3*$<88:Y2Q5AAT>'?8 +M9)5=]L(8;P3G`FUOG+$7AFV\`,<+G?46V@L'`D;B:1'2!X)]("PF1AMI\.=? +M&6Z@P=T895B76GDE?N9;&%6 +M'=@-9A=>>AG(G'/!C7=>6E.^<<=[(.KG!HYTF.E=9$&J5X8._:&GH!QYH*56 +ME66$`=UM_>4%PAU^8H=JGZ72B*J<9=SIXE%R<%H@"">(,0<9N)X`I1P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^TJD*:^(\BCLA7`E*GJ."Z28T@G4LN +M2#XDMY(;(:!840HP!5[<4`&IP%?`*@`20`EH +M!9;<6.XLMY:;*P!&V`ELN;_<0($9]T6@RLT1\`B0N77<9VX>MRWSQUWD_CC4 +M`(;<-X$B=T&@)P#FKG,'!9K<%(&E0%,`+!#EG@IX!:C<.6Z*P)7;SDWH+G0; +EN@_=B.Y$MZ)[T -static void -test_gnutar_filename_encoding_UTF8_CP866(void) +DEFINE_TEST(test_gnutar_filename_encoding_UTF8_CP866) { struct archive *a; struct archive_entry *entry; @@ -69,8 +68,7 @@ test_gnutar_filename_encoding_UTF8_CP866(void) assertEqualMem(buff, "\xAF\xE0\xA8", 3); } -static void -test_gnutar_filename_encoding_KOI8R_UTF8(void) +DEFINE_TEST(test_gnutar_filename_encoding_KOI8R_UTF8) { struct archive *a; struct archive_entry *entry; @@ -111,8 +109,7 @@ test_gnutar_filename_encoding_KOI8R_UTF8(void) assertEqualMem(buff, "\xD0\xBF\xD1\x80\xD0\xB8", 6); } -static void -test_gnutar_filename_encoding_KOI8R_CP866(void) +DEFINE_TEST(test_gnutar_filename_encoding_KOI8R_CP866) { struct archive *a; struct archive_entry *entry; @@ -153,8 +150,7 @@ test_gnutar_filename_encoding_KOI8R_CP866(void) assertEqualMem(buff, "\xAF\xE0\xA8", 3); } -static void -test_gnutar_filename_encoding_CP1251_UTF8(void) +DEFINE_TEST(test_gnutar_filename_encoding_CP1251_UTF8) { struct archive *a; struct archive_entry *entry; @@ -199,8 +195,7 @@ test_gnutar_filename_encoding_CP1251_UTF8(void) /* * Do not translate CP1251 into CP866 if non Windows platform. */ -static void -test_gnutar_filename_encoding_ru_RU_CP1251(void) +DEFINE_TEST(test_gnutar_filename_encoding_ru_RU_CP1251) { struct archive *a; struct archive_entry *entry; @@ -240,8 +235,7 @@ test_gnutar_filename_encoding_ru_RU_CP1251(void) * into CP866 filenames and store it in the gnutar file. * Test above behavior works well. */ -static void -test_gnutar_filename_encoding_Russian_Russia(void) +DEFINE_TEST(test_gnutar_filename_encoding_Russian_Russia) { struct archive *a; struct archive_entry *entry; @@ -276,8 +270,7 @@ test_gnutar_filename_encoding_Russian_Russia(void) assertEqualMem(buff, "\xAF\xE0\xA8", 3); } -static void -test_gnutar_filename_encoding_EUCJP_UTF8(void) +DEFINE_TEST(test_gnutar_filename_encoding_EUCJP_UTF8) { struct archive *a; struct archive_entry *entry; @@ -317,8 +310,7 @@ test_gnutar_filename_encoding_EUCJP_UTF8(void) assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7); } -static void -test_gnutar_filename_encoding_EUCJP_CP932(void) +DEFINE_TEST(test_gnutar_filename_encoding_EUCJP_CP932) { struct archive *a; struct archive_entry *entry; @@ -358,8 +350,7 @@ test_gnutar_filename_encoding_EUCJP_CP932(void) assertEqualMem(buff, "\x95\x5C.txt", 6); } -static void -test_gnutar_filename_encoding_CP932_UTF8(void) +DEFINE_TEST(test_gnutar_filename_encoding_CP932_UTF8) { struct archive *a; struct archive_entry *entry; @@ -400,15 +391,3 @@ test_gnutar_filename_encoding_CP932_UTF8(void) assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7); } -DEFINE_TEST(test_gnutar_filename_encoding) -{ - test_gnutar_filename_encoding_UTF8_CP866(); - test_gnutar_filename_encoding_KOI8R_UTF8(); - test_gnutar_filename_encoding_KOI8R_CP866(); - test_gnutar_filename_encoding_CP1251_UTF8(); - test_gnutar_filename_encoding_ru_RU_CP1251(); - test_gnutar_filename_encoding_Russian_Russia(); - test_gnutar_filename_encoding_EUCJP_UTF8(); - test_gnutar_filename_encoding_EUCJP_CP932(); - test_gnutar_filename_encoding_CP932_UTF8(); -} diff --git a/libarchive/test/test_pax_filename_encoding.c b/libarchive/test/test_pax_filename_encoding.c index e03276e411f0..2d4515e1b3c4 100644 --- a/libarchive/test/test_pax_filename_encoding.c +++ b/libarchive/test/test_pax_filename_encoding.c @@ -335,8 +335,7 @@ test_pax_filename_encoding_3(void) /* * Verify that KOI8-R filenames are correctly translated to Unicode and UTF-8. */ -static void -test_pax_filename_encoding_KOI8R(void) +DEFINE_TEST(test_pax_filename_encoding_KOI8R) { struct archive *a; struct archive_entry *entry; @@ -382,8 +381,7 @@ test_pax_filename_encoding_KOI8R(void) /* * Verify that CP1251 filenames are correctly translated to Unicode and UTF-8. */ -static void -test_pax_filename_encoding_CP1251(void) +DEFINE_TEST(test_pax_filename_encoding_CP1251) { struct archive *a; struct archive_entry *entry; @@ -430,8 +428,7 @@ test_pax_filename_encoding_CP1251(void) /* * Verify that EUC-JP filenames are correctly translated to Unicode and UTF-8. */ -static void -test_pax_filename_encoding_EUCJP(void) +DEFINE_TEST(test_pax_filename_encoding_EUCJP) { struct archive *a; struct archive_entry *entry; @@ -478,8 +475,7 @@ test_pax_filename_encoding_EUCJP(void) /* * Verify that CP932/SJIS filenames are correctly translated to Unicode and UTF-8. */ -static void -test_pax_filename_encoding_CP932(void) +DEFINE_TEST(test_pax_filename_encoding_CP932) { struct archive *a; struct archive_entry *entry; @@ -528,8 +524,7 @@ test_pax_filename_encoding_CP932(void) * Verify that KOI8-R filenames are not translated to Unicode and UTF-8 * when using hdrcharset=BINARY option. */ -static void -test_pax_filename_encoding_KOI8R_BINARY(void) +DEFINE_TEST(test_pax_filename_encoding_KOI8R_BINARY) { struct archive *a; struct archive_entry *entry; @@ -568,8 +563,7 @@ test_pax_filename_encoding_KOI8R_BINARY(void) * Pax format writer only accepts both BINARY and UTF-8. * If other character-set name is specified, you will get ARCHIVE_FAILED. */ -static void -test_pax_filename_encoding_KOI8R_CP1251(void) +DEFINE_TEST(test_pax_filename_encoding_KOI8R_CP1251) { struct archive *a; @@ -592,10 +586,4 @@ DEFINE_TEST(test_pax_filename_encoding) test_pax_filename_encoding_1(); test_pax_filename_encoding_2(); test_pax_filename_encoding_3(); - test_pax_filename_encoding_KOI8R(); - test_pax_filename_encoding_CP1251(); - test_pax_filename_encoding_EUCJP(); - test_pax_filename_encoding_CP932(); - test_pax_filename_encoding_KOI8R_BINARY(); - test_pax_filename_encoding_KOI8R_CP1251(); } diff --git a/libarchive/test/test_read_data_large.c b/libarchive/test/test_read_data_large.c index 7bb72c01ed50..418020d11109 100644 --- a/libarchive/test/test_read_data_large.c +++ b/libarchive/test/test_read_data_large.c @@ -38,9 +38,9 @@ __FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_data_large.c 201247 2009- #define close _close #endif -char buff1[11000000]; -char buff2[10000000]; -char buff3[10000000]; +static char buff1[11000000]; +static char buff2[10000000]; +static char buff3[10000000]; DEFINE_TEST(test_read_data_large) { diff --git a/libarchive/test/test_read_disk_directory_traversals.c b/libarchive/test/test_read_disk_directory_traversals.c index 3ecfbc2d5241..c16b0c65311a 100644 --- a/libarchive/test/test_read_disk_directory_traversals.c +++ b/libarchive/test/test_read_disk_directory_traversals.c @@ -736,7 +736,8 @@ test_symlink_logical(void) assertMakeSymlink("linkY", "d1/fileY"); assertChdir(".."); - assert((ae = archive_entry_new()) != NULL); + /* Note: this test uses archive_read_next_header() + instead of archive_read_next_header2() */ assert((a = archive_read_disk_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_set_symlink_logical(a)); @@ -748,7 +749,7 @@ test_symlink_logical(void) file_count = 5; while (file_count--) { - assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header2(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); if (strcmp(archive_entry_pathname(ae), "l/ld1") == 0) { assertEqualInt(archive_entry_filetype(ae), AE_IFDIR); } else if (strcmp(archive_entry_pathname(ae), @@ -802,7 +803,7 @@ test_symlink_logical(void) } } /* There is no entry. */ - assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header2(a, ae)); + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); /* Close the disk object. */ assertEqualInt(ARCHIVE_OK, archive_read_close(a)); @@ -813,7 +814,7 @@ test_symlink_logical(void) file_count = 13; while (file_count--) { - assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header2(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); if (strcmp(archive_entry_pathname(ae), "l") == 0) { assertEqualInt(archive_entry_filetype(ae), AE_IFDIR); } else if (strcmp(archive_entry_pathname(ae), "l/d1") == 0) { @@ -928,12 +929,11 @@ test_symlink_logical(void) } } /* There is no entry. */ - assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header2(a, ae)); + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); /* Close the disk object. */ assertEqualInt(ARCHIVE_OK, archive_read_close(a)); /* Destroy the disk object. */ assertEqualInt(ARCHIVE_OK, archive_read_free(a)); - archive_entry_free(ae); } static void @@ -1090,8 +1090,10 @@ test_restore_atime(void) failure("There must be no entry"); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header2(a, ae)); - failure("Atime should be restored"); - assertFileAtimeRecent("at"); + /* On FreeBSD (and likely other systems), atime on + dirs does not change when it is read. */ + /* failure("Atime should be restored"); */ + /* assertFileAtimeRecent("at"); */ failure("Atime should be restored"); assertFileAtimeRecent("at/f1"); failure("Atime should be restored"); diff --git a/libarchive/test/test_read_filter_compress.c b/libarchive/test/test_read_filter_compress.c new file mode 100644 index 000000000000..03a1d5fbe9c0 --- /dev/null +++ b/libarchive/test/test_read_filter_compress.c @@ -0,0 +1,80 @@ +/*- + * Copyright (c) 2003-2008 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" + +DEFINE_TEST(test_read_filter_compress_truncated) +{ + const char data[] = {0x1f, 0x9d}; + struct archive *a; + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_compress(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_FATAL, + archive_read_open_memory(a, data, sizeof(data))); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + + +DEFINE_TEST(test_read_filter_compress_empty2) +{ + const char data[] = {0x1f, 0x9d, 0x10}; + struct archive *a; + struct archive_entry *ae; + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_compress(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, data, sizeof(data))); + + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify that the format detection worked. */ + assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_COMPRESS); + assertEqualString(archive_filter_name(a, 0), "compress (.Z)"); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_EMPTY); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + + +DEFINE_TEST(test_read_filter_compress_invalid) +{ + const char data[] = {0x1f, 0x9d, 0x11}; + struct archive *a; + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_compress(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_FATAL, + archive_read_open_memory(a, data, sizeof(data))); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_read_format_7zip.c b/libarchive/test/test_read_format_7zip.c index 62657a82165a..14447def898a 100644 --- a/libarchive/test/test_read_format_7zip.c +++ b/libarchive/test/test_read_format_7zip.c @@ -25,24 +25,36 @@ #include "test.h" __FBSDID("$FreeBSD"); +#if defined(_WIN32) && !defined(__CYGWIN__) +#define close _close +#define open _open +#endif + /* * Extract a non-encoded file. * The header of the 7z archive files is not encoded. */ static void -test_copy() +test_copy(int use_open_fd) { const char *refname = "test_read_format_7zip_copy.7z"; struct archive_entry *ae; struct archive *a; char buff[128]; + int fd = -1; extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); - assertEqualIntA(a, ARCHIVE_OK, - archive_read_open_filename(a, refname, 10240)); + if (use_open_fd) { + fd = open(refname, O_RDONLY | O_BINARY); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_fd(a, fd, 10240)); + } else { + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + } /* Verify regular file1. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -50,6 +62,8 @@ test_copy() assertEqualString("file1", archive_entry_pathname(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(60, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assert(archive_read_has_encrypted_entries(a) > ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualInt(60, archive_read_data(a, buff, sizeof(buff))); assertEqualMem(buff, " ", 4); @@ -65,6 +79,8 @@ test_copy() /* Close the archive. */ assertEqualInt(ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + if (fd != -1) + close(fd); } /* @@ -122,6 +138,8 @@ test_empty_file() assertEqualString("empty", archive_entry_pathname(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); assertEqualInt(1, archive_file_count(a)); @@ -161,6 +179,8 @@ test_plain_header(const char *refname) assertEqualString("file1", archive_entry_pathname(ae)); assertEqualInt(1322058763, archive_entry_mtime(ae)); assertEqualInt(2844, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); assertEqualInt(sizeof(buff), archive_read_data(a, buff, sizeof(buff))); assertEqualMem(buff, "The libarchive distribution ", 28); @@ -202,6 +222,8 @@ test_extract_all_files(const char *refname) 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); @@ -211,6 +233,8 @@ test_extract_all_files(const char *refname) 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); @@ -220,6 +244,8 @@ test_extract_all_files(const char *refname) 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); @@ -229,6 +255,8 @@ test_extract_all_files(const char *refname) 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); @@ -238,6 +266,8 @@ test_extract_all_files(const char *refname) 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); assertEqualInt(5, archive_file_count(a)); @@ -277,6 +307,8 @@ test_extract_last_file(const char *refname) 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); /* Verify regular file2. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -284,6 +316,8 @@ test_extract_last_file(const char *refname) 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); /* Verify regular file3. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -291,6 +325,8 @@ test_extract_last_file(const char *refname) 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); /* Verify regular file4. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -298,6 +334,8 @@ test_extract_last_file(const char *refname) 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); @@ -307,6 +345,8 @@ test_extract_last_file(const char *refname) 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); assertEqualInt(5, archive_file_count(a)); @@ -347,6 +387,8 @@ test_extract_all_files2(const char *refname) 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); @@ -356,6 +398,8 @@ test_extract_all_files2(const char *refname) 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); @@ -365,6 +409,8 @@ test_extract_all_files2(const char *refname) 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); @@ -374,6 +420,8 @@ test_extract_all_files2(const char *refname) 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); @@ -384,6 +432,8 @@ test_extract_all_files2(const char *refname) assertEqualString("dir1/zfile1", archive_entry_pathname(ae)); assertEqualInt(5184001, 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); @@ -393,6 +443,8 @@ test_extract_all_files2(const char *refname) assertEqualString("zfile2", archive_entry_pathname(ae)); assertEqualInt(5184001, 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); @@ -402,6 +454,8 @@ test_extract_all_files2(const char *refname) assertEqualString("zfile3", archive_entry_pathname(ae)); assertEqualInt(5184001, 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); @@ -411,6 +465,8 @@ test_extract_all_files2(const char *refname) assertEqualString("zfile4", archive_entry_pathname(ae)); assertEqualInt(5184001, 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); @@ -420,6 +476,8 @@ test_extract_all_files2(const char *refname) 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); assertEqualInt(9, archive_file_count(a)); @@ -460,6 +518,8 @@ test_delta_lzma(const char *refname) assertEqualString("file1", archive_entry_pathname(ae)); assertEqualInt(172802, archive_entry_mtime(ae)); assertEqualInt(27627, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); remaining = (size_t)archive_entry_size(ae); while (remaining) { if (remaining < sizeof(buff)) @@ -514,6 +574,8 @@ test_bcj(const char *refname) assertEqualString("x86exe", archive_entry_pathname(ae)); assertEqualInt(172802, archive_entry_mtime(ae)); assertEqualInt(27328, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); remaining = (size_t)archive_entry_size(ae); while (remaining) { if (remaining < sizeof(buff)) @@ -569,6 +631,8 @@ test_ppmd() assertEqualString("ppmd_test.txt", archive_entry_pathname(ae)); assertEqualInt(1322464589, archive_entry_mtime(ae)); assertEqualInt(102400, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); remaining = (size_t)archive_entry_size(ae); while (remaining) { if (remaining < sizeof(buff)) @@ -619,6 +683,8 @@ test_symname() assertEqualString("file1", archive_entry_pathname(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(32, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); assertEqualInt(32, archive_read_data(a, buff, sizeof(buff))); assertEqualMem(buff, "hellohellohello\nhellohellohello\n", 32); @@ -628,6 +694,8 @@ test_symname() assertEqualString("symlinkfile", archive_entry_pathname(ae)); assertEqualString("file1", archive_entry_symlink(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); assertEqualInt(2, archive_file_count(a)); @@ -681,9 +749,14 @@ DEFINE_TEST(test_read_format_7zip_bzip2) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } +DEFINE_TEST(test_read_format_7zip_from_fd) +{ + test_copy(1);/* read a 7zip file from a file descriptor. */ +} + DEFINE_TEST(test_read_format_7zip_copy) { - test_copy(); + test_copy(0); test_bcj("test_read_format_7zip_bcj_copy.7z"); test_bcj("test_read_format_7zip_bcj2_copy_1.7z"); test_bcj("test_read_format_7zip_bcj2_copy_2.7z"); diff --git a/libarchive/test/test_read_format_7zip_encryption.7z.uu b/libarchive/test/test_read_format_7zip_encryption.7z.uu new file mode 100644 index 000000000000..5122679f6088 --- /dev/null +++ b/libarchive/test/test_read_format_7zip_encryption.7z.uu @@ -0,0 +1,7 @@ +begin 664 test_read_format_7zip_encryption.7z +M-WJ\KR<<``."K^J($`````````!A`````````%C_;&JY#8C0K"UKHUJ[Y37? +MT4'9`00&``$)$``'"P$``B0&\0`!T````%`H!``"&-JAYL,X! +*%08!`""`M($````` +` +end diff --git a/libarchive/test/test_read_format_7zip_encryption_data.c b/libarchive/test/test_read_format_7zip_encryption_data.c new file mode 100644 index 000000000000..adedbc5311c6 --- /dev/null +++ b/libarchive/test/test_read_format_7zip_encryption_data.c @@ -0,0 +1,70 @@ +/*- + * Copyright (c) 2013 Konrad Kleine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD"); + +DEFINE_TEST(test_read_format_7zip_encryption_data) +{ + /* This file is password protected (encrypted) with AES-256. The headers + are NOT encrypted. Password is "12345678". */ + const char *refname = "test_read_format_7zip_encryption.7z"; + 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)); + + assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a)); + + /* Verify encrypted file "bar.txt". */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae)); + assertEqualString("bar.txt", archive_entry_pathname(ae)); + assertEqualInt(1379073980, archive_entry_mtime(ae)); + assertEqualInt(4, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + assertEqualInt(ARCHIVE_FATAL, archive_read_data(a, buff, sizeof(buff))); + + 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)); +} + diff --git a/libarchive/test/test_read_format_7zip_encryption_header.7z.uu b/libarchive/test/test_read_format_7zip_encryption_header.7z.uu new file mode 100644 index 000000000000..cdabd247e94d --- /dev/null +++ b/libarchive/test/test_read_format_7zip_encryption_header.7z.uu @@ -0,0 +1,8 @@ +begin 664 test_read_format_7zip_encryption_header.7z +M-WJ\KR<<``-1(7)]@``````````F`````````!I:QVF.6KJ?=[:U9:-!,8A0 +MB6O0&LG!?DD:R_'07!.!NV;/LY)*FIFWXUI[)=TPG&";5C%*%S+LERGW+.D%XK*'>5.FQ>74JN]"%`5%TTQ[@L^# +MZVV`LJT"61@``($S!ZXQF+DAMZ?L<`,6_>V19<3;V2;&..`F/OY`DLGI +MB?L"X_1-'%<>!(3'6&[GTF&K$I`20KWW0T2OU80/'3WLJ@2\\?YH6A7J\T[" +M5JH6Y6_..SN-L'T>$^";VM@^(Y(^]N\E588GW68QK>M[C@$[AM@/<+RH]Q!& +J"GI1?FZ````7!A@!"8"$``<+`0`!(P,!`05=`!````R`N@H!F[7,7``` +` +end diff --git a/libarchive/test/test_read_format_7zip_encryption_partially.c b/libarchive/test/test_read_format_7zip_encryption_partially.c new file mode 100644 index 000000000000..68290aa64fd9 --- /dev/null +++ b/libarchive/test/test_read_format_7zip_encryption_partially.c @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2013 Konrad Kleine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD"); + +DEFINE_TEST(test_read_format_7zip_encryption_partially) +{ + /* This file is password protected (encrypted) with AES-256. The headers + are NOT encrypted. Password is "12345678". It contains one encrypted + and one unencrypted file. */ + const char *refname = "test_read_format_7zip_encryption_partially.7z"; + 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)); + + assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a)); + + /* Verify regular unencrypted file1. */ + if (archive_read_next_header(a, &ae) == ARCHIVE_OK) { + assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae)); + assertEqualString("bar_unencrypted.txt", archive_entry_pathname(ae)); + assertEqualInt(1379079541, archive_entry_mtime(ae)); + assertEqualInt(4, archive_entry_size(ae)); + assertEqualInt(0, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 0, archive_read_has_encrypted_entries(a)); + assertEqualInt(4, archive_read_data(a, buff, sizeof(buff))); + + /* Verify regular encrypted file2. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae)); + assertEqualString("bar_encrypted.txt", archive_entry_pathname(ae)); + assertEqualInt(1379079565, archive_entry_mtime(ae)); + assertEqualInt(4, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + assertEqualInt(ARCHIVE_FATAL, archive_read_data(a, buff, sizeof(buff))); + + assertEqualInt(2, archive_file_count(a)); + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_FATAL, 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)); +} diff --git a/libarchive/test/test_read_format_7zip_malformed.7z.uu b/libarchive/test/test_read_format_7zip_malformed.7z.uu new file mode 100644 index 000000000000..179f633f9c63 --- /dev/null +++ b/libarchive/test/test_read_format_7zip_malformed.7z.uu @@ -0,0 +1,5 @@ +begin 644 test_read_format_7zip_malformed.7z +M-WJ\KR<<,#"@P/<&!P````````!(`````````&:^$Y 4) assertEqualInt(65536, archive_entry_uid(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertA(archive_filter_code(a, 0) == ARCHIVE_FILTER_NONE); assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_AFIO_LARGE); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); diff --git a/libarchive/test/test_read_format_cpio_bin.c b/libarchive/test/test_read_format_cpio_bin.c index e65cb9b3870c..7b0fad268c0b 100644 --- a/libarchive/test/test_read_format_cpio_bin.c +++ b/libarchive/test/test_read_format_cpio_bin.c @@ -52,6 +52,8 @@ DEFINE_TEST(test_read_format_cpio_bin) assertEqualIntA(a, 0, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertEqualInt(1, archive_file_count(a)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0)); assertEqualIntA(a, ARCHIVE_FORMAT_CPIO_BIN_LE, archive_format(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); diff --git a/libarchive/test/test_read_format_cpio_bin_Z.c b/libarchive/test/test_read_format_cpio_bin_Z.c index 8aca71f2476d..6afe691138fb 100644 --- a/libarchive/test/test_read_format_cpio_bin_Z.c +++ b/libarchive/test/test_read_format_cpio_bin_Z.c @@ -51,6 +51,8 @@ DEFINE_TEST(test_read_format_cpio_bin_Z) failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_cpio_bin_be.c b/libarchive/test/test_read_format_cpio_bin_be.c index dfd664c9a4d2..164396dab23f 100644 --- a/libarchive/test/test_read_format_cpio_bin_be.c +++ b/libarchive/test/test_read_format_cpio_bin_be.c @@ -44,6 +44,8 @@ DEFINE_TEST(test_read_format_cpio_bin_be) assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); assertEqualInt(archive_entry_uid(ae), 1000); assertEqualInt(archive_entry_gid(ae), 0); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_NONE); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_BE); diff --git a/libarchive/test/test_read_format_cpio_bin_bz2.c b/libarchive/test/test_read_format_cpio_bin_bz2.c index 8afbbcd1ebc1..7497bc41a988 100644 --- a/libarchive/test/test_read_format_cpio_bin_bz2.c +++ b/libarchive/test/test_read_format_cpio_bin_bz2.c @@ -49,6 +49,8 @@ DEFINE_TEST(test_read_format_cpio_bin_bz2) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assert(archive_filter_code(a, 0) == ARCHIVE_FILTER_BZIP2); assert(archive_format(a) == ARCHIVE_FORMAT_CPIO_BIN_LE); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); diff --git a/libarchive/test/test_read_format_cpio_bin_gz.c b/libarchive/test/test_read_format_cpio_bin_gz.c index 98f53578e129..3cc8f15eaee5 100644 --- a/libarchive/test/test_read_format_cpio_bin_gz.c +++ b/libarchive/test/test_read_format_cpio_bin_gz.c @@ -53,6 +53,8 @@ DEFINE_TEST(test_read_format_cpio_bin_gz) assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_GZIP); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); diff --git a/libarchive/test/test_read_format_cpio_bin_le.c b/libarchive/test/test_read_format_cpio_bin_le.c new file mode 100644 index 000000000000..2d0484c5232f --- /dev/null +++ b/libarchive/test/test_read_format_cpio_bin_le.c @@ -0,0 +1,57 @@ +/*- + * 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" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_cpio_bin_le) +{ + struct archive_entry *ae; + struct archive *a; + const char *reference = "test_read_format_cpio_bin_le.cpio"; + + extract_reference_file(reference); + 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, reference, 10)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString(archive_entry_pathname(ae), "file1111222233334444"); + assertEqualInt(archive_entry_size(ae), 5); + assertEqualInt(archive_entry_mtime(ae), 1240664175); + assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); + assertEqualInt(archive_entry_uid(ae), 1000); + assertEqualInt(archive_entry_gid(ae), 0); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + + assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_NONE); + assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + + diff --git a/libarchive/test/test_read_format_cpio_bin_le.cpio.uu b/libarchive/test/test_read_format_cpio_bin_le.cpio.uu new file mode 100644 index 000000000000..f7fef98ed96b --- /dev/null +++ b/libarchive/test/test_read_format_cpio_bin_le.cpio.uu @@ -0,0 +1,7 @@ +begin 644 test_read_format_cpio_bin_le.cpio +MQW$(`#P\I('H`P```0```/-);P@5````!0!F:6QE,3$Q,3(R,C(S,S,S-#0T +M-```86)C9&4`QW$``````````````0`````````+``````!44D%)3$52(2$A +M```````````````````````````````````````````````````````````` +3```````````````````````````` +` +end diff --git a/libarchive/test/test_read_format_cpio_bin_lzip.c b/libarchive/test/test_read_format_cpio_bin_lzip.c index 4e3fb58722fe..d9acf095ed77 100644 --- a/libarchive/test/test_read_format_cpio_bin_lzip.c +++ b/libarchive/test/test_read_format_cpio_bin_lzip.c @@ -53,6 +53,8 @@ DEFINE_TEST(test_read_format_cpio_bin_lzip) assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_LZIP); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); diff --git a/libarchive/test/test_read_format_cpio_bin_lzma.c b/libarchive/test/test_read_format_cpio_bin_lzma.c index cca19ffa7786..9a8a23ceb77c 100644 --- a/libarchive/test/test_read_format_cpio_bin_lzma.c +++ b/libarchive/test/test_read_format_cpio_bin_lzma.c @@ -54,6 +54,8 @@ DEFINE_TEST(test_read_format_cpio_bin_lzma) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_LZMA); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_cpio_bin_xz.c b/libarchive/test/test_read_format_cpio_bin_xz.c index 2b5e6143ca5a..b19c4fae606a 100644 --- a/libarchive/test/test_read_format_cpio_bin_xz.c +++ b/libarchive/test/test_read_format_cpio_bin_xz.c @@ -64,6 +64,8 @@ DEFINE_TEST(test_read_format_cpio_bin_xz) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_XZ); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_BIN_LE); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_cpio_filename.c b/libarchive/test/test_read_format_cpio_filename.c index d0c7c7afafff..cf4f5ac266b3 100644 --- a/libarchive/test/test_read_format_cpio_filename.c +++ b/libarchive/test/test_read_format_cpio_filename.c @@ -27,9 +27,9 @@ __FBSDID("$FreeBSD"); #include -static void -test_read_format_cpio_filename_eucJP_UTF8(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_eucJP_UTF8) { + const char *refname = "test_read_format_cpio_filename_eucjp.cpio"; struct archive *a; struct archive_entry *ae; @@ -40,6 +40,7 @@ test_read_format_cpio_filename_eucJP_UTF8(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -57,11 +58,15 @@ test_read_format_cpio_filename_eucJP_UTF8(const char *refname) assertEqualString("\xe6\xbc\xa2\xe5\xad\x97.txt", archive_entry_pathname(ae)); assertEqualInt(8, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xe8\xa1\xa8.txt", archive_entry_pathname(ae)); assertEqualInt(4, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -77,9 +82,9 @@ test_read_format_cpio_filename_eucJP_UTF8(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_UTF8_eucJP(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_UTF8_eucJP) { + const char *refname = "test_read_format_cpio_filename_utf8_jp.cpio"; struct archive *a; struct archive_entry *ae; @@ -90,6 +95,8 @@ test_read_format_cpio_filename_UTF8_eucJP(const char *refname) skipping("ja_JP.eucJP locale not available on this system."); return; } + 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)); @@ -128,9 +135,9 @@ test_read_format_cpio_filename_UTF8_eucJP(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_UTF8_UTF8_jp(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_UTF8_UTF8_jp) { + const char *refname = "test_read_format_cpio_filename_utf8_jp.cpio"; struct archive *a; struct archive_entry *ae; @@ -141,6 +148,7 @@ test_read_format_cpio_filename_UTF8_UTF8_jp(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -174,9 +182,9 @@ test_read_format_cpio_filename_UTF8_UTF8_jp(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_CP866_KOI8R(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_CP866_KOI8R) { + const char *refname = "test_read_format_cpio_filename_cp866.cpio"; struct archive *a; struct archive_entry *ae; @@ -188,6 +196,7 @@ test_read_format_cpio_filename_CP866_KOI8R(const char *refname) skipping("ru_RU.KOI8-R locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -226,9 +235,9 @@ test_read_format_cpio_filename_CP866_KOI8R(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_CP866_UTF8(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_CP866_UTF8) { + const char *refname = "test_read_format_cpio_filename_cp866.cpio"; struct archive *a; struct archive_entry *ae; @@ -239,6 +248,7 @@ test_read_format_cpio_filename_CP866_UTF8(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -277,9 +287,9 @@ test_read_format_cpio_filename_CP866_UTF8(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_KOI8R_CP866(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_KOI8R_CP866) { + const char *refname = "test_read_format_cpio_filename_koi8r.cpio"; struct archive *a; struct archive_entry *ae; @@ -291,6 +301,7 @@ test_read_format_cpio_filename_KOI8R_CP866(const char *refname) skipping("ru_RU.CP866 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -329,9 +340,9 @@ test_read_format_cpio_filename_KOI8R_CP866(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_KOI8R_UTF8(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_KOI8R_UTF8) { + const char *refname = "test_read_format_cpio_filename_koi8r.cpio"; struct archive *a; struct archive_entry *ae; @@ -342,6 +353,7 @@ test_read_format_cpio_filename_KOI8R_UTF8(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -380,9 +392,9 @@ test_read_format_cpio_filename_KOI8R_UTF8(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_UTF8_KOI8R(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_UTF8_KOI8R) { + const char *refname = "test_read_format_cpio_filename_utf8_ru.cpio"; struct archive *a; struct archive_entry *ae; @@ -394,6 +406,7 @@ test_read_format_cpio_filename_UTF8_KOI8R(const char *refname) skipping("ru_RU.KOI8-R locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -432,9 +445,9 @@ test_read_format_cpio_filename_UTF8_KOI8R(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_UTF8_CP866(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_UTF8_CP866) { + const char *refname = "test_read_format_cpio_filename_utf8_ru.cpio"; struct archive *a; struct archive_entry *ae; @@ -446,6 +459,7 @@ test_read_format_cpio_filename_UTF8_CP866(const char *refname) skipping("ru_RU.CP866 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -484,9 +498,9 @@ test_read_format_cpio_filename_UTF8_CP866(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_UTF8_UTF8_ru(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_UTF8_UTF8_ru) { + const char *refname = "test_read_format_cpio_filename_utf8_ru.cpio"; struct archive *a; struct archive_entry *ae; @@ -497,6 +511,7 @@ test_read_format_cpio_filename_UTF8_UTF8_ru(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -529,9 +544,9 @@ test_read_format_cpio_filename_UTF8_UTF8_ru(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_eucJP_CP932(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_eucJP_CP932) { + const char *refname = "test_read_format_cpio_filename_eucjp.cpio"; struct archive *a; struct archive_entry *ae; @@ -543,6 +558,7 @@ test_read_format_cpio_filename_eucJP_CP932(const char *refname) skipping("CP932 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -579,9 +595,9 @@ test_read_format_cpio_filename_eucJP_CP932(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_UTF8_CP932(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_UTF8_CP932) { + const char *refname = "test_read_format_cpio_filename_utf8_jp.cpio"; struct archive *a; struct archive_entry *ae; @@ -593,6 +609,7 @@ test_read_format_cpio_filename_UTF8_CP932(const char *refname) skipping("CP932 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -630,9 +647,9 @@ test_read_format_cpio_filename_UTF8_CP932(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_CP866_CP1251(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_CP866_CP1251) { + const char *refname = "test_read_format_cpio_filename_cp866.cpio"; struct archive *a; struct archive_entry *ae; @@ -644,6 +661,7 @@ test_read_format_cpio_filename_CP866_CP1251(const char *refname) skipping("CP1251 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -688,9 +706,9 @@ test_read_format_cpio_filename_CP866_CP1251(const char *refname) * filenames and store it in the cpio file and so we should read * it by default on Windows. */ -static void -test_read_format_cpio_filename_CP866_CP1251_win(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_CP866_CP1251_win) { + const char *refname = "test_read_format_cpio_filename_cp866.cpio"; struct archive *a; struct archive_entry *ae; @@ -701,6 +719,7 @@ test_read_format_cpio_filename_CP866_CP1251_win(const char *refname) skipping("Russian_Russia locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -733,9 +752,9 @@ test_read_format_cpio_filename_CP866_CP1251_win(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_KOI8R_CP1251(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_KOI8R_CP1251) { + const char *refname = "test_read_format_cpio_filename_koi8r.cpio"; struct archive *a; struct archive_entry *ae; @@ -747,6 +766,7 @@ test_read_format_cpio_filename_KOI8R_CP1251(const char *refname) skipping("CP1251 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -785,9 +805,9 @@ test_read_format_cpio_filename_KOI8R_CP1251(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_cpio_filename_UTF8_CP1251(const char *refname) +DEFINE_TEST(test_read_format_cpio_filename_UTF8_CP1251) { + const char *refname = "test_read_format_cpio_filename_utf8_ru.cpio"; struct archive *a; struct archive_entry *ae; @@ -799,6 +819,7 @@ test_read_format_cpio_filename_UTF8_CP1251(const char *refname) skipping("CP1251 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -837,38 +858,3 @@ test_read_format_cpio_filename_UTF8_CP1251(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } - -DEFINE_TEST(test_read_format_cpio_filename) -{ - const char *refname1 = "test_read_format_cpio_filename_eucjp.cpio"; - const char *refname2 = "test_read_format_cpio_filename_utf8_jp.cpio"; - const char *refname3 = "test_read_format_cpio_filename_cp866.cpio"; - const char *refname4 = "test_read_format_cpio_filename_koi8r.cpio"; - const char *refname5 = "test_read_format_cpio_filename_utf8_ru.cpio"; - - extract_reference_file(refname1); - test_read_format_cpio_filename_eucJP_UTF8(refname1); - test_read_format_cpio_filename_eucJP_CP932(refname1); - - extract_reference_file(refname2); - test_read_format_cpio_filename_UTF8_eucJP(refname2); - test_read_format_cpio_filename_UTF8_UTF8_jp(refname2); - test_read_format_cpio_filename_UTF8_CP932(refname2); - - extract_reference_file(refname3); - test_read_format_cpio_filename_CP866_KOI8R(refname3); - test_read_format_cpio_filename_CP866_UTF8(refname3); - test_read_format_cpio_filename_CP866_CP1251(refname3); - test_read_format_cpio_filename_CP866_CP1251_win(refname3); - - extract_reference_file(refname4); - test_read_format_cpio_filename_KOI8R_CP866(refname4); - test_read_format_cpio_filename_KOI8R_UTF8(refname4); - test_read_format_cpio_filename_KOI8R_CP1251(refname4); - - extract_reference_file(refname5); - test_read_format_cpio_filename_UTF8_KOI8R(refname5); - test_read_format_cpio_filename_UTF8_CP866(refname5); - test_read_format_cpio_filename_UTF8_UTF8_ru(refname5); - test_read_format_cpio_filename_UTF8_CP1251(refname5); -} diff --git a/libarchive/test/test_read_format_cpio_odc.c b/libarchive/test/test_read_format_cpio_odc.c index c608bf045a50..f433a4c916cd 100644 --- a/libarchive/test/test_read_format_cpio_odc.c +++ b/libarchive/test/test_read_format_cpio_odc.c @@ -57,6 +57,8 @@ DEFINE_TEST(test_read_format_cpio_odc) assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); assertA(archive_filter_code(a, 0) == ARCHIVE_FILTER_NONE); assertA(archive_format(a) == ARCHIVE_FORMAT_CPIO_POSIX); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c b/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c index d069da39eb74..cff64d72c1ed 100644 --- a/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c +++ b/libarchive/test/test_read_format_cpio_svr4_bzip2_rpm.c @@ -112,15 +112,17 @@ DEFINE_TEST(test_read_format_cpio_svr4_bzip2_rpm) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("./etc/file3", archive_entry_pathname(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify the end-of-archive. */ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); - + /* Verify that the format detection worked. */ assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_BZIP2); assertEqualString(archive_filter_name(a, 0), "bzip2"); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_NOCRC); - + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_cpio_svr4_gzip.c b/libarchive/test/test_read_format_cpio_svr4_gzip.c index 9b96234644ce..cb813d24f5d4 100644 --- a/libarchive/test/test_read_format_cpio_svr4_gzip.c +++ b/libarchive/test/test_read_format_cpio_svr4_gzip.c @@ -54,6 +54,8 @@ DEFINE_TEST(test_read_format_cpio_svr4_gzip) ARCHIVE_FILTER_GZIP); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_NOCRC); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c b/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c index eccde65ad53c..345760c1014f 100644 --- a/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c +++ b/libarchive/test/test_read_format_cpio_svr4_gzip_rpm.c @@ -112,6 +112,8 @@ DEFINE_TEST(test_read_format_cpio_svr4_gzip_rpm) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("./etc/file3", archive_entry_pathname(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify the end-of-archive. */ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); diff --git a/libarchive/test/test_read_format_cpio_svr4c_Z.c b/libarchive/test/test_read_format_cpio_svr4c_Z.c index c33cd07ef83c..29aa2c6341e6 100644 --- a/libarchive/test/test_read_format_cpio_svr4c_Z.c +++ b/libarchive/test/test_read_format_cpio_svr4c_Z.c @@ -51,6 +51,8 @@ DEFINE_TEST(test_read_format_cpio_svr4c_Z) assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_COMPRESS); failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_CPIO_SVR4_CRC); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_empty.c b/libarchive/test/test_read_format_empty.c index c27d57ad5a82..2556503acdf5 100644 --- a/libarchive/test/test_read_format_empty.c +++ b/libarchive/test/test_read_format_empty.c @@ -38,6 +38,8 @@ DEFINE_TEST(test_read_format_empty) assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae)); assertA(archive_filter_code(a, 0) == ARCHIVE_FILTER_NONE); assertA(archive_format(a) == ARCHIVE_FORMAT_EMPTY); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_gtar_filename.c b/libarchive/test/test_read_format_gtar_filename.c index 4b2a88c1ee0b..f81796b786da 100644 --- a/libarchive/test/test_read_format_gtar_filename.c +++ b/libarchive/test/test_read_format_gtar_filename.c @@ -27,9 +27,9 @@ __FBSDID("$FreeBSD"); #include -static void -test_read_format_gtar_filename_eucJP_UTF8(const char *refname) +DEFINE_TEST(test_read_format_gtar_filename_eucJP_UTF8) { + const char *refname = "test_read_format_gtar_filename_eucjp.tar.Z"; struct archive *a; struct archive_entry *ae; @@ -40,6 +40,7 @@ test_read_format_gtar_filename_eucJP_UTF8(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -62,6 +63,8 @@ test_read_format_gtar_filename_eucJP_UTF8(const char *refname) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xe8\xa1\xa8.txt", archive_entry_pathname(ae)); assertEqualInt(4, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -77,9 +80,9 @@ test_read_format_gtar_filename_eucJP_UTF8(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_gtar_filename_CP866_KOI8R(const char *refname) +DEFINE_TEST(test_read_format_gtar_filename_CP866_KOI8R) { + const char *refname = "test_read_format_gtar_filename_cp866.tar.Z"; struct archive *a; struct archive_entry *ae; @@ -91,6 +94,7 @@ test_read_format_gtar_filename_CP866_KOI8R(const char *refname) skipping("ru_RU.KOI8-R locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -129,9 +133,9 @@ test_read_format_gtar_filename_CP866_KOI8R(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_gtar_filename_CP866_UTF8(const char *refname) +DEFINE_TEST(test_read_format_gtar_filename_CP866_UTF8) { + const char *refname = "test_read_format_gtar_filename_cp866.tar.Z"; struct archive *a; struct archive_entry *ae; @@ -142,6 +146,7 @@ test_read_format_gtar_filename_CP866_UTF8(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -180,9 +185,9 @@ test_read_format_gtar_filename_CP866_UTF8(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_gtar_filename_KOI8R_CP866(const char *refname) +DEFINE_TEST(test_read_format_gtar_filename_KOI8R_CP866) { + const char *refname = "test_read_format_gtar_filename_koi8r.tar.Z"; struct archive *a; struct archive_entry *ae; @@ -194,6 +199,7 @@ test_read_format_gtar_filename_KOI8R_CP866(const char *refname) skipping("ru_RU.CP866 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -232,9 +238,9 @@ test_read_format_gtar_filename_KOI8R_CP866(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_gtar_filename_KOI8R_UTF8(const char *refname) +DEFINE_TEST(test_read_format_gtar_filename_KOI8R_UTF8) { + const char *refname = "test_read_format_gtar_filename_koi8r.tar.Z"; struct archive *a; struct archive_entry *ae; @@ -245,6 +251,7 @@ test_read_format_gtar_filename_KOI8R_UTF8(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -283,9 +290,9 @@ test_read_format_gtar_filename_KOI8R_UTF8(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_gtar_filename_eucJP_CP932(const char *refname) +DEFINE_TEST(test_read_format_gtar_filename_eucJP_CP932) { + const char *refname = "test_read_format_gtar_filename_eucjp.tar.Z"; struct archive *a; struct archive_entry *ae; @@ -297,6 +304,7 @@ test_read_format_gtar_filename_eucJP_CP932(const char *refname) skipping("CP932 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -333,9 +341,9 @@ test_read_format_gtar_filename_eucJP_CP932(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_gtar_filename_CP866_CP1251(const char *refname) +DEFINE_TEST(test_read_format_gtar_filename_CP866_CP1251) { + const char *refname = "test_read_format_gtar_filename_cp866.tar.Z"; struct archive *a; struct archive_entry *ae; @@ -347,6 +355,7 @@ test_read_format_gtar_filename_CP866_CP1251(const char *refname) skipping("CP1251 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -391,9 +400,9 @@ test_read_format_gtar_filename_CP866_CP1251(const char *refname) * filenames and store it in the gtar file and so we should read * it by default on Windows. */ -static void -test_read_format_gtar_filename_CP866_CP1251_win(const char *refname) +DEFINE_TEST(test_read_format_gtar_filename_CP866_CP1251_win) { + const char *refname = "test_read_format_gtar_filename_cp866.tar.Z"; struct archive *a; struct archive_entry *ae; @@ -404,6 +413,7 @@ test_read_format_gtar_filename_CP866_CP1251_win(const char *refname) skipping("Russian_Russia locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -436,9 +446,9 @@ test_read_format_gtar_filename_CP866_CP1251_win(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_gtar_filename_KOI8R_CP1251(const char *refname) +DEFINE_TEST(test_read_format_gtar_filename_KOI8R_CP1251) { + const char *refname = "test_read_format_gtar_filename_koi8r.tar.Z"; struct archive *a; struct archive_entry *ae; @@ -450,6 +460,7 @@ test_read_format_gtar_filename_KOI8R_CP1251(const char *refname) skipping("CP1251 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -488,25 +499,3 @@ test_read_format_gtar_filename_KOI8R_CP1251(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } - -DEFINE_TEST(test_read_format_gtar_filename) -{ - const char *refname1 = "test_read_format_gtar_filename_eucjp.tar.Z"; - const char *refname2 = "test_read_format_gtar_filename_cp866.tar.Z"; - const char *refname3 = "test_read_format_gtar_filename_koi8r.tar.Z"; - - extract_reference_file(refname1); - test_read_format_gtar_filename_eucJP_UTF8(refname1); - test_read_format_gtar_filename_eucJP_CP932(refname1); - - extract_reference_file(refname2); - test_read_format_gtar_filename_CP866_KOI8R(refname2); - test_read_format_gtar_filename_CP866_UTF8(refname2); - test_read_format_gtar_filename_CP866_CP1251(refname2); - test_read_format_gtar_filename_CP866_CP1251_win(refname2); - - extract_reference_file(refname3); - test_read_format_gtar_filename_KOI8R_CP866(refname3); - test_read_format_gtar_filename_KOI8R_UTF8(refname3); - test_read_format_gtar_filename_KOI8R_CP1251(refname3); -} diff --git a/libarchive/test/test_read_format_gtar_gz.c b/libarchive/test/test_read_format_gtar_gz.c index 8d60de00754f..2541f9926216 100644 --- a/libarchive/test/test_read_format_gtar_gz.c +++ b/libarchive/test/test_read_format_gtar_gz.c @@ -54,6 +54,8 @@ DEFINE_TEST(test_read_format_gtar_gz) assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_GZIP); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_GNUTAR); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_gtar_lzma.c b/libarchive/test/test_read_format_gtar_lzma.c index 5dfbb2c227f2..280a089fd391 100644 --- a/libarchive/test/test_read_format_gtar_lzma.c +++ b/libarchive/test/test_read_format_gtar_lzma.c @@ -66,6 +66,8 @@ DEFINE_TEST(test_read_format_gtar_lzma) archive_read_next_header(a, &ae)); assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_LZMA); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_GNUTAR); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); finish: assertEqualInt(ARCHIVE_OK, archive_read_free(a)); diff --git a/libarchive/test/test_read_format_gtar_sparse.c b/libarchive/test/test_read_format_gtar_sparse.c index 9a3511e9cc6a..7ab13c1109a0 100644 --- a/libarchive/test/test_read_format_gtar_sparse.c +++ b/libarchive/test/test_read_format_gtar_sparse.c @@ -200,6 +200,8 @@ verify_archive_file(const char *name, struct archive_contents *ac) } failure("Name mismatch in archive %s", name); assertEqualString(ac->filename, archive_entry_pathname(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); expect = *cts++; while (0 == (err = archive_read_data_block(a, diff --git a/libarchive/test/test_read_format_gtar_sparse_skip_entry.c b/libarchive/test/test_read_format_gtar_sparse_skip_entry.c index 813315b71fd7..1caed21bcaca 100644 --- a/libarchive/test/test_read_format_gtar_sparse_skip_entry.c +++ b/libarchive/test/test_read_format_gtar_sparse_skip_entry.c @@ -25,6 +25,11 @@ #include "test.h" __FBSDID("$FreeBSD"); +#if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER <= 1300) +# define LITERAL_LL(x) x##i64 +#else +# define LITERAL_LL(x) x##ll +#endif /* * To test skip a sparse file entry, this test does not read file data. */ @@ -47,7 +52,7 @@ DEFINE_TEST(test_read_format_gtar_sparse_skip_entry) /* Verify regular first file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("a", archive_entry_pathname(ae)); - assertEqualInt(10737418244, archive_entry_size(ae)); + assertEqualInt(LITERAL_LL(10737418244), archive_entry_size(ae)); assertEqualInt(archive_entry_is_encrypted(ae), 0); assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); @@ -86,7 +91,7 @@ DEFINE_TEST(test_read_format_gtar_sparse_skip_entry) /* Verify regular first file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("a", archive_entry_pathname(ae)); - assertEqualInt(10737418244, archive_entry_size(ae)); + assertEqualInt(LITERAL_LL(10737418244), archive_entry_size(ae)); assertEqualInt(archive_entry_is_encrypted(ae), 0); assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); diff --git a/libarchive/test/test_read_format_iso_Z.c b/libarchive/test/test_read_format_iso_Z.c index 551e0cf3431c..6492706c3df6 100644 --- a/libarchive/test/test_read_format_iso_Z.c +++ b/libarchive/test/test_read_format_iso_Z.c @@ -47,6 +47,8 @@ test1(void) assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_COMPRESS); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } @@ -88,6 +90,8 @@ test2(void) assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_COMPRESS); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_ISO9660); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_iso_multi_extent.c b/libarchive/test/test_read_format_iso_multi_extent.c index 63b5cf7abb5d..dafbfd38d681 100644 --- a/libarchive/test/test_read_format_iso_multi_extent.c +++ b/libarchive/test/test_read_format_iso_multi_extent.c @@ -73,6 +73,8 @@ DEFINE_TEST(test_read_format_iso_multi_extent) assertEqualInt(1, archive_entry_stat(ae)->st_nlink); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); } else { failure("Saw a file that shouldn't have been there"); assertEqualString(archive_entry_pathname(ae), ""); diff --git a/libarchive/test/test_read_format_iso_xorriso.c b/libarchive/test/test_read_format_iso_xorriso.c index 13502605a2ba..ce71a560a01c 100644 --- a/libarchive/test/test_read_format_iso_xorriso.c +++ b/libarchive/test/test_read_format_iso_xorriso.c @@ -86,6 +86,9 @@ DEFINE_TEST(test_read_format_iso_xorriso) for (i = 0; i < 10; ++i) { assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + if (strcmp(".", archive_entry_pathname(ae)) == 0) { /* '.' root directory. */ assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); diff --git a/libarchive/test/test_read_format_isojoliet_bz2.c b/libarchive/test/test_read_format_isojoliet_bz2.c index 36239d121fea..eb33c0b4f829 100644 --- a/libarchive/test/test_read_format_isojoliet_bz2.c +++ b/libarchive/test/test_read_format_isojoliet_bz2.c @@ -83,6 +83,8 @@ DEFINE_TEST(test_read_format_isojoliet_bz2) assertEqualIntA(a, ARCHIVE_EOF, archive_read_data_block(a, &p, &size, &offset)); assertEqualInt((int)size, 0); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* A directory. */ assertEqualInt(0, archive_read_next_header(a, &ae)); @@ -91,6 +93,8 @@ DEFINE_TEST(test_read_format_isojoliet_bz2) assertEqualInt(2048, archive_entry_size(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* A regular file with two names ("hardlink" gets returned * first, so it's not marked as a hardlink). */ @@ -121,6 +125,8 @@ DEFINE_TEST(test_read_format_isojoliet_bz2) assertEqualInt(0, archive_entry_size(ae)); assertEqualInt(172802, archive_entry_mtime(ae)); assertEqualInt(172802, archive_entry_atime(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); diff --git a/libarchive/test/test_read_format_isojoliet_long.c b/libarchive/test/test_read_format_isojoliet_long.c index 06f3f4fee488..4283c399fbb4 100644 --- a/libarchive/test/test_read_format_isojoliet_long.c +++ b/libarchive/test/test_read_format_isojoliet_long.c @@ -91,6 +91,8 @@ DEFINE_TEST(test_read_format_isojoliet_long) assertEqualIntA(a, ARCHIVE_EOF, archive_read_data_block(a, &p, &size, &offset)); assertEqualInt((int)size, 0); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* A directory. */ pathname[100] = 'd'; @@ -103,6 +105,8 @@ DEFINE_TEST(test_read_format_isojoliet_long) assertEqualInt(2048, archive_entry_size(ae)); assertEqualInt(86401, archive_entry_mtime(ae)); assertEqualInt(86401, archive_entry_atime(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* A regular file with two names (pathname gets returned * first, so it's not marked as a hardlink). */ @@ -119,6 +123,8 @@ DEFINE_TEST(test_read_format_isojoliet_long) assertEqualInt(6, (int)size); assertEqualInt(0, offset); assertEqualMem(p, "hello\n", 6); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Second name for the same regular file (this happens to be * returned second, so does get marked as a hardlink). */ @@ -127,6 +133,8 @@ DEFINE_TEST(test_read_format_isojoliet_long) assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); assertEqualString("hardlink", archive_entry_hardlink(ae)); assert(!archive_entry_size_is_set(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); diff --git a/libarchive/test/test_read_format_isojoliet_rr.c b/libarchive/test/test_read_format_isojoliet_rr.c index ebf1b92d97f5..3c19516d614d 100644 --- a/libarchive/test/test_read_format_isojoliet_rr.c +++ b/libarchive/test/test_read_format_isojoliet_rr.c @@ -83,6 +83,8 @@ DEFINE_TEST(test_read_format_isojoliet_rr) assertEqualIntA(a, ARCHIVE_EOF, archive_read_data_block(a, &p, &size, &offset)); assertEqualInt((int)size, 0); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* A directory. */ assertEqualInt(0, archive_read_next_header(a, &ae)); @@ -94,6 +96,8 @@ DEFINE_TEST(test_read_format_isojoliet_rr) assertEqualInt(2, archive_entry_stat(ae)->st_nlink); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* A regular file with two names ("hardlink" gets returned * first, so it's not marked as a hardlink). */ @@ -116,6 +120,8 @@ DEFINE_TEST(test_read_format_isojoliet_rr) assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Second name for the same regular file (this happens to be * returned second, so does get marked as a hardlink). */ @@ -132,6 +138,8 @@ DEFINE_TEST(test_read_format_isojoliet_rr) assertEqualInt(2, archive_entry_nlink(ae)); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* A symlink to the regular file. */ assertEqualInt(0, archive_read_next_header(a, &ae)); @@ -145,6 +153,8 @@ DEFINE_TEST(test_read_format_isojoliet_rr) assertEqualInt(1, archive_entry_nlink(ae)); assertEqualInt(1, archive_entry_uid(ae)); assertEqualInt(2, archive_entry_gid(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); diff --git a/libarchive/test/test_read_format_isojoliet_versioned.c b/libarchive/test/test_read_format_isojoliet_versioned.c index 8fa974b9806f..011b5e296b94 100644 --- a/libarchive/test/test_read_format_isojoliet_versioned.c +++ b/libarchive/test/test_read_format_isojoliet_versioned.c @@ -58,6 +58,8 @@ DEFINE_TEST(test_read_format_isojoliet_versioned) assertEqualInt(0, archive_read_next_header(a, &ae)); assertEqualString("test", archive_entry_pathname(ae)); assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* A regular file which is called test.txt and has * ;1 appended to it because apparently Nero always @@ -69,6 +71,8 @@ DEFINE_TEST(test_read_format_isojoliet_versioned) assertEqualString("test/test.txt", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ assertEqualInt(ARCHIVE_EOF, archive_read_next_header(a, &ae)); diff --git a/libarchive/test/test_read_format_isorr_bz2.c b/libarchive/test/test_read_format_isorr_bz2.c index 1c16f3cb1ef7..d2dfa2e5f793 100644 --- a/libarchive/test/test_read_format_isorr_bz2.c +++ b/libarchive/test/test_read_format_isorr_bz2.c @@ -73,6 +73,9 @@ DEFINE_TEST(test_read_format_isorr_bz2) * verify that each one is what we expect. */ for (i = 0; i < 10; ++i) { assertEqualInt(0, archive_read_next_header(a, &ae)); + + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); if (strcmp(".", archive_entry_pathname(ae)) == 0) { /* '.' root directory. */ diff --git a/libarchive/test/test_read_format_isorr_ce.c b/libarchive/test/test_read_format_isorr_ce.c index c19864348664..1e57acb7668b 100644 --- a/libarchive/test/test_read_format_isorr_ce.c +++ b/libarchive/test/test_read_format_isorr_ce.c @@ -109,6 +109,9 @@ DEFINE_TEST(test_read_format_isorr_ce) * verify that each one is what we expect. */ for (i = 0; i < 8; ++i) { assertEqualInt(0, archive_read_next_header(a, &ae)); + + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); if (strcmp(".", archive_entry_pathname(ae)) == 0) { /* '.' root directory. */ diff --git a/libarchive/test/test_read_format_isorr_new_bz2.c b/libarchive/test/test_read_format_isorr_new_bz2.c index 96fb0589340c..4c1b5692e9ef 100644 --- a/libarchive/test/test_read_format_isorr_new_bz2.c +++ b/libarchive/test/test_read_format_isorr_new_bz2.c @@ -74,6 +74,9 @@ DEFINE_TEST(test_read_format_isorr_new_bz2) * verify that each one is what we expect. */ for (i = 0; i < 10; ++i) { assertEqualInt(0, archive_read_next_header(a, &ae)); + + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); if (strcmp(".", archive_entry_pathname(ae)) == 0) { /* '.' root directory. */ diff --git a/libarchive/test/test_read_format_isorr_rr_moved.c b/libarchive/test/test_read_format_isorr_rr_moved.c index 57e7e1f85951..693caef621f2 100644 --- a/libarchive/test/test_read_format_isorr_rr_moved.c +++ b/libarchive/test/test_read_format_isorr_rr_moved.c @@ -80,6 +80,9 @@ DEFINE_TEST(test_read_format_isorr_rr_moved) for (i = 0; i < 13; ++i) { assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + if (strcmp(".", archive_entry_pathname(ae)) == 0) { /* '.' root directory. */ assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); diff --git a/libarchive/test/test_read_format_isozisofs_bz2.c b/libarchive/test/test_read_format_isozisofs_bz2.c index 50ad32c70b01..adf9624274e0 100644 --- a/libarchive/test/test_read_format_isozisofs_bz2.c +++ b/libarchive/test/test_read_format_isozisofs_bz2.c @@ -73,6 +73,9 @@ DEFINE_TEST(test_read_format_isozisofs_bz2) for (i = 0; i < 8; ++i) { assertEqualInt(0, archive_read_next_header(a, &ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + if (strcmp(".", archive_entry_pathname(ae)) == 0) { /* '.' root directory. */ assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); diff --git a/libarchive/test/test_read_format_lha.c b/libarchive/test/test_read_format_lha.c index 36c5d080340a..6a53976c2a75 100644 --- a/libarchive/test/test_read_format_lha.c +++ b/libarchive/test/test_read_format_lha.c @@ -169,6 +169,8 @@ verify(const char *refname, int posix) assertEqualIntA(a, ARCHIVE_EOF, archive_read_data_block(a, &pv, &s, &o)); assertEqualInt(s, 0); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify directory2. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -181,6 +183,8 @@ verify(const char *refname, int posix) assertEqualIntA(a, ARCHIVE_EOF, archive_read_data_block(a, &pv, &s, &o)); assertEqualInt(s, 0); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); if (posix) { /* Verify symbolic link file1. */ @@ -192,6 +196,8 @@ verify(const char *refname, int posix) assertEqualInt(uid, archive_entry_uid(ae)); assertEqualInt(gid, archive_entry_gid(ae)); assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify symbolic link file2. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -202,6 +208,8 @@ verify(const char *refname, int posix) assertEqualInt(uid, archive_entry_uid(ae)); assertEqualInt(gid, archive_entry_gid(ae)); assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); } /* Verify regular file1. */ @@ -214,6 +222,8 @@ verify(const char *refname, int posix) assertEqualInt(file1_size, archive_entry_size(ae)); assertEqualInt(file1_size, archive_read_data(a, buff, file1_size)); assertEqualMem(buff, file1, file1_size); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file2. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -228,6 +238,8 @@ verify(const char *refname, int posix) assertEqualInt(file2_size, archive_entry_size(ae)); assertEqualInt(file2_size, archive_read_data(a, buff, file2_size)); assertEqualMem(buff, file2, file2_size); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify the number of files read. */ if (posix) { @@ -246,6 +258,10 @@ verify(const char *refname, int posix) assertEqualInt(4, archive_file_count(a)); } + /* Verify encryption status */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + /* Verify archive format. */ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0)); assertEqualIntA(a, ARCHIVE_FORMAT_LHA, archive_format(a)); diff --git a/libarchive/test/test_read_format_lha_bugfix_0.c b/libarchive/test/test_read_format_lha_bugfix_0.c new file mode 100644 index 000000000000..2b4160b3220e --- /dev/null +++ b/libarchive/test/test_read_format_lha_bugfix_0.c @@ -0,0 +1,76 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD"); + +DEFINE_TEST(test_read_format_lha_bugfix_0) +{ + const char *refname = "test_read_format_lha_bugfix_0.lzh"; + struct archive_entry *ae; + struct archive *a; + const void *pv; + size_t s; + int64_t o; + + 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 directory1. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("f", archive_entry_pathname(ae)); + assertEqualInt(776, archive_entry_size(ae)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_data_block(a, &pv, &s, &o)); + assertEqualInt(s, 776); + assertEqualIntA(a, ARCHIVE_EOF, + archive_read_data_block(a, &pv, &s, &o)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Verify the number of files read. */ + assertEqualInt(1, archive_file_count(a)); + + /* Verify encryption status */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), + ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_LHA, archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + diff --git a/libarchive/test/test_read_format_lha_bugfix_0.lzh.uu b/libarchive/test/test_read_format_lha_bugfix_0.lzh.uu new file mode 100644 index 000000000000..34f5fb58cdfc --- /dev/null +++ b/libarchive/test/test_read_format_lha_bugfix_0.lzh.uu @@ -0,0 +1,19 @@ +begin 644 test_read_format_lha_bugfix_0.lzh +M+P`M;&@U+7T"```(`P``$D*U4R`"],%5!0``,;<$``%F!0!0I($'`%$4`/4! +M```#!FS;%+&?H/SZ_`=2K$ +M-,5VE5(EVT9P)2WPS:$ET@K!861T3'*N&!9P1"!)<58 +M77$ZCA;PVAGN>:E@6E`;&<>"ZC!Y63H&,DLG*7"!89A!JAN$L?(RDL_4`*!5 +MFWE%HD>>J)M8]^%^EM_SX;PSL4PVL.5A30:MQ@.E>3">;0[^XNA:([UUF>FV +MLJS"HLP=\5-Y)HP)8800U81@-`7,)<)ZD6)*P7'5$BBE@NYFR%CS>"PRZ6`Z +M8JPQ)&7:HGF$^/FQGF_PQ;'VBN?WET90#=W4S(2%Q9+!.>\`MR,`]Y;GQNU* +MFV]2K+=B$EZ2M6[KKUMXA2,NK[\3?3>^;:NB(+]2)S/?J*C<=Y'\SN?1Z7-T +M."&"A!R%6"V5"ZI&W[UZFT>T$?;.=#MVH9@V=/!#*$).G2G(Y4.Q*[1AVL?6*_:94#("2J<.Q< +M2F+D][."[K,$ +M^*>G*P8XG*=--.O:V?F58URE?C"9Q>FRRHW0RHQTQ\`IS.%ZJ:J2YKXH6C:+ +MHAD@<2N;;[H(/YMP]]_/=25P$K"=;&?2)-\6HA5V6U"%Z`/3MMKL6>%KKCGI +*+1"40KV_/\%````` +` +end diff --git a/libarchive/test/test_read_format_lha_filename.c b/libarchive/test/test_read_format_lha_filename.c index 67b6f3643843..126a8704ce4a 100644 --- a/libarchive/test/test_read_format_lha_filename.c +++ b/libarchive/test/test_read_format_lha_filename.c @@ -68,12 +68,15 @@ test_read_format_lha_filename_CP932_eucJP(const char *refname) assertEqualString("\xB4\xC1\xBB\xFA\x2E\x74\x78\x74", archive_entry_pathname(ae)); assertEqualInt(8, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xC9\xBD\x2E\x74\x78\x74", archive_entry_pathname(ae)); assertEqualInt(4, archive_entry_size(ae)); - + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); diff --git a/libarchive/test/test_read_format_mtree.c b/libarchive/test/test_read_format_mtree.c index efedc415eb6d..a8342f55790e 100644 --- a/libarchive/test/test_read_format_mtree.c +++ b/libarchive/test/test_read_format_mtree.c @@ -57,6 +57,8 @@ test_read_format_mtree1(void) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_options(a, "mtree:checkfs")); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, reffile, 11)); @@ -76,63 +78,103 @@ test_read_format_mtree1(void) assertEqualInt(archive_entry_size(ae), 3); assertEqualInt(3, archive_read_data(a, buff, 3)); assertEqualMem(buff, "hi\n", 3); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir"); assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir/file with space"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "file with space"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/dir3a"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/dir3a/indir3a"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/fullindir2"); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/indir2"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/dir3b"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/dir3b/indir3b"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString(archive_entry_pathname(ae), "dir2/dir3b/filename\\with_esc\b\t\fapes"); + assertEqualInt(archive_entry_filetype(ae), AE_IFREG); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "notindir"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/emptyfile"); assertEqualInt(archive_entry_size(ae), 0); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/smallfile"); assertEqualInt(archive_entry_size(ae), 1); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* TODO: Mtree reader should probably return ARCHIVE_WARN for this. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/toosmallfile"); assertEqualInt(archive_entry_size(ae), -1); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/bigfile"); assertEqualInt(archive_entry_size(ae), max_int64); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/toobigfile"); /* Size in mtree is max_int64 + 1; should return max_int64. */ assertEqualInt(archive_entry_size(ae), max_int64); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/veryoldfile"); @@ -143,15 +185,19 @@ test_read_format_mtree1(void) /* Simply asserting min_time - 1 > 0 breaks with some compiler optimizations. */ t = min_time - 1; assert(t > 0); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* toooldfile is 1 sec older, which should overflow and get returned * with the same value. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/toooldfile"); assertEqualInt(archive_entry_mtime(ae), min_time); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); - assertEqualInt(19, archive_file_count(a)); + assertEqualInt(20, archive_file_count(a)); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } @@ -170,12 +216,16 @@ test_read_format_mtree2(void) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_options(a, "mtree:checkfs")); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_MTREE); assertEqualString(archive_entry_pathname(ae), "d"); assertEqualInt(archive_entry_filetype(ae), AE_IFDIR); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualInt(1, archive_file_count(a)); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); @@ -205,17 +255,25 @@ test_read_format_mtree3(void) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_options(a, "mtree:checkfs")); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "a"); assertEqualInt(archive_entry_filetype(ae), AE_IFREG); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "b"); assertEqualInt(archive_entry_filetype(ae), AE_IFLNK); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "c"); assertEqualInt(archive_entry_filetype(ae), AE_IFREG); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualInt(3, archive_file_count(a)); @@ -252,26 +310,40 @@ DEFINE_TEST(test_read_format_mtree_filenames_only) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_options(a, "mtree:checkfs")); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); - assertEqualString(archive_entry_pathname(ae), "./a"); + assertEqualString(archive_entry_pathname(ae), "./a"); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "./b"); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "./c"); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "./d"); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "./e"); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "./f"); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0444); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualInt(6, archive_file_count(a)); @@ -306,6 +378,8 @@ DEFINE_TEST(test_read_format_mtree_nochange) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_options(a, "mtree:checkfs")); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -313,16 +387,22 @@ DEFINE_TEST(test_read_format_mtree_nochange) assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); assertEqualInt(archive_entry_mtime(ae), 123); assertEqualInt(archive_entry_size(ae), 5); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "./b"); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); assertEqualInt(archive_entry_mtime(ae), 234); assertEqualInt(archive_entry_size(ae), 6); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "./c"); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); assertEqualInt(archive_entry_mtime(ae), 345); assertEqualInt(archive_entry_size(ae), 7); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualInt(3, archive_file_count(a)); @@ -337,6 +417,8 @@ DEFINE_TEST(test_read_format_mtree_nochange) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_options(a, "mtree:checkfs")); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive2, sizeof(archive2))); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -351,6 +433,8 @@ DEFINE_TEST(test_read_format_mtree_nochange) assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); assertEqualInt(archive_entry_mtime(ae), 234); assertEqualInt(archive_entry_size(ae), 6); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "./c"); #if !defined(_WIN32) || defined(__CYGWIN__) @@ -358,6 +442,8 @@ DEFINE_TEST(test_read_format_mtree_nochange) #endif assert(archive_entry_mtime(ae) != 345); assertEqualInt(archive_entry_size(ae), 7); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualInt(3, archive_file_count(a)); @@ -380,6 +466,8 @@ DEFINE_TEST(test_read_format_mtree_nomagic_v1_form) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_options(a, "mtree:checkfs")); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, reffile, 11)); @@ -399,41 +487,65 @@ DEFINE_TEST(test_read_format_mtree_nomagic_v1_form) assertEqualInt(archive_entry_size(ae), 3); assertEqualInt(3, archive_read_data(a, buff, 3)); assertEqualMem(buff, "hi\n", 3); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir"); assertEqualInt(AE_IFDIR, archive_entry_filetype(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir/file with space"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "file with space"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/dir3a"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/dir3a/indir3a"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/fullindir2"); assertEqualInt(archive_entry_mode(ae), AE_IFREG | 0644); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/indir2"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/dir3b"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "dir2/dir3b/indir3b"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString(archive_entry_pathname(ae), "notindir"); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualInt(12, archive_file_count(a)); @@ -459,6 +571,8 @@ DEFINE_TEST(test_read_format_mtree_nomagic_v2_form) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_options(a, "mtree:checkfs")); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, reffile, 11)); @@ -524,6 +638,8 @@ DEFINE_TEST(test_read_format_mtree_nomagic_v2_netbsd_form) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_options(a, "mtree:checkfs")); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, reffile, 11)); @@ -587,6 +703,8 @@ DEFINE_TEST(test_read_format_mtree_nonexistent_contents_file) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_options(a, "mtree:checkfs")); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, archive, sizeof(archive))); assertEqualIntA(a, ARCHIVE_WARN, archive_read_next_header(a, &ae)); diff --git a/libarchive/test/test_read_format_mtree.mtree.uu b/libarchive/test/test_read_format_mtree.mtree.uu index a0dff18e442e..f1c9d6030698 100644 --- a/libarchive/test/test_read_format_mtree.mtree.uu +++ b/libarchive/test/test_read_format_mtree.mtree.uu @@ -5,14 +5,16 @@ M92!U:60],3@*("XN"F9I;&5<,#0P=VET:%PP-#!S<&%C92!T>7!E/69I;&4* M9&ER,B!T>7!E/61I<@H@9&ER,V$@='EP93UD:7(*("!I;F1I7!E/61I<@H@(&EN9&ER,V(@ -M='EP93UF:6QE"B`@+BX*("XN"FYO=&EN9&ER('1Y<&4]9FEL90ID:7(R+V9U -M;&QI;F1I7!E/69I;&4@F4]+3$*9&ER,B]B:6=F:6QE('1Y<&4]9FEL92!S:7IE/3DR -M,C,S-S(P,S8X-30W-S4X,#<*9&ER,B]T;V]B:6=F:6QE('1Y<&4]9FEL92!S -M:7IE/3DR,C,S-S(P,S8X-30W-S4X,#@*9&ER,B]V97)Y;VQD9FEL92!T>7!E -M/69I;&4@=&EM93TM.3(R,S,W,C`S-C@U-#7!E/69I +M;&4@F4]+3$*9&ER,B]B:6=F:6QE('1Y +M<&4]9FEL92!S:7IE/3DR,C,S-S(P,S8X-30W-S4X,#<*9&ER,B]T;V]B:6=F +M:6QE('1Y<&4]9FEL92!S:7IE/3DR,C,S-S(P,S8X-30W-S4X,#@*9&ER,B]V +M97)Y;VQD9FEL92!T>7!E/69I;&4@=&EM93TM.3(R,S,W,C`S-C@U-#'1/`[S9UA9,WT5`&I*2B-\5*XZ>SW"Y0.C)1^;.UK]$ +MXK@UJ)SH93P!`!P`` +` +end diff --git a/libarchive/test/test_read_format_rar_encryption_header.c b/libarchive/test/test_read_format_rar_encryption_header.c new file mode 100644 index 000000000000..81965eb6787f --- /dev/null +++ b/libarchive/test/test_read_format_rar_encryption_header.c @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2013 Konrad Kleine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_rar_encryption_header) +{ + /* This file is password protected (encrypted) with AES-256. The headers + ARE encrypted. Password is "12345678". */ + const char *refname = "test_read_format_rar_encryption_header.rar"; + 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)); + + assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a)); + + /* Verify regular file but with encrypted headers + as a consequence, all meta information is invalid. */ + assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae)); + + assertEqualInt(0, archive_entry_mode(ae)); + assertEqualString(NULL, archive_entry_pathname(ae)); + assertEqualInt(0, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(1, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + assertEqualInt(ARCHIVE_FATAL, archive_read_data(a, buff, sizeof(buff))); + + assertEqualInt(1, archive_file_count(a)); + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_RAR, archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_read_format_rar_encryption_header.rar.uu b/libarchive/test/test_read_format_rar_encryption_header.rar.uu new file mode 100644 index 000000000000..5bd48d7a503f --- /dev/null +++ b/libarchive/test/test_read_format_rar_encryption_header.rar.uu @@ -0,0 +1,8 @@ +begin 664 test_read_format_rar_encryption_header.rar +M4F%R(1H'`,Z91EQMQ=@1S +M,[$:0Y\;'G8_C0D%2L":*;.B*LM0!,!.2!RBU?+`DTN9KXD\<4RGSC+#KCC:\R +M$)P&_/D2I'(4,7$^#2[\,Y"D.2T$@B1#J-Z$]R6_*($W7+!JH\,(XH,'C7FC +H@B,\$1>+CX-=`-%F3C6%I^,NJV2G7':,JF?4KS:6=TAK%$V=]2+N^@`` +` +end diff --git a/libarchive/test/test_read_format_rar_encryption_partially.c b/libarchive/test/test_read_format_rar_encryption_partially.c new file mode 100644 index 000000000000..81256a96a019 --- /dev/null +++ b/libarchive/test/test_read_format_rar_encryption_partially.c @@ -0,0 +1,79 @@ +/*- + * Copyright (c) 2013 Konrad Kleine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_rar_encryption_partially) +{ + /* This file contains one file that is encrypted (foo.txt, password=12345678) + and one file that is not encrypted (bar.txt) The header is not encrypted + on this file. */ + const char *refname = "test_read_format_rar_encryption_partially.rar"; + 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)); + + assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a)); + + /* Verify encrypted file "foo.txt". */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae)); + assertEqualString("foo.txt", archive_entry_pathname(ae)); + assertEqualInt(16, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + assertEqualInt(ARCHIVE_FATAL, archive_read_data(a, buff, sizeof(buff))); + + /* Verify unencrypted file "bar.txt". */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae)); + assertEqualString("bar.txt", archive_entry_pathname(ae)); + assertEqualInt(16, archive_entry_size(ae)); + assertEqualInt(0, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + assertEqualInt(16, archive_read_data(a, buff, sizeof(buff))); + + assertEqualInt(2, 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_RAR, archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_read_format_rar_encryption_partially.rar.uu b/libarchive/test/test_read_format_rar_encryption_partially.rar.uu new file mode 100644 index 000000000000..0c9727f1add7 --- /dev/null +++ b/libarchive/test/test_read_format_rar_encryption_partially.rar.uu @@ -0,0 +1,7 @@ +begin 664 test_read_format_rar_encryption_partially.rar +M4F%R(1H'`,^0'2>C_^E6-T51TBV:OLN/8KJ<5S5/Y4G6N&PG<5GX;P= +MF_YJK^@\`3\09C!T((`G`!P````0`````[[BD,VF3#%#'3,'`+2!``!B87(N +F='AT#!#)/HRW]%5!"GXA#4D)_]J&++4FP^?OH,0]>P!`!P`` +` +end diff --git a/libarchive/test/test_read_format_raw.c b/libarchive/test/test_read_format_raw.c index a23b9c55a749..1310090cbc68 100644 --- a/libarchive/test/test_read_format_raw.c +++ b/libarchive/test/test_read_format_raw.c @@ -53,6 +53,8 @@ DEFINE_TEST(test_read_format_raw) assert(!archive_entry_atime_is_set(ae)); assert(!archive_entry_ctime_is_set(ae)); assert(!archive_entry_mtime_is_set(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualInt(4, archive_read_data(a, buff, 32)); assertEqualMem(buff, "foo\n", 4); @@ -74,6 +76,8 @@ DEFINE_TEST(test_read_format_raw) /* First (and only!) Entry */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("data", archive_entry_pathname(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Most fields should be unset (unknown) */ assert(!archive_entry_size_is_set(ae)); assert(!archive_entry_atime_is_set(ae)); diff --git a/libarchive/test/test_read_format_tar.c b/libarchive/test/test_read_format_tar.c index 8273e7530658..7c7cadd0a38b 100644 --- a/libarchive/test/test_read_format_tar.c +++ b/libarchive/test/test_read_format_tar.c @@ -74,6 +74,8 @@ static void verifyEmpty(void) assertEqualString(archive_filter_name(a, 0), "none"); failure("512 zero bytes should be recognized as a tar archive."); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); @@ -439,6 +441,8 @@ static void verify(unsigned char *d, size_t s, assertA(0 == archive_read_next_header(a, &ae)); assertEqualInt(archive_filter_code(a, 0), compression); assertEqualInt(archive_format(a), format); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify the only entry. */ f(ae); diff --git a/libarchive/test/test_read_format_tar_concatenated.c b/libarchive/test/test_read_format_tar_concatenated.c new file mode 100644 index 000000000000..d1f67e20f7df --- /dev/null +++ b/libarchive/test/test_read_format_tar_concatenated.c @@ -0,0 +1,86 @@ +/*- + * Copyright (c) 2014 Kevin Locke + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD"); + +/* + * The sample tar file is the result of concatenating two tar files, + * the first containing file1 the second containing file2. + * + * When the read_concatenated_archives option is specified, both files should + * be read. Otherwise, only file1 should be read. + */ +DEFINE_TEST(test_read_format_tar_concatenated) +{ + char name[] = "test_read_format_tar_concatenated.tar"; + struct archive_entry *ae; + struct archive *a; + + /* + * First test that when read_concatenated_archives is not specified + * only file1 is present. + */ + 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)); + extract_reference_file(name); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); + + /* Read first entry. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file1", archive_entry_pathname(ae)); + + /* Verify the end-of-archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + + /* + * Next test that when read_concatenated_archives is specified both + * file1 and file2 are present. + */ + 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_set_options(a, "read_concatenated_archives")); + extract_reference_file(name); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); + + /* Read first entry. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file1", archive_entry_pathname(ae)); + + /* Read second entry. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file2", archive_entry_pathname(ae)); + + /* Verify the end-of-archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_read_format_tar_concatenated.tar.uu b/libarchive/test/test_read_format_tar_concatenated.tar.uu new file mode 100644 index 000000000000..4354b56dc280 --- /dev/null +++ b/libarchive/test/test_read_format_tar_concatenated.tar.uu @@ -0,0 +1,72 @@ +begin 644 test_read_format_tar_concatenated.tar +M9FEL93$````````````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````#`P,#8T-"``,#`Q-S4P(``P,#$W-3`@`#`P,#`P,#`P,#`P +M(#$R,C8T,S0W-3$W(#`Q,C(W-``@,``````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````!UO8,'6D`%BS)LV;O7L&/+GDV[MNW;N'/KWLV[M^_?P(,+'TZ\ +MN/'CR),K7\Z\N?/GT*-+GTZ]NO7KV+-KW\Z]N_?OX,.+'T^^O/GSZ-.K7\^^ +?O?OW\./+GT^_OOW[^//KW\^_O___``8HX(`$%FC@4``` +` +end diff --git a/libarchive/test/test_read_format_tar_filename.c b/libarchive/test/test_read_format_tar_filename.c index ee2bf81dec94..9ee8e813f737 100644 --- a/libarchive/test/test_read_format_tar_filename.c +++ b/libarchive/test/test_read_format_tar_filename.c @@ -80,12 +80,16 @@ test_read_format_tar_filename_KOI8R_CP866(const char *refname) assertEqualString("\x8f\x90\x88\x82\x85\x92", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular second file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xaf\xe0\xa8\xa2\xa5\xe2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -123,6 +127,8 @@ test_read_format_tar_filename_KOI8R_CP866(const char *refname) assertEqualString("\xf0\xf2\xe9\xf7\xe5\xf4", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* * Verify regular second file. @@ -132,6 +138,8 @@ test_read_format_tar_filename_KOI8R_CP866(const char *refname) assertEqualString("\xaf\xe0\xa8\xa2\xa5\xe2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -179,13 +187,20 @@ test_read_format_tar_filename_KOI8R_UTF8(const char *refname) assertEqualString("\xd0\x9f\xd0\xa0\xd0\x98\xd0\x92\xd0\x95\xd0\xa2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + /* Verify encryption status */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); @@ -194,6 +209,10 @@ test_read_format_tar_filename_KOI8R_UTF8(const char *refname) assertEqualIntA(a, ARCHIVE_FILTER_COMPRESS, archive_filter_code(a, 0)); assertEqualIntA(a, ARCHIVE_FORMAT_TAR_PAX_INTERCHANGE, archive_format(a)); + + /* Verify encryption status */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Close the archive. */ assertEqualInt(ARCHIVE_OK, archive_read_close(a)); @@ -220,6 +239,10 @@ test_read_format_tar_filename_KOI8R_UTF8(const char *refname) assertEqualString("\xf0\xf2\xe9\xf7\xe5\xf4", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + + /* Verify encryption status */ + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* * Verify regular second file. @@ -286,12 +309,16 @@ test_read_format_tar_filename_KOI8R_CP1251(const char *refname) assertEqualString("\xcf\xd0\xc8\xc2\xc5\xd2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular second file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xef\xf0\xe8\xe2\xe5\xf2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -328,6 +355,8 @@ test_read_format_tar_filename_KOI8R_CP1251(const char *refname) assertEqualString("\xf0\xf2\xe9\xf7\xe5\xf4", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* * Verify regular second file. @@ -336,6 +365,8 @@ test_read_format_tar_filename_KOI8R_CP1251(const char *refname) assertEqualString("\xef\xf0\xe8\xe2\xe5\xf2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ diff --git a/libarchive/test/test_read_format_tbz.c b/libarchive/test/test_read_format_tbz.c index 475c558eefc5..331955fd9c39 100644 --- a/libarchive/test/test_read_format_tbz.c +++ b/libarchive/test/test_read_format_tbz.c @@ -53,6 +53,8 @@ DEFINE_TEST(test_read_format_tbz) assertEqualInt(1, archive_file_count(a)); assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_BZIP2); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_tgz.c b/libarchive/test/test_read_format_tgz.c index 60985a0d9f8c..9fba89657e92 100644 --- a/libarchive/test/test_read_format_tgz.c +++ b/libarchive/test/test_read_format_tgz.c @@ -54,6 +54,8 @@ DEFINE_TEST(test_read_format_tgz) assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_GZIP); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualInt(ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK,archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_tlz.c b/libarchive/test/test_read_format_tlz.c index 2a058d03971b..7c7a1431903c 100644 --- a/libarchive/test/test_read_format_tlz.c +++ b/libarchive/test/test_read_format_tlz.c @@ -56,6 +56,8 @@ DEFINE_TEST(test_read_format_tlz) assertEqualInt(1, archive_file_count(a)); assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_LZMA); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_txz.c b/libarchive/test/test_read_format_txz.c index 6672ad2f0864..c082d7e5e7be 100644 --- a/libarchive/test/test_read_format_txz.c +++ b/libarchive/test/test_read_format_txz.c @@ -59,6 +59,8 @@ DEFINE_TEST(test_read_format_txz) assertEqualInt(1, archive_file_count(a)); assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_XZ); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_tz.c b/libarchive/test/test_read_format_tz.c index 60d8a4e61514..4ba7bcb3f9c6 100644 --- a/libarchive/test/test_read_format_tz.c +++ b/libarchive/test/test_read_format_tz.c @@ -51,6 +51,8 @@ DEFINE_TEST(test_read_format_tz) assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_COMPRESS); failure("archive_format_name(a)=\"%s\"", archive_format_name(a)); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_TAR_USTAR); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_ustar_filename.c b/libarchive/test/test_read_format_ustar_filename.c index f2e577d0a3b9..5c2717cdf2c0 100644 --- a/libarchive/test/test_read_format_ustar_filename.c +++ b/libarchive/test/test_read_format_ustar_filename.c @@ -57,11 +57,15 @@ test_read_format_ustar_filename_eucJP_UTF8(const char *refname) assertEqualString("\xe6\xbc\xa2\xe5\xad\x97.txt", archive_entry_pathname(ae)); assertEqualInt(8, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xe8\xa1\xa8.txt", archive_entry_pathname(ae)); assertEqualInt(4, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -108,13 +112,16 @@ test_read_format_ustar_filename_CP866_KOI8R(const char *refname) assertEqualString("\xf0\xf2\xe9\xf7\xe5\xf4", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xd0\xd2\xc9\xd7\xc5\xd4", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); - + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); @@ -159,12 +166,16 @@ test_read_format_ustar_filename_CP866_UTF8(const char *refname) assertEqualString("\xd0\x9f\xd0\xa0\xd0\x98\xd0\x92\xd0\x95\xd0\xa2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -211,12 +222,16 @@ test_read_format_ustar_filename_KOI8R_CP866(const char *refname) assertEqualString("\xaf\xe0\xa8\xa2\xa5\xe2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\x8f\x90\x88\x82\x85\x92", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -262,12 +277,16 @@ test_read_format_ustar_filename_KOI8R_UTF8(const char *refname) assertEqualString("\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xd0\x9f\xd0\xa0\xd0\x98\xd0\x92\xd0\x95\xd0\xa2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -313,11 +332,15 @@ test_read_format_ustar_filename_eucJP_CP932(const char *refname) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\x8a\xbf\x8e\x9a.txt", archive_entry_pathname(ae)); assertEqualInt(8, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\x95\x5c.txt", archive_entry_pathname(ae)); assertEqualInt(4, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -364,12 +387,16 @@ test_read_format_ustar_filename_CP866_CP1251(const char *refname) assertEqualString("\xcf\xd0\xc8\xc2\xc5\xd2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xef\xf0\xe8\xe2\xe5\xf2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -416,12 +443,16 @@ test_read_format_ustar_filename_CP866_CP1251_win(const char *refname) assertEqualString("\xcf\xd0\xc8\xc2\xc5\xd2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xef\xf0\xe8\xe2\xe5\xf2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ @@ -467,12 +498,16 @@ test_read_format_ustar_filename_KOI8R_CP1251(const char *refname) assertEqualString("\xef\xf0\xe8\xe2\xe5\xf2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xcf\xd0\xc8\xc2\xc5\xd2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* End of archive. */ diff --git a/libarchive/test/test_read_format_warc.c b/libarchive/test/test_read_format_warc.c new file mode 100644 index 000000000000..658ab8a6e72b --- /dev/null +++ b/libarchive/test/test_read_format_warc.c @@ -0,0 +1,82 @@ +/*- + * Copyright (c) 2014 Sebastian Freundt + * 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" +__FBSDID("$FreeBSD$"); + + +DEFINE_TEST(test_read_format_warc) +{ + char buff[256U]; + const char reffile[] = "test_read_format_warc.warc"; + struct archive_entry *ae; + struct archive *a; + + extract_reference_file(reffile); + 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, reffile, 10240)); + + /* First Entry */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("sometest.txt", archive_entry_pathname(ae)); + assertEqualInt(1402399833, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_uid(ae)); + assertEqualInt(0, archive_entry_gid(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(65, archive_entry_size(ae)); + assertEqualInt(65, archive_read_data(a, buff, sizeof(buff))); + assertEqualMem(buff, "This is a sample text file for libarchive's WARC reader/writer.\n\n", 65); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + + /* Second Entry */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("moretest.txt", archive_entry_pathname(ae)); + assertEqualInt(1402399884, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_uid(ae)); + assertEqualInt(0, archive_entry_gid(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(76, archive_entry_size(ae)); + assertA(76 == archive_read_data(a, buff, sizeof(buff))); + assertEqualMem(buff, "The beauty is that WARC remains ASCII only iff all contents are ASCII only.\n", 76); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); + + /* Test EOF */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_file_count(a)); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_WARC, archive_format(a)); + + /* Verify closing and resource freeing */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_read_format_warc.warc.uu b/libarchive/test/test_read_format_warc.warc.uu new file mode 100644 index 000000000000..f89592b9b06e --- /dev/null +++ b/libarchive/test/test_read_format_warc.warc.uu @@ -0,0 +1,23 @@ +begin 644 test_read_format_warc.warc +M5T%20R\Q+C`-"E=!4D,M5'EP93H@=V%R8VEN9F\-"E=!4D,M1&%T93H@,C`Q +M-"TP-BTQ,%0Q,3HS,3HS.%H-"DQA7!E.B!R97-O +M=7)C90T*5T%20RU487)G970M55)).B!F:6QE.B\O2!I +D9F8@86QL(&-O;G1E;G1S(&%R92!!4T-)22!O;FQY+@H-"@T* +` +end diff --git a/libarchive/test/test_read_format_xar.c b/libarchive/test/test_read_format_xar.c index f2de1e013945..b7189eb259e6 100644 --- a/libarchive/test/test_read_format_xar.c +++ b/libarchive/test/test_read_format_xar.c @@ -663,6 +663,8 @@ static void verify(unsigned char *d, size_t s, assertA(0 == archive_read_next_header(a, &ae)); assertEqualInt(archive_filter_code(a, 0), ARCHIVE_FILTER_NONE); assertEqualInt(archive_format(a), ARCHIVE_FORMAT_XAR); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED); /* Verify the only entry. */ f1(a, ae); if (f2) { diff --git a/libarchive/test/test_read_format_zip.c b/libarchive/test/test_read_format_zip.c index 7f3568157b5b..da5b13787ed5 100644 --- a/libarchive/test/test_read_format_zip.c +++ b/libarchive/test/test_read_format_zip.c @@ -26,12 +26,6 @@ #include "test.h" __FBSDID("$FreeBSD: head/lib/libarchive/test/test_read_format_zip.c 189482 2009-03-07 03:30:35Z kientzle $"); -#ifdef HAVE_LIBZ -static const int libz_enabled = 1; -#else -static const int libz_enabled = 0; -#endif - /* * The reference file for this has been manually tweaked so that: * * file2 has length-at-end but file1 does not @@ -52,6 +46,8 @@ verify_basic(struct archive *a, int seek_checks) assertEqualInt(0, archive_entry_size(ae)); if (seek_checks) assertEqualInt(AE_IFDIR | 0755, archive_entry_mode(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); assertEqualIntA(a, ARCHIVE_EOF, archive_read_data_block(a, &pv, &s, &o)); assertEqualInt((int)s, 0); @@ -62,8 +58,10 @@ verify_basic(struct archive *a, int seek_checks) if (seek_checks) assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); assertEqualInt(18, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); failure("archive_read_data() returns number of bytes read"); - if (libz_enabled) { + if (archive_zlib_version() != NULL) { assertEqualInt(18, archive_read_data(a, buff, 19)); assertEqualMem(buff, "hello\nhello\nhello\n", 18); } else { @@ -76,14 +74,14 @@ verify_basic(struct archive *a, int seek_checks) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("file2", archive_entry_pathname(ae)); assertEqualInt(1179605932, archive_entry_mtime(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); if (seek_checks) { assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); - assertEqualInt(64, archive_entry_size_is_set(ae)); - } else { - failure("file2 has length-at-end, so we shouldn't see a valid size when streaming"); - assertEqualInt(0, archive_entry_size_is_set(ae)); } - if (libz_enabled) { + assert(archive_entry_size_is_set(ae)); + assertEqualInt(18, archive_entry_size(ae)); + if (archive_zlib_version() != NULL) { failure("file2 has a bad CRC, so read should fail and not change buff"); memset(buff, 'a', 19); assertEqualInt(ARCHIVE_WARN, archive_read_data(a, buff, 19)); @@ -144,12 +142,14 @@ verify_info_zip_ux(struct archive *a, int seek_checks) assertEqualString("file1", archive_entry_pathname(ae)); assertEqualInt(1300668680, archive_entry_mtime(ae)); assertEqualInt(18, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); if (seek_checks) assertEqualInt(AE_IFREG | 0644, archive_entry_mode(ae)); failure("zip reader should read Info-ZIP New Unix Extra Field"); assertEqualInt(1001, archive_entry_uid(ae)); assertEqualInt(1001, archive_entry_gid(ae)); - if (libz_enabled) { + if (archive_zlib_version() != NULL) { failure("archive_read_data() returns number of bytes read"); assertEqualInt(18, archive_read_data(a, buff, 19)); assertEqualMem(buff, "hello\nhello\nhello\n", 18); @@ -208,6 +208,8 @@ verify_extract_length_at_end(struct archive *a, int seek_checks) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); assertEqualString("hello.txt", archive_entry_pathname(ae)); if (seek_checks) { assertEqualInt(AE_IFREG | 0644, archive_entry_mode(ae)); @@ -218,7 +220,7 @@ verify_extract_length_at_end(struct archive *a, int seek_checks) assertEqualInt(0, archive_entry_size(ae)); } - if (libz_enabled) { + if (archive_zlib_version() != NULL) { assertEqualIntA(a, ARCHIVE_OK, archive_read_extract(a, ae, 0)); assertFileContents("hello\x0A", 6, "hello.txt"); } else { @@ -278,12 +280,16 @@ test_symlink(void) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("file", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("symlink", archive_entry_pathname(ae)); assertEqualInt(AE_IFLNK, archive_entry_filetype(ae)); assertEqualInt(0, archive_entry_size(ae)); assertEqualString("file", archive_entry_symlink(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); diff --git a/libarchive/test/test_read_format_zip_comment_stored.c b/libarchive/test/test_read_format_zip_comment_stored.c index 5394cebc0507..d2b935de2d44 100644 --- a/libarchive/test/test_read_format_zip_comment_stored.c +++ b/libarchive/test/test_read_format_zip_comment_stored.c @@ -48,13 +48,19 @@ verify(const char *refname) assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("file0", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG | 0644, archive_entry_mode(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("build.sh", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); assertEqualInt(23, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); + assertEqualInt(archive_entry_is_encrypted(ae), 0); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); } diff --git a/libarchive/test/test_read_format_zip_encryption_data.c b/libarchive/test/test_read_format_zip_encryption_data.c new file mode 100644 index 000000000000..b56d78e9074f --- /dev/null +++ b/libarchive/test/test_read_format_zip_encryption_data.c @@ -0,0 +1,79 @@ +/*- + * Copyright (c) 2013 Konrad Kleine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_zip_encryption_data) +{ + /* This file is password protected (encrypted). The headers + are NOT encrypted. Password is "12345678". */ + const char *refname = "test_read_format_zip_encryption_data.zip"; + 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)); + + assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a)); + + /* Verify encrypted file "bar.txt" */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae)); + assertEqualString("bar.txt", archive_entry_pathname(ae)); + assertEqualInt(20, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + assertEqualInt(ARCHIVE_FAILED, archive_read_data(a, buff, sizeof(buff))); + + /* Verify encrypted file "foo.txt" */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae)); + assertEqualString("foo.txt", archive_entry_pathname(ae)); + assertEqualInt(20, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + assertEqualInt(ARCHIVE_FAILED, archive_read_data(a, buff, sizeof(buff))); + + assertEqualInt(2, 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_ZIP, archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + diff --git a/libarchive/test/test_read_format_zip_encryption_data.zip.uu b/libarchive/test/test_read_format_zip_encryption_data.zip.uu new file mode 100644 index 000000000000..d419e7d6d07f --- /dev/null +++ b/libarchive/test/test_read_format_zip_encryption_data.zip.uu @@ -0,0 +1,25 @@ +begin 664 test_read_format_zip_encryption_data.zip +M4$L#!#,`00```*UI,4/H*IFA5@$``!0````'````8F%R+G1X=!``2#/PIQFT +M*F$4U*$#L8[-?B`!```#`!!F``$!`)``[SL/J;#"+JV#-X^_V7R?(/NINR^)*Z@-`+PM+G'_/G,@= +MOQI>T\*I"7FDH^[+/([/S3(S=2JR^B1VT7NV=\PU*ILZ(S-9P@#K>HTK<9$X +MG?3>):QUHT4^7JY*;B_X.,6FCSB0]-;K-:!W"\9#7%JT`````(``I>M3N%RW +MKHT3'HV+V7'\SG*),5W`7P-"J01^*X5F-K&;`\FXL%S[!!"J1 +M?4B:)(8&4)C/_^4!TF+`7W`%52=)VJ9U?3H,W@"9S8062TGSY_<:.\=X_SCC +M1?,I!IE@=&J39?KX5+0Y\Y`;^.[MR@]TB?WG-.D/]RONSJ(6 +MMAL3^^^V;)?](;*EA#%$TN]?2U!+`P0S`$$```"J:3%#_\P&4E8!```4```` +M!P```&9O;RYT>'00`(N/OW)U+.F;D#0D]']<[0I5,5G^P3D\Q/LN'ME\GR#[J;LOB2NH +M#7-Y7/%J"13'@"\+2YQ_SYS(';\:7M/"J0EYI*/NRSR.S\TR,W4JLOHD=M%[ +MMG?,-2J;.B,S6<(`ZWJ-*W&1.)WTWB6L=:-%/EZN2FXO^#C%IH\XD/36ZS6@ +M=PO&0UQ:M`````"``".OX15'_!K.OGAW6+M]C;[G8@26,FBSB&/46Q@#[301 +M`"51%C)3[11_TP#)7O_6`&/F?FGG]G9;W.L$";H2&[ +ML$PNS#NDG9Q@BFL$`&S?S3;,D#OS#% +MZ>O6I=M41I^&XX"JLTTKLW]*B=+>(C]+6]H**#DX_EJ;9BBY;,=02P$"0``S +M`$$```"M:3%#Z"J9H58!```4````!P`T```````!`"``````````8F%R+G1X +M=`H`(````````0`8`".@Q.V6L\X!(Z#$[9:SS@$CH,3MEK/.`1<`#``"`!!F +M``$!``````!02P$"0``S`$$```"J:3%#_\P&4E8!```4````!P`T```````! +M`"````![`0``9F]O+G1X=`H`(````````0`8`"4C6.F6L\X!)2-8Z9:SS@$E +M(UCIEK/.`1<`#``"`!!F``$!``````!02P4&``````(``@#2````]@(````` +` +end diff --git a/libarchive/test/test_read_format_zip_encryption_header.c b/libarchive/test/test_read_format_zip_encryption_header.c new file mode 100644 index 000000000000..f40e1f5cb8da --- /dev/null +++ b/libarchive/test/test_read_format_zip_encryption_header.c @@ -0,0 +1,71 @@ +/*- + * Copyright (c) 2013 Konrad Kleine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_zip_encryption_header) +{ + /* This file is password protected (encrypted) with AES-256. The headers + ARE encrypted. Password is "12345678". */ + const char *refname = "test_read_format_zip_encryption_header.zip"; + 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)); + + assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a)); + + /* Verify regular file but with encrypted headers + as a consequence, all meta information is invalid. */ + assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae)); + + assertEqualInt(0, archive_entry_mode(ae)); + assertEqualString(NULL, archive_entry_pathname(ae)); + assertEqualInt(0, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(1, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + assertEqualInt(ARCHIVE_FATAL, archive_read_data(a, buff, sizeof(buff))); + + assertEqualInt(1, archive_file_count(a)); + + /* End of archive. */ + assertEqualIntA(a, ARCHIVE_FATAL, archive_read_next_header(a, &ae)); + + /* Verify archive format. */ + assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0)); + assertEqualIntA(a, ARCHIVE_FORMAT_ZIP, archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_read_format_zip_encryption_header.zip.uu b/libarchive/test/test_read_format_zip_encryption_header.zip.uu new file mode 100644 index 000000000000..8ba23d322d5c --- /dev/null +++ b/libarchive/test/test_read_format_zip_encryption_header.zip.uu @@ -0,0 +1,32 @@ +begin 664 test_read_format_zip_encryption_header.zip +M4$L#!#,`02``````````````5@$````````!````,1``X3'*9,%K7_13)[I3 +MUO.*N2`!```#`!!F``$!`)``M'BJYI=VDZMXC4&]B1)Q%WJ/M`8VS +M%S*.0\5[MJ34[W"H8*AO==S@TG'S'J'3A;8C`````(``4-?ZX*L^`*0786KZ +ME7<\#%<[_`^#/MO"P\3FX5`^9`Q%(S:FDO98B*C`BC%'XQ0*X"FMO8[@3'S@ +MX(JO5(Q:8-&AM8(OPBY40\O!"%Z5'>I\/<_(AA-%)*TBI6YT6!WEM7L,-"W( +M/GE:7T.B39$3C.W)X2`A=KV-UB4C7I?6B-!F<"?VLE!+`P0S`$$@`````````````%8!`````````0```#(0 +M`%(U7N:0Z+,VS3SNJBRE_=`@`0```P`09@`!`0"0`+1XJN:7=I'+8EUNW[TZ +M9--K0QS.:Q+!FI.`8[!4$,6L*CF!QS:J1.BO`?`/13>YAU`IT$;$9 +M?;.\]/UPBB3_SV=KT;*]:?(9JYM:X+6&:R4J*4S0N)^KE,\XI>AO)H,GWNK> +M(U!O8D2<1=ZC[0&-LQ[:DU.]PJ&"H;W7CYF;:)G.8S3 +M%AT<])L+^"37+I@-S&ALBA\_10'AM,+6C"RP!FEV@VW1"2PDL->Q5HL*M[X( +M];^?-43F%4=UMP/U>83:C4K&OM*'&=DS[_V!*YK9X(6G9R,]GJ\\0`!A&@I%F4R!H=;RQSVWL,/D@ +M`0```P`09@`!`0"0`+1XJN:7=I'+8EUNW[TZ9--K0QS.:Q+!FI.`8[!4$,6L +M*CF!QS:J1.BO`?`/13>YAU`IT$;$9?;.\]/UPBB3_SV=KT;*]:?(9 +MJYM:X+6&:R4J*4S0N)^KE,\XI>AO)H,GWNK>(U!O8D2<1=ZC[0&-LQ[:DU.]PJ&"H;W7A2^EL1N!T3'%DP<< +MXY=DJB$8LS8KERBNN[I*X]M"?A\FYX"B`IP_XMQ-.*H3#`XY.,-K% +M0`Z%4:U*W#IM_DBOP-$^?R<8,!%#Z6F1`?;Z:=LG6@'C+#0I[]^+E$0'L5!+ +M!@9,`````````$``/@```````````````````````@````````"F`0`````` +M`.H"````````"`"F`0```````-(`````````$&8``0$``0`$``"$P.)02P8' +F`````)`$`````````0```%!+!08```````#__Z8!``#J`@`````` +` +end diff --git a/libarchive/test/test_read_format_zip_encryption_partially.c b/libarchive/test/test_read_format_zip_encryption_partially.c new file mode 100644 index 000000000000..77af235d58b7 --- /dev/null +++ b/libarchive/test/test_read_format_zip_encryption_partially.c @@ -0,0 +1,79 @@ +/*- + * Copyright (c) 2013 Konrad Kleine + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_zip_encryption_partially) +{ + /* This file contains one file that is encrypted (foo.txt, password=12345678) + and one file that is not encrypted (bar.txt) The header is not encrypted + on this file. */ + const char *refname = "test_read_format_zip_encryption_partially.zip"; + 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)); + + assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, archive_read_has_encrypted_entries(a)); + + /* Verify unencrypted file "bar.txt". */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae)); + assertEqualString("bar.txt", archive_entry_pathname(ae)); + assertEqualInt(20, archive_entry_size(ae)); + assertEqualInt(0, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + assertEqualInt(20, archive_read_data(a, buff, sizeof(buff))); + + /* Verify encrypted file "foo.txt". */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0664), archive_entry_mode(ae)); + assertEqualString("foo.txt", archive_entry_pathname(ae)); + assertEqualInt(20, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + assertEqualInt(ARCHIVE_FAILED, archive_read_data(a, buff, sizeof(buff))); + + assertEqualInt(2, 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_ZIP, archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_read_format_zip_encryption_partially.zip.uu b/libarchive/test/test_read_format_zip_encryption_partially.zip.uu new file mode 100644 index 000000000000..ac19d31337cd --- /dev/null +++ b/libarchive/test/test_read_format_zip_encryption_partially.zip.uu @@ -0,0 +1,18 @@ +begin 664 test_read_format_zip_encryption_partially.zip +M4$L#!`H``````*UI,4/H*IFA%````!0````'````8F%R+G1X=")D871A(&]F +M(&)A'0B(`T*4$L#!#,`00```*II,4/_S`925@$``!0````'````9F]O +M+G1X=!``=Y31BJ>9'GG$*/<^F6_&OGLZO5E%/W5NJ591,`8BB:/5/7M)AK8/IJ0=@ +M`````(``QS1<"+$&V4,T_.3PQ&HBEXWEA;,\K(U'9+L4P +M=:(P%7DH*U7(2#M.IB;M\7X??Y!F]%PMN<#((2`+)9A+<(W[1K0X@&5:`QJV +MQ:NR:QT5U'+D!K^/_N*M>SJ-)-^@^N6]4VD&Z@L#X(!-7@-6#-G3WV`1:PL" +M!4FWNU]+#`:$,2UI5U`@#@BY.)#$HP6(2 -static void -test_read_format_zip_filename_CP932_eucJP(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_CP932_eucJP) { + const char *refname = "test_read_format_zip_filename_cp932.zip"; struct archive *a; struct archive_entry *ae; @@ -40,6 +40,7 @@ test_read_format_zip_filename_CP932_eucJP(const char *refname) skipping("ja_JP.eucJP locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -58,6 +59,8 @@ test_read_format_zip_filename_CP932_eucJP(const char *refname) "\xc9\xbd\xa4\xc0\xa4\xe8\x2f\xb0\xec\xcd\xf7\xc9\xbd\x2e\x74\x78\x74", archive_entry_pathname(ae)); assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -65,10 +68,14 @@ test_read_format_zip_filename_CP932_eucJP(const char *refname) "\xc9\xbd\xa4\xc0\xa4\xe8\x2f\xb4\xc1\xbb\xfa\x2e\x74\x78\x74", archive_entry_pathname(ae)); assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify archive format. */ assertEqualIntA(a, ARCHIVE_FILTER_NONE, archive_filter_code(a, 0)); @@ -80,9 +87,9 @@ test_read_format_zip_filename_CP932_eucJP(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_CP932_UTF8(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_CP932_UTF8) { + const char *refname = "test_read_format_zip_filename_cp932.zip"; struct archive *a; struct archive_entry *ae; @@ -93,6 +100,7 @@ test_read_format_zip_filename_CP932_UTF8(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -107,6 +115,8 @@ test_read_format_zip_filename_CP932_UTF8(const char *refname) /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); #if defined(__APPLE__) /* Compare NFD string. */ assertEqualUTF8String( @@ -124,6 +134,8 @@ test_read_format_zip_filename_CP932_UTF8(const char *refname) /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); #if defined(__APPLE__) /* Compare NFD string. */ assertEqualUTF8String( @@ -153,9 +165,9 @@ test_read_format_zip_filename_CP932_UTF8(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_UTF8_eucJP(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_UTF8_eucJP) { + const char *refname = "test_read_format_zip_filename_utf8_jp.zip"; struct archive *a; struct archive_entry *ae; @@ -165,9 +177,11 @@ test_read_format_zip_filename_UTF8_eucJP(const char *refname) * Bit 11 of its general purpose bit flag is set. */ if (NULL == setlocale(LC_ALL, "ja_JP.eucJP")) { - skipping("ja_JP.eucJP locale not availablefilename_ on this system."); + skipping("ja_JP.eucJP locale not availablefilename_ on " + "this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); if (ARCHIVE_OK != archive_read_set_options(a, "hdrcharset=UTF-8")) { @@ -189,6 +203,8 @@ test_read_format_zip_filename_UTF8_eucJP(const char *refname) assertEqualString("\xc9\xbd\xa4\xc0\xa4\xe8\x2f", archive_entry_pathname(ae)); assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -197,6 +213,8 @@ test_read_format_zip_filename_UTF8_eucJP(const char *refname) "\xc9\xbd\xa4\xc0\xa4\xe8\x2f\xb0\xec\xcd\xf7\xc9\xbd\x2e\x74\x78\x74", archive_entry_pathname(ae)); assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -205,6 +223,8 @@ test_read_format_zip_filename_UTF8_eucJP(const char *refname) "\xc9\xbd\xa4\xc0\xa4\xe8\x2f\xb4\xc1\xbb\xfa\x2e\x74\x78\x74", archive_entry_pathname(ae)); assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -220,9 +240,9 @@ test_read_format_zip_filename_UTF8_eucJP(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_UTF8_UTF8(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_UTF8_UTF8) { + const char *refname = "test_read_format_zip_filename_utf8_jp.zip"; struct archive *a; struct archive_entry *ae; @@ -235,6 +255,7 @@ test_read_format_zip_filename_UTF8_UTF8(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -257,6 +278,8 @@ test_read_format_zip_filename_UTF8_UTF8(const char *refname) archive_entry_pathname(ae)); #endif assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -275,6 +298,8 @@ test_read_format_zip_filename_UTF8_UTF8(const char *refname) archive_entry_pathname(ae)); #endif assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -293,6 +318,8 @@ test_read_format_zip_filename_UTF8_UTF8(const char *refname) archive_entry_pathname(ae)); #endif assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -307,9 +334,9 @@ test_read_format_zip_filename_UTF8_UTF8(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_CP866_KOI8R(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_CP866_KOI8R) { + const char *refname = "test_read_format_zip_filename_cp866.zip"; struct archive *a; struct archive_entry *ae; @@ -321,6 +348,7 @@ test_read_format_zip_filename_CP866_KOI8R(const char *refname) skipping("ru_RU.KOI8-R locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -338,12 +366,16 @@ test_read_format_zip_filename_CP866_KOI8R(const char *refname) assertEqualString("\xf0\xf2\xe9\xf7\xe5\xf4", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xd0\xd2\xc9\xd7\xc5\xd4", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -359,9 +391,9 @@ test_read_format_zip_filename_CP866_KOI8R(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_CP866_UTF8(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_CP866_UTF8) { + const char *refname = "test_read_format_zip_filename_cp866.zip"; struct archive *a; struct archive_entry *ae; @@ -372,6 +404,7 @@ test_read_format_zip_filename_CP866_UTF8(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -389,12 +422,16 @@ test_read_format_zip_filename_CP866_UTF8(const char *refname) assertEqualString("\xd0\x9f\xd0\xa0\xd0\x98\xd0\x92\xd0\x95\xd0\xa2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -410,9 +447,9 @@ test_read_format_zip_filename_CP866_UTF8(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_KOI8R_CP866(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_KOI8R_CP866) { + const char *refname = "test_read_format_zip_filename_koi8r.zip"; struct archive *a; struct archive_entry *ae; @@ -424,6 +461,7 @@ test_read_format_zip_filename_KOI8R_CP866(const char *refname) skipping("ru_RU.CP866 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -441,12 +479,16 @@ test_read_format_zip_filename_KOI8R_CP866(const char *refname) assertEqualString("\xaf\xe0\xa8\xa2\xa5\xe2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\x8f\x90\x88\x82\x85\x92", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -462,9 +504,9 @@ test_read_format_zip_filename_KOI8R_CP866(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_KOI8R_UTF8(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_KOI8R_UTF8) { + const char *refname = "test_read_format_zip_filename_koi8r.zip"; struct archive *a; struct archive_entry *ae; @@ -475,6 +517,7 @@ test_read_format_zip_filename_KOI8R_UTF8(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -492,12 +535,16 @@ test_read_format_zip_filename_KOI8R_UTF8(const char *refname) assertEqualString("\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xd0\x9f\xd0\xa0\xd0\x98\xd0\x92\xd0\x95\xd0\xa2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -513,9 +560,9 @@ test_read_format_zip_filename_KOI8R_UTF8(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_UTF8_KOI8R(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_UTF8_KOI8R) { + const char *refname = "test_read_format_zip_filename_utf8_ru.zip"; struct archive *a; struct archive_entry *ae; @@ -527,6 +574,7 @@ test_read_format_zip_filename_UTF8_KOI8R(const char *refname) skipping("ru_RU.KOI8-R locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); @@ -549,12 +597,16 @@ test_read_format_zip_filename_UTF8_KOI8R(const char *refname) assertEqualString("\xf0\xf2\xe9\xf7\xe5\xf4", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xd0\xd2\xc9\xd7\xc5\xd4", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -570,9 +622,9 @@ test_read_format_zip_filename_UTF8_KOI8R(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_UTF8_CP866(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_UTF8_CP866) { + const char *refname = "test_read_format_zip_filename_utf8_ru.zip"; struct archive *a; struct archive_entry *ae; @@ -586,6 +638,7 @@ test_read_format_zip_filename_UTF8_CP866(const char *refname) skipping("ru_RU.CP866 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -609,12 +662,16 @@ test_read_format_zip_filename_UTF8_CP866(const char *refname) assertEqualString("\x8f\x90\x88\x82\x85\x92", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xaf\xe0\xa8\xa2\xa5\xe2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -630,9 +687,9 @@ test_read_format_zip_filename_UTF8_CP866(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_UTF8_UTF8_ru(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_UTF8_UTF8_ru) { + const char *refname = "test_read_format_zip_filename_utf8_ru.zip"; struct archive *a; struct archive_entry *ae; @@ -645,6 +702,7 @@ test_read_format_zip_filename_UTF8_UTF8_ru(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -657,12 +715,16 @@ test_read_format_zip_filename_UTF8_UTF8_ru(const char *refname) assertEqualString("\xd0\x9f\xd0\xa0\xd0\x98\xd0\x92\xd0\x95\xd0\xa2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -677,9 +739,9 @@ test_read_format_zip_filename_UTF8_UTF8_ru(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_CP932_CP932(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_CP932_CP932) { + const char *refname = "test_read_format_zip_filename_cp932.zip"; struct archive *a; struct archive_entry *ae; @@ -691,6 +753,7 @@ test_read_format_zip_filename_CP932_CP932(const char *refname) skipping("CP932 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -709,6 +772,8 @@ test_read_format_zip_filename_CP932_CP932(const char *refname) "\x95\x5c\x82\xbe\x82\xe6\x2f\x88\xea\x97\x97\x95\x5c.txt", archive_entry_pathname(ae)); assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -716,6 +781,8 @@ test_read_format_zip_filename_CP932_CP932(const char *refname) "\x95\x5c\x82\xbe\x82\xe6\x2f\x8a\xbf\x8e\x9a.txt", archive_entry_pathname(ae)); assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -731,9 +798,9 @@ test_read_format_zip_filename_CP932_CP932(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_UTF8_CP932(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_UTF8_CP932) { + const char *refname = "test_read_format_zip_filename_utf8_jp.zip"; struct archive *a; struct archive_entry *ae; @@ -747,6 +814,7 @@ test_read_format_zip_filename_UTF8_CP932(const char *refname) skipping("CP932 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); @@ -771,6 +839,8 @@ test_read_format_zip_filename_UTF8_CP932(const char *refname) "\x95\x5c\x82\xbe\x82\xe6\x2f", archive_entry_pathname(ae)); assertEqualInt(0, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify directory file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -779,6 +849,8 @@ test_read_format_zip_filename_UTF8_CP932(const char *refname) "\x95\x5c\x82\xbe\x82\xe6\x2f\x88\xea\x97\x97\x95\x5c.txt", archive_entry_pathname(ae)); assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); @@ -787,6 +859,8 @@ test_read_format_zip_filename_UTF8_CP932(const char *refname) "\x95\x5c\x82\xbe\x82\xe6\x2f\x8a\xbf\x8e\x9a.txt", archive_entry_pathname(ae)); assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); @@ -801,9 +875,9 @@ test_read_format_zip_filename_UTF8_CP932(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_CP866_CP1251(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_CP866_CP1251) { + const char *refname = "test_read_format_zip_filename_cp866.zip"; struct archive *a; struct archive_entry *ae; @@ -815,6 +889,7 @@ test_read_format_zip_filename_CP866_CP1251(const char *refname) skipping("CP1251 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -832,12 +907,16 @@ test_read_format_zip_filename_CP866_CP1251(const char *refname) assertEqualString("\xcf\xd0\xc8\xc2\xc5\xd2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xef\xf0\xe8\xe2\xe5\xf2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -859,9 +938,9 @@ test_read_format_zip_filename_CP866_CP1251(const char *refname) * filenames and store it in the zip file and so we should read * it by default on Windows. */ -static void -test_read_format_zip_filename_CP866_CP1251_win(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_CP866_CP1251_win) { + const char *refname = "test_read_format_zip_filename_cp866.zip"; struct archive *a; struct archive_entry *ae; @@ -872,6 +951,7 @@ test_read_format_zip_filename_CP866_CP1251_win(const char *refname) skipping("Russian_Russia locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -884,12 +964,16 @@ test_read_format_zip_filename_CP866_CP1251_win(const char *refname) assertEqualString("\xcf\xd0\xc8\xc2\xc5\xd2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xef\xf0\xe8\xe2\xe5\xf2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -904,9 +988,9 @@ test_read_format_zip_filename_CP866_CP1251_win(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_KOI8R_CP1251(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_KOI8R_CP1251) { + const char *refname = "test_read_format_zip_filename_koi8r.zip"; struct archive *a; struct archive_entry *ae; @@ -918,6 +1002,7 @@ test_read_format_zip_filename_KOI8R_CP1251(const char *refname) skipping("CP1251 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -935,12 +1020,16 @@ test_read_format_zip_filename_KOI8R_CP1251(const char *refname) assertEqualString("\xef\xf0\xe8\xe2\xe5\xf2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xcf\xd0\xc8\xc2\xc5\xd2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -956,9 +1045,9 @@ test_read_format_zip_filename_KOI8R_CP1251(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } -static void -test_read_format_zip_filename_UTF8_CP1251(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_UTF8_CP1251) { + const char *refname = "test_read_format_zip_filename_utf8_ru.zip"; struct archive *a; struct archive_entry *ae; @@ -972,6 +1061,7 @@ test_read_format_zip_filename_UTF8_CP1251(const char *refname) skipping("CP1251 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); @@ -994,12 +1084,16 @@ test_read_format_zip_filename_UTF8_CP1251(const char *refname) assertEqualString("\xcf\xd0\xc8\xc2\xc5\xd2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xef\xf0\xe8\xe2\xe5\xf2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -1025,9 +1119,9 @@ test_read_format_zip_filename_UTF8_CP1251(const char *refname) * filename of sencod file, which is stored in UTF-8. */ -static void -test_read_format_zip_filename_KOI8R_UTF8_2(const char *refname) +DEFINE_TEST(test_read_format_zip_filename_KOI8R_UTF8_2) { + const char *refname = "test_read_format_zip_filename_utf8_ru2.zip"; struct archive *a; struct archive_entry *ae; @@ -1038,6 +1132,7 @@ test_read_format_zip_filename_KOI8R_UTF8_2(const char *refname) skipping("en_US.UTF-8 locale not available on this system."); return; } + extract_reference_file(refname); assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); @@ -1055,6 +1150,8 @@ test_read_format_zip_filename_KOI8R_UTF8_2(const char *refname) assertEqualString("\xd0\x9f\xd0\xa0\xd0\x98\xd0\x92\xd0\x95\xd0\xa2", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* * Verify regular second file. @@ -1065,6 +1162,8 @@ test_read_format_zip_filename_KOI8R_UTF8_2(const char *refname) assertEqualString("\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -1100,12 +1199,16 @@ test_read_format_zip_filename_KOI8R_UTF8_2(const char *refname) assertEqualString("\xf0\xf2\xe9\xf7\xe5\xf4", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* Verify regular file. */ assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); assertEqualString("\xd0\xbf\xd1\x80\xd0\xb8\xd0\xb2\xd0\xb5\xd1\x82", archive_entry_pathname(ae)); assertEqualInt(6, archive_entry_size(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); /* End of archive. */ @@ -1119,44 +1222,3 @@ test_read_format_zip_filename_KOI8R_UTF8_2(const char *refname) assertEqualInt(ARCHIVE_OK, archive_read_close(a)); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } - -DEFINE_TEST(test_read_format_zip_filename) -{ - const char *refname1 = "test_read_format_zip_filename_cp932.zip"; - const char *refname2 = "test_read_format_zip_filename_utf8_jp.zip"; - const char *refname3 = "test_read_format_zip_filename_cp866.zip"; - const char *refname4 = "test_read_format_zip_filename_koi8r.zip"; - const char *refname5 = "test_read_format_zip_filename_utf8_ru.zip"; - const char *refname6 = "test_read_format_zip_filename_utf8_ru2.zip"; - - extract_reference_file(refname1); - test_read_format_zip_filename_CP932_eucJP(refname1); - test_read_format_zip_filename_CP932_UTF8(refname1); - test_read_format_zip_filename_CP932_CP932(refname1); - - extract_reference_file(refname2); - test_read_format_zip_filename_UTF8_eucJP(refname2); - test_read_format_zip_filename_UTF8_UTF8(refname2); - test_read_format_zip_filename_UTF8_CP932(refname2); - - extract_reference_file(refname3); - test_read_format_zip_filename_CP866_KOI8R(refname3); - test_read_format_zip_filename_CP866_UTF8(refname3); - test_read_format_zip_filename_CP866_CP1251(refname3); - test_read_format_zip_filename_CP866_CP1251_win(refname3); - - extract_reference_file(refname4); - test_read_format_zip_filename_KOI8R_CP866(refname4); - test_read_format_zip_filename_KOI8R_UTF8(refname4); - test_read_format_zip_filename_KOI8R_CP1251(refname4); - - extract_reference_file(refname5); - test_read_format_zip_filename_UTF8_KOI8R(refname5); - test_read_format_zip_filename_UTF8_CP866(refname5); - test_read_format_zip_filename_UTF8_UTF8_ru(refname5); - test_read_format_zip_filename_UTF8_CP1251(refname5); - - /* The filenames contained in refname6 are different charset. */ - extract_reference_file(refname6); - test_read_format_zip_filename_KOI8R_UTF8_2(refname6); -} diff --git a/libarchive/test/test_read_format_zip_mac_metadata.c b/libarchive/test/test_read_format_zip_mac_metadata.c index dd48fd433a59..97aa427b0348 100644 --- a/libarchive/test/test_read_format_zip_mac_metadata.c +++ b/libarchive/test/test_read_format_zip_mac_metadata.c @@ -25,12 +25,6 @@ #include "test.h" __FBSDID("$FreeBSD$"); -#ifdef HAVE_LIBZ -static const int libz_enabled = 1; -#else -static const int libz_enabled = 0; -#endif - /* * Read a zip file that has a zip comment in the end of the central * directory record. @@ -87,9 +81,10 @@ DEFINE_TEST(test_read_format_zip_mac_metadata) /* Mac metadata can only be extracted with the seeking reader. */ assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_set_option(a, "zip", "mac-ext", "1")); assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, p, s, 1)); - if (libz_enabled) { + if (archive_zlib_version() != NULL) { assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); } else { @@ -99,10 +94,12 @@ DEFINE_TEST(test_read_format_zip_mac_metadata) "Unsupported ZIP compression method (deflation)"); assert(archive_errno(a) != 0); } + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); assertEqualString("file3", archive_entry_pathname(ae)); assertEqualInt(AE_IFREG | 0644, archive_entry_mode(ae)); failure("Mac metadata should be set"); - if (libz_enabled) { + if (archive_zlib_version() != NULL) { const void *metadata; if (assert((metadata = archive_entry_mac_metadata(ae, &s)) != NULL)) { diff --git a/libarchive/test/test_read_format_zip_malformed.c b/libarchive/test/test_read_format_zip_malformed.c new file mode 100644 index 000000000000..2327d9149029 --- /dev/null +++ b/libarchive/test/test_read_format_zip_malformed.c @@ -0,0 +1,61 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2011 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +static void +test_malformed1(void) +{ + const char *refname = "test_read_format_zip_malformed1.zip"; + struct archive *a; + struct archive_entry *ae; + char *p; + size_t s; + + extract_reference_file(refname); + + /* Verify with seeking reader. */ + 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)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); + + /* Verify with streaming reader. */ + p = slurpfile(&s, refname); + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, p, s, 31)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); +} + +DEFINE_TEST(test_read_format_zip_malformed) +{ + test_malformed1(); +} diff --git a/libarchive/test/test_read_format_zip_malformed1.zip.uu b/libarchive/test/test_read_format_zip_malformed1.zip.uu new file mode 100644 index 000000000000..cbd21a89304f --- /dev/null +++ b/libarchive/test/test_read_format_zip_malformed1.zip.uu @@ -0,0 +1,5 @@ +begin 644 test_read_format_zip_malformed1.zip +M4$L#!#`P,#`P,#`P,#`P,#`P,#`P,#`P,#`$`!P`,#`P,#`P"0`P,#`P,#`P +1,#!U>`L``80P,#`P,#`P,#`` +` +end diff --git a/libarchive/test/test_read_format_zip_msdos.c b/libarchive/test/test_read_format_zip_msdos.c new file mode 100644 index 000000000000..5f147d557784 --- /dev/null +++ b/libarchive/test/test_read_format_zip_msdos.c @@ -0,0 +1,116 @@ +/*- + * Copyright (c) 2003-2007 Tim Kientzle + * Copyright (c) 2011 Michihiro NAKAJIMA + * 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" + +/* + * Test archive contains the following entries with only MSDOS attributes: + * 'abc' -- zero-length file + * 'def' -- directory without trailing slash and without streaming extension + * 'def/foo' -- file in def + * 'ghi/' -- directory with trailing slash and without streaming extension + * 'jkl' -- directory without trailing slash and with streaming extension + * 'mno/' -- directory with trailing slash and streaming extension + * + * Seeking reader should identify all of these correctly using the + * central directory information. + * Streaming reader should correctly identify everything except 'def'; + * since the standard Zip local file header does not include any file + * type information, it will be mis-identified as a zero-length file. + */ + +static void verify(struct archive *a, int streaming) { + struct archive_entry *ae; + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("abc", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG | 0664, archive_entry_mode(ae)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + if (streaming) { + /* Streaming reader has no basis for making this a dir */ + assertEqualString("def", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG | 0664, archive_entry_mode(ae)); + } else { + /* Since 'def' is a dir, '/' should be added */ + assertEqualString("def/", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR | 0775, archive_entry_mode(ae)); + } + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("def/foo", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG | 0664, archive_entry_mode(ae)); + + /* Streaming reader can tell this is a dir because it ends in '/' */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("ghi/", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR | 0775, archive_entry_mode(ae)); + + /* Streaming reader can tell this is a dir because it has xl + * extension */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + /* '/' gets added because this is a dir */ + assertEqualString("jkl/", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR | 0775, archive_entry_mode(ae)); + + /* Streaming reader can tell this is a dir because it ends in + * '/' and has xl extension */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("mno/", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR | 0775, archive_entry_mode(ae)); + + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); +} + +DEFINE_TEST(test_read_format_zip_msdos) +{ + const char *refname = "test_read_format_zip_msdos.zip"; + struct archive *a; + char *p; + size_t s; + + extract_reference_file(refname); + + /* Verify with seeking reader. */ + 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, 17)); + verify(a, 0); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* Verify with streaming reader. */ + p = slurpfile(&s, refname); + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, p, s, 31)); + verify(a, 1); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + free(p); +} diff --git a/libarchive/test/test_read_format_zip_msdos.zip.uu b/libarchive/test/test_read_format_zip_msdos.zip.uu new file mode 100644 index 000000000000..4503d095ba7f --- /dev/null +++ b/libarchive/test/test_read_format_zip_msdos.zip.uu @@ -0,0 +1,23 @@ +begin 644 test_read_format_zip_msdos.zip +M4$L#!`H``````!"2@D@````````````````#`!P`86)C550)``/P;@!7;'0` +M5W5X"P`!!/4!```$%````%!+`P0*``````#PE()(`````````````````P`< +M`&1E9E54"0`#4W0`5U-T`%=U>`L``03U`0``!!0```!02P,$"@``````[Y2" +M2`````````````````<`'`!D968O9F]O550)``-2=`!7;'0`5W5X"P`!!/4! +M```$%````%!+`P0*```````6DH)(````````````````!``<`&=H:2]55`D` +M`_QN`%?\;@!7=7@+``$$]0$```04````4$L#!`H``````!65@D@````````` +M```````#`"<`:FML550)``.9=`!7F70`5W5X"P`!!/4!```$%````'AL!P`% +M'@`0````4$L#!`H``````!:2@D@````````````````$`"4`;6YO+U54"0`# +M_&X`5_QN`%=U>`L``03U`0``!!0```!X;`4`!!````!02P$"'@`*```````0 +MDH)(`````````````````P`8````````````````````86)C550%``/P;@!7 +M=7@+``$$]0$```04````4$L!`AX`"@``````\)2"2`````````````````,` +M&``````````0````/0```&1E9E54!0`#4W0`5W5X"P`!!/4!```$%````%!+ +M`0(>``H``````.^4@D@````````````````'`!@``````````````'H```!D +M968O9F]O550%``-2=`!7=7@+``$$]0$```04````4$L!`AX`"@``````%I*" +M2`````````````````0`&``````````0````NP```&=H:2]55`4``_QN`%=U +M>`L``03U`0``!!0```!02P$"'@`*```````5E8)(`````````````````P`8 +M`````````!````#Y````:FML550%``.9=`!7=7@+``$$]0$```04````4$L! +M`AX`"@``````%I*"2`````````````````0`&``````````0````00$``&UN +M;R]55`4``_QN`%=U>`L``03U`0``!!0```!02P4&``````8`!@"\`0``B`$` +#```` +` +end diff --git a/libarchive/test/test_read_format_zip_nested.c b/libarchive/test/test_read_format_zip_nested.c new file mode 100644 index 000000000000..6830afb716d7 --- /dev/null +++ b/libarchive/test/test_read_format_zip_nested.c @@ -0,0 +1,85 @@ +/*- + * Copyright (c) 2003,2014 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" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_read_format_zip_nested) +{ + const char *refname = "test_read_format_zip_nested.zip"; + char *p, *inner; + size_t s, innerLength; + struct archive *a; + struct archive_entry *ae; + + extract_reference_file(refname); + p = slurpfile(&s, refname); + + /* Inspect outer Zip */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, p, s, 1)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("small.zip", archive_entry_pathname(ae)); + assertEqualInt(211, archive_entry_size(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); + + /* Save contents of inner Zip. */ + innerLength = (size_t)archive_entry_size(ae); + inner = calloc(innerLength, 1); + assertEqualInt(innerLength, archive_read_data(a, inner, innerLength)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file.txt", archive_entry_pathname(ae)); + assertEqualInt(53, archive_entry_size(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); + + /* Close outer Zip */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); + + /* Inspect inner Zip. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, inner, innerLength, 1)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("another_file.txt", archive_entry_pathname(ae)); + assertEqualInt(29, archive_entry_size(ae)); + assertEqualInt(AE_IFREG, archive_entry_filetype(ae)); + assertEqualInt(archive_entry_is_encrypted(ae), 0); + assertEqualIntA(a, archive_read_has_encrypted_entries(a), 0); + + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); + + free(inner); +} diff --git a/libarchive/test/test_read_format_zip_nested.zip.uu b/libarchive/test/test_read_format_zip_nested.zip.uu new file mode 100644 index 000000000000..7b9e26632aab --- /dev/null +++ b/libarchive/test/test_read_format_zip_nested.zip.uu @@ -0,0 +1,16 @@ +begin 644 test_read_format_zip_nested.zip +M4$L#!`H``````(U`.D6]]'5ITP```-,````)`!P`FEP550)``-Y +MGR14>9\D5'5X"P`!!..5`@`$@A8``%!+`P0*``````"+0#I%N2<3PAT````= +M````$``<`&%N;W1H97)?9FEL92YT>'155`D``W:?)%1VGR14=7@+``$$XY4" +M``2"%@``3VYL>2!T:&ES(&9I;&4@:7,@9&ES<&QA>65D+@I02P$"'@,*```` +M``"+0#I%N2<3PAT````=````$``8```````!````H($`````86YO=&AE`L``03CE0(`!((6``!4:&4@>FEP(&%R8VAI=F4@ +M;65T861A=&$@:7,@;F]T(&1I`PH` +M`````(U`.D6]]'5ITP```-,````)`!@```````````"@@0````!S;6%L;"YZ +M:7!55`4``WF?)%1U>`L``03CE0(`!((6``!02P$"'@,*``````"90#I%^VUC +MDS4````U````"``8```````!````H($6`0``9FEL92YT>'155`4``Y*?)%1U +D>`L``03CE0(`!((6``!02P4&``````(``@"=````C0$````` +` +end diff --git a/libarchive/test/test_read_format_zip_nofiletype.c b/libarchive/test/test_read_format_zip_nofiletype.c new file mode 100644 index 000000000000..b01afabe953b --- /dev/null +++ b/libarchive/test/test_read_format_zip_nofiletype.c @@ -0,0 +1,66 @@ +/*- + * Copyright (c) 2013 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" +__FBSDID("$FreeBSD$"); + +/* + * Issue 332: Some epub files (which are really Zip archives) have + * nonsense in the "external file attributes" field. + */ + +DEFINE_TEST(test_read_format_zip_nofiletype) +{ + const char *refname = "test_read_format_zip_nofiletype.zip"; + char *p; + size_t s; + struct archive *a; + struct archive_entry *ae; + char data[16]; + + extract_reference_file(refname); + p = slurpfile(&s, refname); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip_seekable(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, p, s, 1)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file1", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG | 0644, archive_entry_mode(ae)); + assertEqualInt(6, archive_entry_size(ae)); + assertEqualIntA(a, 6, archive_read_data(a, data, 16)); + assertEqualMem(data, "file1\x0a", 6); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("dir2/", archive_entry_pathname(ae)); + assertEqualInt(AE_IFDIR | 0755, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualIntA(a, 0, archive_read_data(a, data, 16)); + + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); + free(p); +} diff --git a/libarchive/test/test_read_format_zip_nofiletype.zip.uu b/libarchive/test/test_read_format_zip_nofiletype.zip.uu new file mode 100644 index 000000000000..e05e9f055aa7 --- /dev/null +++ b/libarchive/test/test_read_format_zip_nofiletype.zip.uu @@ -0,0 +1,8 @@ +begin 644 test_read_format_zip_nofiletype.zip +M4$L#!`H``````$-$>$,$]RGB!@````8````%````9FEL93%F:6QE,0I02P,$ +M"@``````141X0P````````````````4```!D:7(R+U!+`0(>`PH``````$-$ +M>$,$]RGB!@````8````%``````````$```"D`0````!F:6QE,5!+`0(>`PH` +M`````$5$>$,````````````````%````````````$`#M`2D```!D:7(R+U!+ +4!08``````@`"`&8```!,```````` +` +end diff --git a/libarchive/test/test_read_format_zip_padded.c b/libarchive/test/test_read_format_zip_padded.c new file mode 100644 index 000000000000..dae88abba53e --- /dev/null +++ b/libarchive/test/test_read_format_zip_padded.c @@ -0,0 +1,90 @@ +/*- + * Copyright (c) 2013 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" +__FBSDID("$FreeBSD$"); + +static void +verify_padded_archive(const char *refname) +{ + char *p; + size_t s; + struct archive *a; + struct archive_entry *ae; + + extract_reference_file(refname); + p = slurpfile(&s, refname); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip_seekable(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, p, s, 1)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file0", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG | 0644, archive_entry_mode(ae)); + assertEqualInt(6, archive_entry_size(ae)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualString("file1", archive_entry_pathname(ae)); + assertEqualInt(AE_IFREG | 0644, archive_entry_mode(ae)); + assertEqualInt(6, archive_entry_size(ae)); + + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_free(a)); +} + +/* + * Read a zip file with padding in front. + * This is technically a malformed file, since the + * internal file offsets aren't adjusted to account + * for the added padding. Unfortunately, some SFX + * creators do almost exactly this: + */ +DEFINE_TEST(test_read_format_zip_padded1) +{ + const char *refname = "test_read_format_zip_padded1.zip"; + verify_padded_archive(refname); +} + +/* + * Read a zip file with padding at end. + * Small amounts of end padding should just be ignored by the reader. + * (If there's too much, the reader won't find the central directory.) + */ +DEFINE_TEST(test_read_format_zip_padded2) +{ + const char *refname = "test_read_format_zip_padded2.zip"; + verify_padded_archive(refname); +} + +/* + * Read a zip file with padding at front and end. + */ +DEFINE_TEST(test_read_format_zip_padded3) +{ + const char *refname = "test_read_format_zip_padded3.zip"; + verify_padded_archive(refname); +} + diff --git a/libarchive/test/test_read_format_zip_padded1.zip.uu b/libarchive/test/test_read_format_zip_padded1.zip.uu new file mode 100644 index 000000000000..8cc3f41288eb --- /dev/null +++ b/libarchive/test/test_read_format_zip_padded1.zip.uu @@ -0,0 +1,12 @@ +begin 644 test_read_format_zip_padded1.zip +MBG[*5O,EN^?);45X-!:9?HM14B$W +MD5)U>`L``03U`0``!!0```!F:6QE,`I02P,$"@``````^'EW0P3W*>(&```` +M!@````4`'`!F:6QE,554"0`#)#>14B0WD5)U>`L``03U`0``!!0```!F:6QE +M,0I02P$"'@,*``````#W>7=#1<8R^P8````&````!0`8```````!````I($` +M````9FEL93!55`4``R$WD5)U>`L``03U`0``!!0```!02P$"'@,*``````#X +M>7=#!/`L``03U`0``!!0```!02P4&``````(``@"6````B@`````` +` +end diff --git a/libarchive/test/test_read_format_zip_padded2.zip.uu b/libarchive/test/test_read_format_zip_padded2.zip.uu new file mode 100644 index 000000000000..3b57fe12e005 --- /dev/null +++ b/libarchive/test/test_read_format_zip_padded2.zip.uu @@ -0,0 +1,15 @@ +begin 644 test_read_format_zip_padded2.zip +M4$L#!`H``````/=Y=T-%QC+[!@````8````%`!P`9FEL93!55`D``R$WD5(A +M-Y%2=7@+``$$]0$```04````9FEL93`*4$L#!`H``````/AY=T,$]RGB!@`` +M``8````%`!P`9FEL93%55`D``R0WD5(D-Y%2=7@+``$$]0$```04````9FEL +M93$*4$L!`AX#"@``````]WEW0T7&,OL&````!@````4`&````````0```*2! +M`````&9I;&4P550%``,A-Y%2=7@+``$$]0$```04````4$L!`AX#"@`````` +M^'EW0P3W*>(&````!@````4`&````````0```*2!10```&9I;&4Q550%``,D +M-Y%2=7@+``$$]0$```04````4$L%!@`````"``(`E@```(H``````(.2J;)Q +M[PX@J`9,J[C2AH>N<8_.US0'*2[BOW;O(NTEX5WU&F@8Z'+:Q]HTV@/M"D"9 +MPM-+&=&VJIL(Z1VGT?_2.G?,\!@N+_"U8I!K>[,)F8(HA0[3P7N"0[A;4]3QYC6?U,X[!@NM% +MOQJNIW"H3++]CW52#?CS&A=VU8&T:-YPI'J&>3^,1.F=97>R\P]*YF).R*I0 +M2P,$"@``````]WEW0T7&,OL&````!@````4`'`!F:6QE,%54"0`#(3>14B$W +MD5)U>`L``03U`0``!!0```!F:6QE,`I02P,$"@``````^'EW0P3W*>(&```` +M!@````4`'`!F:6QE,554"0`#)#>14B0WD5)U>`L``03U`0``!!0```!F:6QE +M,0I02P$"'@,*``````#W>7=#1<8R^P8````&````!0`8```````!````I($` +M````9FEL93!55`4``R$WD5)U>`L``03U`0``!!0```!02P$"'@,*``````#X +M>7=#!/`L``03U`0``!!0```!02P4&``````(``@"6````B@``````D$,:4/1\ +MSHGT7I+41*.O21/O.+Z%^`_>)S-WGU>>J4G0Y?5'GJ1PMY->*=#3Y+U(_A)OCL1N.):>IH8%T>Y$?&=@(K; +M(+HD_4?R.6`$;@@+ +M12?TRT^S)&!1W*^J06(&KL+*+>]_YL$5K0Q:G9J,1!%[\Q"5;/MD-K-YJW`L``03U`0``!!0```"E=VLFG3$F"T]Q^;J:A17F^=#3L<1CO8K; +MX-(?KU!+!PA'_=BD'0```.\!``!02P,$%``)``@`V#001>O'D[0=````[P$` +M``<`'`!F;V\N='AT550)``/H?>Y3Z'WN4W5X"P`!!/4!```$%````#O!PFX- +MNJG:A01W(N8M^T7N9=\_D!=4=?,$"6L\4$L'".O'D[0=````[P$``%!+`0(> +M`Q0`"0`(`,HT$$5'_=BD'0```.\!```'`!@```````$```"D@0````!B87(N +M='AT550%``/,?>Y3=7@+``$$]0$```04````4$L!`AX#%``)``@`V#001>O' +MD[0=````[P$```<`&````````0```*2!;@```&9O;RYT>'155`4``^A][E-U +D>`L``03U`0``!!0```!02P4&``````(``@":````W``````` +` +end diff --git a/libarchive/test/test_read_format_zip_winzip_aes.c b/libarchive/test/test_read_format_zip_winzip_aes.c new file mode 100644 index 000000000000..082337d7eabf --- /dev/null +++ b/libarchive/test/test_read_format_zip_winzip_aes.c @@ -0,0 +1,152 @@ +/*- + * Copyright (c) 2013 Konrad Kleine + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +static void +test_winzip_aes(const char *refname, int need_libz) +{ + struct archive_entry *ae; + struct archive *a; + char buff[512]; + + /* Check if running system has cryptographic functionarity. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + if (ARCHIVE_OK != archive_write_set_options(a, + "zip:encryption=aes256")) { + skipping("This system does not have cryptographic liberary"); + archive_write_free(a); + return; + } + archive_write_free(a); + + + extract_reference_file(refname); + + /* + * Extract a zip file without password. + */ + 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_READ_FORMAT_ENCRYPTION_DONT_KNOW, + archive_read_has_encrypted_entries(a)); + + /* Verify encrypted file "README" */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae)); + assertEqualString("README", archive_entry_pathname(ae)); + assertEqualInt(6818, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + assertEqualInt(ARCHIVE_FAILED, archive_read_data(a, buff, sizeof(buff))); + 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_ZIP, archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + + /* + * Extract a zip file with password. + */ + 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)); + /* Pass three passphrases to decrypt a file content. */ + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "invalid_pass")); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "invalid_phrase")); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password")); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_filename(a, refname, 10240)); + + assertEqualIntA(a, ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW, + archive_read_has_encrypted_entries(a)); + + /* Verify encrypted file "README" */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt((AE_IFREG | 0644), archive_entry_mode(ae)); + assertEqualString("README", archive_entry_pathname(ae)); + assertEqualInt(6818, archive_entry_size(ae)); + assertEqualInt(1, archive_entry_is_data_encrypted(ae)); + assertEqualInt(0, archive_entry_is_metadata_encrypted(ae)); + assertEqualIntA(a, 1, archive_read_has_encrypted_entries(a)); + if (!need_libz || archive_zlib_version() != NULL) { + assertEqualInt(512, archive_read_data(a, buff, sizeof(buff))); + } else { + assertEqualInt(ARCHIVE_FAILED, archive_read_data(a, buff, 19)); + assertEqualString(archive_error_string(a), + "Unsupported ZIP compression method (deflation)"); + assert(archive_errno(a) != 0); + } + + 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_ZIP, archive_format(a)); + + /* Close the archive. */ + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + +DEFINE_TEST(test_read_format_zip_winzip_aes128) +{ + /* WinZip AES-128 encryption. */ + test_winzip_aes("test_read_format_zip_winzip_aes128.zip", 1); +} + +DEFINE_TEST(test_read_format_zip_winzip_aes256) +{ + /* WinZip AES-256 encryption. */ + test_winzip_aes("test_read_format_zip_winzip_aes256.zip", 1); +} + +DEFINE_TEST(test_read_format_zip_winzip_aes256_stored) +{ + /* WinZip AES-256 encryption with stored data. */ + test_winzip_aes("test_read_format_zip_winzip_aes256_stored.zip", 0); +} diff --git a/libarchive/test/test_read_format_zip_winzip_aes128.zip.uu b/libarchive/test/test_read_format_zip_winzip_aes128.zip.uu new file mode 100644 index 000000000000..d0f03a3112e1 --- /dev/null +++ b/libarchive/test/test_read_format_zip_winzip_aes128.zip.uu @@ -0,0 +1,66 @@ +begin 644 test_read_format_zip_winzip_aes128_encryption_data.zip +M4$L#!#,#`0!C`(RP#D4`````@0H``*(:```&``L`4D5!1$U%`9D'``(`044! +M"``>H87EHY!N6J#=V\<,#M>^H2IQID3@A--GSL+F%'R^%OKB.K(74CJ!,(%" +ML\O.^D'TO'!T<+"]"28FXP@QKAY]R+02!E!XE_6A-W&<$&SJ5W]K'SJ4>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_A5F5-1$.I*C12"?[BI%-I:,6_9<.$W(V)J!L0AJ+//9H5":1Q>2HQ#J$ +M$D#]UA6EY1K=;`+2#+;SN(U(6^/L@29`!W8UX/!?@%M,3_;+4$L!`C\#,P,! +M`&,`C+`.10````"!"@``HAH```8`"P`````````@@*2!`````%)%041-10&9 +?!P`"`$%%`0@`4$L%!@`````!``$`/P```+`*```````` +` +end diff --git a/libarchive/test/test_read_format_zip_winzip_aes256.zip.uu b/libarchive/test/test_read_format_zip_winzip_aes256.zip.uu new file mode 100644 index 000000000000..a45c8fbe664f --- /dev/null +++ b/libarchive/test/test_read_format_zip_winzip_aes256.zip.uu @@ -0,0 +1,66 @@ +begin 644 test_read_format_zip_winzip_aes256_encryption_data.zip +M4$L#!#,#`0!C`(RP#D4`````B0H``*(:```&``L`4D5!1$U%`9D'``(`044# +M"`#8+Z><':+DENQS9*!7Y*&!7BQK,UN]RF*'<':@;]N)O5>]A5>0[]C +M/4TU`"Y%KD,Q;V2W_NEI5;0-K#T.V%NY<)7![$L?;Q::E65L97^;(+=(2IFV +M*'V?"J/<$%EG^(,TPE7;:2^<$6IHLS:.DOJ1TANF&QL'Z>'ZY\:N^L@0VR[U +M(&+EC'2'.[8;UR0V(5169*2.:4?INQ>39^)88TBNQW?-GB3GU.U.%S\H^.0P +MYD+[R+-`^RY.XG((?EE<)XMHV2G=,5E,UK?R9:>FP4W2O(M8.D/P`W'HQ`K\ +M!JRK)[G8E%$_?=33Y8==ZY,D%4*7;1`=_G^+//Y$ +M2%I`YQ-RB$:L-;KU[W;V^4!`Z'SWP0>32#!#KM1.%WI/&D2]EM3IZRZ#@M"SML^ZB/,-1 +M6>-.Z,-C%)36I+!%R^QJ$W"&OKM$P>?77. +M\2][ST/5[OK@*I,ZS(XRI=PZPK!/^TV<=Q42TCAH`96R4C`"\D5J.,E-;,3S +M52BDWJ/'-B:_.J&-R[>]W$`6#W9VNCR#$WC-;P +M)/D[F[VO:O`7;O_%\.BN0N7Q5SQFS:1.S[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EH;9R$>D9UNDK5&1<%Q$=T2H:[?6NS!#`$]JUJN)KDA+;\?OL`V +M/UL!FHQ[E:#KM',87??MLQ//57G:Y"X:W@Z7T0"/=O8UK\IOKJ#/H* +MRY3%(H^4QTON[C?(A[`)G'<.'#])^W7Q$:L.,S+Y#NH50*L.UK)!Y&=9T9ZK +M82&!G,EMJRAS893'@XN!N_2W7A$%.VW:8VBLC(.T?%T>%YO>TC761K*,=1;Y +M:3;0=K&-R_T0]E+,U-..&CB'G=L_7^62Z&7;`4^9XD_,QW +M)2R4!S5A]K1!D3!'M-J4_II&KMGZLJ=#$U,3'[!3T#W\Q6(,6YBG2NIJB/'9 +MOB*97C,5:,6E=>'TXQEFOT^<37@@?)!!+&%+SKZBYT\DC%2"@Z_]MSTYK@+U +MT*QLJS^\7=DWP@0FHR[.&@B47"0QM).3I)@<186J$T7`RZ<# +M^'P2JU?A("I4%VTDRLQUTRV_;Y&(2HMG/I>Z*5YR)B8M?U;S7H,3Q3M5#A'& +M&"[AV@.%,6YZ]Y6DG9)8`=2V'K#CTU#I\6=HL?\;/#VPC98#JBP9 +M`\VN+W02QK_,-`^I-Z0-K003Y[9NR__P1^,OQY[JHM_MA8Z5M&?HM.1TO98@ +MC/VHMV#85&XLFNN6VU2JXU'>=U/Y:"FI&&[=O?EU=`:WBO8+4%_R/BNRO(R: +MYJTK]U@)6&^QU>:;V)>YGKVVCR=?E,A.60O+AU3HYMXLT_OVE9QJJ-ASQE_$ +M:>T@FMZ\CHU#A]5$J%50$8!"B^S#K_LK5I[//X1DI%60QG4[2@7T7^I]F\Q0 +M2P$"/P,S`P$`8P",L`Y%`````(D*``"B&@``!@`+`````````""`I($````` +G4D5!1$U%`9D'``(`044#"`!02P4&``````$``0`_````N`H````` +` +end diff --git a/libarchive/test/test_read_format_zip_winzip_aes256_large.zip.uu b/libarchive/test/test_read_format_zip_winzip_aes256_large.zip.uu new file mode 100644 index 000000000000..4d887574bb50 --- /dev/null +++ b/libarchive/test/test_read_format_z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\W")`@FH6O@K+8&Q79I6/ +M1E8A/65;.7IQP,I3^#8$=#_7$NL_7;)/C2X;F;3U6-U52A73Z&OY&QL=--L/ +MTT*1Y'UMZI![[ZP6YXQ\(KF,%GGRNDSN-GT(X/@CM&%''4B'9-/[ +M:7(4%V+8B_I_G@XO!1Q5:DW$I?&QI\P`@RU$KVES`B^>,QU?S).4?X1@(0[2?]C_##22\J`G86//K[JRGGH+"Y)HLA%4_9V== +M5P(C0&F8,O.R)P>54%T76]#>@LXO63MZ001?L+'O!K>5XS>K]:T:[@>,B:;IB2F*GGO8&\R#"$?)HPC+#D'AN$-BB4DCN*:APG]7"W%3B*5"(U2T4X= +M@9C.@/8;.JZHG[SVJT15QY!L.)V[L,D%N(/,7EV<6T2M8]4DBT%,R/89LA8U +M>U\)64S)#*.)'0[!#/\9.6^W_>#"!B@NBL?7JZ1.$I"VID$2&TI'0Z@\P'\G +M6SR9!0NU^`IV_ID8U%=3*(^+"4T1X((6_FBQC)9$PFBUL]<1,]S!+>#PJ[$,`````__________\!`!0`+0$`$``````````````` +M````````2\O,237@`@!02P<(1<8R^P@`````````!@````````!02P$"'@,M +M``@`"`!/>7A#1<8R^P@````&`````0`````````!````L($`````+5!+!08` +1`````0`!`"\```!3```````` +` +end diff --git a/libarchive/test/test_read_format_zip_zip64b.zip.uu b/libarchive/test/test_read_format_zip_zip64b.zip.uu new file mode 100644 index 000000000000..99bef749b506 --- /dev/null +++ b/libarchive/test/test_read_format_zip_zip64b.zip.uu @@ -0,0 +1,7 @@ +begin 644 test_read_format_zip_zip64b.zip +M4$L#!"T`"``(`$]Y>$,`````_____P8````!``P`+0$`"````````````$O+ +MS$DUX`(`4$L'"$7&,OL(``````````8`````````4$L!`AX#+0`(``@`3WEX +M0T7&,OL(````!@````$``````````0```+"!`````"U02P4&``````$``0`O +)````2P`````` +` +end diff --git a/libarchive/test/test_read_too_many_filters.c b/libarchive/test/test_read_too_many_filters.c new file mode 100644 index 000000000000..fdd582ff715a --- /dev/null +++ b/libarchive/test/test_read_too_many_filters.c @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2003-2008,2015 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" + +DEFINE_TEST(test_read_too_many_filters) +{ + const char *name = "test_read_too_many_filters.gz"; + struct archive *a; + int r; + + assert((a = archive_read_new()) != NULL); + r = archive_read_support_filter_gzip(a); + if (r == ARCHIVE_WARN) { + skipping("gzip reading not fully supported on this platform"); + } + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + extract_reference_file(name); + assertEqualIntA(a, ARCHIVE_FATAL, + archive_read_open_filename(a, name, 200)); + + // Can't assert the return value here: + // = Decompressing via zlib will return ARCHIVE_OK + // = Decompressing via external gzip will return ARCHIVE_WARN + // (Due to a dirty shutdown of the gzip program.) + archive_read_close(a); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_read_too_many_filters.gz.uu b/libarchive/test/test_read_too_many_filters.gz.uu new file mode 100644 index 000000000000..6bf6614f3b19 --- /dev/null +++ b/libarchive/test/test_read_too_many_filters.gz.uu @@ -0,0 +1,15 @@ +This is a valid gzip file that decompresses to itself, from + http://www.maximumcompression.com/selfgz.gz + +This is used in test_read_too_many_filters to try to +crash libarchive by forcing it to spawn an unending +list of gunzip filters. + +begin 644 test_read_too_many_filters.gz +M'XL(`````````P`/`/#_'XL(`````````P`/`/#_````__\```#__X)QH5P` +M`!X`X?\```#__P```/__@G&A7```'@#A_P```/__````__\```#__P```/__ +M````__\```#__\(FAF`!`!0`Z_\```#__P```/__PB:&8`$`%`#K_\(FAF`! +M`!0`Z_^9(#6-B"@Q,C,T`K/`+```%`#K_P*SP"P``!0`Z_]"B"'$`````/__ +>`P!#2DTAT@```$*((<0`````__\#`$-*32'2```` +` +end diff --git a/libarchive/test/test_read_truncated.c b/libarchive/test/test_read_truncated.c index 3e6652567387..3991ab2baa61 100644 --- a/libarchive/test/test_read_truncated.c +++ b/libarchive/test/test_read_truncated.c @@ -25,8 +25,8 @@ #include "test.h" __FBSDID("$FreeBSD: src/lib/libarchive/test/test_read_truncated.c,v 1.4 2008/09/01 05:38:33 kientzle Exp $"); -char buff[1000000]; -char buff2[100000]; +static char buff[1000000]; +static char buff2[100000]; DEFINE_TEST(test_read_truncated) { diff --git a/libarchive/test/test_sparse_basic.c b/libarchive/test/test_sparse_basic.c index 1963aa4985dc..3cea4595c95f 100644 --- a/libarchive/test/test_sparse_basic.c +++ b/libarchive/test/test_sparse_basic.c @@ -40,6 +40,9 @@ __FBSDID("$FreeBSD$"); #ifdef HAVE_UNISTD_H #include #endif +#ifdef HAVE_LINUX_TYPES_H +#include +#endif #ifdef HAVE_LINUX_FIEMAP_H #include #endif @@ -47,6 +50,11 @@ __FBSDID("$FreeBSD$"); #include #endif +/* The logic to compare sparse file data read from disk with the + * specification is a little involved. Set to 1 to have the progress + * dumped. */ +#define DEBUG 0 + /* * NOTE: On FreeBSD and Solaris, this test needs ZFS. * You may should perfom this test as @@ -215,9 +223,19 @@ create_sparse_file(const char *path, const struct sparse *s) { char buff[1024]; int fd; + size_t total_size = 0; + const struct sparse *cur = s; memset(buff, ' ', sizeof(buff)); assert((fd = open(path, O_CREAT | O_WRONLY, 0600)) != -1); + + /* Handle holes at the end by extending the file */ + while (cur->type != END) { + total_size += cur->size; + ++cur; + } + assert(ftruncate(fd, total_size) != -1); + while (s->type != END) { if (s->type == HOLE) { assert(lseek(fd, s->size, SEEK_CUR) != (off_t)-1); @@ -246,38 +264,114 @@ create_sparse_file(const char *path, const struct sparse *s) */ static void verify_sparse_file(struct archive *a, const char *path, - const struct sparse *sparse, int blocks) + const struct sparse *sparse, int expected_holes) { struct archive_entry *ae; const void *buff; size_t bytes_read; - int64_t offset; - int64_t total; - int data_blocks, hole; + int64_t offset, expected_offset, last_offset; + int holes_seen = 0; create_sparse_file(path, sparse); assert((ae = archive_entry_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_disk_open(a, path)); assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header2(a, ae)); - /* Verify the number of holes only, not its offset nor its - * length because those alignments are deeply dependence on - * its filesystem. */ - assertEqualInt(blocks, archive_entry_sparse_count(ae)); - total = 0; - data_blocks = 0; - hole = 0; + + expected_offset = 0; + last_offset = 0; while (ARCHIVE_OK == archive_read_data_block(a, &buff, &bytes_read, &offset)) { - if (offset > total || offset == 0) { - if (offset > total) - hole = 1; - data_blocks++; + const char *start = buff; +#if DEBUG + fprintf(stderr, "%s: bytes_read=%d offset=%d\n", path, (int)bytes_read, (int)offset); +#endif + if (offset > last_offset) { + ++holes_seen; } - total = offset + bytes_read; + /* Blocks entirely before the data we just read. */ + while (expected_offset + (int64_t)sparse->size < offset) { +#if DEBUG + fprintf(stderr, " skipping expected_offset=%d, size=%d\n", (int)expected_offset, (int)sparse->size); +#endif + /* Must be holes. */ + assert(sparse->type == HOLE); + expected_offset += sparse->size; + ++sparse; + } + /* Block that overlaps beginning of data */ + if (expected_offset < offset + && expected_offset + (int64_t)sparse->size <= offset + (int64_t)bytes_read) { + const char *end = (const char *)buff + (expected_offset - offset) + (size_t)sparse->size; +#if DEBUG + fprintf(stderr, " overlapping hole expected_offset=%d, size=%d\n", (int)expected_offset, (int)sparse->size); +#endif + /* Must be a hole, overlap must be filled with '\0' */ + if (assert(sparse->type == HOLE)) { + assertMemoryFilledWith(start, end - start, '\0'); + } + start = end; + expected_offset += sparse->size; + ++sparse; + } + /* Blocks completely contained in data we just read. */ + while (expected_offset + (int64_t)sparse->size <= offset + (int64_t)bytes_read) { + const char *end = (const char *)buff + (expected_offset - offset) + (size_t)sparse->size; + if (sparse->type == HOLE) { +#if DEBUG + fprintf(stderr, " contained hole expected_offset=%d, size=%d\n", (int)expected_offset, (int)sparse->size); +#endif + + /* verify data corresponding to hole is '\0' */ + if (end > (const char *)buff + bytes_read) { + end = (const char *)buff + bytes_read; + } + assertMemoryFilledWith(start, end - start, '\0'); + start = end; + expected_offset += sparse->size; + ++sparse; + } else if (sparse->type == DATA) { +#if DEBUG + fprintf(stderr, " contained data expected_offset=%d, size=%d\n", (int)expected_offset, (int)sparse->size); +#endif + /* verify data corresponding to hole is ' ' */ + if (assert(expected_offset + sparse->size <= offset + bytes_read)) { + assert(start == (const char *)buff + (size_t)(expected_offset - offset)); + assertMemoryFilledWith(start, end - start, ' '); + } + start = end; + expected_offset += sparse->size; + ++sparse; + } else { + break; + } + } + /* Block that overlaps end of data */ + if (expected_offset < offset + (int64_t)bytes_read) { + const char *end = (const char *)buff + bytes_read; +#if DEBUG + fprintf(stderr, " trailing overlap expected_offset=%d, size=%d\n", (int)expected_offset, (int)sparse->size); +#endif + /* Must be a hole, overlap must be filled with '\0' */ + if (assert(sparse->type == HOLE)) { + assertMemoryFilledWith(start, end - start, '\0'); + } + } + last_offset = offset + bytes_read; } - if (!hole && data_blocks == 1) - data_blocks = 0;/* There are no holes */ - assertEqualInt(blocks, data_blocks); + /* Count a hole at EOF? */ + if (last_offset < archive_entry_size(ae)) { + ++holes_seen; + } + + /* Verify blocks after last read */ + while (sparse->type == HOLE) { + expected_offset += sparse->size; + ++sparse; + } + assert(sparse->type == END); + assertEqualInt(expected_offset, archive_entry_size(ae)); + + assertEqualInt(holes_seen, expected_holes); assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); archive_entry_free(ae); @@ -388,9 +482,10 @@ DEFINE_TEST(test_sparse_basic) { END, 0 } }; const struct sparse sparse_file3[] = { - /* This hole size is too small to create a sparse - * files for almost filesystem. */ - { HOLE, 1024 }, { DATA, 10240 }, + /* This hole size is too small to create a sparse file */ + { HOLE, 1 }, { DATA, 10240 }, + { HOLE, 1 }, { DATA, 10240 }, + { HOLE, 1 }, { DATA, 10240 }, { END, 0 } }; @@ -422,9 +517,10 @@ DEFINE_TEST(test_sparse_basic) */ assert((a = archive_read_disk_new()) != NULL); - verify_sparse_file(a, "file0", sparse_file0, 5); - verify_sparse_file(a, "file1", sparse_file1, 2); + verify_sparse_file(a, "file0", sparse_file0, 4); + verify_sparse_file(a, "file1", sparse_file1, 3); verify_sparse_file(a, "file2", sparse_file2, 20); + /* Encoded non sparse; expect a data block but no sparse entries. */ verify_sparse_file(a, "file3", sparse_file3, 0); assertEqualInt(ARCHIVE_OK, archive_read_free(a)); @@ -440,3 +536,37 @@ DEFINE_TEST(test_sparse_basic) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); free(cwd); } + +DEFINE_TEST(test_fully_sparse_files) +{ + char *cwd; + struct archive *a; + + const struct sparse sparse_file[] = { + { HOLE, 409600 }, { END, 0 } + }; + /* Check if the filesystem where CWD on can + * report the number of the holes of a sparse file. */ +#ifdef PATH_MAX + cwd = getcwd(NULL, PATH_MAX);/* Solaris getcwd needs the size. */ +#else + cwd = getcwd(NULL, 0); +#endif + if (!assert(cwd != NULL)) + return; + if (!is_sparse_supported(cwd)) { + free(cwd); + skipping("This filesystem or platform do not support " + "the reporting of the holes of a sparse file through " + "API such as lseek(HOLE)"); + return; + } + + assert((a = archive_read_disk_new()) != NULL); + + /* Fully sparse files are encoded with a zero-length "data" block. */ + verify_sparse_file(a, "file0", sparse_file, 1); + + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + free(cwd); +} diff --git a/libarchive/test/test_ustar_filename_encoding.c b/libarchive/test/test_ustar_filename_encoding.c index 17b7e4a22764..5e4fba716c13 100644 --- a/libarchive/test/test_ustar_filename_encoding.c +++ b/libarchive/test/test_ustar_filename_encoding.c @@ -27,8 +27,7 @@ __FBSDID("$FreeBSD$"); #include -static void -test_ustar_filename_encoding_UTF8_CP866(void) +DEFINE_TEST(test_ustar_filename_encoding_UTF8_CP866) { struct archive *a; struct archive_entry *entry; @@ -69,8 +68,7 @@ test_ustar_filename_encoding_UTF8_CP866(void) assertEqualMem(buff, "\xAF\xE0\xA8", 3); } -static void -test_ustar_filename_encoding_KOI8R_UTF8(void) +DEFINE_TEST(test_ustar_filename_encoding_KOI8R_UTF8) { struct archive *a; struct archive_entry *entry; @@ -111,8 +109,7 @@ test_ustar_filename_encoding_KOI8R_UTF8(void) assertEqualMem(buff, "\xD0\xBF\xD1\x80\xD0\xB8", 6); } -static void -test_ustar_filename_encoding_KOI8R_CP866(void) +DEFINE_TEST(test_ustar_filename_encoding_KOI8R_CP866) { struct archive *a; struct archive_entry *entry; @@ -153,8 +150,7 @@ test_ustar_filename_encoding_KOI8R_CP866(void) assertEqualMem(buff, "\xAF\xE0\xA8", 3); } -static void -test_ustar_filename_encoding_CP1251_UTF8(void) +DEFINE_TEST(test_ustar_filename_encoding_CP1251_UTF8) { struct archive *a; struct archive_entry *entry; @@ -199,8 +195,7 @@ test_ustar_filename_encoding_CP1251_UTF8(void) /* * Do not translate CP1251 into CP866 if non Windows platform. */ -static void -test_ustar_filename_encoding_ru_RU_CP1251(void) +DEFINE_TEST(test_ustar_filename_encoding_ru_RU_CP1251) { struct archive *a; struct archive_entry *entry; @@ -240,8 +235,7 @@ test_ustar_filename_encoding_ru_RU_CP1251(void) * into CP866 filenames and store it in the ustar file. * Test above behavior works well. */ -static void -test_ustar_filename_encoding_Russian_Russia(void) +DEFINE_TEST(test_ustar_filename_encoding_Russian_Russia) { struct archive *a; struct archive_entry *entry; @@ -276,8 +270,7 @@ test_ustar_filename_encoding_Russian_Russia(void) assertEqualMem(buff, "\xAF\xE0\xA8", 3); } -static void -test_ustar_filename_encoding_EUCJP_UTF8(void) +DEFINE_TEST(test_ustar_filename_encoding_EUCJP_UTF8) { struct archive *a; struct archive_entry *entry; @@ -317,8 +310,7 @@ test_ustar_filename_encoding_EUCJP_UTF8(void) assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7); } -static void -test_ustar_filename_encoding_EUCJP_CP932(void) +DEFINE_TEST(test_ustar_filename_encoding_EUCJP_CP932) { struct archive *a; struct archive_entry *entry; @@ -358,8 +350,7 @@ test_ustar_filename_encoding_EUCJP_CP932(void) assertEqualMem(buff, "\x95\x5C.txt", 6); } -static void -test_ustar_filename_encoding_CP932_UTF8(void) +DEFINE_TEST(test_ustar_filename_encoding_CP932_UTF8) { struct archive *a; struct archive_entry *entry; @@ -400,15 +391,3 @@ test_ustar_filename_encoding_CP932_UTF8(void) assertEqualMem(buff, "\xE8\xA1\xA8.txt", 7); } -DEFINE_TEST(test_ustar_filename_encoding) -{ - test_ustar_filename_encoding_UTF8_CP866(); - test_ustar_filename_encoding_KOI8R_UTF8(); - test_ustar_filename_encoding_KOI8R_CP866(); - test_ustar_filename_encoding_CP1251_UTF8(); - test_ustar_filename_encoding_ru_RU_CP1251(); - test_ustar_filename_encoding_Russian_Russia(); - test_ustar_filename_encoding_EUCJP_UTF8(); - test_ustar_filename_encoding_EUCJP_CP932(); - test_ustar_filename_encoding_CP932_UTF8(); -} diff --git a/libarchive/test/test_warn_missing_hardlink_target.c b/libarchive/test/test_warn_missing_hardlink_target.c new file mode 100644 index 000000000000..d7fa5eb6c0fc --- /dev/null +++ b/libarchive/test/test_warn_missing_hardlink_target.c @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2015 Graham Percival + * 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" + +DEFINE_TEST(test_warn_missing_hardlink_target) +{ + struct archive *a; + struct archive_entry *ae; + + assert(NULL != (a = archive_write_disk_new())); + assert(NULL != (ae = archive_entry_new())); + + archive_entry_set_pathname(ae, "hardlink-name"); + archive_entry_set_hardlink(ae, "hardlink-target"); + + assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); + assertEqualInt(ENOENT, archive_errno(a)); + assertEqualString("Hard-link target 'hardlink-target' does not exist.", + archive_error_string(a)); + + archive_entry_free(ae); + archive_free(a); +} diff --git a/libarchive/test/test_write_disk_appledouble.c b/libarchive/test/test_write_disk_appledouble.c index d604fbf2d51b..81032fca9cd0 100644 --- a/libarchive/test/test_write_disk_appledouble.c +++ b/libarchive/test/test_write_disk_appledouble.c @@ -35,6 +35,33 @@ __FBSDID("$FreeBSD$"); #if defined(__APPLE__) && defined(UF_COMPRESSED) && defined(HAVE_SYS_XATTR_H)\ && defined(HAVE_ZLIB_H) + +// +// The test ACL used here is sometimes assigned to the 'Guest' user +// This changes the text and breaks the test. This function simply +// strips the 'Guest' information from the string to help ensure +// consistent results on different machines. +// +static char _acl_temp[256]; +static const char * +clean_acl(const char *acl) { + char *p, *q; + if (strlen(acl) >= sizeof(_acl_temp)) + return acl; + + strcpy(_acl_temp, acl); + p = strstr(_acl_temp, ":Guest:"); + if (p != NULL) { + fprintf(stderr, "Shortening: %s\n", p + 1); + memmove(p + 1, p + 6, strlen(p + 6) + 1); + q = strstr(p + 2, ":"); + fprintf(stderr, "Shortening: %s\n", q); + memmove(p + 2, q, strlen(q) + 1); + return _acl_temp; + } + return _acl_temp; +} + static int has_xattr(const char *filename, const char *xattrname) { @@ -48,8 +75,8 @@ has_xattr(const char *filename, const char *xattrname) if (r == 0) return (0); - nl = malloc(r); - if (!assert(nl != NULL)) + assert((nl = malloc(r)) != NULL); + if (nl == NULL) return (0); r = listxattr(filename, nl, r, XATTR_SHOWCOMPRESSION); @@ -136,9 +163,9 @@ DEFINE_TEST(test_write_disk_appledouble) failure("'%s' should have decompfs xattr", "file3"); assertEqualInt(1, has_xattr("file3", "com.apple.decmpfs")); assert(NULL != (acl = acl_get_file("file3", ACL_TYPE_EXTENDED))); - assertEqualString(acl_to_text(acl, NULL), + assertEqualString(clean_acl(acl_to_text(acl, NULL)), "!#acl 1\n" - "user:FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000C9:Guest:201:deny:read\n" + "user:FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000C9:::deny:read\n" "group:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000050:admin:80:allow:write\n" ); if (acl) acl_free(acl); @@ -195,9 +222,9 @@ DEFINE_TEST(test_write_disk_appledouble) failure("'%s' should not have decmpfs", "file3"); assertEqualInt(0, has_xattr("file3", "com.apple.decmpfs")); assert(NULL != (acl = acl_get_file("file3", ACL_TYPE_EXTENDED))); - assertEqualString(acl_to_text(acl, NULL), + assertEqualString(clean_acl(acl_to_text(acl, NULL)), "!#acl 1\n" - "user:FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000C9:Guest:201:deny:read\n" + "user:FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000C9:::deny:read\n" "group:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000050:admin:80:allow:write\n" ); if (acl) acl_free(acl); diff --git a/libarchive/test/test_write_disk_hfs_compression.c b/libarchive/test/test_write_disk_hfs_compression.c index 24c13c4ed68a..2960fe2ed6dd 100644 --- a/libarchive/test/test_write_disk_hfs_compression.c +++ b/libarchive/test/test_write_disk_hfs_compression.c @@ -45,8 +45,8 @@ has_xattr(const char *filename, const char *xattrname) if (r == 0) return (0); - nl = malloc(r); - if (!assert(nl != NULL)) + assert((nl = malloc(r)) != NULL); + if (nl == NULL) return (0); r = listxattr(filename, nl, r, XATTR_SHOWCOMPRESSION); diff --git a/libarchive/test/test_write_disk_mac_metadata.c b/libarchive/test/test_write_disk_mac_metadata.c index f9e47d659363..6e9e72365e13 100644 --- a/libarchive/test/test_write_disk_mac_metadata.c +++ b/libarchive/test/test_write_disk_mac_metadata.c @@ -33,8 +33,35 @@ __FBSDID("$FreeBSD$"); #include #endif + #if defined(__APPLE__) && defined(UF_COMPRESSED) && defined(HAVE_SYS_XATTR_H)\ && defined(HAVE_ZLIB_H) +// +// The test ACL used here is sometimes assigned to the 'Guest' user +// This changes the text and breaks the test. This function simply +// strips the 'Guest' information from the string to help ensure +// consistent results on different machines. +// +static char _acl_temp[256]; +static const char * +clean_acl(const char *acl) { + char *p, *q; + if (strlen(acl) >= sizeof(_acl_temp)) + return acl; + + strcpy(_acl_temp, acl); + p = strstr(_acl_temp, ":Guest:"); + if (p != NULL) { + fprintf(stderr, "Shortening: %s\n", p + 1); + memmove(p + 1, p + 6, strlen(p + 6) + 1); + q = strstr(p + 2, ":"); + fprintf(stderr, "Shortening: %s\n", q); + memmove(p + 2, q, strlen(q) + 1); + return _acl_temp; + } + return _acl_temp; +} + static int has_xattr(const char *filename, const char *xattrname) { @@ -48,8 +75,8 @@ has_xattr(const char *filename, const char *xattrname) if (r == 0) return (0); - nl = malloc(r); - if (!assert(nl != NULL)) + assert((nl = malloc(r)) != NULL); + if (nl == NULL) return (0); r = listxattr(filename, nl, r, XATTR_SHOWCOMPRESSION); @@ -129,9 +156,9 @@ DEFINE_TEST(test_write_disk_mac_metadata) failure("'%s' should have decompfs xattr", "file3"); assertEqualInt(1, has_xattr("file3", "com.apple.decmpfs")); assert(NULL != (acl = acl_get_file("file3", ACL_TYPE_EXTENDED))); - assertEqualString(acl_to_text(acl, NULL), + assertEqualString(clean_acl(acl_to_text(acl, NULL)), "!#acl 1\n" - "user:FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000C9:Guest:201:deny:read\n" + "user:FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000C9:::deny:read\n" "group:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000050:admin:80:allow:write\n" ); if (acl) acl_free(acl); @@ -180,9 +207,9 @@ DEFINE_TEST(test_write_disk_mac_metadata) failure("'%s' should not have decmpfs", "file3"); assertEqualInt(0, has_xattr("file3", "com.apple.decmpfs")); assert(NULL != (acl = acl_get_file("file3", ACL_TYPE_EXTENDED))); - assertEqualString(acl_to_text(acl, NULL), + assertEqualString(clean_acl(acl_to_text(acl, NULL)), "!#acl 1\n" - "user:FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000C9:Guest:201:deny:read\n" + "user:FFFFEEEE-DDDD-CCCC-BBBB-AAAA000000C9:::deny:read\n" "group:ABCDEFAB-CDEF-ABCD-EFAB-CDEF00000050:admin:80:allow:write\n" ); if (acl) acl_free(acl); diff --git a/libarchive/test/test_write_disk_no_hfs_compression.c b/libarchive/test/test_write_disk_no_hfs_compression.c index a1afb9bb290f..b7210e204a14 100644 --- a/libarchive/test/test_write_disk_no_hfs_compression.c +++ b/libarchive/test/test_write_disk_no_hfs_compression.c @@ -45,8 +45,8 @@ has_xattr(const char *filename, const char *xattrname) if (r == 0) return (0); - nl = malloc(r); - if (!assert(nl != NULL)) + assert((nl = malloc(r)) != NULL); + if (nl == NULL) return (0); r = listxattr(filename, nl, r, XATTR_SHOWCOMPRESSION); diff --git a/libarchive/test/test_write_disk_perms.c b/libarchive/test/test_write_disk_perms.c index 7861735bd573..4b68e52b4ee5 100644 --- a/libarchive/test/test_write_disk_perms.c +++ b/libarchive/test/test_write_disk_perms.c @@ -150,8 +150,8 @@ DEFINE_TEST(test_write_disk_perms) assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "file_0755"); archive_entry_set_mode(ae, S_IFREG | 0777); - assert(0 == archive_write_header(a, ae)); - assert(0 == archive_write_finish_entry(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); archive_entry_free(ae); /* Write a regular file, then write over it. */ @@ -159,63 +159,63 @@ DEFINE_TEST(test_write_disk_perms) assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "file_overwrite_0144"); archive_entry_set_mode(ae, S_IFREG | 0777); - assert(0 == archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); archive_entry_free(ae); - assert(0 == archive_write_finish_entry(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); /* Check that file was created with different perms. */ - assert(0 == stat("file_overwrite_0144", &st)); + assertEqualInt(0, stat("file_overwrite_0144", &st)); failure("file_overwrite_0144: st.st_mode=%o", st.st_mode); assert((st.st_mode & 07777) != 0144); /* Overwrite, this should change the perms. */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "file_overwrite_0144"); archive_entry_set_mode(ae, S_IFREG | 0144); - assert(0 == archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); archive_entry_free(ae); - assert(0 == archive_write_finish_entry(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); /* Write a regular dir. */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "dir_0514"); archive_entry_set_mode(ae, S_IFDIR | 0514); - assert(0 == archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); archive_entry_free(ae); - assert(0 == archive_write_finish_entry(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); /* Overwrite an existing dir. */ /* For dir, the first perms should get left. */ assertMakeDir("dir_overwrite_0744", 0744); /* Check original perms. */ - assert(0 == stat("dir_overwrite_0744", &st)); + assertEqualInt(0, stat("dir_overwrite_0744", &st)); failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 0777) == 0744); + assertEqualInt(st.st_mode & 0777, 0744); /* Overwrite shouldn't edit perms. */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "dir_overwrite_0744"); archive_entry_set_mode(ae, S_IFDIR | 0777); - assert(0 == archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); archive_entry_free(ae); - assert(0 == archive_write_finish_entry(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); /* Make sure they're unchanged. */ - assert(0 == stat("dir_overwrite_0744", &st)); + assertEqualInt(0, stat("dir_overwrite_0744", &st)); failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 0777) == 0744); + assertEqualInt(st.st_mode & 0777, 0744); /* Write a regular file with SUID bit, but don't use _EXTRACT_PERM. */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "file_no_suid"); archive_entry_set_mode(ae, S_IFREG | S_ISUID | 0777); archive_write_disk_set_options(a, 0); - assert(0 == archive_write_header(a, ae)); - assert(0 == archive_write_finish_entry(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); /* Write a regular file with ARCHIVE_EXTRACT_PERM. */ assert(archive_entry_clear(ae) != NULL); archive_entry_copy_pathname(ae, "file_0777"); archive_entry_set_mode(ae, S_IFREG | 0777); archive_write_disk_set_options(a, ARCHIVE_EXTRACT_PERM); - assert(0 == archive_write_header(a, ae)); - assert(0 == archive_write_finish_entry(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); /* Write a regular file with ARCHIVE_EXTRACT_PERM & SUID bit */ assert(archive_entry_clear(ae) != NULL); @@ -223,8 +223,8 @@ DEFINE_TEST(test_write_disk_perms) archive_entry_set_mode(ae, S_IFREG | S_ISUID | 0742); archive_entry_set_uid(ae, getuid()); archive_write_disk_set_options(a, ARCHIVE_EXTRACT_PERM); - assert(0 == archive_write_header(a, ae)); - assert(0 == archive_write_finish_entry(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); /* * Write a regular file with ARCHIVE_EXTRACT_PERM & SUID bit, @@ -265,7 +265,7 @@ DEFINE_TEST(test_write_disk_perms) archive_entry_set_mode(ae, S_IFREG | S_ISGID | 0742); archive_entry_set_gid(ae, defaultgid()); archive_write_disk_set_options(a, ARCHIVE_EXTRACT_PERM); - assert(0 == archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); failure("Setting SGID bit should succeed here."); assertEqualIntA(a, 0, archive_write_finish_entry(a)); @@ -303,7 +303,7 @@ DEFINE_TEST(test_write_disk_perms) archive_entry_set_uid(ae, getuid()); archive_entry_set_gid(ae, altgid()); archive_write_disk_set_options(a, ARCHIVE_EXTRACT_PERM); - assert(0 == archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); failure("Setting SGID bit should fail because of group mismatch but the failure should be silent because we didn't ask for the group to be set."); assertEqualIntA(a, 0, archive_write_finish_entry(a)); @@ -318,7 +318,7 @@ DEFINE_TEST(test_write_disk_perms) archive_entry_set_gid(ae, altgid()); archive_write_disk_set_options(a, ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_OWNER); - assert(0 == archive_write_header(a, ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); failure("Setting SGID bit should succeed here."); assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); } @@ -369,85 +369,85 @@ DEFINE_TEST(test_write_disk_perms) archive_entry_free(ae); /* Test the entries on disk. */ - assert(0 == stat("file_0755", &st)); + assertEqualInt(0, stat("file_0755", &st)); failure("file_0755: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == 0755); + assertEqualInt(st.st_mode & 07777, 0755); - assert(0 == stat("file_overwrite_0144", &st)); + assertEqualInt(0, stat("file_overwrite_0144", &st)); failure("file_overwrite_0144: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == 0144); + assertEqualInt(st.st_mode & 07777, 0144); - assert(0 == stat("dir_0514", &st)); + assertEqualInt(0, stat("dir_0514", &st)); failure("dir_0514: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == 0514); + assertEqualInt(st.st_mode & 07777, 0514); - assert(0 == stat("dir_overwrite_0744", &st)); + assertEqualInt(0, stat("dir_overwrite_0744", &st)); failure("dir_overwrite_0744: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 0777) == 0744); + assertEqualInt(st.st_mode & 0777, 0744); - assert(0 == stat("file_no_suid", &st)); + assertEqualInt(0, stat("file_no_suid", &st)); failure("file_0755: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == 0755); + assertEqualInt(st.st_mode & 07777, 0755); - assert(0 == stat("file_0777", &st)); + assertEqualInt(0, stat("file_0777", &st)); failure("file_0777: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == 0777); + assertEqualInt(st.st_mode & 07777, 0777); /* SUID bit should get set here. */ - assert(0 == stat("file_4742", &st)); + assertEqualInt(0, stat("file_4742", &st)); failure("file_4742: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == (S_ISUID | 0742)); + assertEqualInt(st.st_mode & 07777, S_ISUID | 0742); /* SUID bit should NOT have been set here. */ - assert(0 == stat("file_bad_suid", &st)); + assertEqualInt(0, stat("file_bad_suid", &st)); failure("file_bad_suid: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == (0742)); + assertEqualInt(st.st_mode & 07777, 0742); /* Some things don't fail if you're root, so suppress this. */ if (getuid() != 0) { /* SUID bit should NOT have been set here. */ - assert(0 == stat("file_bad_suid2", &st)); + assertEqualInt(0, stat("file_bad_suid2", &st)); failure("file_bad_suid2: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == (0742)); + assertEqualInt(st.st_mode & 07777, 0742); } /* SGID should be set here. */ - assert(0 == stat("file_perm_sgid", &st)); + assertEqualInt(0, stat("file_perm_sgid", &st)); failure("file_perm_sgid: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == (S_ISGID | 0742)); + assertEqualInt(st.st_mode & 07777, S_ISGID | 0742); if (altgid() != -1) { /* SGID should not be set here. */ - assert(0 == stat("file_alt_sgid", &st)); + assertEqualInt(0, stat("file_alt_sgid", &st)); failure("file_alt_sgid: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == (0742)); + assertEqualInt(st.st_mode & 07777, 0742); /* SGID should be set here. */ - assert(0 == stat("file_alt_sgid_owner", &st)); + assertEqualInt(0, stat("file_alt_sgid_owner", &st)); failure("file_alt_sgid: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == (S_ISGID | 0742)); + assertEqualInt(st.st_mode & 07777, S_ISGID | 0742); } if (invalidgid() != -1) { /* SGID should NOT be set here. */ - assert(0 == stat("file_bad_sgid", &st)); + assertEqualInt(0, stat("file_bad_sgid", &st)); failure("file_bad_sgid: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == (0742)); + assertEqualInt(st.st_mode & 07777, 0742); /* SGID should NOT be set here. */ - assert(0 == stat("file_bad_sgid2", &st)); + assertEqualInt(0, stat("file_bad_sgid2", &st)); failure("file_bad_sgid2: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == (0742)); + assertEqualInt(st.st_mode & 07777, 0742); } if (getuid() != 0) { - assert(0 == stat("file_bad_owner", &st)); + assertEqualInt(0, stat("file_bad_owner", &st)); failure("file_bad_owner: st.st_mode=%o", st.st_mode); - assert((st.st_mode & 07777) == (0744)); + assertEqualInt(st.st_mode & 07777, 0744); failure("file_bad_owner: st.st_uid=%d getuid()=%d", st.st_uid, getuid()); /* The entry had getuid()+1, but because we're * not root, we should not have been able to set that. */ - assert(st.st_uid == getuid()); + assertEqualInt(st.st_uid, getuid()); } #endif } diff --git a/libarchive/test/test_write_disk_secure.c b/libarchive/test/test_write_disk_secure.c index 31c5bfd7c4b3..7cd66c41ac4e 100644 --- a/libarchive/test/test_write_disk_secure.c +++ b/libarchive/test/test_write_disk_secure.c @@ -84,6 +84,27 @@ DEFINE_TEST(test_write_disk_secure) archive_entry_free(ae); assert(0 == archive_write_finish_entry(a)); + /* Write an absolute symlink to /tmp. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_symlink"); + archive_entry_set_mode(ae, S_IFLNK | 0777); + archive_entry_set_symlink(ae, "/tmp"); + archive_write_disk_set_options(a, 0); + assert(0 == archive_write_header(a, ae)); + assert(0 == archive_write_finish_entry(a)); + + /* With security checks enabled, this should fail. */ + assert(archive_entry_clear(ae) != NULL); + archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_symlink/libarchive_test-test_write_disk_secure-absolute_symlink_path.tmp"); + archive_entry_set_mode(ae, S_IFREG | 0777); + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS); + failure("Extracting a file through an absolute symlink should fail here."); + assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); + archive_entry_free(ae); + assertFileNotExists("/tmp/libarchive_test-test_write_disk_secure-absolute_symlink/libarchive_test-test_write_disk_secure-absolute_symlink_path.tmp"); + assert(0 == unlink("/tmp/libarchive_test-test_write_disk_secure-absolute_symlink")); + unlink("/tmp/libarchive_test-test_write_disk_secure-absolute_symlink_path.tmp"); + /* Create another link. */ assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, "link_to_dir2"); @@ -105,6 +126,25 @@ DEFINE_TEST(test_write_disk_secure) archive_entry_free(ae); assert(0 == archive_write_finish_entry(a)); + /* Create a nested symlink. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir/nested_link_to_dir"); + archive_entry_set_mode(ae, S_IFLNK | 0777); + archive_entry_set_symlink(ae, "../dir"); + archive_write_disk_set_options(a, 0); + assert(0 == archive_write_header(a, ae)); + assert(0 == archive_write_finish_entry(a)); + + /* But with security checks enabled, this should fail. */ + assert(archive_entry_clear(ae) != NULL); + archive_entry_copy_pathname(ae, "dir/nested_link_to_dir/filed"); + archive_entry_set_mode(ae, S_IFREG | 0777); + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_SYMLINKS); + failure("Extracting a file through a symlink should fail here."); + assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); + archive_entry_free(ae); + assert(0 == archive_write_finish_entry(a)); + /* * Without security checks, extracting a dir over a link to a * dir should follow the link. @@ -178,6 +218,29 @@ DEFINE_TEST(test_write_disk_secure) assert(S_ISDIR(st.st_mode)); archive_entry_free(ae); + /* + * Without security checks, we should be able to + * extract an absolute path. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); + archive_entry_set_mode(ae, S_IFREG | 0777); + assert(0 == archive_write_header(a, ae)); + assert(0 == archive_write_finish_entry(a)); + assertFileExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); + assert(0 == unlink("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp")); + + /* But with security checks enabled, this should fail. */ + assert(archive_entry_clear(ae) != NULL); + archive_entry_copy_pathname(ae, "/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); + archive_entry_set_mode(ae, S_IFREG | 0777); + archive_write_disk_set_options(a, ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS); + failure("Extracting an absolute path should fail here."); + assertEqualInt(ARCHIVE_FAILED, archive_write_header(a, ae)); + archive_entry_free(ae); + assert(0 == archive_write_finish_entry(a)); + assertFileNotExists("/tmp/libarchive_test-test_write_disk_secure-absolute_path.tmp"); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); /* Test the entries on disk. */ @@ -211,5 +274,8 @@ DEFINE_TEST(test_write_disk_secure) assert(S_ISREG(st.st_mode)); failure("link_to_dir2/filec: st.st_mode=%o", st.st_mode); assert((st.st_mode & 07777) == 0755); + + failure("dir/filed: This file should not have been created"); + assert(0 != lstat("dir/filed", &st)); #endif } diff --git a/libarchive/test/test_write_filter_lz4.c b/libarchive/test/test_write_filter_lz4.c new file mode 100644 index 000000000000..a04369841709 --- /dev/null +++ b/libarchive/test/test_write_filter_lz4.c @@ -0,0 +1,409 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * 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" +__FBSDID("$FreeBSD$"); + +/* + * A basic exercise of lz4 reading and writing. + */ + +DEFINE_TEST(test_write_filter_lz4) +{ + struct archive_entry *ae; + struct archive* a; + char *buff, *data; + size_t buffsize, datasize; + char path[16]; + size_t used1, used2; + int i, r, use_prog = 0, filecount; + + assert((a = archive_write_new()) != NULL); + r = archive_write_add_filter_lz4(a); + if (archive_liblz4_version() == NULL) { + if (!canLz4()) { + skipping("lz4 writing not supported on this platform"); + assertEqualInt(ARCHIVE_WARN, r); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + return; + } else { + assertEqualInt(ARCHIVE_WARN, r); + use_prog = 1; + } + } else { + assertEqualInt(ARCHIVE_OK, r); + } + + buffsize = 2000000; + assert(NULL != (buff = (char *)malloc(buffsize))); + + datasize = 10000; + assert(NULL != (data = (char *)calloc(1, datasize))); + filecount = 10; + + /* + * Write a filecount files and read them all back. + */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a)); + assertEqualIntA(a, (use_prog)?ARCHIVE_WARN:ARCHIVE_OK, + archive_write_add_filter_lz4(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_bytes_per_block(a, 1024)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_bytes_in_last_block(a, 1024)); + assertEqualInt(ARCHIVE_FILTER_LZ4, archive_filter_code(a, 0)); + assertEqualString("lz4", archive_filter_name(a, 0)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used1)); + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_filetype(ae, AE_IFREG); + archive_entry_set_size(ae, datasize); + for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + archive_entry_copy_pathname(ae, path); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + assertA(datasize + == (size_t)archive_write_data(a, data, datasize)); + } + archive_entry_free(ae); + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + r = archive_read_support_filter_lz4(a); + if (r == ARCHIVE_WARN) { + skipping("Can't verify lz4 writing by reading back;" + " lz4 reading not fully supported on this platform"); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + return; + } + + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, buff, used1)); + for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + if (!assertEqualInt(ARCHIVE_OK, + archive_read_next_header(a, &ae))) + break; + assertEqualString(path, archive_entry_pathname(ae)); + assertEqualInt((int)datasize, archive_entry_size(ae)); + } + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* + * Repeat the cycle again, this time setting some compression + * options. + */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_bytes_per_block(a, 10)); + assertEqualIntA(a, (use_prog)?ARCHIVE_WARN:ARCHIVE_OK, + archive_write_add_filter_lz4(a)); + assertEqualIntA(a, ARCHIVE_FAILED, + archive_write_set_options(a, "lz4:nonexistent-option=0")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "lz4:compression-level=1")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_filter_option(a, NULL, "compression-level", "9")); + assertEqualIntA(a, ARCHIVE_FAILED, + archive_write_set_filter_option(a, NULL, "compression-level", "abc")); + assertEqualIntA(a, ARCHIVE_FAILED, + archive_write_set_filter_option(a, NULL, "compression-level", "99")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "lz4:compression-level=9")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used2)); + for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, path); + archive_entry_set_size(ae, datasize); + archive_entry_set_filetype(ae, AE_IFREG); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + assertA(datasize == (size_t)archive_write_data( + a, data, datasize)); + archive_entry_free(ae); + } + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + failure("compression-level=9 wrote %d bytes, default wrote %d bytes", + (int)used2, (int)used1); + assert(used2 < used1); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + r = archive_read_support_filter_lz4(a); + if (r != ARCHIVE_OK && !use_prog) { + skipping("lz4 reading not fully supported on this platform"); + } else { + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, buff, used2)); + for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + if (!assertEqualInt(ARCHIVE_OK, + archive_read_next_header(a, &ae))) + break; + assertEqualString(path, archive_entry_pathname(ae)); + assertEqualInt((int)datasize, archive_entry_size(ae)); + } + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + } + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* + * Repeat again, with much lower compression. + */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_bytes_per_block(a, 10)); + assertEqualIntA(a, (use_prog)?ARCHIVE_WARN:ARCHIVE_OK, + archive_write_add_filter_lz4(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_filter_option(a, NULL, "compression-level", "1")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used2)); + for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, path); + archive_entry_set_size(ae, datasize); + archive_entry_set_filetype(ae, AE_IFREG); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + failure("Writing file %s", path); + assertEqualIntA(a, datasize, + (size_t)archive_write_data(a, data, datasize)); + archive_entry_free(ae); + } + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + +#if 0 + failure("Compression-level=1 wrote %d bytes; default wrote %d bytes", + (int)used2, (int)used1); + assert(used2 > used1); +#endif + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + r = archive_read_support_filter_lz4(a); + if (r == ARCHIVE_WARN) { + skipping("lz4 reading not fully supported on this platform"); + } else { + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, buff, used2)); + for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + if (!assertEqualInt(ARCHIVE_OK, + archive_read_next_header(a, &ae))) + break; + assertEqualString(path, archive_entry_pathname(ae)); + assertEqualInt((int)datasize, archive_entry_size(ae)); + } + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + } + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* + * Test various premature shutdown scenarios to make sure we + * don't crash or leak memory. + */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, (use_prog)?ARCHIVE_WARN:ARCHIVE_OK, + archive_write_add_filter_lz4(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, (use_prog)?ARCHIVE_WARN:ARCHIVE_OK, + archive_write_add_filter_lz4(a)); + assertEqualInt(ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a)); + assertEqualIntA(a, (use_prog)?ARCHIVE_WARN:ARCHIVE_OK, + archive_write_add_filter_lz4(a)); + assertEqualInt(ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a)); + assertEqualIntA(a, (use_prog)?ARCHIVE_WARN:ARCHIVE_OK, + archive_write_add_filter_lz4(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used2)); + assertEqualInt(ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* + * Clean up. + */ + free(data); + free(buff); +} + +static void +test_options(const char *options) +{ + struct archive_entry *ae; + struct archive* a; + char *buff, *data; + size_t buffsize, datasize; + char path[16]; + size_t used1; + int i, r, use_prog = 0, filecount; + + assert((a = archive_write_new()) != NULL); + r = archive_write_add_filter_lz4(a); + if (archive_liblz4_version() == NULL) { + if (!canLz4()) { + skipping("lz4 writing not supported on this platform"); + assertEqualInt(ARCHIVE_WARN, r); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + return; + } else { + assertEqualInt(ARCHIVE_WARN, r); + use_prog = 1; + } + } else { + assertEqualInt(ARCHIVE_OK, r); + } + + buffsize = 2000000; + assert(NULL != (buff = (char *)malloc(buffsize))); + + datasize = 10000; + assert(NULL != (data = (char *)calloc(1, datasize))); + filecount = 10; + + /* + * Write a filecount files and read them all back. + */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a)); + assertEqualIntA(a, (use_prog)?ARCHIVE_WARN:ARCHIVE_OK, + archive_write_add_filter_lz4(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, options)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_bytes_per_block(a, 1024)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_bytes_in_last_block(a, 1024)); + assertEqualInt(ARCHIVE_FILTER_LZ4, archive_filter_code(a, 0)); + assertEqualString("lz4", archive_filter_name(a, 0)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used1)); + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_filetype(ae, AE_IFREG); + archive_entry_set_size(ae, datasize); + for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + archive_entry_copy_pathname(ae, path); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + assertA(datasize + == (size_t)archive_write_data(a, data, datasize)); + } + archive_entry_free(ae); + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + r = archive_read_support_filter_lz4(a); + if (r == ARCHIVE_WARN) { + skipping("Can't verify lz4 writing by reading back;" + " lz4 reading not fully supported on this platform"); + } else { + assertEqualIntA(a, ARCHIVE_OK, + archive_read_open_memory(a, buff, used1)); + for (i = 0; i < filecount; i++) { + sprintf(path, "file%03d", i); + if (!assertEqualInt(ARCHIVE_OK, + archive_read_next_header(a, &ae))) + break; + assertEqualString(path, archive_entry_pathname(ae)); + assertEqualInt((int)datasize, archive_entry_size(ae)); + } + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + } + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* + * Clean up. + */ + free(data); + free(buff); +} + +DEFINE_TEST(test_write_filter_lz4_disable_stream_checksum) +{ + test_options("lz4:!stream-checksum"); +} + +DEFINE_TEST(test_write_filter_lz4_enable_block_checksum) +{ + test_options("lz4:block-checksum"); +} + +DEFINE_TEST(test_write_filter_lz4_block_size_4) +{ + test_options("lz4:block-size=4"); +} + +DEFINE_TEST(test_write_filter_lz4_block_size_5) +{ + test_options("lz4:block-size=5"); +} + +DEFINE_TEST(test_write_filter_lz4_block_size_6) +{ + test_options("lz4:block-size=6"); +} + +DEFINE_TEST(test_write_filter_lz4_block_dependence) +{ + test_options("lz4:block-dependence"); +} + +/* + * TODO: Figure out how to correctly handle this. + * + * This option simply fails on some versions of the LZ4 libraries. + */ +/* +XXXDEFINE_TEST(test_write_filter_lz4_block_dependence_hc) +{ + test_options("lz4:block-dependence,lz4:compression-level=9"); +} +*/ diff --git a/libarchive/test/test_write_filter_lzop.c b/libarchive/test/test_write_filter_lzop.c index 9e840bd5cae6..a32932c69773 100644 --- a/libarchive/test/test_write_filter_lzop.c +++ b/libarchive/test/test_write_filter_lzop.c @@ -39,7 +39,7 @@ DEFINE_TEST(test_write_filter_lzop) size_t buffsize, datasize; char path[16]; size_t used1, used2; - int i, r, use_prog = 0; + int i, r, use_prog = 0, filecount; assert((a = archive_write_new()) != NULL); r = archive_write_add_filter_lzop(a); @@ -58,9 +58,10 @@ DEFINE_TEST(test_write_filter_lzop) datasize = 10000; assert(NULL != (data = (char *)calloc(1, datasize))); + filecount = 10; /* - * Write a 100 files and read them all back. + * Write a filecount files and read them all back. */ assert((a = archive_write_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_ustar(a)); @@ -77,7 +78,7 @@ DEFINE_TEST(test_write_filter_lzop) assert((ae = archive_entry_new()) != NULL); archive_entry_set_filetype(ae, AE_IFREG); archive_entry_set_size(ae, datasize); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); archive_entry_copy_pathname(ae, path); assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); @@ -97,7 +98,7 @@ DEFINE_TEST(test_write_filter_lzop) } else { assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used1)); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) @@ -133,7 +134,7 @@ DEFINE_TEST(test_write_filter_lzop) archive_write_set_options(a, "lzop:compression-level=9")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); @@ -161,7 +162,7 @@ DEFINE_TEST(test_write_filter_lzop) archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) @@ -186,7 +187,7 @@ DEFINE_TEST(test_write_filter_lzop) archive_write_set_filter_option(a, NULL, "compression-level", "1")); assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used2)); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); assert((ae = archive_entry_new()) != NULL); archive_entry_copy_pathname(ae, path); @@ -216,7 +217,7 @@ DEFINE_TEST(test_write_filter_lzop) } else { assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used2)); - for (i = 0; i < 100; i++) { + for (i = 0; i < filecount; i++) { sprintf(path, "file%03d", i); if (!assertEqualInt(ARCHIVE_OK, archive_read_next_header(a, &ae))) diff --git a/libarchive/test/test_write_filter_program.c b/libarchive/test/test_write_filter_program.c index c156b6d55d1e..9fe264c018dc 100644 --- a/libarchive/test/test_write_filter_program.c +++ b/libarchive/test/test_write_filter_program.c @@ -26,8 +26,8 @@ #include "test.h" __FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_compress_program.c 201247 2009-12-30 05:59:21Z kientzle $"); -char buff[1000000]; -char buff2[64]; +static char buff[1000000]; +static char buff2[64]; DEFINE_TEST(test_write_filter_program) { diff --git a/libarchive/test/test_write_format_ar.c b/libarchive/test/test_write_format_ar.c index 5db75871c75c..058d3b17875c 100644 --- a/libarchive/test/test_write_format_ar.c +++ b/libarchive/test/test_write_format_ar.c @@ -28,8 +28,8 @@ #include "test.h" __FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_ar.c 189308 2009-03-03 17:02:51Z kientzle $"); -char buff[4096]; -char buff2[64]; +static char buff[4096]; +static char buff2[64]; static char strtab[] = "abcdefghijklmn.o/\nggghhhjjjrrrttt.o/\niiijjjdddsssppp.o/\n"; DEFINE_TEST(test_write_format_ar) diff --git a/libarchive/test/test_write_format_cpio_newc.c b/libarchive/test/test_write_format_cpio_newc.c index 3bbc173017f9..48b0b2646472 100644 --- a/libarchive/test/test_write_format_cpio_newc.c +++ b/libarchive/test/test_write_format_cpio_newc.c @@ -30,7 +30,7 @@ static int is_hex(const char *p, size_t l) { while (l > 0) { - if (*p >= 0 && *p <= '9') { + if (*p >= '0' && *p <= '9') { /* Ascii digit */ } else if (*p >= 'a' && *p <= 'f') { /* lowercase letter a-f */ diff --git a/libarchive/test/test_write_format_gnutar.c b/libarchive/test/test_write_format_gnutar.c index 67f5a107cb4c..2a4c383e7aff 100644 --- a/libarchive/test/test_write_format_gnutar.c +++ b/libarchive/test/test_write_format_gnutar.c @@ -25,7 +25,7 @@ #include "test.h" __FBSDID("$FreeBSD$"); -char buff2[64]; +static char buff2[64]; /* Some names 1026 characters long */ static const char *longfilename = "abcdefghijklmnopqrstuvwxyz" @@ -159,6 +159,19 @@ DEFINE_TEST(test_write_format_gnutar) assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); archive_entry_free(ae); + /* + * A file with large UID/GID that overflow octal encoding. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "large_uid_gid"); + archive_entry_set_mode(ae, S_IFREG | 0755); + archive_entry_set_size(ae, 8); + archive_entry_set_uid(ae, 123456789); + archive_entry_set_gid(ae, 987654321); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, 8, archive_write_data(a, "abcdefgh", 9)); + /* TODO: support GNU tar sparse format and test it here. */ /* See test_write_format_pax for an example of testing sparse files. */ @@ -173,7 +186,7 @@ DEFINE_TEST(test_write_format_gnutar) /* Verify GNU tar magic/version fields */ assertEqualMem(buff + 257, "ustar \0", 8); - assertEqualInt(14336, used); + assertEqualInt(15360, used); /* * @@ -225,6 +238,15 @@ DEFINE_TEST(test_write_format_gnutar) assertEqualString(longfilename, archive_entry_symlink(ae)); assertEqualInt(AE_IFLNK | 0755, archive_entry_mode(ae)); + /* + * Read file with large UID/GID. + */ + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualInt(123456789, archive_entry_uid(ae)); + assertEqualInt(987654321, archive_entry_gid(ae)); + assertEqualString("large_uid_gid", archive_entry_pathname(ae)); + assertEqualInt(S_IFREG | 0755, archive_entry_mode(ae)); + /* * Verify the end of the archive. */ diff --git a/libarchive/test/test_write_format_iso9660.c b/libarchive/test/test_write_format_iso9660.c index 9c5a005fd131..1ea69a183595 100644 --- a/libarchive/test/test_write_format_iso9660.c +++ b/libarchive/test/test_write_format_iso9660.c @@ -26,7 +26,7 @@ #include "test.h" __FBSDID("$FreeBSD$"); -char buff2[64]; +static char buff2[64]; DEFINE_TEST(test_write_format_iso9660) { size_t buffsize = 1000000; diff --git a/libarchive/test/test_write_format_iso9660_boot.c b/libarchive/test/test_write_format_iso9660_boot.c index b1f185b9c455..433f633091f7 100644 --- a/libarchive/test/test_write_format_iso9660_boot.c +++ b/libarchive/test/test_write_format_iso9660_boot.c @@ -84,7 +84,7 @@ static const unsigned char el_torito_signature[] = { "IN PRIMARY VOLUME DESCRIPTOR FOR CONTACT INFORMATION." }; -char buff2[1024]; +static char buff2[1024]; static void _test_write_format_iso9660_boot(int write_info_tbl) diff --git a/libarchive/test/test_write_format_mtree.c b/libarchive/test/test_write_format_mtree.c index c886709bf19c..5109e0920b4d 100644 --- a/libarchive/test/test_write_format_mtree.c +++ b/libarchive/test/test_write_format_mtree.c @@ -48,6 +48,26 @@ static struct { { "./subdir3/mtree", S_IFREG | 0664, 1232266273, 1003, 1003 }, { NULL, 0, 0, 0, 0 } }; +static struct { + const char *path; + mode_t mode; + time_t mtime; + uid_t uid; + gid_t gid; +} entries2[] = { + { "COPYING", S_IFREG | 0644, 1231975636, 1001, 1001 }, + { "Makefile", S_IFREG | 0644, 1233041050, 1001, 1001 }, + { "NEWS", S_IFREG | 0644, 1231975636, 1001, 1001 }, + { "PROJECTS", S_IFREG | 0644, 1231975636, 1001, 1001 }, + { "README", S_IFREG | 0644, 1231975636, 1001, 1001 }, + { "subdir", S_IFDIR | 0755, 1233504586, 1001, 1001 }, + { "subdir/README", S_IFREG | 0664, 1231975636, 1002, 1001 }, + { "subdir/config", S_IFREG | 0664, 1232266273, 1003, 1003 }, + { "subdir2", S_IFDIR | 0755, 1233504586, 1001, 1001 }, + { "subdir3", S_IFDIR | 0755, 1233504586, 1001, 1001 }, + { "subdir3/mtree", S_IFREG | 0664, 1232266273, 1003, 1003 }, + { NULL, 0, 0, 0, 0 } +}; static void test_write_format_mtree_sub(int use_set, int dironly) @@ -136,6 +156,97 @@ test_write_format_mtree_sub(int use_set, int dironly) assertEqualInt(ARCHIVE_OK, archive_read_free(a)); } +static void +test_write_format_mtree_sub2(int use_set, int dironly) +{ + struct archive_entry *ae; + struct archive* a; + size_t used; + int i; + char str[32]; + + /* Create a mtree format archive. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_mtree(a)); + if (use_set) + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_option(a, NULL, "use-set", "1")); + if (dironly) + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_option(a, NULL, "dironly", "1")); + assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff)-1, &used)); + + /* Write entries2 */ + for (i = 0; entries2[i].path != NULL; i++) { + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, entries2[i].mtime, 0); + assert(entries2[i].mtime == archive_entry_mtime(ae)); + archive_entry_set_mode(ae, entries2[i].mode); + assert(entries2[i].mode == archive_entry_mode(ae)); + archive_entry_set_uid(ae, entries2[i].uid); + assert(entries2[i].uid == archive_entry_uid(ae)); + archive_entry_set_gid(ae, entries2[i].gid); + assert(entries2[i].gid == archive_entry_gid(ae)); + archive_entry_copy_pathname(ae, entries2[i].path); + if ((entries2[i].mode & AE_IFMT) != S_IFDIR) + archive_entry_set_size(ae, 8); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + if ((entries2[i].mode & AE_IFMT) != S_IFDIR) + assertEqualIntA(a, 8, + archive_write_data(a, "Hello012", 15)); + archive_entry_free(ae); + } + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + if (use_set) { + const char *p; + + buff[used] = '\0'; + assert(NULL != (p = strstr(buff, "\n/set "))); + if (p != NULL) { + char *r; + const char *o; + p++; + r = strchr(p, '\n'); + if (r != NULL) + *r = '\0'; + if (dironly) + o = "/set type=dir uid=1001 gid=1001 mode=755"; + else + o = "/set type=file uid=1001 gid=1001 mode=644"; + assertEqualString(o, p); + if (r != NULL) + *r = '\n'; + } + } + + /* + * Read the data and check it. + */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + + /* Read entries2 */ + memset(str, 0, sizeof(str)); + strcpy(str, "./"); + for (i = 0; entries2[i].path != NULL; i++) { + if (dironly && (entries2[i].mode & AE_IFMT) != S_IFDIR) + continue; + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(entries2[i].mtime, archive_entry_mtime(ae)); + assertEqualInt(entries2[i].mode, archive_entry_mode(ae)); + assertEqualInt(entries2[i].uid, archive_entry_uid(ae)); + assertEqualInt(entries2[i].gid, archive_entry_gid(ae)); + strcpy(str + 2, entries2[i].path); + assertEqualString(str, archive_entry_pathname(ae)); + if ((entries2[i].mode & AE_IFMT) != S_IFDIR) + assertEqualInt(8, archive_entry_size(ae)); + } + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + DEFINE_TEST(test_write_format_mtree) { /* Default setting */ @@ -147,3 +258,15 @@ DEFINE_TEST(test_write_format_mtree) /* Use /set keyword with directory only */ test_write_format_mtree_sub(1, 1); } + +DEFINE_TEST(test_write_format_mtree_no_leading_dotslash) +{ + /* Default setting */ + test_write_format_mtree_sub2(0, 0); + /* Directory only */ + test_write_format_mtree_sub2(0, 1); + /* Use /set keyword */ + test_write_format_mtree_sub2(1, 0); + /* Use /set keyword with directory only */ + test_write_format_mtree_sub2(1, 1); +} diff --git a/libarchive/test/test_write_format_pax.c b/libarchive/test/test_write_format_pax.c index d29e9adcd867..1bae0050f081 100644 --- a/libarchive/test/test_write_format_pax.c +++ b/libarchive/test/test_write_format_pax.c @@ -25,7 +25,7 @@ #include "test.h" __FBSDID("$FreeBSD$"); -char buff2[64]; +static char buff2[64]; DEFINE_TEST(test_write_format_pax) { diff --git a/libarchive/test/test_write_format_raw.c b/libarchive/test/test_write_format_raw.c new file mode 100644 index 000000000000..bd887ff86c94 --- /dev/null +++ b/libarchive/test/test_write_format_raw.c @@ -0,0 +1,123 @@ +/*- + * Copyright (c) 2013 Marek Kubica + * 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" + +static void +test_format(int (*set_format)(struct archive *)) +{ + char filedata[64]; + struct archive_entry *ae; + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + const char *err; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, (*set_format)(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used)); + + /* + * Write a file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_pathname(ae, "test"); + archive_entry_set_filetype(ae, AE_IFREG); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, 9, archive_write_data(a, "12345678", 9)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* + * Read from it. + */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_raw(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualIntA(a, 9, archive_read_data(a, filedata, 10)); + assertEqualMem(filedata, "12345678", 9); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* Create a new archive */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, (*set_format)(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used)); + + /* write first file: that should succeed */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_pathname(ae, "test"); + archive_entry_set_filetype(ae, AE_IFREG); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, 9, archive_write_data(a, "12345678", 9)); + + /* write second file: this should fail */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_pathname(ae, "test2"); + archive_entry_set_filetype(ae, AE_IFREG); + assertEqualIntA(a, ARCHIVE_FATAL, archive_write_header(a, ae)); + err = archive_error_string(a); + assertEqualMem(err, "Raw format only supports one entry per archive", 47); + archive_entry_free(ae); + + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* Create a new archive */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, (*set_format)(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used)); + + /* write a directory: this should fail */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir"); + archive_entry_set_filetype(ae, AE_IFDIR); + archive_entry_set_size(ae, 512); + assertEqualIntA(a, ARCHIVE_FATAL, archive_write_header(a, ae)); + err = archive_error_string(a); + assertEqualMem(err, "Raw format only supports filetype AE_IFREG", 43); + archive_entry_free(ae); + + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + free(buff); +} + +DEFINE_TEST(test_write_format_raw) +{ + test_format(archive_write_set_format_raw); +} diff --git a/libarchive/test/test_write_format_raw_b64.c b/libarchive/test/test_write_format_raw_b64.c new file mode 100644 index 000000000000..f8f67287edb2 --- /dev/null +++ b/libarchive/test/test_write_format_raw_b64.c @@ -0,0 +1,77 @@ +/*- + * Copyright (c) 2013 Marek Kubica + * 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" + +static void +test_format(int (*set_format)(struct archive *)) +{ + char filedata[64]; + struct archive_entry *ae; + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, (*set_format)(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_b64encode(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, buffsize, &used)); + + /* + * Write a file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_pathname(ae, "test"); + archive_entry_set_filetype(ae, AE_IFREG); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, 9, archive_write_data(a, "12345678", 9)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* + * Read from it. + */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_raw(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualIntA(a, 37, archive_read_data(a, filedata, 64)); + assertEqualMem(filedata, "begin-base64 644 -\nMTIzNDU2NzgA\n====\n", 37); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + free(buff); +} + +DEFINE_TEST(test_write_format_raw_b64) +{ + test_format(archive_write_set_format_raw); +} diff --git a/libarchive/test/test_write_format_tar.c b/libarchive/test/test_write_format_tar.c index 7d16bbfc6ec3..3588e8fe2d94 100644 --- a/libarchive/test/test_write_format_tar.c +++ b/libarchive/test/test_write_format_tar.c @@ -25,8 +25,8 @@ #include "test.h" __FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_tar.c 189308 2009-03-03 17:02:51Z kientzle $"); -char buff[1000000]; -char buff2[64]; +static char buff[1000000]; +static char buff2[64]; DEFINE_TEST(test_write_format_tar) { diff --git a/libarchive/test/test_write_format_tar_sparse.c b/libarchive/test/test_write_format_tar_sparse.c index c8e0f479779e..cc725a9a72ea 100644 --- a/libarchive/test/test_write_format_tar_sparse.c +++ b/libarchive/test/test_write_format_tar_sparse.c @@ -26,7 +26,7 @@ #include "test.h" __FBSDID("$FreeBSD$"); -char buff[1000000]; +static char buff[1000000]; static void test_1(void) diff --git a/libarchive/test/test_write_format_warc.c b/libarchive/test/test_write_format_warc.c new file mode 100644 index 000000000000..60d1898fa168 --- /dev/null +++ b/libarchive/test/test_write_format_warc.c @@ -0,0 +1,132 @@ +/*- + * Copyright (C) 2014 Sebastian Freundt + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_write_format_warc) +{ + char filedata[64]; + struct archive *a; + struct archive_entry *ae; + const size_t bsiz = 2048U; + char *buff; + size_t used; + + buff = malloc(bsiz); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_warc(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, bsiz, &used)); + + /* + * Write a file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_pathname(ae, "test"); + archive_entry_set_filetype(ae, AE_IFREG); + archive_entry_set_size(ae, 9); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, 9, archive_write_data(a, "12345678", 9)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* + * Read from it. + */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_warc(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualIntA(a, 9, archive_read_data(a, filedata, 10)); + assertEqualMem(filedata, "12345678", 9); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* Create a new archive */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_warc(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, bsiz, &used)); + + /* write first file: that should succeed */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_pathname(ae, "test"); + archive_entry_set_filetype(ae, AE_IFREG); + archive_entry_set_size(ae, 9); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, 9, archive_write_data(a, "12345678", 9)); + + /* write second file: should succeed as well */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_pathname(ae, "test2"); + archive_entry_set_filetype(ae, AE_IFREG); + archive_entry_set_size(ae, 9); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualIntA(a, 9, archive_write_data(a, "12345678", 9)); + + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* Create a new archive */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_warc(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, bsiz, &used)); + + /* write a directory: this should fail */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "dir"); + archive_entry_set_filetype(ae, AE_IFDIR); + archive_entry_set_size(ae, 512); + assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); + archive_entry_free(ae); + + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* test whether last archive is indeed empty */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + + /* Test EOF */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + free(buff); +} diff --git a/libarchive/test/test_write_format_warc_empty.c b/libarchive/test/test_write_format_warc_empty.c new file mode 100644 index 000000000000..0bd31bd7f8cb --- /dev/null +++ b/libarchive/test/test_write_format_warc_empty.c @@ -0,0 +1,117 @@ +/*- + * Copyright (C) 2014 Sebastian Freundt + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_write_format_warc_empty) +{ + struct archive *a; + struct archive_entry *ae; + char buff[512U]; + size_t used; + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_warc(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, sizeof(buff), &used)); + + /* Add "." entry which must be ignored. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_atime(ae, 2, 0); + archive_entry_set_ctime(ae, 4, 0); + archive_entry_set_mtime(ae, 5, 0); + archive_entry_copy_pathname(ae, "."); + archive_entry_set_mode(ae, S_IFDIR | 0755); + assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Add ".." entry which must be ignored. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_atime(ae, 2, 0); + archive_entry_set_ctime(ae, 4, 0); + archive_entry_set_mtime(ae, 5, 0); + archive_entry_copy_pathname(ae, ".."); + archive_entry_set_mode(ae, S_IFDIR | 0755); + assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Add "/" entry which must be ignored. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_atime(ae, 2, 0); + archive_entry_set_ctime(ae, 4, 0); + archive_entry_set_mtime(ae, 5, 0); + archive_entry_copy_pathname(ae, "/"); + archive_entry_set_mode(ae, S_IFDIR | 0755); + assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Add "../" entry which must be ignored. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_atime(ae, 2, 0); + archive_entry_set_ctime(ae, 4, 0); + archive_entry_set_mtime(ae, 5, 0); + archive_entry_copy_pathname(ae, "../"); + archive_entry_set_mode(ae, S_IFDIR | 0755); + assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Add "../../." entry which must be ignored. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_atime(ae, 2, 0); + archive_entry_set_ctime(ae, 4, 0); + archive_entry_set_mtime(ae, 5, 0); + archive_entry_copy_pathname(ae, "../../."); + archive_entry_set_mode(ae, S_IFDIR | 0755); + assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Add "..//.././" entry which must be ignored. */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_atime(ae, 2, 0); + archive_entry_set_ctime(ae, 4, 0); + archive_entry_set_mtime(ae, 5, 0); + archive_entry_copy_pathname(ae, "..//.././"); + archive_entry_set_mode(ae, S_IFDIR | 0755); + assertEqualIntA(a, ARCHIVE_FAILED, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Close out the archive without writing anything. */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* Test whether last archive is empty indeed. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + + /* Test EOF */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} diff --git a/libarchive/test/test_write_format_zip.c b/libarchive/test/test_write_format_zip.c index 53ce3acc8537..a7ca434f8ea9 100644 --- a/libarchive/test/test_write_format_zip.c +++ b/libarchive/test/test_write_format_zip.c @@ -1,6 +1,7 @@ /*- * Copyright (c) 2003-2008 Tim Kientzle * Copyright (c) 2008 Anselm Strauss + * Copyright (c) 2014 Michihiro NAKAJIMA * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -31,128 +32,35 @@ #include "test.h" __FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_zip.c 201247 2009-12-30 05:59:21Z kientzle $"); +/* + * This test doesn't actually check that the zip writer is + * correct, just that our zip reader can read the output of + * our zip writer. We do more detailed checks of the bits + * elsewhere. + */ + +/* + * Write a variety of different file types into the archive. + */ static void -verify_contents(struct archive *a, int expect_details) -{ - char filedata[64]; - struct archive_entry *ae; - - /* - * Read and verify first file. - */ - assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); - assertEqualInt(1, archive_entry_mtime(ae)); - /* Zip doesn't store high-resolution mtime. */ - assertEqualInt(0, archive_entry_mtime_nsec(ae)); - assertEqualInt(0, archive_entry_atime(ae)); - assertEqualInt(0, archive_entry_ctime(ae)); - assertEqualString("file", archive_entry_pathname(ae)); - if (expect_details) { - assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); - assertEqualInt(8, archive_entry_size(ae)); - } else { - assertEqualInt(0, archive_entry_size(ae)); - } - assertEqualIntA(a, 8, - archive_read_data(a, filedata, sizeof(filedata))); - assertEqualMem(filedata, "12345678", 8); - - - /* - * Read the second file back. - */ - assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); - assertEqualInt(1, archive_entry_mtime(ae)); - assertEqualInt(0, archive_entry_mtime_nsec(ae)); - assertEqualInt(0, archive_entry_atime(ae)); - assertEqualInt(0, archive_entry_ctime(ae)); - assertEqualString("file2", archive_entry_pathname(ae)); - if (expect_details) { - assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); - assertEqualInt(4, archive_entry_size(ae)); - } else { - assertEqualInt(0, archive_entry_size(ae)); - } - assertEqualIntA(a, 4, - archive_read_data(a, filedata, sizeof(filedata))); - assertEqualMem(filedata, "1234", 4); - - /* - * Read the third file back. - */ - assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); - assertEqualInt(1, archive_entry_mtime(ae)); - assertEqualInt(0, archive_entry_mtime_nsec(ae)); - assertEqualInt(0, archive_entry_atime(ae)); - assertEqualInt(0, archive_entry_ctime(ae)); - assertEqualString("symlink", archive_entry_pathname(ae)); - if (expect_details) { - assertEqualInt(AE_IFLNK | 0755, archive_entry_mode(ae)); - assertEqualInt(0, archive_entry_size(ae)); - assertEqualString("file1", archive_entry_symlink(ae)); - } else { - assertEqualInt(AE_IFREG | 0666, archive_entry_mode(ae)); - assertEqualInt(0, archive_entry_size(ae)); - } - - /* - * Read the dir entry back. - */ - assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); - assertEqualInt(11, archive_entry_mtime(ae)); - assertEqualInt(0, archive_entry_mtime_nsec(ae)); - assertEqualInt(0, archive_entry_atime(ae)); - assertEqualInt(0, archive_entry_ctime(ae)); - assertEqualString("dir/", archive_entry_pathname(ae)); - if (expect_details) - assertEqualInt(AE_IFDIR | 0755, archive_entry_mode(ae)); - assertEqualInt(0, archive_entry_size(ae)); - assertEqualIntA(a, 0, archive_read_data(a, filedata, 10)); - - /* Verify the end of the archive. */ - 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_write_format_zip) +write_contents(struct archive *a) { struct archive_entry *ae; - struct archive *a; - size_t used; - size_t buffsize = 1000000; - char *buff; - const char *compression_type; - buff = malloc(buffsize); - - /* Create a new archive in memory. */ - assert((a = archive_write_new()) != NULL); - assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); -#ifdef HAVE_ZLIB_H - compression_type = "deflate"; -#else - compression_type = "store"; -#endif - assertEqualIntA(a, ARCHIVE_OK, - archive_write_set_format_option(a, "zip", "compression", compression_type)); - assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); - assertEqualIntA(a, ARCHIVE_OK, - archive_write_open_memory(a, buff, buffsize, &used)); + /* + * First write things with the "default" compression. + * The library will choose "deflate" for most things if it's + * available, else "store". + */ /* * Write a file to it. */ assert((ae = archive_entry_new()) != NULL); archive_entry_set_mtime(ae, 1, 10); - assertEqualInt(1, archive_entry_mtime(ae)); - assertEqualInt(10, archive_entry_mtime_nsec(ae)); archive_entry_copy_pathname(ae, "file"); - assertEqualString("file", archive_entry_pathname(ae)); archive_entry_set_mode(ae, AE_IFREG | 0755); - assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae)); archive_entry_set_size(ae, 8); - assertEqualInt(0, archive_write_header(a, ae)); archive_entry_free(ae); assertEqualInt(8, archive_write_data(a, "12345678", 9)); @@ -163,20 +71,27 @@ DEFINE_TEST(test_write_format_zip) */ assert((ae = archive_entry_new()) != NULL); archive_entry_set_mtime(ae, 1, 10); - assertEqualInt(1, archive_entry_mtime(ae)); - assertEqualInt(10, archive_entry_mtime_nsec(ae)); archive_entry_copy_pathname(ae, "file2"); - assertEqualString("file2", archive_entry_pathname(ae)); archive_entry_set_mode(ae, AE_IFREG | 0755); - assertEqualInt((S_IFREG | 0755), archive_entry_mode(ae)); archive_entry_set_size(ae, 4); - assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); archive_entry_free(ae); - assertEqualInt(4, archive_write_data(a, "1234", 5)); + assertEqualInt(4, archive_write_data(a, "1234", 4)); /* - * Write symbolic like file to it. + * Write a file with an unknown size. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 2, 15); + archive_entry_copy_pathname(ae, "file3"); + archive_entry_set_mode(ae, AE_IFREG | 0621); + archive_entry_unset_size(ae); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(5, archive_write_data(a, "mnopq", 5)); + + /* + * Write symbolic link. */ assert((ae = archive_entry_new()) != NULL); archive_entry_set_mtime(ae, 1, 10); @@ -201,16 +116,450 @@ DEFINE_TEST(test_write_format_zip) archive_entry_copy_pathname(ae, "dir"); archive_entry_set_mode(ae, S_IFDIR | 0755); archive_entry_set_size(ae, 512); - assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); failure("size should be zero so that applications know not to write"); assertEqualInt(0, archive_entry_size(ae)); archive_entry_free(ae); assertEqualIntA(a, 0, archive_write_data(a, "12345678", 9)); + /* + * Force "deflate" compression if the platform supports it. + */ +#ifdef HAVE_ZLIB_H + assertEqualIntA(a, ARCHIVE_OK, archive_write_zip_set_compression_deflate(a)); + + /* + * Write a file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "file_deflate"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, 8); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(8, archive_write_data(a, "12345678", 9)); + assertEqualInt(0, archive_write_data(a, "1", 1)); + + /* + * Write another file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "file2_deflate"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, 4); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(4, archive_write_data(a, "1234", 4)); + + /* + * Write a file with an unknown size. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 2, 15); + archive_entry_copy_pathname(ae, "file3_deflate"); + archive_entry_set_mode(ae, AE_IFREG | 0621); + archive_entry_unset_size(ae); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(5, archive_write_data(a, "ghijk", 5)); + + /* + * Write symbolic like file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "symlink_deflate"); + archive_entry_copy_symlink(ae, "file1"); + archive_entry_set_mode(ae, AE_IFLNK | 0755); + archive_entry_set_size(ae, 4); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* + * Write a directory to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 11, 110); + archive_entry_copy_pathname(ae, "dir_deflate"); + archive_entry_set_mode(ae, S_IFDIR | 0755); + archive_entry_set_size(ae, 512); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + failure("size should be zero so that applications know not to write"); + assertEqualInt(0, archive_entry_size(ae)); + archive_entry_free(ae); + assertEqualIntA(a, 0, archive_write_data(a, "12345678", 9)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); +#endif + + /* + * Now write a bunch of entries with "store" compression. + */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_zip_set_compression_store(a)); + + /* + * Write a file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "file_stored"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, 8); + assertEqualInt(0, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(8, archive_write_data(a, "12345678", 9)); + assertEqualInt(0, archive_write_data(a, "1", 1)); + + /* + * Write another file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "file2_stored"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, 4); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(4, archive_write_data(a, "ACEG", 4)); + + /* + * Write a file with an unknown size. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 2, 15); + archive_entry_copy_pathname(ae, "file3_stored"); + archive_entry_set_mode(ae, AE_IFREG | 0621); + archive_entry_unset_size(ae); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(5, archive_write_data(a, "ijklm", 5)); + + /* + * Write symbolic like file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "symlink_stored"); + archive_entry_copy_symlink(ae, "file1"); + archive_entry_set_mode(ae, AE_IFLNK | 0755); + archive_entry_set_size(ae, 4); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* + * Write a directory to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 11, 110); + archive_entry_copy_pathname(ae, "dir_stored"); + archive_entry_set_mode(ae, S_IFDIR | 0755); + archive_entry_set_size(ae, 512); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + failure("size should be zero so that applications know not to write"); + assertEqualInt(0, archive_entry_size(ae)); + archive_entry_free(ae); + assertEqualIntA(a, 0, archive_write_data(a, "12345678", 9)); + + /* Close out the archive. */ assertEqualInt(ARCHIVE_OK, archive_write_close(a)); assertEqualInt(ARCHIVE_OK, archive_write_free(a)); +} + +/* + * Read back all of the entries and verify their values. + */ +static void +verify_contents(struct archive *a, int seeking, int content) +{ + char filedata[64]; + struct archive_entry *ae; + + /* + * Default compression options: + */ + + /* Read and verify first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + /* Zip doesn't store high-resolution mtime. */ + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file", archive_entry_pathname(ae)); + if (seeking) { + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + } + assert(archive_entry_size_is_set(ae)); + assertEqualInt(8, archive_entry_size(ae)); + if (content) { + assertEqualIntA(a, 8, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "12345678", 8); + } + + /* Read the second file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file2", archive_entry_pathname(ae)); + if (seeking) { + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + } + assertEqualInt(4, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + if (content) { + assertEqualIntA(a, 4, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "1234", 4); + } + + /* Read the third file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file3", archive_entry_pathname(ae)); + if (seeking) { + assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(AE_IFREG | 0621, archive_entry_mode(ae)); + } else { + assertEqualInt(0, archive_entry_size_is_set(ae)); + } + if (content) { + assertEqualIntA(a, 5, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "mnopq", 5); + } + + /* Read symlink. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("symlink", archive_entry_pathname(ae)); + assertEqualInt(AE_IFLNK | 0755, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualString("file1", archive_entry_symlink(ae)); + + /* Read the dir entry back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(11, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("dir/", archive_entry_pathname(ae)); + if (seeking) + assertEqualInt(AE_IFDIR | 0755, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + if (content) { + assertEqualIntA(a, 0, archive_read_data(a, filedata, 10)); + } + +#ifdef HAVE_ZLIB_H + /* + * Deflate compression option: + */ + + /* Read and verify first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + /* Zip doesn't store high-resolution mtime. */ + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file_deflate", archive_entry_pathname(ae)); + if (seeking) + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + assertEqualInt(8, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + if (content) { + assertEqualIntA(a, 8, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "12345678", 8); + } + + + /* Read the second file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file2_deflate", archive_entry_pathname(ae)); + if (seeking) + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + assertEqualInt(4, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + if (content) { + assertEqualIntA(a, 4, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "1234", 4); + } + + /* Read the third file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file3_deflate", archive_entry_pathname(ae)); + if (seeking) { + assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(AE_IFREG | 0621, archive_entry_mode(ae)); + } else { + assertEqualInt(0, archive_entry_size_is_set(ae)); + } + if (content) { + assertEqualIntA(a, 5, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "ghijk", 4); + } + + /* Read symlink. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("symlink_deflate", archive_entry_pathname(ae)); + assertEqualInt(AE_IFLNK | 0755, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualString("file1", archive_entry_symlink(ae)); + + /* Read the dir entry back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(11, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("dir_deflate/", archive_entry_pathname(ae)); + if (seeking) { + assertEqualInt(AE_IFDIR | 0755, archive_entry_mode(ae)); + } + assertEqualInt(0, archive_entry_size(ae)); + if (content) { + assertEqualIntA(a, 0, archive_read_data(a, filedata, 10)); + } +#endif + + /* + * Store compression option: + */ + + /* Read and verify first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + /* Zip doesn't store high-resolution mtime. */ + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file_stored", archive_entry_pathname(ae)); + if (seeking) + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + assert(archive_entry_size_is_set(ae)); + assertEqualInt(8, archive_entry_size(ae)); + if (content) { + assertEqualIntA(a, 8, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "12345678", 8); + } + + + /* Read the second file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file2_stored", archive_entry_pathname(ae)); + if (seeking) + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + assertEqualInt(4, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + if (content) { + assertEqualIntA(a, 4, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "ACEG", 4); + } + + /* Read the third file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file3_stored", archive_entry_pathname(ae)); + if (seeking) { + assertEqualInt(5, archive_entry_size(ae)); + assertEqualInt(AE_IFREG | 0621, archive_entry_mode(ae)); + } else { + assertEqualInt(0, archive_entry_size_is_set(ae)); + } + if (content) { + assertEqualIntA(a, 5, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "ijklm", 4); + } + + /* Read symlink. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("symlink_stored", archive_entry_pathname(ae)); + assertEqualInt(AE_IFLNK | 0755, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualString("file1", archive_entry_symlink(ae)); + + /* Read the dir entry back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(11, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("dir_stored/", archive_entry_pathname(ae)); + if (seeking) + assertEqualInt(AE_IFDIR | 0755, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + if (content) { + assertEqualIntA(a, 0, archive_read_data(a, filedata, 10)); + } + + /* Verify the end of the archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + +/* + * Do a write-then-read roundtrip. + */ +DEFINE_TEST(test_write_format_zip) +{ + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:experimental")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + write_contents(a); + dumpfile("constructed.zip", buff, used); /* * Now, read the data back. @@ -220,7 +569,7 @@ DEFINE_TEST(test_write_format_zip) assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); - verify_contents(a, 1); + verify_contents(a, 1, 1); /* With the test memory reader -- streaming mode. */ assert((a = archive_read_new()) != NULL); @@ -228,14 +577,333 @@ DEFINE_TEST(test_write_format_zip) assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); /* Streaming reader doesn't see mode information from Central Directory. */ - verify_contents(a, 0); + verify_contents(a, 0, 1); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 0); /* With the test memory reader -- seeking mode. */ assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); - verify_contents(a, 1); + verify_contents(a, 1, 1); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 0); + + free(buff); +} + +/* + * Do a write-then-read roundtrip with Zip64 enabled. + */ +DEFINE_TEST(test_write_format_zip64) +{ + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:zip64")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:experimental")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + write_contents(a); + dumpfile("constructed64.zip", buff, used); + + /* + * Now, read the data back. + */ + /* With the standard memory reader. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + verify_contents(a, 1, 1); + + /* With the test memory reader -- streaming mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 1); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 0); + + /* With the test memory reader -- seeking mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 1); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 0); + + free(buff); +} + +DEFINE_TEST(test_write_format_zip_traditional_pkware_encryption) +{ + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + if (ARCHIVE_OK != archive_write_set_options(a, + "zip:encryption=zipcrypt")) { + skipping("This system does not have cryptographic liberary"); + archive_write_free(a); + free(buff); + return; + } + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:experimental")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + write_contents(a); + dumpfile("constructed.zip", buff, used); + + /* + * Now, read the data back. + */ + /* With the standard memory reader. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + verify_contents(a, 1, 1); + + /* With the test memory reader -- streaming mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 1); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 0); + + /* With the test memory reader -- seeking mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 1); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 0); + + free(buff); +} + +DEFINE_TEST(test_write_format_zip_winzip_aes128_encryption) +{ + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + if (ARCHIVE_OK != archive_write_set_options(a, "zip:encryption=aes128")) + { + skipping("This system does not have cryptographic liberary"); + archive_write_free(a); + free(buff); + return; + } + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:experimental")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + write_contents(a); + dumpfile("constructed.zip", buff, used); + + /* + * Now, read the data back. + */ + /* With the standard memory reader. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + verify_contents(a, 1, 1); + + /* With the test memory reader -- streaming mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 1); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 0); + + /* With the test memory reader -- seeking mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 1); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 0); + + free(buff); +} + +DEFINE_TEST(test_write_format_zip_winzip_aes256_encryption) +{ + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + if (ARCHIVE_OK != archive_write_set_options(a, "zip:encryption=aes256")) + { + skipping("This system does not have cryptographic liberary"); + archive_write_free(a); + free(buff); + return; + } + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:experimental")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + write_contents(a); + dumpfile("constructed.zip", buff, used); + + /* + * Now, read the data back. + */ + /* With the standard memory reader. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + verify_contents(a, 1, 1); + + /* With the test memory reader -- streaming mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 1); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 0); + + /* With the test memory reader -- seeking mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 1); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_add_passphrase(a, "password1234")); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 0); free(buff); } diff --git a/libarchive/test/test_write_format_zip_no_compression.c b/libarchive/test/test_write_format_zip_compression_store.c similarity index 64% rename from libarchive/test/test_write_format_zip_no_compression.c rename to libarchive/test/test_write_format_zip_compression_store.c index 9d47f9b746f7..281de1befe26 100644 --- a/libarchive/test/test_write_format_zip_no_compression.c +++ b/libarchive/test/test_write_format_zip_compression_store.c @@ -28,10 +28,26 @@ */ #include "test.h" -__FBSDID("$FreeBSD: head/lib/libarchive/test/test_write_format_zip_no_compression.c 201247 2009-12-30 05:59:21Z kientzle $"); +__FBSDID("$FreeBSD$"); + +/* File data */ +static const char file_name[] = "file"; +static const char file_data1[] = {'1', '2', '3', '4', '5'}; +static const char file_data2[] = {'6', '7', '8', '9', '0'}; +static const int file_perm = 00644; +static const short file_uid = 10; +static const short file_gid = 20; + +/* Folder data */ +static const char folder_name[] = "folder/"; +static const int folder_perm = 00755; +static const short folder_uid = 30; +static const short folder_gid = 40; + +static time_t now; static unsigned long -bitcrc32(unsigned long c, void *_p, size_t s) +bitcrc32(unsigned long c, const void *_p, size_t s) { /* This is a drop-in replacement for crc32() from zlib. * Libarchive should be able to correctly generate @@ -58,51 +74,9 @@ bitcrc32(unsigned long c, void *_p, size_t s) return (c); } -/* Quick and dirty: Read 2-byte and 4-byte integers from Zip file. */ -static int i2(const char *p) { return ((p[0] & 0xff) | ((p[1] & 0xff) << 8)); } -static int i4(const char *p) { return (i2(p) | (i2(p + 2) << 16)); } - -DEFINE_TEST(test_write_format_zip_no_compression) +static void verify_write_uncompressed(struct archive *a) { - /* Buffer data */ - struct archive *a; struct archive_entry *entry; - char buff[100000]; - const char *buffend; - /* p is the pointer to walk over the central directory, - * q walks over the local headers, the data and the data descriptors. */ - const char *p, *q; - size_t used; - - /* File data */ - char file_name[] = "file"; - char file_data1[] = {'1', '2', '3', '4', '5'}; - char file_data2[] = {'6', '7', '8', '9', '0'}; - int file_perm = 00644; - short file_uid = 10; - short file_gid = 20; - - /* Folder data */ - char folder_name[] = "folder/"; - int folder_perm = 00755; - short folder_uid = 30; - short folder_gid = 40; - - /* Time data */ - time_t t = time(NULL); - struct tm *tm = localtime(&t); - - /* Misc variables */ - unsigned long crc; - - /* Create new ZIP archive in memory without padding. */ - assert((a = archive_write_new()) != NULL); - assertA(0 == archive_write_set_format_zip(a)); - assertA(0 == archive_write_set_options(a, "zip:compression=store")); - assertA(0 == archive_write_add_filter_none(a)); - assertA(0 == archive_write_set_bytes_per_block(a, 1)); - assertA(0 == archive_write_set_bytes_in_last_block(a, 1)); - assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used)); /* Write entries. */ @@ -113,9 +87,8 @@ DEFINE_TEST(test_write_format_zip_no_compression) archive_entry_set_size(entry, sizeof(file_data1) + sizeof(file_data2)); archive_entry_set_uid(entry, file_uid); archive_entry_set_gid(entry, file_gid); - archive_entry_set_mtime(entry, t, 0); - archive_entry_set_atime(entry, t, 0); - archive_entry_set_ctime(entry, t, 0); + archive_entry_set_mtime(entry, now, 0); + archive_entry_set_atime(entry, now + 3, 0); assertEqualIntA(a, 0, archive_write_header(a, entry)); assertEqualIntA(a, sizeof(file_data1), archive_write_data(a, file_data1, sizeof(file_data1))); assertEqualIntA(a, sizeof(file_data2), archive_write_data(a, file_data2, sizeof(file_data2))); @@ -128,15 +101,27 @@ DEFINE_TEST(test_write_format_zip_no_compression) archive_entry_set_size(entry, 0); archive_entry_set_uid(entry, folder_uid); archive_entry_set_gid(entry, folder_gid); - archive_entry_set_mtime(entry, t, 0); - archive_entry_set_atime(entry, t, 0); - archive_entry_set_ctime(entry, t, 0); + archive_entry_set_mtime(entry, now, 0); + archive_entry_set_ctime(entry, now + 5, 0); assertEqualIntA(a, 0, archive_write_header(a, entry)); archive_entry_free(entry); +} - /* Close the archive . */ - assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); - assertEqualInt(ARCHIVE_OK, archive_write_free(a)); +/* Quick and dirty: Read 2-byte and 4-byte integers from Zip file. */ +static int i2(const char *p) { return ((p[0] & 0xff) | ((p[1] & 0xff) << 8)); } +static int i4(const char *p) { return (i2(p) | (i2(p + 2) << 16)); } + +static void verify_uncompressed_contents(const char *buff, size_t used) +{ + const char *buffend; + + /* Misc variables */ + unsigned long crc; + struct tm *tm = localtime(&now); + + /* p is the pointer to walk over the central directory, + * q walks over the local headers, the data and the data descriptors. */ + const char *p, *q, *local_header, *extra_start; /* Remember the end of the archive in memory. */ buffend = buff + used; @@ -166,8 +151,8 @@ DEFINE_TEST(test_write_format_zip_no_compression) /* Verify file entry in central directory. */ assertEqualMem(p, "PK\001\002", 4); /* Signature */ - assertEqualInt(i2(p + 4), 3 * 256 + 20); /* Version made by */ - assertEqualInt(i2(p + 6), 20); /* Version needed to extract */ + assertEqualInt(i2(p + 4), 3 * 256 + 10); /* Version made by */ + assertEqualInt(i2(p + 6), 10); /* Version needed to extract */ assertEqualInt(i2(p + 8), 8); /* Flags */ assertEqualInt(i2(p + 10), 0); /* Compression method */ assertEqualInt(i2(p + 12), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ @@ -178,7 +163,7 @@ DEFINE_TEST(test_write_format_zip_no_compression) assertEqualInt(i4(p + 20), sizeof(file_data1) + sizeof(file_data2)); /* Compressed size */ assertEqualInt(i4(p + 24), sizeof(file_data1) + sizeof(file_data2)); /* Uncompressed size */ assertEqualInt(i2(p + 28), strlen(file_name)); /* Pathname length */ - assertEqualInt(i2(p + 30), 13); /* Extra field length */ + assertEqualInt(i2(p + 30), 28); /* Extra field length */ assertEqualInt(i2(p + 32), 0); /* File comment length */ assertEqualInt(i2(p + 34), 0); /* Disk number start */ assertEqualInt(i2(p + 36), 0); /* Internal file attrs */ @@ -187,18 +172,20 @@ DEFINE_TEST(test_write_format_zip_no_compression) assertEqualMem(p + 46, file_name, strlen(file_name)); /* Pathname */ p = p + 46 + strlen(file_name); assertEqualInt(i2(p), 0x5455); /* 'UT' extension header */ - assertEqualInt(i2(p + 2), 5); /* 'UT' size */ - assertEqualInt(p[4], 7); /* 'UT' flags */ - assertEqualInt(i4(p + 5), t); /* 'UT' mtime */ - p = p + 9; + assertEqualInt(i2(p + 2), 9); /* 'UT' size */ + assertEqualInt(p[4], 3); /* 'UT' flags */ + assertEqualInt(i4(p + 5), now); /* 'UT' mtime */ + assertEqualInt(i4(p + 9), now + 3); /* 'UT' atime */ + p = p + 4 + i2(p + 2); assertEqualInt(i2(p), 0x7875); /* 'ux' extension header */ - assertEqualInt(i2(p + 2), 0); /* 'ux' size */ - p = p + 4; + assertEqualInt(i2(p + 2), 11); /* 'ux' size */ +/* TODO */ + p = p + 4 + i2(p + 2); /* Verify local header of file entry. */ - q = buff; + local_header = q = buff; assertEqualMem(q, "PK\003\004", 4); /* Signature */ - assertEqualInt(i2(q + 4), 20); /* Version needed to extract */ + assertEqualInt(i2(q + 4), 10); /* Version needed to extract */ assertEqualInt(i2(q + 6), 8); /* Flags */ assertEqualInt(i2(q + 8), 0); /* Compression method */ assertEqualInt(i2(q + 10), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ @@ -207,16 +194,16 @@ DEFINE_TEST(test_write_format_zip_no_compression) assertEqualInt(i4(q + 18), sizeof(file_data1) + sizeof(file_data2)); /* Compressed size */ assertEqualInt(i4(q + 22), sizeof(file_data1) + sizeof(file_data2)); /* Uncompressed size */ assertEqualInt(i2(q + 26), strlen(file_name)); /* Pathname length */ - assertEqualInt(i2(q + 28), 32); /* Extra field length */ + assertEqualInt(i2(q + 28), 41); /* Extra field length */ assertEqualMem(q + 30, file_name, strlen(file_name)); /* Pathname */ - q = q + 30 + strlen(file_name); + extra_start = q = q + 30 + strlen(file_name); assertEqualInt(i2(q), 0x5455); /* 'UT' extension header */ - assertEqualInt(i2(q + 2), 13); /* 'UT' size */ - assertEqualInt(q[4], 7); /* 'UT' flags */ - assertEqualInt(i4(q + 5), t); /* 'UT' mtime */ - assertEqualInt(i4(q + 9), t); /* 'UT' atime */ - assertEqualInt(i4(q + 13), t); /* 'UT' ctime */ - q = q + 17; + assertEqualInt(i2(q + 2), 9); /* 'UT' size */ + assertEqualInt(q[4], 3); /* 'UT' flags */ + assertEqualInt(i4(q + 5), now); /* 'UT' mtime */ + assertEqualInt(i4(q + 9), now + 3); /* 'UT' atime */ + q = q + 4 + i2(q + 2); + assertEqualInt(i2(q), 0x7875); /* 'ux' extension header */ assertEqualInt(i2(q + 2), 11); /* 'ux' size */ assertEqualInt(q[4], 1); /* 'ux' version */ @@ -224,7 +211,18 @@ DEFINE_TEST(test_write_format_zip_no_compression) assertEqualInt(i4(q + 6), file_uid); /* 'Ux' UID */ assertEqualInt(q[10], 4); /* 'ux' gid size */ assertEqualInt(i4(q + 11), file_gid); /* 'Ux' GID */ - q = q + 15; + q = q + 4 + i2(q + 2); + + assertEqualInt(i2(q), 0x6c78); /* 'xl' experimental extension header */ + assertEqualInt(i2(q + 2), 9); /* size */ + assertEqualInt(q[4], 7); /* Bitmap of fields included. */ + assertEqualInt(i2(q + 5) >> 8, 3); /* system & version made by */ + assertEqualInt(i2(q + 7), 0); /* internal file attributes */ + assertEqualInt(i4(q + 9) >> 16 & 01777, file_perm); /* external file attributes */ + q = q + 4 + i2(q + 2); + + assert(q == extra_start + i2(local_header + 28)); + q = extra_start + i2(local_header + 28); /* Verify data of file entry. */ assertEqualMem(q, file_data1, sizeof(file_data1)); @@ -242,7 +240,7 @@ DEFINE_TEST(test_write_format_zip_no_compression) assertEqualMem(p, "PK\001\002", 4); /* Signature */ assertEqualInt(i2(p + 4), 3 * 256 + 20); /* Version made by */ assertEqualInt(i2(p + 6), 20); /* Version needed to extract */ - assertEqualInt(i2(p + 8), 8); /* Flags */ + assertEqualInt(i2(p + 8), 0); /* Flags */ assertEqualInt(i2(p + 10), 0); /* Compression method */ assertEqualInt(i2(p + 12), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ assertEqualInt(i2(p + 14), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ @@ -251,7 +249,7 @@ DEFINE_TEST(test_write_format_zip_no_compression) assertEqualInt(i4(p + 20), 0); /* Compressed size */ assertEqualInt(i4(p + 24), 0); /* Uncompressed size */ assertEqualInt(i2(p + 28), strlen(folder_name)); /* Pathname length */ - assertEqualInt(i2(p + 30), 13); /* Extra field length */ + assertEqualInt(i2(p + 30), 28); /* Extra field length */ assertEqualInt(i2(p + 32), 0); /* File comment length */ assertEqualInt(i2(p + 34), 0); /* Disk number start */ assertEqualInt(i2(p + 36), 0); /* Internal file attrs */ @@ -260,18 +258,25 @@ DEFINE_TEST(test_write_format_zip_no_compression) assertEqualMem(p + 46, folder_name, strlen(folder_name)); /* Pathname */ p = p + 46 + strlen(folder_name); assertEqualInt(i2(p), 0x5455); /* 'UT' extension header */ - assertEqualInt(i2(p + 2), 5); /* 'UT' size */ - assertEqualInt(p[4], 7); /* 'UT' flags */ - assertEqualInt(i4(p + 5), t); /* 'UT' mtime */ - p = p + 9; + assertEqualInt(i2(p + 2), 9); /* 'UT' size */ + assertEqualInt(p[4], 5); /* 'UT' flags */ + assertEqualInt(i4(p + 5), now); /* 'UT' mtime */ + assertEqualInt(i4(p + 9), now + 5); /* 'UT' atime */ + p = p + 4 + i2(p + 2); assertEqualInt(i2(p), 0x7875); /* 'ux' extension header */ - assertEqualInt(i2(p + 2), 0); /* 'ux' size */ - /*p = p + 4;*/ + assertEqualInt(i2(p + 2), 11); /* 'ux' size */ + assertEqualInt(p[4], 1); /* 'ux' version */ + assertEqualInt(p[5], 4); /* 'ux' uid size */ + assertEqualInt(i4(p + 6), folder_uid); /* 'ux' UID */ + assertEqualInt(p[10], 4); /* 'ux' gid size */ + assertEqualInt(i4(p + 11), folder_gid); /* 'ux' GID */ + /*p = p + 4 + i2(p + 2);*/ /* Verify local header of folder entry. */ + local_header = q; assertEqualMem(q, "PK\003\004", 4); /* Signature */ assertEqualInt(i2(q + 4), 20); /* Version needed to extract */ - assertEqualInt(i2(q + 6), 8); /* Flags */ + assertEqualInt(i2(q + 6), 0); /* Flags */ assertEqualInt(i2(q + 8), 0); /* Compression method */ assertEqualInt(i2(q + 10), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ assertEqualInt(i2(q + 12), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ @@ -279,16 +284,15 @@ DEFINE_TEST(test_write_format_zip_no_compression) assertEqualInt(i4(q + 18), 0); /* Compressed size */ assertEqualInt(i4(q + 22), 0); /* Uncompressed size */ assertEqualInt(i2(q + 26), strlen(folder_name)); /* Pathname length */ - assertEqualInt(i2(q + 28), 32); /* Extra field length */ + assertEqualInt(i2(q + 28), 41); /* Extra field length */ assertEqualMem(q + 30, folder_name, strlen(folder_name)); /* Pathname */ - q = q + 30 + strlen(folder_name); + extra_start = q = q + 30 + strlen(folder_name); assertEqualInt(i2(q), 0x5455); /* 'UT' extension header */ - assertEqualInt(i2(q + 2), 13); /* 'UT' size */ - assertEqualInt(q[4], 7); /* 'UT' flags */ - assertEqualInt(i4(q + 5), t); /* 'UT' mtime */ - assertEqualInt(i4(q + 9), t); /* 'UT' atime */ - assertEqualInt(i4(q + 13), t); /* 'UT' ctime */ - q = q + 17; + assertEqualInt(i2(q + 2), 9); /* 'UT' size */ + assertEqualInt(q[4], 5); /* 'UT' flags */ + assertEqualInt(i4(q + 5), now); /* 'UT' mtime */ + assertEqualInt(i4(q + 9), now + 5); /* 'UT' atime */ + q = q + 4 + i2(q + 2); assertEqualInt(i2(q), 0x7875); /* 'ux' extension header */ assertEqualInt(i2(q + 2), 11); /* 'ux' size */ assertEqualInt(q[4], 1); /* 'ux' version */ @@ -296,15 +300,76 @@ DEFINE_TEST(test_write_format_zip_no_compression) assertEqualInt(i4(q + 6), folder_uid); /* 'ux' UID */ assertEqualInt(q[10], 4); /* 'ux' gid size */ assertEqualInt(i4(q + 11), folder_gid); /* 'ux' GID */ - q = q + 15; + q = q + 4 + i2(q + 2); + + assertEqualInt(i2(q), 0x6c78); /* 'xl' experimental extension header */ + assertEqualInt(i2(q + 2), 9); /* size */ + assertEqualInt(q[4], 7); /* bitmap of fields */ + assertEqualInt(i2(q + 5) >> 8, 3); /* system & version made by */ + assertEqualInt(i2(q + 7), 0); /* internal file attributes */ + assertEqualInt(i4(q + 9) >> 16 & 01777, folder_perm); /* external file attributes */ + q = q + 4 + i2(q + 2); + + assert(q == extra_start + i2(local_header + 28)); + q = extra_start + i2(local_header + 28); /* There should not be any data in the folder entry, - * meaning next is the data descriptor header. */ - - /* Verify data descriptor of folder entry. */ - assertEqualMem(q, "PK\007\010", 4); /* Signature */ - assertEqualInt(i4(q + 4), crc); /* CRC-32 */ - assertEqualInt(i4(q + 8), 0); /* Compressed size */ - assertEqualInt(i4(q + 12), 0); /* Uncompressed size */ - /*q = q + 16;*/ + * so the first central directory entry should be next: */ + assertEqualMem(q, "PK\001\002", 4); /* Signature */ +} + +DEFINE_TEST(test_write_format_zip_compression_store) +{ + /* Buffer data */ + struct archive *a; + char buff[100000]; + size_t used; + + /* Time data */ + now = time(NULL); + + /* Create new ZIP archive in memory without padding. */ + /* Use compression=store to disable compression. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:compression=store")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:experimental")); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_per_block(a, 1)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_in_last_block(a, 1)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used)); + + verify_write_uncompressed(a); + + /* Close the archive . */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + dumpfile("constructed.zip", buff, used); + + verify_uncompressed_contents(buff, used); + + /* Create new ZIP archive in memory without padding. */ + /* Use compression-level=0 to disable compression. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:compression-level=0")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:experimental")); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_per_block(a, 1)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_in_last_block(a, 1)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used)); + + verify_write_uncompressed(a); + + /* Close the archive . */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + dumpfile("constructed.zip", buff, used); + + verify_uncompressed_contents(buff, used); + } diff --git a/libarchive/test/test_write_format_zip_empty_zip64.c b/libarchive/test/test_write_format_zip_empty_zip64.c new file mode 100644 index 000000000000..d6be44a5d477 --- /dev/null +++ b/libarchive/test/test_write_format_zip_empty_zip64.c @@ -0,0 +1,103 @@ +/*- + * Copyright (c) 2008 Anselm Strauss + * 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. + */ + +/* + * Development supported by Google Summer of Code 2008. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_write_format_zip_empty_zip64) +{ + struct archive *a; + struct archive_entry *ae; + char buff[256]; + size_t used; + + /* Zip format: Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_per_block(a, 1)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_bytes_in_last_block(a, 1)); + /* Force zip writer to use Zip64 extensions. */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_option(a, "zip", "zip64", "1")); + assertEqualIntA(a, ARCHIVE_OK, archive_write_open_memory(a, buff, sizeof(buff), &used)); + + /* Close out the archive without writing anything. */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* Verify the correct format for an empy Zip archive with Zip64 extensions forced. */ + assertEqualInt(used, 98); + assertEqualMem(buff, + "PK\006\006" /* Zip64 end-of-central-directory record */ + "\x2c\0\0\0\0\0\0\0" /* 44 bytes long */ + "\x2d\0" /* Created by Zip 4.5 */ + "\x2d\0" /* Extract with Zip 4.5 or later */ + "\0\0\0\0" /* This is disk #0 */ + "\0\0\0\0" /* Central dir starts on disk #0 */ + "\0\0\0\0\0\0\0\0" /* There are 0 entries on this disk ... */ + "\0\0\0\0\0\0\0\0" /* ... out of 0 entries total ... */ + "\0\0\0\0\0\0\0\0" /* ... requiring a total of 0 bytes. */ + "\0\0\0\0\0\0\0\0" /* Directory starts at offset 0 */ + + "PK\006\007" /* Zip64 end-of-central-directory locator */ + "\0\0\0\0" /* Zip64 EOCD record is on disk #0 .. */ + "\0\0\0\0\0\0\0\0" /* .. at offset 0 .. */ + "\1\0\0\0" /* .. of 1 total disks. */ + + "PK\005\006" /* Regular Zip end-of-central-directory record */ + "\0\0" /* This is disk #0 */ + "\0\0" /* Central dir is on disk #0 */ + "\0\0" /* There are 0 entries on this disk ... */ + "\0\0" /* ... out of 0 total entries ... */ + "\0\0\0\0" /* ... requiring a total of 0 bytes. */ + "\0\0\0\0" /* Directory starts at offset 0. */ + "\0\0" /* File comment is zero bytes long. */, + 98); + + /* Verify that we read this kind of empty archive correctly. */ + /* Try with the standard memory reader, and with the test + memory reader with and without seek support. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, 98)); + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, 98, 1)); + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, 98, 98)); + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); +} diff --git a/libarchive/test/test_write_format_zip_file.c b/libarchive/test/test_write_format_zip_file.c new file mode 100644 index 000000000000..e27b23b4b6d1 --- /dev/null +++ b/libarchive/test/test_write_format_zip_file.c @@ -0,0 +1,251 @@ +/*- + * Copyright (c) 2003-2008 Tim Kientzle + * Copyright (c) 2008 Anselm Strauss + * 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. + */ + +/* + * Development supported by Google Summer of Code 2008. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* + * Detailed byte-for-byte verification of the format of a zip archive + * with a single file written to it. + */ + +static unsigned long +bitcrc32(unsigned long c, void *_p, size_t s) +{ + /* This is a drop-in replacement for crc32() from zlib. + * Libarchive should be able to correctly generate + * uncompressed zip archives (including correct CRCs) even + * when zlib is unavailable, and this function helps us verify + * that. Yes, this is very, very slow and unsuitable for + * production use, but it's correct, compact, and works well + * enough for this particular usage. Libarchive internally + * uses a much more efficient implementation. */ + const unsigned char *p = _p; + int bitctr; + + if (p == NULL) + return (0); + + for (; s > 0; --s) { + c ^= *p++; + for (bitctr = 8; bitctr > 0; --bitctr) { + if (c & 1) c = (c >> 1); + else c = (c >> 1) ^ 0xedb88320; + c ^= 0x80000000; + } + } + return (c); +} + +/* Quick and dirty: Read 2-byte and 4-byte integers from Zip file. */ +static unsigned i2(const unsigned char *p) { return ((p[0] & 0xff) | ((p[1] & 0xff) << 8)); } +static unsigned i4(const unsigned char *p) { return (i2(p) | (i2(p + 2) << 16)); } + +DEFINE_TEST(test_write_format_zip_file) +{ + struct archive *a; + struct archive_entry *ae; + time_t t = 1234567890; + struct tm *tm = localtime(&t); + size_t used, buffsize = 1000000; + unsigned long crc; + int file_perm = 00644; + int zip_version = 20; + int zip_compression = 8; + short file_uid = 10, file_gid = 20; + unsigned char *buff, *buffend, *p; + unsigned char *central_header, *local_header, *eocd, *eocd_record; + unsigned char *extension_start, *extension_end; + char file_data[] = {'1', '2', '3', '4', '5', '6', '7', '8'}; + char *file_name = "file"; + +#ifndef HAVE_ZLIB_H + zip_version = 10; + zip_compression = 0; +#endif + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:experimental")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, file_name); + archive_entry_set_mode(ae, AE_IFREG | file_perm); + archive_entry_set_size(ae, sizeof(file_data)); + archive_entry_set_uid(ae, file_uid); + archive_entry_set_gid(ae, file_gid); + archive_entry_set_mtime(ae, t, 0); + assertEqualInt(0, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(8, archive_write_data(a, file_data, sizeof(file_data))); + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + buffend = buff + used; + dumpfile("constructed.zip", buff, used); + + /* Verify "End of Central Directory" record. */ + /* Get address of end-of-central-directory record. */ + eocd_record = p = buffend - 22; /* Assumes there is no zip comment field. */ + failure("End-of-central-directory begins with PK\\005\\006 signature"); + assertEqualMem(p, "PK\005\006", 4); + failure("This must be disk 0"); + assertEqualInt(i2(p + 4), 0); + failure("Central dir must start on disk 0"); + assertEqualInt(i2(p + 6), 0); + failure("All central dir entries are on this disk"); + assertEqualInt(i2(p + 8), i2(p + 10)); + eocd = buff + i4(p + 12) + i4(p + 16); + failure("no zip comment"); + assertEqualInt(i2(p + 20), 0); + + /* Get address of first entry in central directory. */ + central_header = p = buff + i4(buffend - 6); + failure("Central file record at offset %d should begin with" + " PK\\001\\002 signature", + i4(buffend - 10)); + + /* Verify file entry in central directory. */ + assertEqualMem(p, "PK\001\002", 4); /* Signature */ + assertEqualInt(i2(p + 4), 3 * 256 + zip_version); /* Version made by */ + assertEqualInt(i2(p + 6), zip_version); /* Version needed to extract */ + assertEqualInt(i2(p + 8), 8); /* Flags */ + assertEqualInt(i2(p + 10), zip_compression); /* Compression method */ + assertEqualInt(i2(p + 12), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ + assertEqualInt(i2(p + 14), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ + crc = bitcrc32(0, file_data, sizeof(file_data)); + assertEqualInt(i4(p + 16), crc); /* CRC-32 */ + /* assertEqualInt(i4(p + 20), sizeof(file_data)); */ /* Compressed size */ + assertEqualInt(i4(p + 24), sizeof(file_data)); /* Uncompressed size */ + assertEqualInt(i2(p + 28), strlen(file_name)); /* Pathname length */ + /* assertEqualInt(i2(p + 30), 28); */ /* Extra field length: See below */ + assertEqualInt(i2(p + 32), 0); /* File comment length */ + assertEqualInt(i2(p + 34), 0); /* Disk number start */ + assertEqualInt(i2(p + 36), 0); /* Internal file attrs */ + assertEqualInt(i4(p + 38) >> 16 & 01777, file_perm); /* External file attrs */ + assertEqualInt(i4(p + 42), 0); /* Offset of local header */ + assertEqualMem(p + 46, file_name, strlen(file_name)); /* Pathname */ + p = extension_start = central_header + 46 + strlen(file_name); + extension_end = extension_start + i2(central_header + 30); + + assertEqualInt(i2(p), 0x5455); /* 'UT' extension header */ + assertEqualInt(i2(p + 2), 5); /* 'UT' size */ + assertEqualInt(p[4], 1); /* 'UT' flags */ + assertEqualInt(i4(p + 5), t); /* 'UT' mtime */ + p += 4 + i2(p + 2); + + assertEqualInt(i2(p), 0x7875); /* 'ux' extension header */ + assertEqualInt(i2(p + 2), 11); /* 'ux' size */ + /* TODO: verify 'ux' contents */ + p += 4 + i2(p + 2); + + /* Just in case: Report any extra extensions. */ + while (p < extension_end) { + failure("Unexpected extension 0x%04X", i2(p)); + assert(0); + p += 4 + i2(p + 2); + } + + /* Should have run exactly to end of extra data. */ + assert(p == extension_end); + + assert(p == eocd); + + /* Regular EOCD immediately follows central directory. */ + assert(p == eocd_record); + + /* Verify local header of file entry. */ + p = local_header = buff; + assertEqualMem(p, "PK\003\004", 4); /* Signature */ + assertEqualInt(i2(p + 4), zip_version); /* Version needed to extract */ + assertEqualInt(i2(p + 6), 8); /* Flags */ + assertEqualInt(i2(p + 8), zip_compression); /* Compression method */ + assertEqualInt(i2(p + 10), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ + assertEqualInt(i2(p + 12), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ + assertEqualInt(i4(p + 14), 0); /* CRC-32 */ + /* assertEqualInt(i4(p + 18), sizeof(file_data)); */ /* Compressed size */ + /* assertEqualInt(i4(p + 22), sizeof(file_data)); */ /* Uncompressed size not stored because we're using length-at-end. */ + assertEqualInt(i2(p + 26), strlen(file_name)); /* Pathname length */ + assertEqualInt(i2(p + 28), 37); /* Extra field length */ + assertEqualMem(p + 30, file_name, strlen(file_name)); /* Pathname */ + p = extension_start = local_header + 30 + strlen(file_name); + extension_end = extension_start + i2(local_header + 28); + + assertEqualInt(i2(p), 0x5455); /* 'UT' extension header */ + assertEqualInt(i2(p + 2), 5); /* size */ + assertEqualInt(p[4], 1); /* 'UT' flags */ + assertEqualInt(i4(p + 5), t); /* 'UT' mtime */ + p += 4 + i2(p + 2); + + assertEqualInt(i2(p), 0x7875); /* 'ux' extension header */ + assertEqualInt(i2(p + 2), 11); /* size */ + assertEqualInt(p[4], 1); /* 'ux' version */ + assertEqualInt(p[5], 4); /* 'ux' uid size */ + assertEqualInt(i4(p + 6), file_uid); /* 'Ux' UID */ + assertEqualInt(p[10], 4); /* 'ux' gid size */ + assertEqualInt(i4(p + 11), file_gid); /* 'Ux' GID */ + p += 4 + i2(p + 2); + + assertEqualInt(i2(p), 0x6c78); /* 'xl' experimental extension block */ + assertEqualInt(i2(p + 2), 9); /* size */ + assertEqualInt(p[4], 7); /* bitmap of fields in this block */ + assertEqualInt(i2(p + 5) >> 8, 3); /* System & version made by */ + assertEqualInt(i2(p + 7), 0); /* internal file attributes */ + assertEqualInt(i4(p + 9) >> 16 & 01777, file_perm); /* external file attributes */ + p += 4 + i2(p + 2); + + /* Just in case: Report any extra extensions. */ + while (p < extension_end) { + failure("Unexpected extension 0x%04X", i2(p)); + assert(0); + p += 4 + i2(p + 2); + } + + /* Should have run exactly to end of extra data. */ + assert(p == extension_end); + + /* Data descriptor should follow compressed data. */ + while (p < central_header && memcmp(p, "PK\007\010", 4) != 0) + ++p; + assertEqualMem(p, "PK\007\010", 4); + assertEqualInt(i4(p + 4), crc); /* CRC-32 */ + /* assertEqualInt(i4(p + 8), ???); */ /* compressed size */ + assertEqualInt(i4(p + 12), sizeof(file_data)); /* uncompressed size */ + + /* Central directory should immediately follow the only entry. */ + assert(p + 16 == central_header); + + free(buff); +} diff --git a/libarchive/test/test_write_format_zip_file_zip64.c b/libarchive/test/test_write_format_zip_file_zip64.c new file mode 100644 index 000000000000..7bba50d29223 --- /dev/null +++ b/libarchive/test/test_write_format_zip_file_zip64.c @@ -0,0 +1,285 @@ +/*- + * Copyright (c) 2003-2008 Tim Kientzle + * Copyright (c) 2008 Anselm Strauss + * 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. + */ + +/* + * Development supported by Google Summer of Code 2008. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* + * Detailed byte-for-byte verification of the format of a zip archive + * with a single file written to it that uses Zip64 extensions. + */ + +static unsigned long +bitcrc32(unsigned long c, void *_p, size_t s) +{ + /* This is a drop-in replacement for crc32() from zlib. + * Libarchive should be able to correctly generate + * uncompressed zip archives (including correct CRCs) even + * when zlib is unavailable, and this function helps us verify + * that. Yes, this is very, very slow and unsuitable for + * production use, but it's correct, compact, and works well + * enough for this particular usage. Libarchive internally + * uses a much more efficient implementation. */ + const unsigned char *p = _p; + int bitctr; + + if (p == NULL) + return (0); + + for (; s > 0; --s) { + c ^= *p++; + for (bitctr = 8; bitctr > 0; --bitctr) { + if (c & 1) c = (c >> 1); + else c = (c >> 1) ^ 0xedb88320; + c ^= 0x80000000; + } + } + return (c); +} + +/* Quick and dirty: Read 2-byte and 4-byte integers from Zip file. */ +static unsigned i2(const unsigned char *p) { return ((p[0] & 0xff) | ((p[1] & 0xff) << 8)); } +static unsigned i4(const unsigned char *p) { return (i2(p) | (i2(p + 2) << 16)); } +/* We're only working with small values here; ignore the 4 high bytes. */ +static unsigned i8(const unsigned char *p) { return (i4(p)); } + +DEFINE_TEST(test_write_format_zip_file_zip64) +{ + struct archive *a; + struct archive_entry *ae; + time_t t = 1234567890; + struct tm *tm = localtime(&t); + size_t used, buffsize = 1000000; + unsigned long crc; + int file_perm = 00644; + int zip_version = 45; + int zip_compression = 8; + short file_uid = 10, file_gid = 20; + unsigned char *buff, *buffend, *p; + unsigned char *central_header, *local_header, *eocd, *eocd_record; + unsigned char *extension_start, *extension_end; + char file_data[] = {'1', '2', '3', '4', '5', '6', '7', '8'}; + char *file_name = "file"; + +#ifndef HAVE_ZLIB_H + zip_compression = 0; +#endif + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:zip64")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:experimental")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, file_name); + archive_entry_set_mode(ae, AE_IFREG | file_perm); + archive_entry_set_size(ae, sizeof(file_data)); + archive_entry_set_uid(ae, file_uid); + archive_entry_set_gid(ae, file_gid); + archive_entry_set_mtime(ae, t, 0); + assertEqualInt(0, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(8, archive_write_data(a, file_data, sizeof(file_data))); + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + buffend = buff + used; + dumpfile("constructed.zip", buff, used); + + /* Verify "End of Central Directory" record. */ + /* Get address of end-of-central-directory record. */ + eocd_record = p = buffend - 22; /* Assumes there is no zip comment field. */ + failure("End-of-central-directory begins with PK\\005\\006 signature"); + assertEqualMem(p, "PK\005\006", 4); + failure("This must be disk 0"); + assertEqualInt(i2(p + 4), 0); + failure("Central dir must start on disk 0"); + assertEqualInt(i2(p + 6), 0); + failure("All central dir entries are on this disk"); + assertEqualInt(i2(p + 8), i2(p + 10)); + eocd = buff + i4(p + 12) + i4(p + 16); + failure("no zip comment"); + assertEqualInt(i2(p + 20), 0); + + /* Get address of first entry in central directory. */ + central_header = p = buff + i4(buffend - 6); + failure("Central file record at offset %d should begin with" + " PK\\001\\002 signature", + i4(buffend - 10)); + + /* Verify file entry in central directory. */ + assertEqualMem(p, "PK\001\002", 4); /* Signature */ + assertEqualInt(i2(p + 4), 3 * 256 + zip_version); /* Version made by */ + assertEqualInt(i2(p + 6), zip_version); /* Version needed to extract */ + assertEqualInt(i2(p + 8), 8); /* Flags */ + assertEqualInt(i2(p + 10), zip_compression); /* Compression method */ + assertEqualInt(i2(p + 12), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ + assertEqualInt(i2(p + 14), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ + crc = bitcrc32(0, file_data, sizeof(file_data)); + assertEqualInt(i4(p + 16), crc); /* CRC-32 */ + /* assertEqualInt(i4(p + 20), sizeof(file_data)); */ /* Compressed size */ + assertEqualInt(i4(p + 24), sizeof(file_data)); /* Uncompressed size */ + assertEqualInt(i2(p + 28), strlen(file_name)); /* Pathname length */ + /* assertEqualInt(i2(p + 30), 28); */ /* Extra field length: See below */ + assertEqualInt(i2(p + 32), 0); /* File comment length */ + assertEqualInt(i2(p + 34), 0); /* Disk number start */ + assertEqualInt(i2(p + 36), 0); /* Internal file attrs */ + assertEqualInt(i4(p + 38) >> 16 & 01777, file_perm); /* External file attrs */ + assertEqualInt(i4(p + 42), 0); /* Offset of local header */ + assertEqualMem(p + 46, file_name, strlen(file_name)); /* Pathname */ + p = extension_start = central_header + 46 + strlen(file_name); + extension_end = extension_start + i2(central_header + 30); + + assertEqualInt(i2(p), 0x5455); /* 'UT' extension header */ + assertEqualInt(i2(p + 2), 5); /* 'UT' size */ + assertEqualInt(p[4], 1); /* 'UT' flags */ + assertEqualInt(i4(p + 5), t); /* 'UT' mtime */ + p += 4 + i2(p + 2); + + assertEqualInt(i2(p), 0x7875); /* 'ux' extension header */ + assertEqualInt(i2(p + 2), 11); /* 'ux' size */ + /* TODO: verify 'ux' contents */ + p += 4 + i2(p + 2); + + /* Note: We don't expect to see zip64 extension in the central + * directory, since the writer knows the actual full size by + * the time it is ready to write the central directory and has + * no reason to insert it then. Info-Zip seems to do the same + * thing. */ + + /* Just in case: Report any extra extensions. */ + while (p < extension_end) { + failure("Unexpected extension 0x%04X", i2(p)); + assert(0); + p += 4 + i2(p + 2); + } + + /* Should have run exactly to end of extra data. */ + assert(p == extension_end); + + assert(p == eocd); + + /* After Central dir, we find Zip64 eocd and Zip64 eocd locator. */ + assertEqualMem(p, "PK\006\006", 4); /* Zip64 eocd */ + assertEqualInt(i8(p + 4), 44); /* We're using v1 Zip64 eocd */ + assertEqualInt(i2(p + 12), 45); /* Written by Version 4.5 */ + assertEqualInt(i2(p + 14), 45); /* Needs version 4.5 to extract */ + assertEqualInt(i4(p + 16), 0); /* This is disk #0 */ + assertEqualInt(i4(p + 20), 0); /* Dir starts on disk #0 */ + assertEqualInt(i8(p + 24), 1); /* 1 entry on this disk */ + assertEqualInt(i8(p + 32), 1); /* 1 entry total */ + assertEqualInt(i8(p + 40), eocd - central_header); /* size of cd */ + assertEqualInt(i8(p + 48), central_header - buff); /* start of cd */ + p += 12 + i8(p + 4); + + assertEqualMem(p, "PK\006\007", 4); /* Zip64 eocd locator */ + assertEqualInt(i4(p + 4), 0); /* Zip64 eocd is on disk #0 */ + assertEqualInt(i8(p + 8), eocd - buff); /* Offset of Zip64 eocd */ + assertEqualInt(i4(p + 16), 1); /* 1 disk */ + p += 20; + + /* Regular EOCD immediately follows Zip64 records. */ + assert(p == eocd_record); + + /* Verify local header of file entry. */ + p = local_header = buff; + assertEqualMem(p, "PK\003\004", 4); /* Signature */ + assertEqualInt(i2(p + 4), zip_version); /* Version needed to extract */ + assertEqualInt(i2(p + 6), 8); /* Flags */ + assertEqualInt(i2(p + 8), zip_compression); /* Compression method */ + assertEqualInt(i2(p + 10), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ + assertEqualInt(i2(p + 12), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ + assertEqualInt(i4(p + 14), 0); /* CRC-32 */ + /* assertEqualInt(i4(p + 18), sizeof(file_data)); */ /* Compressed size */ + /* assertEqualInt(i4(p + 22), sizeof(file_data)); */ /* Uncompressed size not stored because we're using length-at-end. */ + assertEqualInt(i2(p + 26), strlen(file_name)); /* Pathname length */ + assertEqualInt(i2(p + 28), 57); /* Extra field length */ + assertEqualMem(p + 30, file_name, strlen(file_name)); /* Pathname */ + p = extension_start = local_header + 30 + strlen(file_name); + extension_end = extension_start + i2(local_header + 28); + + assertEqualInt(i2(p), 0x5455); /* 'UT' extension header */ + assertEqualInt(i2(p + 2), 5); /* 'UT' size */ + assertEqualInt(p[4], 1); /* 'UT' flags */ + assertEqualInt(i4(p + 5), t); /* 'UT' mtime */ + p += 4 + i2(p + 2); + + assertEqualInt(i2(p), 0x7875); /* 'ux' extension header */ + assertEqualInt(i2(p + 2), 11); /* 'ux' size */ + assertEqualInt(p[4], 1); /* 'ux' version */ + assertEqualInt(p[5], 4); /* 'ux' uid size */ + assertEqualInt(i4(p + 6), file_uid); /* 'Ux' UID */ + assertEqualInt(p[10], 4); /* 'ux' gid size */ + assertEqualInt(i4(p + 11), file_gid); /* 'Ux' GID */ + p += 4 + i2(p + 2); + + assertEqualInt(i2(p), 0x0001); /* Zip64 extension header */ + assertEqualInt(i2(p + 2), 16); /* size */ + assertEqualInt(i8(p + 4), 8); /* uncompressed file size */ + /* compressed file size we can't verify here */ + p += 4 + i2(p + 2); + + assertEqualInt(i2(p), 0x6c78); /* 'xl' experimental extension header */ + assertEqualInt(i2(p + 2), 9); /* size */ + assertEqualInt(p[4], 7); /* bitmap of included fields */ + assertEqualInt(i2(p + 5) >> 8, 3); /* system & version made by */ + assertEqualInt(i2(p + 7), 0); /* internal file attributes */ + assertEqualInt(i4(p + 9) >> 16 & 01777, file_perm); /* external file attributes */ + p += 4 + i2(p + 2); + + /* Just in case: Report any extra extensions. */ + while (p < extension_end) { + failure("Unexpected extension 0x%04X", i2(p)); + assert(0); + p += 4 + i2(p + 2); + } + + /* Should have run exactly to end of extra data. */ + assert(p == extension_end); + + /* Data descriptor should follow compressed data. */ + while (p < central_header && memcmp(p, "PK\007\010", 4) != 0) + ++p; + assertEqualMem(p, "PK\007\010", 4); + assertEqualInt(i4(p + 4), crc); /* CRC-32 */ + /* assertEqualInt(i8(p + 8), ???); */ /* compressed size */ + assertEqualInt(i8(p + 16), sizeof(file_data)); /* uncompressed size */ + + /* Central directory should immediately follow the only entry. */ + assert(p + 24 == central_header); + + free(buff); +} diff --git a/libarchive/test/test_write_format_zip_large.c b/libarchive/test/test_write_format_zip_large.c new file mode 100644 index 000000000000..d73dd62dee19 --- /dev/null +++ b/libarchive/test/test_write_format_zip_large.c @@ -0,0 +1,474 @@ +/*- + * Copyright (c) 2003-2007,2013 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" +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +/* + * This is a somewhat tricky test that verifies the ability to + * write and read very large entries to zip archives. + * + * See test_tar_large.c for more information about the machinery + * being used here. + */ + +static size_t nullsize; +static void *nulldata; + +struct fileblock { + struct fileblock *next; + int size; + void *buff; + int64_t gap_size; /* Size of following gap */ +}; + +struct fileblocks { + int64_t filesize; + int64_t fileposition; + int64_t gap_remaining; + void *buff; + struct fileblock *first; + struct fileblock *current; + struct fileblock *last; +}; + +/* The following size definitions simplify things below. */ +#define KB ((int64_t)1024) +#define MB ((int64_t)1024 * KB) +#define GB ((int64_t)1024 * MB) +#define TB ((int64_t)1024 * GB) + +static int64_t memory_read_skip(struct archive *, void *, int64_t request); +static ssize_t memory_read(struct archive *, void *, const void **buff); +static ssize_t memory_write(struct archive *, void *, const void *, size_t); + +static int16_t le16(const void *_p) { + const uint8_t *p = _p; + return (0xff & (int16_t)p[0]) | ((0xff & (int16_t)p[1]) << 8); +} + +static int32_t le32(const void *_p) { + const uint8_t *p = _p; + int32_t v = 0xffff & (int32_t)le16(_p); + return v + ((0xffff & (int32_t)le16(p + 2)) << 16); +} + +static int64_t le64(const void *_p) { + const uint8_t *p = _p; + int64_t v = 0xffffffff & (int64_t)le32(_p); + return v + ((0xffffffff & (int64_t)le32(p + 4)) << 32); +} + +static ssize_t +memory_write(struct archive *a, void *_private, const void *buff, size_t size) +{ + struct fileblocks *private = _private; + struct fileblock *block; + + (void)a; + + if ((const char *)nulldata <= (const char *)buff + && (const char *)buff < (const char *)nulldata + nullsize) { + /* We don't need to store a block of gap data. */ + private->last->gap_size += (int64_t)size; + } else { + /* Yes, we're assuming the very first write is metadata. */ + /* It's header or metadata, copy and save it. */ + block = (struct fileblock *)malloc(sizeof(*block)); + memset(block, 0, sizeof(*block)); + block->size = (int)size; + block->buff = malloc(size); + memcpy(block->buff, buff, size); + if (private->last == NULL) { + private->first = private->last = block; + } else { + private->last->next = block; + private->last = block; + } + block->next = NULL; + } + private->filesize += size; + return ((long)size); +} + +static ssize_t +memory_read(struct archive *a, void *_private, const void **buff) +{ + struct fileblocks *private = _private; + ssize_t size; + + (void)a; + + while (private->current != NULL && private->buff == NULL && private->gap_remaining == 0) { + private->current = private->current->next; + if (private->current != NULL) { + private->buff = private->current->buff; + private->gap_remaining = private->current->gap_size; + } + } + + if (private->current == NULL) + return (0); + + /* If there's real data, return that. */ + if (private->buff != NULL) { + *buff = private->buff; + size = ((char *)private->current->buff + private->current->size) + - (char *)private->buff; + private->buff = NULL; + private->fileposition += size; + return (size); + } + + /* Big gap: too big to return all at once, so just return some. */ + if (private->gap_remaining > (int64_t)nullsize) { + private->gap_remaining -= nullsize; + *buff = nulldata; + private->fileposition += nullsize; + return (nullsize); + } + + /* Small gap: finish the gap and prep for next block. */ + if (private->gap_remaining > 0) { + size = (ssize_t)private->gap_remaining; + *buff = nulldata; + private->gap_remaining = 0; + private->fileposition += size; + + private->current = private->current->next; + if (private->current != NULL) { + private->buff = private->current->buff; + private->gap_remaining = private->current->gap_size; + } + + return (size); + } + fprintf(stderr, "\n\n\nInternal failure\n\n\n"); + exit(1); +} + +static int +memory_read_open(struct archive *a, void *_private) +{ + struct fileblocks *private = _private; + + (void)a; /* UNUSED */ + + private->current = private->first; + private->fileposition = 0; + if (private->current != NULL) { + private->buff = private->current->buff; + private->gap_remaining = private->current->gap_size; + } + return (ARCHIVE_OK); +} + +static int64_t +memory_read_seek(struct archive *a, void *_private, int64_t offset, int whence) +{ + struct fileblocks *private = _private; + + (void)a; + if (whence == SEEK_END) { + offset = private->filesize + offset; + } else if (whence == SEEK_CUR) { + offset = private->fileposition + offset; + } + + if (offset < 0) { + fprintf(stderr, "\n\n\nInternal failure: negative seek\n\n\n"); + exit(1); + } + + /* We've converted the request into a SEEK_SET. */ + private->fileposition = offset; + + /* Walk the block list to find the new position. */ + offset = 0; + private->current = private->first; + while (private->current != NULL) { + if (offset + private->current->size > private->fileposition) { + /* Position is in this block. */ + private->buff = (char *)private->current->buff + + private->fileposition - offset; + private->gap_remaining = private->current->gap_size; + return private->fileposition; + } + offset += private->current->size; + if (offset + private->current->gap_size > private->fileposition) { + /* Position is in this gap. */ + private->buff = NULL; + private->gap_remaining = private->current->gap_size + - (private->fileposition - offset); + return private->fileposition; + } + offset += private->current->gap_size; + /* Skip to next block. */ + private->current = private->current->next; + } + if (private->fileposition == private->filesize) { + return private->fileposition; + } + fprintf(stderr, "\n\n\nInternal failure: over-sized seek\n\n\n"); + exit(1); +} + +static int64_t +memory_read_skip(struct archive *a, void *_private, int64_t skip) +{ + struct fileblocks *private = _private; + int64_t old_position = private->fileposition; + int64_t new_position = memory_read_seek(a, _private, skip, SEEK_CUR); + return (new_position - old_position); +} + +static struct fileblocks * +fileblocks_new(void) +{ + struct fileblocks *fileblocks; + + fileblocks = calloc(1, sizeof(struct fileblocks)); + return fileblocks; +} + +static void +fileblocks_free(struct fileblocks *fileblocks) +{ + while (fileblocks->first != NULL) { + struct fileblock *b = fileblocks->first; + fileblocks->first = fileblocks->first->next; + free(b->buff); + free(b); + } + free(fileblocks); +} + + +/* The sizes of the entries we're going to generate. */ +static int64_t test_sizes[] = { + /* Test for 32-bit signed overflow. */ + 2 * GB - 1, 2 * GB, 2 * GB + 1, + /* Test for 32-bit unsigned overflow. */ + 4 * GB - 1, 4 * GB, 4 * GB + 1, + /* And beyond ... because we can. */ + 16 * GB - 1, 16 * GB, 16 * GB + 1, + 64 * GB - 1, 64 * GB, 64 * GB + 1, + 256 * GB - 1, 256 * GB, 256 * GB + 1, + 1 * TB, + 0 +}; + + +static void +verify_large_zip(struct archive *a, struct fileblocks *fileblocks) +{ + char namebuff[64]; + struct archive_entry *ae; + int i; + + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_options(a, "zip:ignorecrc32")); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_open_callback(a, memory_read_open)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_read_callback(a, memory_read)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_skip_callback(a, memory_read_skip)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_seek_callback(a, memory_read_seek)); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_set_callback_data(a, fileblocks)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open1(a)); + + /* + * Read entries back. + */ + for (i = 0; test_sizes[i] > 0; i++) { + assertEqualIntA(a, ARCHIVE_OK, + archive_read_next_header(a, &ae)); + sprintf(namebuff, "file_%d", i); + assertEqualString(namebuff, archive_entry_pathname(ae)); + assertEqualInt(test_sizes[i], archive_entry_size(ae)); + } + assertEqualIntA(a, 0, archive_read_next_header(a, &ae)); + assertEqualString("lastfile", archive_entry_pathname(ae)); + + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + + /* Close out the archive. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_close(a)); +} + +DEFINE_TEST(test_write_format_zip_large) +{ + int i; + char namebuff[64]; + struct fileblocks *fileblocks = fileblocks_new(); + struct archive_entry *ae; + struct archive *a; + const char *p; + const char *cd_start, *zip64_eocd, *zip64_locator, *eocd; + int64_t cd_size; + char *buff; + int64_t filesize; + size_t writesize, buffsize, s; + + nullsize = (size_t)(1 * MB); + nulldata = malloc(nullsize); + memset(nulldata, 0xAA, nullsize); + + /* + * Open an archive for writing. + */ + a = archive_write_new(); + archive_write_set_format_zip(a); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:compression=store")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_options(a, "zip:fakecrc32")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_bytes_per_block(a, 0)); /* No buffering. */ + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open(a, fileblocks, NULL, memory_write, NULL)); + + /* + * Write a series of large files to it. + */ + for (i = 0; test_sizes[i] != 0; i++) { + assert((ae = archive_entry_new()) != NULL); + sprintf(namebuff, "file_%d", i); + archive_entry_copy_pathname(ae, namebuff); + archive_entry_set_mode(ae, S_IFREG | 0755); + filesize = test_sizes[i]; + archive_entry_set_size(ae, filesize); + + assertEqualIntA(a, ARCHIVE_OK, + archive_write_header(a, ae)); + archive_entry_free(ae); + + /* + * Write the actual data to the archive. + */ + while (filesize > 0) { + writesize = nullsize; + if ((int64_t)writesize > filesize) + writesize = (size_t)filesize; + assertEqualIntA(a, (int)writesize, + (int)archive_write_data(a, nulldata, writesize)); + filesize -= writesize; + } + } + + assert((ae = archive_entry_new()) != NULL); + archive_entry_copy_pathname(ae, "lastfile"); + archive_entry_set_mode(ae, S_IFREG | 0755); + assertA(0 == archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Close out the archive. */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); + + /* + * Read back with seeking reader: + */ + a = archive_read_new(); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_zip_seekable(a)); + verify_large_zip(a, fileblocks); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* + * Read back with streaming reader: + */ + a = archive_read_new(); + assertEqualIntA(a, ARCHIVE_OK, + archive_read_support_format_zip_streamable(a)); + verify_large_zip(a, fileblocks); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); + + /* + * Manually verify some of the final bytes of the archives. + */ + /* Collect the final bytes together */ +#define FINAL_SIZE 8192 + buff = malloc(FINAL_SIZE); + buffsize = 0; + memory_read_open(NULL, fileblocks); + memory_read_seek(NULL, fileblocks, -FINAL_SIZE, SEEK_END); + while ((s = memory_read(NULL, fileblocks, (const void **)&p)) > 0) { + memcpy(buff + buffsize, p, s); + buffsize += s; + } + assertEqualInt(buffsize, FINAL_SIZE); + + p = buff + buffsize; + + /* Verify regular end-of-central-directory record */ + eocd = p - 22; + assertEqualMem(eocd, "PK\005\006\0\0\0\0", 8); + assertEqualMem(eocd + 8, "\021\0\021\0", 4); /* 17 entries total */ + cd_size = le32(eocd + 12); + /* Start of CD offset should be 0xffffffff */ + assertEqualMem(eocd + 16, "\xff\xff\xff\xff", 4); + assertEqualMem(eocd + 20, "\0\0", 2); /* No Zip comment */ + + /* Verify Zip64 locator */ + zip64_locator = p - 42; + assertEqualMem(zip64_locator, "PK\006\007\0\0\0\0", 8); + zip64_eocd = p - (fileblocks->filesize - le64(zip64_locator + 8)); + assertEqualMem(zip64_locator + 16, "\001\0\0\0", 4); + + /* Verify Zip64 end-of-cd record. */ + assert(zip64_eocd == p - 98); + assertEqualMem(zip64_eocd, "PK\006\006", 4); + assertEqualInt(44, le64(zip64_eocd + 4)); // Size of EoCD record - 12 + assertEqualMem(zip64_eocd + 12, "\055\0", 2); // Made by version: 45 + assertEqualMem(zip64_eocd + 14, "\055\0", 2); // Requires version: 45 + assertEqualMem(zip64_eocd + 16, "\0\0\0\0", 4); // This disk + assertEqualMem(zip64_eocd + 20, "\0\0\0\0", 4); // Total disks + assertEqualInt(17, le64(zip64_eocd + 24)); // Entries on this disk + assertEqualInt(17, le64(zip64_eocd + 32)); // Total entries + cd_size = le64(zip64_eocd + 40); + cd_start = p - (fileblocks->filesize - le64(zip64_eocd + 48)); + + assert(cd_start + cd_size == zip64_eocd); + + assertEqualInt(le64(zip64_eocd + 48) // Start of CD + + cd_size + + 56 // Size of Zip64 EOCD + + 20 // Size of Zip64 locator + + 22, // Size of EOCD + fileblocks->filesize); + + // TODO: Scan entire Central Directory, sanity-check all data + assertEqualMem(cd_start, "PK\001\002", 4); + + fileblocks_free(fileblocks); + free(nulldata); +} diff --git a/libarchive/test/test_write_format_zip_zip64.c b/libarchive/test/test_write_format_zip_zip64.c new file mode 100644 index 000000000000..b83aeab5316a --- /dev/null +++ b/libarchive/test/test_write_format_zip_zip64.c @@ -0,0 +1,67 @@ +/*- + * Copyright (c) 2014 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" +__FBSDID("$FreeBSD$"); + +static void +verify_zip_filesize(uint64_t size, int expected) +{ + struct archive *a; + struct archive_entry *ae; + char buff[256]; + size_t used; + + /* Zip format: Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + /* Disable Zip64 extensions. */ + assertEqualIntA(a, ARCHIVE_OK, + archive_write_set_format_option(a, "zip", "zip64", NULL)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, sizeof(buff), &used)); + + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_pathname(ae, "test"); + archive_entry_set_mode(ae, AE_IFREG | 0644); + archive_entry_set_size(ae, size); + assertEqualInt(expected, archive_write_header(a, ae)); + + /* Don't actually write 4GB! ;-) */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_free(a)); +} + +DEFINE_TEST(test_write_format_zip_zip64_oversize) +{ + /* With Zip64 extensions disabled, we should be + * able to write a file with at most 4G-1 bytes. */ + + /* Note: Tar writer pads file to declared size when the file + * is closed. If Zip writer is changed to behave the same + * way, it will be much harder to test the first case here. */ + verify_zip_filesize(0xffffffffLL, ARCHIVE_OK); + + verify_zip_filesize(0x100000000LL, ARCHIVE_FAILED); +} diff --git a/libarchive/test/test_write_read_format_zip.c b/libarchive/test/test_write_read_format_zip.c new file mode 100644 index 000000000000..290c8090aeb5 --- /dev/null +++ b/libarchive/test/test_write_read_format_zip.c @@ -0,0 +1,751 @@ +/*- + * Copyright (c) 2003-2008 Tim Kientzle + * Copyright (c) 2008 Anselm Strauss + * 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. + */ + +/* + * Development supported by Google Summer of Code 2008. + */ + +#include "test.h" +__FBSDID("$FreeBSD$"); + +/* + * These tests verify that our reader can read files + * created by our writer. + */ + +/* + * Write a variety of different file types into the archive. + */ +static void +write_contents(struct archive *a) +{ + struct archive_entry *ae; + + /* + * First write things with the "default" compression. + * The library will choose "deflate" for most things if it's + * available, else "store". + */ + + /* + * Write a file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "file"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, 8); + assertEqualInt(0, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(8, archive_write_data(a, "12345678", 9)); + assertEqualInt(0, archive_write_data(a, "1", 1)); + + /* + * Write another file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "file2"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, 4); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(4, archive_write_data(a, "1234", 4)); + + /* + * Write a file with an unknown size. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 2, 15); + archive_entry_copy_pathname(ae, "file3"); + archive_entry_set_mode(ae, AE_IFREG | 0621); + archive_entry_unset_size(ae); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(5, archive_write_data(a, "mnopq", 5)); + + /* + * Write symbolic link. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(10, archive_entry_mtime_nsec(ae)); + archive_entry_copy_pathname(ae, "symlink"); + assertEqualString("symlink", archive_entry_pathname(ae)); + archive_entry_copy_symlink(ae, "file1"); + assertEqualString("file1", archive_entry_symlink(ae)); + archive_entry_set_mode(ae, AE_IFLNK | 0755); + assertEqualInt((AE_IFLNK | 0755), archive_entry_mode(ae)); + archive_entry_set_size(ae, 4); + + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* + * Write a directory to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 11, 110); + archive_entry_copy_pathname(ae, "dir"); + archive_entry_set_mode(ae, S_IFDIR | 0755); + archive_entry_set_size(ae, 512); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + failure("size should be zero so that applications know not to write"); + assertEqualInt(0, archive_entry_size(ae)); + archive_entry_free(ae); + assertEqualIntA(a, 0, archive_write_data(a, "12345678", 9)); + + /* + * Force "deflate" compression if the platform supports it. + */ +#ifdef HAVE_ZLIB_H + assertEqualIntA(a, ARCHIVE_OK, archive_write_zip_set_compression_deflate(a)); + + /* + * Write a file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "file_deflate"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, 8); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(8, archive_write_data(a, "12345678", 9)); + assertEqualInt(0, archive_write_data(a, "1", 1)); + + /* + * Write another file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "file2_deflate"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, 4); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(4, archive_write_data(a, "1234", 4)); + + /* + * Write a file with an unknown size. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 2, 15); + archive_entry_copy_pathname(ae, "file3_deflate"); + archive_entry_set_mode(ae, AE_IFREG | 0621); + archive_entry_unset_size(ae); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(5, archive_write_data(a, "ghijk", 5)); + + /* + * Write symbolic like file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "symlink_deflate"); + archive_entry_copy_symlink(ae, "file1"); + archive_entry_set_mode(ae, AE_IFLNK | 0755); + archive_entry_set_size(ae, 4); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* + * Write a directory to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 11, 110); + archive_entry_copy_pathname(ae, "dir_deflate"); + archive_entry_set_mode(ae, S_IFDIR | 0755); + archive_entry_set_size(ae, 512); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + failure("size should be zero so that applications know not to write"); + assertEqualInt(0, archive_entry_size(ae)); + archive_entry_free(ae); + assertEqualIntA(a, 0, archive_write_data(a, "12345678", 9)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_finish_entry(a)); +#endif + + /* + * Now write a bunch of entries with "store" compression. + */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_zip_set_compression_store(a)); + + /* + * Write a file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "file_stored"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, 8); + assertEqualInt(0, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(8, archive_write_data(a, "12345678", 9)); + assertEqualInt(0, archive_write_data(a, "1", 1)); + + /* + * Write another file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "file2_stored"); + archive_entry_set_mode(ae, AE_IFREG | 0755); + archive_entry_set_size(ae, 4); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(4, archive_write_data(a, "ACEG", 4)); + + /* + * Write a file with an unknown size. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 2, 15); + archive_entry_copy_pathname(ae, "file3_stored"); + archive_entry_set_mode(ae, AE_IFREG | 0621); + archive_entry_unset_size(ae); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + assertEqualInt(5, archive_write_data(a, "ijklm", 5)); + + /* + * Write symbolic like file to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 1, 10); + archive_entry_copy_pathname(ae, "symlink_stored"); + archive_entry_copy_symlink(ae, "file1"); + archive_entry_set_mode(ae, AE_IFLNK | 0755); + archive_entry_set_size(ae, 4); + assertEqualInt(ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* + * Write a directory to it. + */ + assert((ae = archive_entry_new()) != NULL); + archive_entry_set_mtime(ae, 11, 110); + archive_entry_copy_pathname(ae, "dir_stored"); + archive_entry_set_mode(ae, S_IFDIR | 0755); + archive_entry_set_size(ae, 512); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + failure("size should be zero so that applications know not to write"); + assertEqualInt(0, archive_entry_size(ae)); + archive_entry_free(ae); + assertEqualIntA(a, 0, archive_write_data(a, "12345678", 9)); + + + /* Close out the archive. */ + assertEqualInt(ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_free(a)); +} + +/* + * Read back all of the entries and verify their values. + */ +static void +verify_contents(struct archive *a, int seeking, int improved_streaming) +{ + char filedata[64]; + struct archive_entry *ae; + + /* + * Default compression options: + */ + + /* Read and verify first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + /* Zip doesn't store high-resolution mtime. */ + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file", archive_entry_pathname(ae)); + if (seeking || improved_streaming) { + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + } + assertEqualInt(8, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + assertEqualIntA(a, 8, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "12345678", 8); + + + /* Read the second file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file2", archive_entry_pathname(ae)); + if (seeking || improved_streaming) { + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + } + assertEqualInt(4, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + assertEqualIntA(a, 4, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "1234", 4); + + /* Read the third file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file3", archive_entry_pathname(ae)); + if (seeking || improved_streaming) { + assertEqualInt(AE_IFREG | 0621, archive_entry_mode(ae)); + } + if (seeking) { + assertEqualInt(5, archive_entry_size(ae)); + } else { + assertEqualInt(0, archive_entry_size_is_set(ae)); + } + assertEqualIntA(a, 5, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "mnopq", 5); + + /* Read symlink. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("symlink", archive_entry_pathname(ae)); + if (seeking || improved_streaming) { + assertEqualInt(AE_IFLNK | 0755, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualString("file1", archive_entry_symlink(ae)); + } else { + /* Streaming cannot read file type, so + * symlink body shows as regular file contents. */ + assertEqualInt(AE_IFREG | 0664, archive_entry_mode(ae)); + assertEqualInt(5, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + } + + /* Read the dir entry back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(11, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("dir/", archive_entry_pathname(ae)); + if (seeking || improved_streaming) + assertEqualInt(AE_IFDIR | 0755, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + assertEqualIntA(a, 0, archive_read_data(a, filedata, 10)); + +#ifdef HAVE_ZLIB_H + /* + * Deflate compression option: + */ + + /* Read and verify first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + /* Zip doesn't store high-resolution mtime. */ + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file_deflate", archive_entry_pathname(ae)); + if (seeking || improved_streaming) { + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + } + assertEqualInt(8, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + assertEqualIntA(a, 8, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "12345678", 8); + + + /* Read the second file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file2_deflate", archive_entry_pathname(ae)); + if (seeking || improved_streaming) { + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + } + assertEqualInt(4, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + assertEqualIntA(a, 4, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "1234", 4); + + /* Read the third file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file3_deflate", archive_entry_pathname(ae)); + if (seeking || improved_streaming) { + assertEqualInt(AE_IFREG | 0621, archive_entry_mode(ae)); + } + if (seeking) { + assertEqualInt(5, archive_entry_size(ae)); + } else { + assertEqualInt(0, archive_entry_size_is_set(ae)); + } + assertEqualIntA(a, 5, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "ghijk", 4); + + /* Read symlink. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("symlink_deflate", archive_entry_pathname(ae)); + if (seeking || improved_streaming) { + assertEqualInt(AE_IFLNK | 0755, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualString("file1", archive_entry_symlink(ae)); + } else { + assertEqualInt(AE_IFREG | 0664, archive_entry_mode(ae)); + assertEqualInt(5, archive_entry_size(ae)); + assertEqualIntA(a, 5, archive_read_data(a, filedata, 10)); + assertEqualMem(filedata, "file1", 5); + } + + /* Read the dir entry back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(11, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("dir_deflate/", archive_entry_pathname(ae)); + if (seeking) { + assertEqualInt(AE_IFDIR | 0755, archive_entry_mode(ae)); + } + assertEqualInt(0, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + assertEqualIntA(a, 0, archive_read_data(a, filedata, 10)); +#endif + + /* + * Store compression option: + */ + + /* Read and verify first file. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + /* Zip doesn't store high-resolution mtime. */ + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file_stored", archive_entry_pathname(ae)); + if (seeking || improved_streaming) { + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + } + assert(archive_entry_size_is_set(ae)); + assert(archive_entry_size_is_set(ae)); + assertEqualInt(8, archive_entry_size(ae)); + assertEqualIntA(a, 8, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "12345678", 8); + + + /* Read the second file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file2_stored", archive_entry_pathname(ae)); + if (seeking || improved_streaming) { + assertEqualInt(AE_IFREG | 0755, archive_entry_mode(ae)); + } + assertEqualInt(4, archive_entry_size(ae)); + assert(archive_entry_size_is_set(ae)); + assertEqualIntA(a, 4, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "ACEG", 4); + + /* Read the third file back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(2, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("file3_stored", archive_entry_pathname(ae)); + if (seeking || improved_streaming) + assertEqualInt(AE_IFREG | 0621, archive_entry_mode(ae)); + if (seeking) { + assertEqualInt(5, archive_entry_size(ae)); + } else { + assertEqualInt(0, archive_entry_size_is_set(ae)); + } + assertEqualIntA(a, 5, + archive_read_data(a, filedata, sizeof(filedata))); + assertEqualMem(filedata, "ijklm", 4); + + /* Read symlink. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(1, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("symlink_stored", archive_entry_pathname(ae)); + if (seeking || improved_streaming) { + assertEqualInt(AE_IFLNK | 0755, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualString("file1", archive_entry_symlink(ae)); + } else { + assertEqualInt(AE_IFREG | 0664, archive_entry_mode(ae)); + assertEqualInt(5, archive_entry_size(ae)); + assertEqualIntA(a, 5, archive_read_data(a, filedata, 10)); + assertEqualMem(filedata, "file1", 5); + } + + /* Read the dir entry back. */ + assertEqualIntA(a, ARCHIVE_OK, archive_read_next_header(a, &ae)); + assertEqualInt(11, archive_entry_mtime(ae)); + assertEqualInt(0, archive_entry_mtime_nsec(ae)); + assertEqualInt(0, archive_entry_atime(ae)); + assertEqualInt(0, archive_entry_ctime(ae)); + assertEqualString("dir_stored/", archive_entry_pathname(ae)); + if (seeking || improved_streaming) + assertEqualInt(AE_IFDIR | 0755, archive_entry_mode(ae)); + assertEqualInt(0, archive_entry_size(ae)); + assertEqualIntA(a, 0, archive_read_data(a, filedata, 10)); + + /* Verify the end of the archive. */ + assertEqualIntA(a, ARCHIVE_EOF, archive_read_next_header(a, &ae)); + assertEqualInt(ARCHIVE_OK, archive_read_close(a)); + assertEqualInt(ARCHIVE_OK, archive_read_free(a)); +} + +/* + * Do a write-then-read roundtrip. + */ +DEFINE_TEST(test_write_read_format_zip) +{ + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + write_contents(a); + dumpfile("constructed.zip", buff, used); + + /* + * Now, read the data back. + */ + /* With the standard memory reader. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + verify_contents(a, 1, 0); + + /* With the test memory reader -- streaming mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 0); + + /* With the test memory reader -- seeking mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 0); + + free(buff); +} + +/* + * Do a write-then-read roundtrip with 'el' extension enabled. + */ +DEFINE_TEST(test_write_read_format_zip_improved_streaming) +{ + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_options(a, "zip:experimental")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + write_contents(a); + dumpfile("constructed.zip", buff, used); + + /* + * Now, read the data back. + */ + /* With the standard memory reader. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + verify_contents(a, 1, 1); + + /* With the test memory reader -- streaming mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 1); + + /* With the test memory reader -- seeking mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 1); + + free(buff); +} + +/* + * Do a write-then-read roundtrip with Zip64 enabled. + */ +DEFINE_TEST(test_write_read_format_zip64) +{ + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_options(a, "zip:zip64")); +#if ZIP_IMPROVED_STREAMING + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_options(a, "zip:experimental")); +#endif + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + write_contents(a); + dumpfile("constructed64.zip", buff, used); + + /* + * Now, read the data back. + */ + /* With the standard memory reader. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + verify_contents(a, 1, 0); + + /* With the test memory reader -- streaming mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 0); + + /* With the test memory reader -- seeking mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 0); + + free(buff); +} + + +/* + * Do a write-then-read roundtrip with Zip64 enabled and 'el' extension enabled. + */ +DEFINE_TEST(test_write_read_format_zip64_improved_streaming) +{ + struct archive *a; + size_t used; + size_t buffsize = 1000000; + char *buff; + + buff = malloc(buffsize); + + /* Create a new archive in memory. */ + assert((a = archive_write_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_format_zip(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_add_filter_none(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_options(a, "zip:zip64")); + assertEqualIntA(a, ARCHIVE_OK, archive_write_set_options(a, "zip:experimental")); + assertEqualIntA(a, ARCHIVE_OK, + archive_write_open_memory(a, buff, buffsize, &used)); + write_contents(a); + dumpfile("constructed64.zip", buff, used); + + /* + * Now, read the data back. + */ + /* With the standard memory reader. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_open_memory(a, buff, used)); + verify_contents(a, 1, 1); + + /* With the test memory reader -- streaming mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory(a, buff, used, 7)); + /* Streaming reader doesn't see mode information from Central Directory. */ + verify_contents(a, 0, 1); + + /* With the test memory reader -- seeking mode. */ + assert((a = archive_read_new()) != NULL); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_filter_all(a)); + assertEqualIntA(a, ARCHIVE_OK, read_open_memory_seek(a, buff, used, 7)); + verify_contents(a, 1, 1); + + free(buff); +} diff --git a/libarchive/test/test_write_zip_set_compression_store.c b/libarchive/test/test_write_zip_set_compression_store.c deleted file mode 100644 index f77eb1be0685..000000000000 --- a/libarchive/test/test_write_zip_set_compression_store.c +++ /dev/null @@ -1,308 +0,0 @@ -/*- - * Copyright (c) 2012 Matthias Brantner - * 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" - -static unsigned long -bitcrc32(unsigned long c, void *_p, size_t s) -{ - /* This is a drop-in replacement for crc32() from zlib. - * Libarchive should be able to correctly generate - * uncompressed zip archives (including correct CRCs) even - * when zlib is unavailable, and this function helps us verify - * that. Yes, this is very, very slow and unsuitable for - * production use, but it's correct, compact, and works well - * enough for this particular usage. Libarchive internally - * uses a much more efficient implementation. */ - const unsigned char *p = _p; - int bitctr; - - if (p == NULL) - return (0); - - for (; s > 0; --s) { - c ^= *p++; - for (bitctr = 8; bitctr > 0; --bitctr) { - if (c & 1) c = (c >> 1); - else c = (c >> 1) ^ 0xedb88320; - c ^= 0x80000000; - } - } - return (c); -} - -/* Quick and dirty: Read 2-byte and 4-byte integers from Zip file. */ -static int i2(const char *p) { return ((p[0] & 0xff) | ((p[1] & 0xff) << 8)); } -static int i4(const char *p) { return (i2(p) | (i2(p + 2) << 16)); } - -DEFINE_TEST(test_write_zip_set_compression_store) -{ - /* Buffer data */ - struct archive *a; - struct archive_entry *entry; - char buff[100000]; - const char *buffend; - /* p is the pointer to walk over the central directory, - * q walks over the local headers, the data and the data descriptors. */ - const char *p, *q; - size_t used; - - /* File data */ - char file_name[] = "file"; - char file_data1[] = {'1', '2', '3', '4', '5'}; - char file_data2[] = {'6', '7', '8', '9', '0'}; - int file_perm = 00644; - short file_uid = 10; - short file_gid = 20; - - /* Folder data */ - char folder_name[] = "folder/"; - int folder_perm = 00755; - short folder_uid = 30; - short folder_gid = 40; - - /* Time data */ - time_t t = time(NULL); - struct tm *tm = localtime(&t); - - /* Misc variables */ - unsigned long crc; - - /* Create new ZIP archive in memory without padding. */ - assert((a = archive_write_new()) != NULL); - assertA(0 == archive_write_set_format_zip(a)); - assertA(0 == archive_write_add_filter_none(a)); - assertA(0 == archive_write_set_bytes_per_block(a, 1)); - assertA(0 == archive_write_set_bytes_in_last_block(a, 1)); - assertA(0 == archive_write_open_memory(a, buff, sizeof(buff), &used)); - - /* Write entries. */ - - /* Regular file */ - assert((entry = archive_entry_new()) != NULL); - archive_entry_set_pathname(entry, file_name); - archive_entry_set_mode(entry, S_IFREG | 0644); - archive_entry_set_size(entry, sizeof(file_data1) + sizeof(file_data2)); - archive_entry_set_uid(entry, file_uid); - archive_entry_set_gid(entry, file_gid); - archive_entry_set_mtime(entry, t, 0); - archive_entry_set_atime(entry, t, 0); - archive_entry_set_ctime(entry, t, 0); - archive_write_zip_set_compression_store(a); - assertEqualIntA(a, 0, archive_write_header(a, entry)); - assertEqualIntA(a, sizeof(file_data1), archive_write_data(a, file_data1, sizeof(file_data1))); - assertEqualIntA(a, sizeof(file_data2), archive_write_data(a, file_data2, sizeof(file_data2))); - archive_entry_free(entry); - archive_write_finish_entry(a); - - /* Folder */ - assert((entry = archive_entry_new()) != NULL); - archive_entry_set_pathname(entry, folder_name); - archive_entry_set_mode(entry, S_IFDIR | folder_perm); - archive_entry_set_size(entry, 0); - archive_entry_set_uid(entry, folder_uid); - archive_entry_set_gid(entry, folder_gid); - archive_entry_set_mtime(entry, t, 0); - archive_entry_set_atime(entry, t, 0); - archive_entry_set_ctime(entry, t, 0); - archive_write_zip_set_compression_store(a); - assertEqualIntA(a, 0, archive_write_header(a, entry)); - archive_entry_free(entry); - archive_write_finish_entry(a); - - /* Close the archive . */ - assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); - assertEqualInt(ARCHIVE_OK, archive_write_free(a)); - - /* Remember the end of the archive in memory. */ - buffend = buff + used; - - /* Verify "End of Central Directory" record. */ - /* Get address of end-of-central-directory record. */ - p = buffend - 22; /* Assumes there is no zip comment field. */ - failure("End-of-central-directory begins with PK\\005\\006 signature"); - assertEqualMem(p, "PK\005\006", 4); - failure("This must be disk 0"); - assertEqualInt(i2(p + 4), 0); - failure("Central dir must start on disk 0"); - assertEqualInt(i2(p + 6), 0); - failure("All central dir entries are on this disk"); - assertEqualInt(i2(p + 8), i2(p + 10)); - failure("CD start (%d) + CD length (%d) should == archive size - 22", - i4(p + 12), i4(p + 16)); - assertEqualInt(i4(p + 12) + i4(p + 16), used - 22); - failure("no zip comment"); - assertEqualInt(i2(p + 20), 0); - - /* Get address of first entry in central directory. */ - p = buff + i4(buffend - 6); - failure("Central file record at offset %d should begin with" - " PK\\001\\002 signature", - i4(buffend - 10)); - - /* Verify file entry in central directory. */ - assertEqualMem(p, "PK\001\002", 4); /* Signature */ - assertEqualInt(i2(p + 4), 3 * 256 + 20); /* Version made by */ - assertEqualInt(i2(p + 6), 20); /* Version needed to extract */ - assertEqualInt(i2(p + 8), 8); /* Flags */ - assertEqualInt(i2(p + 10), 0); /* Compression method */ - assertEqualInt(i2(p + 12), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ - assertEqualInt(i2(p + 14), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ - crc = bitcrc32(0, file_data1, sizeof(file_data1)); - crc = bitcrc32(crc, file_data2, sizeof(file_data2)); - assertEqualInt(i4(p + 16), crc); /* CRC-32 */ - assertEqualInt(i4(p + 20), sizeof(file_data1) + sizeof(file_data2)); /* Compressed size */ - assertEqualInt(i4(p + 24), sizeof(file_data1) + sizeof(file_data2)); /* Uncompressed size */ - assertEqualInt(i2(p + 28), strlen(file_name)); /* Pathname length */ - assertEqualInt(i2(p + 30), 13); /* Extra field length */ - assertEqualInt(i2(p + 32), 0); /* File comment length */ - assertEqualInt(i2(p + 34), 0); /* Disk number start */ - assertEqualInt(i2(p + 36), 0); /* Internal file attrs */ - assertEqualInt(i4(p + 38) >> 16 & 01777, file_perm); /* External file attrs */ - assertEqualInt(i4(p + 42), 0); /* Offset of local header */ - assertEqualMem(p + 46, file_name, strlen(file_name)); /* Pathname */ - p = p + 46 + strlen(file_name); - assertEqualInt(i2(p), 0x5455); /* 'UT' extension header */ - assertEqualInt(i2(p + 2), 5); /* 'UT' size */ - assertEqualInt(p[4], 7); /* 'UT' flags */ - assertEqualInt(i4(p + 5), t); /* 'UT' mtime */ - p = p + 9; - assertEqualInt(i2(p), 0x7875); /* 'ux' extension header */ - assertEqualInt(i2(p + 2), 0); /* 'ux' size */ - p = p + 4; - - /* Verify local header of file entry. */ - q = buff; - assertEqualMem(q, "PK\003\004", 4); /* Signature */ - assertEqualInt(i2(q + 4), 20); /* Version needed to extract */ - assertEqualInt(i2(q + 6), 8); /* Flags */ - assertEqualInt(i2(q + 8), 0); /* Compression method */ - assertEqualInt(i2(q + 10), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ - assertEqualInt(i2(q + 12), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ - assertEqualInt(i4(q + 14), 0); /* CRC-32 */ - assertEqualInt(i4(q + 18), sizeof(file_data1) + sizeof(file_data2)); /* Compressed size */ - assertEqualInt(i4(q + 22), sizeof(file_data1) + sizeof(file_data2)); /* Uncompressed size */ - assertEqualInt(i2(q + 26), strlen(file_name)); /* Pathname length */ - assertEqualInt(i2(q + 28), 32); /* Extra field length */ - assertEqualMem(q + 30, file_name, strlen(file_name)); /* Pathname */ - q = q + 30 + strlen(file_name); - assertEqualInt(i2(q), 0x5455); /* 'UT' extension header */ - assertEqualInt(i2(q + 2), 13); /* 'UT' size */ - assertEqualInt(q[4], 7); /* 'UT' flags */ - assertEqualInt(i4(q + 5), t); /* 'UT' mtime */ - assertEqualInt(i4(q + 9), t); /* 'UT' atime */ - assertEqualInt(i4(q + 13), t); /* 'UT' ctime */ - q = q + 17; - assertEqualInt(i2(q), 0x7875); /* 'ux' extension header */ - assertEqualInt(i2(q + 2), 11); /* 'ux' size */ - assertEqualInt(q[4], 1); /* 'ux' version */ - assertEqualInt(q[5], 4); /* 'ux' uid size */ - assertEqualInt(i4(q + 6), file_uid); /* 'Ux' UID */ - assertEqualInt(q[10], 4); /* 'ux' gid size */ - assertEqualInt(i4(q + 11), file_gid); /* 'Ux' GID */ - q = q + 15; - - /* Verify data of file entry. */ - assertEqualMem(q, file_data1, sizeof(file_data1)); - assertEqualMem(q + sizeof(file_data1), file_data2, sizeof(file_data2)); - q = q + sizeof(file_data1) + sizeof(file_data2); - - /* Verify data descriptor of file entry. */ - assertEqualMem(q, "PK\007\010", 4); /* Signature */ - assertEqualInt(i4(q + 4), crc); /* CRC-32 */ - assertEqualInt(i4(q + 8), sizeof(file_data1) + sizeof(file_data2)); /* Compressed size */ - assertEqualInt(i4(q + 12), sizeof(file_data1) + sizeof(file_data2)); /* Uncompressed size */ - q = q + 16; - - /* Verify folder entry in central directory. */ - assertEqualMem(p, "PK\001\002", 4); /* Signature */ - assertEqualInt(i2(p + 4), 3 * 256 + 20); /* Version made by */ - assertEqualInt(i2(p + 6), 20); /* Version needed to extract */ - assertEqualInt(i2(p + 8), 8); /* Flags */ - assertEqualInt(i2(p + 10), 0); /* Compression method */ - assertEqualInt(i2(p + 12), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ - assertEqualInt(i2(p + 14), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ - crc = 0; - assertEqualInt(i4(p + 16), crc); /* CRC-32 */ - assertEqualInt(i4(p + 20), 0); /* Compressed size */ - assertEqualInt(i4(p + 24), 0); /* Uncompressed size */ - assertEqualInt(i2(p + 28), strlen(folder_name)); /* Pathname length */ - assertEqualInt(i2(p + 30), 13); /* Extra field length */ - assertEqualInt(i2(p + 32), 0); /* File comment length */ - assertEqualInt(i2(p + 34), 0); /* Disk number start */ - assertEqualInt(i2(p + 36), 0); /* Internal file attrs */ - assertEqualInt(i4(p + 38) >> 16 & 01777, folder_perm); /* External file attrs */ - assertEqualInt(i4(p + 42), q - buff); /* Offset of local header */ - assertEqualMem(p + 46, folder_name, strlen(folder_name)); /* Pathname */ - p = p + 46 + strlen(folder_name); - assertEqualInt(i2(p), 0x5455); /* 'UT' extension header */ - assertEqualInt(i2(p + 2), 5); /* 'UT' size */ - assertEqualInt(p[4], 7); /* 'UT' flags */ - assertEqualInt(i4(p + 5), t); /* 'UT' mtime */ - p = p + 9; - assertEqualInt(i2(p), 0x7875); /* 'ux' extension header */ - assertEqualInt(i2(p + 2), 0); /* 'ux' size */ - /*p = p + 4;*/ - - /* Verify local header of folder entry. */ - assertEqualMem(q, "PK\003\004", 4); /* Signature */ - assertEqualInt(i2(q + 4), 20); /* Version needed to extract */ - assertEqualInt(i2(q + 6), 8); /* Flags */ - assertEqualInt(i2(q + 8), 0); /* Compression method */ - assertEqualInt(i2(q + 10), (tm->tm_hour * 2048) + (tm->tm_min * 32) + (tm->tm_sec / 2)); /* File time */ - assertEqualInt(i2(q + 12), ((tm->tm_year - 80) * 512) + ((tm->tm_mon + 1) * 32) + tm->tm_mday); /* File date */ - assertEqualInt(i4(q + 14), 0); /* CRC-32 */ - assertEqualInt(i4(q + 18), 0); /* Compressed size */ - assertEqualInt(i4(q + 22), 0); /* Uncompressed size */ - assertEqualInt(i2(q + 26), strlen(folder_name)); /* Pathname length */ - assertEqualInt(i2(q + 28), 32); /* Extra field length */ - assertEqualMem(q + 30, folder_name, strlen(folder_name)); /* Pathname */ - q = q + 30 + strlen(folder_name); - assertEqualInt(i2(q), 0x5455); /* 'UT' extension header */ - assertEqualInt(i2(q + 2), 13); /* 'UT' size */ - assertEqualInt(q[4], 7); /* 'UT' flags */ - assertEqualInt(i4(q + 5), t); /* 'UT' mtime */ - assertEqualInt(i4(q + 9), t); /* 'UT' atime */ - assertEqualInt(i4(q + 13), t); /* 'UT' ctime */ - q = q + 17; - assertEqualInt(i2(q), 0x7875); /* 'ux' extension header */ - assertEqualInt(i2(q + 2), 11); /* 'ux' size */ - assertEqualInt(q[4], 1); /* 'ux' version */ - assertEqualInt(q[5], 4); /* 'ux' uid size */ - assertEqualInt(i4(q + 6), folder_uid); /* 'ux' UID */ - assertEqualInt(q[10], 4); /* 'ux' gid size */ - assertEqualInt(i4(q + 11), folder_gid); /* 'ux' GID */ - q = q + 15; - - /* There should not be any data in the folder entry, - * meaning next is the data descriptor header. */ - - /* Verify data descriptor of folder entry. */ - assertEqualMem(q, "PK\007\010", 4); /* Signature */ - assertEqualInt(i4(q + 4), crc); /* CRC-32 */ - assertEqualInt(i4(q + 8), 0); /* Compressed size */ - assertEqualInt(i4(q + 12), 0); /* Uncompressed size */ - /*q = q + 16;*/ -} diff --git a/libarchive/test/test_zip_filename_encoding.c b/libarchive/test/test_zip_filename_encoding.c index 7ee17196f59d..54cd00630b8e 100644 --- a/libarchive/test/test_zip_filename_encoding.c +++ b/libarchive/test/test_zip_filename_encoding.c @@ -27,8 +27,7 @@ __FBSDID("$FreeBSD$"); #include -static void -test_zip_filename_encoding_UTF8(void) +DEFINE_TEST(test_zip_filename_encoding_UTF8) { struct archive *a; struct archive_entry *entry; @@ -116,8 +115,7 @@ test_zip_filename_encoding_UTF8(void) assertEqualMem(buff + 30, "abcABC", 6); } -static void -test_zip_filename_encoding_KOI8R(void) +DEFINE_TEST(test_zip_filename_encoding_KOI8R) { struct archive *a; struct archive_entry *entry; @@ -217,8 +215,7 @@ test_zip_filename_encoding_KOI8R(void) /* * Do not translate CP1251 into CP866 if non Windows platform. */ -static void -test_zip_filename_encoding_ru_RU_CP1251(void) +DEFINE_TEST(test_zip_filename_encoding_ru_RU_CP1251) { struct archive *a; struct archive_entry *entry; @@ -261,8 +258,7 @@ test_zip_filename_encoding_ru_RU_CP1251(void) * into CP866 filenames and store it in the zip file. * Test above behavior works well. */ -static void -test_zip_filename_encoding_Russian_Russia(void) +DEFINE_TEST(test_zip_filename_encoding_Russian_Russia) { struct archive *a; struct archive_entry *entry; @@ -331,8 +327,7 @@ test_zip_filename_encoding_Russian_Russia(void) assertEqualMem(buff + 30, "\xAF\xE0\xA8", 3); } -static void -test_zip_filename_encoding_EUCJP(void) +DEFINE_TEST(test_zip_filename_encoding_EUCJP) { struct archive *a; struct archive_entry *entry; @@ -431,8 +426,7 @@ test_zip_filename_encoding_EUCJP(void) assertEqualMem(buff + 30, "abcABC", 6); } -static void -test_zip_filename_encoding_CP932(void) +DEFINE_TEST(test_zip_filename_encoding_CP932) { struct archive *a; struct archive_entry *entry; @@ -531,13 +525,3 @@ test_zip_filename_encoding_CP932(void) assertEqualInt(0, buff[7]); assertEqualMem(buff + 30, "abcABC", 6); } - -DEFINE_TEST(test_zip_filename_encoding) -{ - test_zip_filename_encoding_UTF8(); - test_zip_filename_encoding_KOI8R(); - test_zip_filename_encoding_ru_RU_CP1251(); - test_zip_filename_encoding_Russian_Russia(); - test_zip_filename_encoding_EUCJP(); - test_zip_filename_encoding_CP932(); -} diff --git a/libarchive/xxhash.c b/libarchive/xxhash.c new file mode 100644 index 000000000000..d7f8e96de6fb --- /dev/null +++ b/libarchive/xxhash.c @@ -0,0 +1,514 @@ +/* +xxHash - Fast Hash algorithm +Copyright (C) 2012-2014, Yann Collet. +BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php) + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + +* Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +* 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 COPYRIGHT HOLDERS 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 COPYRIGHT +OWNER 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. + +You can contact the author at : +- xxHash source repository : http://code.google.com/p/xxhash/ +*/ +#include +#include + +#include "archive_platform.h" +#include "archive_xxhash.h" + +#ifdef HAVE_LIBLZ4 + +/*************************************** +** Tuning parameters +****************************************/ +/* Unaligned memory access is automatically enabled for "common" CPU, such as x86. +** For others CPU, the compiler will be more cautious, and insert extra code to ensure aligned access is respected. +** If you know your target CPU supports unaligned memory access, you want to force this option manually to improve performance. +** You can also enable this parameter if you know your input data will always be aligned (boundaries of 4, for U32). +*/ +#if defined(__ARM_FEATURE_UNALIGNED) || defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) +# define XXH_USE_UNALIGNED_ACCESS 1 +#endif + +/* XXH_ACCEPT_NULL_INPUT_POINTER : +** If the input pointer is a null pointer, xxHash default behavior is to trigger a memory access error, since it is a bad pointer. +** When this option is enabled, xxHash output for null input pointers will be the same as a null-length input. +** This option has a very small performance cost (only measurable on small inputs). +** By default, this option is disabled. To enable it, uncomment below define : +** #define XXH_ACCEPT_NULL_INPUT_POINTER 1 + +** XXH_FORCE_NATIVE_FORMAT : +** By default, xxHash library provides endian-independent Hash values, based on little-endian convention. +** Results are therefore identical for little-endian and big-endian CPU. +** This comes at a performance cost for big-endian CPU, since some swapping is required to emulate little-endian format. +** Should endian-independance be of no importance for your application, you may set the #define below to 1. +** It will improve speed for Big-endian CPU. +** This option has no impact on Little_Endian CPU. +*/ +#define XXH_FORCE_NATIVE_FORMAT 0 + +/*************************************** +** Compiler Specific Options +****************************************/ +/* Disable some Visual warning messages */ +#ifdef _MSC_VER /* Visual Studio */ +# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */ +#endif + +#ifdef _MSC_VER /* Visual Studio */ +# define FORCE_INLINE __forceinline +#else +# ifdef __GNUC__ +# define FORCE_INLINE inline __attribute__((always_inline)) +# else +# define FORCE_INLINE inline +# endif +#endif + +/*************************************** +** Includes & Memory related functions +****************************************/ +#define XXH_malloc malloc +#define XXH_free free +#define XXH_memcpy memcpy + + +static unsigned int XXH32 (const void*, unsigned int, unsigned int); +static void* XXH32_init (unsigned int); +static XXH_errorcode XXH32_update (void*, const void*, unsigned int); +static unsigned int XXH32_digest (void*); +/*static int XXH32_sizeofState(void);*/ +static XXH_errorcode XXH32_resetState(void*, unsigned int); +#define XXH32_SIZEOFSTATE 48 +typedef struct { long long ll[(XXH32_SIZEOFSTATE+(sizeof(long long)-1))/sizeof(long long)]; } XXH32_stateSpace_t; +static unsigned int XXH32_intermediateDigest (void*); + +/*************************************** +** Basic Types +****************************************/ +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */ +# include + typedef uint8_t BYTE; + typedef uint16_t U16; + typedef uint32_t U32; + typedef int32_t S32; + typedef uint64_t U64; +#else + typedef unsigned char BYTE; + typedef unsigned short U16; + typedef unsigned int U32; + typedef signed int S32; + typedef unsigned long long U64; +#endif + +#if defined(__GNUC__) && !defined(XXH_USE_UNALIGNED_ACCESS) +# define _PACKED __attribute__ ((packed)) +#else +# define _PACKED +#endif + +#if !defined(XXH_USE_UNALIGNED_ACCESS) && !defined(__GNUC__) +# ifdef __IBMC__ +# pragma pack(1) +# else +# pragma pack(push, 1) +# endif +#endif + +typedef struct _U32_S { U32 v; } _PACKED U32_S; + +#if !defined(XXH_USE_UNALIGNED_ACCESS) && !defined(__GNUC__) +# pragma pack(pop) +#endif + +#define A32(x) (((const U32_S *)(x))->v) + + +/**************************************** +** Compiler-specific Functions and Macros +*****************************************/ +#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__) + +/* Note : although _rotl exists for minGW (GCC under windows), performance seems poor */ +#if defined(_MSC_VER) +# define XXH_rotl32(x,r) _rotl(x,r) +#else +# define XXH_rotl32(x,r) ((x << r) | (x >> (32 - r))) +#endif + +#if defined(_MSC_VER) /* Visual Studio */ +# define XXH_swap32 _byteswap_ulong +#elif GCC_VERSION >= 403 +# define XXH_swap32 __builtin_bswap32 +#else +static inline U32 XXH_swap32 (U32 x) { + return ((x << 24) & 0xff000000 ) | + ((x << 8) & 0x00ff0000 ) | + ((x >> 8) & 0x0000ff00 ) | + ((x >> 24) & 0x000000ff );} +#endif + + +/*************************************** +** Constants +****************************************/ +#define PRIME32_1 2654435761U +#define PRIME32_2 2246822519U +#define PRIME32_3 3266489917U +#define PRIME32_4 668265263U +#define PRIME32_5 374761393U + + +/*************************************** +** Architecture Macros +****************************************/ +typedef enum { XXH_bigEndian=0, XXH_littleEndian=1 } XXH_endianess; +#ifndef XXH_CPU_LITTLE_ENDIAN /* It is possible to define XXH_CPU_LITTLE_ENDIAN externally, for example using a compiler switch */ + static const int one = 1; +# define XXH_CPU_LITTLE_ENDIAN (*(const char*)(&one)) +#endif + + +/*************************************** +** Macros +****************************************/ +#define XXH_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(!!(c)) }; } /* use only *after* variable declarations */ + + +/***************************** +** Memory reads +******************************/ +typedef enum { XXH_aligned, XXH_unaligned } XXH_alignment; + +static +FORCE_INLINE U32 XXH_readLE32_align(const U32* ptr, XXH_endianess endian, XXH_alignment align) +{ + if (align==XXH_unaligned) + return endian==XXH_littleEndian ? A32(ptr) : XXH_swap32(A32(ptr)); + else + return endian==XXH_littleEndian ? *ptr : XXH_swap32(*ptr); +} + +static +FORCE_INLINE U32 XXH_readLE32(const U32* ptr, XXH_endianess endian) { return XXH_readLE32_align(ptr, endian, XXH_unaligned); } + + +/***************************** +** Simple Hash Functions +******************************/ +static +FORCE_INLINE U32 XXH32_endian_align(const void* input, unsigned int len, U32 seed, XXH_endianess endian, XXH_alignment align) +{ + const BYTE* p = (const BYTE*)input; + const BYTE* bEnd = p + len; + U32 h32; +#define XXH_get32bits(p) XXH_readLE32_align((const U32*)p, endian, align) + +#ifdef XXH_ACCEPT_NULL_INPUT_POINTER + if (p==NULL) { len=0; bEnd=p=(const BYTE*)(size_t)16; } +#endif + + if (len>=16) + { + const BYTE* const limit = bEnd - 16; + U32 v1 = seed + PRIME32_1 + PRIME32_2; + U32 v2 = seed + PRIME32_2; + U32 v3 = seed + 0; + U32 v4 = seed - PRIME32_1; + + do + { + v1 += XXH_get32bits(p) * PRIME32_2; v1 = XXH_rotl32(v1, 13); v1 *= PRIME32_1; p+=4; + v2 += XXH_get32bits(p) * PRIME32_2; v2 = XXH_rotl32(v2, 13); v2 *= PRIME32_1; p+=4; + v3 += XXH_get32bits(p) * PRIME32_2; v3 = XXH_rotl32(v3, 13); v3 *= PRIME32_1; p+=4; + v4 += XXH_get32bits(p) * PRIME32_2; v4 = XXH_rotl32(v4, 13); v4 *= PRIME32_1; p+=4; + } while (p<=limit); + + h32 = XXH_rotl32(v1, 1) + XXH_rotl32(v2, 7) + XXH_rotl32(v3, 12) + XXH_rotl32(v4, 18); + } + else + { + h32 = seed + PRIME32_5; + } + + h32 += (U32) len; + + while (p<=bEnd-4) + { + h32 += XXH_get32bits(p) * PRIME32_3; + h32 = XXH_rotl32(h32, 17) * PRIME32_4 ; + p+=4; + } + + while (p> 15; + h32 *= PRIME32_2; + h32 ^= h32 >> 13; + h32 *= PRIME32_3; + h32 ^= h32 >> 16; + + return h32; +} + + +U32 XXH32(const void* input, unsigned int len, U32 seed) +{ +#if 0 + // Simple version, good for code maintenance, but unfortunately slow for small inputs + void* state = XXH32_init(seed); + XXH32_update(state, input, len); + return XXH32_digest(state); +#else + XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; + +# if !defined(XXH_USE_UNALIGNED_ACCESS) + if ((((size_t)input) & 3) == 0) /* Input is aligned, let's leverage the speed advantage */ + { + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_aligned); + else + return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_aligned); + } +# endif + + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH32_endian_align(input, len, seed, XXH_littleEndian, XXH_unaligned); + else + return XXH32_endian_align(input, len, seed, XXH_bigEndian, XXH_unaligned); +#endif +} + +/***************************** +** Advanced Hash Functions +******************************/ + +struct XXH_state32_t +{ + U64 total_len; + U32 seed; + U32 v1; + U32 v2; + U32 v3; + U32 v4; + int memsize; + char memory[16]; +}; + +#if 0 +static +int XXH32_sizeofState(void) +{ + XXH_STATIC_ASSERT(XXH32_SIZEOFSTATE >= sizeof(struct XXH_state32_t)); /* A compilation error here means XXH32_SIZEOFSTATE is not large enough */ + return sizeof(struct XXH_state32_t); +} +#endif + +static +XXH_errorcode XXH32_resetState(void* state_in, U32 seed) +{ + struct XXH_state32_t * state = (struct XXH_state32_t *) state_in; + state->seed = seed; + state->v1 = seed + PRIME32_1 + PRIME32_2; + state->v2 = seed + PRIME32_2; + state->v3 = seed + 0; + state->v4 = seed - PRIME32_1; + state->total_len = 0; + state->memsize = 0; + return XXH_OK; +} + +static +void* XXH32_init (U32 seed) +{ + void* state = XXH_malloc (sizeof(struct XXH_state32_t)); + XXH32_resetState(state, seed); + return state; +} + +static +FORCE_INLINE XXH_errorcode XXH32_update_endian (void* state_in, const void* input, int len, XXH_endianess endian) +{ + struct XXH_state32_t * state = (struct XXH_state32_t *) state_in; + const BYTE* p = (const BYTE*)input; + const BYTE* const bEnd = p + len; + +#ifdef XXH_ACCEPT_NULL_INPUT_POINTER + if (input==NULL) return XXH_ERROR; +#endif + + state->total_len += len; + + if (state->memsize + len < 16) /* fill in tmp buffer */ + { + XXH_memcpy(state->memory + state->memsize, input, len); + state->memsize += len; + return XXH_OK; + } + + if (state->memsize) /* some data left from previous update */ + { + XXH_memcpy(state->memory + state->memsize, input, 16-state->memsize); + { + const U32* p32 = (const U32*)state->memory; + state->v1 += XXH_readLE32(p32, endian) * PRIME32_2; state->v1 = XXH_rotl32(state->v1, 13); state->v1 *= PRIME32_1; p32++; + state->v2 += XXH_readLE32(p32, endian) * PRIME32_2; state->v2 = XXH_rotl32(state->v2, 13); state->v2 *= PRIME32_1; p32++; + state->v3 += XXH_readLE32(p32, endian) * PRIME32_2; state->v3 = XXH_rotl32(state->v3, 13); state->v3 *= PRIME32_1; p32++; + state->v4 += XXH_readLE32(p32, endian) * PRIME32_2; state->v4 = XXH_rotl32(state->v4, 13); state->v4 *= PRIME32_1; p32++; + } + p += 16-state->memsize; + state->memsize = 0; + } + + if (p <= bEnd-16) + { + const BYTE* const limit = bEnd - 16; + U32 v1 = state->v1; + U32 v2 = state->v2; + U32 v3 = state->v3; + U32 v4 = state->v4; + + do + { + v1 += XXH_readLE32((const U32*)p, endian) * PRIME32_2; v1 = XXH_rotl32(v1, 13); v1 *= PRIME32_1; p+=4; + v2 += XXH_readLE32((const U32*)p, endian) * PRIME32_2; v2 = XXH_rotl32(v2, 13); v2 *= PRIME32_1; p+=4; + v3 += XXH_readLE32((const U32*)p, endian) * PRIME32_2; v3 = XXH_rotl32(v3, 13); v3 *= PRIME32_1; p+=4; + v4 += XXH_readLE32((const U32*)p, endian) * PRIME32_2; v4 = XXH_rotl32(v4, 13); v4 *= PRIME32_1; p+=4; + } while (p<=limit); + + state->v1 = v1; + state->v2 = v2; + state->v3 = v3; + state->v4 = v4; + } + + if (p < bEnd) + { + XXH_memcpy(state->memory, p, bEnd-p); + state->memsize = (int)(bEnd-p); + } + + return XXH_OK; +} + +static +XXH_errorcode XXH32_update (void* state_in, const void* input, unsigned int len) +{ + XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; + + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH32_update_endian(state_in, input, len, XXH_littleEndian); + else + return XXH32_update_endian(state_in, input, len, XXH_bigEndian); +} + + + +static +FORCE_INLINE U32 XXH32_intermediateDigest_endian (void* state_in, XXH_endianess endian) +{ + struct XXH_state32_t * state = (struct XXH_state32_t *) state_in; + const BYTE * p = (const BYTE*)state->memory; + BYTE* bEnd = (BYTE*)state->memory + state->memsize; + U32 h32; + + if (state->total_len >= 16) + { + h32 = XXH_rotl32(state->v1, 1) + XXH_rotl32(state->v2, 7) + XXH_rotl32(state->v3, 12) + XXH_rotl32(state->v4, 18); + } + else + { + h32 = state->seed + PRIME32_5; + } + + h32 += (U32) state->total_len; + + while (p<=bEnd-4) + { + h32 += XXH_readLE32((const U32*)p, endian) * PRIME32_3; + h32 = XXH_rotl32(h32, 17) * PRIME32_4; + p+=4; + } + + while (p> 15; + h32 *= PRIME32_2; + h32 ^= h32 >> 13; + h32 *= PRIME32_3; + h32 ^= h32 >> 16; + + return h32; +} + +static +U32 XXH32_intermediateDigest (void* state_in) +{ + XXH_endianess endian_detected = (XXH_endianess)XXH_CPU_LITTLE_ENDIAN; + + if ((endian_detected==XXH_littleEndian) || XXH_FORCE_NATIVE_FORMAT) + return XXH32_intermediateDigest_endian(state_in, XXH_littleEndian); + else + return XXH32_intermediateDigest_endian(state_in, XXH_bigEndian); +} + +static +U32 XXH32_digest (void* state_in) +{ + U32 h32 = XXH32_intermediateDigest(state_in); + + XXH_free(state_in); + + return h32; +} + +const +struct archive_xxhash __archive_xxhash = { + XXH32, + XXH32_init, + XXH32_update, + XXH32_digest +}; +#else + +/* + * Define an empty version of the struct if we aren't using the LZ4 library. + */ +const +struct archive_xxhash __archive_xxhash = { + NULL, + NULL, + NULL, + NULL +}; + +#endif /* HAVE_LIBLZ4 */ diff --git a/libarchive_fe/err.c b/libarchive_fe/err.c index a0173983a39c..8618a94ea5d5 100644 --- a/libarchive_fe/err.c +++ b/libarchive_fe/err.c @@ -44,6 +44,30 @@ static void lafe_vwarnc(int, const char *, va_list) __LA_PRINTFLIKE(2, 0); const char *lafe_progname; +const char * +lafe_getprogname(void) +{ + + return lafe_progname; +} + +void +lafe_setprogname(const char *name, const char *defaultname) +{ + + if (name == NULL) + name = defaultname; +#if defined(_WIN32) && !defined(__CYGWIN__) + lafe_progname = strrchr(name, '\\'); + if (strrchr(name, '/') > lafe_progname) +#endif + lafe_progname = strrchr(name, '/'); + if (lafe_progname != NULL) + lafe_progname++; + else + lafe_progname = name; +} + static void lafe_vwarnc(int code, const char *fmt, va_list ap) { diff --git a/libarchive_fe/err.h b/libarchive_fe/err.h index ca1af35630e2..ebf5de814f5e 100644 --- a/libarchive_fe/err.h +++ b/libarchive_fe/err.h @@ -40,10 +40,11 @@ #define __LA_PRINTFLIKE(f,a) #endif -extern const char *lafe_progname; - void lafe_warnc(int code, const char *fmt, ...) __LA_PRINTFLIKE(2, 3); void lafe_errc(int eval, int code, const char *fmt, ...) __LA_DEAD __LA_PRINTFLIKE(3, 4); +const char * lafe_getprogname(void); +void lafe_setprogname(const char *name, const char *defaultname); + #endif diff --git a/libarchive_fe/passphrase.c b/libarchive_fe/passphrase.c new file mode 100644 index 000000000000..1eae0b888bcd --- /dev/null +++ b/libarchive_fe/passphrase.c @@ -0,0 +1,317 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * 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. + */ +/* $OpenBSD: readpassphrase.c,v 1.22 2010/01/13 10:20:54 dtucker Exp $ */ +/* + * Copyright (c) 2000-2002, 2007 Todd C. Miller + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + * Sponsored in part by the Defense Advanced Research Projects + * Agency (DARPA) and Air Force Research Laboratory, Air Force + * Materiel Command, USAF, under agreement number F39502-99-1-0512. + */ + +/* OPENBSD ORIGINAL: lib/libc/gen/readpassphrase.c */ + + +#include "lafe_platform.h" +__FBSDID("$FreeBSD$"); + +#include +#ifdef HAVE_STDLIB_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_READPASSPHRASE_H +#include +#endif + +#include "err.h" +#include "passphrase.h" + +#ifndef HAVE_READPASSPHRASE + +#define RPP_ECHO_OFF 0x00 /* Turn off echo (default). */ +#define RPP_ECHO_ON 0x01 /* Leave echo on. */ +#define RPP_REQUIRE_TTY 0x02 /* Fail if there is no tty. */ +#define RPP_FORCELOWER 0x04 /* Force input to lower case. */ +#define RPP_FORCEUPPER 0x08 /* Force input to upper case. */ +#define RPP_SEVENBIT 0x10 /* Strip the high bit from input. */ +#define RPP_STDIN 0x20 /* Read from stdin, not /dev/tty */ + + +#if defined(_WIN32) && !defined(__CYGWIN__) +#include + +static char * +readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) +{ + HANDLE hStdin, hStdout; + DWORD mode, rbytes; + BOOL success; + + (void)flags; + + hStdin = GetStdHandle(STD_INPUT_HANDLE); + if (hStdin == INVALID_HANDLE_VALUE) + return (NULL); + hStdout = GetStdHandle(STD_OUTPUT_HANDLE); + if (hStdout == INVALID_HANDLE_VALUE) + return (NULL); + + success = GetConsoleMode(hStdin, &mode); + if (!success) + return (NULL); + mode &= ~ENABLE_ECHO_INPUT; + mode |= ENABLE_LINE_INPUT | ENABLE_PROCESSED_INPUT; + success = SetConsoleMode(hStdin, mode); + if (!success) + return (NULL); + + success = WriteFile(hStdout, prompt, (DWORD)strlen(prompt), + NULL, NULL); + if (!success) + return (NULL); + success = ReadFile(hStdin, buf, (DWORD)bufsiz - 1, &rbytes, NULL); + if (!success) + return (NULL); + WriteFile(hStdout, "\r\n", 2, NULL, NULL); + buf[rbytes] = '\0'; + /* Remove trailing carriage return(s). */ + if (rbytes > 2 && buf[rbytes - 2] == '\r' && buf[rbytes - 1] == '\n') + buf[rbytes - 2] = '\0'; + + return (buf); +} + +#else /* _WIN32 && !__CYGWIN__ */ + +#include +#include +#include +#include +#ifdef HAVE_PATHS_H +#include +#endif +#include +#include + +#ifdef TCSASOFT +# define _T_FLUSH (TCSAFLUSH|TCSASOFT) +#else +# define _T_FLUSH (TCSAFLUSH) +#endif + +/* SunOS 4.x which lacks _POSIX_VDISABLE, but has VDISABLE */ +#if !defined(_POSIX_VDISABLE) && defined(VDISABLE) +# define _POSIX_VDISABLE VDISABLE +#endif + +static volatile sig_atomic_t *signo; + +static void +handler(int s) +{ + signo[s] = 1; +} + +static char * +readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags) +{ + ssize_t nr; + int input, output, save_errno, i, need_restart; + char ch, *p, *end; + struct termios term, oterm; + struct sigaction sa, savealrm, saveint, savehup, savequit, saveterm; + struct sigaction savetstp, savettin, savettou, savepipe; + + /* I suppose we could alloc on demand in this case (XXX). */ + if (bufsiz == 0) { + errno = EINVAL; + return(NULL); + } + + if (signo == NULL) { + signo = calloc(SIGRTMAX, sizeof(sig_atomic_t)); + } + +restart: + for (i = 0; i < SIGRTMAX; i++) + signo[i] = 0; + nr = -1; + save_errno = 0; + need_restart = 0; + /* + * Read and write to /dev/tty if available. If not, read from + * stdin and write to stderr unless a tty is required. + */ + if ((flags & RPP_STDIN) || + (input = output = open(_PATH_TTY, O_RDWR)) == -1) { + if (flags & RPP_REQUIRE_TTY) { + errno = ENOTTY; + return(NULL); + } + input = STDIN_FILENO; + output = STDERR_FILENO; + } + + /* + * Catch signals that would otherwise cause the user to end + * up with echo turned off in the shell. Don't worry about + * things like SIGXCPU and SIGVTALRM for now. + */ + sigemptyset(&sa.sa_mask); + sa.sa_flags = 0; /* don't restart system calls */ + sa.sa_handler = handler; + (void)sigaction(SIGALRM, &sa, &savealrm); + (void)sigaction(SIGHUP, &sa, &savehup); + (void)sigaction(SIGINT, &sa, &saveint); + (void)sigaction(SIGPIPE, &sa, &savepipe); + (void)sigaction(SIGQUIT, &sa, &savequit); + (void)sigaction(SIGTERM, &sa, &saveterm); + (void)sigaction(SIGTSTP, &sa, &savetstp); + (void)sigaction(SIGTTIN, &sa, &savettin); + (void)sigaction(SIGTTOU, &sa, &savettou); + + /* Turn off echo if possible. */ + if (input != STDIN_FILENO && tcgetattr(input, &oterm) == 0) { + memcpy(&term, &oterm, sizeof(term)); + if (!(flags & RPP_ECHO_ON)) + term.c_lflag &= ~(ECHO | ECHONL); +#ifdef VSTATUS + if (term.c_cc[VSTATUS] != _POSIX_VDISABLE) + term.c_cc[VSTATUS] = _POSIX_VDISABLE; +#endif + (void)tcsetattr(input, _T_FLUSH, &term); + } else { + memset(&term, 0, sizeof(term)); + term.c_lflag |= ECHO; + memset(&oterm, 0, sizeof(oterm)); + oterm.c_lflag |= ECHO; + } + + /* No I/O if we are already backgrounded. */ + if (signo[SIGTTOU] != 1 && signo[SIGTTIN] != 1) { + if (!(flags & RPP_STDIN)) { + int r = write(output, prompt, strlen(prompt)); + (void)r; + } + end = buf + bufsiz - 1; + p = buf; + while ((nr = read(input, &ch, 1)) == 1 && ch != '\n' && ch != '\r') { + if (p < end) { + if ((flags & RPP_SEVENBIT)) + ch &= 0x7f; + if (isalpha(ch)) { + if ((flags & RPP_FORCELOWER)) + ch = (char)tolower(ch); + if ((flags & RPP_FORCEUPPER)) + ch = (char)toupper(ch); + } + *p++ = ch; + } + } + *p = '\0'; + save_errno = errno; + if (!(term.c_lflag & ECHO)) { + int r = write(output, "\n", 1); + (void)r; + } + } + + /* Restore old terminal settings and signals. */ + if (memcmp(&term, &oterm, sizeof(term)) != 0) { + while (tcsetattr(input, _T_FLUSH, &oterm) == -1 && + errno == EINTR) + continue; + } + (void)sigaction(SIGALRM, &savealrm, NULL); + (void)sigaction(SIGHUP, &savehup, NULL); + (void)sigaction(SIGINT, &saveint, NULL); + (void)sigaction(SIGQUIT, &savequit, NULL); + (void)sigaction(SIGPIPE, &savepipe, NULL); + (void)sigaction(SIGTERM, &saveterm, NULL); + (void)sigaction(SIGTSTP, &savetstp, NULL); + (void)sigaction(SIGTTIN, &savettin, NULL); + (void)sigaction(SIGTTOU, &savettou, NULL); + if (input != STDIN_FILENO) + (void)close(input); + + /* + * If we were interrupted by a signal, resend it to ourselves + * now that we have restored the signal handlers. + */ + for (i = 0; i < SIGRTMAX; i++) { + if (signo[i]) { + kill(getpid(), i); + switch (i) { + case SIGTSTP: + case SIGTTIN: + case SIGTTOU: + need_restart = 1; + } + } + } + if (need_restart) + goto restart; + + if (save_errno) + errno = save_errno; + return(nr == -1 ? NULL : buf); +} +#endif /* _WIN32 && !__CYGWIN__ */ +#endif /* HAVE_READPASSPHRASE */ + +char * +lafe_readpassphrase(const char *prompt, char *buf, size_t bufsiz) +{ + char *p; + + p = readpassphrase(prompt, buf, bufsiz, RPP_ECHO_OFF); + if (p == NULL) { + switch (errno) { + case EINTR: + break; + default: + lafe_errc(1, errno, "Couldn't read passphrase"); + break; + } + } + return (p); +} + diff --git a/libarchive_fe/passphrase.h b/libarchive_fe/passphrase.h new file mode 100644 index 000000000000..ac7a506364bd --- /dev/null +++ b/libarchive_fe/passphrase.h @@ -0,0 +1,31 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * 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. + */ + +#ifndef LAFE_PASSPHRASE_H +#define LAFE_PASSPHRASE_H + +char *lafe_readpassphrase(const char *prompt, char *buf, size_t bufsiz); + +#endif diff --git a/tar/CMakeLists.txt b/tar/CMakeLists.txt index 46ce58b02e2e..6434791f788f 100644 --- a/tar/CMakeLists.txt +++ b/tar/CMakeLists.txt @@ -20,6 +20,8 @@ IF(ENABLE_TAR) ../libarchive_fe/lafe_platform.h ../libarchive_fe/line_reader.c ../libarchive_fe/line_reader.h + ../libarchive_fe/passphrase.c + ../libarchive_fe/passphrase.h ) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../libarchive_fe) IF(WIN32 AND NOT CYGWIN) @@ -39,7 +41,6 @@ IF(ENABLE_TAR) SET_TARGET_PROPERTIES(bsdtar PROPERTIES COMPILE_DEFINITIONS LIBARCHIVE_STATIC) ENDIF(ENABLE_TAR_SHARED) - GET_TARGET_PROPERTY(BSDTAR bsdtar LOCATION) # Installation rules INSTALL(TARGETS bsdtar RUNTIME DESTINATION bin) diff --git a/tar/bsdtar.1 b/tar/bsdtar.1 index 7bb6a6084d54..9eadaaf885b1 100644 --- a/tar/bsdtar.1 +++ b/tar/bsdtar.1 @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 1, 2012 +.Dd September 16, 2014 .Dt TAR 1 .Os .Sh NAME @@ -184,6 +184,10 @@ but before extracting entries from the archive. to the current directory after processing any .Fl C options and before extracting any files. +.It Fl Fl clear-nochange-fflags +(x mode only) +Before removing file system objects to replace them, clear platform-specific +file flags that might prevent removal. .It Fl Fl disable-copyfile Mac OS X specific. Disable the use of @@ -256,6 +260,10 @@ Show usage. .It Fl Fl hfsCompression (x mode only) Mac OS X specific(v10.6 or later). Compress extracted regular files with HFS+ compression. +.It Fl Fl ignore-zeros +An alias of +.Fl Fl options Cm read_concatenated_archives +for compatibility with GNU tar. .It Fl Fl include Ar pattern Process only files or directories that match the specified pattern. Note that exclusions specified with @@ -314,6 +322,11 @@ Issue a warning message unless all links to each file are archived. Compress the resulting archive with .Xr lrzip 1 . In extract or list modes, this option is ignored. +.It Fl Fl lz4 +(c mode only) +Compress the archive with lz4-compatible compression before writing it. +In input mode, this option is ignored; lz4 compression is recognized +automatically on input. .It Fl Fl lzma (c mode only) Compress the resulting archive with the original LZMA algorithm. Use of this option is discouraged and new archives should be created with @@ -494,6 +507,20 @@ Supported values are bzip2, gzip, lzo (ultra fast), and zpaq (best, extremely slow). .It Cm lrzip:compression-level A decimal integer from 1 to 9 specifying the lrzip compression level. +.It Cm lz4:compression-level +A decimal integer from 1 to 9 specifying the lzop compression level. +.It Cm lz4:stream-checksum +Enable stream checksum. This is by default, use +.Cm lz4:!stream-checksum +to disable. +.It Cm lz4:block-checksum +Enable block checksum (Disabled by default). +.It Cm lz4:block-size +A decimal integer from 4 to 7 specifying the lz4 compression block size +(7 is set by default). +.It Cm lz4:block-dependence +Use the previous block of the block being compressed for +a compression dictionary to improve compression ratio. .It Cm lzop:compression-level A decimal integer from 1 to 9 specifying the lzop compression level. .It Cm xz:compression-level @@ -524,6 +551,21 @@ Use .Ar type as compression method. Supported values are store (uncompressed) and deflate (gzip algorithm). +.It Cm zip:encryption +Enable encryption using traditional zip encryption. +.It Cm zip:encryption Ns = Ns Ar type +Use +.Ar type +as encryption type. +Supported values are zipcrypt (traditional zip encryption), +aes128 (WinZip AES-128 encryption) and aes256 (WinZip AES-256 encryption). +.It Cm read_concatenated_archives +Ignore zeroed blocks in the archive, which occurs when multiple tar archives +have been concatenated together. Without this option, only the contents of +the first concatenated archive would be read. This option is comparable to +the +.Fl i , Fl Fl ignore-zeros +option of GNU tar. .El If a provided option is not supported by any module, that is a fatal error. @@ -549,6 +591,13 @@ is being run by root and can be overridden by also specifying .Fl Fl no-same-owner and .Fl Fl no-same-permissions . +.It Fl Fl passphrase Ar passphrase +The +.Pa passphrase +is used to extract or create an encrypted archive. +Currently, zip is the only supported format that supports encryption. +You shouldn't use this option unless you realize how insecure +use of this option is. .It Fl Fl posix (c, r, u mode only) Synonym for @@ -689,9 +738,9 @@ In list mode, .Nm will produce output similar to that of .Xr ls 1 . -Additional +An additional .Fl v -options will provide additional detail. +option will also provide ls-like details in create and extract mode. .It Fl Fl version Print version of .Nm @@ -823,11 +872,13 @@ An input file in format can be used to create an output archive with arbitrary ownership, permissions, or names that differ from existing data on disk: .Pp -.Dl $ cat input.mtree -.Dl #mtree -.Dl usr/bin uid=0 gid=0 mode=0755 type=dir -.Dl usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls -.Dl $ tar -cvf output.tar @input.mtree +.Bd -literal -offset indent +$ cat input.mtree +#mtree +usr/bin uid=0 gid=0 mode=0755 type=dir +usr/bin/ls uid=0 gid=0 mode=0755 type=file content=myls +$ tar -cvf output.tar @input.mtree +.Ed .Pp The .Fl Fl newer @@ -1115,8 +1166,7 @@ option is specified. There needs to be better support for file selection on both create and extract. .Pp -There is not yet any support for multi-volume archives or for archiving -sparse files. +There is not yet any support for multi-volume archives. .Pp Converting between dissimilar archive formats (such as tar and cpio) using the .Cm @ Ns Pa - diff --git a/tar/bsdtar.c b/tar/bsdtar.c index 47267579f0c4..93bf60a94da8 100644 --- a/tar/bsdtar.c +++ b/tar/bsdtar.c @@ -178,21 +178,8 @@ main(int argc, char **argv) } #endif - - /* Need lafe_progname before calling lafe_warnc. */ - if (*argv == NULL) - lafe_progname = "bsdtar"; - else { -#if defined(_WIN32) && !defined(__CYGWIN__) - lafe_progname = strrchr(*argv, '\\'); - if (strrchr(*argv, '/') > lafe_progname) -#endif - lafe_progname = strrchr(*argv, '/'); - if (lafe_progname != NULL) - lafe_progname++; - else - lafe_progname = *argv; - } + /* Set lafe_progname before calling lafe_warnc. */ + lafe_setprogname(*argv, "bsdtar"); #if HAVE_SETLOCALE if (setlocale(LC_ALL, "") == NULL) @@ -303,6 +290,10 @@ main(int argc, char **argv) case OPTION_CHROOT: /* NetBSD */ bsdtar->option_chroot = 1; break; + case OPTION_CLEAR_NOCHANGE_FFLAGS: + bsdtar->extract_flags |= + ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS; + break; case OPTION_DISABLE_COPYFILE: /* Mac OS X */ bsdtar->readdisk_flags &= ~ARCHIVE_READDISK_MAC_COPYFILE; break; @@ -352,6 +343,9 @@ main(int argc, char **argv) bsdtar->extract_flags |= ARCHIVE_EXTRACT_HFS_COMPRESSION_FORCED; break; + case OPTION_IGNORE_ZEROS: + bsdtar->option_ignore_zeros = 1; + break; case 'I': /* GNU tar */ /* * TODO: Allow 'names' to come from an archive, @@ -407,6 +401,7 @@ main(int argc, char **argv) bsdtar->option_warn_links = 1; break; case OPTION_LRZIP: + case OPTION_LZ4: case OPTION_LZIP: /* GNU tar beginning with 1.23 */ case OPTION_LZMA: /* GNU tar beginning with 1.20 */ case OPTION_LZOP: /* GNU tar beginning with 1.21 */ @@ -417,6 +412,7 @@ main(int argc, char **argv) compression = opt; switch (opt) { case OPTION_LRZIP: compression_name = "lrzip"; break; + case OPTION_LZ4: compression_name = "lz4"; break; case OPTION_LZIP: compression_name = "lzip"; break; case OPTION_LZMA: compression_name = "lzma"; break; case OPTION_LZOP: compression_name = "lzop"; break; @@ -480,6 +476,10 @@ main(int argc, char **argv) bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_FFLAGS; bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_MAC_METADATA; break; + case OPTION_NO_XATTR: /* Issue #131 */ + bsdtar->extract_flags &= ~ARCHIVE_EXTRACT_XATTR; + bsdtar->readdisk_flags |= ARCHIVE_READDISK_NO_XATTR; + break; case OPTION_NULL: /* GNU tar */ bsdtar->option_null++; break; @@ -557,6 +557,9 @@ main(int argc, char **argv) bsdtar->extract_flags |= ARCHIVE_EXTRACT_FFLAGS; bsdtar->extract_flags |= ARCHIVE_EXTRACT_MAC_METADATA; break; + case OPTION_PASSPHRASE: + bsdtar->passphrase = bsdtar->argument; + break; case OPTION_POSIX: /* GNU tar */ cset_set_format(bsdtar->cset, "pax"); break; @@ -712,6 +715,8 @@ main(int argc, char **argv) only_mode(bsdtar, "--nopreserveHFSCompression", "x"); if (bsdtar->readdisk_flags & ARCHIVE_READDISK_HONOR_NODUMP) only_mode(bsdtar, "--nodump", "cru"); + if (bsdtar->readdisk_flags & ARCHIVE_READDISK_NO_XATTR) + only_mode(bsdtar, "--no-xattr", "crux"); if (option_o > 0) { switch (bsdtar->mode) { case 'c': @@ -810,6 +815,7 @@ main(int argc, char **argv) cleanup_substitution(bsdtar); #endif cset_free(bsdtar->cset); + passphrase_free(bsdtar->ppbuff); if (bsdtar->return_value != 0) lafe_warnc(0, @@ -844,7 +850,7 @@ usage(void) { const char *p; - p = lafe_progname; + p = lafe_getprogname(); fprintf(stderr, "Usage:\n"); fprintf(stderr, " List: %s -tf \n", p); @@ -859,7 +865,7 @@ version(void) { printf("bsdtar %s - %s\n", BSDTAR_VERSION_STRING, - archive_version_string()); + archive_version_details()); exit(0); } @@ -904,7 +910,7 @@ long_help(void) const char *prog; const char *p; - prog = lafe_progname; + prog = lafe_getprogname(); fflush(stderr); diff --git a/tar/bsdtar.h b/tar/bsdtar.h index 637e1b9d4fee..4b84ba18ab46 100644 --- a/tar/bsdtar.h +++ b/tar/bsdtar.h @@ -57,12 +57,14 @@ struct bsdtar { const char *gname; /* --gname */ int uid; /* --uid */ const char *uname; /* --uname */ + const char *passphrase; /* --passphrase */ char mode; /* Program mode: 'c', 't', 'r', 'u', 'x' */ char symlink_mode; /* H or L, per BSD conventions */ char option_absolute_paths; /* -P */ char option_chroot; /* --chroot */ char option_fast_read; /* --fast-read */ const char *option_options; /* --options */ + char option_ignore_zeros; /* --ignore-zeros */ char option_interactive; /* -w */ char option_no_owner; /* -o */ char option_no_subdirs; /* -n */ @@ -109,6 +111,7 @@ struct bsdtar { struct name_cache *uname_cache; /* for write.c */ struct siginfo_data *siginfo; /* for siginfo.c */ struct substitution *substitution; /* for subst.c */ + char *ppbuff; /* for util.c */ }; /* Fake short equivalents for long options that otherwise lack them. */ @@ -116,6 +119,7 @@ enum { OPTION_B64ENCODE = 1, OPTION_CHECK_LINKS, OPTION_CHROOT, + OPTION_CLEAR_NOCHANGE_FFLAGS, OPTION_DISABLE_COPYFILE, OPTION_EXCLUDE, OPTION_FORMAT, @@ -124,9 +128,11 @@ enum { OPTION_GRZIP, OPTION_HELP, OPTION_HFS_COMPRESSION, + OPTION_IGNORE_ZEROS, OPTION_INCLUDE, OPTION_KEEP_NEWER_FILES, OPTION_LRZIP, + OPTION_LZ4, OPTION_LZIP, OPTION_LZMA, OPTION_LZOP, @@ -138,6 +144,7 @@ enum { OPTION_NOPRESERVE_HFS_COMPRESSION, OPTION_NO_SAME_OWNER, OPTION_NO_SAME_PERMISSIONS, + OPTION_NO_XATTR, OPTION_NULL, OPTION_NUMERIC_OWNER, OPTION_OLDER_CTIME, @@ -146,6 +153,7 @@ enum { OPTION_OLDER_MTIME_THAN, OPTION_ONE_FILE_SYSTEM, OPTION_OPTIONS, + OPTION_PASSPHRASE, OPTION_POSIX, OPTION_SAME_OWNER, OPTION_STRIP_COMPONENTS, @@ -191,3 +199,7 @@ void cset_set_format(struct creation_set *, const char *); int cset_write_add_filters(struct creation_set *, struct archive *, const void **); +const char * passphrase_callback(struct archive *, void *); +void passphrase_free(char *); +void list_item_verbose(struct bsdtar *, FILE *, + struct archive_entry *); diff --git a/tar/bsdtar_platform.h b/tar/bsdtar_platform.h index 45228f504f84..e73f9828b3b0 100644 --- a/tar/bsdtar_platform.h +++ b/tar/bsdtar_platform.h @@ -42,6 +42,10 @@ #include "config.h" #endif +#if defined(_WIN32) && !defined(__CYGWIN__) +#include "bsdtar_windows.h" +#endif + /* Get a real definition for __FBSDID if we can */ #if HAVE_SYS_CDEFS_H #include @@ -125,8 +129,4 @@ #define __LA_DEAD #endif -#if defined(_WIN32) && !defined(__CYGWIN__) -#include "bsdtar_windows.h" -#endif - #endif /* !BSDTAR_PLATFORM_H_INCLUDED */ diff --git a/tar/bsdtar_windows.h b/tar/bsdtar_windows.h index f0611d79abdc..308ad1107bef 100644 --- a/tar/bsdtar_windows.h +++ b/tar/bsdtar_windows.h @@ -29,12 +29,16 @@ #define BSDTAR_WINDOWS_H 1 #include #include +#include +#include #ifndef PRId64 #define PRId64 "I64" #endif #define geteuid() 0 +#ifndef __WATCOMC__ + #ifndef S_IFIFO #define S_IFIFO 0010000 /* pipe */ #endif @@ -57,4 +61,6 @@ int __tar_chdir(const char *); #define S_ISBLK(a) (0) #endif +#endif + #endif /* BSDTAR_WINDOWS_H */ diff --git a/tar/cmdline.c b/tar/cmdline.c index 4444b80c5580..fd0712a0dd6c 100644 --- a/tar/cmdline.c +++ b/tar/cmdline.c @@ -74,6 +74,7 @@ static const struct bsdtar_option { { "cd", 1, 'C' }, { "check-links", 0, OPTION_CHECK_LINKS }, { "chroot", 0, OPTION_CHROOT }, + { "clear-nochange-fflags", 0, OPTION_CLEAR_NOCHANGE_FFLAGS }, { "compress", 0, 'Z' }, { "confirmation", 0, 'w' }, { "create", 0, 'c' }, @@ -94,6 +95,7 @@ static const struct bsdtar_option { { "gzip", 0, 'z' }, { "help", 0, OPTION_HELP }, { "hfsCompression", 0, OPTION_HFS_COMPRESSION }, + { "ignore-zeros", 0, OPTION_IGNORE_ZEROS }, { "include", 1, OPTION_INCLUDE }, { "insecure", 0, 'P' }, { "interactive", 0, 'w' }, @@ -101,6 +103,7 @@ static const struct bsdtar_option { { "keep-old-files", 0, 'k' }, { "list", 0, 't' }, { "lrzip", 0, OPTION_LRZIP }, + { "lz4", 0, OPTION_LZ4 }, { "lzip", 0, OPTION_LZIP }, { "lzma", 0, OPTION_LZMA }, { "lzop", 0, OPTION_LZOP }, @@ -114,6 +117,7 @@ static const struct bsdtar_option { { "no-recursion", 0, 'n' }, { "no-same-owner", 0, OPTION_NO_SAME_OWNER }, { "no-same-permissions", 0, OPTION_NO_SAME_PERMISSIONS }, + { "no-xattr", 0, OPTION_NO_XATTR }, { "nodump", 0, OPTION_NODUMP }, { "nopreserveHFSCompression",0, OPTION_NOPRESERVE_HFS_COMPRESSION }, { "norecurse", 0, 'n' }, @@ -127,6 +131,7 @@ static const struct bsdtar_option { { "older-than", 1, OPTION_OLDER_CTIME_THAN }, { "one-file-system", 0, OPTION_ONE_FILE_SYSTEM }, { "options", 1, OPTION_OPTIONS }, + { "passphrase", 1, OPTION_PASSPHRASE }, { "posix", 0, OPTION_POSIX }, { "preserve-permissions", 0, 'p' }, { "read-full-blocks", 0, 'B' }, diff --git a/tar/creation_set.c b/tar/creation_set.c index 3d7764d46dba..87d561b35193 100644 --- a/tar/creation_set.c +++ b/tar/creation_set.c @@ -75,6 +75,7 @@ get_filter_code(const char *suffix) { ".grz", "grzip" }, { ".lrz", "lrzip" }, { ".lz", "lzip" }, + { ".lz4", "lz4" }, { ".lzo", "lzop" }, { ".lzma", "lzma" }, { ".uu", "uuencode" }, @@ -97,6 +98,7 @@ get_format_code(const char *suffix) { ".mtree", "mtree" }, { ".shar", "shar" }, { ".tar", "paxr" }, + { ".warc", "warc" }, { ".xar", "xar" }, { ".zip", "zip" }, { NULL, NULL } diff --git a/tar/read.c b/tar/read.c index e2bacad9573c..e94cb3da8ac7 100644 --- a/tar/read.c +++ b/tar/read.c @@ -39,9 +39,19 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/read.c,v 1.40 2008/08/21 06:41:14 kientzle E #ifdef HAVE_ERRNO_H #include #endif + +#ifdef HAVE_FCNTL_H +#include +#endif + #ifdef HAVE_GRP_H #include #endif + +#ifdef HAVE_IO_H +#include +#endif + #ifdef HAVE_LIMITS_H #include #endif @@ -74,8 +84,6 @@ struct progress_data { struct archive_entry *entry; }; -static void list_item_verbose(struct bsdtar *, FILE *, - struct archive_entry *); static void read_archive(struct bsdtar *bsdtar, char mode, struct archive *); static int unmatched_inclusions_warn(struct archive *matching, const char *); @@ -112,7 +120,7 @@ tar_mode_x(struct bsdtar *bsdtar) static void progress_func(void *cookie) { - struct progress_data *progress_data = cookie; + struct progress_data *progress_data = (struct progress_data *)cookie; struct bsdtar *bsdtar = progress_data->bsdtar; struct archive *a = progress_data->archive; struct archive_entry *entry = progress_data->entry; @@ -182,7 +190,7 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) if (reader_options != NULL) { char *p; /* Set default read options. */ - p = malloc(sizeof(IGNORE_WRONG_MODULE_NAME) + p = (char *)malloc(sizeof(IGNORE_WRONG_MODULE_NAME) + strlen(reader_options) + 1); if (p == NULL) lafe_errc(1, errno, "Out of memory"); @@ -201,6 +209,17 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) } if (ARCHIVE_OK != archive_read_set_options(a, bsdtar->option_options)) lafe_errc(1, 0, "%s", archive_error_string(a)); + if (bsdtar->option_ignore_zeros) + if (archive_read_set_options(a, + "read_concatenated_archives") != ARCHIVE_OK) + lafe_errc(1, 0, "%s", archive_error_string(a)); + if (bsdtar->passphrase != NULL) + r = archive_read_add_passphrase(a, bsdtar->passphrase); + else + r = archive_read_set_passphrase_callback(a, bsdtar, + &passphrase_callback); + if (r != ARCHIVE_OK) + lafe_errc(1, 0, "%s", archive_error_string(a)); if (archive_read_open_filename(a, bsdtar->filename, bsdtar->bytes_per_block)) lafe_errc(1, 0, "Error opening archive: %s", @@ -226,8 +245,15 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) #endif } +#if defined(_WIN32) && !defined(__CYGWIN__) + if (mode == 'x' && bsdtar->option_stdout) { + _setmode(1, _O_BINARY); + } +#endif + for (;;) { /* Support --fast-read option */ + const char *p; if (bsdtar->option_fast_read && archive_match_path_unmatched_inclusions(bsdtar->matching) == 0) break; @@ -247,6 +273,12 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) } if (r == ARCHIVE_FATAL) break; + p = archive_entry_pathname(entry); + if (p == NULL || p[0] == '\0') { + lafe_warnc(0, "Archive entry has empty or unreadable filename ... skipping."); + bsdtar->return_value = 1; + continue; + } if (bsdtar->uid >= 0) { archive_entry_set_uid(entry, bsdtar->uid); @@ -318,11 +350,14 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) !yes("extract '%s'", archive_entry_pathname(entry))) continue; - /* - * Format here is from SUSv2, including the - * deferred '\n'. - */ - if (bsdtar->verbose) { + if (bsdtar->verbose > 1) { + /* GNU tar uses -tv format with -xvv */ + safe_fprintf(stderr, "x "); + list_item_verbose(bsdtar, stderr, entry); + fflush(stderr); + } else if (bsdtar->verbose > 0) { + /* Format follows SUSv2, including the + * deferred '\n'. */ safe_fprintf(stderr, "x %s", archive_entry_pathname(entry)); fflush(stderr); @@ -366,106 +401,6 @@ read_archive(struct bsdtar *bsdtar, char mode, struct archive *writer) } -/* - * Display information about the current file. - * - * The format here roughly duplicates the output of 'ls -l'. - * This is based on SUSv2, where 'tar tv' is documented as - * listing additional information in an "unspecified format," - * and 'pax -l' is documented as using the same format as 'ls -l'. - */ -static void -list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry) -{ - char tmp[100]; - size_t w; - const char *p; - const char *fmt; - time_t tim; - static time_t now; - - /* - * We avoid collecting the entire list in memory at once by - * listing things as we see them. However, that also means we can't - * just pre-compute the field widths. Instead, we start with guesses - * and just widen them as necessary. These numbers are completely - * arbitrary. - */ - if (!bsdtar->u_width) { - bsdtar->u_width = 6; - bsdtar->gs_width = 13; - } - if (!now) - time(&now); - fprintf(out, "%s %d ", - archive_entry_strmode(entry), - archive_entry_nlink(entry)); - - /* Use uname if it's present, else uid. */ - p = archive_entry_uname(entry); - if ((p == NULL) || (*p == '\0')) { - sprintf(tmp, "%lu ", - (unsigned long)archive_entry_uid(entry)); - p = tmp; - } - w = strlen(p); - if (w > bsdtar->u_width) - bsdtar->u_width = w; - fprintf(out, "%-*s ", (int)bsdtar->u_width, p); - - /* Use gname if it's present, else gid. */ - p = archive_entry_gname(entry); - if (p != NULL && p[0] != '\0') { - fprintf(out, "%s", p); - w = strlen(p); - } else { - sprintf(tmp, "%lu", - (unsigned long)archive_entry_gid(entry)); - w = strlen(tmp); - fprintf(out, "%s", tmp); - } - - /* - * Print device number or file size, right-aligned so as to make - * total width of group and devnum/filesize fields be gs_width. - * If gs_width is too small, grow it. - */ - if (archive_entry_filetype(entry) == AE_IFCHR - || archive_entry_filetype(entry) == AE_IFBLK) { - sprintf(tmp, "%lu,%lu", - (unsigned long)archive_entry_rdevmajor(entry), - (unsigned long)archive_entry_rdevminor(entry)); - } else { - strcpy(tmp, tar_i64toa(archive_entry_size(entry))); - } - if (w + strlen(tmp) >= bsdtar->gs_width) - bsdtar->gs_width = w+strlen(tmp)+1; - fprintf(out, "%*s", (int)(bsdtar->gs_width - w), tmp); - - /* Format the time using 'ls -l' conventions. */ - tim = archive_entry_mtime(entry); -#define HALF_YEAR (time_t)365 * 86400 / 2 -#if defined(_WIN32) && !defined(__CYGWIN__) -#define DAY_FMT "%d" /* Windows' strftime function does not support %e format. */ -#else -#define DAY_FMT "%e" /* Day number without leading zeros */ -#endif - if (tim < now - HALF_YEAR || tim > now + HALF_YEAR) - fmt = bsdtar->day_first ? DAY_FMT " %b %Y" : "%b " DAY_FMT " %Y"; - else - fmt = bsdtar->day_first ? DAY_FMT " %b %H:%M" : "%b " DAY_FMT " %H:%M"; - strftime(tmp, sizeof(tmp), fmt, localtime(&tim)); - fprintf(out, " %s ", tmp); - safe_fprintf(out, "%s", archive_entry_pathname(entry)); - - /* Extra information for links. */ - if (archive_entry_hardlink(entry)) /* Hard link */ - safe_fprintf(out, " link to %s", - archive_entry_hardlink(entry)); - else if (archive_entry_symlink(entry)) /* Symbolic link */ - safe_fprintf(out, " -> %s", archive_entry_symlink(entry)); -} - static int unmatched_inclusions_warn(struct archive *matching, const char *msg) { diff --git a/tar/subst.c b/tar/subst.c index fd6f8e222c6a..4710e06a623a 100644 --- a/tar/subst.c +++ b/tar/subst.c @@ -236,64 +236,66 @@ apply_substitution(struct bsdtar *bsdtar, const char *name, char **result, continue; } - if (regexec(&rule->re, name, 10, matches, 0)) - continue; - - got_match = 1; - print_match |= rule->print; - realloc_strncat(result, name, matches[0].rm_so); - - for (i = 0, j = 0; rule->result[i] != '\0'; ++i) { - if (rule->result[i] == '~') { - realloc_strncat(result, rule->result + j, i - j); - realloc_strncat(result, - name + matches[0].rm_so, - matches[0].rm_eo - matches[0].rm_so); - j = i + 1; - continue; - } - if (rule->result[i] != '\\') - continue; - - ++i; - c = rule->result[i]; - switch (c) { - case '~': - case '\\': - realloc_strncat(result, rule->result + j, i - j - 1); - j = i; + while (1) { + if (regexec(&rule->re, name, 10, matches, 0)) break; - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': - realloc_strncat(result, rule->result + j, i - j - 1); - if ((size_t)(c - '0') > (size_t)(rule->re.re_nsub)) { - free(*result); - *result = NULL; - return -1; + + got_match = 1; + print_match |= rule->print; + realloc_strncat(result, name, matches[0].rm_so); + + for (i = 0, j = 0; rule->result[i] != '\0'; ++i) { + if (rule->result[i] == '~') { + realloc_strncat(result, rule->result + j, i - j); + realloc_strncat(result, + name + matches[0].rm_so, + matches[0].rm_eo - matches[0].rm_so); + j = i + 1; + continue; } - realloc_strncat(result, name + matches[c - '0'].rm_so, matches[c - '0'].rm_eo - matches[c - '0'].rm_so); - j = i + 1; - break; - default: - /* Just continue; */ - break; + if (rule->result[i] != '\\') + continue; + + ++i; + c = rule->result[i]; + switch (c) { + case '~': + case '\\': + realloc_strncat(result, rule->result + j, i - j - 1); + j = i; + break; + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + realloc_strncat(result, rule->result + j, i - j - 1); + if ((size_t)(c - '0') > (size_t)(rule->re.re_nsub)) { + free(*result); + *result = NULL; + return -1; + } + realloc_strncat(result, name + matches[c - '0'].rm_so, matches[c - '0'].rm_eo - matches[c - '0'].rm_so); + j = i + 1; + break; + default: + /* Just continue; */ + break; + } + } + realloc_strcat(result, rule->result + j); + + name += matches[0].rm_eo; + + if (!rule->global) + break; } - - realloc_strcat(result, rule->result + j); - - name += matches[0].rm_eo; - - if (!rule->global) - break; } if (got_match) diff --git a/tar/test/CMakeLists.txt b/tar/test/CMakeLists.txt index 98f49e29298b..9648e4892a3c 100644 --- a/tar/test/CMakeLists.txt +++ b/tar/test/CMakeLists.txt @@ -18,11 +18,13 @@ IF(ENABLE_TAR AND ENABLE_TEST) test_extract_tar_gz.c test_extract_tar_lrz.c test_extract_tar_lz.c + test_extract_tar_lz4.c test_extract_tar_lzma.c test_extract_tar_lzo.c test_extract_tar_xz.c test_format_newc.c test_help.c + test_leading_slash.c test_option_C_upper.c test_option_H_upper.c test_option_L_upper.c @@ -40,12 +42,14 @@ IF(ENABLE_TAR AND ENABLE_TEST) test_option_k.c test_option_keep_newer_files.c test_option_lrzip.c + test_option_lz4.c test_option_lzma.c test_option_lzop.c test_option_n.c test_option_newer_than.c test_option_nodump.c test_option_older_than.c + test_option_passphrase.c test_option_q.c test_option_r.c test_option_s.c @@ -90,11 +94,12 @@ IF(ENABLE_TAR AND ENABLE_TEST) INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/list.h) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR}) - INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/test_utils) + INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR}/test_utils) # Experimental new test handling ADD_CUSTOM_TARGET(run_bsdtar_test - COMMAND bsdtar_test -p ${BSDTAR} -r ${CMAKE_CURRENT_SOURCE_DIR}) + COMMAND bsdtar_test -p $ + -r ${CMAKE_CURRENT_SOURCE_DIR}) ADD_DEPENDENCIES(run_bsdtar_test bsdtar) ADD_DEPENDENCIES(run_all_tests run_bsdtar_test) diff --git a/tar/test/main.c b/tar/test/main.c index f2dcaf4ae83b..90801a98bc8f 100644 --- a/tar/test/main.c +++ b/tar/test/main.c @@ -130,6 +130,16 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/test/main.c,v 1.6 2008/11/05 06:40:53 kientz # include #endif +/* Path to working directory for current test */ +const char *testworkdir; +#ifdef PROGRAM +/* Pathname of exe to be tested. */ +const char *testprogfile; +/* Name of exe to use in printf-formatted command strings. */ +/* On Windows, this includes leading/trailing quotes. */ +const char *testprog; +#endif + #if defined(_WIN32) && !defined(__CYGWIN__) static void *GetFunctionKernel32(const char *); static int my_CreateSymbolicLinkA(const char *, const char *, int); @@ -194,7 +204,7 @@ my_GetFileInformationByName(const char *path, BY_HANDLE_FILE_INFORMATION *bhfi) } #endif -#if defined(HAVE__CrtSetReportMode) +#if defined(HAVE__CrtSetReportMode) && !defined(__WATCOMC__) static void invalid_parameter_handler(const wchar_t * expression, const wchar_t * function, const wchar_t * file, @@ -565,10 +575,10 @@ static void strdump(const char *e, const char *p, int ewidth, int utf8) while (*p != '\0') { unsigned int c = 0xff & *p++; switch (c) { - case '\a': printf("\a"); break; - case '\b': printf("\b"); break; - case '\n': printf("\n"); break; - case '\r': printf("\r"); break; + case '\a': logprintf("\\a"); break; + case '\b': logprintf("\\b"); break; + case '\n': logprintf("\\n"); break; + case '\r': logprintf("\\r"); break; default: if (c >= 32 && c < 127) logprintf("%c", c); @@ -771,6 +781,34 @@ assertion_equal_mem(const char *file, int line, return (0); } +/* Verify that a block of memory is filled with the specified byte. */ +int +assertion_memory_filled_with(const char *file, int line, + const void *_v1, const char *vd, + size_t l, const char *ld, + char b, const char *bd, void *extra) +{ + const char *v1 = (const char *)_v1; + size_t c = 0; + size_t i; + (void)ld; /* UNUSED */ + + assertion_count(file, line); + + for (i = 0; i < l; ++i) { + if (v1[i] == b) { + ++c; + } + } + if (c == l) + return (1); + + failure_start(file, line, "%s (size %d) not filled with %s", vd, (int)l, bd); + logprintf(" Only %d bytes were correct\n", (int)c); + failure_finish(extra); + return (0); +} + /* Verify that the named file exists and is empty. */ int assertion_empty_file(const char *filename, int line, const char *f1) @@ -1061,7 +1099,8 @@ assertion_file_contains_lines_any_order(const char *file, int line, free(expected); return (0); } - for (j = 0, p = buff; p < buff + buff_size; p += 1 + strlen(p)) { + for (j = 0, p = buff; p < buff + buff_size; + p += 1 + strlen(p)) { if (*p != '\0') { actual[j] = p; ++j; @@ -1912,6 +1951,18 @@ canGzip(void) /* * Can this platform run the lrzip program? */ +int +canRunCommand(const char *cmd) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("%s %s", cmd, redirectArgs) == 0) + value = 1; + } + return (value); +} + int canLrzip(void) { @@ -1924,6 +1975,21 @@ canLrzip(void) return (value); } +/* + * Can this platform run the lz4 program? + */ +int +canLz4(void) +{ + static int tested = 0, value = 0; + if (!tested) { + tested = 1; + if (systemf("lz4 -V %s", redirectArgs) == 0) + value = 1; + } + return (value); +} + /* * Can this platform run the lzip program? */ @@ -2136,8 +2202,31 @@ slurpfile(size_t * sizep, const char *fmt, ...) return (p); } +/* + * Slurp a file into memory for ease of comparison and testing. + * Returns size of file in 'sizep' if non-NULL, null-terminates + * data in memory for ease of use. + */ +void +dumpfile(const char *filename, void *data, size_t len) +{ + ssize_t bytes_written; + FILE *f; + + f = fopen(filename, "wb"); + if (f == NULL) { + logprintf("Can't open file %s for writing\n", filename); + return; + } + bytes_written = fwrite(data, 1, len, f); + if (bytes_written < (ssize_t)len) + logprintf("Can't write file %s\n", filename); + fclose(f); +} + /* Read a uuencoded file from the reference directory, decode, and * write the result into the current directory. */ +#define VALID_UUDECODE(c) (c >= 32 && c <= 96) #define UUDECODE(c) (((c) - 0x20) & 0x3f) void extract_reference_file(const char *name) @@ -2161,7 +2250,6 @@ extract_reference_file(const char *name) break; } /* Now, decode the rest and write it. */ - /* Not a lot of error checking here; the input better be right. */ out = fopen(name, "wb"); while (fgets(buff, sizeof(buff), in) != NULL) { char *p = buff; @@ -2175,17 +2263,21 @@ extract_reference_file(const char *name) int n = 0; /* Write out 1-3 bytes from that. */ if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); + assert(VALID_UUDECODE(p[1])); n = UUDECODE(*p++) << 18; n |= UUDECODE(*p++) << 12; fputc(n >> 16, out); --bytes; } if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); n |= UUDECODE(*p++) << 6; fputc((n >> 8) & 0xFF, out); --bytes; } if (bytes > 0) { + assert(VALID_UUDECODE(p[0])); n |= UUDECODE(*p++); fputc(n & 0xFF, out); --bytes; @@ -2196,6 +2288,32 @@ extract_reference_file(const char *name) fclose(in); } +void +copy_reference_file(const char *name) +{ + char buff[1024]; + FILE *in, *out; + size_t rbytes; + + sprintf(buff, "%s/%s", refdir, name); + in = fopen(buff, "rb"); + failure("Couldn't open reference file %s", buff); + assert(in != NULL); + if (in == NULL) + return; + /* Now, decode the rest and write it. */ + /* Not a lot of error checking here; the input better be right. */ + out = fopen(name, "wb"); + while ((rbytes = fread(buff, 1, sizeof(buff), in)) > 0) { + if (fwrite(buff, 1, rbytes, out) != rbytes) { + logprintf("Error: fwrite\n"); + break; + } + } + fclose(out); + fclose(in); +} + int is_LargeInode(const char *file) { @@ -2217,6 +2335,14 @@ is_LargeInode(const char *file) return (ino > 0xffffffff); #endif } + +void +extract_reference_files(const char **names) +{ + while (names && *names) + extract_reference_file(*names++); +} + /* * * TEST management @@ -2246,7 +2372,7 @@ struct test_list_t tests[] = { * Summarize repeated failures in the just-completed test. */ static void -test_summarize(int failed) +test_summarize(int failed, int skips_num) { unsigned int i; @@ -2256,7 +2382,7 @@ test_summarize(int failed) fflush(stdout); break; case VERBOSITY_PASSFAIL: - printf(failed ? "FAIL\n" : "ok\n"); + printf(failed ? "FAIL\n" : skips_num ? "ok (S)\n" : "ok\n"); break; } @@ -2281,13 +2407,14 @@ test_run(int i, const char *tmpdir) char workdir[1024]; char logfilename[64]; int failures_before = failures; + int skips_before = skips; int oldumask; switch (verbosity) { case VERBOSITY_SUMMARY_ONLY: /* No per-test reports at all */ break; case VERBOSITY_PASSFAIL: /* rest of line will include ok/FAIL marker */ - printf("%3d: %-50s", i, tests[i].name); + printf("%3d: %-64s", i, tests[i].name); fflush(stdout); break; default: /* Title of test, details will follow */ @@ -2337,7 +2464,7 @@ test_run(int i, const char *tmpdir) } /* Report per-test summaries. */ tests[i].failures = failures - failures_before; - test_summarize(tests[i].failures); + test_summarize(tests[i].failures, skips - skips_before); /* Close the per-test log file. */ fclose(logfile); logfile = NULL; @@ -2480,6 +2607,7 @@ get_refdir(const char *d) failure: printf("Unable to locate known reference file %s\n", KNOWNREF); printf(" Checked following directories:\n%s\n", tried); + printf("Use -r option to specify full path to reference directory\n"); #if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG) DebugBreak(); #endif @@ -2516,7 +2644,7 @@ main(int argc, char **argv) while (pwd[strlen(pwd) - 1] == '\n') pwd[strlen(pwd) - 1] = '\0'; -#if defined(HAVE__CrtSetReportMode) +#if defined(HAVE__CrtSetReportMode) && !defined(__WATCOMC__) /* To stop to run the default invalid parameter handler. */ _set_invalid_parameter_handler(invalid_parameter_handler); /* Disable annoying assertion message box. */ @@ -2563,7 +2691,7 @@ main(int argc, char **argv) exit(1); } memmove(testprogdir + strlen(pwd) + 1, testprogdir, - strlen(testprogdir)); + strlen(testprogdir) + 1); memcpy(testprogdir, pwd, strlen(pwd)); testprogdir[strlen(pwd)] = '/'; } diff --git a/tar/test/test.h b/tar/test/test.h index a0a9bb6f600c..704a137ed3fb 100644 --- a/tar/test/test.h +++ b/tar/test/test.h @@ -66,6 +66,7 @@ #include #include #include +#include #include #ifdef HAVE_UNISTD_H #include @@ -91,7 +92,7 @@ #endif /* Visual Studio */ -#ifdef _MSC_VER +#if defined(_MSC_VER) && _MSC_VER < 1900 #define snprintf sprintf_s #endif @@ -144,6 +145,9 @@ /* As above, but raw blocks of bytes. */ #define assertEqualMem(v1, v2, l) \ assertion_equal_mem(__FILE__, __LINE__, (v1), #v1, (v2), #v2, (l), #l, NULL) +/* Assert that memory is full of a specified byte */ +#define assertMemoryFilledWith(v1, l, b) \ + assertion_memory_filled_with(__FILE__, __LINE__, (v1), #v1, (l), #l, (b), #b, NULL) /* Assert two files are the same. */ #define assertEqualFile(f1, f2) \ assertion_equal_file(__FILE__, __LINE__, (f1), (f2)) @@ -227,6 +231,7 @@ int assertion_empty_file(const char *, int, const char *); int assertion_equal_file(const char *, int, const char *, const char *); int assertion_equal_int(const char *, int, long long, const char *, long long, const char *, void *); int assertion_equal_mem(const char *, int, const void *, const char *, const void *, const char *, size_t, const char *, void *); +int assertion_memory_filled_with(const char *, int, const void *, const char *, size_t, const char *, char, const char *, void *); int assertion_equal_string(const char *, int, const char *v1, const char *, const char *v2, const char *, void *, int); int assertion_equal_wstring(const char *, int, const wchar_t *v1, const char *, const wchar_t *v2, const char *, void *); int assertion_file_atime(const char *, int, const char *, long, long); @@ -277,9 +282,15 @@ int canGrzip(void); /* Return true if this platform can run the "gzip" program. */ int canGzip(void); +/* Return true if this platform can run the specified command. */ +int canRunCommand(const char *); + /* Return true if this platform can run the "lrzip" program. */ int canLrzip(void); +/* Return true if this platform can run the "lz4" program. */ +int canLz4(void); + /* Return true if this platform can run the "lzip" program. */ int canLzip(void); @@ -302,21 +313,31 @@ int is_LargeInode(const char *); /* Supports printf-style args: slurpfile(NULL, "%s/myfile", refdir); */ char *slurpfile(size_t *, const char *fmt, ...); +/* Dump block of bytes to a file. */ +void dumpfile(const char *filename, void *, size_t); + /* Extracts named reference file to the current directory. */ void extract_reference_file(const char *); +/* Copies named reference file to the current directory. */ +void copy_reference_file(const char *); + +/* Extracts a list of files to the current directory. + * List must be NULL terminated. + */ +void extract_reference_files(const char **); /* Path to working directory for current test */ -const char *testworkdir; +extern const char *testworkdir; /* * Special interfaces for program test harness. */ /* Pathname of exe to be tested. */ -const char *testprogfile; +extern const char *testprogfile; /* Name of exe to use in printf-formatted command strings. */ /* On Windows, this includes leading/trailing quotes. */ -const char *testprog; +extern const char *testprog; #ifdef USE_DMALLOC #include diff --git a/tar/test/test_extract.tar.lz4.uu b/tar/test/test_extract.tar.lz4.uu new file mode 100644 index 000000000000..a10ac0275ad7 --- /dev/null +++ b/tar/test/test_extract.tar.lz4.uu @@ -0,0 +1,8 @@ +begin 644 test_extract.tar.lz4 +M!")-&&1PN:L```!O9FEL93$``0!+Z#`P,#8V-"``,#`Q-S4P"``#`@#_"3(S +M(#$R,#,R-S0P,C,T(#`Q,3,V-0`@,)<`2P("`+)Utest.out 2>test.err", testprog, reffile); + if (f == 0 || canLz4()) { + assertEqualInt(0, systemf("%s -xf %s >test.out 2>test.err", + testprog, reffile)); + + assertFileExists("file1"); + assertTextFileContents("contents of file1.\n", "file1"); + assertFileExists("file2"); + assertTextFileContents("contents of file2.\n", "file2"); + assertEmptyFile("test.out"); + assertEmptyFile("test.err"); + } else { + skipping("It seems lz4 is not supported on this platform"); + } +} diff --git a/tar/test/test_leading_slash.c b/tar/test/test_leading_slash.c new file mode 100644 index 000000000000..a8921ebcbae8 --- /dev/null +++ b/tar/test/test_leading_slash.c @@ -0,0 +1,49 @@ +/*- + * Copyright (c) 2003-2014 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" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_leading_slash) +{ + const char *reffile = "test_leading_slash.tar"; + char *errfile; + size_t errfile_size; + const char *expected_errmsg = "Removing leading '/' from member names"; + + extract_reference_file(reffile); + assertEqualInt(0, systemf("%s -xf %s >test.out 2>test.err", testprog, reffile)); + assertFileExists("foo/file"); + assertTextFileContents("foo\x0a", "foo/file"); + assertTextFileContents("foo\x0a", "foo/hardlink"); + assertIsHardlink("foo/file", "foo/hardlink"); + assertEmptyFile("test.out"); + + /* Verify the error output contains the expected text somewhere in it */ + if (assertFileExists("test.err")) { + errfile = slurpfile(&errfile_size, "test.err"); + assert(strstr(errfile, expected_errmsg) != NULL); + } +} + diff --git a/tar/test/test_leading_slash.tar.uu b/tar/test/test_leading_slash.tar.uu new file mode 100644 index 000000000000..eeb27c3bbf40 --- /dev/null +++ b/tar/test/test_leading_slash.tar.uu @@ -0,0 +1,60 @@ +begin 644 test_leading_slash.tar +M+V9O;R]F:6QE```````````````````````````````````````````````` +M```````````````````````````````````````````````````````````` +M`````````````#`P,#8T-"``,#`P,#`P(``P,#`P,#`@`#`P,#`P,#`P,#`T +M(#$R-#$V,S4U-34V(#`Q,C8V-P`@,``````````````````````````````` +M```````````````````````````````````````````````````````````` +M``````````````````````````````````````````!Utest.out 2>test.err", testprog)); + assertFileContents("file1", 5, "file1"); + assertFileContents("file2", 5, "file2"); + assertFileContents("file3a", 6, "file3a"); + assertFileContents("file4a", 6, "file4a"); + assertEmptyFile("test.out"); + assertEmptyFile("test.err"); + assertChdir(".."); } diff --git a/tar/test/test_option_b.c b/tar/test/test_option_b.c index be2ae65c75a8..81f50be8355e 100644 --- a/tar/test/test_option_b.c +++ b/tar/test/test_option_b.c @@ -25,18 +25,25 @@ #include "test.h" __FBSDID("$FreeBSD$"); +#define USTAR_OPT " --format=ustar" + DEFINE_TEST(test_option_b) { + char *testprog_ustar; + assertMakeFile("file1", 0644, "file1"); if (systemf("cat file1 > test_cat.out 2> test_cat.err") != 0) { skipping("Platform doesn't have cat"); return; } + testprog_ustar = malloc(strlen(testprog) + sizeof(USTAR_OPT) + 1); + strcpy(testprog_ustar, testprog); + strcat(testprog_ustar, USTAR_OPT); /* * Bsdtar does not pad if the output is going directly to a disk file. */ - assertEqualInt(0, systemf("%s -cf archive1.tar file1 >test1.out 2>test1.err", testprog)); + assertEqualInt(0, systemf("%s -cf archive1.tar file1 >test1.out 2>test1.err", testprog_ustar)); failure("bsdtar does not pad archives written directly to regular files"); assertFileSize("archive1.tar", 2048); assertEmptyFile("test1.out"); @@ -46,24 +53,24 @@ DEFINE_TEST(test_option_b) * Bsdtar does pad to the block size if the output is going to a socket. */ /* Default is -b 20 */ - assertEqualInt(0, systemf("%s -cf - file1 2>test2.err | cat >archive2.tar ", testprog)); + assertEqualInt(0, systemf("%s -cf - file1 2>test2.err | cat >archive2.tar ", testprog_ustar)); failure("bsdtar does pad archives written to pipes"); assertFileSize("archive2.tar", 10240); assertEmptyFile("test2.err"); - assertEqualInt(0, systemf("%s -cf - -b 20 file1 2>test3.err | cat >archive3.tar ", testprog)); + assertEqualInt(0, systemf("%s -cf - -b 20 file1 2>test3.err | cat >archive3.tar ", testprog_ustar)); assertFileSize("archive3.tar", 10240); assertEmptyFile("test3.err"); - assertEqualInt(0, systemf("%s -cf - -b 10 file1 2>test4.err | cat >archive4.tar ", testprog)); + assertEqualInt(0, systemf("%s -cf - -b 10 file1 2>test4.err | cat >archive4.tar ", testprog_ustar)); assertFileSize("archive4.tar", 5120); assertEmptyFile("test4.err"); - assertEqualInt(0, systemf("%s -cf - -b 1 file1 2>test5.err | cat >archive5.tar ", testprog)); + assertEqualInt(0, systemf("%s -cf - -b 1 file1 2>test5.err | cat >archive5.tar ", testprog_ustar)); assertFileSize("archive5.tar", 2048); assertEmptyFile("test5.err"); - assertEqualInt(0, systemf("%s -cf - -b 8192 file1 2>test6.err | cat >archive6.tar ", testprog)); + assertEqualInt(0, systemf("%s -cf - -b 8192 file1 2>test6.err | cat >archive6.tar ", testprog_ustar)); assertFileSize("archive6.tar", 4194304); assertEmptyFile("test6.err"); diff --git a/tar/test/test_option_lz4.c b/tar/test/test_option_lz4.c new file mode 100644 index 000000000000..5dc945216300 --- /dev/null +++ b/tar/test/test_option_lz4.c @@ -0,0 +1,74 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_option_lz4) +{ + char *p; + int r; + size_t s; + + /* Create a file. */ + assertMakeFile("f", 0644, "a"); + + /* Archive it with lz4 compression. */ + r = systemf("%s -cf - --lz4 f >archive.out 2>archive.err", + testprog); + p = slurpfile(&s, "archive.err"); + p[s] = '\0'; + if (r != 0) { + if (strstr(p, "Unsupported compression") != NULL) { + skipping("This version of bsdtar was compiled " + "without lz4 support"); + return; + } + /* POSIX permits different handling of the spawnp + * system call used to launch the subsidiary + * program: */ + /* Some systems fail immediately to spawn the new process. */ + if (strstr(p, "Can't launch") != NULL && !canLz4()) { + skipping("This version of bsdtar uses an external lz4 program " + "but no such program is available on this system."); + return; + } + /* Some systems successfully spawn the new process, + * but fail to exec a program within that process. + * This results in failure at the first attempt to + * write. */ + if (strstr(p, "Can't write") != NULL && !canLz4()) { + skipping("This version of bsdtar uses an external lz4 program " + "but no such program is available on this system."); + return; + } + failure("--lz4 option is broken: %s", p); + assertEqualInt(r, 0); + return; + } + /* Check that the archive file has an lz4 signature. */ + p = slurpfile(&s, "archive.out"); + assert(s > 2); + assertEqualMem(p, "\x04\x22\x4d\x18", 4); +} diff --git a/tar/test/test_option_passphrase.c b/tar/test/test_option_passphrase.c new file mode 100644 index 000000000000..337292c95bfc --- /dev/null +++ b/tar/test/test_option_passphrase.c @@ -0,0 +1,43 @@ +/*- + * Copyright (c) 2014 Michihiro NAKAJIMA + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "test.h" +__FBSDID("$FreeBSD$"); + +DEFINE_TEST(test_option_passphrase) +{ + const char *reffile = "test_option_passphrase.zip"; + + extract_reference_file(reffile); + failure("--passphrase option is broken"); + assertEqualInt(0, systemf( + "%s --passphrase pass1 -xf %s >test.out 2>test.err", + testprog, reffile)); + assertFileExists("file1"); + assertTextFileContents("contents of file1.\n", "file1"); + assertFileExists("file2"); + assertTextFileContents("contents of file2.\n", "file2"); + assertEmptyFile("test.out"); + assertEmptyFile("test.err"); +} diff --git a/tar/test/test_option_passphrase.zip.uu b/tar/test/test_option_passphrase.zip.uu new file mode 100644 index 000000000000..021ae8585fe8 --- /dev/null +++ b/tar/test/test_option_passphrase.zip.uu @@ -0,0 +1,12 @@ +begin 644 test_option_passphrase.zip +M4$L#!`H`"0```#B91$7D$C4,'P```!,````%`!P`9FEL93%55`D``VS'+U0" +MQR]4=7@+``$$]0$```04````BHPD*"^*I04=XKI\_FQ*TE+#),TD7TTKSP/7 +MR6R35%!+!PCD$C4,'P```!,```!02P,$"@`)````09E$1;VL<`L``03U`0``!!0```!D#6Z\@CI8 +MV1GIJO5TISQF^I:7.;Y3<-G3$YOCL(C_4$L'"+VL +M`PH`"0```#B91$7D$C4,'P```!,````%`!@```````$```"D@0````!F:6QE +M,554!0`#;,`PH`"0```$&91$6]K',. +M'P```!,````%`!@```````$```"D@6X```!F:6QE,E54!0`#>< 0 && (*q == ' ' || *q == '/' || *q == '.' || isalnum(*q))) { + ++q; + --s; + } /* All terminated by end-of-line. */ assert(s >= 1); /* Skip an optional CR character (e.g., Windows) */ diff --git a/tar/util.c b/tar/util.c index b1b9b93d0e93..9ff22f2b6154 100644 --- a/tar/util.c +++ b/tar/util.c @@ -61,6 +61,7 @@ __FBSDID("$FreeBSD: src/usr.bin/tar/util.c,v 1.23 2008/12/15 06:00:25 kientzle E #include "bsdtar.h" #include "err.h" +#include "passphrase.h" static size_t bsdtar_expand_char(char *, size_t, char); static const char *strip_components(const char *path, int elements); @@ -372,20 +373,107 @@ strip_components(const char *p, int elements) } } +static void +warn_strip_leading_char(struct bsdtar *bsdtar, const char *c) +{ + if (!bsdtar->warned_lead_slash) { + lafe_warnc(0, + "Removing leading '%c' from member names", + c[0]); + bsdtar->warned_lead_slash = 1; + } +} + +static void +warn_strip_drive_letter(struct bsdtar *bsdtar) +{ + if (!bsdtar->warned_lead_slash) { + lafe_warnc(0, + "Removing leading drive letter from " + "member names"); + bsdtar->warned_lead_slash = 1; + } +} + +/* + * Convert absolute path to non-absolute path by skipping leading + * absolute path prefixes. + */ +static const char* +strip_absolute_path(struct bsdtar *bsdtar, const char *p) +{ + const char *rp; + + /* Remove leading "//./" or "//?/" or "//?/UNC/" + * (absolute path prefixes used by Windows API) */ + if ((p[0] == '/' || p[0] == '\\') && + (p[1] == '/' || p[1] == '\\') && + (p[2] == '.' || p[2] == '?') && + (p[3] == '/' || p[3] == '\\')) + { + if (p[2] == '?' && + (p[4] == 'U' || p[4] == 'u') && + (p[5] == 'N' || p[5] == 'n') && + (p[6] == 'C' || p[6] == 'c') && + (p[7] == '/' || p[7] == '\\')) + p += 8; + else + p += 4; + warn_strip_drive_letter(bsdtar); + } + + /* Remove multiple leading slashes and Windows drive letters. */ + do { + rp = p; + if (((p[0] >= 'a' && p[0] <= 'z') || + (p[0] >= 'A' && p[0] <= 'Z')) && + p[1] == ':') { + p += 2; + warn_strip_drive_letter(bsdtar); + } + + /* Remove leading "/../", "/./", "//", etc. */ + while (p[0] == '/' || p[0] == '\\') { + if (p[1] == '.' && + p[2] == '.' && + (p[3] == '/' || p[3] == '\\')) { + p += 3; /* Remove "/..", leave "/" for next pass. */ + } else if (p[1] == '.' && + (p[2] == '/' || p[2] == '\\')) { + p += 2; /* Remove "/.", leave "/" for next pass. */ + } else + p += 1; /* Remove "/". */ + warn_strip_leading_char(bsdtar, rp); + } + } while (rp != p); + + return (p); +} + /* * Handle --strip-components and any future path-rewriting options. * Returns non-zero if the pathname should not be extracted. * + * Note: The rewrites are applied uniformly to pathnames and hardlink + * names but not to symlink bodies. This is deliberate: Symlink + * bodies are not necessarily filenames. Even when they are, they + * need to be interpreted relative to the directory containing them, + * so simple rewrites like this are rarely appropriate. + * * TODO: Support pax-style regex path rewrites. */ int edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry) { const char *name = archive_entry_pathname(entry); + const char *original_name = name; + const char *hardlinkname = archive_entry_hardlink(entry); + const char *original_hardlinkname = hardlinkname; #if defined(HAVE_REGEX_H) || defined(HAVE_PCREPOSIX_H) char *subst_name; int r; + /* Apply user-specified substitution to pathname. */ r = apply_substitution(bsdtar, name, &subst_name, 0, 0); if (r == -1) { lafe_warnc(0, "Invalid substitution, skipping entry"); @@ -399,10 +487,12 @@ edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry) } else free(subst_name); name = archive_entry_pathname(entry); + original_name = name; } - if (archive_entry_hardlink(entry)) { - r = apply_substitution(bsdtar, archive_entry_hardlink(entry), &subst_name, 0, 1); + /* Apply user-specified substitution to hardlink target. */ + if (hardlinkname != NULL) { + r = apply_substitution(bsdtar, hardlinkname, &subst_name, 0, 1); if (r == -1) { lafe_warnc(0, "Invalid substitution, skipping entry"); return 1; @@ -411,7 +501,11 @@ edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry) archive_entry_copy_hardlink(entry, subst_name); free(subst_name); } + hardlinkname = archive_entry_hardlink(entry); + original_hardlinkname = hardlinkname; } + + /* Apply user-specified substitution to symlink body. */ if (archive_entry_symlink(entry) != NULL) { r = apply_substitution(bsdtar, archive_entry_symlink(entry), &subst_name, 1, 0); if (r == -1) { @@ -427,94 +521,41 @@ edit_pathname(struct bsdtar *bsdtar, struct archive_entry *entry) /* Strip leading dir names as per --strip-components option. */ if (bsdtar->strip_components > 0) { - const char *linkname = archive_entry_hardlink(entry); - name = strip_components(name, bsdtar->strip_components); if (name == NULL) return (1); - if (linkname != NULL) { - linkname = strip_components(linkname, + if (hardlinkname != NULL) { + hardlinkname = strip_components(hardlinkname, bsdtar->strip_components); - if (linkname == NULL) + if (hardlinkname == NULL) return (1); - archive_entry_copy_hardlink(entry, linkname); } } - /* By default, don't write or restore absolute pathnames. */ if (!bsdtar->option_absolute_paths) { - const char *rp, *p = name; - int slashonly = 1; - - /* Remove leading "//./" or "//?/" or "//?/UNC/" - * (absolute path prefixes used by Windows API) */ - if ((p[0] == '/' || p[0] == '\\') && - (p[1] == '/' || p[1] == '\\') && - (p[2] == '.' || p[2] == '?') && - (p[3] == '/' || p[3] == '\\')) - { - if (p[2] == '?' && - (p[4] == 'U' || p[4] == 'u') && - (p[5] == 'N' || p[5] == 'n') && - (p[6] == 'C' || p[6] == 'c') && - (p[7] == '/' || p[7] == '\\')) - p += 8; - else - p += 4; - slashonly = 0; - } - do { - rp = p; - /* Remove leading drive letter from archives created - * on Windows. */ - if (((p[0] >= 'a' && p[0] <= 'z') || - (p[0] >= 'A' && p[0] <= 'Z')) && - p[1] == ':') { - p += 2; - slashonly = 0; - } - /* Remove leading "/../", "//", etc. */ - while (p[0] == '/' || p[0] == '\\') { - if (p[1] == '.' && p[2] == '.' && - (p[3] == '/' || p[3] == '\\')) { - p += 3; /* Remove "/..", leave "/" - * for next pass. */ - slashonly = 0; - } else - p += 1; /* Remove "/". */ - } - } while (rp != p); - - if (p != name && !bsdtar->warned_lead_slash) { - /* Generate a warning the first time this happens. */ - if (slashonly) - lafe_warnc(0, - "Removing leading '%c' from member names", - name[0]); - else - lafe_warnc(0, - "Removing leading drive letter from " - "member names"); - bsdtar->warned_lead_slash = 1; - } - - /* Special case: Stripping everything yields ".". */ - if (*p == '\0') + /* By default, don't write or restore absolute pathnames. */ + name = strip_absolute_path(bsdtar, name); + if (*name == '\0') name = "."; - else - name = p; + + if (hardlinkname != NULL) { + hardlinkname = strip_absolute_path(bsdtar, hardlinkname); + if (*hardlinkname == '\0') + return (1); + } } else { /* Strip redundant leading '/' characters. */ while (name[0] == '/' && name[1] == '/') name++; } - /* Safely replace name in archive_entry. */ - if (name != archive_entry_pathname(entry)) { - char *q = strdup(name); - archive_entry_copy_pathname(entry, q); - free(q); + /* Replace name in archive_entry. */ + if (name != original_name) { + archive_entry_copy_pathname(entry, name); + } + if (hardlinkname != original_hardlinkname) { + archive_entry_copy_hardlink(entry, hardlinkname); } return (0); } @@ -581,3 +622,128 @@ pathcmp(const char *a, const char *b) /* They're really different, return the correct sign. */ return (*(const unsigned char *)a - *(const unsigned char *)b); } + +#define PPBUFF_SIZE 1024 +const char * +passphrase_callback(struct archive *a, void *_client_data) +{ + struct bsdtar *bsdtar = (struct bsdtar *)_client_data; + (void)a; /* UNUSED */ + + if (bsdtar->ppbuff == NULL) { + bsdtar->ppbuff = malloc(PPBUFF_SIZE); + if (bsdtar->ppbuff == NULL) + lafe_errc(1, errno, "Out of memory"); + } + return lafe_readpassphrase("Enter passphrase:", + bsdtar->ppbuff, PPBUFF_SIZE); +} + +void +passphrase_free(char *ppbuff) +{ + if (ppbuff != NULL) { + memset(ppbuff, 0, PPBUFF_SIZE); + free(ppbuff); + } +} + +/* + * Display information about the current file. + * + * The format here roughly duplicates the output of 'ls -l'. + * This is based on SUSv2, where 'tar tv' is documented as + * listing additional information in an "unspecified format," + * and 'pax -l' is documented as using the same format as 'ls -l'. + */ +void +list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry) +{ + char tmp[100]; + size_t w; + const char *p; + const char *fmt; + time_t tim; + static time_t now; + + /* + * We avoid collecting the entire list in memory at once by + * listing things as we see them. However, that also means we can't + * just pre-compute the field widths. Instead, we start with guesses + * and just widen them as necessary. These numbers are completely + * arbitrary. + */ + if (!bsdtar->u_width) { + bsdtar->u_width = 6; + bsdtar->gs_width = 13; + } + if (!now) + time(&now); + fprintf(out, "%s %d ", + archive_entry_strmode(entry), + archive_entry_nlink(entry)); + + /* Use uname if it's present, else uid. */ + p = archive_entry_uname(entry); + if ((p == NULL) || (*p == '\0')) { + sprintf(tmp, "%lu ", + (unsigned long)archive_entry_uid(entry)); + p = tmp; + } + w = strlen(p); + if (w > bsdtar->u_width) + bsdtar->u_width = w; + fprintf(out, "%-*s ", (int)bsdtar->u_width, p); + + /* Use gname if it's present, else gid. */ + p = archive_entry_gname(entry); + if (p != NULL && p[0] != '\0') { + fprintf(out, "%s", p); + w = strlen(p); + } else { + sprintf(tmp, "%lu", + (unsigned long)archive_entry_gid(entry)); + w = strlen(tmp); + fprintf(out, "%s", tmp); + } + + /* + * Print device number or file size, right-aligned so as to make + * total width of group and devnum/filesize fields be gs_width. + * If gs_width is too small, grow it. + */ + if (archive_entry_filetype(entry) == AE_IFCHR + || archive_entry_filetype(entry) == AE_IFBLK) { + sprintf(tmp, "%lu,%lu", + (unsigned long)archive_entry_rdevmajor(entry), + (unsigned long)archive_entry_rdevminor(entry)); + } else { + strcpy(tmp, tar_i64toa(archive_entry_size(entry))); + } + if (w + strlen(tmp) >= bsdtar->gs_width) + bsdtar->gs_width = w+strlen(tmp)+1; + fprintf(out, "%*s", (int)(bsdtar->gs_width - w), tmp); + + /* Format the time using 'ls -l' conventions. */ + tim = archive_entry_mtime(entry); +#define HALF_YEAR (time_t)365 * 86400 / 2 +#if defined(_WIN32) && !defined(__CYGWIN__) +#define DAY_FMT "%d" /* Windows' strftime function does not support %e format. */ +#else +#define DAY_FMT "%e" /* Day number without leading zeros */ +#endif + if (tim < now - HALF_YEAR || tim > now + HALF_YEAR) + fmt = bsdtar->day_first ? DAY_FMT " %b %Y" : "%b " DAY_FMT " %Y"; + else + fmt = bsdtar->day_first ? DAY_FMT " %b %H:%M" : "%b " DAY_FMT " %H:%M"; + strftime(tmp, sizeof(tmp), fmt, localtime(&tim)); + fprintf(out, " %s ", tmp); + safe_fprintf(out, "%s", archive_entry_pathname(entry)); + + /* Extra information for links. */ + if (archive_entry_hardlink(entry)) /* Hard link */ + safe_fprintf(out, " link to %s", + archive_entry_hardlink(entry)); + else if (archive_entry_symlink(entry)) /* Symbolic link */ + safe_fprintf(out, " -> %s", archive_entry_symlink(entry)); +} diff --git a/tar/write.c b/tar/write.c index 40d2fb0a9f52..53b63834c419 100644 --- a/tar/write.c +++ b/tar/write.c @@ -236,6 +236,13 @@ tar_mode_c(struct bsdtar *bsdtar) } set_writer_options(bsdtar, a); + if (bsdtar->passphrase != NULL) + r = archive_write_set_passphrase(a, bsdtar->passphrase); + else + r = archive_write_set_passphrase_callback(a, bsdtar, + &passphrase_callback); + if (r != ARCHIVE_OK) + lafe_errc(1, 0, "%s", archive_error_string(a)); if (ARCHIVE_OK != archive_write_open_filename(a, bsdtar->filename)) lafe_errc(1, 0, "%s", archive_error_string(a)); write_archive(a, bsdtar); @@ -647,7 +654,15 @@ append_archive_filename(struct bsdtar *bsdtar, struct archive *a, ina = archive_read_new(); archive_read_support_format_all(ina); archive_read_support_filter_all(ina); - set_reader_options(bsdtar, a); + set_reader_options(bsdtar, ina); + archive_read_set_options(ina, "mtree:checkfs"); + if (bsdtar->passphrase != NULL) + rc = archive_read_add_passphrase(a, bsdtar->passphrase); + else + rc = archive_read_set_passphrase_callback(ina, bsdtar, + &passphrase_callback); + if (rc != ARCHIVE_OK) + lafe_errc(1, 0, "%s", archive_error_string(a)); if (archive_read_open_filename(ina, filename, bsdtar->bytes_per_block)) { lafe_warnc(0, "%s", archive_error_string(ina)); @@ -679,7 +694,10 @@ append_archive(struct bsdtar *bsdtar, struct archive *a, struct archive *ina) if (bsdtar->option_interactive && !yes("copy '%s'", archive_entry_pathname(in_entry))) continue; - if (bsdtar->verbose) + if (bsdtar->verbose > 1) { + safe_fprintf(stderr, "a "); + list_item_verbose(bsdtar, stderr, in_entry); + } else if (bsdtar->verbose > 0) safe_fprintf(stderr, "a %s", archive_entry_pathname(in_entry)); if (need_report()) @@ -899,11 +917,15 @@ write_hierarchy(struct bsdtar *bsdtar, struct archive *a, const char *path) if (edit_pathname(bsdtar, entry)) continue; - /* Display entry as we process it. - * This format is required by SUSv2. */ - if (bsdtar->verbose) + /* Display entry as we process it. */ + if (bsdtar->verbose > 1) { + safe_fprintf(stderr, "a "); + list_item_verbose(bsdtar, stderr, entry); + } else if (bsdtar->verbose > 0) { + /* This format is required by SUSv2. */ safe_fprintf(stderr, "a %s", archive_entry_pathname(entry)); + } /* Non-regular files get archived with zero size. */ if (archive_entry_filetype(entry) != AE_IFREG) @@ -947,11 +969,15 @@ write_entry(struct bsdtar *bsdtar, struct archive *a, e = archive_write_header(a, entry); if (e != ARCHIVE_OK) { - if (!bsdtar->verbose) + if (bsdtar->verbose > 1) { + safe_fprintf(stderr, "a "); + list_item_verbose(bsdtar, stderr, entry); + lafe_warnc(0, ": %s", archive_error_string(a)); + } else if (bsdtar->verbose > 0) { lafe_warnc(0, "%s: %s", archive_entry_pathname(entry), archive_error_string(a)); - else + } else fprintf(stderr, ": %s", archive_error_string(a)); }