|
2010-01-13
| ||
| 15:49 | • Ticket [2930115fff] interp create -safe on Linux excudes try and throw commands... artifact: 811358ccf2 user: dkf | |
| 15:49 | • Closed ticket [2930115fff]. artifact: 3ead622740 user: dkf | |
| 02:01 | • Open ticket [2930115fff]. artifact: b9bdbd632b user: cwjolly | |
|
2010-01-12
| ||
| 16:17 | • Pending ticket [2930115fff]. artifact: 5ef6fa0e9e user: dkf | |
| 16:17 | • Ticket [2930115fff]: 4 changes artifact: 8f9165e5c0 user: dkf | |
| 04:39 | • Ticket [2930115fff]: 4 changes artifact: b4415e6720 user: cwjolly | |
| 04:39 | • Add attachment safeinterp.tcl to ticket [2930115fff] artifact: 9112829ab9 user: cwjolly | |
|
2010-01-11
| ||
| 21:39 | • New ticket [2930115fff] interp create -safe on Linux excudes try and throw comm... artifact: 1541d414d4 user: cwjolly | |
interp create -safe on Linux excudes try and throw commands
Closed / Out of Date2930115fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 17 years ago
Descriptionplain2010-01-11 21:39:13
Safe Slave interpreters on Linux and tcl8.6b.1 do not have the try or the throw command. Same script run on Linux using tcl 8.5.6 shows that safe slave interpreters do have try and throw commands The attached script when run with tcl8.6b.1 results in the following output. -- OUTPUT --- Slave interp does not have: auto_execok Slave interp does not have: auto_import Slave interp does not have: auto_load Slave interp does not have: auto_load_index Slave interp does not have: auto_qualify Slave interp does not have: cd Slave interp does not have: encoding Slave interp does not have: exec Slave interp does not have: exit Slave interp does not have: fconfigure Slave interp does not have: file Slave interp does not have: glob Slave interp does not have: load Slave interp does not have: open Slave interp does not have: pwd Slave interp does not have: socket Slave interp does not have: source Slave interp does not have: tclLog Slave interp does not have: throw <--- Slave interp does not have: try <--- Slave interp does not have: unknown Slave interp does not have: unload tcl 8.5.6 OUTPUT Slave interp does not have: auto_execok Slave interp does not have: auto_import Slave interp does not have: auto_load Slave interp does not have: auto_load_index Slave interp does not have: auto_qualify Slave interp does not have: cd Slave interp does not have: encoding Slave interp does not have: exec Slave interp does not have: exit Slave interp does not have: fconfigure Slave interp does not have: file Slave interp does not have: glob Slave interp does not have: load Slave interp does not have: open Slave interp does not have: pwd Slave interp does not have: socket Slave interp does not have: source Slave interp does not have: tclLog Slave interp does not have: unknown Slave interp does not have: unload
cwjollyplain2010-01-12 04:39:17
File Added - 358604: safeinterp.tcl
dkfplain2010-01-12 16:17:19
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.
dkf Pending ticket [2930115fff].
[History diff]2010-01-12 16:17:20
cwjollyplain2010-01-13 02:01:51
Thanks I looked at the file tcl_Basic.c and did not find the try or throw command in my tcl8.6b.1 distro and then looked in init.tcl and the scripted versions were there as you said. Thanks for letting me know its in the HEAD; I download it and recompile.
dkf Closed ticket [2930115fff].
[History diff]2010-01-13 15:49:18
dkfplain2010-01-13 15:49:19
allow_comments - 1
Log in (anonymous is fine) to add a comment.
Attachments:
- safeinterp.tcl [download] added by cwjolly on 2010-01-12 04:39:16. [details]