Skip to content

T7557: Use PCRE2#16

Merged
dmbaturin merged 1 commit intovyos:currentfrom
sarthurdev:T7557
Jun 23, 2025
Merged

T7557: Use PCRE2#16
dmbaturin merged 1 commit intovyos:currentfrom
sarthurdev:T7557

Conversation

@sarthurdev
Copy link
Member

Change Summary

PCRE3 is deprecated, use PCRE2.

Required for trixie image build.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Other (please describe):

Related Task(s)

Related PR(s)

Proposed changes

How to test

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

@sarthurdev sarthurdev requested a review from dmbaturin June 21, 2025 21:12
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the code to use PCRE2 instead of the deprecated PCRE3, ensuring compatibility with the trixie image build.

  • Updated build flags in Makefile.am files (tests and src) to use PCRE2.
  • Replaced PCRE3-specific header and API usage with PCRE2 in source files.
  • Updated debian/control and configure.ac to use the PCRE2 development libraries.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/Makefile.am Updated compiler/linker flags to use PCRE2.
src/ipaddrcheck_functions.h Replaced pcre.h with pcre2.h and defined code unit width.
src/ipaddrcheck_functions.c Updated API calls from PCRE3 to PCRE2.
src/Makefile.am Updated linking flags to use PCRE2 libraries.
debian/control Changed build dependencies from PCRE3 to PCRE2.
configure.ac Removed PCRE3 header check and added PCRE2 module.

rc = pcre_exec(re, NULL, str, strlen(str), 0, 0, offsets, 1);
pcre2_match_data *match = pcre2_match_data_create_from_pattern(re, NULL);

rc = pcre2_match(re, (PCRE2_SPTR)str, strlen(str), 0, 0, match, NULL);
Copy link

Copilot AI Jun 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider casting the result of strlen(str) to PCRE2_SIZE (e.g., (PCRE2_SIZE)strlen(str)) to match the expected type for the length parameter in pcre2_match.

Suggested change
rc = pcre2_match(re, (PCRE2_SPTR)str, strlen(str), 0, 0, match, NULL);
rc = pcre2_match(re, (PCRE2_SPTR)str, (PCRE2_SIZE)strlen(str), 0, 0, match, NULL);

Copilot uses AI. Check for mistakes.
Copy link
Member

@dmbaturin dmbaturin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It builds and passes all tests, so I have no objections. We certainly have no choice but to upgrade to PCRE2 everywhere if we plan to base the next big release on Trixie.

@dmbaturin dmbaturin merged commit 6075d3d into vyos:current Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants