Skip Menu |

This queue is for tickets about the App-FatPacker CPAN distribution.

Report information
The Basics
Id: 87352
Status: open
Priority: 0/
Queue: App-FatPacker

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

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



Subject: Erroneous handling of .packlist files
Hello, I tried to pack a module that use AnyEvent. All AnyEvent modules are packed with an incorrect module path. For example for AnyEvent.pm, it appears as "mach/AnyEvent.pm" on FreeBSD and "i486-linux-gnu-thread-multi/AnyEvent.pm" on Linux, in the %fatpacked hash. At the compilation phase of the fatpacked resulting script, the module AnyEvent.pm is not found... Note that the problem occurs for each module that uses .packlist file, not only AnyEvent. The attached patch correct the problem. I just typed "fatpack pack myscript.pl", so I don't think I am misusing fatpack... Tested on: - FreeBSD 8.4 amd64 / perl 5.12.5 @INC: /home/max/perl5/lib/perl5/amd64-freebsd /home/max/perl5/lib/perl5 /usr/local/lib/perl5/5.12/BSDPAN /usr/local/lib/perl5/site_perl/5.12/mach <- AnyEvent.pm installed here /usr/local/lib/perl5/site_perl/5.12 /usr/local/lib/perl5/5.12/mach /usr/local/lib/perl5/5.12 - Linux debian 2.6.26-2-686 / perl 5.10.0 @INC: /home/max/perl5/lib/perl5/i486-linux-gnu-thread-multi <- AnyEvent.pm installed here /home/max/perl5/lib/perl5 /etc/perl /usr/local/lib/perl/5.10.0 /usr/local/share/perl/5.10.0 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl Best regards, Max.
Subject: FatPacker.pm.patch
--- FatPacker.pm~ 2013-05-30 03:46:30.000000000 +0200 +++ FatPacker.pm 2013-07-26 15:34:33.000000000 +0200 @@ -173,8 +173,8 @@ my $pack_base; PART: foreach my $p (0 .. $#dir_parts) { if ($dir_parts[$p] eq 'auto') { - # $p-2 since it's <wanted path>/$Config{archname}/auto - $pack_base = catpath $vol, catdir @dir_parts[0..$p-2]; + # $p-1 since it's <wanted path>/$Config{archname}/auto + $pack_base = catpath $vol, catdir @dir_parts[0..$p-1]; last PART; } }
Le 2013-07-26 16:22:17, MAXS a écrit : Show quoted text
> > For example for AnyEvent.pm, it appears as "mach/AnyEvent.pm" on > FreeBSD and "i486-linux-gnu-thread-multi/AnyEvent.pm" on Linux, in the > %fatpacked hash. >
Reproduced on Ubuntu with system perl 5.14.2. It appears that AnyEvent is one module (the only one on my @INC) that, while being pure perl, still install its .pm files in $Config{archname}. In fact it has the following in its Makefile.PL: PM => { 'lib/AE.pm' => '$(INST_LIBDIR)/AE.pm', 'lib/AnyEvent.pm' => '$(INST_LIBDIR)/AnyEvent.pm', ... 'lib/AnyEvent/Util/uts46data.pl' => '$(INST_LIBDIR)/AnyEvent/Util/uts46data.pl', 'lib/AnyEvent/constants.pl' => '$(INST_ARCHLIBDIR)/AnyEvent/constants.pl', }, Usually we skip any distribution installed in archlib because those distributions have XS code that can't be fully fatpacked. So AnyEvent seems to be one singular distribution that is affected by the bug. -- Olivier Mengué - http://perlresume.org/DOLMEN
Le 2013-07-26 16:22:17, MAXS a écrit : Show quoted text
> The attached patch correct the problem.
The patch only fixes the problem for modules installed in $ARCHDIR. So in practice, only AnyEvent. But it breaks App::FatPacker for the other more common cases. A better universal patch is needed. -- Olivier Mengué - http://perlresume.org/DOLMEN
Subject: Re: [rt.cpan.org #87352] Erroneous handling of .packlist files
Date: Mon, 29 Jul 2013 07:58:50 -0700
To: Olivier Mengué via RT <bug-App-FatPacker [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
On Mon, Jul 29, 2013 at 09:23:19AM -0400, Olivier Mengu? via RT wrote: Show quoted text
> It appears that AnyEvent is one module (the only one on my @INC) that, while being pure perl, still install its .pm files in $Config{archname}. > In fact it has the following in its Makefile.PL:
This sounds like a problem with AnyEvent. Why should it need to install into $Config{archname}? Show quoted text
> Usually we skip any distribution installed in archlib because those distributions have XS code that can't be fully fatpacked.
In the absence of any spec that says otherwise, this sounds like a reasonable assumption. I would suggest patching AnyEvent.
RT-Send-CC: ether [...] cpan.org
Le Lun 29 Jui 2013 10:59:03, ETHER a écrit : Show quoted text
> On Mon, Jul 29, 2013 at 09:23:19AM -0400, Olivier Mengu? via RT wrote:
> > It appears that AnyEvent is one module (the only one on my @INC) > > that, while being pure perl, still install its .pm files in > > $Config{archname}. > > In fact it has the following in its Makefile.PL:
> > This sounds like a problem with AnyEvent. Why should it need to > install > into $Config{archname}?
Perhaps because AnyEvent/constants.pl content depends on the achitecture?... Show quoted text
>
> > Usually we skip any distribution installed in archlib because those > > distributions have XS code that can't be fully fatpacked.
> > In the absence of any spec that says otherwise, this sounds like a > reasonable assumption. > > I would suggest patching AnyEvent.
Le 2013-07-29 16:03:52, DOLMEN a écrit : Show quoted text
> A better universal patch is needed.
Here is the patch, committed in the RT87352-packlist-paths-abs2rel branch: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/App-FatPacker.git;a=commitdiff;h=db59036820f26d1d9240b1ce8d469a4679fdcfaf -- Olivier Mengué - http://perlresume.org/DOLMEN
On Mon Jul 29 12:45:35 2013, DOLMEN wrote: Show quoted text
> Le 2013-07-29 16:03:52, DOLMEN a écrit : >
> > A better universal patch is needed.
> > Here is the patch, committed in the RT87352-packlist-paths-abs2rel > branch: > http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/App- > FatPacker.git;a=commitdiff;h=db59036820f26d1d9240b1ce8d469a4679fdcfaf
It seems like that would pick up modules in arch/ in general? We intentionally don't do that, because normally things in arch/ are perl/architecture specific, so they aren't safe to pack. (if I'm missing something here, please say)
Le Mer 31 Jui 2013 15:47:43, MSTROUT a écrit : Show quoted text
> On Mon Jul 29 12:45:35 2013, DOLMEN wrote:
> > Le 2013-07-29 16:03:52, DOLMEN a écrit : > >
> > > A better universal patch is needed.
> > > > Here is the patch, committed in the RT87352-packlist-paths-abs2rel > > branch: > > http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=p5sagit/App- > > FatPacker.git;a=commitdiff;h=db59036820f26d1d9240b1ce8d469a4679fdcfaf
> > It seems like that would pick up modules in arch/ in general? > > We intentionally don't do that, because normally things in arch/ are > perl/architecture specific, so they aren't safe to pack. > > (if I'm missing something here, please say)
In fact you do. At this time, fatpack accepts to pack arch/ modules without a warning and produce a wrong packed program. Olivier's patch corrects the packed program. Why not emit a warning, to say that this behaviour is not supported and that the resulting fatpacked program will not be portable? Or even perhaps won't work... But please, don't forbid the "feature"... Max.
Subject: Re: [rt.cpan.org #87352] Erroneous handling of .packlist files
Date: Fri, 2 Aug 2013 07:51:55 -0700
To: Maxime Soulé via RT <bug-App-FatPacker [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
On Thu, Aug 01, 2013 at 02:59:16AM -0400, Maxime Soul? via RT wrote: Show quoted text
> In fact you do. At this time, fatpack accepts to pack arch/ modules without a warning and produce a wrong packed program. > Olivier's patch corrects the packed program. > > Why not emit a warning, to say that this behaviour is not supported and that the resulting fatpacked program will not be portable? Or even perhaps won't work... > But please, don't forbid the "feature"...
I'd be in favour of disallowing this in normal cases (i.e. die, not warn), unless a flag was passed to indicate "I do want to pack arch-specific things, and I understand the risks". That way the normal user is protected from doing something that probably won't work, but people who want to create pack files targeted towards a particular architecture can still do so.
I had the exact same problem when fatpacking Path::Tiny on perl < 5.16 because it depends on File::Spec 3.4 which is installed into archdir (because the dist has XS in Cwd). File::Spec itself is pure perl, and Cwd.pm loads fine when binary files are missing, so I ended up patching the resulted fatpack to strip the archname path. https://github.com/miyagawa/carton/compare/6c3e161851a8...520305ad21e6#L0R52 I know that this doesn't work for all arch-dependent modules, and should be handled case-by-case, but a flag or list of optional modules to pack would be useful.