Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

TCL/Tk 8.6.2 try/trap with multiple handlers causes error

157 views
Skip to first unread message

Philip Hoffman

unread,
Oct 20, 2014, 4:22:37 PM10/20/14
to
I just upgraded to Activestate 8.6.2. After trying out some scripts I crashed one of them with code similar to the following:

proc someProc {} {
try {
throw vector "Some error..."
} trap {vector} {} - trap {echo} {} - trap {charlie} {} {
puts "The trap ran!"
}
}

A window pops up, titled "Fatal Error" with a message of "bad stack depth computations: is -1, should be 1"

After that wish86 crashes.

Is my coding the cause of this error? How could I get around this?

Christian Gollwitzer

unread,
Oct 20, 2014, 5:07:14 PM10/20/14
to
Am 20.10.14 22:22, schrieb Philip Hoffman:
No.
A Tcl script should never ever crash this way. It is a bug, which I
could reproduce on 8.6.1; it calls Tcl_Panic inside of TclCompileScript

> How could I get around this?
>

Waiting for the TCT to fix it :-( I leave it to the experts to try.

Christian

Philip Hoffman

unread,
Oct 21, 2014, 1:32:29 AM10/21/14
to
Wow really? I haven't had any issues with 8.6.1, at least with the Activestate builds.

Andreas Leitgeb

unread,
Oct 21, 2014, 4:56:51 AM10/21/14
to
Christian Gollwitzer <auri...@gmx.de> wrote:
> Am 20.10.14 22:22, schrieb Philip Hoffman:
>> I just upgraded to Activestate 8.6.2. After trying out some scripts I
>> crashed one of them with code similar to the following:
>> proc someProc {} {
>> try {
>> throw vector "Some error..."
>> } trap {vector} {} - trap {echo} {} - trap {charlie} {} {
>> puts "The trap ran!"
>> }
>> }
> A Tcl script should never ever crash this way. [...]
Definitely

>> How could I get around this?
> Waiting for the TCT to fix it :-( I leave it to the experts to try.

As a workaround, you can give each trap its own body.

After a few experiments it seems to me, as if it was tied
to the "fallthrough"-body -. Fwiw, it's enough to have two
traps to reproduce the crash, and it doesn't matter which
of the two (the former or latter) fires. With separate
bodies I didn't get a crash.

Alexandre Ferrieux

unread,
Oct 21, 2014, 6:25:35 AM10/21/14
to
Quote: Christian Gollwitzer wrote on Mon, 20 October 2014 23:07
----------------------------------------------------
> >
> > How could I get around this?
> >
>
> Waiting for the TCT to fix it :-( I leave it to the experts to try.

.. assuming it is the TCT's privilege and duty :)
Anyway, though many are watching c.l.t, a better way to "wait for a fix" is to post a bug report on core.tcl.tk.

-Alex

Don Porter

unread,
Oct 21, 2014, 11:41:17 AM10/21/14
to
Quote: Philip Hoffman wrote on Mon, 20 October 2014 22:22
> proc someProc {} {
> try {
> throw vector "Some error..."
> } trap {vector} {} - trap {echo} {} - trap {charlie} {} {
> puts "The trap ran!"
> }
> }
>
> A window pops up, titled "Fatal Error" with a message of "bad stack depth computations: is -1, should be 1"

This is Tcl Bug [cee90e4e88].

http://core.tcl.tk/tcl/tktview?name=cee90e4e88

Already fixed for Tcl 8.6.3.


Message has been deleted

Don Porter

unread,
Apr 23, 2018, 8:38:54 AM4/23/18
to
On 04/22/2018 02:14 AM, xyz2...@gmail.com wrote:
> I am getting same error "bad stack depth computations: is 2, should
> be 1" on Tcl 8.6.8. Is there any workaround?
You are replying to a four year old article that has expired from my
news feed. Can you provide a fresh demonstration of the problem?

Better yet, can you file a ticket for your bug report:

https://core.tcl.tk/tcl/tktnew

You will be asked to login. You may use an anonymous account if you must.

--
| Don Porter Applied and Computational Mathematics Division |
| donald...@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|______________________________________________________________________|
0 new messages