From a31d41e1d9f02ec8a54ed67879b529fc20da167f Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 19 Aug 2020 15:22:25 +0200 Subject: F33 build with patch for -Werror=format-security reported as https://github.com/jbboehr/handlebars.c/issues/87 --- build.patch | 209 +++++++++++++++++++++++++++++++++++++++++++++++++++++ libhandlebars.spec | 9 ++- 2 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 build.patch diff --git a/build.patch b/build.patch new file mode 100644 index 0000000..5d85e65 --- /dev/null +++ b/build.patch @@ -0,0 +1,209 @@ +diff -up tests/test_partial_loader.c.old tests/test_partial_loader.c +--- tests/test_partial_loader.c.old 2020-08-19 14:49:19.309503731 +0200 ++++ tests/test_partial_loader.c 2020-08-19 14:57:45.759371679 +0200 +@@ -64,14 +64,14 @@ static struct handlebars_string * execut + // Check error + if( handlebars_error_num(ctx) != HANDLEBARS_SUCCESS ) { + // @todo maybe check message +- ck_abort_msg(handlebars_error_msg(ctx)); ++ ck_abort_msg("%s", handlebars_error_msg(ctx)); + goto done; + } + + // Compile + handlebars_compiler_compile(compiler, parser->program); + if( handlebars_error_num(ctx) != HANDLEBARS_SUCCESS ) { +- ck_abort_msg(handlebars_error_msg(ctx)); ++ ck_abort_msg("%s", handlebars_error_msg(ctx)); + goto done; + } + +@@ -97,7 +97,7 @@ static struct handlebars_string * execut + // Execute + handlebars_vm_execute(vm, module, context); + +- ck_assert_msg(handlebars_error_msg(HBSCTX(vm)) == NULL, handlebars_error_msg(HBSCTX(vm))); ++ ck_assert_msg("%s", handlebars_error_msg(HBSCTX(vm)) == NULL, handlebars_error_msg(HBSCTX(vm))); + + retval = talloc_steal(NULL, vm->buffer); + +diff -up tests/test_spec_handlebars.c.old tests/test_spec_handlebars.c +--- tests/test_spec_handlebars.c.old 2020-08-19 15:02:14.938770019 +0200 ++++ tests/test_spec_handlebars.c 2020-08-19 15:08:17.911897696 +0200 +@@ -333,7 +333,7 @@ START_TEST(test_ast_to_string_on_handleb + + // Check error + if( handlebars_error_num(ctx) != HANDLEBARS_SUCCESS ) { +- ck_assert_msg(0, handlebars_error_msg(ctx)); ++ ck_assert_msg(0, "%s", handlebars_error_msg(ctx)); + } + + ast_str = handlebars_ast_to_string(ctx, parser->program); +@@ -345,7 +345,7 @@ START_TEST(test_ast_to_string_on_handleb + "" /*test->suite_name*/, + test->description, test->it, test->flags, + test->tmpl, expected, actual); +- ck_abort_msg(tmp); ++ ck_abort_msg("%s", tmp); + } + + done: +@@ -447,7 +447,7 @@ static inline void run_test(struct gener + // Check error + if( handlebars_error_num(ctx) != HANDLEBARS_SUCCESS ) { + // @todo maybe check message +- ck_assert_msg(test->exception, handlebars_error_msg(ctx)); ++ ck_assert_msg(test->exception, "%s", handlebars_error_msg(ctx)); + goto done; + } + +@@ -560,14 +560,14 @@ static inline void run_test(struct gener + if( 0 == regex_compare(tmp, handlebars_error_msg(HBSCTX(vm)), ®ex_error) ) { + // ok + } else { +- ck_assert_msg(0, regex_error); ++ ck_assert_msg(0, "%s", regex_error); + } + free(tmp); + } else { + ck_assert_str_eq(test->message, handlebars_error_msg(HBSCTX(vm))); + } + } else { +- ck_assert_msg(handlebars_error_msg(HBSCTX(vm)) == NULL, handlebars_error_msg(HBSCTX(vm))); ++ ck_assert_msg(handlebars_error_msg(HBSCTX(vm)) == NULL, "%s", handlebars_error_msg(HBSCTX(vm))); + ck_assert_ptr_ne(test->expected, NULL); + ck_assert_ptr_ne(vm->buffer, NULL); + +@@ -577,7 +577,7 @@ static inline void run_test(struct gener + "" /*test->suite_name*/, + test->description, test->it, test->flags, + test->tmpl, test->expected, vm->buffer->val); +- ck_abort_msg(tmp); ++ ck_abort_msg("%s", tmp); + } + } + +diff -up tests/test_spec_handlebars_compiler.c.old tests/test_spec_handlebars_compiler.c +--- tests/test_spec_handlebars_compiler.c.old 2020-08-19 15:01:47.311831778 +0200 ++++ tests/test_spec_handlebars_compiler.c 2020-08-19 15:02:01.241800639 +0200 +@@ -697,7 +697,7 @@ START_TEST(handlebars_spec_compiler) + test->suite_name, + test->description, test->it, test->flags, + test->tmpl, test->expected->val, actual->val); +- ck_abort_msg(tmp); ++ ck_abort_msg("%s", tmp); + } + /* } */ + +diff -up tests/test_spec_handlebars_parser.c.old tests/test_spec_handlebars_parser.c +--- tests/test_spec_handlebars_parser.c.old 2020-08-19 15:00:06.471057182 +0200 ++++ tests/test_spec_handlebars_parser.c 2020-08-19 15:01:31.612866873 +0200 +@@ -209,7 +209,7 @@ START_TEST(handlebars_spec_parser) + if( 0 == regex_compare(tmp, errmsgjs, ®ex_error) ) { + // ok + } else { +- ck_assert_msg(0, regex_error); ++ ck_assert_msg(0, "%s", regex_error); + } + free(tmp); + } else { +@@ -222,7 +222,7 @@ START_TEST(handlebars_spec_parser) + lesigh = handlebars_talloc_strdup_append(lesigh, errmsg); + lesigh = handlebars_talloc_strdup_append(lesigh, "\nTemplate: \n"); + lesigh = handlebars_talloc_strdup_append(lesigh, test->tmpl); +- ck_assert_msg(0, lesigh); ++ ck_assert_msg(0, "%s", lesigh); + } + } else { + struct handlebars_string * output = handlebars_ast_print(HBSCTX(parser), parser->program); +@@ -238,10 +238,10 @@ START_TEST(handlebars_spec_parser) + lesigh = handlebars_talloc_strdup_append(lesigh, output->val); + lesigh = handlebars_talloc_strdup_append(lesigh, "\nTemplate: \n"); + lesigh = handlebars_talloc_strdup_append(lesigh, test->tmpl); +- ck_assert_msg(0, lesigh); ++ ck_assert_msg(0, "%s", lesigh); + } + } else { +- ck_assert_msg(0, test->message); ++ ck_assert_msg(0, "%s", test->message); + } + + handlebars_talloc_free(output); +diff -up tests/test_spec_mustache.c.old tests/test_spec_mustache.c +--- tests/test_spec_mustache.c.old 2020-08-19 15:09:13.225763729 +0200 ++++ tests/test_spec_mustache.c 2020-08-19 15:10:04.588639326 +0200 +@@ -258,7 +258,7 @@ START_TEST(test_ast_to_string_on_mustach + + // Check error + if( handlebars_error_num(ctx) != HANDLEBARS_SUCCESS ) { +- ck_assert_msg(0, handlebars_error_msg(ctx)); ++ ck_assert_msg(0, "%s", handlebars_error_msg(ctx)); + } + + ast_str = handlebars_ast_to_string(ctx, parser->program); +@@ -271,7 +271,7 @@ START_TEST(test_ast_to_string_on_mustach + "" /*test->suite_name*/, + test->name, test->desc, test->flags, + test->tmpl, expected, actual); +- ck_abort_msg(tmp); ++ ck_abort_msg("%s", tmp); + } + + done: +@@ -322,7 +322,7 @@ START_TEST(test_mustache_spec) + + // Check error + if( handlebars_error_num(ctx) != HANDLEBARS_SUCCESS ) { +- ck_assert_msg(0, handlebars_error_msg(ctx)); ++ ck_assert_msg(0, "%s", handlebars_error_msg(ctx)); + } + + // Compile +@@ -330,7 +330,7 @@ START_TEST(test_mustache_spec) + handlebars_compiler_compile(compiler, parser->program); + + if( handlebars_error_num(ctx) != HANDLEBARS_SUCCESS ) { +- ck_assert_msg(0, handlebars_error_msg(ctx)); ++ ck_assert_msg(0, "%s", handlebars_error_msg(ctx)); + } + + // Serialize +@@ -368,7 +368,7 @@ START_TEST(test_mustache_spec) + + // Check error + if( handlebars_error_num(ctx) != HANDLEBARS_SUCCESS ) { +- ck_assert_msg(0, handlebars_error_msg(ctx)); ++ ck_assert_msg(0, "%s", handlebars_error_msg(ctx)); + } + + ck_assert_ptr_ne(vm->buffer, NULL); +@@ -379,7 +379,7 @@ START_TEST(test_mustache_spec) + "" /*test->suite_name*/, + test->name, test->desc, test->flags, + test->tmpl, test->expected, vm->buffer->val); +- ck_abort_msg(tmp); ++ ck_abort_msg("%s", tmp); + } + + handlebars_context_dtor(ctx); +diff -up tests/test_value.c.old tests/test_value.c +--- tests/test_value.c.old 2020-08-19 14:58:55.777215189 +0200 ++++ tests/test_value.c 2020-08-19 14:59:35.199127077 +0200 +@@ -434,7 +434,7 @@ START_TEST(test_json_parse_error) + if( handlebars_setjmp_ex(context, &buf) ) { + char * error = NULL; + if( 0 != regex_compare("^JSON Parse error", handlebars_error_msg(context), &error) ) { +- ck_abort_msg(error); ++ ck_abort_msg("%s", error); + } + return; + } +@@ -451,7 +451,7 @@ START_TEST(test_yaml_parse_error) + if( handlebars_setjmp_ex(context, &buf) ) { + char * error = NULL; + if( 0 != regex_compare("^YAML Parse Error", handlebars_error_msg(context), &error) ) { +- ck_abort_msg(error); ++ ck_abort_msg("%s", error); + } + return; + } diff --git a/libhandlebars.spec b/libhandlebars.spec index 36636d3..e9b3977 100644 --- a/libhandlebars.spec +++ b/libhandlebars.spec @@ -25,7 +25,7 @@ Name: %{libname} Version: 0.7.2 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Handlebars C library License: LGPLv2+ @@ -34,6 +34,8 @@ Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{gh_ Source1: https://github.com/%{hspec_owner}/%{hspec_project}/archive/%{hspec_commit}/%{hspec_project}-%{hspec_short}.tar.gz Source2: https://github.com/%{mspec_owner}/%{mspec_project}/archive/%{mspec_commit}/%{mspec_project}-%{mspec_short}.tar.gz +Patch0: build.patch + BuildRequires: gcc BuildRequires: autoconf BuildRequires: automake @@ -79,6 +81,7 @@ This package provides handlebarsc command line tool split off %{libname}. %prep %setup -qn %{gh_project}-%{gh_commit} -a1 -a2 +%patch0 -p0 mkdir spec mv %{hspec_project}-%{hspec_commit} spec/handlebars @@ -124,6 +127,10 @@ make test %changelog +* Wed Aug 19 2020 Remi Collet - 0.7.2-2 +- F33 build with patch for -Werror=format-security + reported as https://github.com/jbboehr/handlebars.c/issues/87 + * Wed Apr 22 2020 Remi Collet - 0.7.2-1 - update to 0.7.2 -- cgit