Control: tag -1 patch

On Tue, Aug 06, 2024 at 06:39:00PM +0300, Niko Tyni wrote:
> Package: libregexp-pattern-license-perl
> Version: 3.11.0-1
> Severity: important
> User: debian-p...@lists.debian.org
> Usertags: perl-5.40-transition
> 
> This module warns on usage with Perl 5.40 (currently in experimental) when
> libre-engine-re2-perl (which is not a dependency, just a recommendation)
> is not installed.
> 
>   $ 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/Regexp/Pattern/License.pm line 15550.
> 
> This causes an autopkgtest regression and also makes licensecheck
> fail its test suite, hence the severity.

Patch attached, this fixes it for me.
-- 
Niko
From: Niko Tyni <nt...@debian.org>
Date: Wed, 14 Aug 2024 23:14:58 +0300
Subject: Only import re::engine::RE2 when available

The BEGIN {} block is executed unconditionally, so it would call import()
even when require() failed.

Flagged by a new warning in Perl 5.40.

Bug-Debian: https://bugs.debian.org/1078071

---

diff --git a/lib/Regexp/Pattern/License.pm b/lib/Regexp/Pattern/License.pm
index ee42254..86ef985 100644
--- a/lib/Regexp/Pattern/License.pm
+++ b/lib/Regexp/Pattern/License.pm
@@ -15550,7 +15550,7 @@ for my $id (@_OBJECTS) {
 					re::engine::RE2->import(
 						-strict  => 1,
 						-max_mem => 8 << 21,
-					);
+					) if $CAN_RE2;
 				}
 				return qr/$pat/;
 			}

Reply via email to