From 3265c40aad6548917e7f6de898563d71d17afc0c Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Sun, 21 Jan 2024 18:57:57 +0100 Subject: [PATCH] Fix C compatibility issues in tests Related to: --- libreport-c89-2.patch | 46 +++++++++++++++++++++++++++++++++++++++++++ libreport-c89.patch | 28 ++++++++++++++++++++++++++ libreport.spec | 7 ++++++- 3 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 libreport-c89-2.patch create mode 100644 libreport-c89.patch diff --git a/libreport-c89-2.patch b/libreport-c89-2.patch new file mode 100644 index 0000000..7b9b9d6 --- /dev/null +++ b/libreport-c89-2.patch @@ -0,0 +1,46 @@ +problem_item_get_size expects unsigned long * argument in problem_data.at test + +Otherwise, the test fails to build on i686 with GCC 14. + +Submitted upstream: + +diff --git a/tests/problem_data.at b/tests/problem_data.at +index 4d8bf0075c0a8b91..db67a76732d48663 100644 +--- a/tests/problem_data.at ++++ b/tests/problem_data.at +@@ -89,7 +89,7 @@ int main(int argc, char **argv) + struct problem_item *itm = problem_data_add_ext(data, "1", "foo", CD_FLAG_TXT | CD_FLAG_ISNOTEDITABLE, PROBLEM_ITEM_UNINITIALIZED_SIZE); + const size_t old_size = strlen(itm->content); + { +- size_t current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE; ++ unsigned long current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE; + assert(problem_item_get_size(itm, ¤t_size) == 0); + assert(current_size != PROBLEM_ITEM_UNINITIALIZED_SIZE); + assert(current_size == old_size); +@@ -97,7 +97,7 @@ int main(int argc, char **argv) + { + g_free(itm->content); + itm->content = NULL; +- size_t current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE; ++ unsigned long current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE; + assert(problem_item_get_size(itm, ¤t_size) == 0); + assert(current_size != PROBLEM_ITEM_UNINITIALIZED_SIZE); + assert(current_size == old_size); +@@ -120,7 +120,7 @@ int main(int argc, char **argv) + struct problem_item *itm = problem_data_add_ext(data, "2", flnm, CD_FLAG_BIN, PROBLEM_ITEM_UNINITIALIZED_SIZE); + + { +- size_t current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE; ++ unsigned long current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE; + assert(problem_item_get_size(itm, ¤t_size) == 0); + assert(current_size != PROBLEM_ITEM_UNINITIALIZED_SIZE); + assert(current_size == old_size); +@@ -129,7 +129,7 @@ int main(int argc, char **argv) + close(flds); + unlink(flnm); + assert(stat(flnm, &buf) != 0); +- size_t current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE; ++ unsigned long current_size = PROBLEM_ITEM_UNINITIALIZED_SIZE; + assert(problem_item_get_size(itm, ¤t_size) == 0); + assert(current_size != PROBLEM_ITEM_UNINITIALIZED_SIZE); + assert(current_size == old_size); diff --git a/libreport-c89.patch b/libreport-c89.patch new file mode 100644 index 0000000..3f1770d --- /dev/null +++ b/libreport-c89.patch @@ -0,0 +1,28 @@ +Remove incorrect casts from tests/string_list.at + +The list_order argument already has the correct pointer type const +char * const * (after array-to-pointer decay). + +Submitted upstream: + +diff --git a/tests/string_list.at b/tests/string_list.at +index 6af162a2f8da3919..2118298da4de0ec3 100644 +--- a/tests/string_list.at ++++ b/tests/string_list.at +@@ -22,13 +22,13 @@ int main(void) + NULL + }; + +- int index = libreport_index_of_string_in_list(FILENAME_REASON, (char**) list_order); ++ int index = libreport_index_of_string_in_list(FILENAME_REASON, list_order); + assert(index == 0); + +- index = libreport_index_of_string_in_list(FILENAME_COUNT, (char**) list_order); ++ index = libreport_index_of_string_in_list(FILENAME_COUNT, list_order); + assert(index == 5); + +- index = libreport_index_of_string_in_list("other", (char**) list_order); ++ index = libreport_index_of_string_in_list("other", list_order); + assert(index < 0); + + return 0; diff --git a/libreport.spec b/libreport.spec index 70899a4..4facbcc 100644 --- a/libreport.spec +++ b/libreport.spec @@ -15,10 +15,12 @@ Summary: Generic library for reporting various problems Name: libreport Version: 2.17.11 -Release: 4%{?dist} +Release: 5%{?dist} License: GPL-2.0-or-later URL: https://abrt.readthedocs.org/ Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz +Patch0: libreport-c89.patch +Patch1: libreport-c89-2.patch # Fix compatibility with libxml2 2.12 Patch: https://github.com/abrt/%{name}/pull/801.patch @@ -672,6 +674,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %endif %changelog +* Sun Jan 21 2024 Florian Weimer - 2.17.11-5 +- Fix C compatibility issues in tests + * Sun Jan 21 2024 Fedora Release Engineering - 2.17.11-4 - Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild