mate-desktop / engrampa

A file archiver for MATE
http://www.mate-desktop.org
GNU General Public License v2.0
113 stars 52 forks source link

Can't extract files from some ZIP files #346

Closed InfoLibre closed 4 years ago

InfoLibre commented 4 years ago

Expected behaviour

Extract files from all zip files.

Actual behaviour

Some zip files can't be unzipped with CAJA. ZIP error.txt

Steps to reproduce the behaviour

With CAJA, right-click on the PSWRD.ZIP file I joined here. Choose Extract here. An error occurs.

MATE general version

1.22.2

Package version

1.22.2 PSWRD.ZIP

Linux Distribution

Linux Mint MATE 19.3

Link to downstream report of your Distribution

InfoLibre commented 4 years ago

I can open and extract files from this ZIP file with Midnight Commander, without any error.

rbuj commented 4 years ago

Make sure the PSWRD.ZIP file is not corrupted. You can try to recover the PSWRD.ZIP file:

$ zip -FF PSWRD.ZIP --out PSWRD-NEW.ZIP

test 1

$ 7z t PSWRD.ZIP 
...
ERRORS:
Headers Error

--
Path = PSWRD.ZIP
Type = zip
ERRORS:
Headers Error
Physical Size = 165480
...

test 2

$ 7z t PSWRD-NEW.ZIP 
...
Scanning the drive for archives:
1 file, 165480 bytes (162 KiB)

Testing archive: PSWRD-NEW.ZIP
--
Path = PSWRD-NEW.ZIP
Type = zip
Physical Size = 165480

Everything is Ok

Files: 32
Size:       307703
Compressed: 165480
InfoLibre commented 4 years ago

Yes, 7z find errors in it. But zip -F or -FF doesn't repair it. And I can extract files with mc and not with CAJA. Another example : BRGCLIP9.ZIP

InfoLibre commented 4 years ago

Other examples : AGATE.ZIP CARIB24.ZIP TAPMKR20.ZIP HYPHN1.ZIP BORIS.ZIP

rbuj commented 4 years ago

Yes, all zip files use legacy algorithms for compression method.

$ find . -name "*.ZIP" -exec zipdetails {} \; | grep "Compression Method" | cut -f 2- -d ' ' | sort -u
Compression Method    0000 'Stored'
Compression Method    0001 'Shrunk'
Compression Method    0006 'Imploded'

You can repack those files to 7z from command line:

$ sudo apt-get install atool
$ arepack -e -F 7z *.ZIP

Feel free to open a ticket in https://www.7-zip.org/support.html.

InfoLibre commented 4 years ago

Done : https://sourceforge.net/p/sevenzip/bugs/2238/

This ticket can be closed, as I made a bugreport on 7-zip website.

My other ticket on https://github.com/mate-desktop/engrampa/issues/347 has been closed without explanations. Could someone have a look at it, please ?

rbuj commented 4 years ago

I can unzip HYPHN1.ZIP from caja using "extract here". I can unzip the other files (new-AGATE.ZIP new-BORIS.ZIP new-CARIB24.ZIP new-TAPMKR20.ZIP) after fixing their headers:

$ for f in *.ZIP; do echo "zip -FF $f --out new-$f"; done | sh

All this suggests that the files are corrupted.

AGATE.ZIP was fixed after setting the bit 13 to 0 in General Purpose Flag: 0xA000 & (bitwise 0x2000) = 0x8000

$ zipdetails AGATE.ZIP > AGATE.ZIP.zipdetails
$ zipdetails new-AGATE.ZIP > new-AGATE.ZIP.zipdetails
$ diff AGATE.ZIP.zipdetails new-AGATE.ZIP.zipdetails
97,98c97
< 16385 General Purpose Flag  A000
<       [Bit 13]              1 'Encrypted Central Dir'
---
> 16385 General Purpose Flag  8000
120c119
< 163C4 General Purpose Flag  A000
---
> 163C4 General Purpose Flag  8000
123d121
<       [Bit 13]              1 'Encrypted Central Dir'
145,146c143
< 16403 General Purpose Flag  A000
<       [Bit 13]              1 'Encrypted Central Dir'
---
> 16403 General Purpose Flag  8000
168c165
< 16443 General Purpose Flag  A000
---
> 16443 General Purpose Flag  8000
171d167
<       [Bit 13]              1 'Encrypted Central Dir'
193,194c189
< 16483 General Purpose Flag  A000
<       [Bit 13]              1 'Encrypted Central Dir'
---
> 16483 General Purpose Flag  8000
216c211
< 164C3 General Purpose Flag  A000
---
> 164C3 General Purpose Flag  8000
219d213
<       [Bit 13]              1 'Encrypted Central Dir'
InfoLibre commented 4 years ago

Strange, I've got more than 100 files like that. Perhaps they were zipped with a buggy software. Thank you for you help.