rpms/grep/devel grep-2.5.1a-pcrewrap.patch, NONE, 1.1 grep-2.5.1a-utf8.patch, NONE, 1.1 grep.spec, 1.69, 1.70

Lubomir Rintel lkundrak at fedoraproject.org
Wed Oct 1 16:50:37 UTC 2008


Author: lkundrak

Update of /cvs/pkgs/rpms/grep/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv25861

Modified Files:
	grep.spec 
Added Files:
	grep-2.5.1a-pcrewrap.patch grep-2.5.1a-utf8.patch 
Log Message:
* Wed Oct 1 2008 Lubomir Rintel <lkundrak at v3.sk> 2.5.1a-61
- Fix pcre-mode (-P) line wrapping (bug #324781)
- Match the version with upstream
- Recode AUTHORS to utf8


grep-2.5.1a-pcrewrap.patch:

--- NEW FILE grep-2.5.1a-pcrewrap.patch ---
Fix https://bugzilla.redhat.com/show_bug.cgi?id=324781
See the code comments for details.

Lubomir Rintel <lkundrak at 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 at 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


grep-2.5.1a-utf8.patch:

--- NEW FILE grep-2.5.1a-utf8.patch ---
>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 at arklinux.org> maintained GNU grep until
+Bernhard "Bero" Rosenkränzer <bero at arklinux.org> maintained GNU grep until
 version 2.5.1, ie. from Sep 2001 till 2003.
 
 Stepan Kasal <kasal at ucw.cz> maintains GNU grep since Feb 2004.


Index: grep.spec
===================================================================
RCS file: /cvs/pkgs/rpms/grep/devel/grep.spec,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- grep.spec	25 Jul 2008 19:28:11 -0000	1.69
+++ grep.spec	1 Oct 2008 16:50:07 -0000	1.70
@@ -1,10 +1,10 @@
 Summary: The GNU versions of grep pattern matching utilities
 Name: grep
-Version: 2.5.1
-Release: 60%{?dist}
+Version: 2.5.1a
+Release: 61%{?dist}
 License: GPLv2+
 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
 Patch1: grep-2.5.1-bracket.patch
 Patch2: grep-2.5-i18n.patch
@@ -20,6 +20,8 @@
 Patch14: grep-P.patch
 Patch15: grep-mem-exhausted.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/
 Requires(post): /sbin/install-info
 Requires(preun): /sbin/install-info
@@ -36,7 +38,7 @@
 utility for searching through text.
 
 %prep
-%setup -q -n %{name}-%{version}a
+%setup -q
 %patch0 -p1 -b .fgrep
 %patch1 -p1 -b .bracket
 %patch2 -p1 -b .i18n
@@ -52,7 +54,10 @@
 %patch14 -p1 -b .P
 %patch15 -p1 -b .mem-exhausted
 %patch16 -p1 -b .empty-pattern
+%patch17 -p1 -b .pcrewrap
+%patch18 -p1 -b .utf8
 chmod a+x tests/fmbtest.sh
+chmod a+x tests/pcrewrap.sh
 
 %build
 [ ! -e configure ] && ./autogen.sh
@@ -103,6 +108,11 @@
 %{_mandir}/*/*
 
 %changelog
+* Wed Oct 1 2008 Lubomir Rintel <lkundrak at 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 at redhat.com> - 2.5.1-60
 - fix license tag
 




More information about the scm-commits mailing list