Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Sep 11, 2025

This PR updates the xrootd-cmstfc repository to support PCRE2, replacing the legacy PCRE library with the modern PCRE2 API. This migration ensures compatibility with modern systems where legacy PCRE is deprecated or unavailable.

Changes Made

CMake Configuration

  • Added new FindPcre2.cmake module to locate PCRE2 library and headers
  • Updated CMakeLists.txt to use PCRE2 instead of PCRE
  • Removed obsolete FindPcre.cmake configuration

Source Code Migration

  • Updated header includes from <pcre.h> to <pcre2.h> with proper code unit width definition
  • Migrated data types from pcre * to pcre2_code *
  • Replaced PCRE function calls with PCRE2 equivalents:
    • pcre_compile()pcre2_compile()
    • pcre_exec()pcre2_match()
    • pcre_free()pcre2_code_free() and pcre2_match_data_free()
  • Updated error handling to use PCRE2's error number/offset pattern
  • Implemented PCRE2 match data structures for proper memory management

API Differences Handled

  • PCRE2 requires explicit code unit width definition (PCRE2_CODE_UNIT_WIDTH 8)
  • Match results now use pcre2_match_data structures instead of raw arrays
  • Updated constant names (e.g., PCRE_ANCHOREDPCRE2_ANCHORED)
  • Proper cleanup of match data structures to prevent memory leaks

Verification

  • Clean build completes successfully with PCRE2
  • Library properly links to libpcre2-8
  • Module loads correctly and exports expected symbols
  • Maintains backward compatibility with existing XRootD plugin interface

This migration ensures the project remains maintainable and compatible with modern Linux distributions that are phasing out legacy PCRE in favor of PCRE2.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@Copilot Copilot AI changed the title [WIP] Update the repo to support pcre2. Changes will need to be made to the cmake build files as well as the src files. Migrate from PCRE to PCRE2 API Sep 11, 2025
@Copilot Copilot AI requested a review from djw8605 September 11, 2025 18:29
Copilot finished work on behalf of djw8605 September 11, 2025 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants