Hi, 
debhelper-devel ML doesn't exist anymore, please let me know if I
should report this in other place . 

I can't build debhelper on Centos epel 8, which have Perl 5.26.3

fedpkg clone debhelper
cd debhelper
fedpkg srpm && mock -r epel-8-x86_64  --no-clean --rebuild debhelper-
13.3.4-1.fc35.src.rpm 

and in epel8 build ends with
"Initialization of state variables in list context currently forbidden
at /builddir/build/BUILD/debhelper-
13.3.4/lib/Debian/Debhelper/Dh_Lib.pm line 2021, near");" "

Petr wrote : 
perl has a "splain" tool which explains the compiler errors and
warnings:

$ splain
/usr/bin/splain: Reading from STDIN
Initialization of state variables in list context currently forbidden
at /home/test/fedora/debhelper/debhelper-
13.3.4/lib/Debian/Debhelper/Dh_Lib.pm line 2021, near ");"
Initialization of state variables in list context currently forbidden
at
        /home/test/fedora/debhelper/debhelper-
13.3.4/lib/Debian/Debhelper/Dh_Lib.pm line 2021, near ");" (#1)
    (F) state only permits initializing a single scalar variable, in
scalar
    context.  So state $a = 42 is allowed, but not state ($a) = 42.  To
apply
    state semantics to a hash or array, store a hash or array reference
in a
    scalar variable.

What do we have at the line 2021?:

        state %rrr = map { $_ => 1 } split(' ', $rrr_env);

That's it. perl 5.26.3 does not support "state" declaration for hashes
(%err).
Here is a one-line reproducer:

$ perl -e 'use v5.24; sub foo {state %rrr = map { $_ => 1 } split(q{ },
q{});}'
Initialization of state variables in list context currently forbidden
at -e line 1, near ");"
Execution of -e aborted due to compilation errors.

Which can be reduced to:

$ perl -e 'use v5.24; state %rrr = ();'
Initialization of state variables in list context currently forbidden
at -e line 1, near ");"
Execution of -e aborted due to compilation errors.

Please note that the "use v5.24;" statement is taken from debhelper
code.
It's obviously an upstream bug. The code is not valid syntax for perl
5.24.

The state support for non-scalar types was implemented in Perl 5.28.0
(see
"perldoc perl5280delta" command output):

  Initialisation of aggregate state variables
    A persistent lexical array or hash variable can now be initialized,
by
    an expression such as "state @a = qw(x y z)". Initialization of a
list
    of persistent lexical variables is still not possible.

You should reach out debhelper upstream to correct the "use v5.24;"
into "use
v5.28;". Or you can ask them to refactor the code to support perl 5.26.



Thanks ,
-- 
Sérgio M. B.

Reply via email to