From 25a3c109c1d6d577b12d9e45a28c26c167b8033d Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Sun, 27 Aug 2023 13:30:51 +0200 Subject: [PATCH] CI updates --- .github/workflows/ci.yml | 16 +++++++--------- .../workflows/github-close-inactive-issues.yml | 3 ++- .github/workflows/github-close-pull-requests.yml | 3 ++- .github/workflows/misc-spell-check.yml | 1 + .../workflows/static-analyzer-clang-analyzer.yml | 1 + .github/workflows/static-analyzer-clang-tidy.yml | 3 ++- .github/workflows/static-analyzer-codeql.yml | 1 + .github/workflows/test-alpine-linux.yml | 4 ++-- .github/workflows/test-unused.yml | 2 +- .github/workflows/weekly-ci-bs-by-hand.yml | 2 +- .../workflows/weekly-ci-bs-cmake-macos-xcode.yml | 1 + .../weekly-ci-bs-cmake-windows-nmake.yml | 1 + .github/workflows/weekly-ci-cc-alpine-linux.yml | 3 +-- .github/workflows/weekly-ci-cc-llvm-mingw.yml | 14 +++++++------- .github/workflows/weekly-ci-cc-zigcc.yml | 7 +++---- .github/workflows/weekly-ci-rt-checkers.yml | 3 ++- doc/upx.1 | 2 +- src/check/dt_cxxlib.cpp | 10 +++++++++- src/conf.h | 2 +- src/help.cpp | 2 +- src/packer.h | 10 +++++----- src/packmast.cpp | 2 ++ src/util/cxxlib.h | 4 +++- src/version.h | 4 ++-- 24 files changed, 59 insertions(+), 42 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02f54183..50a88aa1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ env: CMAKE_REQUIRED_QUIET: OFF DEBIAN_FRONTEND: noninteractive UPX_CMAKE_BUILD_FLAGS: --verbose - # 2023-08-22 - ZIG_DIST_VERSION: 0.12.0-dev.157+8e96be008 + # 2023-08-26 + ZIG_DIST_VERSION: 0.12.0-dev.170+750998eef jobs: job-rebuild-and-verify-stubs: @@ -57,7 +57,7 @@ jobs: if ! git diff --quiet; then git diff; exit 1; fi job-linux-cmake: # uses cmake + make - if: ${{ true }} + if: true needs: [ job-rebuild-and-verify-stubs ] name: ${{ format('{0} cmake', matrix.os) }} runs-on: ${{ matrix.os }} @@ -134,7 +134,7 @@ jobs: env -C build/extra/gcc/release upx_exe=./upx bash "$testsuite_1" job-macos-cmake: # uses cmake + make - if: ${{ true }} + if: true needs: [ job-rebuild-and-verify-stubs ] name: ${{ format('{0} cmake', matrix.os) }} runs-on: ${{ matrix.os }} @@ -210,7 +210,7 @@ jobs: env -C build/extra/clang/release upx_exe=./upx bash "$testsuite_1" job-windows-cmake: # uses cmake + msbuild - if: ${{ true }} + if: true needs: [ job-rebuild-and-verify-stubs ] name: ${{ format('{0} cmake', matrix.name) }} runs-on: ${{ matrix.os }} @@ -265,7 +265,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: true needs: [ job-rebuild-and-verify-stubs ] name: ${{ format('windows {0}', matrix.name) }} runs-on: ${{ matrix.os }} @@ -372,7 +372,7 @@ jobs: env -C build/$C/$B/upx upx_exe=./upx.exe bash "$testsuite_1" job-linux-zigcc: # uses cmake + make - if: ${{ true }} + if: github.repository_owner == 'upx' needs: [ job-rebuild-and-verify-stubs ] name: ${{ format('zigcc {0} {1}', matrix.zig_target, matrix.zig_pic) }} runs-on: ubuntu-latest @@ -485,5 +485,3 @@ jobs: run: | (cd build/zig/${ZIG_TARGET}${ZIG_PIC}/release && DESTDIR=$PWD/Install-with-cmake cmake --install .) (cd build/zig/${ZIG_TARGET}${ZIG_PIC}/release && DESTDIR=$PWD/Install-with-make make install) - -# vim:set ts=2 sw=2 et: diff --git a/.github/workflows/github-close-inactive-issues.yml b/.github/workflows/github-close-inactive-issues.yml index e3b64a7f..177df8a4 100644 --- a/.github/workflows/github-close-inactive-issues.yml +++ b/.github/workflows/github-close-inactive-issues.yml @@ -17,7 +17,8 @@ on: schedule: [cron: '50 0 * * 3'] # run weekly Wednesday 00:50 UTC workflow_dispatch: jobs: - close-issues: + job-close-inactive-issues: + if: github.repository_owner == 'upx' name: 'Close inactive issues' runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/github-close-pull-requests.yml b/.github/workflows/github-close-pull-requests.yml index a8c9d540..d390cfcd 100644 --- a/.github/workflows/github-close-pull-requests.yml +++ b/.github/workflows/github-close-pull-requests.yml @@ -4,7 +4,8 @@ on: #pull_request: workflow_dispatch: jobs: - close-pull-requests: + job-close-pull-requests: + if: github.repository_owner == 'upx' name: 'Close pull requests' runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/misc-spell-check.yml b/.github/workflows/misc-spell-check.yml index 53f3bd02..8a118f65 100644 --- a/.github/workflows/misc-spell-check.yml +++ b/.github/workflows/misc-spell-check.yml @@ -9,6 +9,7 @@ env: DEBIAN_FRONTEND: noninteractive jobs: job-spell-check: + if: github.repository_owner == 'upx' name: 'Spell check' runs-on: ubuntu-latest steps: diff --git a/.github/workflows/static-analyzer-clang-analyzer.yml b/.github/workflows/static-analyzer-clang-analyzer.yml index 3827ec7b..921bedcf 100644 --- a/.github/workflows/static-analyzer-clang-analyzer.yml +++ b/.github/workflows/static-analyzer-clang-analyzer.yml @@ -10,6 +10,7 @@ env: jobs: job-analyze-clang-analyzer: # uses cmake + make + if: github.repository_owner == 'upx' strategy: fail-fast: false matrix: {container: ['alpine:3.16','alpine:3.17','alpine:3.18','alpine:edge','i386/alpine:edge']} diff --git a/.github/workflows/static-analyzer-clang-tidy.yml b/.github/workflows/static-analyzer-clang-tidy.yml index 8f30adc7..68d3ab62 100644 --- a/.github/workflows/static-analyzer-clang-tidy.yml +++ b/.github/workflows/static-analyzer-clang-tidy.yml @@ -10,9 +10,10 @@ env: jobs: job-analyze-clang-tidy: # uses cmake + make + if: github.repository_owner == 'upx' strategy: fail-fast: false - matrix: {container: ['alpine:edge','i386/alpine:edge']} + matrix: {container: ['alpine:3.18','alpine:edge','i386/alpine:edge']} name: ${{ format('Analyze clang-tidy {0}', matrix.container) }} runs-on: ubuntu-latest container: ${{ matrix.container }} diff --git a/.github/workflows/static-analyzer-codeql.yml b/.github/workflows/static-analyzer-codeql.yml index ebbe9006..6e677f67 100644 --- a/.github/workflows/static-analyzer-codeql.yml +++ b/.github/workflows/static-analyzer-codeql.yml @@ -10,6 +10,7 @@ env: jobs: job-analyze-codeql: + if: github.repository_owner == 'upx' name: Analyze runs-on: ubuntu-latest permissions: diff --git a/.github/workflows/test-alpine-linux.yml b/.github/workflows/test-alpine-linux.yml index 4cdd85d6..2731067f 100644 --- a/.github/workflows/test-alpine-linux.yml +++ b/.github/workflows/test-alpine-linux.yml @@ -11,7 +11,7 @@ env: jobs: job-alpine-clang: # uses cmake + make - if: ${{ true }} + if: true strategy: { matrix: { container: ['alpine:edge','i386/alpine:edge'] } } name: ${{ format('clang {0}', matrix.container) }} runs-on: ubuntu-latest @@ -38,7 +38,7 @@ jobs: path: 'upx*/build/*/upx' job-alpine-gcc: # uses cmake + make - if: ${{ true }} + if: true strategy: { matrix: { container: ['alpine:edge','i386/alpine:edge'] } } name: ${{ format('gcc {0}', matrix.container) }} runs-on: ubuntu-latest diff --git a/.github/workflows/test-unused.yml b/.github/workflows/test-unused.yml index 2154602c..6526dabf 100644 --- a/.github/workflows/test-unused.yml +++ b/.github/workflows/test-unused.yml @@ -8,7 +8,7 @@ env: jobs: job-unused: # uses cmake + make - if: ${{ true }} + if: true runs-on: ubuntu-latest steps: - run: | diff --git a/.github/workflows/weekly-ci-bs-by-hand.yml b/.github/workflows/weekly-ci-bs-by-hand.yml index 652ecc6d..0295497c 100644 --- a/.github/workflows/weekly-ci-bs-by-hand.yml +++ b/.github/workflows/weekly-ci-bs-by-hand.yml @@ -13,7 +13,7 @@ jobs: job-alpine-by-hand: # 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: ${{ true }} + if: github.repository_owner == 'upx' strategy: { matrix: { container: ['alpine:3.9','alpine:edge'] } } name: ${{ format('gcc by-hand {0}', matrix.container) }} runs-on: ubuntu-latest diff --git a/.github/workflows/weekly-ci-bs-cmake-macos-xcode.yml b/.github/workflows/weekly-ci-bs-cmake-macos-xcode.yml index 921517b3..e1e19874 100644 --- a/.github/workflows/weekly-ci-bs-cmake-macos-xcode.yml +++ b/.github/workflows/weekly-ci-bs-cmake-macos-xcode.yml @@ -11,6 +11,7 @@ env: jobs: job-cmake-macos-xcode: # uses cmake + xcodebuild + if: github.repository_owner == 'upx' strategy: fail-fast: false matrix: diff --git a/.github/workflows/weekly-ci-bs-cmake-windows-nmake.yml b/.github/workflows/weekly-ci-bs-cmake-windows-nmake.yml index f7e13ea7..6aef858f 100644 --- a/.github/workflows/weekly-ci-bs-cmake-windows-nmake.yml +++ b/.github/workflows/weekly-ci-bs-cmake-windows-nmake.yml @@ -13,6 +13,7 @@ env: jobs: job-cmake-windows-nmake: # uses cmake + nmake + if: github.repository_owner == 'upx' strategy: fail-fast: false matrix: diff --git a/.github/workflows/weekly-ci-cc-alpine-linux.yml b/.github/workflows/weekly-ci-cc-alpine-linux.yml index fa853550..999b7845 100644 --- a/.github/workflows/weekly-ci-cc-alpine-linux.yml +++ b/.github/workflows/weekly-ci-cc-alpine-linux.yml @@ -21,6 +21,7 @@ env: jobs: job-alpine-cmake: # uses cmake + make + if: github.repository_owner == 'upx' strategy: fail-fast: false matrix: { container: ['alpine:3.9','alpine:3.10','alpine:3.11','alpine:3.12','alpine:3.13','alpine:3.14','alpine:3.15','alpine:3.16','alpine:3.17','alpine:3.18','alpine:edge','i386/alpine:edge'] } @@ -155,5 +156,3 @@ jobs: export upx_testsuite_SRCDIR="$(readlink -fn "upx-testsuite with space")" testsuite_1="$(readlink -fn "upx with space"/misc/testsuite/upx_testsuite_1.sh)" (cd "upx with space"/build/xtarget/gcc-static/release && upx_exe=./upx bash "$testsuite_1") - -# vim:set ts=2 sw=2 et: diff --git a/.github/workflows/weekly-ci-cc-llvm-mingw.yml b/.github/workflows/weekly-ci-cc-llvm-mingw.yml index e3bfe832..464d06a1 100644 --- a/.github/workflows/weekly-ci-cc-llvm-mingw.yml +++ b/.github/workflows/weekly-ci-cc-llvm-mingw.yml @@ -13,7 +13,7 @@ env: jobs: job-llvm-mingw: # uses cmake+make - if: ${{ true }} + if: github.repository_owner == 'upx' strategy: fail-fast: false matrix: @@ -24,12 +24,12 @@ jobs: - name: llvm-mingw-20230614-ucrt llvm_version: 16.0.6 url: 'https://github.com/mstorsjo/llvm-mingw/releases/download/20230614/llvm-mingw-20230614-ucrt-ubuntu-20.04-x86_64.tar.xz' - - name: llvm-mingw-20230811-msvcrt - llvm_version: 17.0.0rc2 - url: 'https://github.com/mstorsjo/llvm-mingw/releases/download/20230811/llvm-mingw-20230811-msvcrt-ubuntu-20.04-x86_64.tar.xz' - - name: llvm-mingw-20230811-ucrt - llvm_version: 17.0.0rc2 - url: 'https://github.com/mstorsjo/llvm-mingw/releases/download/20230811/llvm-mingw-20230811-ucrt-ubuntu-20.04-x86_64.tar.xz' + - name: llvm-mingw-20230822-msvcrt + llvm_version: 17.0.0rc3 + url: 'https://github.com/mstorsjo/llvm-mingw/releases/download/20230822/llvm-mingw-20230822-msvcrt-ubuntu-20.04-x86_64.tar.xz' + - name: llvm-mingw-20230822-ucrt + llvm_version: 17.0.0rc3 + url: 'https://github.com/mstorsjo/llvm-mingw/releases/download/20230822/llvm-mingw-20230822-ucrt-ubuntu-20.04-x86_64.tar.xz' name: ${{ format('{0} {1}', matrix.name, matrix.llvm_version) }} runs-on: ubuntu-latest steps: diff --git a/.github/workflows/weekly-ci-cc-zigcc.yml b/.github/workflows/weekly-ci-cc-zigcc.yml index 85ba89cb..0875bde5 100644 --- a/.github/workflows/weekly-ci-cc-zigcc.yml +++ b/.github/workflows/weekly-ci-cc-zigcc.yml @@ -10,11 +10,12 @@ on: env: CMAKE_REQUIRED_QUIET: OFF DEBIAN_FRONTEND: noninteractive - # 2023-08-22 - ZIG_DIST_VERSION: 0.12.0-dev.157+8e96be008 + # 2023-08-26 + ZIG_DIST_VERSION: 0.12.0-dev.170+750998eef jobs: job-linux-zigcc: # uses cmake + make + if: github.repository_owner == 'upx' strategy: fail-fast: false matrix: @@ -125,5 +126,3 @@ jobs: run: | (cd build/zig/${ZIG_TARGET}${ZIG_PIC}/release && DESTDIR=$PWD/Install-with-cmake cmake --install .) (cd build/zig/${ZIG_TARGET}${ZIG_PIC}/release && DESTDIR=$PWD/Install-with-make make install) - -# vim:set ts=2 sw=2 et: diff --git a/.github/workflows/weekly-ci-rt-checkers.yml b/.github/workflows/weekly-ci-rt-checkers.yml index b5b57002..f3f6940a 100644 --- a/.github/workflows/weekly-ci-rt-checkers.yml +++ b/.github/workflows/weekly-ci-rt-checkers.yml @@ -13,6 +13,7 @@ env: jobs: job-runtime-checkers: # uses cmake + make + if: github.repository_owner == 'upx' strategy: fail-fast: false matrix: @@ -93,7 +94,7 @@ jobs: export upx_exe_runner="${{ matrix.qemu }}" env -C build/xtarget/clang-static/$release "$PWD"/misc/testsuite/upx_testsuite_1.sh - name: 'Run testsuite clang-static - Valgrind' - if: ${{ true }} # very slow + if: true # very slow run: | export upx_exe_runner="valgrind --error-exitcode=1 --quiet" # on current GitHub CI, takes about 30 minutes for release and 80 minutes for debug builds diff --git a/doc/upx.1 b/doc/upx.1 index f33d8122..aef59d86 100644 --- a/doc/upx.1 +++ b/doc/upx.1 @@ -133,7 +133,7 @@ .\" ======================================================================== .\" .IX Title "UPX 1" -.TH UPX 1 "2023-08-08" "upx 4.2.0" " " +.TH UPX 1 "2023-08-25" "upx 4.2.0" " " .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l diff --git a/src/check/dt_cxxlib.cpp b/src/check/dt_cxxlib.cpp index 41cb6669..0c918877 100644 --- a/src/check/dt_cxxlib.cpp +++ b/src/check/dt_cxxlib.cpp @@ -117,7 +117,7 @@ struct TestTriBool { static_assert(sizeof(typename T::value_type) == sizeof(typename T::underlying_type)); static_assert(alignof(typename T::value_type) == alignof(typename T::underlying_type)); #if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__) - // broken compiler + // broken compiler or broken ABI #else static_assert(sizeof(T) == sizeof(typename T::underlying_type)); static_assert(alignof(T) == alignof(typename T::underlying_type)); @@ -127,6 +127,14 @@ struct TestTriBool { static_assert(T(T::False) == T::False); static_assert(T(T::True) == T::True); static_assert(T(T::Third) == T::Third); + static_assert(T(T::Third) == T(9)); + static_assert(T(8) == T(9)); + static_assert(!(T(0) == T(9))); + static_assert(!(T(1) == T(9))); + static_assert(T(T::Third) == 9); + static_assert(T(8) == 9); + static_assert(!(T(0) == 9)); + static_assert(!(T(1) == 9)); constexpr T array[] = {false, true, T::Third}; static_assert(array[0].isStrictFalse()); static_assert(array[1].isStrictTrue()); diff --git a/src/conf.h b/src/conf.h index f693ead9..fc05d803 100644 --- a/src/conf.h +++ b/src/conf.h @@ -95,7 +95,7 @@ template inline constexpr bool upx_is_integral_v = upx_is_integral::value; #if (ACC_ARCH_M68K && ACC_OS_TOS && ACC_CC_GNUC) && defined(__MINT__) -// horrible hack for broken compiler +// horrible hack for broken compiler / ABI #define upx_fake_alignas_1 __attribute__((__aligned__(1),__packed__)) #define upx_fake_alignas_16 __attribute__((__aligned__(2))) // object file maximum 2 ??? #define upx_fake_alignas__(x) upx_fake_alignas_ ## x diff --git a/src/help.cpp b/src/help.cpp index c48c069a..6729c82f 100644 --- a/src/help.cpp +++ b/src/help.cpp @@ -104,7 +104,7 @@ struct PackerNames { const Options *o; PackerNames() : names_count(0), o(nullptr) {} void add(const PackerBase *pb) { - assert(names_count < 64); + assert_noexcept(names_count < 64); names[names_count].fname = pb->getFullName(o); names[names_count].sname = pb->getName(); names_count++; diff --git a/src/packer.h b/src/packer.h index 39ab32a3..f1b3b9ef 100644 --- a/src/packer.h +++ b/src/packer.h @@ -57,13 +57,13 @@ public: virtual const int *getCompressionMethods(int method, int level) const = 0; virtual const int *getFilters() const = 0; - // canPack() should throw a cantPackException eplaining why it cannot pack + // canPack() should throw a cantPackException explaining why it cannot pack // a recognized format. - // canPack() can return -1 to fail early; see class PackMaster + // canPack() can also return -1 to fail early; see class PackMaster virtual tribool canPack() = 0; - // canUnpack() should throw a cantUnpackException eplaining why it cannot pack + // canUnpack() should throw a cantUnpackException explaining why it cannot pack // a recognized format. - // canUnpack() can return -1 to fail early; see class PackMaster + // canUnpack() can also return -1 to fail early; see class PackMaster virtual tribool canUnpack() = 0; // PackMaster entries @@ -80,7 +80,7 @@ protected: InputFile *const fi; // reference union { // unnamed union const upx_int64_t file_size; // must get set by constructor - const upx_uint64_t file_size_u; // explicitly unsigned + const upx_uint64_t file_size_u; // (explicitly unsigned) }; PackHeader ph; // must be filled by canUnpack(); also used by UiPacker }; diff --git a/src/packmast.cpp b/src/packmast.cpp index 60b55c64..aee03e60 100644 --- a/src/packmast.cpp +++ b/src/packmast.cpp @@ -65,6 +65,7 @@ PackMaster::PackMaster(InputFile *f, Options *o) noexcept : fi(f) { // replace global options with local options if (o != nullptr) { #if WITH_THREADS + // TODO later: check for possible "noexcept" violation here std::lock_guard lock(opt_lock_mutex); #endif saved_opt = o; @@ -78,6 +79,7 @@ PackMaster::~PackMaster() noexcept { // restore global options if (saved_opt != nullptr) { #if WITH_THREADS + // TODO later: check for possible "noexcept" violation here std::lock_guard lock(opt_lock_mutex); #endif opt = saved_opt; diff --git a/src/util/cxxlib.h b/src/util/cxxlib.h index 0d103520..79545c71 100644 --- a/src/util/cxxlib.h +++ b/src/util/cxxlib.h @@ -121,7 +121,9 @@ struct TriBool final { // equality constexpr bool operator==(TriBool other) const noexcept { return value == other.value; } constexpr bool operator==(value_type other) const noexcept { return value == other; } - constexpr bool operator==(promoted_type other) const noexcept { return value == other; } + constexpr bool operator==(promoted_type other) const noexcept { + return value == TriBool(other).value; + } // "Third" can mean many things, depending on usage context, so provide some alternative names: // constexpr bool isDefault() const noexcept { return isThird(); } // might be misleading diff --git a/src/version.h b/src/version.h index 4349ff64..3e2a0280 100644 --- a/src/version.h +++ b/src/version.h @@ -1,6 +1,6 @@ #define UPX_VERSION_HEX 0x040200 /* 04.02.00 */ #define UPX_VERSION_STRING "4.2.0" #define UPX_VERSION_STRING4 "4.20" -#define UPX_VERSION_DATE "Aug 8th 2023" -#define UPX_VERSION_DATE_ISO "2023-08-08" +#define UPX_VERSION_DATE "Aug 25th 2023" +#define UPX_VERSION_DATE_ISO "2023-08-25" #define UPX_VERSION_YEAR "2023"