From 47b853689640af20c6bd7113870a2926e44a01b7afd8b5625eeed58936fabc8a Mon Sep 17 00:00:00 2001 From: OBS User unknown Date: Thu, 17 May 2007 09:38:38 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/grep?expand=0&rev=4 --- grep.changes | 5 ++++ grep.spec | 6 +++- icase.diff | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 icase.diff diff --git a/grep.changes b/grep.changes index ad5a5ee..7cc6bb3 100644 --- a/grep.changes +++ b/grep.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Tue May 15 15:00:53 CEST 2007 - schwab@suse.de + +- Fix some icase bugs. + ------------------------------------------------------------------- Mon May 7 15:41:23 CEST 2007 - schwab@suse.de diff --git a/grep.spec b/grep.spec index 6a50bff..3f3414e 100644 --- a/grep.spec +++ b/grep.spec @@ -19,7 +19,7 @@ Provides: base:/usr/bin/grep Autoreqprov: on PreReq: %{install_info_prereq} Version: 2.5.2 -Release: 1 +Release: 3 Summary: Print lines matching a pattern Source: grep-%{version}.tar.bz2 Patch: grep-%{version}.diff @@ -29,6 +29,7 @@ Patch3: grep-2.5.2-nb.patch Patch4: wordmatch.patch Patch5: grep-2.5.1a-mbcset.diff Patch6: xfail-tests.diff +Patch7: icase.diff BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -55,6 +56,7 @@ Authors: %patch4 %patch5 %patch6 +%patch7 %build %{suse_update_config -f} @@ -96,6 +98,8 @@ ln -sf ../../bin/grep $RPM_BUILD_ROOT/usr/bin/grep /usr/share/locale/*/LC_MESSAGES/grep.mo %changelog +* Tue May 15 2007 - schwab@suse.de +- Fix some icase bugs. * Mon May 07 2007 - schwab@suse.de - Try to get something sensible out of CVS. * Thu Mar 22 2007 - schwab@suse.de diff --git a/icase.diff b/icase.diff new file mode 100644 index 0000000..8f5c9ae --- /dev/null +++ b/icase.diff @@ -0,0 +1,79 @@ +--- src/grep.c.~1.121.~ 2006-08-25 17:43:30.000000000 +0200 ++++ src/grep.c 2007-05-15 14:13:24.000000000 +0200 +@@ -789,28 +789,10 @@ print_line_middle (const char *beg, cons + size_t match_offset; + const char *cur = beg; + const char *mid = NULL; +- char *buf; /* XXX */ +- const char *ibeg; /* XXX */ +- +- if (match_icase) /* XXX - None of the -i stuff should be here. */ +- { +- int i = lim - beg; +- +- ibeg = buf = (char *) xmalloc(i); +- /* This can't possibly be correct with UTF-8, +- but it's equivalent to what was there so far. */ +- while (--i >= 0) +- buf[i] = tolower(beg[i]); +- } +- else +- { +- buf = NULL; +- ibeg = beg; +- } + + while ( lim > cur +- && ((match_offset = execute(ibeg, lim - beg, &match_size, +- ibeg + (cur - beg))) != (size_t) -1)) ++ && ((match_offset = execute(beg, lim - beg, &match_size, ++ beg + (cur - beg))) != (size_t) -1)) + { + char const *b = beg + match_offset; + +@@ -854,9 +836,6 @@ print_line_middle (const char *beg, cons + cur = b + match_size; + } + +- if (buf) +- free(buf); /* XXX */ +- + if (only_matching) + cur = lim; + else if (mid) +--- src/search.c.~1.40.~ 2005-12-12 16:26:59.000000000 +0100 ++++ src/search.c 2007-05-15 14:49:38.000000000 +0200 +@@ -192,11 +192,18 @@ GEAcompile (char const *pattern, size_t + const char *sep; + size_t total = size; + char const *motif = pattern; ++ static char translate[NCHAR]; + +-#if 0 +- if (match_icase) +- syntax_bits |= RE_ICASE; ++ if (match_icase ++#ifdef MBS_SUPPORT ++ && MB_CUR_MAX == 1) + #endif ++ { ++ int i; ++ for (i = 0; i < NCHAR; i++) ++ translate[i] = ISUPPER (i) ? TOLOWER (i) : i; ++ } ++ + re_set_syntax (syntax_bits); + dfasyntax (syntax_bits, match_icase, eolbyte); + +@@ -224,6 +231,11 @@ GEAcompile (char const *pattern, size_t + if (patterns == NULL) + error (2, errno, _("memory exhausted")); + patterns[pcount] = patterns0; ++ if (match_icase ++#ifdef MBS_SUPPORT ++ && MB_CUR_MAX == 1) ++#endif ++ patterns[pcount].regexbuf.translate = translate; + + if ((err = re_compile_pattern (motif, len, + &(patterns[pcount].regexbuf))) != 0)