sys-apps/grep: Sync with gentoo

It's from gentoo commit 2f3ae8922190ebd677d2abf91dac174b42e24ad8.
This commit is contained in:
Krzesimir Nowak 2022-03-02 18:06:02 +01:00
parent a7ada2c491
commit c5a50f1ea5
8 changed files with 91 additions and 207 deletions

View File

@ -1,3 +1 @@
DIST grep-2.27.tar.xz 1360388 BLAKE2B ed750fa7a6aea389c8f096acc9ac9cdebc9561c4b0cedfd5415ef033dd90076d5b9a42fa97c97207474b250ac0c4e4ed3c2ff216fe4462ac80baa6e47a2b90eb SHA512 d67f16cc5f931a455d5287badbaf080967da573d290430f440e578a563cff4f4c0c2668f60dbb8bc71eaed289f075957006c10c6827f0da1a49df49efd3f0781
DIST grep-3.0.tar.xz 1375156 BLAKE2B 19f5441ed3fe5bb16d9d8327e76f0beb7eb837b727f6da99844dc9c74eb4def9eab857059c527e651758fa224a6f4079ec5939806645806f2db341ed0cb727e4 SHA512 0e9a00df9d492f399230bae0264942edaf64bb926f93edb7922f27b075a86ba0a78698f54996cc522b6261aa01a8ecbeadeb68523d4470a9941f242c3ae24c58
DIST grep-3.1.tar.xz 1370880 BLAKE2B d71a09d8bfd2c15b6d393d3ca4e22a2b2724632034a6d35d6e269a3c639d76ecaa5ae989a3d8466ee4bcf45e5d08862b0ef19194d6ec7ac6c250e6f60fc61031 SHA512 05494381c7dd8aad7e2ee4c17450de8d7b969a99dcfe17747db60df3475bf02d5323d091e896e8343e4f3251c29dc7f0b7a9f93c575c9d58ee2a57014c2c9d26
DIST grep-3.7.tar.xz 1641196 BLAKE2B acf03b1fe8065dac48d686de070bab9ecddae65c97f3b0e2be484e8abdd06d1fbdbb396f3d73dadadf9618aad2f02cf6416094bad64d5f2f15eab6b6b3adfeda SHA512 e9e45dcd40af8367f819f2b93c5e1b4e98a251a9aa251841fa67a875380fae52cfa27c68c6dbdd6a4dde1b1017ee0f6b9833ef6dd6e419d32d71b6df5e972b82

View File

