From 196c9ff535cacf4d9ba0966b8b70eeb7ca11b902 Mon Sep 17 00:00:00 2001 From: yixiangzhike Date: Wed, 16 Aug 2023 16:19:05 +0800 Subject: [PATCH] Refix the failure of building with cppcheck>=2.11 by using upstream patch (cherry picked from commit 3c72d76aa0d3f86e778e5e9367791a08090ac7f9) --- ...ent-cppcheck-from-defining-CHECK_DIR.patch | 33 +++++++++++++++++++ libkcapi.spec | 16 ++++----- 2 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 backport-Prevent-cppcheck-from-defining-CHECK_DIR.patch diff --git a/backport-Prevent-cppcheck-from-defining-CHECK_DIR.patch b/backport-Prevent-cppcheck-from-defining-CHECK_DIR.patch new file mode 100644 index 0000000..9f1cefa --- /dev/null +++ b/backport-Prevent-cppcheck-from-defining-CHECK_DIR.patch @@ -0,0 +1,33 @@ +From 2a49df86007becae89f335025e549bdbd26a24d2 Mon Sep 17 00:00:00 2001 +From: Ondrej Mosnacek +Date: Wed, 26 Jul 2023 10:32:34 +0200 +Subject: [PATCH] Prevent cppcheck from defining CHECK_DIR + +Recent versions of cppcheck fail with a syntax error when they check +apps/kcapi-hasher.c with CHECK_DIR defined (probably they now define it +to 1 instead of an empty value). To fix it, instruct cppcheck to only +check with CHECK_DIR left undefined. + +Link: https://bugzilla.redhat.com/show_bug.cgi?id=2225970 +Signed-off-by: Ondrej Mosnacek +Signed-off-by: Stephan Mueller +--- + Makefile.am | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/Makefile.am b/Makefile.am +index 0a6ff26..0189848 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -241,7 +241,7 @@ endif + + if HAVE_CPPCHECK + cppcheck: +- $(CPPCHECK) --error-exitcode=42 --enable=performance,warning,portability $(sort $(SCAN_FILES)) ++ $(CPPCHECK) -U CHECK_DIR --error-exitcode=42 --enable=performance,warning,portability $(sort $(SCAN_FILES)) + endif + + if HAVE_MKTEMP +-- +2.27.0 + diff --git a/libkcapi.spec b/libkcapi.spec index ff02844..d96ccb9 100644 --- a/libkcapi.spec +++ b/libkcapi.spec @@ -8,9 +8,6 @@ %define enable_docbook_pdf 0 %endif -# check failed with cppcheck >= 2.11 -%define min_cppcheck %pkg_version_cmp cppcheck 2.11 - # Calculate hmac file after installing for binary %define __spec_install_post \ %{?__debug_package:%{__debug_install_post}} \ @@ -29,7 +26,7 @@ ln -s libkcapi.so.%{version}.hmac %{buildroot}/%{_lib}/fipscheck/libkcapi.so. Name: libkcapi Version: 1.4.0 -Release: 4 +Release: 5 Summary: libkcapi - Linux Kernel Crypto API User Space Interface Library License: BSD or GPLv2 @@ -39,6 +36,7 @@ Source1: http://www.chronox.de/%{name}/%{name}-%{version}.tar.xz.asc Patch0: libkcapi-1.1.1-lib_Fix_kcapi_handle_destroy_closing_FD_0.patch Patch1: backport-Append-newline-to-stdout.patch +Patch2: backport-Prevent-cppcheck-from-defining-CHECK_DIR.patch BuildRequires: clang coreutils cppcheck gcc hardlink BuildRequires: libtool openssl perl systemd xmlto kernel-headers >= 4.10.0 @@ -178,10 +176,6 @@ done %ldconfig_scriptlets %check -%if %{min_cppcheck} >= 0 -# add -UCHECK_DIR to cppcheck with cppcheck >= 2.11 -sed -i 's/\$(CPPCHECK)/\$(CPPCHECK) -UCHECK_DIR/' Makefile -%endif for t in cppcheck scan;do %make_build $t done @@ -227,6 +221,12 @@ popd %{_mandir}/man3/kcapi_*.3.* %changelog +* Wed Aug 16 2023 yixiangzhike - 1.4.0-5 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC:refix the failure of building with cppcheck>=2.11 by using upstream patch + * Tue Aug 15 2023 yixiangzhike - 1.4.0-4 - Type:bugfix - ID:NA