Control: found -1 0.0.9-1
Control: tag -1 patch

On Tue, Aug 01, 2023 at 10:25:04PM +0300, Niko Tyni wrote:
> Package: libstring-license-perl
> Version: 0.0.2-1
> Severity: important
> Tags: ftbfs trixie sid
> Forwarded: https://rt.cpan.org/Public/Bug/Display.html?id=148507
> User: debian-p...@lists.debian.org
> Usertags: perl-5.38-transition
> Control: affects -1 licensecheck
> 
> Some modules in this package report syntax errors with Perl 5.38
> (currently in experimental.)
> 
> This also makes the test suite fail, so the package fails to build
> from source.
> 
> When this is fixed, please file a bug on the perl package
> to add a Breaks entry for earlier versions so that partial
> upgrades cannot end up with a broken combination.

As seen in

  
http://perl.debian.net/rebuild-logs/perl-5.38-throwaway/libstring-license-perl_0.0.9-1/libstring-license-perl_0.0.9-1_amd64-2023-08-05T15:35:07Z.build

this has now turned into

  Class :isa attribute requires a class but "String::License::Naming" is not 
one at 
/home/ntyni/tmp/libstring-license-perl/blib/lib/String/License/Naming/Custom.pm 
line 64.

This looks like a bug in the current (still experimental) Perl
core implementation of the class feature.  I've just filed
https://github.com/Perl/perl5/issues/21332 about it.

Working around that reveals new errors:

  Bareword "__CLASS__" not allowed while "strict subs" in use at 
lib/String/License.pm line 59.
  Attempt to access disallowed key '__ANON__' in a restricted hash at 
lib/String/License.pm line 64.

String::License using the __CLASS__ keyword, which was not yet implemented
in the core version for 5.38. A quick fix is to just use Object::Pad
instead of Feature::Compat::Class, which fixes the other error as well.

Doing that shows one more instance of the first issue:

  Class :isa attribute requires a class but "String::License::Naming" is not 
one at 
/home/ntyni/tmp/libstring-license-perl/blib/lib/String/License/Naming/SPDX.pm 
line 57.

The attached patch has workarounds for all of these. It passes the
test suite for me on both Perl 5.36 (Debian sid) and 5.38 (Debian
experimental.)

Hope this helps,
-- 
Niko Tyni   nt...@debian.org
>From c266d3f0983eaf2155de693bf5d0efb90bfc1145 Mon Sep 17 00:00:00 2001
From: Niko Tyni <nt...@debian.org>
Date: Mon, 7 Aug 2023 18:32:10 +0100
Subject: [PATCH] Workarounds for the class feature on Perl 5.38

__CLASS__ is not implemented in 5.38 yet, so we need to use Object::Pad
for String::License instead of Feature::Compat::Class.

Hierarchical naming currently has a quirk with :isa(), see
https://github.com/Perl/perl5/issues/21332

Bug-Debian: https://bugs.debian.org/1042847
---
 lib/String/License.pm               | 2 +-
 lib/String/License/Naming/Custom.pm | 1 +
 lib/String/License/Naming/SPDX.pm   | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/String/License.pm b/lib/String/License.pm
index dd3d9aa..cdf27c2 100644
--- a/lib/String/License.pm
+++ b/lib/String/License.pm
@@ -4,7 +4,7 @@ use warnings;
 use feature qw(signatures);
 no warnings qw(experimental::signatures);
 
-use Feature::Compat::Class 0.04;
+use Object::Pad;
 
 =head1 NAME
 
diff --git a/lib/String/License/Naming/Custom.pm b/lib/String/License/Naming/Custom.pm
index 28e2941..b00de17 100644
--- a/lib/String/License/Naming/Custom.pm
+++ b/lib/String/License/Naming/Custom.pm
@@ -59,6 +59,7 @@ use Log::Any   ();
 use List::Util qw(uniq);
 use Regexp::Pattern::License 3.4.0;
 
+use String::License::Naming ();
 use namespace::clean;
 
 class String::License::Naming::Custom : isa(String::License::Naming);
diff --git a/lib/String/License/Naming/SPDX.pm b/lib/String/License/Naming/SPDX.pm
index b40ddf6..2b64598 100644
--- a/lib/String/License/Naming/SPDX.pm
+++ b/lib/String/License/Naming/SPDX.pm
@@ -54,6 +54,7 @@ use Regexp::Pattern::License 3.4.0;
 
 use namespace::clean;
 
+use String::License::Naming ();
 class String::License::Naming::SPDX : isa(String::License::Naming);
 
 field $log;
-- 
2.39.1

Reply via email to