Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 5f656870209a553e1c7d567abeb2406255c298b2
Ticket: 07d13d99b0a94420a5d25091b4baf917839cdce5
Who broke TCL 8.6 and Tclblend ?
User & Date: anonymous on 2016-04-09 22:33:39
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    Tclblend (1.4.1), the popular package providing access to Java classes, no more works with Tcl 8.6.x
    
    Tclblend was still working with Tcl 8.6.0; starting with Tcl-8.6.1, Tclblend
    stopped working.
    
    Here is a minimal crash test:
      package require java 1.4
      set jobj [java::new Object]
      $obj toString ;# CRASH
    
    
    I cannot claim to understand how tclblend internally works, but I believe I've found
    the way to fix it.
    The fix is in the tcl-core, more specifically in "generic/tclObj.c" .
    I  propose to *undo* a part of the changes occurred in 8.6.0->8.6.1 .
     (Check-in [2688d65077] 	2013-09-26 13:13:47)
    
    Within the function "Tcl_GetCommandFromObj", change
    from:
        if (SetCmdNameFromAny(interp, objPtr) != TCL_OK) {
            return NULL;
        }
    to:
     if (tclCmdNameType.setFromAnyProc(interp, objPtr) != TCL_OK) {
            return NULL;
        }
    
    
    Note that "by default" 
       tclCmdNameType.setFromAnyProc  ==  SetCmdNameFromAny
    ( i.e. the two code fragments are equivalent ).
    Only some (rare) extensions do redefine
      tclCmdNameType.setFromAnyProc
    and therefore it's vital that Tcl_GetCommandFromObj call the redefined function and not the 'standard' SetCmdNameFromAny.
    
    In other words,
    Tclblend redefines the function setFromAnyProc with its own "SetJavaCmdFromAny",
    but this function is never called, since TCL (8.6.1) always calls the original 
    SetCmdNameFromAny. This causes the crash.
    
    
    I tested this change with a 'patched' Tcl-8.6.1 and Tcl-8.6.4 and I had no more crash, even with heavy applications using tclblend.
    
    As I said before, this core-change has no impact for Tcl, since Tcl *never* changes the tclCmdNameType.setFromAnyProc value.
    
  5. foundin changed to: "8.6.1"
  6. is_private changed to: "0"
  7. login: "anonymous"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "af9c70d5700d5af288b87a3a9ed94e1300911d18"
  10. resolution changed to: "None"
  11. severity changed to: "Severe"
  12. status changed to: "Open"
  13. submitter changed to: "anonymous"
  14. subsystem changed to: "10. Objects"
  15. title changed to: "Who broke TCL 8.6 and Tclblend ?"
  16. type changed to: "Bug"