From fbb1b16ad8bc7a6f9a32424ddbd61e59ad5a4d4d Mon Sep 17 00:00:00 2001 From: Martin Matuska Date: Tue, 12 Feb 2019 22:29:41 +0000 Subject: Update vendor/libarchive/dist to git 31c0a517c91f44eeee717a04db8b075cadda83d8 Relevant vendor changes: PR #1085: Fix a null pointer dereference bug in zip writer PR #1110: ZIP reader added support for XZ, LZMA, PPMD8 and BZIP2 decopmpression PR #1116: Add support for 64-bit ar format PR #1120: Fix a 7zip crash [1] and a ISO9660 infinite loop [2] PR #1125: RAR5 reader - fix an invalid read and a memory leak PR #1131: POSIX reader - do not fail when tree_current_lstat() fails due to ENOENT [3] PR #1134: Delete unnecessary null pointer checks before calls of free() OSS-Fuzz 10843: Force intermediate to uint64_t to make UBSAN happy. OSS-Fuzz 11011: Avoid buffer overflow in rar5 reader PR: 233006 [3] Security: CVE-2019-1000019 [1], CVE-2019-1000020 [2] --- build/ci/build.sh | 112 ++++++++++++++++++++++++++++++++++++++ build/ci/cirrus_ci.sh | 53 ++++++++++++++++++ build/ci/test_driver | 148 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 313 insertions(+) create mode 100755 build/ci/build.sh create mode 100755 build/ci/cirrus_ci.sh create mode 100755 build/ci/test_driver (limited to 'build/ci') diff --git a/build/ci/build.sh b/build/ci/build.sh new file mode 100755 index 000000000000..d61336eafb0e --- /dev/null +++ b/build/ci/build.sh @@ -0,0 +1,112 @@ +#!/bin/sh +# +# Automated build and test of libarchive on CI systems +# +# Variables that can be passed via environment: +# BS= # build system (autotools or cmake) +# BUILDDIR= # build directory +# SRCDIR= # source directory +# CONFIGURE_ARGS= # configure arguments +# MAKE_ARGS= # make arguments + +ACTIONS= +if [ -n "${BUILD_SYSTEM}" ]; then + BS="${BUILD_SYSTEM}" +fi +BS="${BS:-autotools}" +MAKE="${MAKE:-make}" +CMAKE="${CMAKE:-cmake}" +CURDIR=`pwd` +SRCDIR="${SRCDIR:-`pwd`}" +RET=0 + +usage () { + echo "Usage: $0 [-b autotools|cmake] [-a autogen|configure|build|test ] [ -a ... ] [ -d builddir ] [-s srcdir ]" +} +inputerror () { + echo $1 + usage + exit 1 +} +while getopts a:b:d:s: opt; do + case ${opt} in + a) + case "${OPTARG}" in + autogen) ;; + configure) ;; + build) ;; + test) ;; + *) inputerror "Invalid action (-a)" ;; + esac + ACTIONS="${ACTIONS} ${OPTARG}" + ;; + b) BS="${OPTARG}" + case "${BS}" in + autotools) ;; + cmake) ;; + *) inputerror "Invalid build system (-b)" ;; + esac + ;; + d) + BUILDDIR="${OPTARG}" + ;; + s) + SRCDIR="${OPTARG}" + if [ ! -f "${SRCDIR}/build/version" ]; then + inputerror "Missing file: ${SRCDIR}/build/version" + fi + ;; + esac +done +if [ -z "${ACTIONS}" ]; then + ACTIONS="autogen configure build test" +fi +if [ -z "${BS}" ]; then + inputerror "Missing build system (-b) parameter" +fi +if [ -z "${BUILDDIR}" ]; then + BUILDDIR="${CURDIR}/build_ci/${BS}" +fi +mkdir -p "${BUILDDIR}" +for action in ${ACTIONS}; do + cd "${BUILDDIR}" + case "${action}" in + autogen) + case "${BS}" in + autotools) + cd "${SRCDIR}" + sh build/autogen.sh + RET="$?" + ;; + esac + ;; + configure) + case "${BS}" in + autotools) "${SRCDIR}/configure" ${CONFIGURE_ARGS} ;; + cmake) ${CMAKE} ${CONFIGURE_ARGS} "${SRCDIR}" ;; + esac + RET="$?" + ;; + build) + ${MAKE} ${MAKE_ARGS} + RET="$?" + ;; + test) + case "${BS}" in + autotools) + ${MAKE} ${MAKE_ARGS} check LOG_DRIVER="${SRCDIR}/build/ci/test_driver" + ;; + cmake) + ${MAKE} ${MAKE_ARGS} test + ;; + esac + RET="$?" + find ${TMPDIR:-/tmp} -path '*_test.*' -name '*.log' -print -exec cat {} \; + ;; + esac + if [ "${RET}" != "0" ]; then + exit "${RET}" + fi + cd "${CURDIR}" +done +exit "${RET}" diff --git a/build/ci/cirrus_ci.sh b/build/ci/cirrus_ci.sh new file mode 100755 index 000000000000..9db762f97cca --- /dev/null +++ b/build/ci/cirrus_ci.sh @@ -0,0 +1,53 @@ +#!/bin/sh +UNAME=`uname` +if [ "$1" = "install" ] +then + if [ "${UNAME}" = "FreeBSD" ] + then + set -x -e + sed -i.bak -e 's,pkg+http://pkg.FreeBSD.org/\${ABI}/quarterly,pkg+http://pkg.FreeBSD.org/\${ABI}/latest,' /etc/pkg/FreeBSD.conf + mount -u -o acls / + mkdir /tmp_acl_nfsv4 + MD=`mdconfig -a -t swap -s 128M` + newfs /dev/$MD + tunefs -N enable /dev/$MD + mount /dev/$MD /tmp_acl_nfsv4 + chmod 1777 /tmp_acl_nfsv4 + pkg install -y autoconf automake cmake libiconv libtool pkgconf expat libxml2 liblz4 zstd + elif [ "${UNAME}" = "Darwin" ] + then + set -x -e + brew update + brew install autoconf automake libtool pkg-config cmake xz lz4 zstd + elif [ "${UNAME}" = "Linux" ] + then + if [ -f "/etc/debian_version" ] + then + apt-get -y update + apt-get -y install build-essential locales automake libtool bison sharutils pkgconf libacl1-dev libbz2-dev libzip-dev zlib1g-dev liblzma-dev liblz4-dev libzstd-dev libssl-dev lrzip cmake + elif [ -f "/etc/fedora-release" ] + then + dnf -y install make cmake gcc gcc-c++ kernel-devel automake libtool bison sharutils pkgconf libacl-devel librichacl-devel bzip2-devel libzip-devel zlib-devel xz-devel lz4-devel libzstd-devel openssl-devel + fi + fi +elif [ "$1" = "test" ] +then + if [ "${UNAME}" = "FreeBSD" ] + then + set -e + echo "Additional NFSv4 ACL tests" + CURDIR=`pwd` + if [ "${BS}" = "cmake" ] + then + BIN_SUBDIR="bin" + else + BIN_SUBDIR=. + fi + BUILDDIR="${CURDIR}/build_ci/${BS}" + cd "$BUILDDIR" + TMPDIR=/tmp_acl_nfsv4 ${BIN_SUBDIR}/libarchive_test -r "${CURDIR}/libarchive/test" -v test_acl_platform_nfs4 + fi +else + echo "Usage $0 install | test_nfsv4_acls" + exit 1 +fi diff --git a/build/ci/test_driver b/build/ci/test_driver new file mode 100755 index 000000000000..69a5463c10e8 --- /dev/null +++ b/build/ci/test_driver @@ -0,0 +1,148 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2013-07-13.22; # UTC + +# Copyright (C) 2011-2014 Free Software Foundation, Inc. +# +# 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 2, 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 to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +usage_error () +{ + echo "$0: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat < $log_file.s ) | tee $log_file 2>&1 +estatus=`cat $log_file.s` + +if test $enable_hard_errors = no && test $estatus -eq 99; then + tweaked_estatus=1 +else + tweaked_estatus=$estatus +fi + +case $tweaked_estatus:$expect_failure in + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$grn res=PASS recheck=no gcopy=no;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; + *:*) col=$red res=FAIL recheck=yes gcopy=yes;; +esac + +# Report the test outcome and exit status in the logs, so that one can +# know whether the test passed or failed simply by looking at the '.log' +# file, without the need of also peaking into the corresponding '.trs' +# file (automake bug#11814). +echo "$res $test_name (exit status: $estatus)" >>$log_file + +# Report outcome to console. +echo "${col}${res}${std}: $test_name" + +# Register the test result, and other relevant metadata. +echo ":test-result: $res" > $trs_file +echo ":global-test-result: $res" >> $trs_file +echo ":recheck: $recheck" >> $trs_file +echo ":copy-in-global-log: $gcopy" >> $trs_file + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: -- cgit v1.2.3