Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-09-12
01:24 • Ticket [443184ffff] interp alias {} unknown {} nothing; foo status still Clo... artifact: 3d76fbe91e user: hobbs
2001-09-11
13:22 • Ticket [443184ffff]: 6 changes artifact: b8af374371 user: dgp
10:53 • Ticket [443184ffff]: 6 changes artifact: a4c69321f6 user: dgp
07:50 • Closed ticket [443184ffff]. artifact: 4467b7821f user: hobbs
07:00 • Ticket [443184ffff]: 6 changes artifact: 48fffdb415 user: hobbs
2001-09-08
05:50 • Ticket [443184ffff]: 1 change artifact: 48f5c089c2 user: andreas_kupries
2001-08-20
21:20 • Ticket [443184ffff]: 1 change artifact: 2478bb95fa user: dkf
2001-07-21
04:11 • Ticket [443184ffff]: 4 changes artifact: 76d78209ac user: dgp
03:39 • Ticket [443184ffff]: 4 changes artifact: 642a14b7a6 user: dgp
2001-07-20
20:28 • New ticket [443184ffff]. artifact: 4afbeaceff user: nobody

interp alias {} unknown {} nothing; foo

Closed / Fixed443184ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 25 years ago
Descriptionplain2001-07-20 20:28:13
Tcl can be made to eat resources until it dies, by
doing "interp alias {} unknown {} nothing", where
"nothing" is a nonexistent procedure, and then invoking
unknown.
dgpplain2001-07-21 03:39:24
Logged In: YES 
user_id=80530

Contrast this with

% proc unknown args nothing; foo
too many nested calls to Tcl_EvalObj (infinite loop?)
dgpplain2001-07-21 04:11:29
Logged In: YES 
user_id=80530

Note another way aliases differ from procs:

http://groups.google.com/groups?hl=en&safe=off&th=1784032ddc241340,4&seekm=8mf2uq%24jkq%241%40bob.news.rcn.net
dkf Ticket [443184ffff]: 1 change [History diff]2001-08-20 21:20:32
andreas_kupries Ticket [443184ffff]: 1 change [History diff]2001-09-08 05:50:10
hobbsplain2001-09-11 07:00:42
Logged In: YES 
user_id=72656

I'm dubious of how and if this should be fixed in the 
core.  What occurs is a memory exhaustion failure, and it 
does require direct coding on the user's part.  While this 
may be a bit more obtuse than
    set i 1000000
    while 1 { string repeat a [incr i] }
it is the same failure.  Very fragile checks would have to 
be put in to avoid this, and I'm not sure we should do 
anything more than document the use of 'unknown' better.
hobbsplain2001-09-11 07:50:47
Logged In: YES 
user_id=72656

Forget my blathering.  Looking closer I see that the same 
check for loop can be done (the numLevels was actually 
getting incr'ed, but wasn't getting checked because we were 
using TclObjInvoke instead of Tcl_EvalObjEx).  Fixed in 
8.4a4cvs and core-8-3-1-branch.
dgpplain2001-09-11 10:53:05
Logged In: YES 
user_id=80530

test stack-2.1 fails on the core-8-3-1-branch.

==== stack-2.1 maxNestingDepth reached on infinite recursion
FAILED
==== Contents of test case:

    catch {rename unknown unknown_safe}
    interp alias {} unknown {} notaknownproc
    catch {foo} msg
    catch {rename unknown {} ; rename unknown_safe unknown}
    set msg

---- Result was:
a b  c
---- Result should have been:
too many nested calls to AliasObjCmd (infinite loop using
alias?)
==== stack-2.1 FAILED
dgpplain2001-09-11 13:22:41
Logged In: YES 
user_id=80530

OK, the stack-2.1 test failure is just a specific instance
of a general problem in the test suite.  See Tcl Bug 460591.

http://sf.net/tracker/index.php?func=detailbug&aid=460591&group_id=10894&atid=110894
hobbsplain2001-09-12 01:24:47
Logged In: YES 
user_id=72656

This can be isolated with the changes:

***************
*** 46,55 ****
  } {too many nested calls to Tcl_EvalObj (infinite loop?)}
  
  test stack-2.1 {maxNestingDepth reached on infinite 
recursion} {minStack2400} {
!     catch {rename unknown unknown_safe}
!     interp alias {} unknown {} notaknownproc
!     catch {foo} msg
!     catch {rename unknown {} ; rename unknown_safe 
unknown}
      set msg
  } {too many nested calls to AliasObjCmd (infinite loop 
using alias?)}
  
--- 46,57 ----
  } {too many nested calls to Tcl_EvalObj (infinite loop?)}
  
  test stack-2.1 {maxNestingDepth reached on infinite 
recursion} {minStack2400} {
!     # do this in a slave to not mess with parent
!     set slave stack-2.1
!     interp create $slave
!     $slave eval { interp alias {} unknown {} 
notaknownproc }
!     set msg [$slave eval { catch {foo} msg ; set msg }]
!     interp delete $slave
      set msg
  } {too many nested calls to AliasObjCmd (infinite loop 
using alias?)}
Log in (anonymous is fine) to add a comment.