Tcl package Thread source code

View Ticket
Login
Ticket UUID: c9b0bd2a8864b1197fbdad3f969f6537591222fe
Title: Bug in "unknown" proc implementation provided by Ttrace
Type: Bug Version: trunk
Submitter: anonymous Created on: 2021-11-25 11:39:00
Subsystem: 80. Thread Package Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Severe
Status: Closed Last Modified: 2021-12-02 17:18:12
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2021-12-02 17:18:12
Description:
Observed behavior (reported by Ralf Fassel on comp.lang.tcl):

package require Ttrace
parray tcl_platform
=> "tcl_platform" isn't an array

The reason for the above strange error message is a bug in the Ttrace package.  This package renames the "unknown" proc to ::tcl::unknown and provides its own "unknown" command implementation in the file ttrace.tcl.  Line #329 of this file reads:

            set c [catch {::eval ::tcl::unknown $args} r]

This line (belonging to the body of the ttrace::unknown proc, which in turn is imported into the global namespace) must be changed to become:

            set c [catch {uplevel ::tcl::unknown $args} r]

The bug described above is a very long-standing one.  As far as I can see, it has been present in Ttrace from the very beginning.
User Comments: jan.nijtmans added on 2021-12-02 17:18:12:

Done [d532cbd23f6e357b|here]. Thanks, Schelte, for your suggestion!


sbron added on 2021-11-26 11:32:56:

I believe it is recommended to always provide an explicit level to the uplevel command. This prevents failing attempts to interpret the first argument as number or #number and is supposedly more efficient. Or so I've been told.


jan.nijtmans added on 2021-11-25 21:12:18:

Fixed now in all branches. Will be part of Thread 2.8.8. Thanks for the clear example! And for the fix!