Bug 2305082

Summary: perl-Regexp-Pattern-License warns without perl-re-engine-RE2
Product: [Fedora] Fedora Reporter: Jens Petersen <petersen>
Component: perl-Regexp-Pattern-LicenseAssignee: Sandro Mani <manisandro>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 41CC: denis.arnaud_fedora, manisandro, ppisar
Target Milestone: ---Keywords: Patch
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: perl-Regexp-Pattern-License-3.11.1-6.fc40 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-08-24 01:53:05 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 Jens Petersen 2024-08-15 06:53:31 UTC
Recently re2 got a SONAME bump believe, so perl-Regexp-Pattern-License
needs to be rebuilt against it.

I tested it locally and that unbroke licensecheck for me.

Reproducible: Always

Steps to Reproduce:
1. run licensecheck
Actual Results:  
Attempt to call undefined import method with arguments ("-strict" ...) via package "re::engine::RE2" (Perhaps you forgot to load the package?) at /usr/share/perl5/vendor_perl/Regexp/Pattern/License.pm line 15550.

Expected Results:  
No error

Rebuild is also needed for F41

Comment 1 Petr Pisar 2024-08-15 08:25:49 UTC
Rebuild won't help. The problem is that licensecheck somehow re::engine::RE2 without declaring the RPM dependency on it. I will look where the use is.

Comment 2 Petr Pisar 2024-08-15 08:35:21 UTC
This is a bug in Regexp/Pattern/License.pm:

my $CAN_RE2;
                
BEGIN {             
    eval { require re::engine::RE2 };
    $CAN_RE2 = $@ ? '' : 1;
}                   
[...]
            if ( $args{engine} eq 'RE2' ) {
                unless ($CAN_RE2) {
                    die
                        'cannot use regexp engine "RE2": Module "re::engine::RE2" is not installed';
                }
                    
                BEGIN {
→                   re::engine::RE2->import(
                        -strict  => 1,
                        -max_mem => 8 << 21,
                    );
                }
                return qr/$pat/;
            }

It optimizes re::engine::RE2 initialization with a BEGIN block, but the initialization does not take $CAN_RE2 result into account. Obviously the dependency on re::engine::RE2 was intended to be optional.

Comment 3 Petr Pisar 2024-08-15 08:43:00 UTC
A fix is available upstream at <https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=1078071;filename=only-import-reenginere2-when-available.patch;msg=10>.

This bug is not related to re2 update. It's an old bug which became visible with perl-5.40.0.

Comment 4 Petr Pisar 2024-08-15 08:44:27 UTC
A reproducer:

$ perl -e 'use Regexp::Pattern::License;'
Attempt to call undefined import method with arguments ("-strict" ...) via package "re::engine::RE2" (Perhaps you forgot to load the package?) at /usr/share/perl5/vendor_perl/Regexp/Pattern/License.pm line 15550.

Comment 5 Denis Arnaud 2024-08-15 08:54:16 UTC
Thanks for the heads up!

In parallel to what Petr is doing, I was able to rebuild that package on Fedora Rawhide (F42), and the Fedora update is now available: https://bodhi.fedoraproject.org/updates/FEDORA-2024-05f8d22295

At this time, I was not able to create an update for Fedora 41 (IIUC, it is being branched/composed/synchronized right now; we may have to trigger a build on F41 specifically once that option will become available).

Comment 6 Petr Pisar 2024-08-15 09:07:36 UTC
I'm finished with the analysis. It's up to regular maintainer to apply the fix.

Comment 7 Denis Arnaud 2024-08-15 09:40:33 UTC
* Fedora update for Rawhide (F42): https://bodhi.fedoraproject.org/updates/FEDORA-2024-05f8d22295

Comment 8 Jens Petersen 2024-08-15 13:27:25 UTC
It should be possible to build for F41 already - branching is already over AFAIK.

Comment 9 Denis Arnaud 2024-08-15 14:02:36 UTC
Indeed, I was able to build for Fedora 41: https://koji.fedoraproject.org/koji/buildinfo?buildID=2530324
But when trying to create a Fedora update, I get the following error:
> Builds : Cannot manually create updates for a Release which is not composed by Bodhi. Read the 'Automatic updates' page in Bodhi docs about this error.

Comment 10 Petr Pisar 2024-08-15 14:05:47 UTC
Bodhi updates are created automatically for F41 the same way as for F42. See <https://bodhi.fedoraproject.org/updates/FEDORA-2024-1a8b91da1b>.

However, the builds are pointless because a simple rebuild won't fix the reported issue.

Comment 11 Denis Arnaud 2024-08-15 14:06:30 UTC
(In reply to Denis Arnaud from comment #9)
> Indeed, I was able to build for Fedora 41:
> https://koji.fedoraproject.org/koji/buildinfo?buildID=2530324
> But when trying to create a Fedora update, I get the following error:
> > Builds : Cannot manually create updates for a Release which is not composed by Bodhi. Read the 'Automatic updates' page in Bodhi docs about this error.

My bad: the update was eventually created automatically by Bodhi (I checked for an update in Bodhi too early, and it was not there yet): https://bodhi.fedoraproject.org/updates/FEDORA-2024-1a8b91da1b

Comment 12 Denis Arnaud 2024-08-15 14:11:19 UTC
(In reply to Petr Pisar from comment #10)
> Bodhi updates are created automatically for F41 the same way as for F42. See
> <https://bodhi.fedoraproject.org/updates/FEDORA-2024-1a8b91da1b>.
> 
> However, the builds are pointless because a simple rebuild won't fix the
> reported issue.

Focusing on the rebuild, I overlooked your messages stating that RE2 was not the cause of the reported issue. I get it now. Even though pointless, the rebuild will not harm, hopefully :)
Let's keep that bug open then.

Comment 13 Fedora Update System 2024-08-15 17:12:13 UTC
FEDORA-2024-3dc7adf51b (perl-Regexp-Pattern-License-3.11.1-6.fc40) has been submitted as an update to Fedora 40.
https://bodhi.fedoraproject.org/updates/FEDORA-2024-3dc7adf51b

Comment 14 Fedora Update System 2024-08-16 02:07:38 UTC
FEDORA-2024-3dc7adf51b has been pushed to the Fedora 40 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-3dc7adf51b`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-3dc7adf51b

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

Comment 15 Fedora Update System 2024-08-24 01:53:05 UTC
FEDORA-2024-3dc7adf51b (perl-Regexp-Pattern-License-3.11.1-6.fc40) has been pushed to the Fedora 40 stable repository.
If problem still persists, please make note of it in this bug report.