[tclPkgUnknown] and Safe Base
Closed / Fixed2910867fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 41 days ago
Descriptionplain2009-12-08 18:10:58
Within [tclPkgUnknown] is:
# safe interps usually don't have "file exists",
if {([interp issafe] || [file exists $file])} {
set code [catch {source $file} msg opt]
if {$code == 1 &&
[lindex [dict get $opt -errorcode] 0] eq "POSIX" &&
[lindex [dict get $opt -errorcode] 1] eq "EACCES"} {
# $file was not readable; silently ignore
continue
}
if {$code} {
tclLog "error reading package index file $file: $msg"
} else {
set procdDirs($dir) 1
}
}
so in safe interps we intentionally do not verify file existence
before attempting the [source]. This predictably fails in many
of the searched directories, which leads to many [tclLog]
calls to report these failures.
In a safe interp, [puts] is often disabled as well, so the
[tclLog] may be silent. (this is why the poor logic is
seldom nonticed).
However, when Safe Base is in use, some safety-enabled
version of [puts] is likely on, and the noisy error messages
spew forth.
Whole logic of safe interps needs some review at this
point.
The place this is most easily seen is in test math-12.1
in the test suite of the math package in tcllib.
dkfplain2010-01-05 15:56:37
Would also be clearer written with [try ... trap {POSIX EACCES}] in 8.6
johannes-kuhnplain2010-01-05 20:43:49
We allow glob, so it might be safe to allow file exists too.
serhiy.storchakawiki2026-10-21 10:03:38
Fixed in 8.6.11 by [a638b9a73b]: the Safe Base source alias reports missing or unreadable files with -errorcode {POSIX EACCES}, which tclPkgUnknown ignores, so the spurious "no such file" log messages are gone. Index files that fail for other reasons are still logged, as intended.
serhiy.storchaka Ticket [2910867fff]: 3 changes
[History diff]2026-10-22 17:19:31
Log in (anonymous is fine) to add a comment.