summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wendler <polynomial-c@gentoo.org>2013-12-13 15:03:21 +0000
committerLars Wendler <polynomial-c@gentoo.org>2013-12-13 15:03:21 +0000
commitf2ddcd96d43a20ca9c2006454aa4b4b7c6e1d4d0 (patch)
treec67456b4088502664aaf1db56e5b5fd9acd0999b /sys-apps/grep
parentversion bump (diff)
downloadgentoo-2-f2ddcd96d43a20ca9c2006454aa4b4b7c6e1d4d0.tar.gz
gentoo-2-f2ddcd96d43a20ca9c2006454aa4b4b7c6e1d4d0.tar.bz2
gentoo-2-f2ddcd96d43a20ca9c2006454aa4b4b7c6e1d4d0.zip
Fixed a regression when doing pcre searches (bug #494148). Fixed another regression with pattern searches
(Portage version: 2.2.7/cvs/Linux x86_64, signed Manifest commit with key 0x981CA6FC)
Diffstat (limited to 'sys-apps/grep')
-rw-r--r--sys-apps/grep/ChangeLog11
-rw-r--r--sys-apps/grep/files/grep-2.15-avoid_maintainer_mode.patch51
-rw-r--r--sys-apps/grep/files/grep-2.15-fix_pattern_matching.patch111
-rw-r--r--sys-apps/grep/files/grep-2.15-fix_pcre_abort_regression.patch115
-rw-r--r--sys-apps/grep/grep-2.15-r1.ebuild42
5 files changed, 329 insertions, 1 deletions
diff --git a/sys-apps/grep/ChangeLog b/sys-apps/grep/ChangeLog
index 6d3aa3eb7539..6c5b66ce08d4 100644
--- a/sys-apps/grep/ChangeLog
+++ b/sys-apps/grep/ChangeLog
@@ -1,6 +1,15 @@
# ChangeLog for sys-apps/grep
# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-apps/grep/ChangeLog,v 1.127 2013/10/27 07:21:05 radhermit Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/grep/ChangeLog,v 1.128 2013/12/13 15:03:21 polynomial-c Exp $
+
+*grep-2.15-r1 (13 Dec 2013)
+
+ 13 Dec 2013; Lars Wendler <polynomial-c@gentoo.org> +grep-2.15-r1.ebuild,
+ +files/grep-2.15-avoid_maintainer_mode.patch,
+ +files/grep-2.15-fix_pattern_matching.patch,
+ +files/grep-2.15-fix_pcre_abort_regression.patch:
+ Fixed a regression when doing pcre searches (bug #494148). Fixed another
+ regression with pattern searches.
*grep-2.15 (27 Oct 2013)
diff --git a/sys-apps/grep/files/grep-2.15-avoid_maintainer_mode.patch b/sys-apps/grep/files/grep-2.15-avoid_maintainer_mode.patch
new file mode 100644
index 000000000000..884983b094ff
--- /dev/null
+++ b/sys-apps/grep/files/grep-2.15-avoid_maintainer_mode.patch
@@ -0,0 +1,51 @@
+Patch to avoid regeneration of Makefile.in because we cannot use autotools in
+@system packages.
+
+Signed-off-by: Lars Wendler <polynomial-c@gentoo.org>
+
+--- grep-2.15/tests/Makefile.in 2013-10-26 18:46:39.000000000 +0200
++++ grep-2.15/tests/Makefile.in 2013-10-26 18:46:39.000000000 +0200
+@@ -1586,6 +1586,7 @@
+ backref \
+ backref-multibyte-slow \
+ backref-word \
++ backslash-s-and-repetition-operators \
+ backslash-s-vs-invalid-multitype \
+ big-hole \
+ big-match \
+@@ -1628,6 +1629,7 @@
+ options \
+ pcre \
+ pcre-abort \
++ pcre-invalid-utf8-input \
+ pcre-utf8 \
+ pcre-z \
+ prefix-of-multibyte \
+@@ -1992,6 +1994,13 @@
+ --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)
++backslash-s-and-repetition-operators.log: backslash-s-and-repetition-operators
++ @p='backslash-s-and-repetition-operators'; \
++ b='backslash-s-and-repetition-operators'; \
++ $(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)
+ backslash-s-vs-invalid-multitype.log: backslash-s-vs-invalid-multitype
+ @p='backslash-s-vs-invalid-multitype'; \
+ b='backslash-s-vs-invalid-multitype'; \
+@@ -2285,6 +2294,13 @@
+ $(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)
++pcre-invalid-utf8-input.log: pcre-invalid-utf8-input
++ @p='pcre-invalid-utf8-input'; \
++ b='pcre-invalid-utf8-input'; \
++ $(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)
+ pcre-utf8.log: pcre-utf8
+ @p='pcre-utf8'; \
diff --git a/sys-apps/grep/files/grep-2.15-fix_pattern_matching.patch b/sys-apps/grep/files/grep-2.15-fix_pattern_matching.patch
new file mode 100644
index 000000000000..5c3dc325a51a
--- /dev/null
+++ b/sys-apps/grep/files/grep-2.15-fix_pattern_matching.patch
@@ -0,0 +1,111 @@
+From 7f96aa773b5967bbb3c8476f8614fd04b3fc1362 Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering@fb.com>
+Date: Fri, 01 Nov 2013 03:20:30 +0000
+Subject: grep: fix regression involving \s and \S
+
+Commit v2.14-40-g01ec90b made \s and \S work with multi-byte
+characters, but it made it so any use like \s*, \s+, \s?, \s{3}
+would malfunction in a multi-byte locale.
+* src/dfa.c (lex): Also reset laststart.
+* tests/backslash-s-and-repetition-operators: New file.
+* tests/Makefile.am (TESTS): Add it.
+* NEWS (Bug fixes): Mention it.
+* THANKS: Update.
+Reported by Mirraz Mirraz in http://bugs.gnu.org/15773.
+---
+diff --git a/NEWS b/NEWS
+index 161be50..078d13b 100644
+--- a/NEWS 2013-10-26 18:51:55.000000000 +0200
++++ b/NEWS 2013-10-26 18:51:55.000000000 +0200
+@@ -9,6 +9,11 @@ GNU grep NEWS -*- outline -*-
+ procedure resulted in a grep-2.15 tarball that would lead to a grep
+ binary whose --version-reported version number was 2.14.51...
+
++ The fix to make \s and \S work with multi-byte white space broke
++ the use of each shortcut whenever followed by a repetition operator.
++ For example, \s*, \s+, \s? and \s{3} would all malfunction in a
++ multi-byte locale. [bug introduced in grep-2.15]
++
+
+ * Noteworthy changes in release 2.15 (2013-10-26) [stable]
+
+diff --git a/THANKS b/THANKS
+index 1a1901c..475c51e 100644
+--- a/THANKS 2013-06-11 15:33:31.000000000 +0200
++++ b/THANKS 2013-06-11 15:33:31.000000000 +0200
+@@ -66,6 +66,7 @@ Martin Rex <martin.rex@sap-ag.de>
+ Michael Aichlmayr <mikla@nx.com>
+ Mike Frysinger <vapier@gentoo.org>
+ Miles Bader <miles@ccs.mt.nec.co.jp>
++Mirraz Mirraz <mirraz1@rambler.ru>
+ Nelson H. F. Beebe <beebe@math.utah.edu>
+ Olaf Kirch <okir@ns.lst.de>
+ Paolo Bonzini <bonzini@gnu.org>
+diff --git a/src/dfa.c b/src/dfa.c
+index de6c671..92c410e 100644
+--- a/src/dfa.c 2013-10-20 19:08:06.000000000 +0200
++++ b/src/dfa.c 2013-10-20 19:08:06.000000000 +0200
+@@ -1473,6 +1473,7 @@ lex (void)
+
+ POP_LEX_STATE ();
+
++ laststart = 0;
+ return lasttok;
+
+ case 'w':
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index a64a2d2..970a9de 100644
+--- a/tests/Makefile.am 2013-10-20 19:08:06.000000000 +0200
++++ b/tests/Makefile.am 2013-10-20 19:08:06.000000000 +0200
+@@ -36,6 +36,7 @@ TESTS = \
+ backref \
+ backref-multibyte-slow \
+ backref-word \
++ backslash-s-and-repetition-operators \
+ backslash-s-vs-invalid-multitype \
+ big-hole \
+ big-match \
+diff --git a/tests/backslash-s-and-repetition-operators b/tests/backslash-s-and-repetition-operators
+new file mode 100755
+index 0000000..3b250d4
+--- a/dev/null
++++ b/tests/backslash-s-and-repetition-operators
+@@ -0,0 +1,36 @@
++#! /bin/sh
++# Ensure that \s and \S work with repetition operators.
++#
++# Copyright (C) 2013 Free Software Foundation, Inc.
++#
++# Copying and distribution of this file, with or without modification,
++# are permitted in any medium without royalty provided the copyright
++# notice and this notice are preserved.
++
++. "${srcdir=.}/init.sh"; path_prepend_ ../src
++
++require_en_utf8_locale_
++
++fail=0
++
++for loc in en_US.UTF-8 C; do
++ echo locale=$loc
++ LC_ALL=$loc
++ export LC_ALL
++
++ printf ' \n' > in || framework_failure_
++
++ for re in '\s\+' '\s*' '\s\?' '\s\{1\}'; do
++ grep "^$re\$" in > out || fail=1
++ compare in out || fail=1
++ done
++
++ printf 'X\n' > in || framework_failure_
++
++ for re in '\S\+' '\S*' '\S\?' '\S\{1\}'; do
++ grep "^$re\$" in > out || fail=1
++ compare in out || fail=1
++ done
++done
++
++Exit $fail
+--
+cgit v0.9.0.2
diff --git a/sys-apps/grep/files/grep-2.15-fix_pcre_abort_regression.patch b/sys-apps/grep/files/grep-2.15-fix_pcre_abort_regression.patch
new file mode 100644
index 000000000000..f2bc4afd3486
--- /dev/null
+++ b/sys-apps/grep/files/grep-2.15-fix_pcre_abort_regression.patch
@@ -0,0 +1,115 @@
+From 9a9b4c59babc60e15a79cf7db8167d42e68e44b9 Mon Sep 17 00:00:00 2001
+From: Jim Meyering <meyering@fb.com>
+Date: Sat, 02 Nov 2013 19:15:48 +0000
+Subject: grep: fix regression with -P vs. invalid UTF-8 input
+
+* src/pcresearch.c (Pexecute): Don't abort upon unexpected
+PCRE-specific error code. Explicitly handle PCRE_ERROR_BADUTF8,
+and change the default to print a diagnostic including the unhandled
+integer PCRE error code and exit with status 2.
+* tests/pcre-invalid-utf8-input: New file.
+* tests/Makefile.am (TESTS): Add it.
+* NEWS (Bug fixes): Mention it.
+* THANKS: Update.
+Reported by Dave Reisner in http://bugs.gnu.org/15758.
+---
+diff --git a/NEWS b/NEWS
+index 078d13b..e974f29 100644
+--- a/NEWS 2013-10-26 18:51:55.000000000 +0200
++++ b/NEWS 2013-10-26 18:51:55.000000000 +0200
+@@ -14,6 +14,12 @@ GNU grep NEWS -*- outline -*-
+ For example, \s*, \s+, \s? and \s{3} would all malfunction in a
+ multi-byte locale. [bug introduced in grep-2.15]
+
++ The fix to make grep -P work better with UTF-8 made it possible for
++ grep to evoke a larger set of PCRE errors, some of which could trigger
++ an abort. E.g., this would abort:
++ printf '\x82'|LC_ALL=en_US.UTF-8 grep -P y
++ Now grep handles arbitrary PCRE errors. [bug introduced in grep-2.15]
++
+
+ * Noteworthy changes in release 2.15 (2013-10-26) [stable]
+
+diff --git a/THANKS b/THANKS
+index 475c51e..02ef246 100644
+--- a/THANKS 2013-06-11 15:33:31.000000000 +0200
++++ b/THANKS 2013-06-11 15:33:31.000000000 +0200
+@@ -20,6 +20,7 @@ Christian Groessler <cpg@aladdin.de>
+ Corinna Vinschen <vinschen@redhat.com>
+ Dagobert Michelsen <dam@opencsw.org>
+ Daisuke GOTO <gotoh@m-design.com>
++Dave Reisner <d@falconindy.com>
+ David Clissold <cliss@austin.ibm.com>
+ David J MacKenzie <djm@catapult.va.pubnix.com>
+ David O'Brien <obrien@freebsd.org>
+diff --git a/src/pcresearch.c b/src/pcresearch.c
+index ad5999d..9ba1227 100644
+--- a/src/pcresearch.c 2013-06-11 15:33:31.000000000 +0200
++++ b/src/pcresearch.c 2013-06-11 15:33:31.000000000 +0200
+@@ -185,9 +185,20 @@ Pexecute (char const *buf, size_t size, size_t *match_size,
+ error (EXIT_TROUBLE, 0,
+ _("exceeded PCRE's backtracking limit"));
+
++ case PCRE_ERROR_BADUTF8:
++ error (EXIT_TROUBLE, 0,
++ _("invalid UTF-8 byte sequence in input"));
++
+ default:
+- abort ();
++ /* For now, we lump all remaining PCRE failures into this basket.
++ If anyone cares to provide sample grep usage that can trigger
++ particular PCRE errors, we can add to the list (above) of more
++ detailed diagnostics. */
++ error (EXIT_TROUBLE, 0, _("internal PCRE error: %d"), e);
+ }
++
++ /* NOTREACHED */
++ return -1;
+ }
+ else
+ {
+diff --git a/tests/Makefile.am b/tests/Makefile.am
+index 970a9de..76b8c52 100644
+--- a/tests/Makefile.am 2013-10-20 19:08:06.000000000 +0200
++++ b/tests/Makefile.am 2013-10-20 19:08:06.000000000 +0200
+@@ -79,6 +79,7 @@ TESTS = \
+ options \
+ pcre \
+ pcre-abort \
++ pcre-invalid-utf8-input \
+ pcre-utf8 \
+ pcre-z \
+ prefix-of-multibyte \
+diff --git a/tests/pcre-invalid-utf8-input b/tests/pcre-invalid-utf8-input
+new file mode 100755
+index 0000000..52a5432
+--- a/dev/null
++++ b/tests/pcre-invalid-utf8-input
+@@ -0,0 +1,25 @@
++#! /bin/sh
++# Ensure that grep -P doesn't abort for invalid multi-byte input
++#
++# Copyright (C) 2013 Free Software Foundation, Inc.
++#
++# Copying and distribution of this file, with or without modification,
++# are permitted in any medium without royalty provided the copyright
++# notice and this notice are preserved.
++
++. "${srcdir=.}/init.sh"; path_prepend_ ../src
++require_pcre_
++require_en_utf8_locale_
++
++fail=0
++
++printf '\202\n' > in || framework_failure_
++printf 'grep: invalid UTF-8 byte sequence in input\n' \
++ > exp-err || framework_failure_
++
++LC_ALL=en_US.UTF-8 grep -P anything in > out 2> err
++test $? = 2 || fail=1
++compare /dev/null out || fail=1
++compare exp-err err || fail=1
++
++Exit $fail
+--
+cgit v0.9.0.2
diff --git a/sys-apps/grep/grep-2.15-r1.ebuild b/sys-apps/grep/grep-2.15-r1.ebuild
new file mode 100644
index 000000000000..a8668da71842
--- /dev/null
+++ b/sys-apps/grep/grep-2.15-r1.ebuild
@@ -0,0 +1,42 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-apps/grep/grep-2.15-r1.ebuild,v 1.1 2013/12/13 15:03:21 polynomial-c Exp $
+
+EAPI="4"
+
+inherit eutils
+
+DESCRIPTION="GNU regular expression matcher"
+HOMEPAGE="http://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 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="nls pcre"
+
+RDEPEND="nls? ( virtual/libintl )
+ pcre? ( >=dev-libs/libpcre-7.8-r1 )
+ virtual/libiconv"
+DEPEND="${RDEPEND}
+ nls? ( sys-devel/gettext )"
+
+DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO )
+
+src_prepare() {
+ EPATCH_OPTS="-Z" \
+ epatch "${FILESDIR}/${P}-fix_pattern_matching.patch" \
+ "${FILESDIR}/${P}-fix_pcre_abort_regression.patch" \
+ "${FILESDIR}/${P}-avoid_maintainer_mode.patch"
+
+ chmod a+x "${S}"/tests/{backslash-s-and-repetition-operators,pcre-invalid-utf8-input} \
+ || die
+}
+
+src_configure() {
+ econf \
+ --bindir="${EPREFIX}"/bin \
+ $(use_enable nls) \
+ $(use_enable pcre perl-regexp)
+}