#1351 inconsistent [return] at level #0

obsolete: 8.3.1
closed-duplicate
5
2001-08-28
2000-10-26
Anonymous
No

OriginalBugID: 6103 Bug
Version: 8.3.1
SubmitDate: '2000-08-09'
LastModified: '2000-10-25'
Severity: SER
Status: UnAssn
Submitter: techsupp
OS: All
FixedDate: '2000-10-25'
ClosedDate: '2000-10-25'

Name:
Don Porter

Comments:
The source of the problem is in tclParse.c,
in the routine Tcl_EvalTokens():

case TCL_TOKEN_COMMAND:
code = Tcl_EvalEx(interp, tokenPtr->start+1,
tokenPtr->size+2,
0);
if (code != TCL_OK) {
goto error;
}

This code effectively converts all non-TCL_OK return codes
into a TCL_ERROR return code, which is not correct. I don't
see an immediate fix, though, since Tcl_EvalTokens() returns
a Tcl_Obj, not a Tcl return code. There doesn't seem to be
any channel for passing back the return code to the caller.

This same problem is the cause of bug report #2136, and it
may be related to other bug reports linked to #2136.

BTW, the status of ticket #2136 is "Assigned". Any way
to find out to whom it was assigned?

ReproducibleScript:
$ cat demo1.tcl
# FILE: demo1.tcl
puts [info patchlevel]
return

$ cat demo2.tcl
# FILE: demo1.tcl
puts [info patchlevel]
list [return]

ObservedBehavior:
$ tclsh8.0 demo1.tcl
8.0.5

$ tclsh8.0 demo2.tcl
8.0.5

$ tclsh demo1.tcl
8.3.1

$ tclsh demo2.tcl
8.3.1

while executing
"list [return]
"
(file "demo2.tcl" line 3)

DesiredBehavior:
I expect the [return] command at level #0 of
evaluation to behave the same whether it is
invoked directly, or as part of a command
substitution. Tcl 8.0.5 gets it right.
Tcl 8.1.0 and every Tcl since gets it wrong,
as demonstrated above using Tcl 8.3.1.

Discussion

  • Donal K. Fellows

    • labels: 104246 --> 104238
     
  • Don Porter

    Don Porter - 2001-04-05
    • labels: 104238 --> 45. Parsing and Eval
     
  • miguel sofer

    miguel sofer - 2001-04-05
    • assigned_to: nobody --> msofer
     
  • miguel sofer

    miguel sofer - 2001-08-25

    Logged In: YES
    user_id=148712

    Seems to be fixed by the patch to bug #455151

     
  • miguel sofer

    miguel sofer - 2001-08-28
    • status: open --> closed-duplicate
     
  • miguel sofer

    miguel sofer - 2001-08-28

    Logged In: YES
    user_id=148712

    It is now apparent that this is the same bug as #455151. I'm
    tagging this one as "Duplicate".