[Cuis-dev] [DEFECT] Can't zip Cuis' sources file

Gerald Klix cuis.01 at klix.ch
Wed Nov 22 03:13:20 PST 2023


Hi Juan,

I got tried to work around this problem by reading the
license files in binary mode and converting them to a string.
However this leads to as CRC error:

  extracting: LICENSES.txt             bad CRC 46294e2b  (should be 
c42f8133)


As promised I skimmed the ZIP file spec at 
https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT
I only saw provisions for UTF-8 file names.
Indeed we have problems storing such files; adding
this one 
https://github.com/Cuis-Smalltalk/Cuis-Smalltalk-Dev/blob/master/CoreUpdates/5922-FixedClassMethodPushDown-Tom%C3%A1sSpognardi-2023Jul09-20h38m-TS.001.cs.st
yields the following error when listing the contents withunzip -l

      1195  2023-07-19 20:39 
Image/CoreUpdates/5922-FixedClassMethodPushDown-TomásSpognardi-2023Jul09-20h38m-TS.001.cs.s
error:  expected central file header signature not found (file #459).
   (please check that you have transferred or created the zipfile in the


*The biggest problem however is this one:

*Execute the following code snippet:

'testIn.bin' asFileEntry forceWriteStreamDo: [ :ws |
     ws binary.
     ws nextPutAll: #[16rF1 16rF7] ].


ZipArchive new
     zipFileComment: 'ZIP file test';
     addFile: 'testIn.bin' as: 'testOut.bin';
     writeToFileNamed: 'testbin.zip'

Then unzip the file with:

bear at speedy ~/s/c/Environments> unzip testbin.zip
Archive:  testbin.zip
ZIP file test
   inflating: testOut.bin

This yields the following:

bear at speedy ~/s/c/Environments> ls -l test*.bin
-rw-r--r-- 1 bear bear 2 Nov 22 12:01 testIn.bin
-rw-rw-rw- 1 bear bear 4 Nov 22 12:01 testOut.bin

Invoking hexdump on both files shows a "slight" difference:

bear at speedy ~/s/c/Environments> hexdump testIn.bin
0000000 f7f1
0000002
bear at speedy ~/s/c/Environments> hexdump testOut.bin
0000000 b1c3 b7c3
0000004

Obviously some UTF8 conversion happened.
Needless to say that ZipArchive can't be used to compress binary
files and thus I can't create a distribution of Haver
with my current tool-set.


Best Regards,

Gerald



On 11/22/23 10:21 AM, Gerald Klix via Cuis-dev wrote:
> Thank's Juan,
>
> this works now.
>
> Alas when I tried to create a new Haver release I ran into another 
> problem.
> I also add strings to the ZIP-archive, for example a generated file 
> that contains
> all the contents of all the license files found. The resulting string 
> contains
> Unicode code-points, which makes the CRC computation fail.
>
> In essence when sending #updateCrc:from:to:in: the primitive fails – for
> obvious reasons – and the failure code kicks in. This in turn 
> (indirectly) sends #bitXor:
> to a UnicodePoint instance, which results in a DNU exception.
>
> I will try to do some research on how UTF8 data is supposed
> to be stored in a ZIP file.
>
>
> Thank's again and Best Regards,
>
> Gerald
>
>
>
> On 11/21/23 9:12 PM, Juan Vuletich wrote:
>> On 11/14/2023 10:20 AM, Gerald Klix via Cuis-dev wrote:
>>> Hi all, Hi Juan,
>>>
>>> The following snippet does not terminate (within reasonable time, 20h):
>>>
>>> (z1 := ZipArchive new) zipFileComment: 'ZIP test'.
>>> z1
>>>     addFile: SourceFiles first fileEntry as: 'f1';
>>>     writeToFileNamed: 'test.zip';
>>>     close.
>>>
>>> Adding small test files, created like this: echo test > test.txt ,
>>> however does work:
>>>
>>> (z3 := ZipArchive new) zipFileComment: 'ZIP test'.
>>> z3
>>>     addFile: Smalltalk imageName as: 'f3';
>>>     writeToFileNamed: 'test.zip';
>>>     close.
>>>
>>>
>>>
>>> Best Regards,
>>>
>>> Gerald
>>
>> Hi Gerald,
>>
>> I just pushed a fix to GitHub. Thanks for reporting.
>>
>> Cheers,
>>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20231122/0c78cd32/attachment.htm>


More information about the Cuis-dev mailing list