[SERVER-48232] PCRE is not maintained anymore, upgrade to PCRE2 Created: 14/May/20  Updated: 29/Oct/23  Resolved: 27/Jun/22

Status: Closed
Project: Core Server
Component/s: Internal Code, Querying
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Billy Donahue Assignee: Jennifer Peshansky (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
Related
related to SERVER-60100 Estimate cost of migrating to PCRE2 Closed
Sprint: 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
Participants:

 Description   

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:

src/mongo/db/matcher/expression_leaf.cpp:
class LeafMatchExpression

src/mongo/db/matcher/schema/expression_internal_schema_allowed_properties.h
struct Pattern

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


Generated at Thu Feb 08 05:16:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.