Overview
| Comment: | Updated to support a limit on how much seeking is done looking for a zip header |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
acdc36a7e0c97877f7bbe12d299de448 |
| User & Date: | rkeene on 2010-10-02 03:02:12 |
| Other Links: | manifest | tags |
Context
|
2010-10-02
| ||
| 04:02 | Updated to rename Win32 libraries to more windows-specific names check-in: 491345c1fd user: rkeene tags: trunk | |
| 03:02 | Updated to support a limit on how much seeking is done looking for a zip header check-in: acdc36a7e0 user: rkeene tags: trunk | |
|
2010-10-01
| ||
| 23:46 | Renamed library built by KitDLL to include version number by default check-in: fe17341989 user: rkeene tags: trunk | |
Changes
Modified kitdll/buildsrc/kitdll-0.0/boot.tcl from [31a964e643] to [2b2126d5c0].
| ︙ | ︙ | |||
71 72 73 74 75 76 77 78 79 80 81 82 |
# This loads everything needed for "clock scan" to work
# "clock scan" is used within "vfs::zip", which may be
# loaded before this is run causing the root VFS to break
catch { clock scan }
# Load these, the original Tclkit does so it should be safe.
uplevel #0 [list source [file join $tcl_mountpoint lib vfs vfsUtils.tcl]]
# Now that the initialization is complete, mount the user VFS if needed
## Mount the VFS from the Shared Object
if {[info exists ::initVFS] && [info exists ::tclKitFilename]} {
catch {
| > > > > > > > < < < < > > > | 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# This loads everything needed for "clock scan" to work
# "clock scan" is used within "vfs::zip", which may be
# loaded before this is run causing the root VFS to break
catch { clock scan }
# Load these, the original Tclkit does so it should be safe.
uplevel #0 [list source [file join $tcl_mountpoint lib vfs vfsUtils.tcl]]
# Set a maximum seek to avoid reading the entire DLL looking for a
# zip header
catch {
package require vfs::zip
set ::zip::max_header_seek 8192
}
# Now that the initialization is complete, mount the user VFS if needed
## Mount the VFS from the Shared Object
if {[info exists ::initVFS] && [info exists ::tclKitFilename]} {
catch {
vfs::zip::Mount $::tclKitFilename "/.KITDLL_USER"
lappend auto_path [file normalize "/.KITDLL_USER/lib"]
}
}
## Mount the VFS from executable
if {[info exists ::initVFS]} {
catch {
vfs::zip::Mount [info nameofexecutable] "/.KITDLL_APP"
lappend auto_path [file normalize "/.KITDLL_APP/lib"]
}
}
# Clean up
unset -nocomplain ::zip::max_header_seek
# Clean up after the kitInit.c:preInitCmd
unset -nocomplain ::initVFS ::tclKitFilename
}
|
Modified kitsh/buildsrc/kitsh-0.0/zipvfs.tcl from [8fe7ed4f05] to [9ed60c581d].
| ︙ | ︙ | |||
328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# comments the chunk may start at an arbitrary distance from the
# end of the file. So if we do not find the header immediately
# we have to extend the range of our search, possibly until we
# have a large part of the archive in memory. We can fail only
# after the whole file has been searched.
set sz [tell $fd]
set len 512
set at 512
while {1} {
if {$sz < $at} {set n -$sz} else {set n -$at}
seek $fd $n end
set hdr [read $fd $len]
| > > > > > | 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
# comments the chunk may start at an arbitrary distance from the
# end of the file. So if we do not find the header immediately
# we have to extend the range of our search, possibly until we
# have a large part of the archive in memory. We can fail only
# after the whole file has been searched.
set sz [tell $fd]
if {[info exists ::zip::max_header_seek]} {
if {$::zip::max_header_seek < $sz} {
set sz $::zip::max_header_seek
}
}
set len 512
set at 512
while {1} {
if {$sz < $at} {set n -$sz} else {set n -$at}
seek $fd $n end
set hdr [read $fd $len]
|
| ︙ | ︙ |
Modified tclvfs/patches/all/tclvfs-20080503-zipvfs.diff from [b70e607501] to [f1ca9abb3e].
1 2 | diff -uNr tclvfs-20080503.orig/library/zipvfs.tcl tclvfs-20080503-1rsk/library/zipvfs.tcl --- tclvfs-20080503.orig/library/zipvfs.tcl 2008-04-15 16:11:53.000000000 -0500 | | | 1 2 3 4 5 6 7 8 9 10 |
diff -uNr tclvfs-20080503.orig/library/zipvfs.tcl tclvfs-20080503-1rsk/library/zipvfs.tcl
--- tclvfs-20080503.orig/library/zipvfs.tcl 2008-04-15 16:11:53.000000000 -0500
+++ tclvfs-20080503-1rsk/library/zipvfs.tcl 2010-10-01 21:48:38.000000000 -0500
@@ -107,6 +107,10 @@
::zip::stat $zipfd $name sb
+ if {$sb(ino) == -1} {
+ vfs::filesystem posixerror $::vfs::posix(EISDIR)
+ }
|
| ︙ | ︙ | |||
40 41 42 43 44 45 46 |
- # Only mday can be wrong, at end of month
- incr mday -1
}
+
return $res
}
| > > > > > > > > > > > > | | | | | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
- # Only mday can be wrong, at end of month
- incr mday -1
}
+
return $res
}
@@ -360,6 +364,11 @@
# after the whole file has been searched.
set sz [tell $fd]
+ if {[info exists ::zip::max_header_seek]} {
+ if {$::zip::max_header_seek < $sz} {
+ set sz $::zip::max_header_seek
+ }
+ }
set len 512
set at 512
while {1} {
@@ -381,7 +390,12 @@
}
set hdr [string range $hdr [expr $pos + 4] [expr $pos + 21]]
- set pos [expr [tell $fd] + $pos - 512]
+
+ set seekstart [expr {[tell $fd] - 512}]
+ if {$seekstart < 0} {
+ set seekstart 0
+ }
+ set pos [expr {$seekstart + $pos}]
binary scan $hdr ssssiis \
cb(ndisk) cb(cdisk) \
@@ -396,10 +410,15 @@
# Compute base for situations where ZIP file
# has been appended to another media (e.g. EXE)
- set cb(base) [expr { $pos - $cb(csize) - $cb(coff) }]
+ set base [expr { $pos - $cb(csize) - $cb(coff) }]
+ if {$base < 0} {
+ set base 0
+ }
+ set cb(base) $base
}
proc zip::TOC {fd arr} {
+ upvar #0 zip::$fd cb
upvar 1 $arr sb
set buf [read $fd 46]
@@ -410,6 +429,8 @@
flen elen clen sb(disk) sb(attr) \
sb(atx) sb(ino)
+ set sb(ino) [expr {$cb(base) + $sb(ino)}]
+
if { ![string equal "PK\01\02" $hdr] } {
binary scan $hdr H* x
error "bad central header: $x"
@@ -442,7 +463,7 @@
zip::EndOfArchive $fd cb
- seek $fd $cb(coff) start
+ seek $fd [expr {$cb(base) + $cb(coff)}] start
set toc(_) 0; unset toc(_); #MakeArray
|