From 7d9c37e57b47215ed378ada8176ee3183ac5536f Mon Sep 17 00:00:00 2001 From: Joachim Metz Date: Wed, 4 Sep 2019 07:18:47 +0200 Subject: [PATCH] Applied updates --- .travis.yml | 80 +++++++++++++------------------- .travis/before_install.sh | 39 ++++++++++++++++ .travis/install.sh | 32 +++++++++++++ .travis/runtests.sh | 31 +++++++++++++ .travis/script.sh | 39 ++++++++++++++++ .travis/script_docker.sh | 29 ++++++++++++ configure.ac | 2 +- libpff/libpff_item_values.c | 16 +++---- libpff/libpff_item_values.h | 8 ++-- libpff/libpff_table.c | 18 +++---- libpff/libpff_table.h | 8 ++-- m4/libfdata.m4 | 4 +- msvscpp/libfdata/libfdata.vcproj | 4 -- tests/test_pffexport.sh | 14 +++--- 14 files changed, 237 insertions(+), 87 deletions(-) create mode 100755 .travis/before_install.sh create mode 100755 .travis/install.sh create mode 100755 .travis/runtests.sh create mode 100755 .travis/script.sh create mode 100755 .travis/script_docker.sh diff --git a/.travis.yml b/.travis.yml index 1696e9c9..3318803e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,32 @@ matrix: dist: xenial sudo: required group: edge + - name: "Linux with gcc on PowerPC 64-bit" + env: + - CONFIGURE_OPTIONS="" + - CFLAGS="--coverage" + - LDFLAGS="--coverage" + - TARGET="linux-gcc" + compiler: gcc + os: linux-ppc64le + dist: xenial + sudo: required + group: edge + - name: "Linux with gcc on s390x (Docker)" + env: + - DOCKERHUB_REPO="s390x/ubuntu" + - DOCKERHUB_TAG="bionic" + - CONFIGURE_OPTIONS="" + - CFLAGS="--coverage" + - LDFLAGS="--coverage" + - TARGET="docker" + compiler: gcc + os: linux + dist: xenial + sudo: required + group: edge + services: + - docker - name: "Linux with gcc and wide character type (wchar_t) support" env: - CONFIGURE_OPTIONS="--enable-wide-character-type" @@ -197,54 +223,12 @@ matrix: os: osx osx_image: xcode8.3 before_install: - - if test ${TRAVIS_OS_NAME} = "linux"; then - sudo apt-get update && sudo apt-mark hold mysql-server-5.7 && sudo apt-get --fix-missing -o Dpkg::Options::="--force-confold" upgrade -y --allow-unauthenticated && sudo apt-get install -y autopoint zlib1g-dev; - elif test ${TRAVIS_OS_NAME} = "osx"; then - brew update && brew install gettext gnu-sed && brew link --force gettext; - fi - - if test ${TARGET} = "coverity"; then - echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-; - fi +- .travis/before_install.sh install: - - if test ${TRAVIS_OS_NAME} = "osx"; then - export SED="/usr/local/bin/gsed"; - fi - - ./synclibs.sh --use-head && ./autogen.sh - - if test ${TARGET} = "linux-gcc-shared" || test ${TARGET} = "linux-gcc-shared-wide-character-type"; then - ./configure > /dev/null && make > /dev/null && ./syncsharedlibs.sh --use-head; - fi - - if test -x "synctestdata.sh"; then - ./synctestdata.sh; - fi +- .travis/install.sh script: - - if test ${TRAVIS_OS_NAME} = "linux"; then - export PATH=$(echo $PATH | tr ":" "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s/::/:/g"); - fi - - if test ${TARGET} = "linux-gcc-python-setup-py" || test ${TARGET} = "macos-gcc-python-setup-py"; then - ./configure ${CONFIGURE_OPTIONS} && make > /dev/null && python ./setup.py build; - elif test ${TARGET} != "coverity"; then - ./configure ${CONFIGURE_OPTIONS} && make > /dev/null; RESULT=$?; - if test ${RESULT} -eq 0; then - if test ${TARGET} = "macos-gcc-python" || test ${TARGET} = "macos-gcc-pkgbuild"; then - install_name_tool -change /usr/local/lib/libpff.1.dylib ${PWD}/libpff/.libs/libpff.1.dylib ./pypff/.libs/pypff.so; - fi; - make check CHECK_WITH_STDERR=1; RESULT=$?; - fi; - if test ${RESULT} -ne 0; then - if test -f tests/test-suite.log; then - cat tests/test-suite.log; - fi; - return ${RESULT}; - fi; - if test ${TARGET} = "macos-gcc-pkgbuild"; then - VERSION=`sed '5!d; s/^ \[//;s/\],$//' configure.ac` && - make install DESTDIR=${PWD}/osx-pkg && - mkdir -p ${PWD}/osx-pkg/usr/share/doc/libpff && - cp AUTHORS COPYING NEWS README ${PWD}/osx-pkg/usr/share/doc/libpff && - pkgbuild --root osx-pkg --identifier com.github.libyal.libpff --version ${VERSION} --ownership recommended ../libpff-${VERSION}.pkg; - fi - fi +- .travis/script.sh after_success: - - if test ${TARGET} = "linux-gcc-no-optimization"; then - curl -o codecov.sh -s https://codecov.io/bash && sed 's/ -execdir / -exec /' -i ./codecov.sh && /bin/bash ./codecov.sh -n ${TARGET} -y .codecov.yml; - fi +- if test ${TARGET} = "linux-gcc-no-optimization"; then + curl -o codecov.sh -s https://codecov.io/bash && sed 's/ -execdir / -exec /' -i ./codecov.sh && /bin/bash ./codecov.sh -n ${TARGET} -y .codecov.yml; + fi diff --git a/.travis/before_install.sh b/.travis/before_install.sh new file mode 100755 index 00000000..438c8713 --- /dev/null +++ b/.travis/before_install.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# Script to run before_install step on Travis-CI +# +# Version: 20190808 + +# Exit on error. +set -e; + +if test ${TARGET} = "docker"; +then + sudo apt-get update; + sudo apt-mark hold mysql-server-5.7 postgresql-9.4 postgresql-client-9.4 postgresql-9.5 postgresql-client-9.5 postgresql-9.6 postgresql-client-9.6 postgresql-10 postgresql-client-10; + sudo apt-get --fix-missing -o Dpkg::Options::="--force-confold" upgrade -y --allow-unauthenticated; + + sudo apt-get install -y qemu-user-static; + + docker run --rm --privileged multiarch/qemu-user-static --reset -p yes; + +elif test ${TRAVIS_OS_NAME} = "linux" || test ${TRAVIS_OS_NAME} = "linux-ppc64le"; +then + sudo apt-get update; + sudo apt-mark hold mysql-server-5.7 postgresql-9.4 postgresql-client-9.4 postgresql-9.5 postgresql-client-9.5 postgresql-9.6 postgresql-client-9.6 postgresql-10 postgresql-client-10; + sudo apt-get --fix-missing -o Dpkg::Options::="--force-confold" upgrade -y --allow-unauthenticated; + + sudo apt-get install -y autopoint zlib1g-dev; + +elif test ${TRAVIS_OS_NAME} = "osx"; +then + brew update + + brew install gettext gnu-sed; + brew link --force gettext; +fi + +if test ${TARGET} = "coverity"; +then + echo -n | openssl s_client -connect scan.coverity.com:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sudo tee -a /etc/ssl/certs/ca-; +fi + diff --git a/.travis/install.sh b/.travis/install.sh new file mode 100755 index 00000000..f3313fe4 --- /dev/null +++ b/.travis/install.sh @@ -0,0 +1,32 @@ +#!/bin/sh +# Script to run install step on Travis-CI +# +# Version: 20190802 + +# Exit on error. +set -e; + +if test ${TARGET} != "docker"; +then + if test ${TRAVIS_OS_NAME} = "osx"; + then + export SED="/usr/local/bin/gsed"; + fi + + ./synclibs.sh --use-head; + ./autogen.sh; + + if test ${TARGET} = "linux-gcc-shared" || test ${TARGET} = "linux-gcc-shared-wide-character-type"; + then + ./configure > /dev/null; + make > /dev/null; + + ./syncsharedlibs.sh --use-head; + fi + + if test -x "synctestdata.sh"; + then + ./synctestdata.sh; + fi +fi + diff --git a/.travis/runtests.sh b/.travis/runtests.sh new file mode 100755 index 00000000..93575199 --- /dev/null +++ b/.travis/runtests.sh @@ -0,0 +1,31 @@ +#!/bin/sh +# Script to run tests on Travis-CI +# +# Version: 20190808 + +./configure ${CONFIGURE_OPTIONS}; +RESULT=$?; + +if test ${RESULT} -eq 0; +then + make > /dev/null; + RESULT=$?; +fi +if test ${RESULT} -eq 0; +then + if test ${TARGET} = "macos-gcc-python" || test ${TARGET} = "macos-gcc-pkgbuild"; + then + install_name_tool -change /usr/local/lib/libpff.1.dylib ${PWD}/libpff/.libs/libpff.1.dylib ./pypff/.libs/pypff.so; + fi + make check CHECK_WITH_STDERR=1; + RESULT=$?; +fi +if test ${RESULT} -ne 0; +then + if test -f tests/test-suite.log; + then + cat tests/test-suite.log; + fi +fi +exit ${RESULT}; + diff --git a/.travis/script.sh b/.travis/script.sh new file mode 100755 index 00000000..cf303f3d --- /dev/null +++ b/.travis/script.sh @@ -0,0 +1,39 @@ +#!/bin/sh +# Script to run script step on Travis-CI +# +# Version: 20190808 + +# Exit on error. +set -e; + +if test ${TRAVIS_OS_NAME} = "linux" || test ${TRAVIS_OS_NAME} = "linux-ppc64le"; +then + export PATH=$(echo $PATH | tr ":" "\n" | sed '/\/opt\/python/d' | tr "\n" ":" | sed "s/::/:/g"); +fi + +if test ${TARGET} = "docker"; +then + docker run -t -v "${PWD}:/libpff" ${DOCKERHUB_REPO}:${DOCKERHUB_TAG} sh -c "cd libpff && .travis/script_docker.sh"; + +elif test ${TARGET} = "linux-gcc-python-setup-py" || test ${TARGET} = "macos-gcc-python-setup-py"; +then + ./configure ${CONFIGURE_OPTIONS}; + make > /dev/null; + python ./setup.py build; + +elif test ${TARGET} != "coverity"; +then + .travis/runtests.sh; + + if test ${TARGET} = "macos-gcc-pkgbuild"; + then + export VERSION=`sed '5!d; s/^ \[//;s/\],$//' configure.ac`; + + make install DESTDIR=${PWD}/osx-pkg; + mkdir -p ${PWD}/osx-pkg/usr/share/doc/libpff; + cp AUTHORS COPYING NEWS README ${PWD}/osx-pkg/usr/share/doc/libpff; + + pkgbuild --root osx-pkg --identifier com.github.libyal.libpff --version ${VERSION} --ownership recommended ../libpff-${VERSION}.pkg; + fi +fi + diff --git a/.travis/script_docker.sh b/.travis/script_docker.sh new file mode 100755 index 00000000..4d0fe492 --- /dev/null +++ b/.travis/script_docker.sh @@ -0,0 +1,29 @@ +#!/bin/sh +# Script to run script step on Travis-CI with Docker +# +# Version: 20190809 + +# Exit on error. +set -e; + +export DEBIAN_FRONTEND="noninteractive"; + +apt-get update -q; + +# Install add-apt-repository and locale-gen. +apt-get install -y locales software-properties-common; + +# Set locale to US English and UTF-8. +locale-gen en_US.UTF-8; + +# Install packages essential for building. +apt-get install -y autoconf automake build-essential git libtool pkg-config autopoint; + +export LANG="en_US.UTF-8"; + +./synclibs.sh --use-head; + +./autogen.sh; + +.travis/runtests.sh; + diff --git a/configure.ac b/configure.ac index ba14c1e9..c4aa8ea7 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ( 2.59 ) AC_INIT( [libpff], - [20190725], + [20190904], [joachim.metz@gmail.com]) AC_CONFIG_SRCDIR( diff --git a/libpff/libpff_item_values.c b/libpff/libpff_item_values.c index eebe93cb..4b3226ed 100644 --- a/libpff/libpff_item_values.c +++ b/libpff/libpff_item_values.c @@ -679,8 +679,8 @@ int libpff_item_values_get_record_entry_by_utf8_name( libbfio_handle_t *file_io_handle, libpff_offsets_index_t *offsets_index, int record_set_index, - const uint8_t *utf8_name, - size_t utf8_name_length, + const uint8_t *utf8_string, + size_t utf8_string_length, uint32_t value_type, libpff_record_entry_t **record_entry, uint8_t flags, @@ -744,8 +744,8 @@ int libpff_item_values_get_record_entry_by_utf8_name( result = libpff_table_get_record_entry_by_utf8_name( item_values->table, record_set_index, - utf8_name, - utf8_name_length, + utf8_string, + utf8_string_length, value_type, record_entry, flags, @@ -781,8 +781,8 @@ int libpff_item_values_get_record_entry_by_utf16_name( libbfio_handle_t *file_io_handle, libpff_offsets_index_t *offsets_index, int record_set_index, - const uint16_t *utf16_name, - size_t utf16_name_length, + const uint16_t *utf16_string, + size_t utf16_string_length, uint32_t value_type, libpff_record_entry_t **record_entry, uint8_t flags, @@ -846,8 +846,8 @@ int libpff_item_values_get_record_entry_by_utf16_name( result = libpff_table_get_record_entry_by_utf16_name( item_values->table, record_set_index, - utf16_name, - utf16_name_length, + utf16_string, + utf16_string_length, value_type, record_entry, flags, diff --git a/libpff/libpff_item_values.h b/libpff/libpff_item_values.h index 4931fe8d..57b89189 100644 --- a/libpff/libpff_item_values.h +++ b/libpff/libpff_item_values.h @@ -145,8 +145,8 @@ int libpff_item_values_get_record_entry_by_utf8_name( libbfio_handle_t *file_io_handle, libpff_offsets_index_t *offsets_index, int record_set_index, - const uint8_t *utf8_name, - size_t utf8_name_length, + const uint8_t *utf8_string, + size_t utf8_string_length, uint32_t value_type, libpff_record_entry_t **record_entry, uint8_t flags, @@ -159,8 +159,8 @@ int libpff_item_values_get_record_entry_by_utf16_name( libbfio_handle_t *file_io_handle, libpff_offsets_index_t *offsets_index, int record_set_index, - const uint16_t *utf16_name, - size_t utf16_name_length, + const uint16_t *utf16_string, + size_t utf16_string_length, uint32_t value_type, libpff_record_entry_t **record_entry, uint8_t flags, diff --git a/libpff/libpff_table.c b/libpff/libpff_table.c index 3dbc6716..6948d83b 100644 --- a/libpff/libpff_table.c +++ b/libpff/libpff_table.c @@ -1797,8 +1797,8 @@ int libpff_table_get_record_entry_by_type( int libpff_table_get_record_entry_by_utf8_name( libpff_table_t *table, int set_index, - const uint8_t *utf8_name, - size_t utf8_name_length, + const uint8_t *utf8_string, + size_t utf8_string_length, uint32_t value_type, libpff_record_entry_t **record_entry, uint8_t flags, @@ -1846,7 +1846,7 @@ int libpff_table_get_record_entry_by_utf8_name( "%s: retrieving table set: %d name: %s\n", function, set_index, - utf8_name ); + utf8_string ); */ } #endif @@ -1868,8 +1868,8 @@ int libpff_table_get_record_entry_by_utf8_name( } result = libpff_record_set_get_entry_by_utf8_name( record_set, - utf8_name, - utf8_name_length, + utf8_string, + utf8_string_length, value_type, record_entry, flags, @@ -1902,8 +1902,8 @@ int libpff_table_get_record_entry_by_utf8_name( int libpff_table_get_record_entry_by_utf16_name( libpff_table_t *table, int set_index, - const uint16_t *utf16_name, - size_t utf16_name_length, + const uint16_t *utf16_string, + size_t utf16_string_length, uint32_t value_type, libpff_record_entry_t **record_entry, uint8_t flags, @@ -1973,8 +1973,8 @@ int libpff_table_get_record_entry_by_utf16_name( } result = libpff_record_set_get_entry_by_utf16_name( record_set, - utf16_name, - utf16_name_length, + utf16_string, + utf16_string_length, value_type, record_entry, flags, diff --git a/libpff/libpff_table.h b/libpff/libpff_table.h index 8d476a47..906b4779 100644 --- a/libpff/libpff_table.h +++ b/libpff/libpff_table.h @@ -250,8 +250,8 @@ int libpff_table_get_record_entry_by_type( int libpff_table_get_record_entry_by_utf8_name( libpff_table_t *table, int set_index, - const uint8_t *utf8_name, - size_t utf8_name_length, + const uint8_t *utf8_string, + size_t utf8_string_length, uint32_t value_type, libpff_record_entry_t **record_entry, uint8_t flags, @@ -260,8 +260,8 @@ int libpff_table_get_record_entry_by_utf8_name( int libpff_table_get_record_entry_by_utf16_name( libpff_table_t *table, int set_index, - const uint16_t *utf16_name, - size_t utf16_name_length, + const uint16_t *utf16_string, + size_t utf16_string_length, uint32_t value_type, libpff_record_entry_t **record_entry, uint8_t flags, diff --git a/m4/libfdata.m4 b/m4/libfdata.m4 index 19e96f20..e2950da8 100644 --- a/m4/libfdata.m4 +++ b/m4/libfdata.m4 @@ -1,6 +1,6 @@ dnl Functions for libfdata dnl -dnl Version: 20190308 +dnl Version: 20190811 dnl Function to detect if libfdata is available dnl ac_libfdata_dummy is used to prevent AC_CHECK_LIB adding unnecessary -l arguments @@ -26,7 +26,7 @@ AC_DEFUN([AX_LIBFDATA_CHECK_LIB], [test "x$cross_compiling" != "xyes" && test "x$PKGCONFIG" != "x"], [PKG_CHECK_MODULES( [libfdata], - [libfdata >= 20181009], + [libfdata >= 20190811], [ac_cv_libfdata=yes], [ac_cv_libfdata=check]) ]) diff --git a/msvscpp/libfdata/libfdata.vcproj b/msvscpp/libfdata/libfdata.vcproj index dca3b4a7..b03e8aa8 100644 --- a/msvscpp/libfdata/libfdata.vcproj +++ b/msvscpp/libfdata/libfdata.vcproj @@ -260,10 +260,6 @@ RelativePath="..\..\libfdata\libfdata_extern.h" > - - diff --git a/tests/test_pffexport.sh b/tests/test_pffexport.sh index 7b8a926c..dca4e62b 100755 --- a/tests/test_pffexport.sh +++ b/tests/test_pffexport.sh @@ -1,7 +1,7 @@ #!/bin/bash # Export tool testing script # -# Version: 20181111 +# Version: 20190223 EXIT_SUCCESS=0; EXIT_FAILURE=1; @@ -102,17 +102,17 @@ fi if ! test -d "input"; then - echo "Test input directory: input not found."; + echo "Test input directory not found."; - return ${EXIT_IGNORE}; + exit ${EXIT_IGNORE}; fi RESULT=`ls input/* | tr ' ' '\n' | wc -l`; if test ${RESULT} -eq ${EXIT_SUCCESS}; then - echo "No files or directories found in the test input directory: input"; + echo "No files or directories found in the test input directory"; - return ${EXIT_IGNORE}; + exit ${EXIT_IGNORE}; fi TEST_PROFILE_DIRECTORY=$(get_test_profile_directory "input" "pffexport"); @@ -144,7 +144,7 @@ do then for INPUT_FILE in `cat ${TEST_SET_DIRECTORY}/files | sed "s?^?${TEST_SET_INPUT_DIRECTORY}/?"`; do - run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "pffexport" "with_callback" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}"; + run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "pffexport" "with_callback" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${OPTIONS[@]}"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS}; @@ -155,7 +155,7 @@ do else for INPUT_FILE in `ls -1 ${TEST_SET_INPUT_DIRECTORY}/${INPUT_GLOB}`; do - run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "pffexport" "with_callback" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}"; + run_test_on_input_file_with_options "${TEST_SET_DIRECTORY}" "pffexport" "with_callback" "${OPTION_SETS}" "${TEST_EXECUTABLE}" "${INPUT_FILE}" "${OPTIONS[@]}"; RESULT=$?; if test ${RESULT} -ne ${EXIT_SUCCESS};