Tcl Source Code

View Ticket
Login
Ticket UUID: 495830
Title: execution in deleted interpreter
Type: Bug Version: obsolete: 8.5a2
Submitter: msofer Created on: 2001-12-21 12:26:36
Subsystem: 47. Bytecode Compiler Assigned To: msofer
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2004-03-30 23:34:57
Resolution: Fixed Closed By: msofer
    Closed on: 2004-03-30 16:34:57
Description:
The following script

    interp create tst
    interp alias tst suicide {} interp delete tst
    tst eval {proc bug {} {suicide; set a 5}}
    tst eval bug

returns 5, the bytecode runs to the end without
noticing the dead
interp!
User Comments: msofer added on 2004-03-30 23:34:57:
Logged In: YES 
user_id=148712

Fixed in 8.5a2 together with bug #729692

dgp added on 2003-11-17 23:10:03:
Logged In: YES 
user_id=80530


We need documentation on what
operations should be permitted
in a deleted interp, and why.

If such documentation doesn't
already exist somewhere, we
need to create it, by divining
intent from the source code as
best we can, I guess.

This will take some time (or
intervention by someone wiser).

msofer added on 2003-11-16 20:59:25:

File Deleted - 67667: 



File Added - 67671: interpDeleted.patch

Logged In: YES 
user_id=148712

Added two tests to the patch, although I'm not sure what the
correct returns should be (see previous remark).

msofer added on 2003-11-16 19:21:23:

File Added - 67667: interpDeleted.patch

Logged In: YES 
user_id=148712

The attached patch solves this particular issue and passes
the complete testsuite. I am however worried about it being
too strict: is it true that the only bc instruction to be
allowed in a deleted interpreter is INST_DONE? In principle,
invoking new commands is what should be forbidden.

Ie, what should happen with
  tst eval {proc bug {} {catch {suicide} m}
  tst eval bug
This patch returns an error, which may be right or not ...
in principle, 'catch' was called before the interp deletion,
and it is not clear tome if it should run to the end or not.
Requesting comments.

msofer added on 2003-06-11 02:48:05:
Logged In: YES 
user_id=148712

The new bug is now fixed in 8.4-branch and 8.5

msofer added on 2003-06-11 01:01:58:
Logged In: YES 
user_id=148712

The original bug exists in 8.3 too.
dgp's version is OK in 8.3, buggy in 8.4. This probably has
to do with the overall reorganization in the different
execution paths.

dgp added on 2003-06-10 22:54:54:
Logged In: YES 
user_id=80530

jyl, try this alternative:

interp create tst
interp alias tst suicide {} interp delete tst
tst eval {proc bug {} {set set set; suicide; $set a 5}}
tst eval bug

jyljyljyl added on 2003-06-10 06:09:27:
Logged In: YES 
user_id=63723

I want to understand, is this a problem only in compiled 
bytecodes? If the code runs interpreted (I don't know how to 
create an equivalent interpreted example..) does execution 
terminate with an error (as expected) after "suicide"?

--JYL

msofer added on 2002-06-21 01:40:10:
Logged In: YES 
user_id=148712

This is actually not *that* bad, as not much can happen in
the deleted interpreter: no non-compiled cmds can be run, no
variable can be saved, ...
The only real problem is that we get a TCL_OK return

Attachments: