[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Bug in grep-2.5.1 patch added. Revoke first patch.
From: |
Thomas Steudten |
Subject: |
Bug in grep-2.5.1 patch added. Revoke first patch. |
Date: |
Thu, 11 Mar 2004 20:13:08 +0100 |
Sorry patch in mail from march 10, is obsolete. Please
use this one.
Hello
Problem see: https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=72641
Test with: echo "one tEst here" | grep -X -i --color=auto TEST and with
-o, fails with X:none,G,E and runs fine with X:F,P.
PATCH:
See https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=72641 (sent upstream)
--- grep-2.5.1/src/search.c.oi 2004-03-11 19:32:55.000000000 +0100
+++ grep-2.5.1/src/search.c 2004-03-11 19:50:09.000000000 +0100
@@ -187,8 +187,10 @@
{
const char *err;
char const *sep;
+ char *trans;
size_t total = size;
char const *motif = pattern;
+ int i;
re_set_syntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE);
dfasyntax (RE_SYNTAX_GREP | RE_HAT_LISTS_NOT_NEWLINE, match_icase,
eolbyte);
@@ -197,6 +199,18 @@
errors like "[\nallo\n]\n". The patterns here are "[", "allo" and "]"
GNU regex should have raise a syntax error. The same for backref, where
the backref should have been local to each pattern. */
+
+ /* Fix for -i ignore-case default grep
+ ** Thomas Steudten <address@hidden>, 03/10/2004
+ */
+ if (match_icase)
+ {
+ trans = xmalloc (size);
+ for (i = 0; i < size; ++i)
+ *(trans+i) = TOLOWER ( *(motif+i));
+ motif = trans;
+ }
+
do
{
size_t len;
@@ -215,13 +229,28 @@
patterns = realloc (patterns, (pcount + 1) * sizeof (*patterns));
if (patterns == NULL)
- error (2, errno, _("memory exhausted"));
+ {
+ int err = errno;
+ if (match_icase && trans)
+ {
+ free(trans);
+ trans = NULL;
+ }
+ error (2, err, _("memory exhausted"));
+ }
patterns[pcount] = patterns0;
if ((err = re_compile_pattern (motif, len,
&(patterns[pcount].regexbuf))) != 0)
+ {
+ if (match_icase && trans)
+ {
+ free(trans);
+ trans = NULL;
+ }
error (2, 0, err);
+ }
pcount++;
motif = sep;
@@ -253,6 +282,11 @@
pattern = n;
size = i;
}
+ if (match_icase && trans)
+ {
+ free(trans);
+ trans = NULL;
+ }
dfacomp (pattern, size, &dfa, 1);
kwsmusts ();
@@ -263,8 +297,10 @@
{
const char *err;
const char *sep;
+ char *trans;
size_t total = size;
char const *motif = pattern;
+ int i;
if (strcmp (matcher, "awk") == 0)
{
@@ -281,6 +317,18 @@
errors like "[\nallo\n]\n". The patterns here are "[", "allo" and "]"
GNU regex should have raise a syntax error. The same for backref, where
the backref should have been local to each pattern. */
+
+ /* Fix for -i ignore-case egrep
+ ** Thomas Steudten <address@hidden>, 03/10/2004
+ */
+ if (match_icase)
+ {
+ trans = xmalloc (size);
+ for (i = 0; i < size; ++i)
+ *(trans+i) = TOLOWER ( *(motif+i));
+ motif = trans;
+ }
+
do
{
size_t len;
@@ -299,12 +347,27 @@
patterns = realloc (patterns, (pcount + 1) * sizeof (*patterns));
if (patterns == NULL)
- error (2, errno, _("memory exhausted"));
+ {
+ int err = errno;
+ if (match_icase && trans)
+ {
+ free(trans);
+ trans = NULL;
+ }
+ error (2, err, _("memory exhausted"));
+ }
patterns[pcount] = patterns0;
if ((err = re_compile_pattern (motif, len,
&(patterns[pcount].regexbuf))) != 0)
- error (2, 0, err);
+ {
+ if (match_icase && trans)
+ {
+ free(trans);
+ trans = NULL;
+ }
+ error (2, 0, err);
+ }
pcount++;
motif = sep;
@@ -336,6 +399,11 @@
pattern = n;
size = i;
}
+ if (match_icase && trans)
+ {
+ free(trans);
+ trans = NULL;
+ }
dfacomp (pattern, size, &dfa, 1);
kwsmusts ();
--
Tom
LINUX user since kernel 0.99.x 1994.
RPM Alpha packages at http://alpha.steudten.com/packages
Want to know what S.u.S.E 1995 cdrom-set contains?
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Bug in grep-2.5.1 patch added. Revoke first patch.,
Thomas Steudten <=