!45 Change assert in ringbuffer to a return code

From: @bixiaoyan1 
Reviewed-by: @liqingqing_1229 
Signed-off-by: @liqingqing_1229
This commit is contained in:
openeuler-ci-bot 2023-11-23 12:08:42 +00:00 committed by Gitee
commit c902301cc5
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 41 additions and 2 deletions

View File

@ -0,0 +1,34 @@
From 9297df4e48c45123a5e4103b3fd07df244346636 Mon Sep 17 00:00:00 2001
From: Chrissie Caulfield <ccaulfie@redhat.com>
Date: Wed, 15 Nov 2023 09:03:52 +0000
Subject: [PATCH] Change assert in ringbuffer to a return code (#492)
Why just this one?
There are LOADS of asserts in libqb, some are OK and some may be
overkill. This one in particular is causing CI failures
and so annoys me more than the rest.
---
lib/ringbuffer_helper.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/lib/ringbuffer_helper.c b/lib/ringbuffer_helper.c
index dbde275..11795ff 100644
--- a/lib/ringbuffer_helper.c
+++ b/lib/ringbuffer_helper.c
@@ -359,7 +359,11 @@ qb_rb_close_helper(struct qb_ringbuffer_s * rb, int32_t unlink_it,
truncate_fallback);
/* the dirname part is assumed to be the same */
- assert(!strncmp(dir_path, hdr_path, sep - data_path));
+ if (strncmp(dir_path, hdr_path, sep - data_path)) {
+ qb_util_perror(LOG_DEBUG,
+ "header path is corrupted: %s", hdr_path);
+ res = -ENXIO;
+ }
sep = hdr_path + (sep - data_path);
/* now, don't touch neither data_path nor hdr_path */
--
2.33.0

View File

@ -1,11 +1,11 @@
Name: libqb
Version: 2.0.8
Release: 1
Release: 2
Summary: Library providing high performance logging, tracing, ipc, and poll
License: LGPLv2+
URL: https://github.com/ClusterLabs/libqb
Source0: https://github.com/ClusterLabs/libqb/releases/download/v%{version}/%{name}-%{version}.tar.xz
Patch0: Change-assert-in-ringbuffer-to-a-return-code-492.patch
BuildRequires: autoconf automake libtool check-devel doxygen gcc procps pkgconfig(glib-2.0)
BuildRequires: git-core
# For doxygen2man
@ -74,6 +74,11 @@ This package contains a program to create nicely-formatted man pages from Doxyge
%{_mandir}/man1/doxygen2man.1.gz
%changelog
* Mon Nov 20 2023 bixiaoyan <bixiaoyan@kylinos.cn> - 2.0.8-2
- Change assert in ringbuffer to a return code
Community Patch Link:
https://github.com/ClusterLabs/libqb/pull/492/commits/88d3eeacc64a059fcb8e2d329ddeafa63b24edfb
* Tue Oct 31 2023 haomimi <haomimi@uniontech.com> - 2.0.8-1
- Upgrade to 2.0.8