elastic/support-diagnostics

created zip cannot be unpacked with windows built-in zip

fgierlinger opened this issue · 4 comments

Summary
The zip created in the support-diagnostics-app docker container cannot be unpacked with the windows built-in zip. When trying to unpack the zip in windows 10 the built-in zip utility complains, that the compressed folder is invalid. When opening the zip archive with the Windows Explorer to list the content, no content is shown "This folder is empty." .

image

Unpacking the archive with the powershell Expand-Archive module and unpacking in RHEL with unzip succeeds without error.

PS > Expand-Archive -Verbose .\api-diagnostics-20210819-125842.zip
VERBOSE: Erweitern wird vorbereitet...
VERBOSE: Performing the operation "Expand-Archive" on target
"C:\DATA\api-diagnostics-20210819-125842.zip".
VERBOSE: Performing the operation "Create Directory" on target "Destination:
C:\DATA\api-diagnostics-20210819-125842".
VERBOSE: 'C:\DATA\api-diagnostics-20210819-125842\api-diagnostics-20210819-125842\' has been added.
VERBOSE: 'C:\DATA\api-diagnostics-20210819-125842\api-diagnostics-20210819-125842\diagnostics.log'
has been created.
$ unzip -v api-diagnostics-20210819-125842.zip
Archive:  api-diagnostics-20210819-125842.zip
 Length   Method    Size  Cmpr    Date    Time   CRC-32   Name
--------  ------  ------- ---- ---------- ----- --------  ----
       0  Defl:N        2   0% 08-19-2021 12:58 00000000  /api-diagnostics-20210819-125842/
    1427  Defl:N      466  67% 08-19-2021 12:58 e994bc7e  /api-diagnostics-20210819-125842/diagnostics.log
--------          -------  ---                            -------
    1427              468  67%                            2 files

Expected behaviour
The zip can be opened and extracted with the Compressed Folder Tools in the Windows Explorer, as well as with the command line tools in Windows and GNU/Linux.

System Information
OS: Windows 10 20H2
Support Diagnostics: v8.1.4

Hi @fgierlinger, is this a one-off error or is this happening on a regular basis?

As a small aside, WinZip is a specific application that is separate from the built-in Windows Zip utility, which frequently has issues like this in my experience. If you keep running into issues, you may want to check out 7-Zip or some other Zip utility for Windows, separate from the built-in functionality.

Separately, unless this is happening consistently (and possibly even then), there's not much we can do beyond exploring an update for our libraries because we are using Apache Commons Compress to create the file archives:

if(filename.endsWith(".zip")){
ais = new ZipArchiveInputStream(inputStream);
}
else if (filename.endsWith(".tar")){
ais = new TarArchiveInputStream(inputStream);
}
else if (filename.endsWith(".tar.gz")){
ais = new TarArchiveInputStream(new GzipCompressorInputStream(inputStream));
}

this happening on a regular basis?

@pickypg yes, whenever I had to submit an elastic support package to the elastic support I received a response, that the zip was empty. Which I couldn't comprehend, since unzip -l showed me some content. Now I finally got the time to look into the issue and found what I described above.

As a small aside, WinZip is a specific application that is separate from the built-in Windows Zip utility,

You are right, this is my mistake. I have only tested this with the windows built-in Zip utility. I will rename the issue accordingly.

Separately, unless this is happening consistently (and possibly even then)

As far as I have noticed, this issue appears consistently.

There's a newer version of the Apache Commons Compress that we can update to and hopefully this will fix the issue.

I updated to commons-compress version 1.21 and released it in 8.2.2. @fgierlinger that's unfortunately the best we can do, so I hope that it works. If it continues to have issues, I do suggest trying a different Zip utility in Windows (or hopefully Windows 11 makes it work).