commit: bad1434434e66744b2c660546374f8574ed9d8a0 Author: Sam James <sam <AT> gentoo <DOT> org> AuthorDate: Sun Apr 28 23:04:03 2024 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sun Apr 28 23:05:49 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bad14344
sys-apps/grep: fix operation on large directories While I did backport the test itself, it's not run by default as it's marked as expensive. We may want to run those in future though. Closes: https://bugs.gentoo.org/930825 Signed-off-by: Sam James <sam <AT> gentoo.org> sys-apps/grep/files/grep-3.11-100k-files-dir.patch | 143 +++++++++++++++++++++ sys-apps/grep/grep-3.11-r1.ebuild | 122 ++++++++++++++++++ 2 files changed, 265 insertions(+) diff --git a/sys-apps/grep/files/grep-3.11-100k-files-dir.patch b/sys-apps/grep/files/grep-3.11-100k-files-dir.patch new file mode 100644 index 000000000000..2862fef02efd --- /dev/null +++ b/sys-apps/grep/files/grep-3.11-100k-files-dir.patch @@ -0,0 +1,143 @@ +https://bugs.gentoo.org/930825 +https://debbugs.gnu.org/64773 +https://bugs.debian.org/1041588 +https://bugs.debian.org/1041588#105 + +We backport the following: +* the fix (https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=d4d8abb39eb02c555f062b1f83ffcfac999c582f) +* a test (https://git.savannah.gnu.org/cgit/grep.git/commit/?id=d1c3fbe7722662b449bae23130b644c726473fe3) +* a fixup commit for the test (https://git.savannah.gnu.org/cgit/grep.git/commit/?id=180e8dd674ede48727c03647dd36c1f8c3379667) + +From d4d8abb39eb02c555f062b1f83ffcfac999c582f Mon Sep 17 00:00:00 2001 +From: Bruno Haible <br...@clisp.org> +Date: Fri, 5 May 2023 12:02:49 +0200 +Subject: [PATCH] dirfd: Fix bogus override (regression 2023-04-26). + +Reported by Bjarni Ingi Gislason <bjarn...@simnet.is> in +<https://lists.gnu.org/archive/html/bug-gnulib/2023-05/msg00040.html>. + +* m4/dirfd.m4 (gl_FUNC_DIRFD): Fix mistake in last change. +--- a/m4/dirfd.m4 ++++ b/m4/dirfd.m4 +@@ -1,4 +1,4 @@ +-# serial 27 -*- Autoconf -*- ++# serial 28 -*- Autoconf -*- + + dnl Find out how to get the file descriptor associated with an open DIR*. + +@@ -40,10 +40,6 @@ AC_DEFUN([gl_FUNC_DIRFD], + HAVE_DIRFD=0 + else + HAVE_DIRFD=1 +- dnl Replace only if the system declares dirfd already. +- if test $ac_cv_have_decl_dirfd = yes; then +- REPLACE_DIRFD=1 +- fi + dnl Replace dirfd() on native Windows, to support fdopendir(). + AC_REQUIRE([gl_DIRENT_DIR]) + if test $DIR_HAS_FD_MEMBER = 0; then +--- a/configure ++++ b/configure +@@ -31438,9 +31438,6 @@ printf "%s\n" "$gl_cv_func_dirfd_macro" >&6; } + HAVE_DIRFD=0 + else + HAVE_DIRFD=1 +- if test $ac_cv_have_decl_dirfd = yes; then +- REPLACE_DIRFD=1 +- fi + + if test $DIR_HAS_FD_MEMBER = 0; then + REPLACE_DIRFD=1 +From d1c3fbe7722662b449bae23130b644c726473fe3 Mon Sep 17 00:00:00 2001 +From: Jim Meyering <meyer...@meta.com> +Date: Fri, 21 Jul 2023 17:42:23 -0700 +Subject: doc: mention the 100,000-entry ENOTSUP bug +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +* NEWS: document the fixed bug. +* tests/100k-entries: New file, to test for this. +Reported by Vincent Lefevre via Santiago Ruano Rincón in +https://bugs.gnu.org/64773 +Fixed by gnulib commit v0.1-6175-gd4d8abb39e. +--- + tests/100k-entries | 15 +++++++++++++++ + 2 files changed, 24 insertions(+) + create mode 100755 tests/100k-entries + +diff --git a/tests/100k-entries b/tests/100k-entries +new file mode 100755 +index 0000000..382ab3c +--- /dev/null ++++ b/tests/100k-entries +@@ -0,0 +1,15 @@ ++#!/bin/sh ++# This would make grep-3.11 fail with ENOTSUP and exit 2. ++. "${srcdir=.}/init.sh"; path_prepend_ ../src ++expensive_ ++ ++fail=0 ++ ++mkdir t || framework_failure_ ++(cd t && seq 100000|xargs touch) || framework_failure_ ++ ++returns_ 1 grep -r x t > out 2> err ++compare /dev/null out || fail=1 ++compare /dev/null err || fail=1 ++ ++Exit $fail +-- +cgit v1.1 + +From 180e8dd674ede48727c03647dd36c1f8c3379667 Mon Sep 17 00:00:00 2001 +From: Jim Meyering <meyer...@meta.com> +Date: Sun, 20 Aug 2023 12:42:14 -0700 +Subject: tests: actually package and run the new 100k-entries test + +* tests/Makefile.am (TESTS): Include the new test file name, +100k-entries. +--- + tests/Makefile.am | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index d566445..94430a9 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -71,6 +71,7 @@ else + endif + + TESTS = \ ++ 100k-entries \ + backref \ + backref-alt \ + backref-multibyte-slow \ +-- +cgit v1.1 +diff --git a/tests/Makefile.in b/tests/Makefile.in +index 8ae7bb4..0007f8d 100644 +--- a/tests/Makefile.in ++++ b/tests/Makefile.in +@@ -1953,6 +1953,7 @@ XFAIL_TESTS = triple-backref glibc-infloop $(am__append_1) + # If you're using older glibc you can upgrade to glibc 2.28 or later, + # configure --with-included-regex, or ignore the test failure. + TESTS = \ ++ 100k-entries \ + backref \ + backref-alt \ + backref-multibyte-slow \ +@@ -2430,6 +2431,13 @@ recheck: all $(check_PROGRAMS) + am__force_recheck=am--force-recheck \ + TEST_LOGS="$$log_list"; \ + exit $$? ++100k-entries.log: 100k-entries ++ @p='100k-entries'; \ ++ b='100k-entries'; \ ++ $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ ++ --log-file $$b.log --trs-file $$b.trs \ ++ $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ ++ "$$tst" $(AM_TESTS_FD_REDIRECT) + backref.log: backref + @p='backref'; \ + b='backref'; \ diff --git a/sys-apps/grep/grep-3.11-r1.ebuild b/sys-apps/grep/grep-3.11-r1.ebuild new file mode 100644 index 000000000000..4341f860771e --- /dev/null +++ b/sys-apps/grep/grep-3.11-r1.ebuild @@ -0,0 +1,122 @@ +# Copyright 1999-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/grep.asc +inherit flag-o-matic verify-sig + +DESCRIPTION="GNU regular expression matcher" +HOMEPAGE="https://www.gnu.org/software/grep/" + +if [[ ${PV} == *_p* ]] ; then + # Subscribe to the 'platform-testers' ML to find these. + # Useful to test on our especially more niche arches and report issues upstream. + MY_COMMIT="19-2ea9" + MY_P=${PN}-$(ver_cut 1-2).${MY_COMMIT} + SRC_URI="https://meyering.net/${PN}/${MY_P}.tar.xz" + SRC_URI+=" verify-sig? ( https://meyering.net/${PN}/${MY_P}.tar.xz.sig )" + S="${WORKDIR}"/${MY_P} +else + SRC_URI="mirror://gnu/${PN}/${P}.tar.xz" + SRC_URI+=" verify-sig? ( mirror://gnu/${PN}/${P}.tar.xz.sig )" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" +fi + +LICENSE="GPL-3+" +SLOT="0" +IUSE="+egrep-fgrep nls pcre static" + +# We lack dev-libs/libsigsegv[static-libs] for now +REQUIRED_USE="static? ( !sparc )" + +LIB_DEPEND=" + pcre? ( >=dev-libs/libpcre2-10.42-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 ) + verify-sig? ( sec-keys/openpgp-keys-grep ) +" + +DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO ) + +QA_CONFIG_IMPL_DECL_SKIP=( + # Either gnulib FPs or fixed in newer autoconf, not worth autoreconf here for now? + MIN + alignof + static_assert +) + +PATCHES=( + "${FILESDIR}"/${P}-100k-files-dir.patch +) + +src_prepare() { + default + + # bug #523898 + sed -i \ + -e "s:@SHELL@:${EPREFIX}/bin/sh:g" \ + -e "s:@grep@:${EPREFIX}/bin/grep:" \ + src/egrep.sh || die + + # Drop when grep-3.11-100k-files-dir.patch is gone + touch aclocal.m4 config.hin configure {,doc/,gnulib-tests/,lib/,src/,tests/}Makefile.in || die +} + +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) + + local myeconfargs=( + --bindir="${EPREFIX}"/bin + $(use_enable nls) + $(use_enable pcre perl-regexp) + ) + + econf "${myeconfargs[@]}" +} + +src_install() { + default + + if use egrep-fgrep ; then + # Delete the upstream wrapper variants which warn on egrep+fgrep use + rm "${ED}"/bin/{egrep,fgrep} || die + + into / + # Install egrep, fgrep which don't warn. + # + # We do this by default to avoid breakage in old scripts + # and such which don't expect unexpected output on stderr, + # we've had examples of builds failing because foo-config + # starts returning a warning. + # + # https://lists.gnu.org/archive/html/bug-grep/2022-10/msg00000.html + newbin - egrep <<-EOF + #!/usr/bin/env sh + exec "${EPREFIX}/bin/grep" -E "\$@" + EOF + + newbin - fgrep <<-EOF + #!/usr/bin/env sh + exec "${EPREFIX}/bin/grep" -F "\$@" + EOF + fi +}