- Added w patch to fix -w switch behaviour broken by dfa-optional patch
This commit is contained in:
parent
d612644be3
commit
573565948a
117
grep-2.5.4-w.patch
Normal file
117
grep-2.5.4-w.patch
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
--- a/src/search.c 2007-10-01 14:47:55.000000000 +0200
|
||||||
|
+++ b/src/search.c 2007-09-30 23:38:45.000000000 +0200
|
||||||
|
@@ -282,6 +282,7 @@
|
||||||
|
static int use_dfa_checked = 0;
|
||||||
|
size_t i, ret_val;
|
||||||
|
#ifdef MBS_SUPPORT
|
||||||
|
+ const char *last_char = NULL;
|
||||||
|
int mb_cur_max = MB_CUR_MAX;
|
||||||
|
mbstate_t mbs;
|
||||||
|
memset (&mbs, '\0', sizeof (mbstate_t));
|
||||||
|
@@ -338,6 +341,8 @@
|
||||||
|
while (bytes_left)
|
||||||
|
{
|
||||||
|
size_t mlen = mbrlen (beg, bytes_left, &mbs);
|
||||||
|
+
|
||||||
|
+ last_char = beg;
|
||||||
|
if (mlen == (size_t) -1 || mlen == 0)
|
||||||
|
{
|
||||||
|
/* Incomplete character: treat as single-byte. */
|
||||||
|
@@ -398,6 +403,8 @@
|
||||||
|
while (bytes_left)
|
||||||
|
{
|
||||||
|
size_t mlen = mbrlen (beg, bytes_left, &mbs);
|
||||||
|
+
|
||||||
|
+ last_char = beg;
|
||||||
|
if (mlen == (size_t) -1 || mlen == 0)
|
||||||
|
{
|
||||||
|
/* Incomplete character: treat as single-byte. */
|
||||||
|
@@ -475,10 +483,84 @@
|
||||||
|
if (match_words)
|
||||||
|
while (match <= best_match)
|
||||||
|
{
|
||||||
|
+ int lword_match = 0;
|
||||||
|
+ if (match == buf)
|
||||||
|
+ lword_match = 1;
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ assert (start > 0);
|
||||||
|
+#ifdef MBS_SUPPORT
|
||||||
|
+ if (mb_cur_max > 1)
|
||||||
|
+ {
|
||||||
|
+ const char *s;
|
||||||
|
+ int mr;
|
||||||
|
+ wchar_t pwc;
|
||||||
|
+ if (using_utf8)
|
||||||
|
+ {
|
||||||
|
+ s = match - 1;
|
||||||
|
+ while (s > buf
|
||||||
|
+ && (unsigned char) *s >= 0x80
|
||||||
|
+ && (unsigned char) *s <= 0xbf)
|
||||||
|
+ --s;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ s = last_char;
|
||||||
|
+ mr = mbtowc (&pwc, s, match - s);
|
||||||
|
+ if (mr <= 0)
|
||||||
|
+ {
|
||||||
|
+ memset (&mbs, '\0', sizeof (mbstate_t));
|
||||||
|
+ lword_match = 1;
|
||||||
|
+ }
|
||||||
|
+ else if (!(iswalnum (pwc) || pwc == L'_')
|
||||||
|
+ && mr == (int) (match - s))
|
||||||
|
+ lword_match = 1;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+#endif /* MBS_SUPPORT */
|
||||||
|
+ if (!WCHAR ((unsigned char) match[-1]))
|
||||||
|
+ lword_match = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (lword_match)
|
||||||
|
+ {
|
||||||
|
+ int rword_match = 0;
|
||||||
|
+ if (start + len == end - beg - 1)
|
||||||
|
+ rword_match = 1;
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+#ifdef MBS_SUPPORT
|
||||||
|
+ if (mb_cur_max > 1)
|
||||||
|
+ {
|
||||||
|
+ wchar_t nwc;
|
||||||
|
+ int mr;
|
||||||
|
+
|
||||||
|
+ mr = mbtowc (&nwc, buf + start + len,
|
||||||
|
+ end - buf - start - len - 1);
|
||||||
|
+ if (mr <= 0)
|
||||||
|
+ {
|
||||||
|
+ memset (&mbs, '\0', sizeof (mbstate_t));
|
||||||
|
+ rword_match = 1;
|
||||||
|
+ }
|
||||||
|
+ else if (!iswalnum (nwc) && nwc != L'_')
|
||||||
|
+ rword_match = 1;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+#endif /* MBS_SUPPORT */
|
||||||
|
+ if (!WCHAR ((unsigned char) match[len]))
|
||||||
|
+ rword_match = 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (rword_match)
|
||||||
|
+ {
|
||||||
|
+ if (!start_ptr)
|
||||||
|
+ /* Returns the whole line. */
|
||||||
|
+ goto success;
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ goto assess_pattern_match;
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
- if ((match == buf || !WCHAR ((unsigned char) match[-1]))
|
||||||
|
- && (len == end - beg - 1
|
||||||
|
- || !WCHAR ((unsigned char) match[len])))
|
||||||
|
- goto assess_pattern_match;
|
||||||
|
if (len > 0)
|
||||||
|
{
|
||||||
|
/* Try a shorter length anchored at the same place. */
|
@ -3,7 +3,7 @@
|
|||||||
Summary: Pattern matching utilities
|
Summary: Pattern matching utilities
|
||||||
Name: grep
|
Name: grep
|
||||||
Version: 2.5.4
|
Version: 2.5.4
|
||||||
Release: 1%{?dist}
|
Release: 2%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Group: Applications/Text
|
Group: Applications/Text
|
||||||
Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.bz2
|
Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.bz2
|
||||||
@ -15,6 +15,8 @@ Patch4: grep-2.5.3-egf-speedup.patch
|
|||||||
Patch40: grep-bz460641.patch
|
Patch40: grep-bz460641.patch
|
||||||
Patch5: grep-2.5.4-utf8.patch
|
Patch5: grep-2.5.4-utf8.patch
|
||||||
Patch6: grep-2.5.4-dfa-optional.patch
|
Patch6: grep-2.5.4-dfa-optional.patch
|
||||||
|
# fix -w switch behaviour broken by dfa-optional.patch
|
||||||
|
Patch13: grep-2.5.4-w.patch
|
||||||
URL: http://www.gnu.org/software/grep/
|
URL: http://www.gnu.org/software/grep/
|
||||||
Requires(post): /sbin/install-info
|
Requires(post): /sbin/install-info
|
||||||
Requires(preun): /sbin/install-info
|
Requires(preun): /sbin/install-info
|
||||||
@ -38,6 +40,7 @@ GNU grep is needed by many scripts, so it shall be installed on every system.
|
|||||||
%patch40 -p1 -b .bz460641
|
%patch40 -p1 -b .bz460641
|
||||||
%patch5 -p1 -b .utf8
|
%patch5 -p1 -b .utf8
|
||||||
%patch6 -p1 -b .dfa-optional
|
%patch6 -p1 -b .dfa-optional
|
||||||
|
%patch13 -p1 -b .w
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --without-included-regex CPPFLAGS="-I%{_includedir}/pcre"
|
%configure --without-included-regex CPPFLAGS="-I%{_includedir}/pcre"
|
||||||
@ -77,6 +80,9 @@ fi
|
|||||||
%{_mandir}/*/*
|
%{_mandir}/*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Mar 05 2010 Jaroslav Škarvada <jskarvad@redhat.com> - 2.5.4-2
|
||||||
|
- Added w patch to fix -w switch behaviour broken by dfa-optional patch
|
||||||
|
|
||||||
* Wed Feb 10 2010 Jaroslav Škarvada <jskarvad@redhat.com> - 2.5.4-1
|
* Wed Feb 10 2010 Jaroslav Škarvada <jskarvad@redhat.com> - 2.5.4-1
|
||||||
- New version: grep-2.5.4 (#502931)
|
- New version: grep-2.5.4 (#502931)
|
||||||
- Fixed typos in %description
|
- Fixed typos in %description
|
||||||
|
Loading…
Reference in New Issue
Block a user