MDEV-38046 Make func_regexp_pcre tolerant to PCRE2 offset change #4429
+3
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PCRE2 10.47 reports the invalid escape in 'A\q' at offset 3 instead of 2. Update the expected result and add a --replace_regex in the test so the suite passes with both older and newer PCRE2 versions.
Description
PCRE2 10.47 tightened/improved its error reporting and now points one character further into the pattern when it encounters an invalid escape such as
\q. The testmain.func_regexp_pcrewas asserting on the literal error text coming back from PCRE2:With PCRE2 10.47 this becomes:
This made the test brittle across PCRE2 versions.
This patch does two things:
mysql-test/main/func_regexp_pcre.resultto the newer wording (offset 3) produced by PCRE2 10.47.--replace_regex /offset 2/offset 3/tomysql-test/main/func_regexp_pcre.testright before the failing statement, so older PCRE2 that still reportsoffset 2will be normalized tooffset 3during test run.That way the same test can pass with both older and newer PCRE2 without changing server code.
There should be no side effects for runtime behaviour: this only relaxes the test harness around version-dependent diagnostic text.
Release Notes
Adjusts regex test to accept PCRE2 10.47's updated error offset message.
How can this PR be tested?
Use a system with PCRE2 10.47 (e.g. Debian experimental which currently ships it).
Build MariaDB server against that PCRE2.
Run:
If the test passes both with older PCRE2 (offset 2) and with 10.47+ (offset 3), the change works.
Basing the PR against the correct MariaDB version
mainbranch.PR quality check