Zip file problem on Mac
neville.smythe at optusnet.com.au
Sat May 7 21:18:20 EDT 2022
> On 8 May 2022, at 2:00 am, Brian Milby wrote:
> It is a bug somewhere. See this big report:
> https://quality.livecode.com/show_bug.cgi?id=21447 <https://quality.livecode.com/show_bug.cgi?id=21447>
> I actually think it is related. The zip should be created as a Unix variant and not Fat and file attributes should be stored. One thing that could be tried is to manually set the executable bit when creating the archive. I was able to store a link in a zip using this method, but there is no way to read the file attributes in LC.
Brian, utter genius!
Not only do you pinpoint the bug — revZip is creating a ‘fat’ zip not a ‘unx’ zip and not adding the external attributes – but it looks like you have provided the workaround (for my problem of execute permissions at least)
I tried the implausible trick of using the undocumented revZipSetItemAttributes
put 0x80000000 into tExtAttributes -- regular file
add 0x01ED0000 to tExtAttributes -- rwxrwxr-x -- modify as per file (and may only do for Mac,Linux?)
revZipSetItemAttributes pArchive, pName, 3, tExtAttributes — 3 for unix system
for each file as it is added to the archive. I didn’t really expect this to work as the file is already added to the archive in ‘fat’ format.
Not only does unzip -Z report that the archive items are now in ‘unx’ format with permissions rwxrwxr-x, but astonishingly the zip actually decompresses to a working executable – well, only so far briefly tested on a Mac but it seems likely this is going to work on all platforms.
As you point out in your bug 21447 report, revZip probably won’t be able to decompress the archive correctly because of other deficiencies, but I only need the user's system to unpack it. And I will have to modify the permissions for each individual file in the archive.
I never thought I would use the expression, but, like , awesome! OK sorry I went there, but jolly well done, that man!
More information about the use-livecode