Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-10-15
09:20 • Closed ticket [1028587fff]: interp hide leaves pre-existing imports exposed</i... artifact: 64912f1645 user: sf-robot
2006-10-01
02:33 • Pending ticket [1028587fff]. artifact: 66e5884b04 user: msofer
2004-09-16
23:07 • Ticket [1028587fff]: 4 changes artifact: 3bcaa7a113 user: dkf
21:42 • Ticket [1028587fff]: 4 changes artifact: f18491fda1 user: dgp
21:36 • Ticket [1028587fff]: 5 changes artifact: 6a15958149 user: msofer
2004-09-15
14:24 • New ticket [1028587fff]. artifact: b8dc261b37 user: dgp

[interp hide] leaves pre-existing imports exposed

Closed / Invalid1028587fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 20 years ago
Descriptionplain2004-09-15 14:24:36
% proc foo {} {puts foo}
% namespace export foo 
% namespace eval ns namespace import ::foo
% ns::foo    
foo
% interp hide {} foo
% foo
invalid command name "foo"
% ns::foo
foo


This means that a "safe" interp
can have the means to access
hidden commands.  Ability
to hide commands it what makes
a safe interp safe.
msoferplain2004-09-16 21:36:30
Logged In: YES 
user_id=148712

To insure the safety of the interp you have to hide unsafe
commands *before* running any potentially unsafe script. It
is useless to close the barn door after the horses fled ;)

% proc foo {} {puts foo}
% namespace export foo 
% interp hide {} foo
% namespace eval ns namespace import ::foo
% ns::foo 
invalid command name "ns::foo"

The bug (is it one?) is then that you cannot completely hide
a command after it was exposed. Consider a different
example, pushing the argument to the extreme

% proc newProc [info args oldProc] [info body oldProc]
% interp hide {} oldProc
dgpplain2004-09-16 21:42:02
Logged In: YES 
user_id=80530


I can accept a judgment of
"not a bug".

There is a difference with
your conterexample, though.

The hiding of a command
in most respects looks like
the deletion of the command.
It's just not there anymore.

Deleting a command also
deletes all of its imports.
However, (inconsistently,
I allege), hiding a command
fails to hide all of its imports.
Instead the imports still refer
to a spooky half-existing command
that still runs.
dkfplain2004-09-16 23:07:20
Logged In: YES 
user_id=79902

The bug is the funky way that [namespace import] works...
msofer Pending ticket [1028587fff]. [History diff]2006-10-01 02:33:28
sf-robotplain2006-10-15 09:20:08
Logged In: YES 
user_id=1312539

This Tracker item was closed automatically by the system. It was
previously set to a Pending status, and the original submitter
did not respond within 14 days (the time period specified by
the administrator of this Tracker).
Log in (anonymous is fine) to add a comment.