Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Bug in safe::interpCreate

Closed / Fixed693851ffffffffffffffffffffffffffffffffffCreated 24 years agoUpdated 6 years ago
Descriptionplain2003-02-26 19:15:52
I want to create a safe interpreter (bar) under the foo 
namespace..  Here's the sample code and the error it 
gives:

% namespace eval foo {safe::interpCreate ::foo::bar}
can't set "S::foo::bar(access_path,0)": parent 
namespace doesn't exist
nobodyplain2003-02-27 04:08:38
Logged In: NO 

Based on my preliminary research,

changing this proc in "safe.tcl" from this:

    proc InterpStateName {slave} {
        return "S$slave"
    }

to this:

    proc InterpStateName {slave} {
        regsub -all -- {::} $slave "" slave
        return "S$slave"
    }

seems to fix the problem.

JJM
fireegl Ticket [693851ffff]: 2 changes [History diff]2003-03-05 01:56:50
fireeglplain2003-03-05 01:56:51
Logged In: YES 
user_id=20221

I personally did it like this..

proc InterpStateName {slave} {
        return "${slave}S"
}

It would seem that it would put the variable in the same 
namespace that I created the interpreter uder this way.
fireegl Ticket [693851ffff]: 3 changes [History diff]2003-07-09 15:07:10
hobbsplain2003-07-17 05:33:25
Logged In: YES 
user_id=72656

I think the correct thing is to improve the docs to note that 
slaves cannot be in namespaces.  There may be other bugs 
lurking.  Or rather, make the creation more ns aware and 
create the [namespace qual $slaveName] first.  If someone 
can create and test that patch, it would be better.
kjnashplain2020-07-21 17:36:33
Fixed in safe-bugfixes-8-6 commit [ba718daa57], but subject to some restrictions because of the need for compatibility with existing code, and the non-standard namespace handling of "interp" (see bug [66c2e8c974]).

In the fixed version, the interpreter name "slave" may include namespace separators,
but may not have leading or trailing namespace separators, or excess
colon characters in namespace separators.  The interpreter name is
qualified relative to the global namespace ::, not the namespace in which
the ::safe::interpCreate or ::safe::interpInit command is evaluated.
kjnash Closed ticket [693851ffff]. [History diff]2020-12-31 15:57:04
Log in (anonymous is fine) to add a comment.