Discussion:
[rt.cpan.org #104635] IO error the first time an executable built by the packer is run on OSX
(too old to reply)
Roderich Schupp via RT
2015-05-24 10:36:54 UTC
Permalink
Sun May 24 06:36:50 2015: Request 104635 was acted upon.
Transaction: Correspondence added by RSCHUPP
Queue: PAR-Packer
Subject: IO error the first time an executable built by the packer is run on OSX
Broken in: 1.025
Severity: (no value)
Owner: RSCHUPP
Requestors: ***@cpan.org
Status: new
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=104635 >
The packer produces binaries that cause the following error message
IO error: Can't open file
/var/folders/_9/ts8bmfyd3wb7nq36_p2fs1p40000gn/T/par-
6d736368696c6c69/cache-
fd843f52293f9fd2e4c93823729966b52c2d26a6/inc/lib/script for write : Is
a directory at -e line 621.
Subsequent runs go through without error message. The binary has been
both packed and run on OSX 10.8.
Sorry, I can't reproduce this on OSX 10.10.3 with system Perl (5.18.2) and latest PAR::Packer, PAR, Module::ScanDeps.
What versions are you using?

Does this also happen for a "hello world" example, e.g.

pp -o hello.exe -e 'print "hello\n"'

In any case, could you show the output of

unzip -l packed_executable

of a packed_executable showing the problem.

Cheers, Roderich
Michael_Schilli via RT
2015-06-25 18:30:52 UTC
Permalink
Thu Jun 25 14:30:52 2015: Request 104635 was acted upon.
Transaction: Correspondence added by MSCHILLI
Queue: PAR-Packer
Subject: IO error the first time an executable built by the packer is run on OSX
Broken in: 1.025
Severity: (no value)
Owner: RSCHUPP
Requestors: ***@cpan.org
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=104635 >


I've found a way to reproduce it, try this:

mkdir -p lib/Foo eg

cat >Foo.pm <<EOT
package Foo;
use Foo::Bar;
sub foo {
Foo::Bar->foo();
}
1;
EOT

cat >lib/Foo/Bar.pm <<EOT
package Foo::Bar;
sub foo { print "hello\n"; }
1;
EOT

cat >eg/foo <<EOT
#!/usr/bin/perl -w
use lib "lib";
use Foo;
Foo::foo();
EOT

chmod +x eg/foo
pp -o broken.exe eg/foo
./broken.exe

IO error: Can't open file /var/folders/_9/ts8bmfyd3wb7nq36_p2fs1p40000gn/T//par-6d736368696c6c69/cache-77a96ed9cc9da13b9f275d500f8ec0ed2e7e58a1/inc/lib/foo for write : Is a directory
at -e line 953.

Seems to be related to the fact that the osx FS won't distinguish between Foo and foo.
Roderich Schupp via RT
2015-06-26 08:56:21 UTC
Permalink
Fri Jun 26 04:56:15 2015: Request 104635 was acted upon.
Transaction: Correspondence added by RSCHUPP
Queue: PAR-Packer
Subject: IO error the first time an executable built by the packer is run on OSX
Broken in: 1.025
Severity: (no value)
Owner: RSCHUPP
Requestors: ***@cpan.org
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=104635 >
Post by Michael_Schilli via RT
Seems to be related to the fact that the osx FS won't distinguish
between Foo and foo.
Yes, because broken.exe which is also a zip file contains this
(using your recipe on Linux, but that shouldn't matter):

$ unzip -l broken.exe
Archive: broken.exe
Length Date Time Name
--------- ---------- ----- ----
0 2015-06-26 10:45 lib/
0 2015-06-26 10:45 script/
463 2015-06-26 10:45 MANIFEST
217 2015-06-26 10:45 META.yml
80 2015-06-26 10:45 lib/Foo.pm
71 2015-06-26 10:45 lib/Foo/Bar.pm
55 2015-06-26 10:45 lib/foo
55 2015-06-26 10:45 script/foo
676 2015-06-26 10:45 script/main.pl
--------- -------
1617 9 files

The problem is directory lib/Foo (only implied by zip member lib/Foo/Bar.pm)
and file lib/foo - these can't coexist on a case-insensitive filesystem.
Hmm, but why is lib/foo there at all? The original script is in script/foo.
OK, time for some code exegesis...

Cheers, Roderich
Roderich Schupp via RT
2015-06-29 19:49:24 UTC
Permalink
Mon Jun 29 15:49:22 2015: Request 104635 was acted upon.
Transaction: Correspondence added by RSCHUPP
Queue: PAR-Packer
Subject: IO error the first time an executable built by the packer is run on OSX
Broken in: 1.025
Severity: (no value)
Owner: RSCHUPP
Requestors: ***@cpan.org
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=104635 >
Post by Roderich Schupp via RT
OK, time for some code exegesis...
Perhaps the bug is not in PAR::Packer, but rather in Module::ScanDeps
(which is used by PAR::Packer to determine what modules etc to "pack in").

$ scandeps.pl -V eg/foo
# Foo.pm [module]
# Foo/Bar.pm [module]
# foo [data] <--- ???
# Legend: [C]ore [X]ternal [S]ubmodule [?]NotOnCPAN
'Foo::Bar' => '0', # ? # Foo
'Foo' => '0', # ? # foo

But when I move foo to the cwd:

$ scandeps.pl -V foo
# Foo.pm [module]
# Foo/Bar.pm [module]
# Legend: [C]ore [X]ternal [S]ubmodule [?]NotOnCPAN
'Foo::Bar' => '0', # ? # Foo
'Foo' => '0', # ? # foo

also

$ scandeps.pl -V ./foo
# Foo.pm [module]
# Foo/Bar.pm [module]
# foo [data] <--- ???
# Legend: [C]ore [X]ternal [S]ubmodule [?]NotOnCPAN
'Foo::Bar' => '0', # ? # Foo
'Foo' => '0', # ? # foo

The line "# foo [data]" is probably responsible for the spurious zip member lib/foo:

$ pp -o good.exe foo
$ unzip -l good.exe
Archive: good.exe
Length Date Time Name
--------- ---------- ----- ----
0 2015-06-29 21:42 lib/
0 2015-06-29 21:42 script/
455 2015-06-29 21:42 MANIFEST
215 2015-06-29 21:42 META.yml
80 2015-06-29 21:42 lib/Foo.pm
71 2015-06-29 21:42 lib/Foo/Bar.pm
55 2015-06-29 21:42 script/foo
676 2015-06-29 21:42 script/main.pl
--------- -------
1552 8 files

Note: no lib/foo!
To be continued.

Cheers, Roderich
Roderich Schupp via RT
2015-07-19 13:05:37 UTC
Permalink
Sun Jul 19 09:05:36 2015: Request 104635 was acted upon.
Transaction: Correspondence added by RSCHUPP
Queue: PAR-Packer
Subject: IO error the first time an executable built by the packer is run on OSX
Broken in: 1.025
Severity: (no value)
Owner: RSCHUPP
Requestors: ***@cpan.org
Status: open
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=104635 >


Fixed in PAR::Packer 1.026.

Cheers, Roderich
Michael_Schilli via RT
2015-08-11 02:06:07 UTC
Permalink
Mon Aug 10 22:06:01 2015: Request 104635 was acted upon.
Transaction: Correspondence added by MSCHILLI
Queue: PAR-Packer
Subject: IO error the first time an executable built by the packer is run on OSX
Broken in: 1.025
Severity: (no value)
Owner: RSCHUPP
Requestors: ***@cpan.org
Status: resolved
Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=104635 >
Post by Roderich Schupp via RT
Fixed in PAR::Packer 1.026.
Works perfectly, thanks much!

Loading...