From 93abbdf964bb96304d26b61e2e87ad4e8bbc5b7d Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Sun, 23 May 2021 22:05:54 +0200 Subject: [PATCH 1/4] CI: Run on CentOS 7 and 8 --- .github/workflows/ci-centos-7.yml | 30 +++++++++++++++++++++++++++++ .github/workflows/ci-centos-8.yml | 32 +++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .github/workflows/ci-centos-7.yml create mode 100644 .github/workflows/ci-centos-8.yml diff --git a/.github/workflows/ci-centos-7.yml b/.github/workflows/ci-centos-7.yml new file mode 100644 index 000000000..ca8105c8d --- /dev/null +++ b/.github/workflows/ci-centos-7.yml @@ -0,0 +1,30 @@ +name: CI CentOS 7 + +on: + push: + branches: + - '*' + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + container: centos:7 + + steps: + - name: Enable RPMFusion and EPEL + run: yum -y install https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-7.noarch.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + - name: Install git + run: yum -y install https://repo.ius.io/ius-release-el7.rpm && yum -y install git224 + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install dependencies + run: yum -y update && yum -y install make cmake3 gcc-c++ mariadb-devel ffmpeg-devel libcurl-devel vlc-devel libvncserver-devel libjpeg-turbo-devel "perl(Date::Manip)" "perl(DBD::mysql)" "perl(ExtUtils::MakeMaker)" "perl(Sys::Mmap)" "perl(Sys::Syslog)" "perl(LWP::UserAgent)" polkit-devel + - name: Prepare + run: mkdir build + - name: Configure + run: cd build && cmake3 --version && cmake3 .. -DBUILD_MAN=0 -DENABLE_WERROR=1 + - name: Build + run: cd build && make -j3 | grep --line-buffered -Ev '^(cp lib\/|Installing.+\.pm)' && (exit ${PIPESTATUS[0]}) diff --git a/.github/workflows/ci-centos-8.yml b/.github/workflows/ci-centos-8.yml new file mode 100644 index 000000000..d838804f7 --- /dev/null +++ b/.github/workflows/ci-centos-8.yml @@ -0,0 +1,32 @@ +name: CI CentOS 8 + +on: + push: + branches: + - '*' + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + container: centos:8 + + steps: + - name: Enable RPMFusion, EPEL and PowerTools + run: yum -y install "dnf-command(config-manager)" https://mirrors.rpmfusion.org/free/el/rpmfusion-free-release-8.noarch.rpm https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm && yum config-manager --set-enabled powertools + - name: Install git + run: yum -y install git + - uses: actions/checkout@v2 + with: + submodules: recursive + - name: Install dependencies + run: yum -y update && yum -y install make cmake gcc-c++ catch-devel mariadb-devel ffmpeg-devel libcurl-devel vlc-devel libvncserver-devel libjpeg-turbo-devel "perl(Date::Manip)" "perl(DBD::mysql)" "perl(ExtUtils::MakeMaker)" "perl(Sys::Mmap)" "perl(Sys::Syslog)" "perl(LWP::UserAgent)" polkit-devel + - name: Prepare + run: mkdir build + - name: Configure + run: cd build && cmake --version && cmake .. -DBUILD_MAN=0 -DBUILD_TEST_SUITE=1 -DENABLE_WERROR=1 + - name: Build + run: cd build && make -j3 | grep --line-buffered -Ev '^(cp lib\/|Installing.+\.pm)' && (exit ${PIPESTATUS[0]}) + - name: Run test + run: cd build/tests && ./tests "~[notCI]" From e5cac38521c17ac184235a687cd0639f3c7e85f2 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Mon, 24 May 2021 00:44:15 +0200 Subject: [PATCH 2/4] Comms: Make sure sun_path is NUL-terminated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When using strncpy the NUL-termination can go missing if the string to be copied is longer than the buffer. Make sure the last character in the buffer is NUL. If this really happens, the error (non-existing path due to truncation) will be caught during bind-ing. Fixes the following warning: /home/peterke/DEV/zoneminder/src/zm_comms.cpp: In member function ‘bool ZM::SockAddrUnix::resolve(const char*, const char*)’: /home/peterke/DEV/zoneminder/src/zm_comms.cpp:207:10: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound 108 equals destination size [-Wstringop-truncation] 207 | strncpy(mAddrUn.sun_path, path, sizeof(mAddrUn.sun_path)); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --- src/zm_comms.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/zm_comms.cpp b/src/zm_comms.cpp index bef10164d..e3855bdea 100644 --- a/src/zm_comms.cpp +++ b/src/zm_comms.cpp @@ -205,6 +205,7 @@ bool ZM::SockAddrUnix::resolve(const char *path, const char *proto) { memset(&mAddrUn, 0, sizeof(mAddrUn)); strncpy(mAddrUn.sun_path, path, sizeof(mAddrUn.sun_path)); + mAddrUn.sun_path[sizeof(mAddrUn.sun_path) - 1] = '\0'; mAddrUn.sun_family = AF_UNIX; return true; From 9900fc1273f285bd27c041714b6672feb6ee3943 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Mon, 24 May 2021 00:55:46 +0200 Subject: [PATCH 3/4] tests/Font: Avoid lambda capture initialization Remove the use of this language feature until we raise the requirements to C++14. --- tests/zm_font.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/zm_font.cpp b/tests/zm_font.cpp index 9ddb79a0e..432f26d7e 100644 --- a/tests/zm_font.cpp +++ b/tests/zm_font.cpp @@ -80,8 +80,11 @@ TEST_CASE("FontVariant: GetCodepoint") { std::vector bitmap(FontVariant::kMaxNumCodePoints * height); // fill bitmap for each codepoint alternating with 1 and std::numeric_limits::max() + // TODO: restore capture initializer when C++14 is supported + int32 n = 0; + bool zero = true; std::generate(bitmap.begin(), bitmap.end(), - [n = 0, zero = true]() mutable { + [n, zero]() mutable { if (n == height) { zero = !zero; n = 0; From e232b5d1a77e5917dd3dc97583fb627e47b1fe42 Mon Sep 17 00:00:00 2001 From: Peter Keresztes Schmidt Date: Mon, 24 May 2021 01:15:00 +0200 Subject: [PATCH 4/4] Build: Disable Wmissing-field-initializers on older GCC versions GCC 5.1 corrected the behaviour in regard that the C++11 initialisation behaviour is respected. --- cmake/compiler/gcc/settings.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/compiler/gcc/settings.cmake b/cmake/compiler/gcc/settings.cmake index ce84dcc1a..14eca0310 100644 --- a/cmake/compiler/gcc/settings.cmake +++ b/cmake/compiler/gcc/settings.cmake @@ -6,6 +6,7 @@ target_compile_options(zm-warning-interface -Wformat-security -Wno-cast-function-type $<$,11>:-Wno-clobbered> + $<$,5.1>:-Wno-missing-field-initializers> -Wno-unused-parameter -Woverloaded-virtual -Wvla)