auto-import changelog data from grep-2.5.1-26.src.rpm

Thu Feb 26 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-26
- Fix fgrep (bug #116909).
Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
This commit is contained in:
cvsdist 2004-09-09 05:55:07 +00:00
parent 2393906004
commit ac51d8507f
3 changed files with 248 additions and 122 deletions

View File

@ -1,6 +1,5 @@
diff -ur grep-2.5.1.orig/lib/regex.c grep-2.5.1/lib/regex.c
--- grep-2.5.1.orig/lib/regex.c 2001-04-02 20:04:45.000000000 +0200
+++ grep-2.5.1/lib/regex.c 2002-08-14 12:27:01.000000000 +0200
--- grep-2.5.1/lib/regex.c.i18n 2001-04-02 19:04:45.000000000 +0100
+++ grep-2.5.1/lib/regex.c 2004-02-26 13:09:54.000000000 +0000
@@ -60,6 +60,10 @@
#ifdef MBS_SUPPORT
# define CHAR_TYPE wchar_t
@ -42,9 +41,8 @@ diff -ur grep-2.5.1.orig/lib/regex.c grep-2.5.1/lib/regex.c
#else
int temp = SIGN_EXTEND_CHAR (*(source + 1));
*dest = *source & 0377;
diff -ur grep-2.5.1.orig/src/dfa.c grep-2.5.1/src/dfa.c
--- grep-2.5.1.orig/src/dfa.c 2001-09-26 18:57:55.000000000 +0200
+++ grep-2.5.1/src/dfa.c 2002-08-14 12:27:01.000000000 +0200
--- grep-2.5.1/src/dfa.c.i18n 2001-09-26 17:57:55.000000000 +0100
+++ grep-2.5.1/src/dfa.c 2004-02-26 13:09:54.000000000 +0000
@@ -414,7 +414,7 @@
/* This function fetch a wide character, and update cur_mb_len,
@ -121,9 +119,8 @@ diff -ur grep-2.5.1.orig/src/dfa.c grep-2.5.1/src/dfa.c
}
}
while ((wc = wc1) != L']');
diff -ur grep-2.5.1.orig/src/grep.c grep-2.5.1/src/grep.c
--- grep-2.5.1.orig/src/grep.c 2002-03-26 16:54:12.000000000 +0100
+++ grep-2.5.1/src/grep.c 2002-08-14 12:27:01.000000000 +0200
--- grep-2.5.1/src/grep.c.i18n 2002-03-26 15:54:12.000000000 +0000
+++ grep-2.5.1/src/grep.c 2004-02-26 13:09:54.000000000 +0000
@@ -30,6 +30,12 @@
# include <sys/time.h>
# include <sys/resource.h>
@ -175,9 +172,8 @@ diff -ur grep-2.5.1.orig/src/grep.c grep-2.5.1/src/grep.c
(*compile)(keys, keycc);
if ((argc - optind > 1 && !no_filenames) || with_filenames)
diff -ur grep-2.5.1.orig/src/search.c grep-2.5.1/src/search.c
--- grep-2.5.1.orig/src/search.c 2001-04-19 05:42:14.000000000 +0200
+++ grep-2.5.1/src/search.c 2002-08-14 12:27:51.000000000 +0200
--- grep-2.5.1/src/search.c.i18n 2004-02-26 13:09:54.000000000 +0000
+++ grep-2.5.1/src/search.c 2004-02-26 13:17:12.000000000 +0000
@@ -149,15 +149,16 @@
static char*
check_multibyte_string(char const *buf, size_t size)
@ -257,57 +253,39 @@ diff -ur grep-2.5.1.orig/src/search.c grep-2.5.1/src/search.c
#endif /* MBS_SUPPORT */
buflim = buf + size;
@@ -363,8 +378,12 @@
{
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1)
- free(mb_properties);
-#endif
+ {
+ if (match_icase)
+ free ((char*)buf);
+ free(mb_properties);
+ }
+#endif /* MBS_SUPPORT */
return (size_t)-1;
}
beg += offset;
@@ -462,18 +481,29 @@
} /* for Regex patterns. */
} /* for (beg = end ..) */
@@ -455,8 +470,13 @@
failure:
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1 && mb_properties)
- free (mb_properties);
+ if (MB_CUR_MAX > 1)
+ {
+ if (match_icase)
+ free((char*)buf);
+ if (mb_properties)
+ free (mb_properties);
+ if (match_icase)
+ free ((char *) buf);
+ }
#endif /* MBS_SUPPORT */
return (size_t) -1;
success:
+ ret_val = beg - buf;
@@ -467,8 +487,13 @@
success_in_start_and_len:
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1 && mb_properties)
- free (mb_properties);
+ if (MB_CUR_MAX > 1)
+ {
+ if (match_icase)
+ free((char*)buf);
+ if (mb_properties)
+ free (mb_properties);
+ if (match_icase)
+ free ((char *) buf);
+ }
#endif /* MBS_SUPPORT */
*match_size = end - beg;
- return beg - buf;
+ return ret_val;
}
static void
@@ -506,10 +536,19 @@
*match_size = len;
return start;
@@ -504,10 +529,19 @@
register size_t len;
char eol = eolbyte;
struct kwsmatch kwsmatch;
@ -329,58 +307,8 @@ diff -ur grep-2.5.1.orig/src/search.c grep-2.5.1/src/search.c
#endif /* MBS_SUPPORT */
for (beg = buf; beg <= buf + size; ++beg)
@@ -518,8 +557,12 @@
if (offset == (size_t) -1)
{
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free(mb_properties);
+ if (MB_CUR_MAX > 1)
+ {
+ if (match_icase)
+ free ((char*)buf);
+ free(mb_properties);
+ }
#endif /* MBS_SUPPORT */
return offset;
}
@@ -532,11 +575,16 @@
if (exact)
{
*match_size = len;
+ ret_val = beg - buf;
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free (mb_properties);
+ if (MB_CUR_MAX > 1)
+ {
+ if (match_icase)
+ free ((char*)buf);
+ free(mb_properties);
+ }
#endif /* MBS_SUPPORT */
- return beg - buf;
+ return ret_val;
}
if (match_lines)
{
@@ -557,8 +605,12 @@
if (offset == (size_t) -1)
{
#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free (mb_properties);
+ if (MB_CUR_MAX > 1)
+ {
+ if (match_icase)
+ free ((char*)buf);
+ free(mb_properties);
+ }
#endif /* MBS_SUPPORT */
return offset;
}
@@ -574,7 +626,12 @@
@@ -565,7 +599,12 @@
failure:
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1)
- free (mb_properties);
@ -393,23 +321,17 @@ diff -ur grep-2.5.1.orig/src/search.c grep-2.5.1/src/search.c
#endif /* MBS_SUPPORT */
return -1;
@@ -584,11 +641,17 @@
while (buf < beg && beg[-1] != eol)
--beg;
*match_size = end - beg;
+ ret_val = beg - buf;
@@ -581,7 +620,12 @@
*match_size = len;
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1)
- free (mb_properties);
+ {
+ if (match_icase)
+ free((char*)buf);
+ if (mb_properties)
+ free (mb_properties);
+ if (match_icase)
+ free ((char *) buf);
+ }
#endif /* MBS_SUPPORT */
- return beg - buf;
+ return ret_val;
return beg - buf;
}
#if HAVE_LIBPCRE

