Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: java.util.zip.ZipException: invalid entry CRC #6

Open
rockstorm101 opened this issue May 14, 2021 · 4 comments
Open

Error: java.util.zip.ZipException: invalid entry CRC #6

rockstorm101 opened this issue May 14, 2021 · 4 comments

Comments

@rockstorm101
Copy link
Contributor

Hi, I manually installed the filters as per [1] in an empty git repository. Then I created a simple .odt file with just a single line. git commit the file, added a simple mod and tried to see the diff. Here is the error I got:

$ git diff
warning: CRLF will be replaced by LF in hello.odt.
The file will have its original line endings in your working directory
Exception in thread "main" java.util.zip.ZipException: invalid entry CRC (expected 0xecf40a9d but got 0x716ecc7d)
        at java.base/java.util.zip.ZipInputStream.read(ZipInputStream.java:224)
        at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
        at io.github.hoijui.rezipdoc.Utils.transferTo(Utils.java:348)
        at io.github.hoijui.rezipdoc.ReZip.reZip(ReZip.java:248)
        at io.github.hoijui.rezipdoc.ReZip.reZip(ReZip.java:229)
        at io.github.hoijui.rezipdoc.ReZip.reZip(ReZip.java:201)
        at io.github.hoijui.rezipdoc.ReZip.main(ReZip.java:188)
error: external filter 'java -cp .git/rezipdoc-*.jar io.github.hoijui.rezipdoc.ReZip --compressed' failed 1
error: external filter 'java -cp .git/rezipdoc-*.jar io.github.hoijui.rezipdoc.ReZip --compressed' failed
Exception in thread "main" java.util.zip.ZipException: invalid entry CRC (expected 0xecf40a9d but got 0x716ecc7d)
        at java.base/java.util.zip.ZipInputStream.read(ZipInputStream.java:224)
        at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
        at io.github.hoijui.rezipdoc.Utils.transferTo(Utils.java:348)
        at io.github.hoijui.rezipdoc.ZipDoc.transform(ZipDoc.java:153)
        at io.github.hoijui.rezipdoc.ZipDoc.transform(ZipDoc.java:125)
        at io.github.hoijui.rezipdoc.ZipDoc.main(ZipDoc.java:112)
fatal: unable to read files to diff

Java version info:

$ java --version 
openjdk 11.0.11 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-post-Debian-1)
OpenJDK 64-Bit Server VM (build 11.0.11+9-post-Debian-1, mixed mode, sharing)

System info:

$ uname -a
Linux [...] 5.10.0-6-amd64 #1 SMP Debian 5.10.28-1 (2021-04-09) x86_64 GNU/Linux

$ lsb_release -a
Distributor ID:	Debian
Description:	Debian GNU/Linux 11 (bullseye)
Release:	11
Codename:	bullseye
@rockstorm101
Copy link
Contributor Author

In case it helps, I just found out it works just fine with FreeCAD files. So it might be something related to the '.odt' file extension.

$ libreoffice --version
LibreOffice 7.0.4.2 00(Build:2)

@hoijui
Copy link
Owner

hoijui commented Jul 26, 2021

thank you for the report, and sorry for the late answer!
So it looks like the Java internal ZIP library found an error in that ODT file. I would argue, that this either means, the file is not in the ZIP format, or it is corrupted. It seems very unlikely to me, that the Java internal ZIP implementation is buggy.
I just checked on my system, and my ODT files seem to be valid ZIP files. Can you check yours with:

unzip -t file.odt

please?

@rockstorm101
Copy link
Contributor Author

Hi @hoijui, thanks for replying! So, I re-did all the steps I reported and was able to reproduce the behaviour again. As requested see below, I don't think the file corrupted or anything.

$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   hello.odt

no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
warning: CRLF will be replaced by LF in hello.odt.
The file will have its original line endings in your working directory
Exception in thread "main" java.util.zip.ZipException: invalid entry CRC (expected 0x1832bedd but got 0xfe27eff6)
        at java.base/java.util.zip.ZipInputStream.read(ZipInputStream.java:224)
        at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
        at io.github.hoijui.rezipdoc.Utils.transferTo(Utils.java:348)
        at io.github.hoijui.rezipdoc.ReZip.reZip(ReZip.java:248)
        at io.github.hoijui.rezipdoc.ReZip.reZip(ReZip.java:229)
        at io.github.hoijui.rezipdoc.ReZip.reZip(ReZip.java:201)
        at io.github.hoijui.rezipdoc.ReZip.main(ReZip.java:188)