@ -1,60 +0,0 @@
http://lists.gnu.org/archive/html/bug-grep/2016-12/msg00036.html
From 7ad47abbcb070946000771a829b51224720b8cef Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 27 Dec 2016 11:16:32 -0800
Subject: [PATCH] grep: fix bug with '... | grep pat >> /dev/null'
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Problem reported by Benno Fünfstück (Bug#25283).
* NEWS: Document this.
* src/grep.c (drain_input) [SPLICE_F_MOVE]:
Don't assume /dev/null is always acceptable output to splice.
* tests/grep-dev-null-out: Test for the bug.
---
NEWS | 7 ++++---
src/grep.c | 14 +++++++++-----
tests/grep-dev-null-out | 2 ++
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/grep.c b/src/grep.c
index f28f3c287609..aebab2060308 100644
--- a/src/grep.c
+++ b/src/grep.c
@@ -1728,11 +1728,15 @@ drain_input (int fd, struct stat const *st)
{
#ifdef SPLICE_F_MOVE
/* Should be faster, since it need not copy data to user space. */
- while ((nbytes = splice (fd, NULL, STDOUT_FILENO, NULL,
- INITIAL_BUFSIZE, SPLICE_F_MOVE)))
- if (nbytes < 0)
- return false;
- return true;
+ nbytes = splice (fd, NULL, STDOUT_FILENO, NULL,
+ INITIAL_BUFSIZE, SPLICE_F_MOVE);
+ if (0 <= nbytes || errno != EINVAL)
+ {
+ while (0 < nbytes)
+ nbytes = splice (fd, NULL, STDOUT_FILENO, NULL,
+ INITIAL_BUFSIZE, SPLICE_F_MOVE);
+ return nbytes == 0;
+ }
#endif
}
while ((nbytes = safe_read (fd, buffer, bufalloc)))
diff --git a/tests/grep-dev-null-out b/tests/grep-dev-null-out
index 13a4843957a6..c8128d5cc6a4 100755
--- a/tests/grep-dev-null-out
+++ b/tests/grep-dev-null-out
@@ -8,4 +8,6 @@ require_timeout_
${AWK-awk} 'BEGIN {while (1) print "x"}' </dev/null |
returns_ 124 timeout 1 grep x >/dev/null || fail=1
+echo abc | grep b >>/dev/null || fail=1
+
Exit $fail
--
2.11.0

View File

@ -0,0 +1,18 @@
Needed to fix build on ppc + musl. Doesn't seem to yet be in upstream gnulib.
https://www.openwall.com/lists/musl/2017/11/05/2
https://github.com/void-linux/void-packages/blob/master/srcpkgs/grep/patches/ppc-musl.patch
--- a/lib/sigsegv.c
+++ b/lib/sigsegv.c
@@ -221,8 +221,10 @@ int libsigsegv_version = LIBSIGSEGV_VERSION;
/* both should be equivalent */
# if 0
# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.regs->gpr[1]
-# else
+# elif defined(__GLIBC__)
# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.uc_regs->gregs[1]
+# else
+# define SIGSEGV_FAULT_STACKPOINTER ((ucontext_t *) ucp)->uc_mcontext.gregs[1]
# endif
# endif

View File

@ -1,46 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
inherit eutils flag-o-matic toolchain-funcs
DESCRIPTION="GNU regular expression matcher"
HOMEPAGE="https://www.gnu.org/software/grep/"
SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
mirror://gentoo/${P}.tar.xz"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="alpha amd64 arm ~arm64 hppa ia64 ~m68k ~mips ppc ppc64 ~s390 ~sh sparc x86 ~ppc-aix ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="nls pcre static"
LIB_DEPEND="pcre? ( >=dev-libs/libpcre-7.8-r1[static-libs(+)] )"
RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
nls? ( virtual/libintl )
virtual/libiconv"
DEPEND="${RDEPEND}
virtual/pkgconfig
nls? ( sys-devel/gettext )
static? ( ${LIB_DEPEND} )"
DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
src_prepare() {
epatch "${FILESDIR}"/${P}-splice.patch
sed -i \
-e "s:@SHELL@:${EPREFIX}/bin/sh:g" \
src/egrep.sh || die #523898
}
src_configure() {
use static && append-ldflags -static
# Always use pkg-config to get lib info for pcre.
export ac_cv_search_pcre_compile=$(
usex pcre "$($(tc-getPKG_CONFIG) --libs $(usex static --static '') libpcre)" ''
)
econf \
--bindir="${EPREFIX}"/bin \
$(use_enable nls) \
$(use_enable pcre perl-regexp)
}

View File

@ -1,45 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
inherit eutils flag-o-matic toolchain-funcs
DESCRIPTION="GNU regular expression matcher"
HOMEPAGE="https://www.gnu.org/software/grep/"
SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
mirror://gentoo/${P}.tar.xz"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="alpha amd64 arm arm64 hppa ia64 m68k ~mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="nls pcre static"
LIB_DEPEND="pcre? ( >=dev-libs/libpcre-7.8-r1[static-libs(+)] )"
RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
nls? ( virtual/libintl )
virtual/libiconv"
DEPEND="${RDEPEND}
virtual/pkgconfig
nls? ( sys-devel/gettext )
static? ( ${LIB_DEPEND} )"
DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
src_prepare() {
sed -i \
-e "s:@SHELL@:${EPREFIX}/bin/sh:g" \
src/egrep.sh || die #523898
}
src_configure() {
use static && append-ldflags -static
# Always use pkg-config to get lib info for pcre.
export ac_cv_search_pcre_compile=$(
usex pcre "$($(tc-getPKG_CONFIG) --libs $(usex static --static '') libpcre)" ''
)
econf \
--bindir="${EPREFIX}"/bin \
$(use_enable nls) \
$(use_enable pcre perl-regexp)
}

View File

@ -1,45 +0,0 @@
# Copyright 1999-2018 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=5
inherit eutils flag-o-matic toolchain-funcs
DESCRIPTION="GNU regular expression matcher"
HOMEPAGE="https://www.gnu.org/software/grep/"
SRC_URI="mirror://gnu/${PN}/${P}.tar.xz
mirror://gentoo/${P}.tar.xz"
LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="nls pcre static"
LIB_DEPEND="pcre? ( >=dev-libs/libpcre-7.8-r1[static-libs(+)] )"
RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
nls? ( virtual/libintl )
virtual/libiconv"
DEPEND="${RDEPEND}
virtual/pkgconfig
nls? ( sys-devel/gettext )
static? ( ${LIB_DEPEND} )"
DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
src_prepare() {
sed -i \
-e "s:@SHELL@:${EPREFIX}/bin/sh:g" \
src/egrep.sh || die #523898
}
src_configure() {
use static && append-ldflags -static
# Always use pkg-config to get lib info for pcre.
export ac_cv_search_pcre_compile=$(
usex pcre "$($(tc-getPKG_CONFIG) --libs $(usex static --static '') libpcre)" ''
)
econf \
--bindir="${EPREFIX}"/bin \
$(use_enable nls) \
$(use_enable pcre perl-regexp)
}

View File

@ -0,0 +1,64 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit flag-o-matic toolchain-funcs
DESCRIPTION="GNU regular expression matcher"
HOMEPAGE="https://www.gnu.org/software/grep/"
SRC_URI="mirror://gnu/${PN}/${P}.tar.xz"
LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
IUSE="nls pcre static"
# We lack dev-libs/libsigsegv[static-libs] for now
REQUIRED_USE="static? ( !sparc )"
LIB_DEPEND="pcre? ( >=dev-libs/libpcre-7.8-r1[static-libs(+)] )
sparc? ( dev-libs/libsigsegv )"
RDEPEND="!static? ( ${LIB_DEPEND//\[static-libs(+)]} )
nls? ( virtual/libintl )
virtual/libiconv"
DEPEND="${RDEPEND}
static? ( ${LIB_DEPEND} )"
BDEPEND="
virtual/pkgconfig
nls? ( sys-devel/gettext )
"
PATCHES=( "${FILESDIR}/ppc-musl.patch" )
DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
src_prepare() {
sed -i \
-e "s:@SHELL@:${EPREFIX}/bin/sh:g" \
-e "s:@grep@:${EPREFIX}/bin/grep:" \
src/egrep.sh || die #523898
default
}
src_configure() {
use static && append-ldflags -static
# We used to turn this off unconditionally (bug #673524) but we now
# allow it for cases where libsigsegv is better for userspace handling
# of stack overflows.
# In particular, it's necessary for sparc: bug #768135
export ac_cv_libsigsegv=$(usex sparc)
# Always use pkg-config to get lib info for pcre.
export ac_cv_search_pcre_compile=$(
usex pcre "$($(tc-getPKG_CONFIG) --libs $(usex static --static '') libpcre)" ''
)
local myeconfargs=(
--bindir="${EPREFIX}"/bin
$(use_enable nls)
$(use_enable pcre perl-regexp)
)
econf "${myeconfargs[@]}"
}

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>base-system@gentoo.org</email>