196
grep-2.5.1-fgrep.patch Normal file
View File

@ -0,0 +1,196 @@
--- grep-2.5.1/src/search.c.fgrep 2001-04-19 04:42:14.000000000 +0100
+++ grep-2.5.1/src/search.c 2004-02-26 13:09:32.000000000 +0000
@@ -360,13 +360,7 @@
/* Find a possible match using the KWset matcher. */
size_t offset = kwsexec (kwset, beg, buflim - beg, &kwsm);
if (offset == (size_t) -1)
- {
-#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free(mb_properties);
-#endif
- return (size_t)-1;
- }
+ goto failure;
beg += offset;
/* Narrow down to the line containing the candidate, and
run it through DFA. */
@@ -379,7 +373,7 @@
while (beg > buf && beg[-1] != eol)
--beg;
if (kwsm.index < kwset_exact_matches)
- goto success;
+ goto success_in_beg_and_end;
if (dfaexec (&dfa, beg, end - beg, &backref) == (size_t) -1)
continue;
}
@@ -398,7 +392,7 @@
}
/* Successful, no backreferences encountered! */
if (!backref)
- goto success;
+ goto success_in_beg_and_end;
}
else
end = beg + size;
@@ -413,14 +407,11 @@
end - beg - 1, &(patterns[i].regs))))
{
len = patterns[i].regs.end[0] - start;
- if (exact)
- {
- *match_size = len;
- return start;
- }
+ if (exact && !match_words)
+ goto success_in_start_and_len;
if ((!match_lines && !match_words)
|| (match_lines && len == end - beg - 1))
- goto success;
+ goto success_in_beg_and_end;
/* If -w, check if the match aligns with word boundaries.
We do this iteratively because:
(a) the line may contain more than one occurence of the
@@ -434,7 +425,7 @@
if ((start == 0 || !WCHAR ((unsigned char) beg[start - 1]))
&& (len == end - beg - 1
|| !WCHAR ((unsigned char) beg[start + len])))
- goto success;
+ goto success_in_start_and_len;
if (len > 0)
{
/* Try a shorter length anchored at the same place. */
@@ -461,19 +452,26 @@
}
} /* for Regex patterns. */
} /* for (beg = end ..) */
+
+ failure:
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1 && mb_properties)
free (mb_properties);
#endif /* MBS_SUPPORT */
return (size_t) -1;
- success:
+ success_in_beg_and_end:
+ len = end - beg;
+ start = beg - buf;
+ /* FALLTHROUGH */
+
+ success_in_start_and_len:
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1 && mb_properties)
free (mb_properties);
#endif /* MBS_SUPPORT */
- *match_size = end - beg;
- return beg - buf;
+ *match_size = len;
+ return start;
}
static void
@@ -516,28 +514,15 @@
{
size_t offset = kwsexec (kwset, beg, buf + size - beg, &kwsmatch);
if (offset == (size_t) -1)
- {
-#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free(mb_properties);
-#endif /* MBS_SUPPORT */
- return offset;
- }
+ goto failure;
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1 && mb_properties[offset+beg-buf] == 0)
continue; /* It is a part of multibyte character. */
#endif /* MBS_SUPPORT */
beg += offset;
len = kwsmatch.size[0];
- if (exact)
- {
- *match_size = len;
-#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free (mb_properties);
-#endif /* MBS_SUPPORT */
- return beg - buf;
- }
+ if (exact && !match_words)
+ goto success_in_beg_and_len;
if (match_lines)
{
if (beg > buf && beg[-1] != eol)
@@ -547,31 +532,37 @@
goto success;
}
else if (match_words)
- for (try = beg; len; )
- {
- if (try > buf && WCHAR((unsigned char) try[-1]))
- break;
- if (try + len < buf + size && WCHAR((unsigned char) try[len]))
- {
- offset = kwsexec (kwset, beg, --len, &kwsmatch);
- if (offset == (size_t) -1)
- {
-#ifdef MBS_SUPPORT
- if (MB_CUR_MAX > 1)
- free (mb_properties);
-#endif /* MBS_SUPPORT */
- return offset;
- }
- try = beg + offset;
- len = kwsmatch.size[0];
- }
- else
- goto success;
- }
+ {
+ while (offset >= 0)
+ {
+ if ((offset == 0 || !WCHAR ((unsigned char) beg[-1]))
+ && (len == end - beg - 1 || !WCHAR ((unsigned char) beg[len])))
+ {
+ if (!exact)
+ /* Returns the whole line now we know there's a word match. */
+ goto success;
+ else
+ /* Returns just this word match. */
+ goto success_in_beg_and_len;
+ }
+ if (len > 0)
+ {
+ /* Try a shorter length anchored at the same place. */
+ --len;
+ offset = kwsexec (kwset, beg, len, &kwsmatch);
+ if (offset == -1) {
+ break; /* Try a different anchor. */
+ }
+ beg += offset;
+ len = kwsmatch.size[0];
+ }
+ }
+ }
else
goto success;
}
+ failure:
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1)
free (mb_properties);
@@ -583,7 +574,11 @@
end++;
while (buf < beg && beg[-1] != eol)
--beg;
- *match_size = end - beg;
+ len = end - beg;
+ /* FALLTHROUGH */
+
+ success_in_beg_and_len:
+ *match_size = len;
#ifdef MBS_SUPPORT
if (MB_CUR_MAX > 1)
free (mb_properties);

