p7zip-project / p7zip

A new p7zip fork with additional codecs and improvements (forked from https://sourceforge.net/projects/sevenzip/ AND https://sourceforge.net/projects/p7zip/).
797 stars 109 forks source link

Generated files differ from 7zip for same settings #54

Closed cslycord closed 3 years ago

cslycord commented 4 years ago

Obviously this is a corner case, but if open a PPTX file with 7zip in windows, extract the contents to an empty folder and create a zip of the contents, I can get a zip file that after renaming it to pptx, it still opens perfectly in powerpoint. But with p7zip, the same isn't true with the same settings.

As long as I stick to Deflate, 7zip produces something that opens fine in PowerPoint after renaming it to a pptx file.

But with p7zip with the same settings (Deflate, ultra/-mx=9, word size 258/-mfb=258), the resulting pptx will invariably open but with error popups that the file needs repairing with followed by a complaint that there's content missing.

I'll upload a minimal reproducing file when I work next in case it helps.

jinfeihan57 commented 4 years ago

Which version of 7zip do you use? I tested it on 7zip19.00 and it also needs to be repaired to open. Please upload you file,thanks.

cslycord commented 4 years ago

Been using 19.00. 64-bit, although never using "deflate64" since with that it always gives me a corrupted file

On Sun, Jun 28, 2020, 10:50 AM jinfeihan57 notifications@github.com wrote:

Which version of 7zip do you use? I tested it on 7zip19.00 and it also needs to be repaired to open. Please upload you file,thanks.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/szcnick/p7zip/issues/54#issuecomment-650668559, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5TL7K7N4LZVMQVGA2BZZLRY2OYBANCNFSM4OJ6KEFQ .

cslycord commented 4 years ago

The way I created these is I opened the original in 7zip, extracted it to a directory, then inside that directory, I selected all of the content originally from the PPTX and right-clicked on them and selected 7zip and add to archive. Then the settings were made as in the screen shot (Deflate, ultra, word size 258, and dictionary size 32k). I believe the dictionary size doesn't do anything as it's really for bzip. After the file is generated, I changed it to a pptx and it works perfectly.

Then in a unix shell, I moved to the same directory, and created a new zip archive with ~/p7zip/bin/7z a -mm=Deflate -mx=9 -mfb=258 blah.zip . and renamed it to a pptx. It's the same size as the one 7zip made but gives errors upon opening in powerpoint unlike the other file.

Earth Day_orig.pptx Earth Day_7zip.pptx Earth Day_p7zip.pptx settings

jinfeihan57 commented 4 years ago

@cslycord Can you test it on 7zip 17.01 https://sourceforge.net/projects/sevenzip/files/7-Zip/17.01/ . p7zip 17.02 is more like 7zip 17.01

cslycord commented 4 years ago

With 7zip 17.01, the same thing happened. It generated a file that opened with no issues in powerpoint.

jinfeihan57 commented 4 years ago

Please upload the file. Thanks!

cslycord commented 4 years ago

Earth Day_7zip_1701.pptx Here it is.

ghost commented 4 years ago

@cslycord

So Earth Day_p7zip.pptx is the file generated by p7zip and PowerPoint complains that the file is corrupted, right?

LibreOffice Impress 6.4.4.2 opens that file fine. Since that presentation file is very simple and does not use any fancy or PowerPoint-specific features, you can try LibreOffice.

By listing the contents using 7z l -slt file.zip, I notice that the ZIP file created by p7zip contains Unix file attributes. My wild guess is that PowerPoint is "picky" and expects the file attributes to be in Windows' format.

For example, for docProps/thumbnail.jpeg:

Archived by p7zip:

Path = docProps/thumbnail.jpeg
Folder = -
Size = 2926
Packed Size = 2283
Modified = 1980-01-01 00:00:00
Created = 2020-06-29 09:00:59
Accessed = 2020-06-29 09:00:59
Attributes = _ -rwxrwxrwx
Encrypted = -
Comment = 
CRC = D7CC1409
Method = Deflate
Host OS = Unix
Version = 20
Volume Index = 0

Archived by 7-Zip:

Path = docProps/thumbnail.jpeg
Folder = -
Size = 2926
Packed Size = 2283
Modified = 1980-01-01 00:00:00
Created = 2020-06-29 08:54:15
Accessed = 2020-06-29 08:54:15
Attributes = 
Encrypted = -
Comment = 
CRC = D7CC1409
Method = Deflate
Host OS = FAT
Version = 20
Volume Index = 0
cslycord commented 4 years ago

Is there an option for having p7zip not use the unix attributes when the files are generated? I don't see it in the options.

jinfeihan57 commented 4 years ago

I don't see any system option either.

Maybe you can ask the 7zip author on sourceforge.

slycordinator commented 2 years ago

I'm the same user as the reporter above, just with a new account.

I've found that the issue boils down to p7zip creating a file with inconsistent "characteristics" vs attributes when run in WSL.

1) If I use the zip command to repack the directory, docProps/thumbnail.jpeg has:

2) Using 7zip, the same file has:

3) With p7zip, the resulting file has:

The p7zip one seems incongruent; an NTFS file with unix attributes.

The files generated with zip and 7zip work perfectly.

The file created with p7zip gives a warning that it has to be repaired, though it works fine after clicking to repair.

Thanks