TclVFS is the extension that exposes the core level Virtual File System (VFS) layer, now part of Tcl/Tk (8.4a5 is required, 8.4.1.1 or newer for best possible operation, using Tcl 8.4.3 or 8.4.4 would be a good idea.). The current version of the tclvfs extension is 1.3.0 ---- This package is part of the [ActiveTcl] Batteries Included distribution. ---- '''VFS links''' * [tclVFS usage] * [tclVFS building] * [tclVFS gotchas] * [vfs filesystem configuration] * [tclVFS examples] ---- '''Actual VFSs''' * [A collate/broadcast virtual filesystem] * [A template virtual filesystem] * [A quota-enforcing virtual filesystem] * [A versioning virtual filesystem] * [An LZW-compressing virtual filesystem] * [vfs::zip] * [Caching VFS] * add more here '''Possible VFSs''' * [metadata virtual filesystem] * [tclCVS virtual filesystem] * [pure tcl distributed filesystem] ---- See also [VFS]. The C extension is now very robust and well tested. But, distributed with tclvfs are a large number of virtual filesystem implementations (in pure Tcl). Many of these still need a lot of work (but since it is pure Tcl, lots of people should be able to help). Current tcl implementations include: zip, mk4, namespace, tar, ftp, http, webdav, tk filesystems. package ifneeded vfs::ftp 1.0 package ifneeded vfs::http 0.5 package ifneeded vfs::mk4 1.6 package ifneeded vfs::ns 0.5 package ifneeded vfs::tar 0.9 package ifneeded vfs::test 1.0 package ifneeded vfs::urltype 1.0 package ifneeded vfs::webdav 0.1 package ifneeded vfs::zip 1.0 package ifneeded vfs::tk 0.5 tclvfs relies on [Memchan] or some equivalent to 'open' (or 'load' or 'source') any file. Contributions of binary versions of tclvfs to be placed on sourceforge much appreciated. ---- [SEH] Robust and well-tested perhaps, but contains a deadly crashing bug when attempting to close a file opened for write. See [http://sourceforge.net/tracker/index.php?func=detail&aid=984388&group_id=32692&atid=406308] There are some idiosyncrasies in writing a tclvfs, save some time by checking [tclvfs gotchas] ---- Readonly - writable - translucent ... see [vfs filesystem configuration] ---- [LV] When using a [Starkit], one accesses files within the starkit via TclVFS. Please list here some of the differences one will see when accessing files via TclVFS rather than accessing them via a normal file system. For instance, file ownership and permissions are not supported within many (most? all?) the VFS modules. A user reports on comp.lang.tcl that when accessing files via VFS on Windows, the file names are case sensitive. [Vince] adds that each filesystem module can choose whether to be case-sensitive or not. Most are, I believe, implemented in a case sensitive fashion. I'd be interested to know how, say vfs::ftp works when the relevant ftp site is running on a windows server (not case sensitive)... ---- New (Feb 20 2003), tclvfs now contains a nice debugging feature for those writing tclvfs implementations: vfs::filesystem internalerror report proc report {} { puts stderr $::errorInfo } will do wonders! Tcl implementations are now not allowed to throw Tcl errors, only Tcl ok or posix errors. ---- Home page on SourceForge: http://sourceforge.net/projects/tclvfs/ ---- '''Examples''' Take a look at the [One-line web browser in Tcl]. Using the [tclvfs] extension, you can now do things like this package require vfs::urltype vfs::urltype::Mount ftp file copy ftp://foo.bar.com/pub/Readme . file copy ftp://user:password@foo.bar.com/private.txt . or package require vfs::ftp vfs::urltype::Mount ftp set image [image create photo -file ftp://ftp.ucsd.edu/pub/alpha/tcl/alphatk/alphatk.gif] pack [label .b -image $image] or package require vfs::zip vfs::zip::Mount foo.zip foo.zip cd foo.zip ; glob * or package require vfs::urltype vfs::urltype::Mount ftp set listing [glob -dir ftp://ftp.scriptics.com/pub *] or package require vfs::urltype vfs::urltype::Mount http set fd [open http://sourceforge.net/projects/tcl] set contents [read $fd] ; close $fd or nested mounts: package require vfs::ftp package require vfs::zip vfs::ftp::Mount ftp://ftp.ucsd.edu/pub pub vfs::zip::Mount pub/archive.zip pub/archive.zip % load a .dll from inside a .zip which sits on a remote ftp site. load pub/archive.zip/foo.dll (Caveat: I haven't actually tried this last one....) Notice that you need to ''Mount'' non-native filesystems before you can use them. There are two kinds of mounts that tclvfs supports. The first kind is a particular mount point such as an archive 'foo.zip' or 'ftp://ftp.scriptics/com/pub' which can be mapped onto any point in the local filesystem. The contents of those mounts (i.e. the contents of the zip archive or the contents of the remote ftp site) are then accessible as normal, local files. The second kind of mount is a 'protocol' (somewhat clumsily called a 'urltype' in the current vfs library), which is illustrated in 3 of the examples above. Here we are effectively creating a new ''drive'' called 'ftp://' or 'http://', and any access within that ''drive'' causes the tclvfs library to attempt to perform a mount of the first kind so that the contents can be accessed. Please help develop the tclvfs package further! [lv] Question: can anyone provide an example of how one could use the vfs package to poke around a gzipped tar file? Also, can tcl and tclvfs together be used to poke around a starkit? ---- tclvfs now contains the first vague attempts at a 'webdav' implementation in Tcl. "... a remark by Jean Claude, Steve Landers and perhaps someone else discussing the fact that shared libraries had to be written out to a real file system before many OSes would dynamically load the library." -- Indeed that is true, and Tcl's core provides transparent support for a copy-to-temp-then-load behaviour as default. It would be nice to be able to load directly, and this is discussed here: [loading from memory]. [Matthias Hoffmann]: The above mentioned automatic ''copy-to-temp-then-load-feature'' isn't working always with '''tclkit-win32(-sh).exe''': if launched from within the ''command.com''-Shell (not cmd.exe!), the temp-folder is defined as ''c:/winnt/temp'', which could not be accessed (''permission denied'') with user privilegs (of course, the temp-folder has to be user specific in a multi user environment). But maybe this phenomen is unique to our server-farm... ---- ''tclvfs syntax'' All tclvfs commands exposed to Tcl go through a 'subcommand' syntax. So the mount command you give (say 'foo') is called with: "eval $foo deletefile ...." for example. It might be nice to add the option of calling a namespace command instead (something like 'namespace $ns eval {foo deletefile ...}). Pretty much all the vfs code actually does this anyway, using a very simple 'foo' to divert to namespace commands. ---- '''TclVfs building, compilation and bugs''' There are a variety of fixes to tclvfs compilation and running in the latest release. In particular, various TEA files have been added, and the code works with multiple interpreters very well. ---- The majority of the following details the trials and tribulations as tclvfs is ported to new platforms. ---- Note: tclvfs is known to build and run ok on: * windows * linux * solaris (please add your platform when it works). There are preview stand-alone builds of [Tclkit] for Windows and Linux, which use the new VFS core and include support for the above examples (see [http://www.equi4.com/previews/]). I have not yet packaged the adjusted sources, which are essentially off-the-shelf Tcl, Tk, Metakit, and TclVfs releases... -- [JCW] '''22-3-2002''' - it looks like tclvfs also builds on: * alpha-linux * freebsd-linux (needs tweaks to tcl/compat/unistd.h) * ppc-linux * ppc-macosx * sparc-linux * sparc-solaris (needs cd generic; ln -s ../vfs.o) * i386-bsdos41 Most of these were done as part of Tclkit ports on the SourceForge compile farm. One drawback of the current config is that it does not seem to support building from another directory (you have to do "./configure"). -- [JCW] [Vince]: All 'build' bugs are basically bugs in TEA or in the sample-extension. I am happy to accept any build patches, but am completely unwilling to waste any time trying to fix TEA issues. ---- [LV]: SPARC/Solaris 2.6 , Tcl 8.4a4 , tclvfs from Nov 11, 2001. After copying copies of config.sub, config.guess, and tcl.m4 from tcl's CVS distribution, tclvfs will configure and compile as well as passes most of the test suite. However, there was a problem with the ftp test where, on my machine, the ftp takes 60+ seconds to connect. In this case, tclvfs times out and the test fails. ---- [Chang Li]: Is there a timeout variable? [Vince]: No, something like this ought to be added in the future to deal with asynchronous filesystem access. ---- [LV] Sept, 2002 I have noted on the chat and elsewhere that the Makefile in the current versions of TclVFS no longer appear to install the actual VFS file systems. [Steve Cassidy] and I worked on this for a while and if you check Steve's [Cantcl] archive you can find something that might give you an idea on how to modify things to get them to work. I think that it came pretty close to working for me out of the box (well, after I created the appropriate .so for my platform). ---- [LV] Feb, 2003 The latest CVS head for tclvfs appears to build and install better than ever before. Now, it's up to users to start contributing new vfs types! ---- [Setok] Feb, 2003: Seems as if tclvfs needs the Tcl source to compile? Is this really necessary? At least on my Tcl8.4 installation on debian it wouldn't compile, complaining about a missing header file. 22feb03 [jcw] - Should be ok. But there is still some nastiness left in the tclvfs build, at least on just about all *bsd variants I tried - it can be worked around by adding "$(TCL_DECLS)" to the CCFLAGS in the makefile. The effects are weird and varying, it causes tcl headers to make incorrect decisions and try to define or include the wrong stuff (thx to Mark Roseman for the explanation and workaround). [Setok] OK with latest build. ---- Desired features: * ''sftp'' (secureftp) is not supported, and would be a nice addition. * [bzip2] is not supported, and would be a nice addition, it offers great compression ratios ---- In a recent web search I noticed some misinformation about 'load foo.dll' not working inside a .zip, and how it can't possibly work and is impossible and .... Tclvfs is designed to allow this to work just fine, and will transparently copy the .dll to the native temporary directory and load it there (and arrange for it to be deleted on exit). If any of this doesn't work it is a bug and should be reported! ---- See also [vfs::zip]. ---- Is it a known bug that vfs::tar doesn't support glob? E:\>tclsh % package require vfs::tar 0.9 % set fd [vfs::tar::Mount test.tar test.tar] file8002a8 % cd test.tar % glob -dir . * no files matched glob pattern "*" % glob * no files matched glob pattern "*" Albert Davidson Chou September 16, 2004 I discovered the problem above is apparently due to the fact that the file I was using is not in POSIX tar format. ---- [[ [Category Package] | [Category VFS] ]]