View File

@ -1,21 +1,22 @@
%define beta %nil
%define rel 24
%define rel 26
Summary: The GNU versions of grep pattern matching utilities.
Name: grep
Version: 2.5.1
%if "%{beta}" != ""
Release: 4.%{beta}.%{rel}
Release: 5.%{beta}.%{rel}
%else
Release: %{rel}
%endif
License: GPL
Group: Applications/Text
Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}%{beta}.tar.bz2
Patch0: grep-2.5-i18n.patch
Patch1: grep-2.5.1-oi.patch
Patch2: grep-2.5.1-manpage.patch
Patch3: grep-2.5.1-gofast.patch
Patch4: grep-2.5.1-bracket.patch
Patch0: grep-2.5.1-fgrep.patch
Patch1: grep-2.5-i18n.patch
Patch2: grep-2.5.1-oi.patch
Patch3: grep-2.5.1-manpage.patch
Patch4: grep-2.5.1-gofast.patch
Patch5: grep-2.5.1-bracket.patch
Prefix: %{_prefix}
Prereq: /sbin/install-info
Buildroot: %{_tmppath}/%{name}-%{version}-root
@ -33,11 +34,12 @@ utility for searching through text.
%prep
%setup -q -n %{name}-%{version}%{beta}
%patch0 -p1 -b .i18n
%patch1 -p1 -b .oi
%patch2 -p1 -b .manpage
%patch3 -p1 -b .gofast
%patch4 -p1 -b .bracket
%patch0 -p1 -b .fgrep
%patch1 -p1 -b .i18n
%patch2 -p1 -b .oi
%patch3 -p1 -b .manpage
%patch4 -p1 -b .gofast
%patch5 -p1 -b .bracket
%build
[ ! -e configure ] && ./autogen.sh
@ -85,6 +87,12 @@ fi
%{_mandir}/*/*
%changelog
* Thu Feb 26 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-26
- Fix fgrep (bug #116909).
* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Mon Jan 5 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-24
- Work around glibc bug #112869 (segfault in re_compile_pattern).
- Avoid patching Makefile.am, to avoid automake/autoconf weirdness.