Skip Menu |

This queue is for tickets about the PAR-Dist CPAN distribution.

Report information
The Basics
Id: 78194
Status: resolved
Priority: 0/
Queue: PAR-Dist

People
Owner: RSCHUPP [...] cpan.org
Requestors: keno [...] cpan.org
Cc:
AdminCc:

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



Subject: PAR::Dist::parse_dist_name mis-parses par file name when arch is darwin-2level
I am unable to load a module with arch=darwin-2level from a PAR::Repository. When parsing the par file name, PAR::Dist::parse_dist_name() counts 2level as a Perl version. The test is to create a repository containing some module that is not otherwise available on the system. I used Acme::Drunk. $ cat /tmp/testpar.pl use strict; use warnings; use Test::More tests => 1; BEGIN { SKIP: { eval{ require Acme::Drunk; 1 } and skip 'Acme::Drunk must not be available.'; eval{ require PAR; PAR->import( { repository => 'file:///tmp/repo/', fallback => 0, } ); 1; } or skip 'Could not load PAR.'; use_ok( 'Acme::Drunk' ); } } $ find /tmp/repo -name \*.par /tmp/repo/darwin-2level/5.16.0/Acme-Drunk-0.03-darwin-2level-5.16.0.par $ ls -l Dist.pm* lrwxr-xr-x 1 root wheel 12 Jul 4 00:20 Dist.pm -> Dist.pm.orig -r--r--r-- 1 root wheel 43107 Jul 4 00:08 Dist.pm.new -rw-r--r-- 1 root wheel 43106 Jul 4 00:09 Dist.pm.orig $ diff Dist.pm.orig Dist.pm.new 1143c1143 < my $version = qr/v?(?:\d+(?:_\d+)?|\d*(?:\.\d+(?:_\d+)?)+)/; --- Show quoted text
> my $version = qr/v?(?:\d+(?:_\d+)?|\d*(?:\.\d+(?:_\d+)?)+)$/;
$ perl /tmp/testpar.pl 1..1 not ok 1 - use Acme::Drunk; # Failed test 'use Acme::Drunk;' # at /tmp/testpar.pl line 17. # Tried to use 'Acme::Drunk'. # Error: Can't locate Acme/Drunk.pm in @INC (@INC contains: CODE(0x10088ff00) /usr/ local/lib/perl5/site_perl/5.16.0/darwin-2level /usr/local/lib/perl5/site_perl/5.16.0 /usr/ local/lib/perl5/5.16.0/darwin-2level /usr/local/lib/perl5/5.16.0 . CODE(0x100890008)) at (eval 42) line 2. # BEGIN failed--compilation aborted at (eval 42) line 2. # Looks like you failed 1 test of 1. $ sudo ln -sf Dist.pm.new Dist.pm Password: $ perl /tmp/testpar.pl 1..1 ok 1 - use Acme::Drunk; $ The first fix that came to mind is shown above: just add '$' to the version regexp. But maybe this is too restrictive; I have not tested on other platforms.
The fix I suggested above does work but it's not the right fix. The right fix is to change line 1171 from this if ($e =~ /^$version|any_version$/) { to this if ($e =~ /^(?:$version|any_version)$/) { This is the match that was too loose.
Applied your patch, will be in the next release. Thanks Ken! Cheers, Roderich