Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2010-08-18
20:32 • Closed ticket [3004191fff]: glob - the use of try does not set msg prober ... artifact: 181871e995 user: dkf
20:13 • Ticket [3004191fff]: 4 changes artifact: 791d473bf6 user: dkf
2010-05-20
19:32 • Ticket [3004191fff]: 5 changes artifact: be0ed163e5 user: johannes-kuhn
00:09 • Ticket [3004191fff]: 1 change artifact: 904aab05ef user: johannes-kuhn
00:08 • Ticket [3004191fff]: 4 changes artifact: f3278bc6cb user: johannes-kuhn
00:08 • Add attachment safe.tcl.patch to ticket [3004191fff] artifact: b79a45387c user: johannes-kuhn
2010-05-19
17:08 • New ticket [3004191fff] glob doesn't work on the safe base. artifact: a948cbbe51 user: johannes-kuhn

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: