Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f98db08d0728fa5d4e297c515c94f48bb705c7557504f7d5d4030655228afe70
Ticket: 39fed4dae51e4fd7f1abf6baf3ba094a072b8beb
Tcl_PkgRequireEx, Tcl_InitStubs broken in 8.6.9
User & Date: dgp on 2019-03-02 12:18:06
Changes

  1. icomment:
    
    Tcl provides a number of routines that return to the caller a pointer into internal structs
    managed by Tcl itself. This is a fragile, but efficient arrangement that can work so long
    as the caller is aware of the limited period of reliability of the returned pointer, and makes
    copies of anything needed beyond that timeframe.
    
    Before this rewrite, the pointer returned pointed to a pkgPtr->version field of the
    "Package" struct for the provided package. This pointer could be expected to be
    reliable until the next [package forget] removes that Package from our database
    of package information known to the interp.
    
    After the rewrite, the pointer points into the interp's string result, which is only
    reliable until the next Tcl_ResetResult() call on that interp -- a much shorter time frame.
    That's a disturbance in the public interface we should not have accepted. Even worse
    the rewrite makes the Tcl_ResetResult() calls itself, invalidating the pointer before it
    is even returned.
    
    Removing the Tcl_ResetResult() calls is not an effective solution. Test load-10.1 among
    others fails.
    
  2. login: "dgp"
  3. mimetype: "text/plain"