Tcl Source Code

View Ticket
Login
Ticket UUID: 833150
Title: exception -> wrong length of cmd in stack
Type: Bug Version: obsolete: 8.4.5
Submitter: dgp Created on: 2003-10-30 15:53:07
Subsystem: 45. Parsing and Eval Assigned To: dgp
Priority: 8 Severity:
Status: Closed Last Modified: 2004-07-28 23:06:06
Resolution: Fixed Closed By: dgp
    Closed on: 2004-07-28 16:06:06
Description:
% continue
invoked "continue" outside of a loop
% set errorInfo
invoked "continue" outside of a loop
    while executing
"continue
"


Note the extra \n at the end of $errorInfo

Apparently Tcl_LogCommandInfo is being
passed an incorrect length.
User Comments: dgp added on 2004-07-28 23:06:05:
Logged In: YES 
user_id=80530

done

dgp added on 2004-07-23 08:07:07:
Logged In: YES 
user_id=80530

backport this for 8.4.8

dgp added on 2004-03-29 22:58:30:
Logged In: YES 
user_id=80530


The \n is put back by Tcl_Main() only
to be sure it is present in multi-line
scripts.  It's not needed at the end of
a complete script.  Committing correction
to HEAD.

It's still a bit disappointing that line 3896
of tclBasic.c can't provide any more detail
than the whole toplevel script that raised
the exception, but that's probablty best
addressed in another report if it ever becomes
a real problem for someone.

dgp added on 2004-03-28 06:26:54:
Logged In: YES 
user_id=80530

I have an elegant solution to this issue
that the margin is too small to
contain...

msofer added on 2004-03-28 06:06:48:
Logged In: YES 
user_id=148712

Actually, this patch feels very wrong. It is sure to cause
pain to embedders and/or extenders.
I'd rather say that this is not a bug (scripts run from the
console include the closing \n), or else it is a bug in
Tcl_Main (scripts run from the console should not include
the closing \n).

dgp added on 2004-03-28 06:04:18:
Logged In: YES 
user_id=80530


Thanks for looking into this.

I suspect the right fix is to
examine Tcl_Main and make
sure it's only appending \n
when it needs to.  I'll check
into that.

msofer added on 2004-03-27 09:58:14:

File Added - 81541: 833150.patch

msofer added on 2004-03-27 09:58:13:
Logged In: YES 
user_id=148712

Attached a patch that fixes this issue and passes all tests
(after adapting basic-46.1).
I am not positive that this is a correct fix: what are all
the uses of TCL_ALLOW_EXCEPTIONS? Note that this flag value
is defined in tclInt.h and is (correctly) not documented in
doc/Eval.3
Please review.

msofer added on 2004-03-27 09:29:22:
Logged In: YES 
user_id=148712

This is a consequence of line 467 in tclMain.c - the comment
explicitly says that a newline is to be added there. 
This behaviour is actually required by the test basic-46.1;
removing that line however causes failure of tests in
main.test (5.8, 5.11, 5.12, 9.1) and unixInit-1.2. So that
is not a correct fix ...

Attachments: