Skip to content
Tcl Source Code View Ticket
Login

View Ticket

glob - the use of [try] does not set msg prober

Closed / Fixed3004191fffffffffffffffffffffffffffffffffCreated 17 years agoUpdated 16 years ago
Descriptionplain2010-05-19 17:08:40
(bin) 52 % safe::createInterp slave; slave eval {glob *}
invalid command name "safe::createInterp"

Please trap the ok too :)

Patch file included.
johannes-kuhnplain2010-05-20 00:08:41
File Added - 374488: safe.tcl.patch
johannes-kuhn Ticket [3004191fff]: 1 change [History diff]2010-05-20 00:09:13
johannes-kuhnplain2010-05-20 19:32:47
    try {
::interp invokehidden $slave glob {*}$cmd
    } on error msg {
Log $slave $msg
return -code error "script error"
    }

As we can see, the result of glob is not used unless an error occurs.
But the statement
    Log $slave "GLOB @ $msg" NOTICE
requires that $msg is set. We use $msg also for the result of [glob] later.
My solution is to catch ok too, but we can also use the old [catch] or set msg [glob].
dkfplain2010-08-18 20:13:48
% safe::interpCreate slave
slave
% slave eval {glob *}
can't read "msg": no such variable
dkfplain2010-08-18 20:32:35
allow_comments - 1

Turned out that we didn't have any tests that checked whether a safe [glob] could ever work! D'oh!
Log in (anonymous is fine) to add a comment.

Attachments: