https://bugzilla.redhat.com/show_bug.cgi?id=1851334
Bug ID: 1851334
Summary: perl-Marpa-XS-1.008000-27.fc33 FTBFS with Perl 5.32:
Constants from lexical variables potentially modified
elsewhere are no longer permitted at
/builddir/build/BUILD/Marpa-XS-1.008000/blib/lib/Marpa
/XS/Internal.pm line 93.
Product: Fedora
Version: rawhide
Status: NEW
Component: perl-Marpa-XS
Assignee: jplesnik(a)redhat.com
Reporter: ppisar(a)redhat.com
QA Contact: extras-qa(a)fedoraproject.org
CC: jplesnik(a)redhat.com, lkundrak(a)v3.sk,
perl-devel(a)lists.fedoraproject.org
Target Milestone: ---
Classification: Fedora
perl-Marpa-XS-1.008000-27.fc33 fails to build in Fedora 33 with Perl 5.32
because a test fails:
# Failed test 'use Marpa::XS;'
# at t/00-load.t line 27.
# Tried to use 'Marpa::XS'.
# Error: Constants from lexical variables potentially modified elsewhere
are no longer permitted at
/builddir/build/BUILD/Marpa-XS-1.008000/blib/lib/Marpa/XS/Internal.pm line 93.
# BEGIN failed--compilation aborted at
/builddir/build/BUILD/Marpa-XS-1.008000/blib/lib/Marpa/XS/Grammar.pm line 64.
# Compilation failed in require at
/builddir/build/BUILD/Marpa-XS-1.008000/blib/lib/Marpa/XS.pm line 101.
# Compilation failed in require at t/00-load.t line 27.
# BEGIN failed--compilation aborted at t/00-load.t line 27.
Bailout called. Further testing stopped: Could not load Marpa::XS
FAILED--Further testing stopped: Could not load Marpa::XS
That's because lib/Marpa/XS/Internal.pm does:
if ( $field !~ s/\A=//xms ) {
$offset++;
}
if ( $field =~ / \A ( [^=]* ) = ( [0-9+-]* ) \z/xms ) {
$field = $1;
$offset = $2 + 0;
}
Marpa::XS::exception("Unacceptable field name: $field")
if $field =~ /[^A-Z0-9_]/xms;
my $field_name = $prefix . $field;
→ *{$field_name} = sub () {$offset};
and this usage of $offset variable is forbidden since Perl 5.32. Splain
explanation:
$ perl -Mblib -e 'use Marpa::XS' 2>&1 | splain
Constants from lexical variables potentially modified elsewhere are no longer
permitted at
/home/test/fedora/perl-Marpa-XS/Marpa-XS-1.008000/blib/lib/Marpa/XS/Internal.pm
line 93 (#1)
(F) You wrote something like
my $var;
$sub = sub () { $var };
but $var is referenced elsewhere and could be modified after the sub
expression is evaluated. Either it is explicitly modified elsewhere
($var = 3) or it is passed to a subroutine or to an operator like
printf or map, which may or may not modify the variable.
Traditionally, Perl has captured the value of the variable at that
point and turned the subroutine into a constant eligible for inlining.
In those cases where the variable can be modified elsewhere, this
breaks the behavior of closures, in which the subroutine captures
the variable itself, rather than its value, so future changes to the
variable are reflected in the subroutine's return value.
This usage was deprecated, and as of Perl 5.32 is no longer allowed,
making it possible to change the behavior in the future.
If you intended for the subroutine to be eligible for inlining, then
make sure the variable is not referenced elsewhere, possibly by
copying it:
my $var2 = $var;
$sub = sub () { $var2 };
If you do want this subroutine to be a closure that reflects future
changes to the variable that it closes over, add an explicit return:
my $var;
$sub = sub () { return $var };
--
You are receiving this mail because:
You are on the CC list for the bug.