[#TRUEZIP-233] ZipRepairPro generates "Compressed filesize

advertisement
[TRUEZIP-233] ZipRepairPro generates "Compressed filesize seems to be
incorrect." log message for archives modified with TrueZip Created: 02/Mar/12 Updated:
04/Jun/12 Resolved: 02/Mar/12
Status:
Project:
Component/s:
Affects
Version/s:
Fix Version/s:
Closed
TrueZIP
TrueZIP File*
TrueZIP 7.4.3
Type:
Reporter:
Resolution:
Labels:
Remaining
Estimate:
Time Spent:
Original
Estimate:
Bug
mihaela_calotescu
Works as designed
None
Not Specified
Attachments:
None
Priority:
Assignee:
Votes:
Major
Christian Schlichtherle
0
Not Specified
Not Specified
testModified.zip
testOriginal.zip
Description
After I use TrueZip to modify an entry from an archive, ZIPRepair Pro will generate the
following log message when I check if the resulting archive is corrupted:
"Compressed filesize seems to be incorrect.".
I used code from both TrueZip 6 and 7 versions. Here is a code sample that modifies an archive
entry using TrueZip7.4.3 (I have started from your sample at: http://truezip.java.net/truezipfile/index.html):
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import de.schlichtherle.truezip.file.TFile;
import de.schlichtherle.truezip.file.TFileOutputStream;
public class ModifyArchive {
public static void main(String[] args) {
// Sample starting from http://truezip.java.net/truezip-file/index.html
File file = new TFile("test.zip/test.txt");
OutputStream out = null;
try {
out = new TFileOutputStream(file);
// Write archive entry contents here.
out.write("test".getBytes("UTF-8"));
} catch (Exception e) {
e.printStackTrace();
} finally {
if (out != null) {
try {
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
}
You can find attached both initial and modified test archives.
Comments
Comment by Christian Schlichtherle [ 02/Mar/12 ]
There is nothing wrong with both attached ZIP files, except that I can tell by their meta data that
testOriginal.zip hasn't been created by TrueZIP.
I do not support third party tools, but I guess this software gets confused by the fact that the
compressed entry size is larger than the uncompressed entry size because of the very short
content (just four bytes).
Comment by mihaela_calotescu [ 07/Mar/12 ]
Hi,
The original file was created with 7-Zip and then modified by the code from my previous
message.
The problem is not related to the fact that the compressed entry size is larger than the
uncompressed entry size. I have modified the code to write more data in the archive file so that
the uncompressed size to be larger than the compressed size. ZipRepairPro generates the same
"Compressed filesize seems to be incorrect." message.
What I have found is that this message is generated when an archive entry content is modified,
but not when I add a new folder in archive:
TFile parentFile = new TFile("test.zip");
TFile folderToCreate = new TFile(parentFile, "testDir");
folderToCreate.mkdirs();
So, it seems that there could be some problems only when writing data to archive entries.
Any thoughts about what could be the source of the error message?
Regards,
Mihaela
Comment by Christian Schlichtherle [ 07/Mar/12 ]
This is the most basic use case and it works as designed and tested since years. Again, there is
nothing wrong with both files - they are both in compliance with the ZIP File Format
Specification. So this is an issue with Zip Repair Pro - not TrueZIP - and you should ask its
makers for help.
Generated at Wed Feb 10 00:35:30 UTC 2016 using JIRA 6.2.3#6260sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.
Download