From 8fb4a78de6371170c6539d75289dbb217b095d72 Mon Sep 17 00:00:00 2001 From: chengzihan2 Date: Tue, 2 Jun 2020 11:50:31 +0800 Subject: [PATCH] Fix the error of using parameter (%s, NULL) for 'printf' when built by gcc-9 --- ...tricter-on-NULL-arguments-for-printf.patch | 43 +++++++++++++++++++ varnish.spec | 6 ++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 gcc-9-stricter-on-NULL-arguments-for-printf.patch diff --git a/gcc-9-stricter-on-NULL-arguments-for-printf.patch b/gcc-9-stricter-on-NULL-arguments-for-printf.patch new file mode 100644 index 0000000..4028ab1 --- /dev/null +++ b/gcc-9-stricter-on-NULL-arguments-for-printf.patch @@ -0,0 +1,43 @@ +From 6fa1497436693b2a2d8577dcae86a2bebca5b3f3 Mon Sep 17 00:00:00 2001 +From: chengzihan2 +Date: Tue, 2 Jun 2020 10:57:02 +0800 +Subject: [PATCH] gcc-9 stricter on NULL arguments for printf + +--- + lib/libvarnish/vnum.c | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/lib/libvarnish/vnum.c b/lib/libvarnish/vnum.c +index 6caf931..2611768 100644 +--- a/lib/libvarnish/vnum.c ++++ b/lib/libvarnish/vnum.c +@@ -348,15 +348,17 @@ main(int argc, char *argv[]) + + for (tc = test_cases; tc->str; ++tc) { + e = VNUM_2bytes(tc->str, &val, tc->rel); +- if (e != tc->err) { +- printf("%s: VNUM_2bytes(\"%s\", %ju) (%s) != (%s)\n", +- *argv, tc->str, tc->rel, tc->err, e); +- ++ec; +- } else if (e == NULL && val != tc->val) { +- printf("%s: VNUM_2bytes(\"%s\", %ju) %ju != %ju (%s)\n", +- *argv, tc->str, tc->rel, val, tc->val, e); +- ++ec; +- } ++ if (e != NULL) ++ val = 0; ++ if (e == tc->err && val == tc->val) ++ continue; ++ ++ec; ++ printf("%s: VNUM_2bytes(\"%s\", %ju)\n", ++ *argv, tc->str, tc->rel); ++ printf("\tExpected:\tstatus %s - value %ju\n", ++ tc->err ? tc->err : "Success", tc->val); ++ printf("\tGot:\t\tstatus %s - value %ju\n", ++ e ? e : "Success", val); + } + if (!isnan(VNUM_duration(NULL))) { + printf("%s: VNUM_Duration(NULL) fail\n", *argv); +-- +2.23.0 + diff --git a/varnish.spec b/varnish.spec index 1eefd10..b4f9141 100644 --- a/varnish.spec +++ b/varnish.spec @@ -1,7 +1,7 @@ Name: varnish Summary: A web application accelerator Version: 6.0.0 -Release: 4 +Release: 5 License: BSD URL: https://www.varnish-cache.org/ Source0: http://varnish-cache.org/_downloads/varnish-%{version}.tgz @@ -10,6 +10,7 @@ Source0: http://varnish-cache.org/_downloads/varnish-%{version}.tgz Source1: https://github.com/varnishcache/pkg-varnish-cache/archive/0ad2f22629c4a368959c423a19e352c9c6c79682/pkg-varnish-cache-0ad2f22.tar.gz Patch0001: varnish-5.1.1.fix_ld_library_path_in_doc_build.patch +Patch0002: gcc-9-stricter-on-NULL-arguments-for-printf.patch BuildRequires: python3-sphinx python3-docutils pkgconfig make graphviz nghttp2 systemd-units BuildRequires: ncurses-devel pcre-devel libedit-devel @@ -157,5 +158,8 @@ test -f /etc/varnish/secret || (uuidgen > /etc/varnish/secret && chmod 0600 /etc %{_mandir}/man7/*.7* %changelog +* Tue Jun 2 2020 chengzihan - 6.0.0-5 +- Fix the error of using parameter ("%s", NULL) for 'printf' when built by gcc-9 + * Mon Feb 10 2020 wangye - 6.0.0-4 - Init package -- Gitee