error: external filter 'java -cp .git/rezipdoc-*.jar io.github.hoijui.rezipdoc.ReZip --compressed' failed 1
error: external filter 'java -cp .git/rezipdoc-*.jar io.github.hoijui.rezipdoc.ReZip --compressed' failed
Exception in thread "main" java.util.zip.ZipException: invalid entry CRC (expected 0x1832bedd but got 0xfe27eff6)
        at java.base/java.util.zip.ZipInputStream.read(ZipInputStream.java:224)
        at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
        at io.github.hoijui.rezipdoc.Utils.transferTo(Utils.java:348)
        at io.github.hoijui.rezipdoc.ZipDoc.transform(ZipDoc.java:153)
        at io.github.hoijui.rezipdoc.ZipDoc.transform(ZipDoc.java:125)
        at io.github.hoijui.rezipdoc.ZipDoc.main(ZipDoc.java:112)
fatal: unable to read files to diff
$ unzip -t hello.odt 
Archive:  hello.odt
    testing: mimetype                 OK
    testing: Configurations2/toolbar/   OK
    testing: Configurations2/floater/   OK
    testing: Configurations2/popupmenu/   OK
    testing: Configurations2/menubar/   OK
    testing: Configurations2/accelerator/   OK
    testing: Configurations2/toolpanel/   OK
    testing: Configurations2/progressbar/   OK
    testing: Configurations2/statusbar/   OK
    testing: Configurations2/images/Bitmaps/   OK
    testing: manifest.rdf             OK
    testing: meta.xml                 OK
    testing: settings.xml             OK
    testing: Thumbnails/thumbnail.png   OK
    testing: styles.xml               OK
    testing: content.xml              OK
    testing: META-INF/manifest.xml    OK
No errors detected in compressed data of hello.odt.

I tried with a FreeCAD file to confirm the installation was correct and it works OK (had to add "*.FCStd reZipDoc" at the end of file .git/info/attributes)

$ git status
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   cube.FCStd

no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
diff --git a/cube.FCStd b/cube.FCStd
index ab6c899..ff5f8bf 100644
--- a/cube.FCStd
+++ b/cube.FCStd
@@ -30,7 +30,7 @@ Sub-file:     Document.xml
             <String value=""/>
         </Property>
         <Property name="LastModifiedDate" type="App::PropertyString" status="16777217">
-            <String value="2021-07-26T17:45:27Z"/>
+            <String value="2021-07-26T17:46:33Z"/>
         </Property>
         <Property name="License" type="App::PropertyString" status="1">
             <String value="All rights reserved"/>
[...]

I've tried with an '.ods' file just in case it was only a problem with Writer and I got the same error (see third chunk of code).

$ git status 
On branch master
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   hello.ods

no changes added to commit (use "git add" and/or "git commit -a")
$ git diff
warning: CRLF will be replaced by LF in hello.ods.
The file will have its original line endings in your working directory
Exception in thread "main" java.util.zip.ZipException: invalid entry CRC (expected 0xd15794a2 but got 0x1bf12e26)
        at java.base/java.util.zip.ZipInputStream.read(ZipInputStream.java:224)
        at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
        at io.github.hoijui.rezipdoc.Utils.transferTo(Utils.java:348)
        at io.github.hoijui.rezipdoc.ReZip.reZip(ReZip.java:248)
        at io.github.hoijui.rezipdoc.ReZip.reZip(ReZip.java:229)
        at io.github.hoijui.rezipdoc.ReZip.reZip(ReZip.java:201)
        at io.github.hoijui.rezipdoc.ReZip.main(ReZip.java:188)
error: external filter 'java -cp .git/rezipdoc-*.jar io.github.hoijui.rezipdoc.ReZip --compressed' failed 1
error: external filter 'java -cp .git/rezipdoc-*.jar io.github.hoijui.rezipdoc.ReZip --compressed' failed
Exception in thread "main" java.util.zip.ZipException: invalid entry CRC (expected 0xd15794a2 but got 0x1bf12e26)
        at java.base/java.util.zip.ZipInputStream.read(ZipInputStream.java:224)
        at java.base/java.io.FilterInputStream.read(FilterInputStream.java:107)
        at io.github.hoijui.rezipdoc.Utils.transferTo(Utils.java:348)
        at io.github.hoijui.rezipdoc.ZipDoc.transform(ZipDoc.java:153)
        at io.github.hoijui.rezipdoc.ZipDoc.transform(ZipDoc.java:125)
        at io.github.hoijui.rezipdoc.ZipDoc.main(ZipDoc.java:112)
fatal: unable to read files to diff

Anything else I can do to debug this further please let me know. Disclaimer: my knowledge of Java is very limited :P.

@hoijui
Copy link
Owner

hoijui commented Jul 26, 2021

hmm.. that is strange... :/
I guess I will have to test too then. Thank you!
(can't promise to be able to get to it any time soon)

Thanks for the fast and verbose reply! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants