hayd / deno-zip

A JSZip wrapper for handling zipfiles in deno
MIT License
21 stars 16 forks source link

Fuzzy behavior #27

Open aef opened 3 years ago

aef commented 3 years ago

So I tried to load some EPUBs (based on ZIP containers). Sometimes they load fine, sometimes they fail. I wrote some tests for it here. At least for me these sometimes pass and other times they produce the following result:

deno test --unstable --allow-read epub.test.ts
running 3 tests from file:///home/aef/Projects/deno-zip/epub.test.ts
test can load an EPUB container file ... ok (30ms)
test can load another EPUB container file ... FAILED (4ms)
test can load an EPUB media type ... FAILED (4ms)

failures:

can load another EPUB container file
Error: Corrupted zip: can't find end of central directory
    at ZipEntries.readEndOfCentral (https://dev.jspm.io/npm:jszip@3.5.0/lib/zipEntries.dew.js:197:17)
    at ZipEntries.load (https://dev.jspm.io/npm:jszip@3.5.0/lib/zipEntries.dew.js:287:12)
    at https://dev.jspm.io/npm:jszip@3.5.0/lib/load.dew.js:64:18
    at async JSZip.loadAsync (file:///home/aef/Projects/deno-zip/mod.ts:172:5)
    at async readZip (file:///home/aef/Projects/deno-zip/mod.ts:22:3)
    at async file:///home/aef/Projects/deno-zip/epub.test.ts:15:32
    at async asyncOpSanitizer (deno:runtime/js/40_testing.js:21:9)
    at async resourceSanitizer (deno:runtime/js/40_testing.js:58:7)
    at async exitSanitizer (deno:runtime/js/40_testing.js:85:9)
    at async runTest (deno:runtime/js/40_testing.js:199:7)

can load an EPUB media type
Error: Corrupted zip: can't find end of central directory
    at ZipEntries.readEndOfCentral (https://dev.jspm.io/npm:jszip@3.5.0/lib/zipEntries.dew.js:197:17)
    at ZipEntries.load (https://dev.jspm.io/npm:jszip@3.5.0/lib/zipEntries.dew.js:287:12)
    at https://dev.jspm.io/npm:jszip@3.5.0/lib/load.dew.js:64:18
    at async JSZip.loadAsync (file:///home/aef/Projects/deno-zip/mod.ts:172:5)
    at async readZip (file:///home/aef/Projects/deno-zip/mod.ts:22:3)
    at async file:///home/aef/Projects/deno-zip/epub.test.ts:22:32
    at async asyncOpSanitizer (deno:runtime/js/40_testing.js:21:9)
    at async resourceSanitizer (deno:runtime/js/40_testing.js:58:7)
    at async exitSanitizer (deno:runtime/js/40_testing.js:85:9)
    at async runTest (deno:runtime/js/40_testing.js:199:7)

failures:

    can load another EPUB container file
    can load an EPUB media type

test result: FAILED. 1 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out (190ms)

I'm running

deno --version
deno 1.10.2 (release, x86_64-unknown-linux-gnu)
v8 9.1.269.27
typescript 4.2.2

on Linux 5.10.0-0.bpo.5-amd64 #1 SMP Debian 5.10.24-1~bpo10+1 (2021-03-29) x86_64 GNU/Linux

aef commented 3 years ago

Today, all 3 tests failed without any code changes:

deno test --unstable --allow-read epub.test.ts 
running 3 tests from file:///home/aef/Projects/deno-zip/epub.test.ts
test can load an EPUB container file ... FAILED (8ms)
test can load another EPUB container file ... FAILED (70ms)
test can load an EPUB media type ... FAILED (19ms)

failures:

can load an EPUB container file
Error: Corrupted zip: can't find end of central directory
    at ZipEntries.readEndOfCentral (https://dev.jspm.io/npm:jszip@3.5.0/lib/zipEntries.dew.js:197:17)
    at ZipEntries.load (https://dev.jspm.io/npm:jszip@3.5.0/lib/zipEntries.dew.js:287:12)
    at https://dev.jspm.io/npm:jszip@3.5.0/lib/load.dew.js:64:18
    at async JSZip.loadAsync (file:///home/aef/Projects/deno-zip/mod.ts:172:5)
    at async readZip (file:///home/aef/Projects/deno-zip/mod.ts:22:3)
    at async file:///home/aef/Projects/deno-zip/epub.test.ts:8:32
    at async asyncOpSanitizer (deno:runtime/js/40_testing.js:21:9)
    at async resourceSanitizer (deno:runtime/js/40_testing.js:58:7)
    at async exitSanitizer (deno:runtime/js/40_testing.js:85:9)
    at async runTest (deno:runtime/js/40_testing.js:199:7)

can load another EPUB container file
Error: Corrupted zip: can't find end of central directory
    at ZipEntries.readEndOfCentral (https://dev.jspm.io/npm:jszip@3.5.0/lib/zipEntries.dew.js:197:17)
    at ZipEntries.load (https://dev.jspm.io/npm:jszip@3.5.0/lib/zipEntries.dew.js:287:12)
    at https://dev.jspm.io/npm:jszip@3.5.0/lib/load.dew.js:64:18
    at async JSZip.loadAsync (file:///home/aef/Projects/deno-zip/mod.ts:172:5)
    at async readZip (file:///home/aef/Projects/deno-zip/mod.ts:22:3)
    at async file:///home/aef/Projects/deno-zip/epub.test.ts:15:32
    at async asyncOpSanitizer (deno:runtime/js/40_testing.js:21:9)
    at async resourceSanitizer (deno:runtime/js/40_testing.js:58:7)
    at async exitSanitizer (deno:runtime/js/40_testing.js:85:9)
    at async runTest (deno:runtime/js/40_testing.js:199:7)

can load an EPUB media type
Error: Corrupted zip: can't find end of central directory
    at ZipEntries.readEndOfCentral (https://dev.jspm.io/npm:jszip@3.5.0/lib/zipEntries.dew.js:197:17)
    at ZipEntries.load (https://dev.jspm.io/npm:jszip@3.5.0/lib/zipEntries.dew.js:287:12)
    at https://dev.jspm.io/npm:jszip@3.5.0/lib/load.dew.js:64:18
    at async JSZip.loadAsync (file:///home/aef/Projects/deno-zip/mod.ts:172:5)
    at async readZip (file:///home/aef/Projects/deno-zip/mod.ts:22:3)
    at async file:///home/aef/Projects/deno-zip/epub.test.ts:22:32
    at async asyncOpSanitizer (deno:runtime/js/40_testing.js:21:9)
    at async resourceSanitizer (deno:runtime/js/40_testing.js:58:7)
    at async exitSanitizer (deno:runtime/js/40_testing.js:85:9)
    at async runTest (deno:runtime/js/40_testing.js:199:7)

failures:

    can load an EPUB container file
    can load another EPUB container file
    can load an EPUB media type

test result: FAILED. 0 passed; 3 failed; 0 ignored; 0 measured; 0 filtered out (229ms)
hayd commented 3 years ago

On docker I ran this more than 10 times without reproducing this error.

What OS are you using and which version of deno?