Index: common/common.sh ================================================================== --- common/common.sh +++ common/common.sh @@ -122,14 +122,20 @@ } function apply_patches() { local patch - for patch in "${patchdir}/all"/${pkg}-${version}-*.diff "${patchdir}/${TCL_VERSION}"/${pkg}-${version}-*.diff; do + for patch in "${patchdir}/all"/${pkg}-${version}-*.diff "${patchdir}/${TCL_VERSION}"/${pkg}-${version}-*.diff "${patchdir}"/*.diff; do if [ ! -f "${patch}" ]; then continue fi + + if [ -x "${patch}.sh" ]; then + if ! "${patch}.sh" "${TCL_VERSION}" "${pkg}" "${version}"; then + continue + fi + fi echo "Applying: ${patch}" ( cd "${workdir}" && ${PATCH:-patch} -p1 ) < "${patch}" || return 1 done DELETED tclvfs/patches/8.6/tclvfs-20080503-compilewithcvs.diff Index: tclvfs/patches/8.6/tclvfs-20080503-compilewithcvs.diff ================================================================== --- tclvfs/patches/8.6/tclvfs-20080503-compilewithcvs.diff +++ /dev/null @@ -1,12 +0,0 @@ -diff -uNr tclvfs-20080503-orig/generic/vfs.c tclvfs-20080503-rsk/generic/vfs.c ---- tclvfs-20080503-orig/generic/vfs.c 2006-08-30 14:38:03.000000000 -0500 -+++ tclvfs-20080503-rsk/generic/vfs.c 2010-02-21 18:43:45.000000000 -0600 -@@ -1656,7 +1656,7 @@ - return returnVal; - } - --static CONST char** -+static const char* CONST* - VfsFileAttrStrings(pathPtr, objPtrRef) - Tcl_Obj* pathPtr; - Tcl_Obj** objPtrRef; DELETED tclvfs/patches/8.6/tclvfs-20080503-fixbug81845.diff Index: tclvfs/patches/8.6/tclvfs-20080503-fixbug81845.diff ================================================================== --- tclvfs/patches/8.6/tclvfs-20080503-fixbug81845.diff +++ /dev/null @@ -1,35 +0,0 @@ -diff -uNr tclvfs-20080503.orig/pkgIndex.tcl.in tclvfs-20080503/pkgIndex.tcl.in ---- tclvfs-20080503.orig/pkgIndex.tcl.in 2008-04-16 01:59:24.000000000 +0200 -+++ tclvfs-20080503/pkgIndex.tcl.in 2016-01-29 15:01:44.000000000 +0100 -@@ -49,6 +49,7 @@ - package ifneeded vfs::urltype 1.0 [list source [file join $dir vfsUrl.tcl]] - package ifneeded vfs::webdav 0.1 [list source [file join $dir webdavvfs.tcl]] - package ifneeded vfs::tk 0.5 [list source [file join $dir tkvfs.tcl]] -+package ifneeded vfs::utils 0.5 [list source [file join $dir vfsUtils.tcl]] - # - # Virtual filesystems based on the template vfs: - # - -diff -uNr tclvfs-20080503.orig/library/vfsUtils.tcl tclvfs-20080503/library/vfsUtils.tcl ---- tclvfs-20080503.orig/library/vfsUtils.tcl 2004-07-05 01:42:04.000000000 +0200 -+++ tclvfs-20080503/library/vfsUtils.tcl 2016-01-29 14:45:20.000000000 +0100 -@@ -4,6 +4,7 @@ - - package require Tcl 8.4 - package require vfs -+package provide vfs::utils 0.5 - - namespace eval ::vfs { - variable debug 0 - -diff -uNr tclvfs-20080503.orig/library/zipvfs.tcl tclvfs-20080503/library/zipvfs.tcl ---- tclvfs-20080503.orig/library/zipvfs.tcl 2008-04-15 23:11:53.000000000 +0200 -+++ tclvfs-20080503/library/zipvfs.tcl 2016-01-29 15:01:42.000000000 +0100 -@@ -3,6 +3,7 @@ - package provide vfs::zip 1.0.1 - - package require vfs -+package require vfs::utils 0.5 - - # Using the vfs, memchan and Trf extensions, we ought to be able - # to write a Tcl-only zip virtual filesystem. What we have below DELETED tclvfs/patches/8.6/tclvfs-20080503-supportnativezlib.diff Index: tclvfs/patches/8.6/tclvfs-20080503-supportnativezlib.diff ================================================================== --- tclvfs/patches/8.6/tclvfs-20080503-supportnativezlib.diff +++ /dev/null @@ -1,81 +0,0 @@ -diff -uNr tclvfs-20080503/library/vfslib.tcl tclvfs-20080503-supportnativezlib/library/vfslib.tcl ---- tclvfs-20080503/library/vfslib.tcl 2006-09-14 16:39:57.000000000 -0500 -+++ tclvfs-20080503-supportnativezlib/library/vfslib.tcl 2012-10-08 14:30:50.930779011 -0500 -@@ -5,6 +5,16 @@ - - namespace eval ::vfs { - variable zseq 0 ;# used to generate temp zstream cmd names -+ variable zlibPkg 0 ;# Use Tcl 8.6+ zlib command, or zlib package -+} -+ -+ -+# Work with the Tcl 8.6+ built-in zlib command or the zlib package, if available -+catch { -+ set ::vfs::zlibVers [package present zlib] -+ if {$::vfs::zlibVers == "1.1"} { -+ set ::vfs::zlibPkg 1 -+ } - } - - # for backwards compatibility -@@ -94,8 +104,12 @@ - } - # to seek back, rewind, i.e. start from scratch - if {$a1 < $pos} { -- rename $zcmd "" -- zlib $imode $zcmd -+ if {$::vfs::zlibPkg} { -+ rename $zcmd "" -+ zlib $imode $zcmd -+ } else { -+ $zcmd reset -+ } - seek $ifd 0 - set pos 0 - } -@@ -110,19 +124,26 @@ - return $pos - } - read { -+ if {$::vfs::zlibPkg} { -+ set zputcmd fill -+ set zgetcmd drain -+ } else { -+ set zputcmd put -+ set zgetcmd get -+ } - set r "" - set n $a1 - #puts stderr " want $n z $zcmd pos $pos ilen $ilen" - if {$n + $pos > $ilen} { set n [expr {$ilen - $pos}] } - while {$n > 0} { -- if {[$zcmd fill] == 0} { -+ if {![eof $ifd]} { - set c [expr {$clen - [tell $ifd]}] - if {$c > 4096} { set c 4096 } - set data [read $ifd $c] - #puts "filled $c [string length $data]" -- $zcmd fill $data -- } -- set data [$zcmd drain $n] -+ $zcmd $zputcmd $data -+ } -+ set data [$zcmd $zgetcmd $n] - #puts stderr " read [string length $data]" - if {$data eq ""} break - append r $data -@@ -141,8 +162,12 @@ - } - - proc vfs::zstream {mode ifd clen ilen} { -- set cname _zstream_[incr ::vfs::zseq] -- zlib s$mode $cname -+ if {$::vfs::zlibPkg} { -+ set cname _zstream_[incr ::vfs::zseq] -+ zlib s$mode $cname -+ } else { -+ set cname [zlib stream $mode] -+ } - set cmd [list ::vfs::zstream_handler $cname $ifd $clen $ilen s$mode] - set fd [rechan $cmd 2] - set ::vfs::_zstream_pos($fd) 0 DELETED tclvfs/patches/all/tclvfs-20080503-alwaysstatic.diff Index: tclvfs/patches/all/tclvfs-20080503-alwaysstatic.diff ================================================================== --- tclvfs/patches/all/tclvfs-20080503-alwaysstatic.diff +++ /dev/null @@ -1,20 +0,0 @@ -diff -uNr tclvfs-20080503.orig/generic/vfs.c tclvfs-20080503-alwaysstatic/generic/vfs.c ---- tclvfs-20080503.orig/generic/vfs.c 2006-08-30 14:38:03.000000000 -0500 -+++ tclvfs-20080503-alwaysstatic/generic/vfs.c 2015-03-30 17:20:15.415513923 -0500 -@@ -25,16 +25,6 @@ - #include "tclInt.h" - #include "tclPort.h" - --/* -- * Windows needs to know which symbols to export. Unix does not. -- * BUILD_vfs should be undefined for Unix. -- */ -- --#ifdef BUILD_vfs --#undef TCL_STORAGE_CLASS --#define TCL_STORAGE_CLASS DLLEXPORT --#endif /* BUILD_vfs */ -- - #ifndef TCL_GLOB_TYPE_MOUNT - #define TCL_GLOB_TYPE_MOUNT (1<<7) - #endif DELETED tclvfs/patches/all/tclvfs-20080503-fixinternalrepuse.diff Index: tclvfs/patches/all/tclvfs-20080503-fixinternalrepuse.diff ================================================================== --- tclvfs/patches/all/tclvfs-20080503-fixinternalrepuse.diff +++ /dev/null @@ -1,24 +0,0 @@ ---- tclvfs-20080503.orig/generic/vfs.c 2006-08-30 19:38:03.000000000 +0000 -+++ tclvfs-20080503-fixinternalrepuse/generic/vfs.c 2014-11-17 18:34:43.317025829 +0000 -@@ -1986,16 +1986,17 @@ - return NULL; - } - -- splitPosition = nativeRep->splitPosition; -- normed = Tcl_FSGetNormalizedPath(NULL, pathPtr); -- normedString = Tcl_GetStringFromObj(normed, &len); -- - mountCmd = Tcl_DuplicateObj(nativeRep->fsCmd->mountCmd); - Tcl_IncrRefCount(mountCmd); - if (Tcl_ListObjLength(NULL, mountCmd, &dummyLen) == TCL_ERROR) { - Tcl_DecrRefCount(mountCmd); - return NULL; - } -+ -+ splitPosition = nativeRep->splitPosition; -+ normed = Tcl_FSGetNormalizedPath(NULL, pathPtr); -+ normedString = Tcl_GetStringFromObj(normed, &len); -+ - Tcl_ListObjAppendElement(NULL, mountCmd, Tcl_NewStringObj(cmd,-1)); - if (splitPosition == len) { - Tcl_ListObjAppendElement(NULL, mountCmd, normed); DELETED tclvfs/patches/all/tclvfs-20080503-includestat.diff Index: tclvfs/patches/all/tclvfs-20080503-includestat.diff ================================================================== --- tclvfs/patches/all/tclvfs-20080503-includestat.diff +++ /dev/null @@ -1,13 +0,0 @@ -diff -uNr tclvfs-20080503.orig//generic/vfs.c tclvfs-20080503-1rsk//generic/vfs.c ---- tclvfs-20080503.orig//generic/vfs.c 2006-08-30 19:38:03.000000000 +0000 -+++ tclvfs-20080503-1rsk//generic/vfs.c 2010-09-10 06:41:30.280557731 +0000 -@@ -20,6 +20,9 @@ - * of this file, and for a DISCLAIMER OF ALL WARRANTIES. - */ - -+#ifdef HAVE_SYS_STAT_H -+# include -+#endif - #include - /* Required to access the 'stat' structure fields, and TclInExit() */ - #include "tclInt.h" DELETED tclvfs/patches/all/tclvfs-20080503-zipvfs.diff Index: tclvfs/patches/all/tclvfs-20080503-zipvfs.diff ================================================================== --- tclvfs/patches/all/tclvfs-20080503-zipvfs.diff +++ /dev/null @@ -1,107 +0,0 @@ -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) -+ } -+ - set nfd [vfs::memchan] - fconfigure $nfd -translation binary - -@@ -255,21 +259,21 @@ - set year [expr { (($date >> 9) & 0xFF) + 1980 }] - - # Fix up bad date/time data, no need to fail -- while {$sec > 59} {incr sec -60} -- while {$min > 59} {incr sec -60} -- while {$hour > 23} {incr hour -24} -- if {$mday < 1} {incr mday} -- if {$mon < 1} {incr mon} -- while {$mon > 12} {incr hour -12} -+ if {$sec > 59} {set sec 59} -+ if {$min > 59} {set min 59} -+ if {$hour > 23} {set hour 23} -+ if {$mday < 1} {set mday 1} -+ if {$mday > 31} {set mday 31} -+ if {$mon < 1} {set mon 1} -+ if {$mon > 12} {set mon 12} - -- while {[catch { -+ set res 0 -+ catch { - set dt [format {%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d} \ - $year $mon $mday $hour $min $sec] - set res [clock scan $dt -gmt 1] -- }]} { -- # 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 - ADDED tclvfs/patches/tclvfs-20080503-alwaysstatic.diff Index: tclvfs/patches/tclvfs-20080503-alwaysstatic.diff ================================================================== --- /dev/null +++ tclvfs/patches/tclvfs-20080503-alwaysstatic.diff @@ -0,0 +1,20 @@ +diff -uNr tclvfs-20080503.orig/generic/vfs.c tclvfs-20080503-alwaysstatic/generic/vfs.c +--- tclvfs-20080503.orig/generic/vfs.c 2006-08-30 14:38:03.000000000 -0500 ++++ tclvfs-20080503-alwaysstatic/generic/vfs.c 2015-03-30 17:20:15.415513923 -0500 +@@ -25,16 +25,6 @@ + #include "tclInt.h" + #include "tclPort.h" + +-/* +- * Windows needs to know which symbols to export. Unix does not. +- * BUILD_vfs should be undefined for Unix. +- */ +- +-#ifdef BUILD_vfs +-#undef TCL_STORAGE_CLASS +-#define TCL_STORAGE_CLASS DLLEXPORT +-#endif /* BUILD_vfs */ +- + #ifndef TCL_GLOB_TYPE_MOUNT + #define TCL_GLOB_TYPE_MOUNT (1<<7) + #endif ADDED tclvfs/patches/tclvfs-20080503-compilewithcvs.diff Index: tclvfs/patches/tclvfs-20080503-compilewithcvs.diff ================================================================== --- /dev/null +++ tclvfs/patches/tclvfs-20080503-compilewithcvs.diff @@ -0,0 +1,12 @@ +diff -uNr tclvfs-20080503-orig/generic/vfs.c tclvfs-20080503-rsk/generic/vfs.c +--- tclvfs-20080503-orig/generic/vfs.c 2006-08-30 14:38:03.000000000 -0500 ++++ tclvfs-20080503-rsk/generic/vfs.c 2010-02-21 18:43:45.000000000 -0600 +@@ -1656,7 +1656,7 @@ + return returnVal; + } + +-static CONST char** ++static const char* CONST* + VfsFileAttrStrings(pathPtr, objPtrRef) + Tcl_Obj* pathPtr; + Tcl_Obj** objPtrRef; ADDED tclvfs/patches/tclvfs-20080503-compilewithcvs.diff.sh Index: tclvfs/patches/tclvfs-20080503-compilewithcvs.diff.sh ================================================================== --- /dev/null +++ tclvfs/patches/tclvfs-20080503-compilewithcvs.diff.sh @@ -0,0 +1,13 @@ +#! /usr/bin/env bash + +tclVersion="$1" +pkg="$2" +pkgVersion="$3" + +case "${tclVersion}" in + 8.[012345]|8.[012345].*) + exit 1 + ;; +esac + +exit 0 ADDED tclvfs/patches/tclvfs-20080503-fixbug81845.diff Index: tclvfs/patches/tclvfs-20080503-fixbug81845.diff ================================================================== --- /dev/null +++ tclvfs/patches/tclvfs-20080503-fixbug81845.diff @@ -0,0 +1,35 @@ +diff -uNr tclvfs-20080503.orig/pkgIndex.tcl.in tclvfs-20080503/pkgIndex.tcl.in +--- tclvfs-20080503.orig/pkgIndex.tcl.in 2008-04-16 01:59:24.000000000 +0200 ++++ tclvfs-20080503/pkgIndex.tcl.in 2016-01-29 15:01:44.000000000 +0100 +@@ -49,6 +49,7 @@ + package ifneeded vfs::urltype 1.0 [list source [file join $dir vfsUrl.tcl]] + package ifneeded vfs::webdav 0.1 [list source [file join $dir webdavvfs.tcl]] + package ifneeded vfs::tk 0.5 [list source [file join $dir tkvfs.tcl]] ++package ifneeded vfs::utils 0.5 [list source [file join $dir vfsUtils.tcl]] + # + # Virtual filesystems based on the template vfs: + # + +diff -uNr tclvfs-20080503.orig/library/vfsUtils.tcl tclvfs-20080503/library/vfsUtils.tcl +--- tclvfs-20080503.orig/library/vfsUtils.tcl 2004-07-05 01:42:04.000000000 +0200 ++++ tclvfs-20080503/library/vfsUtils.tcl 2016-01-29 14:45:20.000000000 +0100 +@@ -4,6 +4,7 @@ + + package require Tcl 8.4 + package require vfs ++package provide vfs::utils 0.5 + + namespace eval ::vfs { + variable debug 0 + +diff -uNr tclvfs-20080503.orig/library/zipvfs.tcl tclvfs-20080503/library/zipvfs.tcl +--- tclvfs-20080503.orig/library/zipvfs.tcl 2008-04-15 23:11:53.000000000 +0200 ++++ tclvfs-20080503/library/zipvfs.tcl 2016-01-29 15:01:42.000000000 +0100 +@@ -3,6 +3,7 @@ + package provide vfs::zip 1.0.1 + + package require vfs ++package require vfs::utils 0.5 + + # Using the vfs, memchan and Trf extensions, we ought to be able + # to write a Tcl-only zip virtual filesystem. What we have below ADDED tclvfs/patches/tclvfs-20080503-fixinternalrepuse.diff Index: tclvfs/patches/tclvfs-20080503-fixinternalrepuse.diff ================================================================== --- /dev/null +++ tclvfs/patches/tclvfs-20080503-fixinternalrepuse.diff @@ -0,0 +1,24 @@ +--- tclvfs-20080503.orig/generic/vfs.c 2006-08-30 19:38:03.000000000 +0000 ++++ tclvfs-20080503-fixinternalrepuse/generic/vfs.c 2014-11-17 18:34:43.317025829 +0000 +@@ -1986,16 +1986,17 @@ + return NULL; + } + +- splitPosition = nativeRep->splitPosition; +- normed = Tcl_FSGetNormalizedPath(NULL, pathPtr); +- normedString = Tcl_GetStringFromObj(normed, &len); +- + mountCmd = Tcl_DuplicateObj(nativeRep->fsCmd->mountCmd); + Tcl_IncrRefCount(mountCmd); + if (Tcl_ListObjLength(NULL, mountCmd, &dummyLen) == TCL_ERROR) { + Tcl_DecrRefCount(mountCmd); + return NULL; + } ++ ++ splitPosition = nativeRep->splitPosition; ++ normed = Tcl_FSGetNormalizedPath(NULL, pathPtr); ++ normedString = Tcl_GetStringFromObj(normed, &len); ++ + Tcl_ListObjAppendElement(NULL, mountCmd, Tcl_NewStringObj(cmd,-1)); + if (splitPosition == len) { + Tcl_ListObjAppendElement(NULL, mountCmd, normed); ADDED tclvfs/patches/tclvfs-20080503-includestat.diff Index: tclvfs/patches/tclvfs-20080503-includestat.diff ================================================================== --- /dev/null +++ tclvfs/patches/tclvfs-20080503-includestat.diff @@ -0,0 +1,13 @@ +diff -uNr tclvfs-20080503.orig//generic/vfs.c tclvfs-20080503-1rsk//generic/vfs.c +--- tclvfs-20080503.orig//generic/vfs.c 2006-08-30 19:38:03.000000000 +0000 ++++ tclvfs-20080503-1rsk//generic/vfs.c 2010-09-10 06:41:30.280557731 +0000 +@@ -20,6 +20,9 @@ + * of this file, and for a DISCLAIMER OF ALL WARRANTIES. + */ + ++#ifdef HAVE_SYS_STAT_H ++# include ++#endif + #include + /* Required to access the 'stat' structure fields, and TclInExit() */ + #include "tclInt.h" ADDED tclvfs/patches/tclvfs-20080503-supportnativezlib.diff Index: tclvfs/patches/tclvfs-20080503-supportnativezlib.diff ================================================================== --- /dev/null +++ tclvfs/patches/tclvfs-20080503-supportnativezlib.diff @@ -0,0 +1,81 @@ +diff -uNr tclvfs-20080503/library/vfslib.tcl tclvfs-20080503-supportnativezlib/library/vfslib.tcl +--- tclvfs-20080503/library/vfslib.tcl 2006-09-14 16:39:57.000000000 -0500 ++++ tclvfs-20080503-supportnativezlib/library/vfslib.tcl 2012-10-08 14:30:50.930779011 -0500 +@@ -5,6 +5,16 @@ + + namespace eval ::vfs { + variable zseq 0 ;# used to generate temp zstream cmd names ++ variable zlibPkg 0 ;# Use Tcl 8.6+ zlib command, or zlib package ++} ++ ++ ++# Work with the Tcl 8.6+ built-in zlib command or the zlib package, if available ++catch { ++ set ::vfs::zlibVers [package present zlib] ++ if {$::vfs::zlibVers == "1.1"} { ++ set ::vfs::zlibPkg 1 ++ } + } + + # for backwards compatibility +@@ -94,8 +104,12 @@ + } + # to seek back, rewind, i.e. start from scratch + if {$a1 < $pos} { +- rename $zcmd "" +- zlib $imode $zcmd ++ if {$::vfs::zlibPkg} { ++ rename $zcmd "" ++ zlib $imode $zcmd ++ } else { ++ $zcmd reset ++ } + seek $ifd 0 + set pos 0 + } +@@ -110,19 +124,26 @@ + return $pos + } + read { ++ if {$::vfs::zlibPkg} { ++ set zputcmd fill ++ set zgetcmd drain ++ } else { ++ set zputcmd put ++ set zgetcmd get ++ } + set r "" + set n $a1 + #puts stderr " want $n z $zcmd pos $pos ilen $ilen" + if {$n + $pos > $ilen} { set n [expr {$ilen - $pos}] } + while {$n > 0} { +- if {[$zcmd fill] == 0} { ++ if {![eof $ifd]} { + set c [expr {$clen - [tell $ifd]}] + if {$c > 4096} { set c 4096 } + set data [read $ifd $c] + #puts "filled $c [string length $data]" +- $zcmd fill $data +- } +- set data [$zcmd drain $n] ++ $zcmd $zputcmd $data ++ } ++ set data [$zcmd $zgetcmd $n] + #puts stderr " read [string length $data]" + if {$data eq ""} break + append r $data +@@ -141,8 +162,12 @@ + } + + proc vfs::zstream {mode ifd clen ilen} { +- set cname _zstream_[incr ::vfs::zseq] +- zlib s$mode $cname ++ if {$::vfs::zlibPkg} { ++ set cname _zstream_[incr ::vfs::zseq] ++ zlib s$mode $cname ++ } else { ++ set cname [zlib stream $mode] ++ } + set cmd [list ::vfs::zstream_handler $cname $ifd $clen $ilen s$mode] + set fd [rechan $cmd 2] + set ::vfs::_zstream_pos($fd) 0 ADDED tclvfs/patches/tclvfs-20080503-supportnativezlib.diff.sh Index: tclvfs/patches/tclvfs-20080503-supportnativezlib.diff.sh ================================================================== --- /dev/null +++ tclvfs/patches/tclvfs-20080503-supportnativezlib.diff.sh @@ -0,0 +1,13 @@ +#! /usr/bin/env bash + +tclVersion="$1" +pkg="$2" +pkgVersion="$3" + +case "${tclVersion}" in + 8.[012345]|8.[012345].*) + exit 1 + ;; +esac + +exit 0 ADDED tclvfs/patches/tclvfs-20080503-zipvfs.diff Index: tclvfs/patches/tclvfs-20080503-zipvfs.diff ================================================================== --- /dev/null +++ tclvfs/patches/tclvfs-20080503-zipvfs.diff @@ -0,0 +1,107 @@ +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) ++ } ++ + set nfd [vfs::memchan] + fconfigure $nfd -translation binary + +@@ -255,21 +259,21 @@ + set year [expr { (($date >> 9) & 0xFF) + 1980 }] + + # Fix up bad date/time data, no need to fail +- while {$sec > 59} {incr sec -60} +- while {$min > 59} {incr sec -60} +- while {$hour > 23} {incr hour -24} +- if {$mday < 1} {incr mday} +- if {$mon < 1} {incr mon} +- while {$mon > 12} {incr hour -12} ++ if {$sec > 59} {set sec 59} ++ if {$min > 59} {set min 59} ++ if {$hour > 23} {set hour 23} ++ if {$mday < 1} {set mday 1} ++ if {$mday > 31} {set mday 31} ++ if {$mon < 1} {set mon 1} ++ if {$mon > 12} {set mon 12} + +- while {[catch { ++ set res 0 ++ catch { + set dt [format {%4.4d-%2.2d-%2.2d %2.2d:%2.2d:%2.2d} \ + $year $mon $mday $hour $min $sec] + set res [clock scan $dt -gmt 1] +- }]} { +- # 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 +