3

Closed

Bug when compressing .rar or .zip file

description

Hi,
 
I found a bug, when compressing(actually archiving) a .rar or .zip file into segments, particularly if the file is large enough to generate more than one segment, DotNetZip will throw a "FileNotFoundException", saying that the XXX.z01 doesn't exists. From the code, it seems the method WantReadAgain(file: ZipEntry.Writer.cs) returns true if compressed size is larger than original size, and that will direct to method "TruncateBackward" (file: ZipSegmentedStream.cs) which generates the exception.
 
the exception is thrown from the following code:
 
 
 
// get a new temp file, try 3 times:
        for (int i = 0; i < 3; i++)
        {
            try
            {
                _currentTempName = SharedUtilities.InternalGetTempFileName();
                File.Move(CurrentName, _currentTempName);  // move the .z0x file back to a temp name
            }
            catch(IOException)
            {
                if (i == 2) throw;
            }
        }
Closed Jun 18, 2011 at 3:38 AM by Cheeso
fixed in changeset 79356. First binary to contain this fix: v1.9.1.6

comments

lxitixl wrote Sep 6, 2010 at 6:32 AM

This seems like the same bug as #10143 at http://dotnetzip.codeplex.com/workitem/10143?ProjectName=dotnetzip (Splitting Large (~1gb+) files leads to an exception)

Cheeso wrote Jun 18, 2011 at 3:37 AM

Yes, this is a duplicate bug. It is fixed in v1.9.1.6, which will be available soon.