- Fix pcre-mode (-P) line wrapping (bug #324781)
- Match the version with upstream - Recode AUTHORS to utf8
This commit is contained in:
parent
85fb4e31b9
commit
c5d3d9a082
101
grep-2.5.1a-pcrewrap.patch
Normal file
101
grep-2.5.1a-pcrewrap.patch
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
Fix https://bugzilla.redhat.com/show_bug.cgi?id=324781
|
||||||
|
See the code comments for details.
|
||||||
|
|
||||||
|
Lubomir Rintel <lkundrak@v3.sk>
|
||||||
|
|
||||||
|
--- grep-2.5.1a/src/search.c.pcrewrap 2008-10-01 16:38:20.000000000 +0200
|
||||||
|
+++ grep-2.5.1a/src/search.c 2008-10-01 16:38:20.000000000 +0200
|
||||||
|
@@ -1241,8 +1241,31 @@
|
||||||
|
is just for performance improvement in pcre_exec. */
|
||||||
|
int sub[300];
|
||||||
|
|
||||||
|
- int e = pcre_exec (cre, extra, buf, size, 0, 0,
|
||||||
|
- sub, sizeof sub / sizeof *sub);
|
||||||
|
+ char *line_buf = buf;
|
||||||
|
+ int line_size = 0;
|
||||||
|
+ int e = 0;
|
||||||
|
+
|
||||||
|
+ /* PCRE can't limit the matching to space between newlines (i.e
|
||||||
|
+ [^a] will allways match newline, see pcreposix(3) for details),
|
||||||
|
+ therefore whe have to match each line in the buffer separately */
|
||||||
|
+ do {
|
||||||
|
+ /* We're not at the of buffer or end of line, get another char */
|
||||||
|
+ if (line_buf + line_size < buf + size && line_buf[line_size++] != eolbyte) {
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Match the part of buffer that constitutes a line */
|
||||||
|
+ e = pcre_exec (cre, extra, line_buf, line_size - 1, 0, 0,
|
||||||
|
+ sub, sizeof sub / sizeof *sub);
|
||||||
|
+
|
||||||
|
+ /* Don't try other lines if this one matched or returned an error */
|
||||||
|
+ if (e != PCRE_ERROR_NOMATCH)
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
+ /* Wrap up */
|
||||||
|
+ line_buf += line_size;
|
||||||
|
+ line_size = 0;
|
||||||
|
+ } while (line_buf < buf + size);
|
||||||
|
|
||||||
|
if (e <= 0)
|
||||||
|
{
|
||||||
|
@@ -1261,8 +1284,8 @@
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Narrow down to the line we've found. */
|
||||||
|
- char const *beg = buf + sub[0];
|
||||||
|
- char const *end = buf + sub[1];
|
||||||
|
+ char const *beg = line_buf + sub[0];
|
||||||
|
+ char const *end = line_buf + sub[1];
|
||||||
|
char const *buflim = buf + size;
|
||||||
|
char eol = eolbyte;
|
||||||
|
if (!exact)
|
||||||
|
--- grep-2.5.1a/tests/Makefile.am.pcrewrap 2008-10-01 16:47:01.000000000 +0200
|
||||||
|
+++ grep-2.5.1a/tests/Makefile.am 2008-10-01 16:47:26.000000000 +0200
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
|
||||||
|
TESTS = warning.sh khadafy.sh spencer1.sh bre.sh ere.sh \
|
||||||
|
status.sh empty.sh options.sh backref.sh file.sh \
|
||||||
|
- fmbtest.sh
|
||||||
|
+ fmbtest.sh pcrewrap.sh
|
||||||
|
EXTRA_DIST = $(TESTS) \
|
||||||
|
khadafy.lines khadafy.regexp \
|
||||||
|
spencer1.awk spencer1.tests \
|
||||||
|
--- grep-2.5.1a/tests/Makefile.in.pcrewrap 2008-10-01 16:47:01.000000000 +0200
|
||||||
|
+++ grep-2.5.1a/tests/Makefile.in 2008-10-01 16:47:34.000000000 +0200
|
||||||
|
@@ -98,7 +98,7 @@
|
||||||
|
|
||||||
|
TESTS = warning.sh khadafy.sh spencer1.sh bre.sh ere.sh \
|
||||||
|
status.sh empty.sh options.sh backref.sh file.sh \
|
||||||
|
- fmbtest.sh
|
||||||
|
+ fmbtest.sh pcrewrap.sh
|
||||||
|
|
||||||
|
EXTRA_DIST = $(TESTS) \
|
||||||
|
khadafy.lines khadafy.regexp \
|
||||||
|
--- grep-2.5.1a/tests/pcrewrap.sh 2008-09-30 09:16:44.037543374 +0200
|
||||||
|
+++ grep-2.5.1a/tests/pcrewrap.sh 2008-10-01 16:45:45.000000000 +0200
|
||||||
|
@@ -0,0 +1,23 @@
|
||||||
|
+#!/bin/sh
|
||||||
|
+# Test for bug https://bugzilla.redhat.com/show_bug.cgi?id=324781
|
||||||
|
+# Lubomir Rintel <lkundrak@v3.sk>
|
||||||
|
+
|
||||||
|
+: ${srcdir=.}
|
||||||
|
+
|
||||||
|
+failures=0
|
||||||
|
+
|
||||||
|
+echo -ne "a\na" | ${GREP} -P '[^a]' > /dev/null 2>&1
|
||||||
|
+if test $? -ne 1
|
||||||
|
+then
|
||||||
|
+ echo "PCRE Wrap: Wrong status code, test \#1 failed"
|
||||||
|
+ failures=1
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+echo -ne "a\na" | ${GREP} -P '[^b].[^b]' > /dev/null 2>&1
|
||||||
|
+if test $? -ne 1
|
||||||
|
+then
|
||||||
|
+ echo "PCRE Wrap: Wrong status code, test \#2 failed"
|
||||||
|
+ failures=1
|
||||||
|
+fi
|
||||||
|
+
|
||||||
|
+exit $failures
|
||||||
|
|
14
grep-2.5.1a-utf8.patch
Normal file
14
grep-2.5.1a-utf8.patch
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
From latin1 to utf8
|
||||||
|
|
||||||
|
diff -up grep-2.5.1a/AUTHORS.utf8 grep-2.5.1a/AUTHORS
|
||||||
|
--- grep-2.5.1a/AUTHORS.utf8 2008-10-01 18:42:53.000000000 +0200
|
||||||
|
+++ grep-2.5.1a/AUTHORS 2008-10-01 18:43:12.000000000 +0200
|
||||||
|
@@ -40,7 +40,7 @@ send me email.
|
||||||
|
|
||||||
|
Alain Magloire maintained GNU grep until version 2.5e.
|
||||||
|
|
||||||
|
-Bernhard "Bero" Rosenkränzer <bero@arklinux.org> maintained GNU grep until
|
||||||
|
+Bernhard "Bero" Rosenkränzer <bero@arklinux.org> maintained GNU grep until
|
||||||
|
version 2.5.1, ie. from Sep 2001 till 2003.
|
||||||
|
|
||||||
|
Stepan Kasal <kasal@ucw.cz> maintains GNU grep since Feb 2004.
|
18
grep.spec
18
grep.spec
@ -1,10 +1,10 @@
|
|||||||
Summary: The GNU versions of grep pattern matching utilities
|
Summary: The GNU versions of grep pattern matching utilities
|
||||||
Name: grep
|
Name: grep
|
||||||
Version: 2.5.1
|
Version: 2.5.1a
|
||||||
Release: 60%{?dist}
|
Release: 61%{?dist}
|
||||||
License: GPLv2+
|
License: GPLv2+
|
||||||
Group: Applications/Text
|
Group: Applications/Text
|
||||||
Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}a.tar.bz2
|
Source: ftp://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.bz2
|
||||||
Patch0: grep-2.5.1-fgrep.patch
|
Patch0: grep-2.5.1-fgrep.patch
|
||||||
Patch1: grep-2.5.1-bracket.patch
|
Patch1: grep-2.5.1-bracket.patch
|
||||||
Patch2: grep-2.5-i18n.patch
|
Patch2: grep-2.5-i18n.patch
|
||||||
@ -20,6 +20,8 @@ Patch13: grep-2.5.1-w.patch
|
|||||||
Patch14: grep-P.patch
|
Patch14: grep-P.patch
|
||||||
Patch15: grep-mem-exhausted.patch
|
Patch15: grep-mem-exhausted.patch
|
||||||
Patch16: grep-empty-pattern.patch
|
Patch16: grep-empty-pattern.patch
|
||||||
|
Patch17: grep-2.5.1a-pcrewrap.patch
|
||||||
|
Patch18: grep-2.5.1a-utf8.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
|
||||||
@ -36,7 +38,7 @@ You should install grep on your system, because it is a very useful
|
|||||||
utility for searching through text.
|
utility for searching through text.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q -n %{name}-%{version}a
|
%setup -q
|
||||||
%patch0 -p1 -b .fgrep
|
%patch0 -p1 -b .fgrep
|
||||||
%patch1 -p1 -b .bracket
|
%patch1 -p1 -b .bracket
|
||||||
%patch2 -p1 -b .i18n
|
%patch2 -p1 -b .i18n
|
||||||
@ -52,7 +54,10 @@ utility for searching through text.
|
|||||||
%patch14 -p1 -b .P
|
%patch14 -p1 -b .P
|
||||||
%patch15 -p1 -b .mem-exhausted
|
%patch15 -p1 -b .mem-exhausted
|
||||||
%patch16 -p1 -b .empty-pattern
|
%patch16 -p1 -b .empty-pattern
|
||||||
|
%patch17 -p1 -b .pcrewrap
|
||||||
|
%patch18 -p1 -b .utf8
|
||||||
chmod a+x tests/fmbtest.sh
|
chmod a+x tests/fmbtest.sh
|
||||||
|
chmod a+x tests/pcrewrap.sh
|
||||||
|
|
||||||
%build
|
%build
|
||||||
[ ! -e configure ] && ./autogen.sh
|
[ ! -e configure ] && ./autogen.sh
|
||||||
@ -103,6 +108,11 @@ fi
|
|||||||
%{_mandir}/*/*
|
%{_mandir}/*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Oct 1 2008 Lubomir Rintel <lkundrak@v3.sk> 2.5.1a-61
|
||||||
|
- Fix pcre-mode (-P) line wrapping (bug #324781)
|
||||||
|
- Match the version with upstream
|
||||||
|
- Recode AUTHORS to utf8
|
||||||
|
|
||||||
* Fri Jul 25 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 2.5.1-60
|
* Fri Jul 25 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 2.5.1-60
|
||||||
- fix license tag
|
- fix license tag
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user