Browse Source
zipfs_tclPkgUnknown previously declared 'global dir' and executed pkgIndex.tcl scripts via 'namespace eval ::' - the pkgIndex $dir contract was met by writing the global namespace's dir variable, silently overwriting any user global named 'dir' whenever a package require fell through to the pkg unknown handler (observed misdirecting a file write into the user's Tcl installation during test development), and each index's stray unqualified variables (ver, pkg, script, _CawtSubDirs, ...) leaked into ::. Index scripts now execute in a source_pkgindex proc frame: $dir is a formal parameter and auto_path/env are global links - exactly the environment stock tclPkgUnknown documents (its indexes see dir as the handler's proc-local plus 'global auto_path env'), without stock's incidental exposure of all its other proc locals. tcl::Pkg::source uplevels into the caller's frame, so the scheme works unchanged for the 8.6 pre-tip459 fallback. The legacy non-epoch branch already sourced in the handler frame and simply gains stock parity from the 'global dir' removal. Reviewed against tcllib 2.0's vendored index behaviours (all compatible): qualified '$dir ni $::auto_path'/'lappend ::auto_path' extension in the top-level index, its own apply-scoped subindex sweep (the same isolation idiom), vsatisfies guards with early return, 'package provide' during index sourcing (try/pkgIndex.tcl on 9+), and critcl-generated ifneeded strings (md5c, tcllibc) whose proc definitions run at require time, not source time. One deliberate divergence from stock: each index file gets its own frame, so unqualified variables no longer persist between index files within one sweep (stock shares its handler frame across the sweep) - nothing in tcllib relies on that. discovery.test: the GAP pin flips to libunknown_pkgunknown_preserves_global_dir, plus new pins for the index contract - $dir-based ifneeded/source works, unqualified 'lappend auto_path' extension reaches the real ::auto_path, and stray index-script sets don't leak to ::. Verified live in punk902z src: ::dir no longer set at startup, user dir global survives package activity, tcllib md5/struct::set/json load through the new frame, lib.search deep discovery unaffected. Remaining startup globals def/pkg/ver come from punkshell's own boot code (punk_main.tcl foreach loops), not the handler. punkshell 0.10.1. punk::libunknown remains manually versioned at 0.1; vfs artifact synced, bootsupport copy untouched as before. Assisted-by: harness=claude; primary-model=claude-fable-5; api-location=anthropic.commaster
6 changed files with 130 additions and 22 deletions
@ -1,3 +1,3 @@
|
||||
[project] |
||||
name = "punkshell" |
||||
version = "0.10.0" |
||||
version = "0.10.1" |
||||
|
||||
Loading…
Reference in new issue