3 ms·
zip at least has a de-facto standard, which today is the "Info-ZIP" utility.
by LeoPanthera 6y ago
zip at least has a de-facto standard, which today is the "Info-ZIP" utility.
- chungy 6y agoZip also has a real bonefide standard: https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
- greggman3 6y agoThat spec is seriously underspecified https://games.greggman.com/game/zip-rant/ https://games.greggman.com/game/zip-rant/
- chungy 6y agoSeems kind of a shame to tuck this away in a comments section on a (mostly) unrelated article. I would suggest you submit it as a main article for HN :)
- greggman3 6y agonot really. The zip spec says anything can come in before the "zip data". Info-Zip gives this example unzip unz552x3.exe unzipsfx.exe // extract the DOS SFX stub cat unzipsfx.exe yourzip.zip > yourDOSzip.exe // create the SFX archive zip -A yourDOSzip.exe // fix up internal offsets http://infozip.sourceforge.net/FAQ.html#unixSFX http://infozip.sourceforge.net/FAQ.html#unixSFX In other words, append any data you want, then fix the pointers in the central directory. There are tons of various zip utilities that will mess up depending on what you put in that self extractor including MacOS's built in finder based zip support. PKWare, the keepers of the documentation for the ZIP format refuse to specify that you must read the end of central directory. They do this by claiming you can stream a zip file. But you can't stream a zip file if you have to read the central directory because data you may have already used, "the definition of streaming", maybe not be listed in the central directory in which case you shouldn't have used it. In other words imagine each file in the zip is a compressed script and you are going to execute them. Imagine there are 2 scripts, the first one is "rm -rf /" and the second "ls /". The central directory only points to the 2nd script but if you stream you'll read the first script an execute it. The ZIP spec claims you can stream but clearly you can't.