Skip Menu |

This queue is for tickets about the Module-Metadata CPAN distribution.

Maintainer(s)' notes

Attention bug reporters: issues MUST include the version of Module::Metadata that you are running that exhibit the stated symptoms. thank you!

Report information
The Basics
Id: 101095
Status: resolved
Priority: 0/
Queue: Module-Metadata

People
Owner: Nobody in particular
Requestors: maurice [...] cpan.org
voegelas [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 1.000023



Subject: Module::Metadata does not extract correct version if use_our is enabled
If the PkgVersion plugin's "use_our" option is enabled, Module::Metadata fails to extract the correct version from distributions built with this Dist::Zilla plugin bundle. If the module version is put into curly brackets, like in the current "aliased" and "Test::Warnings" releases, Module::Metadata and in turn Module::Load::Conditional and CPANPLUS do not report the proper module version. CPANPLUS says that the currently installed version is "Unparsable" and that new versions are available. CPAN Terminal> o 1 Unparsable 0.019 Test::Warnings ETHER 2 Unparsable 0.33 aliased ETHER The version information at the top of Test/Warnings.pm is put into curly brackets by Dist::Zilla: { our $VERSION = '0.019'; } The following code snippets return 0 instead of the expected version unless the curly brackets are removed: use Module::Load::Conditional qw(check_install); my $rv = check_install( module => 'aliased' ); if ($rv) { print $rv->{version}, "\n"; } use Module::Metadata; my $info = Module::Metadata->new_from_file('path/to/module/aliased.pm'); if ( $info && defined $info->version ) { print $info->version, "\n"; }
On 2014-12-22 22:45:33, voegelas wrote: Show quoted text
> If the PkgVersion plugin's "use_our" option is enabled, > Module::Metadata fails to extract the correct version from > distributions built with this Dist::Zilla plugin bundle.
This is not a bug with the plugin bundle. Moving queues.
On 2014-12-23 11:45:05, ETHER wrote: Show quoted text
> On 2014-12-22 22:45:33, voegelas wrote:
> > If the PkgVersion plugin's "use_our" option is enabled, > > Module::Metadata fails to extract the correct version from > > distributions built with this Dist::Zilla plugin bundle.
> > This is not a bug with the plugin bundle. > > Moving queues.
Cannot reproduce so far. e.g. this test passes: https://github.com/Perl-Toolchain-Gang/Module-Metadata/commit/c12a6adcedc05a446eba79bbbbbbb3faa3c8f02d
On 2014-12-22 22:45:33, voegelas wrote: Show quoted text
> The following code snippets return 0 instead of the expected version > unless the curly brackets are removed: > > use Module::Load::Conditional qw(check_install); > > my $rv = check_install( module => 'aliased' ); > if ($rv) { > print $rv->{version}, "\n"; > }
Sorry, cannot reproduce: use strict; use warnings; use Module::Load::Conditional qw(check_install); my $rv = check_install( module => 'aliased' ); if ($rv) { print $rv->{version}, "\n"; } gives: 0.33 Show quoted text
> use Module::Metadata; > > my $info = Module::Metadata-
> >new_from_file('path/to/module/aliased.pm');
> if ( $info && defined $info->version ) { > print $info->version, "\n"; > }
Sorry, cannot reproduce: use strict; use warnings; use Module::Metadata; my $aliased = '/Users/ether/.perlbrew/libs/21.6@std/lib/perl5/aliased.pm'; my $info = Module::Metadata->new_from_file($aliased); print "extracted version: ", ($info->{versions}{aliased} // 'undef'), "\n"; print "...or ", ($info->version // 'undef'), "\n"; gives: extracted version: 0.33 ...or 0.33 What versions of CPANPLUS, Module::Metadata and Module::Load::Conditional do you have installed? What is your version of perl?
Am Di 23. Dez 2014, 15:49:58, ETHER schrieb: Show quoted text
> What versions of CPANPLUS, Module::Metadata and > Module::Load::Conditional do you have installed? What is your version > of perl?
I use Perl 5.20.1 with Module::Metadata 1.000019. Version 1.000024 fixes the problem. Sorry for the noise. I thought that I had tested version 1.000024 before I reported the problem but I ran the test in the wrong environment. Under Perl 5.14.2, 5.16.3 and 5.18.1 with their respective Module::Metadata versions everything is fine. I see that Strawberry Perl 5.20.1.1 comes with Module::Metadata 1.000024. Will Perl 5.20.2 update Module::Metadata? https://github.com/Perl/perl5/tree/maint-5.20-votes contains version 1.000019.
On 2014-12-23 13:56:12, voegelas wrote: Show quoted text
> Am Di 23. Dez 2014, 15:49:58, ETHER schrieb:
> > What versions of CPANPLUS, Module::Metadata and > > Module::Load::Conditional do you have installed? What is your > > version > > of perl?
> > I use Perl 5.20.1 with Module::Metadata 1.000019. Version 1.000024 > fixes the problem. Sorry for the noise. I thought that I had tested > version 1.000024 before I reported the problem but I ran the test in > the wrong environment.
I bisected this down to the commit where I dzilified the repository, which was in the 1.000023 release: https://metacpan.org/diff/file?target=ETHER/Module-Metadata-1.000023/&source=ETHER/Module-Metadata-1.000022/#lib/Module/Metadata.pm The relevant change is removing "our $VERSION = '1.000022';" and replacing it with "$Module::Metadata::VERSION = '1.000023';". I'm not quite sure exactly why this change is so critical, but we're doing some really dodgy things in _evaluate_version_line() (which is in the process of being rewritten anyway). @dagolden, you might have some insights here? Show quoted text
> I see that Strawberry Perl 5.20.1.1 comes with Module::Metadata > 1.000024. Will Perl 5.20.2 update Module::Metadata? > https://github.com/Perl/perl5/tree/maint-5.20-votes contains version > 1.000019.
dual-life modules aren't normally updated in point releases, unless there are important bug fixes. This ticket might qualify.
Subject: Problem parsing VERSION
Hi. I was just trying to install a bunch of dependencies using a cpanfile, and it ran into trouble with Test::Warnings. It attempted to install Test::CleanNamespaces 0.16, which has a dependency on T::W. But it failed with this error: ==> Found dependencies: Test::Warnings --> Working on Test::Warnings Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Test-Warnings-0.019.tar.gz ... OK Configuring Test-Warnings-0.019 ... OK Building and testing Test-Warnings-0.019 ... OK Successfully installed Test-Warnings-0.019 ! Installing the dependencies failed: Missing version info for module 'Test::Warnings' I'm on a plenv installed perl 5.18.1. I tried upgrading Module::Build and ExtUtils::MakeMaker, thinking it needed an updated VERSION regex or something, but that didn't help. Finally, I hacked Warnings.pm directly and just added newlines around the braces. i.e., { our $VERSION = '0.019'; } After that, the install worked okay. Any idea what build module/version is needed to correctly parse the 0.019 VERSION string?
On 2015-01-01 14:03:13, MAURICE wrote: Show quoted text
> Hi. > > I was just trying to install a bunch of dependencies using a cpanfile, > and it ran into trouble with Test::Warnings.
... Show quoted text
> Finally, I hacked Warnings.pm directly and just added newlines around > the braces. i.e., > > { > our $VERSION = '0.019'; > }
This is *very* helpful. There is a problem with older versions of Module::Metadata not being able to detect the version declaration when surrounded by braces like that -- here is the issue: https://rt.cpan.org/Ticket/Display.html?id=101095 Show quoted text
> After that, the install worked okay. Any idea what build > module/version is needed to correctly parse the 0.019 VERSION string?
So, you need to update Module::Metadata if it is older than version 1.000023.
On 2015-01-01 22:15:50, ETHER wrote: Show quoted text
> On 2015-01-01 14:03:13, MAURICE wrote:
> > Hi. > > > > I was just trying to install a bunch of dependencies using a > > cpanfile, > > and it ran into trouble with Test::Warnings.
IMPORTANT!!! Could you please paste the exact command you used to install Test::Warnings, and a stack trace showing the error (which can be achieved by installing Devel::Confess, and then: PERL5OPT=d:Confess <install command>). The bits of the toolchain that are experiencing this issue will need to have their dependency version bumped for Module::Metadata -- and I was unable to reproduce this with the latest cpanm.
I am still encountering the aforementioned issue: [shaun@arch2:~]$ cpanm File::Map --> Working on File::Map Fetching http://www.cpan.org/authors/id/L/LE/LEONT/File-Map-0.63.tar.gz ... OK Configuring File-Map-0.63 ... OK ==> Found dependencies: Test::Warnings --> Working on Test::Warnings Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Test-Warnings-0.019.tar.gz ... OK Configuring Test-Warnings-0.019 ... OK Building and testing Test-Warnings-0.019 ... OK Successfully installed Test-Warnings-0.019 ! Installing the dependencies failed: Missing version info for module 'Test::Warnings' ! Bailing out the installation for File-Map-0.63. 1 distribution installed [shaun@arch2:~]$ cpanm Module::Metadata Module::Metadata is up to date. (1.000024) Confirmed happening on two separate arch linux machines. No other machines to test on presently.
On Fri Jan 02 15:35:15 2015, ETHER wrote: Show quoted text
> On 2015-01-01 22:15:50, ETHER wrote:
> > On 2015-01-01 14:03:13, MAURICE wrote:
> > > Hi. > > > > > > I was just trying to install a bunch of dependencies using a > > > cpanfile, > > > and it ran into trouble with Test::Warnings.
> > IMPORTANT!!! > > Could you please paste the exact command you used to install > Test::Warnings, > and a stack trace showing the error (which can be achieved by > installing Devel::Confess, and then: PERL5OPT=d:Confess <install
> command>). The bits of the toolchain that are experiencing this issue
> will need to have their dependency version bumped for Module::Metadata > -- and I was unable to reproduce this with the latest cpanm.
Here you go: $ PERL5OPT=d:Confess cpanm Moose --> Working on Moose Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Moose-2.1403.tar.gz ... OK Configuring Moose-2.1403 ... OK ==> Found dependencies: Test::Warnings, Test::CleanNamespaces --> Working on Test::Warnings Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Test-Warnings-0.019.tar.gz .. . OK Configuring Test-Warnings-0.019 ... OK Building and testing Test-Warnings-0.019 ... OK Successfully installed Test-Warnings-0.019 --> Working on Test::CleanNamespaces Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Test-CleanNamespaces-0.16.tar .gz ... OK Configuring Test-CleanNamespaces-0.16 ... ! Installing the dependencies failed: Missing version info for module 'Test::Warnings' ! Bailing out the installation for Test-CleanNamespaces-0.16. ! Installing the dependencies failed: Missing version info for module 'Test::War nings', Module 'Test::CleanNamespaces' is not installed ! Bailing out the installation for Moose-2.1403. OK ==> Found dependencies: Test::Warnings 1 distribution installed $ perl -v This is perl 5, version 18, subversion 1 (v5.18.1) built for x86_64-linux $ cpanm -V cpanm (App::cpanminus) version 1.7004 (/home/mla/.plenv/versions/5.18.1/bin/cpanm) perl version 5.018001 (/home/mla/.plenv/versions/5.18.1/bin/perl5.18.1) Thanks!
As a follow up, I may be doing something wrong, but updating Module::Metadata doesn't been to solve this. $ cpanm Module::MetadataModule::Metadata is up to date. (1.000024) $ cpanm Moose --> Working on Moose Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Moose-2.1403.tar.gz ... OK Configuring Moose-2.1403 ... OK ==> Found dependencies: Test::Warnings --> Working on Test::Warnings Fetching http://www.cpan.org/authors/id/E/ET/ETHER/Test-Warnings-0.019.tar.gz ... OK Configuring Test-Warnings-0.019 ... OK Building and testing Test-Warnings-0.019 ... OK Successfully installed Test-Warnings-0.019 ! Installing the dependencies failed: Missing version info for module 'Test::Warnings' ! Bailing out the installation for Moose-2.1403. 1 distribution installed
On 2014-12-24 16:29:38, ETHER wrote: Show quoted text
> The relevant change is removing "our $VERSION = '1.000022';" and > replacing it with "$Module::Metadata::VERSION = '1.000023';".
Note this also means that changing from [PkgVersion] to [RewriteVersion] in dist.ini would also cause the problem (again)...
On 2014-12-24 16:29:38, ETHER wrote: Show quoted text
> The relevant change is removing "our $VERSION = '1.000022';" and > replacing it with "$Module::Metadata::VERSION = '1.000023';". > > I'm not quite sure exactly why this change is so critical, but we're > doing some really dodgy things in _evaluate_version_line() (which is > in the process of being rewritten anyway). @dagolden, you might have > some insights here?
Narrowed down the problem to this code: my $pn = 0; my $vsub; $pn++; my $eval = qq{BEGIN { my \$dummy = q# Hide from _packages_inside() #; package Module::Metadata::_version::p$pn; use version; no strict; no warnings; \$vsub = sub { local $sigil$variable_name; \$$variable_name=undef; $line; \$$variable_name }; }}; Which produces this $vsub in the good version (when Module::Metadata's $VERSION is declared as $Module::Metadata::VERSION = '...') my $good_vsub = sub { package Module::Metadata::_version::p1; no strict; no warnings; local $VERSION; $VERSION = undef; { our $VERSION = '1.12'; } $VERSION; }; and this $vsub in the bad version (when Module::Metadata's $VERSION is declared as our $VERSION = '...') my $bad_vsub = sub { package Module::Metadata::_version::p1; no strict; no warnings; local $Module::Metadata::VERSION; $Module::Metadata::VERSION = undef; { our $VERSION = '1.12'; } $Module::Metadata::VERSION; }; I'm still left with puzzling out WHY the code evaluation behaves differently, given that we are using a throwaway namespace.
I've made a new release that reverts the change to the $VERSION declaration; merging this ticket back to the Module-Metadata issue, #101095.
On Sat Jan 03 15:33:02 2015, ETHER wrote: Show quoted text
> I've made a new release that reverts the change to the $VERSION > declaration; merging this ticket back to the Module-Metadata issue, > #101095.
I have confirmed that this is fixed and File::Map no builds properly as a result. Thanks!
On 2015-01-03 13:45:44, SENRSMILE wrote: Show quoted text
> On Sat Jan 03 15:33:02 2015, ETHER wrote:
> > I've made a new release that reverts the change to the $VERSION > > declaration; merging this ticket back to the Module-Metadata issue, > > #101095.
> > > I have confirmed that this is fixed and File::Map no builds properly > as a result. Thanks!
MMD was fixed starting with 1.000023 (June 2014); I've made further changes, including adding tests, to make sure things stay fixed in the future. Marking resolved.