facebook / buck

A fast build system that encourages the creation of small, reusable modules over a variety of platforms and languages.

Home Page:https://buck.build

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

zip64 self executing jar issue

reevesg opened this issue · comments

We've run into an issue where are jars no longer work if they cross the zip64 threshold and also use a self executing bash script that is appended to the start of the archive. When trying to inspect the contents of the archive we get an error such as

jar -tf  buck-out/gen/src/myselfexecutingjar                                                          
java.util.zip.ZipException: invalid CEN header (bad signature)                                                                                                                                            
        at java.base/java.util.zip.ZipFile$Source.zerror(ZipFile.java:1607)                                                                                                                               
        at java.base/java.util.zip.ZipFile$Source.initCEN(ZipFile.java:1557)                                                                                                                              
        at java.base/java.util.zip.ZipFile$Source.<init>(ZipFile.java:1308)                                                                                                                               
        at java.base/java.util.zip.ZipFile$Source.get(ZipFile.java:1271)                                                                                                                                  
        at java.base/java.util.zip.ZipFile$CleanableResource.<init>(ZipFile.java:733)                                                                                                                     
        at java.base/java.util.zip.ZipFile$CleanableResource.get(ZipFile.java:850)                                                                                                                        
        at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:248)                                                                                                                                       
        at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:177)                                                                                                                                       
        at java.base/java.util.zip.ZipFile.<init>(ZipFile.java:148)

zip-info highlights the problem as

zipinfo -v buck-out/gen/src/myselfexecutingjar  | less                                                                                                   
[buck-out/gen/src/od-transform/od-transform]                                                                                                                                                              
error: End-of-centdir-64 signature not where expected (prepended bytes?)                                                                                                                                  
  (attempting to process anyway)                                                                                                                                                                          
warning [buck-out/gen/src/myselfexecutingjar]:  1020 extra bytes at beginning or within zipfile 
...

1020 bytes is what we are prepending to the archive and if I add this to the offset in the zip64 EOCD record it works.