Trying to list a 8 GB zip file containing several 2GB files leads to:
error during seek on "file5": invalid argument
while executing
"::zip::open [::file normalize $zipfile]"
(procedure "vfs::zip::Mount" line 2)
invoked from within
"vfs::zip::Mount $inpfile ZIP"
invoked from within
"set fd [vfs::zip::Mount $inpfile ZIP]"
(file "./list_zip.tcl" line 101)
It seems to come from a 32-bit signed/unsigned missmatch in function zip::EndOfArchive - I've added some debug output and changed the value for cb(coff) to an unsigned value:
DEBUG: header filepos=490
DEBUG: $hdr=00000000060006006a0200002511bec20000
DEBUG: scan $hdr ssssiis cb(ndisk) cb(cdisk) cb(nitems) cb(ntotal) cb(csize) cb(coff) cb(comment)
DEBUG: cb(ndisk) = 0000 0
DEBUG: cb(cdisk) = 0000 0
DEBUG: cb(nitems) = 0600 6
DEBUG: cb(ntotal) = 0600 6
DEBUG: cb(csize) = 6a020000 618
DEBUG: cb(coff) = 2511bec2 -1027731163
DEBUG: cb(comment) = 0000 0
DEBUG: cb(coff) unsigned 3267236133
DEBUG: before: seek file5 3267236133 start
DEBUG: after: seek...
bad central header: f5ef215f
while executing
"::zip::open [::file normalize $zipfile]"
(procedure "vfs::zip::Mount" line 2)
invoked from within
"vfs::zip::Mount $inpfile ZIP"
invoked from within
"set fd [vfs::zip::Mount $inpfile ZIP]"
(file "./list_zip.tcl" line 102)
Errors occurred in : list_zip.tcl
ZIP file lister
Unsigned filesize patch
Files larger than 2GB lead to invalid negative file offsets because the zip header entries are interpreted signed (scan format code "i").
The patch zip-1.0.1.tm.patch changes all file size related binary scan codes "i" to unsigned "iu".
I don't know if the CRC32 word is interpreted correct with "i".