diff --git a/0754-test-catalog-Fix-coredump-when-compiled-under-GCC10.patch b/0754-test-catalog-Fix-coredump-when-compiled-under-GCC10.patch new file mode 100644 index 0000000000000000000000000000000000000000..d4054b4cccc2ee48f17e7c88568dda18aadeb1a0 --- /dev/null +++ b/0754-test-catalog-Fix-coredump-when-compiled-under-GCC10.patch @@ -0,0 +1,56 @@ +From 5209a26aa917aa54b09ee18394ad46ee601e77be Mon Sep 17 00:00:00 2001 +From: Yuanhong Peng +Date: Tue, 17 May 2022 21:34:34 +0800 +Subject: [PATCH] test-catalog: Fix coredump when compiled under GCC10 + +According to the documentation: +https://gcc.gnu.org/gcc-9/porting_to.html#complit: + +The `catalog_dirs` produced by STRV_MAKE(..) marco relies on +the extended lifetime feature which is fixed by GCC9. + +Signed-off-by: Yuanhong Peng +--- + src/journal/test-catalog.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/src/journal/test-catalog.c b/src/journal/test-catalog.c +index 0c4da29..2ce92af 100644 +--- a/src/journal/test-catalog.c ++++ b/src/journal/test-catalog.c +@@ -201,7 +201,8 @@ static void test_catalog_file_lang(void) { + + int main(int argc, char *argv[]) { + _cleanup_(unlink_tempfilep) char database[] = "/tmp/test-catalog.XXXXXX"; +- _cleanup_free_ char *text = NULL, *catalog_dir = NULL; ++ _cleanup_free_ char *text = NULL; ++ char *catalog_dir = CATALOG_DIR; + int r; + + setlocale(LC_ALL, "de_DE.UTF-8"); +@@ -214,10 +215,9 @@ int main(int argc, char *argv[]) { + * If it is not, e.g. installed by systemd-tests package, then use installed catalogs. */ + if (test_is_running_from_builddir(NULL)) { + assert_se(catalog_dir = path_join(NULL, ABS_BUILD_DIR, "catalog")); +- catalog_dirs = STRV_MAKE(catalog_dir); +- } else +- catalog_dirs = STRV_MAKE(CATALOG_DIR); ++ } + ++ catalog_dirs = STRV_MAKE(catalog_dir); + assert_se(access(catalog_dirs[0], F_OK) >= 0); + log_notice("Using catalog directory '%s'", catalog_dirs[0]); + +@@ -242,5 +242,9 @@ int main(int argc, char *argv[]) { + assert_se(catalog_get(database, SD_MESSAGE_COREDUMP, &text) >= 0); + printf(">>>%s<<<\n", text); + ++ /* Only in this case, catalog_dir is malloced */ ++ if (test_is_running_from_builddir(NULL)) ++ free(catalog_dir); ++ + return 0; + } +-- +2.27.0 + diff --git a/systemd.spec b/systemd.spec index 7d8e5c49da39aeb26b0361a035a8b9e28ed87118..d828ae4ee6f8fbd2d78cf497c35dc7fef36adf06 100644 --- a/systemd.spec +++ b/systemd.spec @@ -1,4 +1,4 @@ -%define anolis_release .0.1 +%define anolis_release .0.2 #global gitcommit 10e465b5321bd53c1fc59ffab27e724535c6bc0f %{?gitcommit:%global gitcommitshort %(c=%{gitcommit}; echo ${c:0:7})} @@ -804,6 +804,7 @@ Patch0750: 0750-cgroup-util-make-definition-of-CGROUP_CONTROLLER_TO_.patch Patch0751: 0751-cgroup-update-only-siblings-that-got-realized-once.patch Patch0752: 0752-core-add-a-config-item-to-support-setting-the-value-.patch Patch0753: 0753-systemd-anolis-support-loongarch64.patch +Patch0754: 0754-test-catalog-Fix-coredump-when-compiled-under-GCC10.patch %ifarch %{ix86} x86_64 aarch64 %global have_gnu_efi 1 @@ -1433,6 +1434,9 @@ fi %files tests -f .file-list-tests %changelog +* Tue May 17 2022 Yuanhong Peng - 239-58.0.2 +- test-catalog: Fix coredump when compiled under GCC10 + * Tue Apr 19 2022 Yuanhong Peng - 239-58.0.1 - core: fix a null reference case in load_from_path() - sysctl: Don't pass null directive argument to '%s'