diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4be09ffe..cbab1a55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,8 +13,8 @@ env: CTEST_OUTPUT_ON_FAILURE: "ON" DEBIAN_FRONTEND: noninteractive UPX_CMAKE_BUILD_FLAGS: --verbose - # 2023-11-01 - ZIG_DIST_VERSION: 0.12.0-dev.1369+a09ba455c + # 2023-11-03 + ZIG_DIST_VERSION: 0.12.0-dev.1390+94cee4fb2 jobs: job-rebuild-and-verify-stubs: @@ -146,8 +146,8 @@ jobs: fail-fast: false matrix: include: - # NOTE: macos does not have "env -C"; only with coreutils - # NOTE: macos-11 does not have "readlink -f"; only on macos >= 12 or with coreutils + # NOTE: macos does not have "env -C"; only with brew coreutils + # NOTE: macos-11 does not have "readlink -f"; only on macos >= 12 or with brew coreutils - { os: macos-11, gcc: gcc-10, gxx: 'g++-10', testsuite: true } - { os: macos-12, gcc: gcc-11, gxx: 'g++-11', testsuite: true } - { os: macos-13, gcc: gcc-12, gxx: 'g++-12', testsuite: true } @@ -278,7 +278,7 @@ jobs: env -C build/release/Release upx_exe=./upx bash "$testsuite_1" job-windows-toolchains: # build "by hand" using cmd.exe - if: true + if: github.repository_owner == 'upx' needs: [ job-rebuild-and-verify-stubs ] name: ${{ format('windows {0}', matrix.name) }} runs-on: ${{ matrix.os }} diff --git a/.github/workflows/weekly-ci-bs-by-hand.yml b/.github/workflows/weekly-ci-bs-by-hand.yml index 854fd368..b698bcfd 100644 --- a/.github/workflows/weekly-ci-bs-by-hand.yml +++ b/.github/workflows/weekly-ci-bs-by-hand.yml @@ -104,6 +104,7 @@ jobs: job-by-hand-macos-clang: # uses a POSIX-compliant shell # ...and also uses a subdirectory "upx with space" in order to detect possible quoting issues + # ...and also uses ccache as we are running the same build-script again and again if: github.repository_owner == 'upx' strategy: fail-fast: false @@ -168,7 +169,7 @@ jobs: export zlib_extra_flags="-DHAVE_VSNPRINTF" export AR=false # link without using $AR CC="clang $xflags" CXX="clang++ -std=gnu++17 $xflags" bash "./upx with space/misc/scripts/build_upx_by_hand.sh" - ls -l build/by-hand || true + ls -l "upx with space"/build/by-hand || true - name: 'Build by-hand with bash - gcc' if: success() || failure() # run this step even if the previous step failed shell: bash @@ -176,3 +177,4 @@ jobs: xflags="-static -Wall -Wextra -Werror" # gcc uses the MingGW headers, so no extra settings are needed CC="gcc $xflags" CXX="g++ -std=gnu++17 $xflags" bash "./upx with space/misc/scripts/build_upx_by_hand.sh" + ls -l "upx with space"/build/by-hand || true diff --git a/.github/workflows/weekly-ci-bs-misc.yml b/.github/workflows/weekly-ci-bs-misc.yml index a141181f..feac7555 100644 --- a/.github/workflows/weekly-ci-bs-misc.yml +++ b/.github/workflows/weekly-ci-bs-misc.yml @@ -13,6 +13,7 @@ env: jobs: BS0: + if: github.repository_owner == 'upx' runs-on: ubuntu-latest container: 'alpine:edge' steps: diff --git a/.github/workflows/weekly-ci-cc-alpine-linux.yml b/.github/workflows/weekly-ci-cc-alpine-linux.yml index 77760ffc..230373df 100644 --- a/.github/workflows/weekly-ci-cc-alpine-linux.yml +++ b/.github/workflows/weekly-ci-cc-alpine-linux.yml @@ -38,8 +38,8 @@ jobs: - { container: 'alpine:3.16', use_cxx20: 1, use_cxx2b: 1, use_lto: 1 } # May 2022: C++2b; clang-13 & gcc-11 - { container: 'alpine:3.17', use_cxx20: 1, use_cxx2b: 1, use_lto: 1 } - { container: 'alpine:3.18', use_cxx20: 1, use_cxx2b: 1, use_lto: 1 } - - { container: 'alpine:edge', use_cxx20: 1, use_cxx2b: 1, use_lto: 1 } - - { container: 'i386/alpine:edge', use_cxx20: 1, use_cxx2b: 1, use_lto: 1 } + - { container: 'alpine:edge', use_cxx20: 1, use_cxx23: 1, use_lto: 1 } + - { container: 'i386/alpine:edge', use_cxx20: 1, use_cxx23: 1, use_lto: 1 } # more 32-bit i386 versions, just for testing # { container: 'i386/alpine:3.9' } # clang-5, gcc-8; BROKEN: clang -m32 problem - { container: 'i386/alpine:3.10' } # clang-8, gcc-8 @@ -185,6 +185,7 @@ jobs: for dir in "upx with space"/build/xtarget/*-cxx*/*; do echo "===== $dir" make -C "$dir" test + (cd "$dir" && ./upx --sysinfo -v) done - name: 'Run file system test suite (busybox)' diff --git a/.github/workflows/weekly-ci-cc-llvm-mingw.yml b/.github/workflows/weekly-ci-cc-llvm-mingw.yml index b7be9393..a3d21c33 100644 --- a/.github/workflows/weekly-ci-cc-llvm-mingw.yml +++ b/.github/workflows/weekly-ci-cc-llvm-mingw.yml @@ -55,16 +55,19 @@ jobs: CC="$CC -D_WIN32_WINNT=0x0400"; CXX="$CXX -D_WIN32_WINNT=0x0400" make UPX_XTARGET=aarch64-w64-mingw32-clang xtarget/debug xtarget/release - name: 'Build clang armv7' + if: success() || failure() # run this step even if the previous step failed run: | export CC="armv7-w64-mingw32-clang -static" CXX="armv7-w64-mingw32-clang++ -static" CC="$CC -D_WIN32_WINNT=0x0400"; CXX="$CXX -D_WIN32_WINNT=0x0400" make UPX_XTARGET=armv7-w64-mingw32-clang xtarget/debug xtarget/release - name: 'Build clang i686' + if: success() || failure() # run this step even if the previous step failed run: | export CC="i686-w64-mingw32-clang -static" CXX="i686-w64-mingw32-clang++ -static" CC="$CC -D_WIN32_WINNT=0x0400"; CXX="$CXX -D_WIN32_WINNT=0x0400" make UPX_XTARGET=i686-w64-mingw32-clang xtarget/debug xtarget/release - name: 'Build clang x86_64' + if: success() || failure() # run this step even if the previous step failed run: | export CC="x86_64-w64-mingw32-clang -static" CXX="x86_64-w64-mingw32-clang++ -static" CC="$CC -D_WIN32_WINNT=0x0400"; CXX="$CXX -D_WIN32_WINNT=0x0400" diff --git a/.github/workflows/weekly-ci-cc-zigcc.yml b/.github/workflows/weekly-ci-cc-zigcc.yml index b2b74806..1f420ab4 100644 --- a/.github/workflows/weekly-ci-cc-zigcc.yml +++ b/.github/workflows/weekly-ci-cc-zigcc.yml @@ -11,8 +11,8 @@ env: CMAKE_REQUIRED_QUIET: "OFF" CTEST_OUTPUT_ON_FAILURE: "ON" DEBIAN_FRONTEND: noninteractive - # 2023-11-01 - ZIG_DIST_VERSION: 0.12.0-dev.1369+a09ba455c + # 2023-11-03 + ZIG_DIST_VERSION: 0.12.0-dev.1390+94cee4fb2 jobs: job-linux-zigcc: # uses cmake + make diff --git a/CMakeLists.txt b/CMakeLists.txt index 001980cf..98e947e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -524,7 +524,7 @@ include(CTest) if(NOT CMAKE_CROSSCOMPILING) add_test(NAME upx-version COMMAND upx --version) add_test(NAME upx-help COMMAND upx --help) - add_test(NAME upx-sysinfo COMMAND upx --sysinfo) + add_test(NAME upx-sysinfo COMMAND upx --sysinfo -v) endif() if(NOT CMAKE_CROSSCOMPILING AND NOT UPX_CONFIG_DISABLE_SELF_PACK_TEST) # IMPORTANT NOTE: these tests can only work if the host executable format is supported by UPX! diff --git a/misc/scripts/upx-clang-format.sh b/misc/scripts/upx-clang-format.sh index fe34d1c1..2d7a5a11 100755 --- a/misc/scripts/upx-clang-format.sh +++ b/misc/scripts/upx-clang-format.sh @@ -3,20 +3,21 @@ set -e; set -o pipefail # "Gofmt's style is nobody's favourite, but gofmt is everybody's favourite." --Rob Pike - +# # NOTE: we are using clang-format-15.0.6 from upx-stubtools # see https://github.com/upx/upx-stubtools/releases - +# # NOTE: we use .clang-format config from upx.git/.clang-format +# Copyright (C) Markus Franz Xaver Johannes Oberhumer if [[ ! -f $UPX_CLANG_FORMAT ]]; then -UPX_CLANG_FORMAT="$HOME/local/bin/bin-upx/clang-format-15.0.6" + UPX_CLANG_FORMAT="$HOME/local/bin/bin-upx/clang-format-15.0.6" fi if [[ ! -f $UPX_CLANG_FORMAT ]]; then -UPX_CLANG_FORMAT="$HOME/.local/bin/bin-upx/clang-format-15.0.6" + UPX_CLANG_FORMAT="$HOME/.local/bin/bin-upx/clang-format-15.0.6" fi if [[ ! -f $UPX_CLANG_FORMAT ]]; then -UPX_CLANG_FORMAT="$HOME/bin/bin-upx/clang-format-15.0.6" + UPX_CLANG_FORMAT="$HOME/bin/bin-upx/clang-format-15.0.6" fi if [[ ! -f $UPX_CLANG_FORMAT ]]; then echo "ERROR: $0: cannot find clang-format-15.0.6" @@ -29,4 +30,4 @@ ulimit -v 1048576 || true #echo $UPX_CLANG_FORMAT exec "$UPX_CLANG_FORMAT" -style=file "$@" -exit 1 +exit 99 diff --git a/misc/testsuite/test_symlinks.sh b/misc/testsuite/test_symlinks.sh index 9c41be70..9e15e963 100755 --- a/misc/testsuite/test_symlinks.sh +++ b/misc/testsuite/test_symlinks.sh @@ -3,16 +3,25 @@ set -e; set -o pipefail argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs") +# +# Copyright (C) Markus Franz Xaver Johannes Oberhumer +# +# test file system behaviour with symlinks; requires: +# $upx_exe (required, but with convenience fallback "./upx") +# optional settings: +# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Westmere" or "valgrind") +# + +# IMPORTANT NOTE: do NOT run as user root!! +# IMPORTANT NOTE: this script only works on Unix!! +umask 0022 + # disable on macOS for now, see https://github.com/upx/upx/issues/612 if [[ "$(uname)" == Darwin ]]; then echo "$0: SKIPPED" exit 0 fi -# IMPORTANT NOTE: do NOT run as user root!! -# IMPORTANT NOTE: this script only works on Unix!! -umask 0022 - id || true echo "PWD='$PWD'" if [[ $UID == 0 || $EUID == 0 ]]; then @@ -20,11 +29,6 @@ if [[ $UID == 0 || $EUID == 0 ]]; then exit 91 fi -# test file system behaviour with symlinks; requires: -# $upx_exe (required, but with convenience fallback "./upx") -# optional settings: -# $upx_exe_runner (e.g. "qemu-x86_64 -cpu Westmere" or "valgrind") - #*********************************************************************** # init & checks #*********************************************************************** diff --git a/misc/testsuite/upx_testsuite_1.sh b/misc/testsuite/upx_testsuite_1.sh index 2e67e82e..693c41b4 100755 --- a/misc/testsuite/upx_testsuite_1.sh +++ b/misc/testsuite/upx_testsuite_1.sh @@ -3,6 +3,9 @@ set -e; set -o pipefail argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs") +# +# Copyright (C) Markus Franz Xaver Johannes Oberhumer +# # very first version of the upx-testsuite; requires: # $upx_exe (required, but with convenience fallback "./upx") # $upx_testsuite_SRCDIR (required, but with convenience fallback) @@ -14,6 +17,7 @@ argv0=$0; argv0abs=$(readlink -fn "$argv0"); argv0dir=$(dirname "$argv0abs") # $UPX_TESTSUITE_LEVEL # # see https://github.com/upx/upx-testsuite.git +# #*********************************************************************** # init & checks diff --git a/src/help.cpp b/src/help.cpp index 981bb1ac..b847869d 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -467,6 +467,11 @@ void show_sysinfo(const char *options_var) { con_fprintf(f, fmt, v); con_fprintf(f, "\n"); }; + // language + cf_print("__cplusplus", "%lld", __cplusplus + 0, 3); +#if defined(_MSVC_LANG) + cf_print("_MSVC_LANG", "%lld", _MSVC_LANG + 0, 3); +#endif // compiler #if defined(ACC_CC_CLANG) cf_print("ACC_CC_CLANG", "0x%06llx", ACC_CC_CLANG + 0, 3);