Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2024-05-27
16:39 • Closed ticket [43b7e5b511]: tclsh with attached ZIP plus 7 other changes artifact: 315492ceb7 user: griffin
2024-05-25
01:10 • Ticket [43b7e5b511]: 3 changes artifact: 8ce6cbba64 user: apnadkarni
2024-05-24
17:58 • Ticket [43b7e5b511]: 3 changes artifact: 82f8026d83 user: griffin
17:50
address ticket [43b7e5b511] - Improve zipfs description in tclsh manual. check-in: 187224bda2 user: griffin tags: bug-43b7e5b511
16:49 • Ticket [43b7e5b511] tclsh with attached ZIP status still Open with 3 other c... artifact: 06a042bd3d user: apnadkarni
16:38 • Ticket [43b7e5b511]: 3 changes artifact: 30f9cefce1 user: griffin
06:00 • Ticket [43b7e5b511]: 3 changes artifact: fdaa98fd63 user: apnadkarni
2024-05-23
19:51 • Ticket [43b7e5b511]: 3 changes artifact: c5ac0f2711 user: griffin
16:34 • New ticket [43b7e5b511]. artifact: 8bca4e3665 user: apnadkarni

tclsh with attached ZIP

Closed / Fixed43b7e5b51154124aa07f7fd66e7e325ad9676209Created 3 years agoUpdated 3 years ago
Descriptionmarkdown2024-05-23 16:34:39

The 9.0 tclsh manpage has a section ZIPFS which describes tclsh behavior when a zip archive is attached to it (note this is different from the tcl library zip archive attached to the tcl shared library). Aside from the obvious errors (mount point and Tcl version) in the description, I cannot get that behavior to work at all. Also not clear to me from the code how it would have ever worked but I could be looking in the wrong place.

Logging this ticket as a place holder pending further investigation.

Referenced by1
  • 187224bda2address ticket [43b7e5b511] - Improve zipfs description in tclsh manual. check-in2024-05-24 17:50:38
griffinmarkdown2024-05-23 19:51:21

The description is old; /zvfs is actuall //zipfs:/

# "file volumes" will report the root(s) to follow. 
# If there is an attached archive, //zipfs:/ will be present.
% file volumes
//zipfs:/ /

The auto_path variable is also informative:

% set auto_path
//zipfs:/app/tcl_library //zipfs:/app 

I've been creating stand-alone applications for awhile now by adding "main.tcl" to the archive and rewriting it using zipfs mkimg. See makeapp.tcl for an example.

So, this section of the man page needs to be rewritten.

apnadkarnimarkdown2024-05-24 06:00:30

Brian,

I knew about the outdated paths but still could not get it to work.

If I read your code correctly, you are explicitly copying the tcl_library content into your vfs as part of the package copies from auto_path. Is that correct?

In other words, when using a static shell, zipfs mkimg will overwrite the existing zip archive thereby losing the tcl_library content from the static executable. That is what my 7zip dump shows and would explain the failures to run.

If that is the case, the documentation should warn or explain as much as I don't think it is obvious except in hindsight.

/Ashok

griffinplain2024-05-24 16:38:12
How is this as a rewrite:

.SH ZIPVFS
.PP
When a zipfile is concatenated to the end of a \fBtclsh\fR, on startup
the contents of the zip archive will be mounted as the virtual file
system \fB//zipfs:/\fR. If a top level directory \fBtcl_library\fR is
present in the zip archive, it will become the directory loaded as
env(TCL_LIBRARY). If a file named \fBmain.tcl\fR is present in the top
level directory of the zip archive, it will be sourced instead of the
shell's normal command line handing.
.PP
Only one zipfile can be concatenated to the end of executable image
(tclsh, or wish). However, if multiple zipfiles are
concatenated, only the last one is used.

This filesystem is read-only. Files cannot be added or modified within
this mounted file system.  See zipfs(n) for complete details.

.SH "SEE ALSO"
auto_path(n), encoding(n), env(n), fconfigure(n), zipfs(n)
.SH KEYWORDS
application, argument, interpreter, prompt, script file, shell, zipfs
apnadkarnimarkdown2024-05-24 16:49:39

Reads much better. The one thing I would change is "mounted as the virtual file system..." to "mounted under the virtual file system" because I think it depends on how tclsh is built. For example, in my default Windows build,

% set tcl_library
//zipfs:/lib/tcl/tcl_library
% zipfs mount
//zipfs:/lib/tcl D:/tcl/90/x64-debug/bin/tcl90.dll

so the mount point is not directly at //zipfs:/. Bit of nitpicking...

griffinmarkdown2024-05-24 17:58:44

see bug-43b7e5b511 for proposed improvement for this ticket.

Also, there is currently nothing in the wish man page that mentions zipfs, but this issue applies there too, no?

apnadkarniplain2024-05-25 01:10:11
Good question. I am not sure if wish supports the functionality but if it does, clearly it should be documented.
griffinplain2024-05-27 16:39:48
Tcl and Tk documentation improved with Tk:[c3289584177] and Tcl:[5977456ad3] to address this reported concern.
Log in (anonymous is fine) to add a comment.