From b052e1040107341b59d0034b0cbc6e300af2f00b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Wed, 9 Aug 2023 12:29:16 +0200 Subject: [PATCH] 0.37 bump --- .gitignore | 1 + ...rd-0.37-Pass-a-format-string-to-warn.patch | 47 +++++++++++++++++++ perl-XS-Parse-Keyword.spec | 9 +++- sources | 2 +- 4 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 XS-Parse-Keyword-0.37-Pass-a-format-string-to-warn.patch diff --git a/.gitignore b/.gitignore index 306d66c..592e1db 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,4 @@ /XS-Parse-Keyword-0.33.tar.gz /XS-Parse-Keyword-0.34.tar.gz /XS-Parse-Keyword-0.36.tar.gz +/XS-Parse-Keyword-0.37.tar.gz diff --git a/XS-Parse-Keyword-0.37-Pass-a-format-string-to-warn.patch b/XS-Parse-Keyword-0.37-Pass-a-format-string-to-warn.patch new file mode 100644 index 0000000..e1d1f3c --- /dev/null +++ b/XS-Parse-Keyword-0.37-Pass-a-format-string-to-warn.patch @@ -0,0 +1,47 @@ +From 2f53d01f14661f7a663090582ac4f2a5414328b5 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= +Date: Wed, 9 Aug 2023 12:19:21 +0200 +Subject: [PATCH] Pass a format string to warn() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Building with -Werror=format-security compiler flag raised an error: + + gcc -Isrc/ -I/usr/lib64/perl5/CORE -fPIC -DHAVE_PL_INFIX_PLUGIN -I. -Ihax -c -D_REENTRANT -D_GNU_SOURCE -O2 '-flto=auto' -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang '-Werror=format-security' '-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3' -Wp,-D_GLIBCXX_ASSERTIONS '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' -fstack-protector-strong '-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1' -m64 '-mtune=generic' -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE '-D_FILE_OFFSET_BITS=64' -O2 '-flto=auto' -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall '-Werror=format-security' '-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3' -Wp,-D_GLIBCXX_ASSERTIONS '-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1' -fstack-protector-strong '-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1' -m64 '-mtune=generic' -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -o src/keyword.o src/keyword.c + [...] + src/keyword.c: In function 'parse_piece': + src/keyword.c:422:7: error: format not a string literal and no format arguments [-Werror=format-security] + 422 | warn(piece->u.str); + | ^~~~ + +This is becaue warn() expects a format string as a first argument, see proto.h: + + Perl_warn(pTHX_ const char *pat, ...) + __attribute__format__(__printf__,pTHX_1,pTHX_2); + +This patch fixes it by formatting the unknown string with "%s". + +CPAN RT#149346 + +Signed-off-by: Petr Písař +--- + src/keyword.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/keyword.c b/src/keyword.c +index 30d0900..07aae26 100644 +--- a/src/keyword.c ++++ b/src/keyword.c +@@ -419,7 +419,7 @@ static void parse_piece(pTHX_ SV *argsv, size_t *argidx, const struct XSParseKey + int warnbit = piece->type >> 24; + if(warnbit && !ckWARN(warnbit)) + return; +- warn(piece->u.str); ++ warn("%s", piece->u.str); + return; + } + +-- +2.41.0 + diff --git a/perl-XS-Parse-Keyword.spec b/perl-XS-Parse-Keyword.spec index 80f036e..0391f7b 100644 --- a/perl-XS-Parse-Keyword.spec +++ b/perl-XS-Parse-Keyword.spec @@ -2,8 +2,8 @@ %bcond_without perl_XS_Parse_Keyword_enables_optional_test Name: perl-XS-Parse-Keyword -Version: 0.36 -Release: 2%{?dist} +Version: 0.37 +Release: 1%{?dist} Summary: XS functions to assist in parsing keyword syntax License: GPL-1.0-or-later OR Artistic-1.0-Perl URL: https://metacpan.org/release/XS-Parse-Keyword @@ -12,6 +12,8 @@ Source1: macros.perl-XS-Parse-Keyword # Fix a check for PL_infix_plugin, not suitable for upstream, bug #2226738, # CPAN RT#149179. Patch0: XS-Parse-Keyword-0.36-No-special-linker-flags-for-checking-for-PL_infix_pl.patch +# Fix calling warn(), CPAN RT#149346, proposed to the upstream. +Patch1: XS-Parse-Keyword-0.37-Pass-a-format-string-to-warn.patch BuildRequires: coreutils BuildRequires: perl-devel BuildRequires: perl-generators @@ -147,6 +149,9 @@ export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print %{_libexecdir}/%{name} %changelog +* Wed Aug 09 2023 Petr Pisar - 0.37-1 +- 0.37 bump + * Wed Jul 26 2023 Petr Pisar - 0.36-2 - Fix a check for PL_infix_plugin diff --git a/sources b/sources index bc9343a..1c79dcc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (XS-Parse-Keyword-0.36.tar.gz) = 243965d6ec91e4303524b5b4a973f197d0831a62d8a257f114e803bb95145eff40c806dc32476ae975f38c0ee23bc0bd89f7bd57939f3918b8927ccbbb94f2ca +SHA512 (XS-Parse-Keyword-0.37.tar.gz) = 6a0c125e8f4afb6c33260e1bb07e64b168f1e7e1776739b6f09cc47232cb41ae65cee9ea5bbcafcc67eefa91b7cb3cd7a916581649b4b2da3049f306987ca5a9