Ah, that's an interesting one! I took half an hour to investigate it.
lsar is a command that lets me list the contents of an archive.
$ lsar Editor-Mac.zip | head -5 Editor-Mac.zip: Zip Electron.app/Contents/Resources/app/ Electron.app/Contents/Resources/app/ace/ Electron.app/Contents/Resources/app/ace/cleanup.bat Electron.app/Contents/Resources/app/ace/mode-gml.js
When I count the number of entries in Editor-Mac.zip, I get:
$ lsar Editor-Mac.zip | wc -l 490
But if I sort the filenames and keep only the unique ones, I get:
$ lsar Editor-Mac.zip | sort -n | uniq | wc -l 409
This is consistent with other tests I've made - for example, diffing an empty folder against the zip (replicating what `butler push` does), then applying this patch (without verification, so it doesn't fail), then diffing Editor-Mac.zip against the newly-patched folder, and probing that patch:
$ butler probe zeropatch.pwr ∙ patch: 20 KiB before: 123 MiB in 318 files, 157 dirs, 0 symlinks after: 123 MiB in 248 files, 157 dirs, 0 symlinks [...]
So it seems the `.zip` archive contains multiple entries with the same path name - I didn't realize this was even possible :)
I was able to get a complete list by doing:
$ lsar Editor-Mac.zip | sort -n | uniq -c -d 2 Electron.app/Contents/Resources/app/ 2 Electron.app/Contents/Resources/app/ace/ 2 Electron.app/Contents/Resources/app/ace/cleanup.bat 2 Electron.app/Contents/Resources/app/ace/mode-gml.js [...]
Here's the full list if you're curious. The entries are also shown twice in 7-zip:
I'm happy that wharf caught that, but now there's two possible ways we could handle it:
- Reject .zip files that contain multiple entries with the same name (I'm strongly tempted by that option)
- This would've made the failure obvious when pushing the archive, and it would have had a proper error message, for example: Multiple entries with same filename found in .zip, bailing out (example: Electron.app/Contents/Resources/app/ace/cleanup.bat)
- Or accept these files and make later entries overwrite previous ones - but I'm not in love with that option at all
- First of all, I don't understand why 7-zip would ever generate a .zip archive with multiples entries of the same name
- What if the version you actually want is the earlier entry and not the later one?
- What if other archive extractors behave differently?
According to this StackOverflow topic, it's not a huge deal and we should be using the later ones. Hmm.