Package: cod-tools Version: 3.10.0+dfsg-1 Severity: important User: debian-p...@lists.debian.org Usertags: perl-5.40-transition Tags: patch
This package fails its autopkgtest checks with Perl 5.40 (currently in experimental.) https://ci.debian.net/packages/c/cod-tools/unstable/amd64/50041232/ 69s /tmp/autopkgtest-lxc.xs3evp70/downtmp/autopkgtest_tmp/tests/cases/cif2cod_001.inp: FAILED: 69s 0a1 69s > Attempt to call undefined import method with arguments ("cif_cell_contents") via package "COD::CIF::Data::CellContents" (Perhaps you forgot to load the package?) at <script_name> line <line_no>. 69s /tmp/autopkgtest-lxc.xs3evp70/downtmp/autopkgtest_tmp/tests/cases/cif2cod_002.inp: FAILED: 69s 0a1 69s > Attempt to call undefined import method with arguments ("cif_cell_contents") via package "COD::CIF::Data::CellContents" (Perhaps you forgot to load the package?) at <script_name> line <line_no>. 70s /tmp/autopkgtest-lxc.xs3evp70/downtmp/autopkgtest_tmp/tests/cases/cif2cod_003.inp: FAILED: [...] The test failures are also visible in the build log, but the build still succeeds. It looks like the subdirectory make invocations in the main Makefile lack error checking. https://perl.debian.net/rebuild-logs/perl-5.40/cod-tools_3.10.0%2Bdfsg-1/cod-tools_3.10.0%2Bdfsg-1%2Bb2_amd64-2024-08-03T07%3A34%3A21Z.build Some information on this new warning can be found at https://metacpan.org/dist/perl/view/pod/perldiag.pod#Missing-comma-after-first-argument-to-return I think this is a case of mutually recursive modules where the assignment to @EXPORT_OK happens too late at run time while it's needed at compile time. See the "Playing Safe" section in Exporter(3perl). Tentative patch attached, this fixes it for me. -- Niko Tyni nt...@debian.org
From: Niko Tyni <nt...@debian.org> Date: Tue, 6 Aug 2024 20:38:09 +0100 X-Dgit-Generated: 3.10.0+dfsg-1 5a1458da5fc72e0d208dc9baa32a05fe79a92403 Subject: Fix Exporter usage with mutually recursive modules This fixes warnings with Perl 5.40: Attempt to call undefined import method with arguments ("cif_cell_contents") via package "COD::CIF::Data::CellContents" (Perhaps you forgot to load the package?) See the "Playing Safe" section in Exporter(3perl) and https://metacpan.org/dist/perl/view/pod/perldelta.pod#Calling-the-import-method-of-an-unknown-package-produces-a-warning --- diff --git a/src/lib/perl5/COD/CIF/Data/CellContents.pm b/src/lib/perl5/COD/CIF/Data/CellContents.pm index 27d7ced..090d6b7 100644 --- a/src/lib/perl5/COD/CIF/Data/CellContents.pm +++ b/src/lib/perl5/COD/CIF/Data/CellContents.pm @@ -14,6 +14,17 @@ package COD::CIF::Data::CellContents; use strict; use warnings; + +BEGIN { +require Exporter; +our @ISA = qw( Exporter ); +our @EXPORT_OK = qw( + cif_cell_contents + atomic_composition + print_composition +); +} + use COD::AtomProperties; use COD::Fractional qw( symop_ortho_from_fract ) ; use COD::Spacegroups::Symop::Parse qw( symop_from_string @@ -26,14 +37,6 @@ use COD::CIF::Data::AtomList qw( atom_array_from_cif ); use COD::CIF::Data::EstimateZ qw( cif_estimate_z ); use COD::CIF::Data::SymmetryGenerator qw( symop_generate_atoms ); -require Exporter; -our @ISA = qw( Exporter ); -our @EXPORT_OK = qw( - cif_cell_contents - atomic_composition - print_composition -); - $::format = "%g"; sub atomic_composition( $$$@ ); diff --git a/src/lib/perl5/COD/CIF/Data/EstimateZ.pm b/src/lib/perl5/COD/CIF/Data/EstimateZ.pm index 1f82159..42f1349 100644 --- a/src/lib/perl5/COD/CIF/Data/EstimateZ.pm +++ b/src/lib/perl5/COD/CIF/Data/EstimateZ.pm @@ -16,6 +16,15 @@ package COD::CIF::Data::EstimateZ; use strict; use warnings; +BEGIN { +require Exporter; +our @ISA = qw( Exporter ); +our @EXPORT_OK = qw( + cif_estimate_z + cif_estimate_z_from_formula +); +} + use COD::Cell qw( cell_volume ); use COD::CIF::Data qw( get_cell get_symmetry_operators ); use COD::Precision qw( unpack_cif_number ); @@ -29,13 +38,6 @@ use COD::Spacegroups::Symop::Parse qw( symop_from_string use COD::CIF::Data::SymmetryGenerator qw( symop_generate_atoms ); use COD::CIF::Data::CellContents qw( cif_cell_contents ); -require Exporter; -our @ISA = qw( Exporter ); -our @EXPORT_OK = qw( - cif_estimate_z - cif_estimate_z_from_formula -); - # Avogadro number in "CIF unit" scale: my $N = 0.1 * 6.0221418;