Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[rt.cpan.org #78194] PAR::Dist::parse_dist_name mis-parses par file name when arch is darwin-2level

15 views
Skip to first unread message

Ken Olstad via RT

unread,
Jul 4, 2012, 1:30:52 AM7/4/12
to p...@perl.org, jess...@bestpractical.com
Wed Jul 04 01:30:50 2012: Request 78194 was acted upon.
Transaction: Ticket created by KENO
Queue: PAR
Subject: PAR::Dist::parse_dist_name mis-parses par file name when arch is
darwin-2level
Broken in: 0.48
Severity: Important
Owner: Nobody
Requestors: ke...@cpan.org
Status: new
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78194 >


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+)?)+)/;
---
> 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.

Ken Olstad via RT

unread,
Aug 8, 2012, 11:45:15 AM8/8/12
to p...@perl.org, jess...@bestpractical.com
Wed Aug 08 11:45:14 2012: Request 78194 was acted upon.
Transaction: Correspondence added by KENO
Queue: PAR
Subject: PAR::Dist::parse_dist_name mis-parses par file name when arch is darwin-2level
Broken in: 0.48
Severity: Important
Owner: Nobody
Requestors: ke...@cpan.org
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78194 >


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.

Roderich Schupp via RT

unread,
Oct 12, 2012, 3:13:16 AM10/12/12
to p...@perl.org
Fri Oct 12 03:13:16 2012: Request 78194 was acted upon.
Transaction: Correspondence added by RSCHUPP
Queue: PAR-Dist
Subject: PAR::Dist::parse_dist_name mis-parses par file name when arch is darwin-2level
Broken in: (no value)
Severity: Important
Owner: RSCHUPP
Requestors: ke...@cpan.org
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=78194 >


Applied your patch, will be in the next release. Thanks Ken!

Cheers, Roderich
0 new messages