Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-48232

PCRE is not maintained anymore, upgrade to PCRE2

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: Internal Code, Querying
    • Labels:
    • QE 2022-04-04, QE 2022-03-21, QE 2022-04-18, QE 2022-05-02, QE 2022-05-16, QE 2022-05-30, QE 2022-06-13, QE 2022-06-27, QE 2022-07-11

      SERVER-48116 fixed a startup bug in the venerable C++ bindings for the PCRE library. We can keep going with a local patch, but that change cannot be upstreamed because the PCRE project is not even taking bug fixes anymore (see https://bugs.exim.org/show_bug.cgi?id=2575 ).

      The very strong recommendation from the PCRE author is to migrate to the successor, PCRE2, which is under active maintenance. It is compatible, but not bug-for-bug compatible. It provides a similar C API as PCRE, but does not ship with a C++ wrapper. C++ wrappers for PCRE2 are available from third parties, reflecting some diversity of style. Some are quite featureful, e.g., https://github.com/jpcre2/jpcre2 .

      The PHP project made this transition in 2018, and generated some compatibility notes. The main difference is that invalid regexes are more zealously rejected:

      We would have to consider what in the server could change in such an upgrade.
      The pcrecpp.h header is included in only a few files. Of those, we can eliminate places that are internal, testing, or hardcoded regexes. Or places that only need quoteMeta or other supporting functions. Those can all be adjusted if necessary. All that's left is two sites:

      class LeafMatchExpression

      struct Pattern

      So query team would be best able to evaluate the impact of the upgrade.

            jennifer.peshansky@mongodb.com Jennifer Peshansky (Inactive)
            billy.donahue@mongodb.com Billy Donahue
            0 Vote for this issue
            14 Start watching this issue