Tcl Source Code

View Ticket
Login
Ticket UUID: 2895741
Title: expr min and max don't work in a safe interp
Type: Bug Created on: 2009-11-11 06:35:58
Submitter: john13a Assigned to: dgp
Subsystem: 20. [interp] Severity:
Priority: 8 Last modified: 2009-12-29 21:56:55
Status: Open Closed by:
Resolution: None Closed on:
Version: obsolete: 8.5.7
Description:
::tcl::mathfunc::min and ::tcl::mathfunc::max are not created in a safe interp

this both commands are procs, written in pure tcl [info procs ::tcl::mathfunc::*]

To avoid this, create aliases for this method, but I think, this soud be created as well (like sin and cos and so on)
User Comments:
dgp added on 2009-11-11 22:27:01:
This is a consequence of Tcl_Init() not
being called on safe interps.  I was surprised
to see that.  I'll want to restore my understanding
of the history before leaping on this change,
even though the requested end if clearly correct.

john13a added on 2009-11-11 22:33:10:
Of course. On the other hand even a safe interp can create this commands on his own.

My suggest is to split Tcl_Init() into 2 or 3 parts, one for safe, one fore normal unsafe, and eventually a common init.

dkf added on 2009-11-11 22:40:09:
That's a bit complex because most of what Tcl_Init is doing is arranging for paths to be set correctly (very nasty!) and for init.tcl to be sourced (which does many things, including defining min() and max() of course).

dkf added on 2009-12-29 21:56:55:
Made both max() and min() work in safe interpreters. There's still the reconsideration of just what is to be done when building a safe interpreter, but that's now a less pressing problem so the priority is dropped a bit.