diff options
author | Lars Wendler <polynomial-c@gentoo.org> | 2017-02-08 22:36:09 +0100 |
---|---|---|
committer | Lars Wendler <polynomial-c@gentoo.org> | 2017-02-08 22:37:37 +0100 |
commit | aa2f866c5f633501863c0fb48ea7d368761596d2 (patch) | |
tree | 12e32af9c08cdffe365feb313b95c7078a6f7cc4 /sys-apps | |
parent | net-analyzer/fe3d: Drop netmon maintainership. (diff) | |
download | gentoo-aa2f866c5f633501863c0fb48ea7d368761596d2.tar.gz gentoo-aa2f866c5f633501863c0fb48ea7d368761596d2.tar.bz2 gentoo-aa2f866c5f633501863c0fb48ea7d368761596d2.zip |
sys-apps/grep: Revbump to fix multiple pattern issue (bug #608644).
Removed old.
Package-Manager: Portage-2.3.3, Repoman-2.3.1
Diffstat (limited to 'sys-apps')
-rw-r--r-- | sys-apps/grep/files/grep-2.28-multiple_pattern_fix.patch | 97 | ||||
-rw-r--r-- | sys-apps/grep/grep-2.28-r1.ebuild (renamed from sys-apps/grep/grep-2.28.ebuild) | 5 |
2 files changed, 102 insertions, 0 deletions
diff --git a/sys-apps/grep/files/grep-2.28-multiple_pattern_fix.patch b/sys-apps/grep/files/grep-2.28-multiple_pattern_fix.patch new file mode 100644 index 000000000000..f6cf64d3831f --- /dev/null +++ b/sys-apps/grep/files/grep-2.28-multiple_pattern_fix.patch @@ -0,0 +1,97 @@ +From 6e4c8728f0e75af57f839625d0bd51b0a02d091e Mon Sep 17 00:00:00 2001 +From: Paul Eggert <eggert@cs.ucla.edu> +Date: Wed, 8 Feb 2017 13:00:11 -0800 +Subject: grep: do not mishandle \. in multiple patterns + +Problem reported by Lars Wendler (Bug#25655). +* NEWS: Document this. +* src/grep.c (try_fgrep_pattern): Fix typo that prevented +keys from being properly updated. +* tests/foad1: Test for the bug. +--- + src/grep.c | 15 ++++++++------- + tests/foad1 | 7 +++++++ + 3 files changed, 20 insertions(+), 7 deletions(-) + +diff --git a/src/grep.c b/src/grep.c +index 81654c3..74acb0b 100644 +--- a/src/grep.c ++++ b/src/grep.c +@@ -2361,11 +2361,12 @@ try_fgrep_pattern (int matcher, char *keys, size_t *len_p) + size_t len = *len_p; + char *new_keys = xmalloc (len + 1); + char *p = new_keys; ++ char const *q = keys; + mbstate_t mb_state = { 0 }; + + while (len != 0) + { +- switch (*keys) ++ switch (*q) + { + case '$': case '*': case '.': case '[': case '^': + goto fail; +@@ -2377,7 +2378,7 @@ try_fgrep_pattern (int matcher, char *keys, size_t *len_p) + + case '\\': + if (1 < len) +- switch (keys[1]) ++ switch (q[1]) + { + case '\n': + case 'B': case 'S': case 'W': case'\'': case '<': +@@ -2391,7 +2392,7 @@ try_fgrep_pattern (int matcher, char *keys, size_t *len_p) + goto fail; + /* Fall through. */ + default: +- keys++, len--; ++ q++, len--; + break; + } + break; +@@ -2401,20 +2402,20 @@ try_fgrep_pattern (int matcher, char *keys, size_t *len_p) + size_t n; + if (match_icase) + { +- int ni = fgrep_icase_charlen (keys, len, &mb_state); ++ int ni = fgrep_icase_charlen (q, len, &mb_state); + if (ni < 0) + goto fail; + n = ni; + } + else + { +- n = mb_clen (keys, len, &mb_state); ++ n = mb_clen (q, len, &mb_state); + if (MB_LEN_MAX < n) + goto fail; + } + +- p = mempcpy (p, keys, n); +- keys += n; ++ p = mempcpy (p, q, n); ++ q += n; + len -= n; + } + } +diff --git a/tests/foad1 b/tests/foad1 +index 286c449..0163f1a 100755 +--- a/tests/foad1 ++++ b/tests/foad1 +@@ -137,6 +137,13 @@ grep_test "$x2" "$y2" -F -w --color=always bc + grep_test "$x3" "$y3" -E -w --color=always bc + grep_test "$x3" "$y3" -F -w --color=always bc + ++# Bug#25655 ++grep_test .tar/ .tar/ -e '\.tar' -e '\.tbz' ++grep_test .tar/ .tar/ -o -e '\.tar' -e 'tar' ++grep_test '$*.[^\/' '$*.[^\/' -o -e '\$\*\.\[\^\\' -e abc ++grep_test '$*.[^\/(+?{|/' '$*.[^\/(+?{|/' -o -E \ ++ -e '\$\*\.\[\^\\' -e '\(\+\?\{\|' ++ + # Skip the rest of the tests - known to fail. TAA. + Exit $failures + +-- +cgit v1.0-41-gc330 + diff --git a/sys-apps/grep/grep-2.28.ebuild b/sys-apps/grep/grep-2.28-r1.ebuild index f2035a7b7ae3..dc112782f9d2 100644 --- a/sys-apps/grep/grep-2.28.ebuild +++ b/sys-apps/grep/grep-2.28-r1.ebuild @@ -27,7 +27,12 @@ DEPEND="${RDEPEND} DOCS=( AUTHORS ChangeLog NEWS README THANKS TODO ) +PATCHES=( + "${FILESDIR}"/${P}-multiple_pattern_fix.patch +) + src_prepare() { + epatch "${PATCHES[@]}" sed -i \ -e "s:@SHELL@:${EPREFIX}/bin/sh:g" \ src/egrep.sh || die #523898 |