Bug 2280109

Summary: Puppet regsubst/Regexp.new incompatibility with Ruby 3.3
Product: [Fedora] Fedora Reporter: Ed Marshall <esm>
Component: puppetAssignee: Breno <brandfbb>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 40CC: brandfbb, ekohlvan, igor.raits, terje.rosten
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
URL: https://github.com/puppetlabs/puppet-enterprise_issues/issues/8#issuecomment-2035524085
Whiteboard:
Fixed In Version: puppet-8.10.0-1.fc43 puppet-8.10.0-1.fc42 Doc Type: ---
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2025-04-15 19:07:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Ed Marshall 2024-05-11 23:30:19 UTC
Puppet's regsubst function (specifically, the pattern-as-string signature variant) breaks with Ruby 3.3:
- https://github.com/puppetlabs/puppet-enterprise_issues/issues/8#issuecomment-2035524085 (re: not upgrading PE to Ruby 3.3 specifically because of this)
- vaguely related: https://github.com/puppetlabs/puppet/issues/9302

On the ruby side, the third argument to Regexp.new (encoding) was deprecated in Ruby 3.2, and removed completely in 3.3:
- https://bugs.ruby-lang.org/issues/18797

For my environment, the "fix" was to edit puppet/functions/regsubst.rb#regsubst_string and simply remove the encoding argument to Regexp.compile, but that's obviously incorrect; a real patch here would probably do a switch on the encoding enum and either forcibly set the string encoding, or add Regexp::NOENCODING to re_flags in the 'N' case.



Reproducible: Always

Steps to Reproduce:
Use the string variant of regsubst with puppet in Fedora 40.
Actual Results:  
It fails with:

Error while evaluating a Resource Statement, Evaluation Error: Error while evaluating a Function Call, wrong number of arguments (given 3, expected 1..2)

Expected Results:  
No error, manifest compilation completes as expected.

Comment 1 Fedora Update System 2025-04-15 17:45:26 UTC
FEDORA-2025-43731b849e (puppet-8.10.0-1.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-43731b849e

Comment 2 Fedora Update System 2025-04-15 19:07:09 UTC
FEDORA-2025-43731b849e (puppet-8.10.0-1.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 3 Fedora Update System 2025-04-15 21:19:05 UTC
FEDORA-2025-13f2e70c1c (puppet-8.10.0-1.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-13f2e70c1c

Comment 4 Fedora Update System 2025-04-16 01:04:20 UTC
FEDORA-2025-13f2e70c1c has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-13f2e70c1c`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-13f2e70c1c

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Fedora Update System 2025-04-24 03:38:59 UTC
FEDORA-2025-13f2e70c1c (puppet-8.10.0-1.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.