Skip to content

Conversation

@aquilamacedo
Copy link

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.

  • The Jira issue number for this PR is: MDEV-38046

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 test main.func_regexp_pcre was asserting on the literal error text coming back from PCRE2:

ERROR 42000: Regex error 'unrecognized character follows \ at offset 2'

With PCRE2 10.47 this becomes:

ERROR 42000: Regex error 'unrecognized character follows \ at offset 3'

This made the test brittle across PCRE2 versions.

This patch does two things:

  1. Updates mysql-test/main/func_regexp_pcre.result to the newer wording (offset 3) produced by PCRE2 10.47.
  2. Adds a --replace_regex /offset 2/offset 3/ to mysql-test/main/func_regexp_pcre.test right before the failing statement, so older PCRE2 that still reports offset 2 will be normalized to offset 3 during 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?

  1. Use a system with PCRE2 10.47 (e.g. Debian experimental which currently ships it).

  2. Build MariaDB server against that PCRE2.

  3. Run:

    mysql-test-run.pl main.func_regexp_pcre

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

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@svoj svoj added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Nov 10, 2025
@NWilson
Copy link

NWilson commented Nov 10, 2025

🚀 Looks good to me as PCRE2 maintainer.

(And - my thanks again for coping with this bit of churn from us. I try very hard for PCRE2 releases to be drop-in compatible with minimal behavioural changes, and I'm sorry this impacted you.)

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.
@vuvova vuvova enabled auto-merge (rebase) November 12, 2025 09:40
@vuvova vuvova merged commit eb5712b into MariaDB:10.6 Nov 12, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

4 participants