From 356907286b6c5b4d839958134c3bb6d602c73eeb Mon Sep 17 00:00:00 2001 From: zhangyaqi Date: Thu, 17 Oct 2024 19:15:29 +0800 Subject: [PATCH] grep adjust to safe_read change --- ...-Fix-grep-adjust-to-safe_read-change.patch | 43 +++++++++++++++++++ grep.spec | 6 ++- 2 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 backport-Fix-grep-adjust-to-safe_read-change.patch diff --git a/backport-Fix-grep-adjust-to-safe_read-change.patch b/backport-Fix-grep-adjust-to-safe_read-change.patch new file mode 100644 index 0000000..b844d74 --- /dev/null +++ b/backport-Fix-grep-adjust-to-safe_read-change.patch @@ -0,0 +1,43 @@ +From c89ce1cd48d949322a110ea793f41484a8dd0be9 Mon Sep 17 00:00:00 2001 +From: Paul Eggert +Date: Sat, 21 Sep 2024 08:45:13 -0700 +Subject: grep: adjust to safe_read change + +* src/grep.c (fillbuf): Adjust to Gnulib safe_read API change; +it now returns ptrdiff_t, with -1 signifying error. +--- + src/grep.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/grep.c b/src/grep.c +index 491dd02..bb88d49 100644 +--- a/src/grep.c ++++ b/src/grep.c +@@ -1006,13 +1006,13 @@ fillbuf (idx_t save, struct stat const *st) + idx_t readsize = buffer + bufalloc - uword_size - readbuf; + readsize -= readsize % pagesize; + +- idx_t fillsize; ++ ptrdiff_t fillsize; + bool cc = true; + + while (true) + { + fillsize = safe_read (bufdesc, readbuf, readsize); +- if (fillsize == SAFE_READ_ERROR) ++ if (fillsize < 0) + { + fillsize = 0; + cc = false; +@@ -1788,7 +1788,7 @@ drain_input (int fd, struct stat const *st) + #endif + } + while ((nbytes = safe_read (fd, buffer, bufalloc))) +- if (nbytes == SAFE_READ_ERROR) ++ if (nbytes < 0) + return false; + return true; + } +-- +2.27.0 + diff --git a/grep.spec b/grep.spec index 59f98eb..190d174 100644 --- a/grep.spec +++ b/grep.spec @@ -1,6 +1,6 @@ Name: grep Version: 3.11 -Release: 4 +Release: 5 Summary: A string search utility License: GPLv3+ URL: https://www.gnu.org/software/grep @@ -12,6 +12,7 @@ Source3: grepconf.sh Patch0001: fix-grep-m2-pattern.patch Patch0002: backport-Fix-troff-typos-found-by-mandoc-and-groff.patch Patch0003: backport-Fix-recognition-of-cs_CZ.UTF-8-locale-on-FreeBSD.patch +Patch0004: backport-Fix-grep-adjust-to-safe_read-change.patch BuildRequires: gcc pcre2-devel texinfo gettext automake Provides: /bin/egrep /bin/fgrep /bin/grep bundled(gnulib) @@ -52,6 +53,9 @@ install -Dpm 755 %{SOURCE3} $RPM_BUILD_ROOT%{_libexecdir}/grepconf.sh %{_mandir}/man1/*grep.1* %changelog +* Fri Oct 25 2024 zhangyaqi - 3.11-5 +- fix grep: adjust to safe_read change + * Mon Aug 26 2024 guojunding - 3.11-4 - fix troff typos - fix recognition of cs_CZ.UTF-8 locale on FreeBSD -- Gitee