Bug in XQuery archive module

Wednesday, 18 February 2015 · 2 messages
A
alxarch18 Feb 2015 17:48 #
Hi, I stumbled upon a bug in the archive module on BaseX 8.0. The zip files created by the archive module are not valid.
let $found := file:list("/tmp/test/media/")
return
file:write-binary("/tmp/test.zip",
archive:create(
  $found,
  $found ! file:read-binary( "/tmp/test/media/" || .)
, map { "format" : "zip", "algorithm" : "deflate"}))
The resultting zip file is invalid. Trying to unzip in cli returns:
Archive:  test.zip
  End-of-central-directory signature not found.  Either this file is not
  a zipfile, or it constitutes one disk of a multi-part archive.  In the
  latter case the central directory and zipfile comment will be found on
  the last disk(s) of this archive.
unzip:  cannot find zipfile directory in one of test.zip or
test.zip.zip, and cannot find test.zip.ZIP, period.
The same code works in BaseX7.9 Cheers, Alex
CG
Christian Grün18 Feb 2015 18:50 #
Thanks Alex, The Bug has been fixed. A new 8.1 snapshot is available [1]. We'll soon provide a 8.0.1 bug fix release as well (ideally, the "1" will represent this single bug fix). [1] http://files.basex.org/releases/latest
Quoted text · alxarch · 32 lines
On Wed, Feb 18, 2015 at 5:48 PM, alxarch <alxarch at gmail.com> wrote: > Hi, > > I stumbled upon a bug in the archive module on BaseX 8.0. > The zip files created by the archive module are not valid. > > ``` > let $found := file:list("/tmp/test/media/") > return > file:write-binary("/tmp/test.zip", > archive:create( > $found, > $found ! file:read-binary( "/tmp/test/media/" || .) > , map { "format" : "zip", "algorithm" : "deflate"})) > ``` > > The resultting zip file is invalid. > Trying to unzip in cli returns: > ``` > Archive: test.zip > End-of-central-directory signature not found. Either this file is not > a zipfile, or it constitutes one disk of a multi-part archive. In the > latter case the central directory and zipfile comment will be found on > the last disk(s) of this archive. > unzip: cannot find zipfile directory in one of test.zip or > test.zip.zip, and cannot find test.zip.ZIP, period. > > ``` > The same code works in BaseX7.9 > > Cheers, > Alex

⚡Generated with XQuery