Closed GlennWood closed 1 year ago
I can't reproduce this with the following simple "hello, world" using --clean
$ pp --clean -o clean.exe -E 'say "PAR::Packer = ${PAR::Packer::VERSION}"; say "PAR_TEMP = $ENV{PAR_TEMP}";'
$ ./clean.exe
PAR::Packer = 1.055
PAR_TEMP = /tmp/par-726f646572696368/cache-5883d6b770f9019ef9183f1dbe84d16bcaacee83
$ ls -ld /tmp/par-726f646572696368/cache-5883d6b770f9019ef9183f1dbe84d16bcaacee83
/bin/ls: cannot access '/tmp/par-726f646572696368/cache-5883d6b770f9019ef9183f1dbe84d16bcaacee83': No such file or directory
(so clean.exe works and cleaning also works).
Can't load '/tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/5b38968d.so' for module IO: /tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/5b38968d.so: c: No such file or directory at \
/DynaLoader.pm line 193.
Run your test under strace and check whether the file in the error message really doesn't exist or DynaLoader is lying to us.
strace output attached While getting this, I tried executing it multiple times: and got a few different results. Here is the output of those:
[gwood@vraNB6802 ~]$ cd tmp
[gwood@vraNB6802 tmp]$ ../nbdeployutil --gather --traditional --background
/tmp/nbdeployutil_yk__R
Error writing "/tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/5e65e3d1.pm.153901": No such file or directory at -e line 521.
[gwood@vraNB6802 tmp]$ ../nbdeployutil --gather --traditional --background
/tmp/nbdeployutil_bCyFh
Error writing "/tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/95c1e7e6.pm.153911": No such file or directory at -e line 521.
Compilation failed in require at <embedded>/Carp/Heavy.pm line 3.
BEGIN failed--compilation aborted at <embedded>/Carp/Heavy.pm line 3.
Compilation failed in require at -e line 139.
[gwood@vraNB6802 tmp]$ ../nbdeployutil --gather --traditional --background
/tmp/nbdeployutil_m9jp5
Error writing "/tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/5e65e3d1.pm.153932": No such file or directory at -e line 521.
[gwood@vraNB6802 tmp]$ ../nbdeployutil --gather --traditional --background
/tmp/nbdeployutil_q74C3
Error writing "/tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/3b86428e.pm.153943": No such file or directory at -e line 521.
[gwood@vraNB6802 tmp]$ ../nbdeployutil --gather --traditional --background
/tmp/nbdeployutil_c_QK9
Error writing "/tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/5e65e3d1.pm.153949": No such file or directory at -e line 521.
[gwood@vraNB6802 tmp]$ ../nbdeployutil --gather --traditional --background
/tmp/nbdeployutil_bvr1S
Can't load '/tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/a2930ce9.so' for module Compress::Raw::Zlib: /tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/a2930ce9.so: cannot open shared object file: No such file or directory at <embedded>/DynaLoader.pm line 193.
at <embedded>/PAR/Heavy.pm line 95.
Compilation failed in require at <embedded>/Archive/Zip.pm line 9.
BEGIN failed--compilation aborted at <embedded>/Archive/Zip.pm line 9.
Compilation failed in require at -e line 145.
[gwood@vraNB6802 tmp]$ ../nbdeployutil --gather --traditional --background
/tmp/nbdeployutil_Ff3Wb
Error writing "/tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/95c1e7e6.pm.154006": No such file or directory at -e line 521.
Compilation failed in require at <embedded>/Carp/Heavy.pm line 3.
BEGIN failed--compilation aborted at <embedded>/Carp/Heavy.pm line 3.
Compilation failed in require at -e line 139.
[gwood@vraNB6802 tmp]$ ../nbdeployutil --gather --traditional --background
/tmp/nbdeployutil_XjpSj
Can't load '/tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/6dacc4c4.so' for module Encode: /tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1/6dacc4c4.so: cannot open shared object file: No such file or directory at <embedded>/DynaLoader.pm line 193.
at <embedded>/PAR/Heavy.pm line 95.
BEGIN failed--compilation aborted at <embedded>/Encode.pm line 13.
Compilation failed in require at <embedded>/Archive/Zip/Archive.pm line 12.
BEGIN failed--compilation aborted at <embedded>/Archive/Zip/Archive.pm line 12.
Compilation failed in require at <embedded>/Archive/Zip.pm line 316.
Compilation failed in require at -e line 145.
par-packer-issue-66.strace.out.log par-packer-issue-66.strace.err.log
strace.err.log (BTW: please use strace -o trace_log ...
to capture the strace log) starting with line 17192 shows that "someone" is deleting the files beneath the cache area (/tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1).
That is not the cleanup done by PAR::Packer
(actually par_rmtmpdir() in myldr/mktmpdir), as the latter doesn't use chdir
. This cleanup actually starts at line 19531.
So "someone" must be the packed script, right?
Also the log contains two clone
calls and I can't see what the new threads are doing -use strace -f ...
to trace thru clone/fork. A good idea is also strace -s 200 ...
so that we can see more of the content of write
and read
calls.
At the end of strace.err.log you can see actual error messages from perl, but I don't see the write
s that produce them (nor do I see the failing syscalls), this must actually happen in the cloned threads...
"someone" is deleting the files beneath the cache area (/tmp/par-67776f6f64/cache-cb5707b8810b800fc0a1a76b15d413c2ada257e1).
This traverse-and-delete looks as if produced by File::Path::remove_tree
(AKA rmtree
)... In the PAR ecosystem only PAR::Dist uses File::Path::remove_tree
.
Here is the strace log with -f
. It adds 25% more lines; quite a tangle. I'll be perusing it, but if anything leaps out at you, let me know. TIA
OK, I see what's going on... You invoke (via system()
) nbdeployutil
(a packed executable) from nbdeployutil
itself.
Both use the same cache directory (/tmp/par-USER/cache-SHA1) and have --clean
set. So when the "inner" nbdeployutil
finishes it will remove the cache directory. The problem is that executables packed with --clean
should have cache directories of the form /tmp/par-USER/temp-PID, i.e. different directories for each invocation.
That is an unexpected side effect of my fix for #62: it moved the information "this executable was packed with --clean
" from
patching the boot
executable to the file META.yml
in the zip part of the executable. It will be honored alright, i.e. the cache directory will be removed, but at the time we look in the zip it's too late, the wrong type of cache directory has already been created.
The information must somehow be extracted by the boot executable itself (which creates the cache directory). My idea is to encode that in the "Ending section" (see man par.pl
, "Stand-alone executable format"), but this requires major surgery. So it's gonna take a while.
@GlennWood Please try the version from branch "par_clean". It's not based on current broken "master", but goes back to #62 (hence should get right the ephemeral vs persistent cache directory when used with/without --clean
).
I'm esp. curious whether it passes your minimal-viable-test in https://github.com/rschupp/PAR-Packer/issues/62#issuecomment-1171175771
If it still fails, please post
hello
hello.truss
obtained from running truss -a -e -f -o hello.truss ./hello
OK minimal-viable-test in https://github.com/rschupp/PAR-Packer/issues/62#issuecomment-1171175771, with or without --clean
@GlennWood Thanks for testing. I just released a slightly edited version of that branch as 1.056 to CPAN.
Roderich, you fixed a problem with --clean option on rs6000 platforms with v1.055 (#62). It turns out another team here attempted to pack a different program using 1.055 and the packed executable fails on other platforms, e.g. LinuxR_x86. Without the --clean option, or by using 1.054, they report that it will work properly.
I have duplicated their problem; I get the following running the packed executable:
Can you look into this, please?