The Trunk: Compression-ar.19.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Compression-ar.19.mcz

commits-2
Andreas Raab uploaded a new version of Compression to project The Trunk:
http://source.squeak.org/trunk/Compression-ar.19.mcz

==================== Summary ====================

Name: Compression-ar.19
Author: ar
Time: 10 August 2010, 1:18:33.227 pm
UUID: 85770924-100a-fc44-bbfa-1b7ab229e24c
Ancestors: Compression-nice.18

Fix handling of empty members in ZipArchives which would produce zips considered corrupt by other tools (unzip -t).

=============== Diff against Compression-nice.18 ===============

Item was changed:
  ----- Method: ZipArchiveMember>>writeDataTo: (in category 'private-writing') -----
  writeDataTo: aStream
  "Copy my (possibly inflated or deflated) data to the given stream.
  This might do compression, decompression, or straight copying, depending
  on the values of compressionMethod and desiredCompressionMethod"
 
+ "Note: Do not shortcut this method if uncompressedSize = 0. Even in this case
+ data may be produced by the compressor (i.e., '' zipped size > 0) and must
+ be stored in the file or else other utilities will treat the zip file as corrupt."
- uncompressedSize = 0 ifTrue: [ ^self ]. "nothing to do because no data"
 
  (compressionMethod = CompressionStored and: [ desiredCompressionMethod = CompressionDeflated ])
  ifTrue: [ ^self compressDataTo: aStream ].
 
  (compressionMethod = CompressionDeflated and: [ desiredCompressionMethod = CompressionStored ])
  ifTrue: [ ^self uncompressDataTo: aStream ].
 
  self copyDataTo: aStream.!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Compression-ar.19.mcz

Javier Diaz-Reinoso
> On 10/08/2010, at 15:19, [hidden email] wrote:
>
> Fix handling of empty members in ZipArchives which would produce zips considered corrupt by other tools (unzip -t).
>
> =============== Diff against Compression-nice.18 ===============
>
> Item was changed:
>  ----- Method: ZipArchiveMember>>writeDataTo: (in category 'private-writing') -----
>  writeDataTo: aStream
...

This remember me of a bug who also created corrupt zip files, in ZipArchiveMember>>dosToUnixTime: for converting years the method move 1980 to 1911, so the year 2000 is moved to 1931, but February/1931 was not a leap year, is that rule of divisible by 400, so is not a very common bug.


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Compression-ar.19.mcz

Andreas.Raab
On 8/10/2010 4:51 PM, Javier Díaz Reinoso wrote:

>> On 10/08/2010, at 15:19, [hidden email] wrote:
>>
>> Fix handling of empty members in ZipArchives which would produce zips considered corrupt by other tools (unzip -t).
>>
>> =============== Diff against Compression-nice.18 ===============
>>
>> Item was changed:
>>   ----- Method: ZipArchiveMember>>writeDataTo: (in category 'private-writing') -----
>>   writeDataTo: aStream
> ...
>
> This remember me of a bug who also created corrupt zip files, in ZipArchiveMember>>dosToUnixTime: for converting years the method move 1980 to 1911, so the year 2000 is moved to 1931, but February/1931 was not a leap year, is that rule of divisible by 400, so is not a very common bug.

Do you have a fix for that issue by any chance?

Cheers,
   - Andreas

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Compression-ar.19.mcz

Javier Diaz-Reinoso
On 11/08/2010, at 02:15, Andreas Raab wrote:

> On 8/10/2010 4:51 PM, Javier Díaz Reinoso wrote:
>>> On 10/08/2010, at 15:19, [hidden email] wrote:
>>>
>>> Fix handling of empty members in ZipArchives which would produce zips considered corrupt by other tools (unzip -t).
>>>
>>> =============== Diff against Compression-nice.18 ===============
>>>
>>> Item was changed:
>>>  ----- Method: ZipArchiveMember>>writeDataTo: (in category 'private-writing') -----
>>>  writeDataTo: aStream
>> ...
>>
>> This remember me of a bug who also created corrupt zip files, in ZipArchiveMember>>dosToUnixTime: for converting years the method move 1980 to 1911, so the year 2000 is moved to 1931, but February/1931 was not a leap year, is that rule of divisible by 400, so is not a very common bug.
>
> Do you have a fix for that issue by any chance?
>
> Cheers,
>  - Andreas
>
Fix attached, Ned Konz was using DOS<->unix<->squeakDate conversions, instead I added squeakToDosTime: and dosToSqueakTime: to convert DOS<->squeakDate.

I tested with a file created in 29/Feb/2000 and works OK, with the previous version the error was 'Error: day is after month ends', perhaps needs some more testing.




ZipDates.1.cs (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Compression-ar.19.mcz

Andreas.Raab
On 8/11/2010 9:27 AM, Javier Díaz Reinoso wrote:
> Fix attached, Ned Konz was using DOS<->unix<->squeakDate conversions, instead I added squeakToDosTime: and dosToSqueakTime: to convert DOS<->squeakDate.
>
> I tested with a file created in 29/Feb/2000 and works OK, with the previous version the error was 'Error: day is after month ends', perhaps needs some more testing.

Thanks I just added it (and a test for the specific problem you were
noticing).

Cheers,
   - Andreas