From 9f8b3f1f41f39d45cab0837af877b58aef8b3c44 Mon Sep 17 00:00:00 2001 From: Jakub Bogusz Date: Sun, 3 Oct 2021 08:33:03 +0200 Subject: [PATCH] - added truncation-workaround patch to workaround build failure on th-i686; release 2 --- pinfo-truncation-workaround.patch | 26 ++++++++++++++++++++++++++ pinfo.spec | 4 +++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 pinfo-truncation-workaround.patch diff --git a/pinfo-truncation-workaround.patch b/pinfo-truncation-workaround.patch new file mode 100644 index 0000000..551d846 --- /dev/null +++ b/pinfo-truncation-workaround.patch @@ -0,0 +1,26 @@ +gcc's -Werror=stringop-truncation tries to be too smart, but actually it isn't. +Take len just after initialization, before call to mkstemp() (which doesn't change string length); +now gcc doesn't complain. + +--- pinfo-0.6.13/src/utils.c.orig 2019-02-16 21:23:32.000000000 +0100 ++++ pinfo-0.6.13/src/utils.c 2021-10-03 07:45:00.428038370 +0200 +@@ -848,10 +848,10 @@ char * + make_tempfile() + { + char *filename; +- size_t len; + + /* TODO: fix hardcoded /tmp */ + char tmpfile_template[] = "/tmp/pinfo.XXXXXX"; ++ size_t len = strlen(tmpfile_template)+1; + + /* create a tmpfile */ + int fd = mkstemp(tmpfile_template); +@@ -864,7 +864,6 @@ make_tempfile() + } + + /* allocate a new string and copy the filename there */ +- len = strlen(tmpfile_template)+1; + filename = xmalloc(len+1); /* guarenteerd to be set to \0's */ + strncpy(filename, tmpfile_template, len); + diff --git a/pinfo.spec b/pinfo.spec index f9dd1fd..606cf4f 100644 --- a/pinfo.spec +++ b/pinfo.spec @@ -6,7 +6,7 @@ Summary(ru.UTF-8): Программа просмотра info- и man-докум Summary(uk.UTF-8): Програма перегляду info- та man-документів у стилі lynx Name: pinfo Version: 0.6.13 -Release: 1 +Release: 2 License: GPL v2 Group: Applications/System #Source0Download: https://github.com/baszoetekouw/pinfo/releases @@ -21,6 +21,7 @@ Patch3: %{name}-info.patch Patch4: %{name}-gettext.patch Patch5: %{name}-color.patch Patch6: %{name}-no-common.patch +Patch7: %{name}-truncation-workaround.patch URL: https://github.com/baszoetekouw/pinfo BuildRequires: autoconf >= 2.57 BuildRequires: automake @@ -66,6 +67,7 @@ Pinfo - це програма перегляду info-файлів та man-ст %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 %build CPPFLAGS="-I%{_includedir}/ncursesw" -- 2.43.0