Tcl Source Code

View Ticket
Login
Ticket UUID: 75291b89b3d039ae0a804da61e0c3ed68320e371
Title: Documentation of zipfs in tclsh(1)
Type: Bug Version: 9.0
Submitter: tberg Created on: 2024-07-30 08:42:53
Subsystem: - New Builtin Commands Assigned To: nobody
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2024-08-06 06:38:47
Resolution: None Closed By: nobody
    Closed on:
Description:

There are some statements in the tclsh(1) page about ZIPVFS. It is related to zipfs(n) but uses the term ZIPVFS for the heading instead. To minimize confusion (with the tclvfs package and the zipvfs driver there), maybe the heading should rather be termed "ZIPFS" instead??

The section goes on with:

If a top level directory tcl_library is present in the zip archive, it will become the directory loaded as env(TCL_LIBRARY).

It is not clear what exactly the term "the directory loaded as ..." means. Does it mean that the variable env(TCL_LIBRARY) is filled with the name/path of the zip archive? According to tclvars(n) this would mean the zipfs directory is returned by [info library] but that is not the case when trying the example code from the zipfs(n) page.

The manual page further says:

If a file named main.tcl is present in the top level directory of the zip archive, it will be sourced instead of the shell's normal command line handling.

Which shell is meant here? Tclsh/Wish? Then it should be written like this. And the part about the different command line handling should probably also go into zipfs(n) or does it not apply there? It could be emphasized here that this implies you cannot source another Tcl script anymore from the command line when calling the modified tclsh.

Note: the same applies to wish(1) which contains the same text.

User Comments: tberg added on 2024-08-06 06:38:47:

I am not sure how to properly document this tcl_library thing but with the changes from ticket 7db9574a06, this is maybe ok now. Otherwise, someone else can find a good wording for this?

I just changed the heading as the last thing here and adapted the wording a bit.

Now implemented with commit 6a6dac423f147a85.


apnadkarni added on 2024-08-03 03:15:09:

Also, forgot to mention, in case you have not seen it, the TclZipfs_AppHook manpage describes the search path for tcl_library et al. I just became aware of it and have not reviewed it yet.


apnadkarni added on 2024-08-03 03:10:02:

Torsten,

Below is how tcl_library and tk_library look like for various build configurations.

tclsh:

                                | tcl_library
tclsh Configuration             | Mount point @ zip path
--------------------------------|------------------------------------------------
--enable-shared --enable-zipfs  | //zipfs:/lib/tcl/tcl_library
                                | //zipfs:/lib/tcl @ D:/tcl/90b3/x64/bin/tcl90.dll
--disable-shared --enable-zipfs | //zipfs:/app/tcl_library
                                | //zipfs:/app @ D:/tcl/90b3/x64-static/bin/tclsh90s.exe
*               --disable-zipfs | D:/tcl/90b3/*/lib/tcl9.0
                                | No mount points

wish:

                                | tcl_library
                                | tk_library
wish Configuration              | Mount point @ zip path
--------------------------------|------------------------------------------------
--enable-shared --enable-zipfs  | //zipfs:/lib/tcl/tcl_library
                                | //zipfs:/lib/tk/tk_library
                                | //zipfs:/lib/tcl @ D:/tcl/90b3/x64/bin/tcl90.dll
                                | //zipfs:/lib/tk @ D:/tcl/90b3/x64/bin/tcl9tk90.dll
--disable-shared --enable-zipfs | //zipfs:/app/tcl_library
                                | //zipfs:/app/tk_library
                                | //zipfs:/app @ D:/tcl/90b3/x64-static/bin/wish90s.exe
*               --disable-zipfs | D:/tcl/90b3/*/lib/tcl9.0
                                | D:/tcl/90b3/*/lib/tk9.0
                                | No mount points

Also note that the recipe for single file executables given in the TIP works only for --enable-shared builds, not for static shells. For static shells, you have to merge the embedded tcl_library zip with the application vfs, and then replace the embedded zip in the executable with the merged zip.


tberg added on 2024-08-02 21:38:38:

Any other opinions? Otherwise I will soon change the documentation for both tclsh(1) and wish(1) accordingly:

  • change the heading to "ZIPFS virtual file system"
  • refer to the zipfs(n) manual page and the command zipfs root to retrieve the mount point
  • clarify the wording about tcl_library

Ashok, did you get the chance to experiment with a zip attached to tclsh vs. attached to a library and what this means for tcl_library (and possibly [info library])?


apnadkarni added on 2024-07-31 03:24:47:
Yes, ZIPVFS should probably say ZIPFS or **ZIP Virtual File System**

And yes, the documentation is misleading, incomplete or wrong, I'm not sure which :-) I think the path referred to is correct when tclsh is build as a static shell and the ZIP is attached to it but not in the case of the default build where the ZIP attached to the tcl shared library, not tclsh itself. Will experiment and confirm.

Further, I feel the `tclsh` should not mention `//zipfs:/` as the mount point but rather refer to `zipfs root` but that is a call we need to make as to whether to specifically document //zipfs:/ as the mount point.