From MAILER-DAEMON Fri Nov 09 20:19:55 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TWzjn-0000jo-Bh
	for mharc-grep-commit@gnu.org; Fri, 09 Nov 2012 20:19:55 -0500
Received: from eggs.gnu.org ([208.118.235.92]:49498)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bonzini@gnu.org>) id 1TWzjk-0000j4-CF
	for grep-commit@gnu.org; Fri, 09 Nov 2012 20:19:53 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bonzini@gnu.org>) id 1TWzji-0004JY-CK
	for grep-commit@gnu.org; Fri, 09 Nov 2012 20:19:52 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:60038)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bonzini@gnu.org>) id 1TWzji-0004JU-8r
	for grep-commit@gnu.org; Fri, 09 Nov 2012 20:19:50 -0500
Received: from bonzini by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <bonzini@gnu.org>) id 1TWzjh-0006pk-Oj
	for grep-commit@gnu.org; Sat, 10 Nov 2012 01:19:50 +0000
Date: Sat, 10 Nov 2012 01:19:49 +0000
Message-Id: <E1TWzjh-0006pk-Oj@vcs.savannah.gnu.org>
To: grep-commit@gnu.org
Subject: grep branch, master, updated. v2.14-14-gb06f7a2
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: cbf738c8d0b148b7d5e43ebb19dd683891cbefac
X-Git-Newrev: b06f7a29a58bbdd5866afc1e92dba3fdc9e2ed59
From: Paolo Bonzini <bonzini@gnu.org>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: grep-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: bug-grep@gnu.org
List-Id: CVS commit notices for GNU grep <grep-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/grep-commit>,
	<mailto:grep-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/grep-commit>
List-Post: <mailto:grep-commit@gnu.org>
List-Help: <mailto:grep-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/grep-commit>,
	<mailto:grep-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Sat, 10 Nov 2012 01:19:53 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  b06f7a29a58bbdd5866afc1e92dba3fdc9e2ed59 (commit)
      from  cbf738c8d0b148b7d5e43ebb19dd683891cbefac (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=b06f7a29a58bbdd5866afc1e92dba3fdc9e2ed59


commit b06f7a29a58bbdd5866afc1e92dba3fdc9e2ed59
Author: Paolo Bonzini <bonzini@gnu.org>
Date:   Sat Nov 10 02:15:51 2012 +0100

    pcre: add PCRE-JIT support for grep
    
    * NEWS: Document new feature.
    * src/pcresearch.c [PCRE_STUDY_JIT_COMPILE] (jit_stack): New.
    [PCRE_STUDY_JIT_COMPILE] (Pcompile): JIT-compile the regular expression
    and allocate a stack for it.  Based on a patch from Zoltan Herczeg.
    * THANKS: Add Zoltan to the list.

diff --git a/NEWS b/NEWS
index 052cd81..e43e06a 100644
--- a/NEWS
+++ b/NEWS
@@ -9,6 +9,13 @@ GNU grep NEWS                                    -*- outline -*-
   to match multibyte characters against some regular expressions, especially
   those including the '.' or '\p' metacharacters.
 
+** New features
+
+  grep -P can now use a just-in-time compiler to greatly speed up matches,
+  This feature is transparent to the user; no flag is required to enable
+  it.  It is only available if the corresponding support in the PCRE
+  library is detected when grep is compiled.
+
 
 * Noteworthy changes in release 2.14 (2012-08-20) [stable]
 
diff --git a/THANKS b/THANKS
index 1720232..fd6aeef 100644
--- a/THANKS
+++ b/THANKS
@@ -99,3 +99,4 @@ Volker Borchert            <bt@teknon.de>
 Wichert Akkerman           <wichert@cistron.nl>
 William Bader              <william@nscs.fast.net>
 Wolfgang Schludi           <schludi@syscomp.de>
+Zoltan Herczeg             <hzmester@freemail.hu>
diff --git a/src/pcresearch.c b/src/pcresearch.c
index 2e95f2d..89bfbec 100644
--- a/src/pcresearch.c
+++ b/src/pcresearch.c
@@ -35,6 +35,12 @@ static pcre *cre;
 
 /* Additional information about the pattern.  */
 static pcre_extra *extra;
+
+#ifdef PCRE_STUDY_JIT_COMPILE
+static pcre_jit_stack *jit_stack;
+#else
+#define PCRE_STUDY_JIT_COMPILE 0
+#endif
 #endif
 
 void
@@ -101,12 +107,27 @@ Pcompile (char const *pattern, size_t size)
   if (!cre)
     error (EXIT_TROUBLE, 0, "%s", ep);
 
-  extra = pcre_study (cre, 0, &ep);
+  extra = pcre_study (cre, PCRE_STUDY_JIT_COMPILE, &ep);
   if (ep)
     error (EXIT_TROUBLE, 0, "%s", ep);
 
+#if PCRE_STUDY_JIT_COMPILE
+  if (pcre_fullinfo(cre, extra, PCRE_INFO_JIT, &e))
+    error (EXIT_TROUBLE, 0, "Internal error (should never happen).");
+
+  if (e)
+    {
+      /* A 32K stack is allocated for the machine code by default, which
+         can grow to 512K if necessary. Since JIT uses far less memory
+         than the interpreter, this should be enough in practice. */
+      jit_stack = pcre_jit_stack_alloc (32 * 1024, 512 * 1024);
+      if (!jit_stack)
+        error (EXIT_TROUBLE, 0, "Cannot allocate memory for the JIT stack.");
+      pcre_assign_jit_stack(extra, NULL, jit_stack);
+    }
   free (re);
 #endif
+#endif
 }
 
 size_t

-----------------------------------------------------------------------

Summary of changes:
 NEWS             |    7 +++++++
 THANKS           |    1 +
 src/pcresearch.c |   23 ++++++++++++++++++++++-
 3 files changed, 30 insertions(+), 1 deletions(-)


hooks/post-receive
-- 
grep


From MAILER-DAEMON Tue Nov 20 02:51:48 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1TaicV-0008PS-Uw
	for mharc-grep-commit@gnu.org; Tue, 20 Nov 2012 02:51:47 -0500
Received: from eggs.gnu.org ([208.118.235.92]:38298)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1TaicS-0008PM-Lr
	for grep-commit@gnu.org; Tue, 20 Nov 2012 02:51:46 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1TaicM-0003Ig-IK
	for grep-commit@gnu.org; Tue, 20 Nov 2012 02:51:44 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:55765)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1TaicM-0003Ic-Eq
	for grep-commit@gnu.org; Tue, 20 Nov 2012 02:51:38 -0500
Received: from eggert by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <eggert@cs.ucla.edu>) id 1TaicM-0004wz-1s
	for grep-commit@gnu.org; Tue, 20 Nov 2012 07:51:38 +0000
Date: Tue, 20 Nov 2012 07:51:38 +0000
Message-Id: <E1TaicM-0004wz-1s@vcs.savannah.gnu.org>
To: grep-commit@gnu.org
Subject: grep branch, master, updated. v2.14-15-g9401024
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: b06f7a29a58bbdd5866afc1e92dba3fdc9e2ed59
X-Git-Newrev: 9401024f7505dee3d14c1b520d0028bd9b8aa2ab
From: Paul Eggert <eggert@cs.ucla.edu>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: grep-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: bug-grep@gnu.org
List-Id: CVS commit notices for GNU grep <grep-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/grep-commit>,
	<mailto:grep-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/grep-commit>
List-Post: <mailto:grep-commit@gnu.org>
List-Help: <mailto:grep-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/grep-commit>,
	<mailto:grep-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 20 Nov 2012 07:51:46 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  9401024f7505dee3d14c1b520d0028bd9b8aa2ab (commit)
      from  b06f7a29a58bbdd5866afc1e92dba3fdc9e2ed59 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=9401024f7505dee3d14c1b520d0028bd9b8aa2ab


commit 9401024f7505dee3d14c1b520d0028bd9b8aa2ab
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Mon Nov 19 23:50:40 2012 -0800

    grep: diagnose read errors from -f dir, porting to Solaris
    
    Problem reported by Dennis Clarke for Solaris 10 in
    <http://lists.gnu.org/archive/html/bug-grep/2012-11/msg00009.html>.
    * src/main.c (main): For -f F, diagnose any read errors
    encountered when reading F.
    * tests/Makefile.am (XFAIL_TESTS): Remove grep-dir.
    * tests/grep-dir: Don't assume that directories cannot be read
    via fread, as POSIX allows this and it can happen on Solaris.

diff --git a/src/main.c b/src/main.c
index 6750007..cadefd6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1860,6 +1860,7 @@ main (int argc, char **argv)
   size_t cc;
   int opt, status, prepended;
   int prev_optind, last_recursive;
+  int fread_errno;
   intmax_t default_context;
   FILE *fp;
   exit_failure = EXIT_TROUBLE;
@@ -2009,13 +2010,15 @@ main (int argc, char **argv)
           ;
         keys = xrealloc (keys, keyalloc);
         oldcc = keycc;
-        while (!feof (fp)
-               && (cc = fread (keys + keycc, 1, keyalloc - 1 - keycc, fp)) > 0)
+        while ((cc = fread (keys + keycc, 1, keyalloc - 1 - keycc, fp)) != 0)
           {
             keycc += cc;
             if (keycc == keyalloc - 1)
               keys = x2nrealloc (keys, &keyalloc, sizeof *keys);
           }
+        fread_errno = errno;
+        if (ferror (fp))
+          error (EXIT_TROUBLE, fread_errno, "%s", optarg);
         if (fp != stdin)
           fclose (fp);
         /* Append final newline if file ended in non-newline. */
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2f99a69..7565840 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -24,8 +24,7 @@ LDADD = ../lib/libgreputils.a $(LIBINTL) ../lib/libgreputils.a
 
 # Remove this definition once the failing test passes.
 XFAIL_TESTS = \
-  word-delim-multibyte \
-  grep-dir
+  word-delim-multibyte
 
 # Equivalence classes are only supported when using the system
 # matcher (which means only with glibc).
diff --git a/tests/grep-dir b/tests/grep-dir
index e005525..de14d62 100755
--- a/tests/grep-dir
+++ b/tests/grep-dir
@@ -4,14 +4,22 @@
 
 mkdir a || framework_failure
 
-echo x | grep -f a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
-echo x | grep -if a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
-echo x | grep -Ff a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
-echo x | grep -Fif a/; { test $? -gt 1 && test $? -lt 128; } || fail=1
+# Lower and upper bound of valid exit status for "grep -f DIR",
+# when reading from empty and nonempty files, respectively.
+if cat a >/dev/null 2>&1; then
+  l=1 u=1 L=0 U=1
+else
+  l=2 u=127 L=2 U=127
+fi
 
-grep -f a/ < /dev/null; { test $? -gt 1 && test $? -lt 128; } || fail=1
-grep -if a/ < /dev/null; { test $? -gt 1 && test $? -lt 128; } || fail=1
-grep -Ff a/ < /dev/null; { test $? -gt 1 && test $? -lt 128; } || fail=1
-grep -Fif a/ < /dev/null; { test $? -gt 1 && test $? -lt 128; } || fail=1
+echo x | grep -f a/; { test $? -ge $L && test $? -le $U; } || fail=1
+echo x | grep -if a/; { test $? -ge $L && test $? -le $U; } || fail=1
+echo x | grep -Ff a/; { test $? -ge $L && test $? -le $U; } || fail=1
+echo x | grep -Fif a/; { test $? -ge $L && test $? -le $U; } || fail=1
+
+grep -f a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1
+grep -if a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1
+grep -Ff a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1
+grep -Fif a/ < /dev/null; { test $? -ge $l && test $? -le $u; } || fail=1
 
 Exit $fail

-----------------------------------------------------------------------

Summary of changes:
 src/main.c        |    7 +++++--
 tests/Makefile.am |    3 +--
 tests/grep-dir    |   24 ++++++++++++++++--------
 3 files changed, 22 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
grep


From MAILER-DAEMON Tue Nov 20 12:49:43 2012
Received: from list by lists.gnu.org with archive (Exim 4.71)
	id 1Tarx8-0000S5-VY
	for mharc-grep-commit@gnu.org; Tue, 20 Nov 2012 12:49:42 -0500
Received: from eggs.gnu.org ([208.118.235.92]:44086)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1Tarx6-0000Rw-Kf
	for grep-commit@gnu.org; Tue, 20 Nov 2012 12:49:41 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1Tarx5-00082V-8v
	for grep-commit@gnu.org; Tue, 20 Nov 2012 12:49:40 -0500
Received: from vcs.savannah.gnu.org ([140.186.70.72]:50202)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <eggert@cs.ucla.edu>) id 1Tarx5-00082H-53
	for grep-commit@gnu.org; Tue, 20 Nov 2012 12:49:39 -0500
Received: from eggert by vcs.savannah.gnu.org with local (Exim 4.72)
	(envelope-from <eggert@cs.ucla.edu>) id 1Tarx4-0005Hq-Ln
	for grep-commit@gnu.org; Tue, 20 Nov 2012 17:49:38 +0000
Date: Tue, 20 Nov 2012 17:49:38 +0000
Message-Id: <E1Tarx4-0005Hq-Ln@vcs.savannah.gnu.org>
To: grep-commit@gnu.org
Subject: grep branch, master, updated. v2.14-16-g5625cd0
X-Git-Refname: refs/heads/master
X-Git-Reftype: branch
X-Git-Oldrev: 9401024f7505dee3d14c1b520d0028bd9b8aa2ab
X-Git-Newrev: 5625cd0ed447eccc366cf6e70297b3b4fd457be4
From: Paul Eggert <eggert@cs.ucla.edu>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 140.186.70.72
X-BeenThere: grep-commit@gnu.org
X-Mailman-Version: 2.1.14
Precedence: list
Reply-To: bug-grep@gnu.org
List-Id: CVS commit notices for GNU grep <grep-commit.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/grep-commit>,
	<mailto:grep-commit-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/archive/html/grep-commit>
List-Post: <mailto:grep-commit@gnu.org>
List-Help: <mailto:grep-commit-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/grep-commit>,
	<mailto:grep-commit-request@gnu.org?subject=subscribe>
X-List-Received-Date: Tue, 20 Nov 2012 17:49:41 -0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "grep".

The branch, master has been updated
       via  5625cd0ed447eccc366cf6e70297b3b4fd457be4 (commit)
      from  9401024f7505dee3d14c1b520d0028bd9b8aa2ab (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit/grep.git/commit/?id=5625cd0ed447eccc366cf6e70297b3b4fd457be4


commit 5625cd0ed447eccc366cf6e70297b3b4fd457be4
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Tue Nov 20 09:49:14 2012 -0800

    grep: normalize diagnostics
    
    * src/pcresearch.c (Pcompile): Use similar format diagnostics
    as elsewhere, and translate them.

diff --git a/src/pcresearch.c b/src/pcresearch.c
index 89bfbec..b32b6e1 100644
--- a/src/pcresearch.c
+++ b/src/pcresearch.c
@@ -66,7 +66,7 @@ Pcompile (char const *pattern, size_t size)
 #endif
 
   /* FIXME: Remove these restrictions.  */
-  if (memchr(pattern, '\n', size))
+  if (memchr (pattern, '\n', size))
     error (EXIT_TROUBLE, 0, _("the -P option only supports a single pattern"));
 
   *n = '\0';
@@ -112,18 +112,18 @@ Pcompile (char const *pattern, size_t size)
     error (EXIT_TROUBLE, 0, "%s", ep);
 
 #if PCRE_STUDY_JIT_COMPILE
-  if (pcre_fullinfo(cre, extra, PCRE_INFO_JIT, &e))
-    error (EXIT_TROUBLE, 0, "Internal error (should never happen).");
+  if (pcre_fullinfo (cre, extra, PCRE_INFO_JIT, &e))
+    error (EXIT_TROUBLE, 0, _("internal error (should never happen)"));
 
   if (e)
     {
       /* A 32K stack is allocated for the machine code by default, which
          can grow to 512K if necessary. Since JIT uses far less memory
-         than the interpreter, this should be enough in practice. */
+         than the interpreter, this should be enough in practice.  */
       jit_stack = pcre_jit_stack_alloc (32 * 1024, 512 * 1024);
       if (!jit_stack)
-        error (EXIT_TROUBLE, 0, "Cannot allocate memory for the JIT stack.");
-      pcre_assign_jit_stack(extra, NULL, jit_stack);
+        error (EXIT_TROUBLE, 0, _("cannot allocate memory for the JIT stack"));
+      pcre_assign_jit_stack (extra, NULL, jit_stack);
     }
   free (re);
 #endif

-----------------------------------------------------------------------

Summary of changes:
 src/pcresearch.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
grep


