rschupp / PAR-Packer

(perl) Generate stand-alone executables, perl scripts and PAR files https://metacpan.org/pod/PAR::Packer
Other
48 stars 13 forks source link

Dynamically determine best Archive::Zip negative offset for ChunkSize #16

Closed plk closed 5 years ago

plk commented 5 years ago

Apologies, I did not realise that OSX codesign appends an amount of code to exes proportional to their size (presumably due to checksums) and this makes any static offset for ChunkSize eventually break. I know this as I had to add a couple of extra --link statements to a binary and the ChunkSize bump to 256K failed as the codesign appendage was then 270K ...

In this pull request, I dynamically compute the offset for ChunkSize based on the PAR sig which will always be before any post-packing appendices. Fixes my case and all tests pass.

plk commented 5 years ago

@rschupp - do you think it might be possible to review this and merge/release soonish? The last fix I submitted is only a limited fix and this one should be general.

rschupp commented 5 years ago

Thx Phil, I implemented this in a slightly different way in 3395cca715e5b7807be732e69a564865dbb567ff: If we bump ChunkSize just locally around the call $zip->readFromFileHandle(...) we can omit the elaborate estimation and just set ChunkSize to the size of the zip file. Note that PAR.pm needs the same workaround, done in PAR 1.016.

plk commented 5 years ago

Many thanks - I was a bit wary of setting it like that but it seems to work fine.