Module Name: src Committed By: joerg Date: Tue Sep 25 05:39:19 UTC 2018
Modified Files: src/external/public-domain/xz/dist: configure.ac src/external/public-domain/xz/dist/src/liblzma/check: check.h src/external/public-domain/xz/dist/src/xz: args.c Log Message: Revert to vendor state. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/public-domain/xz/dist/configure.ac cvs rdiff -u -r1.3 -r1.4 \ src/external/public-domain/xz/dist/src/liblzma/check/check.h cvs rdiff -u -r1.2 -r1.3 src/external/public-domain/xz/dist/src/xz/args.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/external/public-domain/xz/dist/configure.ac diff -u src/external/public-domain/xz/dist/configure.ac:1.4 src/external/public-domain/xz/dist/configure.ac:1.5 --- src/external/public-domain/xz/dist/configure.ac:1.4 Fri Apr 17 18:49:23 2015 +++ src/external/public-domain/xz/dist/configure.ac Tue Sep 25 05:39:19 2018 @@ -15,20 +15,27 @@ # of malloc(), stat(), or lstat(), since we don't use those functions in # a way that would cause the problems the autoconf macros check. -AC_PREREQ([2.52]) +AC_PREREQ([2.64]) -AC_INIT([XZ Utils], 5.0.0, [jo...@netbsd.org], [xz], [http://tukaani.org/xz/]) +AC_INIT([XZ Utils], m4_esyscmd([/bin/sh build-aux/version.sh]), + [lasse.col...@tukaani.org], [xz], [https://tukaani.org/xz/]) +AC_CONFIG_SRCDIR([src/liblzma/common/common.h]) +AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADER([config.h]) -AC_CONFIG_AUX_DIR([../../gnu/dist/autoconf/config]) +echo +echo "$PACKAGE_STRING" + +echo +echo "System type:" +# This is needed to know if assembler optimizations can be used. AC_CANONICAL_HOST -AC_USE_SYSTEM_EXTENSIONS # We do some special things on Windows (32-bit or 64-bit) builds. case $host_os in - mingw* | cygwin*) is_w32=yes ;; - *) is_w32=no ;; + mingw* | cygwin | msys) is_w32=yes ;; + *) is_w32=no ;; esac AM_CONDITIONAL([COND_W32], [test "$is_w32" = yes]) @@ -36,9 +43,15 @@ AM_CONDITIONAL([COND_W32], [test "$is_w3 # executables. Cygwin is an exception to this, since it is recommended # that symlinks don't have the .exe suffix. To make this work, we # define LN_EXEEXT. +# +# MSYS2 is treated the same way as Cygwin. It uses plain "msys" like +# the original MSYS when building MSYS/MSYS2-binaries. Hopefully this +# doesn't break things for the original MSYS developers. Note that this +# doesn't affect normal MSYS/MSYS2 users building non-MSYS/MSYS2 binaries +# since in that case the $host_os is usually mingw32. case $host_os in - cygwin) LN_EXEEXT= ;; - *) LN_EXEEXT='$(EXEEXT)' ;; + cygwin | msys) LN_EXEEXT= ;; + *) LN_EXEEXT='$(EXEEXT)' ;; esac AC_SUBST([LN_EXEEXT]) @@ -84,6 +97,7 @@ AC_ARG_ENABLE([encoders], AS_HELP_STRING [], [enable_encoders=SUPPORTED_FILTERS]) enable_encoders=`echo "$enable_encoders" | sed 's/,/ /g'` if test "x$enable_encoders" = xno || test "x$enable_encoders" = x; then + enable_encoders=no AC_MSG_RESULT([(none)]) else for arg in $enable_encoders @@ -101,6 +115,8 @@ else ;; esac done + AC_DEFINE([HAVE_ENCODERS], [1], + [Define to 1 if any of HAVE_ENCODER_foo have been defined.]) AC_MSG_RESULT([$enable_encoders]) fi @@ -111,6 +127,7 @@ AC_ARG_ENABLE([decoders], AS_HELP_STRING [], [enable_decoders=SUPPORTED_FILTERS]) enable_decoders=`echo "$enable_decoders" | sed 's/,/ /g'` if test "x$enable_decoders" = xno || test "x$enable_decoders" = x; then + enable_decoders=no AC_MSG_RESULT([(none)]) else for arg in $enable_decoders @@ -128,11 +145,8 @@ else ;; esac done - - # LZMA2 requires that LZMA1 is enabled. - test "x$enable_encoder_lzma2" = xyes && enable_encoder_lzma1=yes - test "x$enable_decoder_lzma2" = xyes && enable_decoder_lzma1=yes - + AC_DEFINE([HAVE_DECODERS], [1], + [Define to 1 if any of HAVE_DECODER_foo have been defined.]) AC_MSG_RESULT([$enable_decoders]) fi @@ -141,8 +155,8 @@ if test "x$enable_encoder_lzma2$enable_e AC_MSG_ERROR([LZMA2 requires that LZMA1 is also enabled.]) fi -AM_CONDITIONAL(COND_MAIN_ENCODER, test "x$enable_encoders" != xno && test "x$enable_encoders" != x) -AM_CONDITIONAL(COND_MAIN_DECODER, test "x$enable_decoders" != xno && test "x$enable_decoders" != x) +AM_CONDITIONAL(COND_MAIN_ENCODER, test "x$enable_encoders" != xno) +AM_CONDITIONAL(COND_MAIN_DECODER, test "x$enable_decoders" != xno) m4_foreach([NAME], [SUPPORTED_FILTERS], [AM_CONDITIONAL(COND_FILTER_[]m4_toupper(NAME), test "x$enable_filter_[]NAME" = xyes) @@ -176,12 +190,6 @@ AM_CONDITIONAL(COND_FILTER_LZ, test "x$e AM_CONDITIONAL(COND_ENCODER_LZ, test "x$enable_encoder_lz" = xyes) AM_CONDITIONAL(COND_DECODER_LZ, test "x$enable_decoder_lz" = xyes) -m4_foreach([NAME], [SUPPORTED_FILTERS], [ - AC_DEFINE(HAVE_ENCODER_[]m4_toupper(NAME), [1], - [Define to 1 if] NAME [encoder is enabled.]) - AC_DEFINE(HAVE_DECODER_[]m4_toupper(NAME), [1], - [Define to 1 if] NAME [decoder is enabled.]) -]) ################# # Match finders # @@ -189,9 +197,8 @@ m4_foreach([NAME], [SUPPORTED_FILTERS], m4_define([SUPPORTED_MATCH_FINDERS], [hc3,hc4,bt2,bt3,bt4]) -m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS], [ - AC_DEFINE(HAVE_MF_[]m4_toupper(NAME), [1], - [Define to 1 to enable] NAME [match finder.]) +m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS], +[enable_match_finder_[]NAME=no ]) AC_MSG_CHECKING([which match finders to build]) @@ -268,20 +275,60 @@ m4_foreach([NAME], [SUPPORTED_CHECKS], [AM_CONDITIONAL(COND_CHECK_[]m4_toupper(NAME), test "x$enable_check_[]NAME" = xyes) ])dnl +AC_MSG_CHECKING([if external SHA-256 should be used]) +AC_ARG_ENABLE([external-sha256], AS_HELP_STRING([--enable-external-sha256], + [Use SHA-256 code from the operating system. + See INSTALL for possible subtle problems.]), + [], [enable_external_sha256=no]) +if test "x$enable_check_sha256" != "xyes"; then + enable_external_sha256=no +fi +if test "x$enable_external_sha256" = xyes; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi + ########################### # Assembler optimizations # ########################### -AM_CONDITIONAL(COND_ASM_X86, false) -AM_CONDITIONAL(COND_ASM_X86_64, false) +AC_MSG_CHECKING([if assembler optimizations should be used]) +AC_ARG_ENABLE([assembler], AS_HELP_STRING([--disable-assembler], + [Do not use assembler optimizations even if such exist + for the architecture.]), + [], [enable_assembler=yes]) +if test "x$enable_assembler" = xyes; then + enable_assembler=no + case $host_os in + # Darwin should work too but only if not creating universal + # binaries. Solaris x86 could work too but I cannot test. + linux* | *bsd* | mingw* | cygwin | msys | *djgpp*) + case $host_cpu in + i?86) enable_assembler=x86 ;; + x86_64) enable_assembler=x86_64 ;; + esac + ;; + esac +fi +case $enable_assembler in + x86 | x86_64 | no) + AC_MSG_RESULT([$enable_assembler]) + ;; + *) + AC_MSG_RESULT([]) + AC_MSG_ERROR([--enable-assembler accepts only `yes', `no', `x86', or `x86_64'.]) + ;; +esac +AM_CONDITIONAL(COND_ASM_X86, test "x$enable_assembler" = xx86) +AM_CONDITIONAL(COND_ASM_X86_64, test "x$enable_assembler" = xx86_64) ##################### # Size optimization # ##################### -if false; then AC_MSG_CHECKING([if small size is preferred over speed]) AC_ARG_ENABLE([small], AS_HELP_STRING([--enable-small], [Make liblzma smaller and a little slower. @@ -295,7 +342,6 @@ elif test "x$enable_small" != xno; then fi AC_MSG_RESULT([$enable_small]) AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes) -fi ############# @@ -384,18 +430,21 @@ AM_CONDITIONAL([COND_XZ], [test x$enable AC_ARG_ENABLE([xzdec], [AS_HELP_STRING([--disable-xzdec], [do not build xzdec])], [], [enable_xzdec=yes]) +test "x$enable_decoders" = xno && enable_xzdec=no AM_CONDITIONAL([COND_XZDEC], [test x$enable_xzdec != xno]) AC_ARG_ENABLE([lzmadec], [AS_HELP_STRING([--disable-lzmadec], [do not build lzmadec (it exists primarily for LZMA Utils compatibility)])], [], [enable_lzmadec=yes]) +test "x$enable_decoder_lzma1" = xno && enable_lzmadec=no AM_CONDITIONAL([COND_LZMADEC], [test x$enable_lzmadec != xno]) AC_ARG_ENABLE([lzmainfo], [AS_HELP_STRING([--disable-lzmainfo], [do not build lzmainfo (it exists primarily for LZMA Utils compatibility)])], [], [enable_lzmainfo=yes]) +test "x$enable_decoder_lzma1" = xno && enable_lzmainfo=no AM_CONDITIONAL([COND_LZMAINFO], [test x$enable_lzmainfo != xno]) AC_ARG_ENABLE([lzma-links], [AS_HELP_STRING([--disable-lzma-links], @@ -443,6 +492,30 @@ AC_MSG_RESULT([$enable_symbol_versions]) AM_CONDITIONAL([COND_SYMVERS], [test "x$enable_symbol_versions" = xyes]) +############## +# Sandboxing # +############## + +AC_MSG_CHECKING([if sandboxing should be used]) +AC_ARG_ENABLE([sandbox], [AS_HELP_STRING([--enable-sandbox=METHOD], + [This is an experimental feature. + Sandboxing METHOD can be `auto', `no', or `capsicum'. + The default is `no'.])], + [], [enable_sandbox=no]) +case $enable_sandbox in + auto) + AC_MSG_RESULT([maybe (autodetect)]) + ;; + no | capsicum) + AC_MSG_RESULT([$enable_sandbox]) + ;; + *) + AC_MSG_RESULT([]) + AC_MSG_ERROR([--enable-sandbox only accepts `auto', `no', or `capsicum'.]) + ;; +esac + + ############################################################################### # Checks for programs. ############################################################################### @@ -536,7 +609,7 @@ AM_CONDITIONAL([COND_SHARED], [test "x$e echo echo "Initializing gettext:" -AM_GNU_GETTEXT_VERSION([0.18]) +AM_GNU_GETTEXT_VERSION([0.19]) AM_GNU_GETTEXT([external]) @@ -544,8 +617,8 @@ AM_GNU_GETTEXT([external]) # Checks for header files. ############################################################################### -AC_DEFINE_UNQUOTED([ASSUME_RAM], [128], - [How many MiB of RAM to assume if the real amount cannot be determined.]) +echo +echo "System headers and functions:" # There is currently no workarounds in this package if some of # these headers are missing. @@ -590,11 +663,19 @@ AC_CHECK_MEMBERS([ AC_SYS_LARGEFILE AC_C_BIGENDIAN + +############################################################################### +# Checks for library functions. +############################################################################### + +# Gnulib replacements as needed +gl_GETOPT + # Find the best function to set timestamps. -AC_CHECK_FUNCS([futimens futimes futimesat utimes utime], [break]) +AC_CHECK_FUNCS([futimens futimes futimesat utimes _futime utime], [break]) -# These are nice to have but not mandatory. -AC_CHECK_FUNCS([posix_fadvise pipe2]) +# This is nice to have but not mandatory. +AC_CHECK_FUNCS([posix_fadvise]) TUKLIB_PROGNAME TUKLIB_INTEGER @@ -602,34 +683,34 @@ TUKLIB_PHYSMEM TUKLIB_CPUCORES TUKLIB_MBSTR -# Check for system-provided SHA-256. At least the following is supported: +# If requsted, check for system-provided SHA-256. At least the following +# implementations are supported: # # OS Headers Library Type Function # FreeBSD sys/types.h + sha256.h libmd SHA256_CTX SHA256_Init # NetBSD sys/types.h + sha2.h SHA256_CTX SHA256_Init # OpenBSD sys/types.h + sha2.h SHA2_CTX SHA256Init # Solaris sys/types.h + sha2.h libmd SHA256_CTX SHA256Init -# MINIX 3 sys/types.h + minix/sha2.h libutil SHA256_CTX SHA256_Init +# MINIX 3 sys/types.h + sha2.h SHA256_CTX SHA256_Init # Darwin CommonCrypto/CommonDigest.h CC_SHA256_CTX CC_SHA256_Init # # Note that Darwin's CC_SHA256_Update takes buffer size as uint32_t instead # of size_t. # -# We don't check for e.g. OpenSSL or libgcrypt because we don't want -# to introduce dependencies to other packages by default. Maybe such -# libraries could be supported via additional configure options though. -# -if test "x$enable_check_sha256" = "xyes"; then +sha256_header_found=no +sha256_type_found=no +sha256_func_found=no +if test "x$enable_external_sha256" = "xyes"; then # Test for Common Crypto before others, because Darwin has sha256.h # too and we don't want to use that, because on older versions it # uses OpenSSL functions, whose SHA256_Init is not guaranteed to # succeed. - sha256_header_found=no AC_CHECK_HEADERS( - [CommonCrypto/CommonDigest.h sha256.h sha2.h minix/sha2.h], + [CommonCrypto/CommonDigest.h sha256.h sha2.h], [sha256_header_found=yes ; break]) if test "x$sha256_header_found" = xyes; then - AC_CHECK_TYPES([CC_SHA256_CTX, SHA256_CTX, SHA2_CTX], [], [], + AC_CHECK_TYPES([CC_SHA256_CTX, SHA256_CTX, SHA2_CTX], + [sha256_type_found=yes], [], [[#ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif @@ -641,20 +722,19 @@ if test "x$enable_check_sha256" = "xyes" #endif #ifdef HAVE_SHA2_H # include <sha2.h> - #endif - #ifdef HAVE_MINIX_SHA2_H - # include <minix/sha2.h> #endif]]) - AC_SEARCH_LIBS([SHA256_Init], [md util]) - AC_SEARCH_LIBS([SHA256Init], [md]) - AC_CHECK_FUNCS([CC_SHA256_Init SHA256_Init SHA256Init], - [break]) + if test "x$sha256_type_found" = xyes ; then + AC_SEARCH_LIBS([SHA256Init], [md]) + AC_SEARCH_LIBS([SHA256_Init], [md]) + AC_CHECK_FUNCS([CC_SHA256_Init SHA256Init SHA256_Init], + [sha256_func_found=yes ; break]) + fi fi fi -AM_CONDITIONAL([COND_INTERNAL_SHA256], - [test "x$ac_cv_func_SHA256_Init" != xyes \ - && test "x$ac_cv_func_SHA256Init" != xyes \ - && test "x$ac_cv_func_CC_SHA256_Init" != xyes]) +AM_CONDITIONAL([COND_INTERNAL_SHA256], [test "x$sha256_func_found" = xno]) +if test "x$enable_external_sha256$sha256_func_found" = xyesno; then + AC_MSG_ERROR([--enable-external-sha256 was specified but no supported external SHA-256 implementation was found]) +fi # Check for SSE2 intrinsics. AC_CHECK_DECL([_mm_movemask_epi8], @@ -665,6 +745,23 @@ AC_CHECK_DECL([_mm_movemask_epi8], #include <immintrin.h> #endif]) +# Check for sandbox support. If one is found, set enable_sandbox=found. +case $enable_sandbox in + auto | capsicum) + AX_CHECK_CAPSICUM([enable_sandbox=found], [:]) + ;; +esac + +# If a specific sandboxing method was explicitly requested and it wasn't +# found, give an error. +case $enable_sandbox in + auto | no | found) + ;; + *) + AC_MSG_ERROR([$enable_sandbox support not found]) + ;; +esac + ############################################################################### # If using GCC, set some additional AM_CFLAGS: Index: src/external/public-domain/xz/dist/src/liblzma/check/check.h diff -u src/external/public-domain/xz/dist/src/liblzma/check/check.h:1.3 src/external/public-domain/xz/dist/src/liblzma/check/check.h:1.4 --- src/external/public-domain/xz/dist/src/liblzma/check/check.h:1.3 Fri Apr 17 18:49:23 2015 +++ src/external/public-domain/xz/dist/src/liblzma/check/check.h Tue Sep 25 05:39:19 2018 @@ -15,10 +15,18 @@ #include "common.h" -#ifdef NETBSD_NATIVE_SHA256 -#include <sha2.h> -#else -#if defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H) +// If the function for external SHA-256 is missing, use the internal SHA-256 +// code. Due to how configure works, these defines can only get defined when +// both a usable header and a type have already been found. +#if !(defined(HAVE_CC_SHA256_INIT) \ + || defined(HAVE_SHA256_INIT) \ + || defined(HAVE_SHA256INIT)) +# define HAVE_INTERNAL_SHA256 1 +#endif + +#if defined(HAVE_INTERNAL_SHA256) +// Nothing +#elif defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H) # include <CommonCrypto/CommonDigest.h> #elif defined(HAVE_SHA256_H) # include <sys/types.h> @@ -26,19 +34,9 @@ #elif defined(HAVE_SHA2_H) # include <sys/types.h> # include <sha2.h> -#elif defined(HAVE_MINIX_SHA2_H) -# include <sys/types.h> -# include <minix/sha2.h> -#endif #endif -#if defined(HAVE_CC_SHA256_CTX) -typedef CC_SHA256_CTX lzma_sha256_state; -#elif defined(HAVE_SHA256_CTX) -typedef SHA256_CTX lzma_sha256_state; -#elif defined(HAVE_SHA2_CTX) -typedef SHA2_CTX lzma_sha256_state; -#else +#if defined(HAVE_INTERNAL_SHA256) /// State for the internal SHA-256 implementation typedef struct { /// Internal state @@ -47,9 +45,17 @@ typedef struct { /// Size of the message excluding padding uint64_t size; } lzma_sha256_state; +#elif defined(HAVE_CC_SHA256_CTX) +typedef CC_SHA256_CTX lzma_sha256_state; +#elif defined(HAVE_SHA256_CTX) +typedef SHA256_CTX lzma_sha256_state; +#elif defined(HAVE_SHA2_CTX) +typedef SHA2_CTX lzma_sha256_state; #endif -#if defined(HAVE_CC_SHA256_INIT) +#if defined(HAVE_INTERNAL_SHA256) +// Nothing +#elif defined(HAVE_CC_SHA256_INIT) # define LZMA_SHA256FUNC(x) CC_SHA256_ ## x #elif defined(HAVE_SHA256_INIT) # define LZMA_SHA256FUNC(x) SHA256_ ## x @@ -84,15 +90,10 @@ typedef struct { union { uint32_t crc32; uint64_t crc64; -#ifdef NETBSD_NATIVE_SHA256 - SHA256_CTX sha256; -#else lzma_sha256_state sha256; -#endif } state; } lzma_check_state; -#endif /// lzma_crc32_table[0] is needed by LZ encoder so we need to keep @@ -120,14 +121,6 @@ extern void lzma_check_update(lzma_check /// Finish the check calculation and store the result to check->buffer.u8. extern void lzma_check_finish(lzma_check_state *check, lzma_check type); -#ifdef NETBSD_NATIVE_SHA256 -#define lzma_sha256_init(check) \ - SHA256_Init(&(check)->state.sha256) -#define lzma_sha256_update(buf,size,check) \ - SHA256_Update(&(check)->state.sha256, buf, size) -#define lzma_sha256_finish(check) \ - SHA256_Final((check)->buffer.u8, &(check)->state.sha256) -#else #ifndef LZMA_SHA256FUNC Index: src/external/public-domain/xz/dist/src/xz/args.c diff -u src/external/public-domain/xz/dist/src/xz/args.c:1.2 src/external/public-domain/xz/dist/src/xz/args.c:1.3 --- src/external/public-domain/xz/dist/src/xz/args.c:1.2 Sat May 9 15:28:25 2015 +++ src/external/public-domain/xz/dist/src/xz/args.c Tue Sep 25 05:39:19 2018 @@ -107,8 +107,6 @@ parse_block_list(char *str) } } - if (p == NULL) - break; str = p + 1; } @@ -637,6 +635,22 @@ args_parse(args_info *args, int argc, ch // Then from the command line parse_real(args, argc, argv); + // If encoder or decoder support was omitted at build time, + // show an error now so that the rest of the code can rely on + // that whatever is in opt_mode is also supported. +#ifndef HAVE_ENCODERS + if (opt_mode == MODE_COMPRESS) + message_fatal(_("Compression support was disabled " + "at build time")); +#endif +#ifndef HAVE_DECODERS + // Even MODE_LIST cannot work without decoder support so MODE_COMPRESS + // is the only valid choice. + if (opt_mode != MODE_COMPRESS) + message_fatal(_("Decompression support was disabled " + "at build time")); +#endif + // Never remove the source file when the destination is not on disk. // In test mode the data is written nowhere, but setting opt_stdout // will make the rest of the code behave well.