Tcl Source Code

View Ticket
Login
Ticket UUID: 3004191
Title: glob - the use of [try] does not set msg prober
Type: Bug Version: obsolete: 8.6b1.1
Submitter: johannes-kuhn Created on: 2010-05-19 17:08:40
Subsystem: 33. Safe Base Assigned To: dkf
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2010-08-18 20:32:35
Resolution: Fixed Closed By: dkf
    Closed on: 2010-08-18 13:32:35
Description:
(bin) 52 % safe::createInterp slave; slave eval {glob *}
invalid command name "safe::createInterp"

Please trap the ok too :)

Patch file included.
User Comments: dkf added on 2010-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!

dkf added on 2010-08-18 20:13:48:
% safe::interpCreate slave
slave
% slave eval {glob *}
can't read "msg": no such variable

johannes-kuhn added on 2010-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].

johannes-kuhn added on 2010-05-20 00:08:41:

File Added - 374488: safe.tcl.patch

Attachments: