app-builder icon indicating copy to clipboard operation
app-builder copied to clipboard

"blockmap" with "deflate" and no output file creates invalid ZIP

Open garrettjstevens opened this issue 5 years ago • 2 comments

I'm using electron-builder to create ZIP files, which uses app-builder internally. Specifically, it calls app-builder with the "blockmap" and "deflate" options and no output file. Sometimes when I run command-line unzip on the generated ZIP files, they give an error like:

Archive:  MyApp-2.0.0-mac.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.

I'm not a Go developer, but it looks to me like when blockmap is run with no output file, pkg/blockmap/blockmap.go is simply appending the compressed blockmap data to the end of the existing ZIP file. I found a really great comment at https://github.com/thejoshwolfe/yauzl/issues/48#issuecomment-266587526 that discusses why appending data to the end of a ZIP file isn't valid.

I'd suggest using the end-of-central-directory comment to store the blockmap data, but it looks like the data can be longer than the max allowed comment length, so I'm not sure what would be the best approach.

Also xref https://github.com/electron-userland/electron-builder/issues/3779, which helped me track this down.

garrettjstevens avatar Nov 18 '19 23:11 garrettjstevens

Any update on this issue?

BotellaA avatar Jun 03 '20 03:06 BotellaA

@BotellaA @garrettjstevens - u can use this gist after electron builder is done with the zip thingy. https://gist.github.com/harshitsilly/a1bd5a405f93966aad20358ae6c4cec5 Check this space also which fix this + with other features - https://imjselectron.github.io/electron-differential-updater

harshitsilly avatar Jul 18 '20 18:07 harshitsilly