Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8f9165e5c0cf1f3eff30f152e6736efb5c63d61d
Ticket: 2930115fffffffffffffffffffffffffffffffff
interp create -safe on Linux excudes try and throw commands
User & Date: dkf on 2010-01-12 16:17:19
Changes

  1. icomment:
    Works for me when I use either [interp create -safe] or [safe::interpCreate] to make the interpreter. Evidence:
    
    dkf$ make -C unix shell
    DYLD_LIBRARY_PATH=`pwd`: TCLLIBPATH="/Users/dkf/Documents/software/tcl8.6-HEAD/unix/pkgs" TCL_LIBRARY="/Users/dkf/Documents/software/tcl8.6-HEAD/library" ./tclsh 
    % interp create foo -safe
    foo
    % foo eval {try { puts abc } finally {return ok}}
    ok
    % foo eval {try { puts abc }}
    can not find channel named "stdout"
    % interp share foo 
    wrong # args: should be "interp share srcPath channelId destPath"
    % interp share {} stdout foo
    % foo eval {try { puts abc } finally {return ok}}
    abc
    ok
    % foo eval {try {throw err} finally {puts ok}}
    ok
    wrong # args: should be "throw type message"
    % safe::interpCreate
    interp0
    % interp0 eval {try { puts abc } finally {return ok}}
    ok
    % interp share {} stdout interp0
    % interp0 eval {try { puts abc } finally {return ok}}
    abc
    ok
    % interp0 eval {throw FOO "foo is bar"}
    foo is bar
    % set errorInfo
    foo is bar
        while executing
    "throw FOO "foo is bar""
        invoked from within
    "interp0 eval {throw FOO "foo is bar"}"
    % set errorCode
    FOO
    
    I suspect you've got an older version where [try] and [throw] were scripted commands that were created in init.tcl (not evaluated in a safe interpreter); this is fixed in the HEAD, and has been for a while. The scripted [try] was only ever an interim solution anyway so that we could get 8.6b1 released sooner.
    
    
  2. login: "dkf"
  3. mimetype: "text/plain"
  4. username: "dkf"