Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ea8d3761de259dcfc84f179c28f7fee3ba3d6c57
Ticket: 3588687fffffffffffffffffffffffffffffffff
Tcl_InitStubs() Broken As Designed
User & Date: dgp on 2012-12-07 22:06:29
Changes

  1. icomment:
    Using 'make shell` on novem branch, here's
    the result of [load]ing the updated pkgb.so files
    on the trunk and bug-3588687 branches:
    
    % load path/to/bug-3588687/pkgb.so
    version conflict for package "Tcl": have 9.0a0, need 8
    % load path/to/trunk/pkgb.so
    % pkgb_demo
    make: *** [shell] Segmentation fault
    
    The [pkgb_demo] command calls
    Tcl_GetDefaultEncodingDir() which has been
    removed from the novem stubs table, causing
    the crash.  The bug fix on bug-3588687 prevents
    this crash from happening by preventing the [load]
    of the unsupportable extension.
    
    Now you may object Tcl_GetDefaultEncodingDir
    isn't in the Tcl 9 API!  So it's a bug for pkgb.c to
    be passing "8.5-9.1" to Tcl_InitStubs().  Two replies:
    
    1) I submit that Tcl_EvalEx() with an int numBytes argument
        is likewise not in the Tcl 9 stubs API.  So this is just the same
        bug already demonstrated.  Except this new test makes clear
        this is not some problem that only shows up in a 64-bit scenario.
        It's implicit in the freedom to change the stubs tables incompatibly
        on a new major version of Tcl.
    2) Even if it is a bug, the common theme in much of this discussion is
         how much better it is to react to a bug with an error message, or even
         a controlled panic, rather than a crash.
    
    
    
  2. login: "dgp"
  3. mimetype: "text/plain"
  4. username: "dgp"