Tcl Source Code

View Ticket
Login
Ticket UUID: 8e53aea5b9c09f13622410ae4daf381a38e0cb0b
Title: Safe interpreter paths differ from non-safe (test safe-14.1 fails)
Type: Bug Created on: 2015-07-15 17:04:11
Submitter: jskarvad Assigned to: aku
Subsystem: 20. [interp] Severity: Minor
Priority: 5 Medium Last modified: 2026-10-22 17:19:28
Status: Closed Closed by: serhiy.storchaka
Resolution: Fixed Closed on: 2026-10-21 08:46:00
Version: tcl-8.6.4
Description:
I am not sure whether the category is correct, but I encountered the following problem with the safe interpreter - the test safe-14.1 fails if run by the installed interpreter. It fails because the paths of safe and normal interpreter are different.

The problem is that the safe interpreter recursively descends into directories which may add paths that are not in the 'tm::path'. I.e. I am getting the following:

---- Result was:
/usr/lib/tcl8/site-tcl /usr/lib/tcl8/8.0 /usr/lib/tcl8/8.1 /usr/lib/tcl8/8.2 /usr/lib/tcl8/8.3 /usr/lib/tcl8/8.4 /usr/lib/tcl8/8.5 /usr/share/tcl8/site-tcl /usr/share/tcl8/8.0 /usr/share/tcl8/8.1 /usr/share/tcl8/8.2 /usr/share/tcl8/8.3 /usr/share/tcl8/8.4 /usr/share/tcl8/8.5 /usr/share/tcl8/8.4/platform
---- Result should have been (exact matching):
/usr/lib/tcl8/site-tcl /usr/lib/tcl8/8.0 /usr/lib/tcl8/8.1 /usr/lib/tcl8/8.2 /usr/lib/tcl8/8.3 /usr/lib/tcl8/8.4 /usr/lib/tcl8/8.5 /usr/share/tcl8/site-tcl /usr/share/tcl8/8.0 /usr/share/tcl8/8.1 /usr/share/tcl8/8.2 /usr/share/tcl8/8.3 /usr/share/tcl8/8.4 /usr/share/tcl8/8.5

The /usr/share/tcl8/8.4/platform is extra directory added to safe interpreter by descending deeper into /usr/share/tcl8/8.4. It is added by the following snip of safe.tcl:

# [Bug 2854929]
# Recursively find deeper paths which may contain
# modules. Required to handle modules with names like
# 'platform::shell', which translate into
# 'platform/shell-X.tm', i.e arbitrarily deep
# subdirectories.
lappend morepaths {*}[glob -nocomplain -directory $dir -type d *]

Is it the correct fix? Are safe intepreter paths allowed to be different?
User Comments:
jskarvad added on 2015-07-15 17:08:43:
The original ticket that introduced this:
http://core.tcl.tk/tcl/tktview?name=2854929fffffffff

serhiy.storchaka added on 2026-10-21 08:46:00:

Fixed in 8.6.11 by [081a8b9b50] (safe-bugfixes-8-6): subdirectories of tm roots now go only into the access path, not into the child's tm path. With an extra tm directory that has subdirectories, the child's and the parent's tm lists are the same with 8.6.11, 8.6.18, 9.0.5 and main (they differ with 8.6.10). Closing.