Tcl Source Code

View Ticket
Login
Ticket UUID: 1091431
Title: Tcl_InitStubs failure crashes wish
Type: Bug Version: None
Submitter: jenglish Created on: 2004-12-26 20:12:58
Subsystem: 40. Dynamic Loading Assigned To: jenglish
Priority: 8 Severity:
Status: Closed Last Modified: 2005-11-21 01:37:40
Resolution: Fixed Closed By: jenglish
    Closed on: 2005-11-20 18:37:37
Description:
On Linux and possibly other ELF-based systems,  the
global variable "tclStubsPtr" defined in tclStubLib.c
may be shared by all extensions.  That is, even though
each shared library includes its own copy of the
variable, the runtime loader will merge all copies into
a single location.

This causes serious problems if Tcl_InitStubs() ever
fails.  For example, if an extension that calls
Tcl_InitStubs(..., "8.5", ...) is loaded into an 8.4
wish, then Tcl_InitStubs() sets tclStubsPtr to NULL,
causing wish to immediately crash (if, as is the usual
case, Tk was compiled with -DUSE_TCL_STUBS).
User Comments: jenglish added on 2005-11-21 01:37:40:

File Added - 156958: tcl-stublib.patch

jenglish added on 2005-11-21 01:37:35:
Logged In: YES 
user_id=68433

Committing refreshed patch to CVS HEAD and backported to
core-8-4 branch, so at least this will be fixed with 8.4.12.

Also removed some TCL_STORAGE_CLASS monkey business that had
no effect.

dgp added on 2004-12-29 09:21:15:
Logged In: YES 
user_id=80530


Is Feature Request 540378 relevant here?

jenglish added on 2004-12-27 03:37:11:

File Added - 113585: tcl-stublib.patch

jenglish added on 2004-12-27 03:37:09:
Logged In: YES 
user_id=68433

Attached patch to generic/tclStubLib.c attempts to fix the
problem.  Unfortunately it can't really work without
retroactively patching all the existing copies of wish8.4;
when an extension that calls Tcl_InitStubs() is loaded into
wish8.4, the runtime loader will use the copy of
Tcl_InitStubs from libtk8.4.so, not the one from the
extensions' library.

Attachments: