git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v3 00/18] PCRE v1 improvements & PCRE v2 support

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Apr 20, 2017, 21:23 UTC
Message-ID
<20170420212345.7408-1-avarab@gmail.com>

Sorry about the high volume sending. I thought I wouldn't have time to work on v3 for a while, but here it is a day later. I promise to hold off on further sending for a bit.

This, unlike v2, addresses all the outstanding comments the series had. Most importantly I added a patch at the end to remove the concurrent support for v1 & v2 of the library as Jeff & Junio suggested.

See the v2 coverletter in <20170419224053.8920-1-avarab@gmail.com> for changes since v1, changes since v2 noted below:

Ævar Arnfjörð Bjarmason (18):
  grep: amend submodule recursion test in preparation for rx engine
    testing
  grep: add tests for grep pattern types being passed to submodules
  grep: submodule-related case statements should die if new fields are
    added

I thought there was a bug in v2 still where submodule grepping wouldn't properly pass along e.g. `-c grep.patternType=pcre2`, this turned out to not be the case since we pass -c options to subprocesses via the GIT_CONFIG_PARAMETERS env var, which I didn't know about.

But in preparing to fix that I wrote these tests which improve on some blind spots in the tests Brandon initially added for the submodule grep. It's part of this series because it would conflict with subsequent patches if sent stand-alone, but is otherwise unrelated.

  grep: remove redundant regflags assignment under PCRE
  Makefile & configure: reword outdated comment about PCRE
No changes.
  grep: add a test for backreferences in PCRE patterns

s/PCRE/LIBPCRE/ for the prereq check. That's changed later, but this patch didn't work properly stand-alone, error introduced in earlier v1-era rebasing.

  log: add exhaustive tests for pattern style options & config
  log: add -P as a synonym for --perl-regexp
No changes.
  grep & rev-list doc: stop promising libpcre for --perl-regexp

I've reworded these docs to make even weaker promises about what's a "Perl-compatible regular expression". As noted in the commit message the motivation is that maybe in the future we'd like to provide -P via some entirely different library, e.g. Intel's hyperscan. This leaves that door open without breaking existing promises in the documentation.

  grep: make grep.patternType=[pcre|pcre1] a synonym for "perl"
Now with tests for recursive submodule grepping.
  test-lib: rename the LIBPCRE prerequisite to PCRE
Now with s/LIBPCRE/PCRE/ back for the s/PCRE/LIBPCRE/ change noted earlier.
  grep: change the internal PCRE macro names to be PCRE1
  grep: change the internal PCRE code & header names to be PCRE1
  perf: add a performance comparison test of grep -E and -P
  grep: add support for the PCRE v1 JIT API
No changes.
  grep: add support for PCRE v2

Fix one s/LIBPCREDIR/LIBPCRE2DIR/ in a ./configure notice which I missed & tests & minor changes for recursive submodule grepping.

  grep: remove support concurrent use of both PCRE v1 & v2
NEW: Removes grep.patternType=[pcre|pcre1|pcre2] & makes trying to
compile git with both v1 & v2 an error, but either one will work, with
v1 being the default still.

After writing this up & seeing what the change is I also agree that it's a good idea to apply this. It makes the user-facing docs simpler, but also the various tests which previously had to worry about [pcre|pcre1|pcre2] which now just test "perl".

  Makefile & configure: make PCRE v2 the default PCRE implementation
NEW: This changes the default PCRE implementation to v2, and makes
USE_LIBPCRE mean USE_LIBPCRE2, but USE_LIBPCRE1 is still available.

I originally wrote this as something to keep for some future submission, but come to think of it I can't see why it shouldn't be applied.

The v2 PCRE is stable & end-user compatible, all this change does is change the default, someone building a new git is likely to also have packaged PCRE v2 sometime in the last 2 years since it was released, and if not they can choose to use the legacy v2 library by making the trivial s/USE_LIBPCRE/USE_LIBPCRE1/ change, or package up PCRE v2.

 Documentation/git-grep.txt         |   7 +-
 Documentation/rev-list-options.txt |   9 +-
 Makefile                           |  39 +++++--
 builtin/grep.c                     |   4 +
 configure.ac                       |  81 +++++++++++---
 grep.c                             | 214 ++++++++++++++++++++++++++++++------
 grep.h                             |  32 +++++-
 revision.c                         |   2 +-
 t/README                           |   4 +-
 t/perf/p7820-grep-engines.sh       |  25 +++++
 t/t4202-log.sh                     |  86 ++++++++++++++-
 t/t7810-grep.sh                    |  41 ++++---
 t/t7812-grep-icase-non-ascii.sh    |   4 +-
 t/t7813-grep-icase-iso.sh          |  11 +-
 t/t7814-grep-recurse-submodules.sh | 215 +++++++++++++++++++++++--------------
 t/test-lib.sh                      |   3 +-
 16 files changed, 608 insertions(+), 169 deletions(-)
 create mode 100755 t/perf/p7820-grep-engines.sh
-- 
2.11.0
Next: Ævar Arnfjörð Bjarmason
Message 1 of 22 in “PCRE v1 improvements & PCRE v2 support”
  1. 00/18 PCRE v1 improvements & PCRE v2 supportÆvar Arnfjörð Bjarmason, Apr 20, 2017
  2. 01/18 grep: amend submodule recursion test in preparation for rx engine testingÆvar Arnfjörð Bjarmason, Apr 20, 2017
  3. Brandon WilliamsApr 20, 2017
  4. 02/18 grep: add tests for grep pattern types being passed to submodulesÆvar Arnfjörð Bjarmason, Apr 20, 2017
  5. 03/18 grep: submodule-related case statements should die if new fields are addedÆvar Arnfjörð Bjarmason, Apr 20, 2017
  6. Brandon WilliamsApr 20, 2017
  7. Jeff KingApr 20, 2017
  8. 04/18 grep: remove redundant regflags assignment under PCREÆvar Arnfjörð Bjarmason, Apr 20, 2017
  9. 05/18 Makefile & configure: reword outdated comment about PCREÆvar Arnfjörð Bjarmason, Apr 20, 2017
  10. 06/18 grep: add a test for backreferences in PCRE patternsÆvar Arnfjörð Bjarmason, Apr 20, 2017
  11. 08/18 log: add -P as a synonym for --perl-regexpÆvar Arnfjörð Bjarmason, Apr 20, 2017
  12. 09/18 grep & rev-list doc: stop promising libpcre for --perl-regexpÆvar Arnfjörð Bjarmason, Apr 20, 2017
  13. 10/18 grep: make grep.patternType=[pcre|pcre1] a synonym for "perl"Ævar Arnfjörð Bjarmason, Apr 20, 2017
  14. 11/18 test-lib: rename the LIBPCRE prerequisite to PCREÆvar Arnfjörð Bjarmason, Apr 20, 2017
  15. 12/18 grep: change the internal PCRE macro names to be PCRE1Ævar Arnfjörð Bjarmason, Apr 20, 2017
  16. 13/18 grep: change the internal PCRE code & header names to be PCRE1Ævar Arnfjörð Bjarmason, Apr 20, 2017
  17. 07/18 log: add exhaustive tests for pattern style options & configÆvar Arnfjörð Bjarmason, Apr 20, 2017
  18. 14/18 perf: add a performance comparison test of grep -E and -PÆvar Arnfjörð Bjarmason, Apr 20, 2017
  19. 18/18 Makefile & configure: make PCRE v2 the default PCRE implementationÆvar Arnfjörð Bjarmason, Apr 20, 2017
  20. 16/18 grep: add support for PCRE v2Ævar Arnfjörð Bjarmason, Apr 20, 2017
  21. 17/18 grep: remove support concurrent use of both PCRE v1 & v2Ævar Arnfjörð Bjarmason, Apr 20, 2017
  22. 15/18 grep: add support for the PCRE v1 JIT APIÆvar Arnfjörð Bjarmason, Apr 20, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.