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

Bug in trace add execution leave

46 views
Skip to first unread message

Stephen Prather

unread,
Jul 6, 2021, 1:07:38 PM7/6/21
to
Hi Tcl'ers--

When I give a non-existent proc to trace, the tclsh locks up. Let me know if you think it is a real bug. Thanks! --Myles

% tclsh
>trace add execution puts leave foo

while executing
"puts -nonewline [string range $txt 0 2047]"
(procedure "TclReadLine::print" line 6)
invoked from within
"TclReadLine::print "$res\n""
invoked from within
"if {$code == 1} {
TclReadLine::print "$::errorInfo\n"
} else {
TclReadLine::print ..."
("uplevel" body line 1)
invoked from within
"uplevel \#0 {

# Handle aliases:
set cmdline $TclReadLine::CMDLINE
#
..."
(procedure "TclReadLine::tclline" line 38)
invoked from within
"TclReadLine::tclline"
<hangs here>
^C

Usenet Lurker

unread,
Jul 14, 2021, 3:57:36 AM7/14/21
to

On 7/7/21 1:07 am, Stephen Prather wrote:
> When I give a non-existent proc to trace, the tclsh locks up. Let me
know if you think it is a real bug. Thanks! --Myles

At first I though you were using the canonical `tclreadline` (i.e. Tcl
interface to GNU readline), but I've never known it to use a CamelCase
namespace name (`TclReadLine`). I also don't remember that package
having a "tclline" proc, so I assume you're using something else. More
details about your operating environment (like OS, Tcl version, and what
`TclReadLine` actually is) would help.

> % tclsh
>> trace add execution puts leave foo
>
> while executing
> "puts -nonewline [string range $txt 0 2047]"
> (procedure "TclReadLine::print" line 6)
> invoked from within
> "TclReadLine::print "$res\n""
> invoked from within
> "if {$code == 1} {
> TclReadLine::print "$::errorInfo\n"
> } else {
> TclReadLine::print ..."
> ("uplevel" body line 1)
> invoked from within
> "uplevel \#0 {
>
> # Handle aliases:
> set cmdline $TclReadLine::CMDLINE
> #
> ..."
> (procedure "TclReadLine::tclline" line 38)
> invoked from within
> "TclReadLine::tclline"
> <hangs here>
> ^C

In any case, I can't replicate your problem with stock `tclreadline`, so
it's likely something in `TclReadLine`, whatever that is:

$ tclsh
% package require tclreadline
2.3.8
% trace add execution puts leave foo
% puts [info tclversion]
8.6
invalid command name "foo"
% puts Hi
Hi
invalid command name "foo"
%

Christian Werner

unread,
Jul 14, 2021, 7:17:46 PM7/14/21
to
Most likely, you're using https://wiki.tcl-lang.org/diff/Pure-tcl%20readline2 which uses puts for output which now is traced which leads to puts ceasing proper puttery due to erroneous execution tracing which makes things seem to be locked up. Pure Tcl readline may cause straight footgunnery in this case.

My 2c,
Christian
0 new messages