Skip Menu |

This queue is for tickets about the CPAN-Site CPAN distribution.

Report information
The Basics
Id: 68616
Status: resolved
Priority: 0/
Queue: CPAN-Site

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

Bug Information
Severity: Important
Broken in: 1.06
Fixed in: (no value)

Attachments
0001-Test-dist-for-multi-package-issue.patch
0002-Added-test-for-multi-package-issue.patch
0003-Fix-for-multi-package-issue.patch
Distro-With-Multi-Package-Module.tar.gz



Subject: Modules with multiple packages don't get indexed properly
The dist file Version-Requirements-0.101020.tar.gz contains the module file Version/Requirements.pm, which contains multiple package declarations. This would not be a problem except that the author is setting a VERSION for each package like so: package Version::Requirements; BEGIN { Version::Requirements::VERSION = '0.101020'; } # code... package Version::Requirements::_Range::Exact; $Version::Requirements::_Range::Exact; BEGIN { $Version::Requirements::_Range::Exact::VERSION = '0.101020'; } # code... package $Version::Requirements::_Range::Range; BEGIN { $Version::Requirements::_Range::Range::VERSION = '0.101020'; } # code... Only the last one found ends up in the 02packages.details.txt file. This means that the CPAN client using the local cpan indexes can't find Version::Requirements, and so the installation of several other modules fails. However, this is easily fixed with the included patch. I've even included tests. I made the patches with git, but they should apply with a patch -p1 In case the first one (containing the test-dist tarball) doesn't apply, I've also attached it.
Subject: 0002-Added-test-for-multi-package-issue.patch
From f25d2ac5a72363556f1e104c3434c0b93dccfc8c Mon Sep 17 00:00:00 2001 From: "Stephen R. Scaffidi" <sscaffid@akamai.com> Date: Thu, 2 Jun 2011 16:59:40 -0400 Subject: [PATCH 2/3] Added test for multi-package issue --- t/10index.t | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/t/10index.t b/t/10index.t index 7301842..b6662c8 100644 --- a/t/10index.t +++ b/t/10index.t @@ -5,12 +5,13 @@ $^W = 0; use strict; use warnings; use FindBin qw($Bin); -use Test::More tests => 53; +use Test::More tests => 60; use_ok('CPAN::Site::Index'); test_inspect_archive_for_distro_with_strange_data(); test_inspect_archive_for_distro_with_packages_that_should_not_be_registered(); +test_inspect_archive_for_distro_with_module_with_multiple_packages(); exit; @@ -55,6 +56,16 @@ sub test_inspect_archive_for_distro_with_packages_that_should_not_be_registered _test_inspect_archive_for_distro( $distro_to_test, \%want_packages ); } +sub test_inspect_archive_for_distro_with_module_with_multiple_packages { + my $distro_to_test = 'Distro-With-Multi-Package-Module.tar.gz'; + my %want_packages = ( + 'Module::MultiPackage' => '0.01', + 'Module::MultiPackage::SubPackageOne' => '0.011', + 'Module::MultiPackage::SubPackageTwo' => '0.012', + ); + _test_inspect_archive_for_distro( $distro_to_test, \%want_packages ); +} + sub _test_inspect_archive_for_distro { my $distro = shift; my $want_packages = shift; -- 1.7.5.2
Subject: 0001-Test-dist-for-multi-package-issue.patch
From 25764b8ab3c5e6a3b53e5e855dbfcb632184683e Mon Sep 17 00:00:00 2001 From: "Stephen R. Scaffidi" <sscaffid@akamai.com> Date: Thu, 2 Jun 2011 16:59:15 -0400 Subject: [PATCH 1/3] Test dist for multi-package issue --- .../Distro-With-Multi-Package-Module.tar.gz | Bin 0 -> 458 bytes 1 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 t/test_data/Distro-With-Multi-Package-Module.tar.gz diff --git a/t/test_data/Distro-With-Multi-Package-Module.tar.gz b/t/test_data/Distro-With-Multi-Package-Module.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..fc750238f7211cb9db947b1a4dc89d90cc2f96a6 GIT binary patch literal 458 zcmV;*0X6;~iwFR~@#jqd1MQSePr^VDhB^0FOo9m~aJQvxQsO~{7!Cqaqvz5tbYp2r zcN-4I|L#=FhXDeJVvO^o>1;YXyYKEhX<I6trS&JNqxx+gYgr%o!LvUW_1iSeV{u+N z9>$n!+fc!`Wx5y{=N2pC0^r<sx$EHL0OKw*oeJ3Bu=h@KrTq-0C>8jlkqp1OPI-<+ z{3En?`5(*Su|2TA|LD7A7yjFhMgE_Hz5GA&S8$O3jtR`<j5G586ddCJd%jFJrjxz* z!258T&8_}(hRM1A+-jo#mdkks*bkn2!9VxE3J;M~Fp{wVjJXma$OLpG;CgV`^Spbh z1!$o(s2qn4W3?hk6Ya}H!K7%7DSnxLv<HMDi2cmhGR5pHl0k%pDoXP>1V4^pC?FGK zY(9~R5EnJ(g&)1<d8^IVGOju|-5$Ic0B4&fc-~{@?!Mda!3ES<gYjC+cr}b-eihGx za_7sJ5^(!ShM`DsMw!A9Y}_61ARm_Feu83f=2FjAMW2e+1QrSbUY9CWI@h+U_dt0M zv$S=nI;>e!XD-$8mhsy?N)QA=5ClOG1VIo4K@bE%5ClOG1VQZP4fh@GApj@<0R8>m A#Q*>R literal 0 HcmV?d00001 -- 1.7.5.2
Subject: 0003-Fix-for-multi-package-issue.patch
From 9fb4acfb0eaf7fa37fee6bf3fd70da44a416e7c6 Mon Sep 17 00:00:00 2001 From: "Stephen R. Scaffidi" <sscaffid@akamai.com> Date: Thu, 2 Jun 2011 16:59:59 -0400 Subject: [PATCH 3/3] Fix for multi-package issue --- lib/CPAN/Site/Index.pm | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/CPAN/Site/Index.pm b/lib/CPAN/Site/Index.pm index 1abda68..3576ac0 100644 --- a/lib/CPAN/Site/Index.pm +++ b/lib/CPAN/Site/Index.pm @@ -250,11 +250,11 @@ sub collect_package_details($$) trace "pkg $package version $VERSION"; } } - } - $VERSION = $VERSION->numify if ref $VERSION; - register $package, $VERSION, $dist - if defined $package; + $VERSION = $VERSION->numify if ref $VERSION; + register $package, $VERSION, $dist + if defined $package; + } } sub update_global_cpan($$) -- 1.7.5.2
Subject: Distro-With-Multi-Package-Module.tar.gz

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #68616] Modules with multiple packages don't get indexed properly
Date: Fri, 3 Jun 2011 00:09:07 +0200
To: "Stephen R. Scaffidi via RT" <bug-CPAN-Site [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Stephen R. Scaffidi via RT (bug-CPAN-Site@rt.cpan.org) [110602 21:07]: Show quoted text
> Thu Jun 02 17:07:24 2011: Request 68616 was acted upon. > Transaction: Ticket created by SSCAFFIDI > Queue: CPAN-Site > Subject: Modules with multiple packages don't get indexed properly > > The dist file Version-Requirements-0.101020.tar.gz contains the module file > Version/Requirements.pm, which contains multiple package declarations. > Only the last one found ends up in the 02packages.details.txt file.
That's a bug. Once the code handled the situation correctly. I'll fix it asap. There are more changes queued -- Thanks, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #68616] Modules with multiple packages don't get indexed properly
Date: Sat, 4 Jun 2011 00:13:15 +0200
To: "Stephen R. Scaffidi via RT" <bug-CPAN-Site [...] rt.cpan.org>
From: Mark Overmeer <secretaris [...] nluug.nl>
* Stephen R. Scaffidi via RT (bug-CPAN-Site@rt.cpan.org) [110602 21:07]: Show quoted text
> Thu Jun 02 17:07:24 2011: Request 68616 was acted upon. > Transaction: Ticket created by SSCAFFIDI > Queue: CPAN-Site > Subject: Modules with multiple packages don't get indexed properly > > The dist file Version-Requirements-0.101020.tar.gz contains the module file > Version/Requirements.pm, which contains multiple package declarations. This would not be a > problem except that the author is setting a VERSION for each package like so: > > > package Version::Requirements; > BEGIN { > Version::Requirements::VERSION = '0.101020'; > } > # code...
This was not exactly the problem. The cause of the misbahior was that the "package" keywords and the package name were not on the same line. See this: Show quoted text
> package > Module::MultiPackage::SubPackageTwo;
CPAN::Site expects these components on one single line, as CPAN.pm does as well! It is a requirement. On the other hand, there is no obligation for me to be as restrictive as CPAN.pm... I have added a little logic to be able to understand above. The test was most useful in finding this problem, and now included in the distribution. I'll publish a new release in a few minutes. -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Subject: Re: [rt.cpan.org #68616] Modules with multiple packages don't get indexed properly
Date: Fri, 3 Jun 2011 22:25:57 -0400
To: bug-CPAN-Site [...] rt.cpan.org
From: Steve Scaffidi <sscaffidi [...] cpan.org>
On Fri, Jun 3, 2011 at 6:13 PM, Mark Overmeer via RT <bug-CPAN-Site@rt.cpan.org> wrote: Show quoted text
> > This was not exactly the problem. The cause of the misbahior was that the "package" > keywords and the package name were not on the same line. See this: >
>>   package >>     Module::MultiPackage::SubPackageTwo;
> > CPAN::Site expects these components on one single line, as CPAN.pm > does as well!  It is a requirement.  On the other hand, there is no > obligation for me to be as restrictive as CPAN.pm... I have added a > little logic to be able to understand above.
Interesting! I knew that was a way of hiding package declarations from PAUSE, and I was a bit puzzled at how your code was still picking up the package name, since the files were being processed line-at-a-time. A second look at the code, after I sent the patches, showed me that you were getting the package from the $Package::Name::VERSION assignment (clever!). Show quoted text
> The test was most useful in finding this problem, and now included in > the distribution. > > I'll publish a new release in a few minutes.
Great! I've been using a locally-patched version the last few days :) -- -- Steve Scaffidi <stephen@scaffidi.net>
Subject: Re: [rt.cpan.org #68616] Modules with multiple packages don't get indexed properly
Date: Sat, 4 Jun 2011 11:35:13 +0200
To: "Stephen R. Scaffidi via RT" <bug-CPAN-Site [...] rt.cpan.org>
From: Mark Overmeer <mark [...] overmeer.net>
* Stephen R. Scaffidi via RT (bug-CPAN-Site@rt.cpan.org) [110604 02:26]: Show quoted text
> Interesting! I knew that was a way of hiding package declarations from > PAUSE, and I was a bit puzzled at how your code was still picking up > the package name, since the files were being processed line-at-a-time. > A second look at the code, after I sent the patches, showed me that > you were getting the package from the $Package::Name::VERSION > assignment (clever!).
Actually, you can do this: package B; package C; $B::VERSION = '3.12'; It's valid Perl (poor design) which Pause tries to understand. Originally, Pause simply did a "do $pmfile" (execute the code to find the $VERSION), but that is a serious security risk. So, also Pause simply scans the uncompiled file. -- Thanks for your clean contribution, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.net
Got released in 1.07 (half a year ago)