#1 2018-07-18 12:55:10

asdjklf
Member
Registered: 2018-07-18
Posts: 9

Created ZIP file is not valid

Hello,

I use the following code to create a .zip file:

class procedure TUtils.ZIP(const Dir, ZIPFile: string);
var
    Z: TZipWrite;
begin
    Z := TZipWrite.Create(ZIPFile);
    try
        Z.AddFolder(Dir);
    finally
        FreeAndNil(Z);
    end;
end;

... and the following batch to create a test directory:

mkdir "%~1"

"C:\msys64\usr\bin\dd.exe" if=/dev/urandom "of=%~1\File1.dat" bs=64M count=16 iflag=fullblock
"C:\msys64\usr\bin\dd.exe" if=/dev/urandom "of=%~1\File2.dat" bs=64M count=16 iflag=fullblock
"C:\msys64\usr\bin\dd.exe" if=/dev/urandom "of=%~1\File3.dat" bs=64M count=16 iflag=fullblock
"C:\msys64\usr\bin\dd.exe" if=/dev/urandom "of=%~1\File4.dat" bs=64M count=16 iflag=fullblock
"C:\msys64\usr\bin\dd.exe" if=/dev/urandom "of=%~1\File5.dat" bs=64M count=16 iflag=fullblock
"C:\msys64\usr\bin\dd.exe" if=/dev/urandom "of=%~1\File6.dat" bs=64M count=16 iflag=fullblock
"C:\msys64\usr\bin\dd.exe" if=/dev/urandom "of=%~1\File7.dat" bs=64M count=16 iflag=fullblock
"C:\msys64\usr\bin\dd.exe" if=/dev/urandom "of=%~1\File8.dat" bs=64M count=16 iflag=fullblock
"C:\msys64\usr\bin\dd.exe" if=/dev/urandom "of=%~1\File9.dat" bs=64M count=16 iflag=fullblock
"C:\msys64\usr\bin\dd.exe" if=/dev/urandom "of=%~1\File10.dat" bs=64M count=16 iflag=fullblock

7-zip shows errors while validating the created file.

Thank you

Offline

#2 2018-07-19 09:35:18

zed
Member
From: Belarus
Registered: 2015-02-26
Posts: 105

Re: Created ZIP file is not valid

What type of errors shows 7zip?

What shows unzip with -t switch?

Offline

#3 2018-07-19 14:15:46

asdjklf
Member
Registered: 2018-07-18
Posts: 9

Re: Created ZIP file is not valid

7-zip errors:

https://drive.google.com/file/d/1Sz0MuB … sp=sharing

Here is the output of 7z.exe (should be the same as unzip):

P:\>"C:\Program Files\7-ZIP_64_bit\7z.exe" t "C:\ProgramData\SPS\Reporting\Files\bigdir\139.zip"

7-Zip 18.01 (x64) : Copyright (c) 1999-2018 Igor Pavlov : 2018-01-28

Scanning the drive for archives:
1 file, 2150759962 bytes (2052 MiB)

Testing archive: C:\ProgramData\SPS\Reporting\Files\bigdir\139.zip
--
Path = C:\ProgramData\SPS\Reporting\Files\bigdir\139.zip
Type = zip
Physical Size = 2150759962

ERROR: Data Error : File1.dat
ERROR: Headers Error : File10.dat
ERROR: Headers Error : File2.dat
ERROR: Headers Error : File3.dat
ERROR: Data Error : File4.dat
ERROR: Headers Error : File5.dat
ERROR: Headers Error : File6.dat
ERROR: Headers Error : File7.dat

Sub items Errors: 8

Archives with Errors: 1

Sub items Errors: 8

Offline

#4 2018-07-19 15:19:03

zed
Member
From: Belarus
Registered: 2015-02-26
Posts: 105

Re: Created ZIP file is not valid

Ah, I think it's because resulting file size is > 2Gb. In this case Zip64 format should be used (instead simple Zip format) but mORMot doesn't support it.

Offline

#5 2018-07-19 15:56:16

zed
Member
From: Belarus
Registered: 2015-02-26
Posts: 105

Re: Created ZIP file is not valid

I make some tests and here is 4 Gb file size limitation, not 2. When mORMot needed to write more then 4 Gb data to output file, LongWord type overflow occurs and file truncated to zero.

It would be better if there was an exception with message that Zip file cannot be more than 4 Gb and Zip64 format is not supported.

Offline

#6 2018-07-19 20:57:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: Created ZIP file is not valid

Zip64 is indeed not yet supported.
Anyone has a clue how to add it?

Offline

#7 2018-07-20 08:21:47

zed
Member
From: Belarus
Registered: 2015-02-26
Posts: 105

Re: Created ZIP file is not valid

Offline

#8 2018-07-20 09:07:00

asdjklf
Member
Registered: 2018-07-18
Posts: 9

Re: Created ZIP file is not valid

Some time ago I asked for the implementation of zip64 in Quazip. Here are the corresponding commits: https://github.com/stachenov/quazip/sea … pe=Commits

Offline

#9 2018-07-23 12:23:05

asdjklf
Member
Registered: 2018-07-18
Posts: 9

Re: Created ZIP file is not valid

I will go back to AbZipper in the mean time. Thank you for a great library!

Offline

Board footer

Powered by FluxBB