[zip-devel] Some files fail to extract out of archive
Dmitry V'yal
akamaus at gmail.com
Thu Nov 26 05:32:36 UTC 2009
Greetings,
I tried to use the zip library to extract contents of odt files (which
afaik just zip files with fancy extension).
Soon I discovered, for some entries this function fails:
(defun extract-odt-contents (path arch-file)
(with-zipfile (odt path)
(zipfile-entry-contents (get-zipfile-entry arch-file odt))))
giving an error:
(extract-odt-contents "test_content/test.odt"
"Pictures/10000201000000B200000078985BB627.png")
The value
#<SB-SYS:FD-STREAM for "file
/home/maus/coding/Bodhy/Drupostal/test_conten..." {B6D6391}>
is not of type
SEQUENCE.
[Condition of type TYPE-ERROR]
Restarts:
0: [RETRY] Retry SLIME REPL evaluation request.
1: [ABORT] Return to SLIME's top level.
2: [TERMINATE-THREAD] Terminate this thread (#<THREAD
"new-repl-thread" RUNNING {B51D829}>)
Backtrace:
0: (READ-SEQUENCE #<SB-SYS:FD-STREAM for "file
/home/maus/coding/Bodhy/Drupostal/test_content/test.odt" {B6D6391}> #(0
0 0 0 0 0 ...))[:EXTERNAL]
1: ((SB-PCL::FAST-METHOD TRIVIAL-GRAY-STREAMS:STREAM-READ-SEQUENCE
(ZIP::TRUNCATING-STREAM T T T)) ..)[:EXTERNAL]
2: (READ-SEQUENCE #(0 0 0 0 0 0 ...) #<ZIP::TRUNCATING-STREAM
{B6F4D39}>)[:EXTERNAL]
3: (STORE #<ZIP::TRUNCATING-STREAM {B6F4D39}>
#<ZIP::BUFFER-OUTPUT-STREAM {B6F81D9}>)
4: ((SB-PCL::FAST-METHOD ZIPFILE-ENTRY-CONTENTS (ZIP::ZIPFILE-ENTRY)) ..)
5: (EXTRACT-ODT-CONTENTS "test_content/test.odt"
"Pictures/10000201000000B200000078985BB627.png")
**********************
I updated to last cvs version since then, but the problem still there.
I've made a bit of testing and found that some zip-entries have equal
:SIZE and :COMPRESSED-SIZE. And zipfile-entry-contents fails processing
them:
(do-zipfile-entries (n e (open-zipfile "/home/maus/stuff/test.odt" ))
(handler-case (when (> (zipfile-entry-size e) 0) (print e)
(format t "~&read ~A bytes~%" (length (zipfile-entry-contents e))))
(error () (format t "~&!!!cant read~%"))))
#S(ZIP::ZIPFILE-ENTRY
:NAME "mimetype"
:STREAM #<SB-SYS:FD-STREAM for "file /home/maus/stuff/test.odt"
{BE98E71}>
:OFFSET 0
:SIZE 39
:COMPRESSED-SIZE 39
:COMMENT NIL)
!!!cant read
#S(ZIP::ZIPFILE-ENTRY
:NAME "Pictures/10000201000000B200000078985BB627.png"
:STREAM #<SB-SYS:FD-STREAM for "file /home/maus/stuff/test.odt"
{BE98E71}>
:OFFSET 557
:SIZE 12749
:COMPRESSED-SIZE 12749
:COMMENT NIL)
!!!cant read
#S(ZIP::ZIPFILE-ENTRY
:NAME "content.xml"
:STREAM #<SB-SYS:FD-STREAM for "file /home/maus/stuff/test.odt"
{BE98E71}>
:OFFSET 13381
:SIZE 6343
:COMPRESSED-SIZE 1563
:COMMENT NIL)
read 6343 bytes
#S(ZIP::ZIPFILE-ENTRY
:NAME "styles.xml"
:STREAM #<SB-SYS:FD-STREAM for "file /home/maus/stuff/test.odt"
{BE98E71}>
:OFFSET 15001
:SIZE 12997
:COMPRESSED-SIZE 2188
:COMMENT NIL)
read 12997 bytes
#S(ZIP::ZIPFILE-ENTRY
:NAME "meta.xml"
:STREAM #<SB-SYS:FD-STREAM for "file /home/maus/stuff/test.odt"
{BE98E71}>
:OFFSET 17245
:SIZE 1028
:COMPRESSED-SIZE 1028
:COMMENT NIL)
!!!cant read
#S(ZIP::ZIPFILE-ENTRY
:NAME "Thumbnails/thumbnail.png"
:STREAM #<SB-SYS:FD-STREAM for "file /home/maus/stuff/test.odt"
{BE98E71}>
:OFFSET 18311
:SIZE 1689
:COMPRESSED-SIZE 1329
:COMMENT NIL)
read 1689 bytes
#S(ZIP::ZIPFILE-ENTRY
:NAME "settings.xml"
:STREAM #<SB-SYS:FD-STREAM for "file /home/maus/stuff/test.odt"
{BE98E71}>
:OFFSET 19710
:SIZE 8092
:COMPRESSED-SIZE 1287
:COMMENT NIL)
read 8092 bytes
#S(ZIP::ZIPFILE-ENTRY
:NAME "META-INF/manifest.xml"
:STREAM #<SB-SYS:FD-STREAM for "file /home/maus/stuff/test.odt"
{BE98E71}>
:OFFSET 21055
:SIZE 2090
:COMPRESSED-SIZE 372
:COMMENT NIL)
read 2090 bytes
test.odt used for testing can be found here:
http://linode.bodhy.ru/test.odt
Best regards,
Dmitry
More information about the zip-devel
mailing list