Skip to content
Tcl Source Code View Ticket
Login

View Ticket

[namespace import] / alias foil each others loop prevention

Open1017004fffffffffffffffffffffffffffffffffCreated 22 years agoUpdated 22 years ago
Descriptionplain2004-08-26 16:27:13
TclPreventAliasLoop doesn't detect 
and prevent loops that include a
[namespace import] link.

% namespace eval ns namespace export alias
% interp alias {} ns::alias {} ns::target  
ns::alias
% namespace import ns::alias
% interp alias {} ns::target {} alias 
ns::target
% alias
too many nested evaluations (infinite loop?)
dgpplain2004-08-27 07:13:14
Logged In: YES 
user_id=80530


Another variation, this time the
flaw is in the loop detection
inside Tcl_Import():

% namespace eval ns namespace export alias
% interp alias {} ns::alias {} alias
ns::alias
% namespace import ns::alias
% alias
too many nested evaluations (infinite loop?)
dgpplain2004-08-27 07:33:33
Logged In: YES 
user_id=80530


BTW, I think it's fair to claim that
neither of these issues is really a
bug.  Tcl certainly allows other
ways to set up infinite loops:

proc foo {} foo; foo

and the recursion limit is the
only protection.

I raise these points only because
loops made purely of aliases, or
purely of imports, are detected
and prevented at creation time.

The pure import loops must be
prevented to avoid loss of the
base Tcl_Command, but any
loop that includes an alias
could reasonably be allowed
to be caught at runtime.
dgp Ticket [1017004fff]: 1 change [History diff]2004-08-27 20:50:59
Log in (anonymous is fine) to add a comment.