Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 29663de4c58b0f2c08cf3a7ae814e8b99c03a373cf9c046f480070894be5a005
Ticket: 6fbabfe1661c22e7990bb917e9fa49cc16e016ea
Tkinter: Cannot find a usable init.tcl with recent core-9-0-branch
User & Date: apnadkarni on 2025-10-01 11:18:46
Changes

  1. icomment:
    Thanks for the link to tkinter, I was looking at exactly the wrong one :-)
    
    It appears your tcl is built with zipfs enabled (so init.tcl and friends are placed within the zip
    archive and not in a native disk directory). But because tkinter never calls TclZipfs_AppInit as part 
    of its initialization, the init.tcl within the zipfs archive is never looked at.
    
    Possible solutions are:
    
    - Add the TclZipfs_AppHook to the tkinter code that initializes the Tcl library. See main() in
    tkAppInit.c in the Tk sources for an example.
    
    - Or, as Jan suggests, build Tcl (and Tk) with the --disable-zipfs option to configure so the tcl
    library is placed on disk as in 8.6
    
    A third possibility is below but first I need to clear up a point of confusion I have about MacOS.
    
    I only recently learnt that MacOS builds do not support zipfs archives and yet I see that's how
    your Tcl is built. So do MacOS binaries support zip archives attached to the executable or shared
     library or not? Does it depend on the OS version, architecture, compiler toolchain or
    something else? 
    
    Now, as to why it was working before (i.e. as of commit [201dd6fe]), it's because zipfs
    was searched on every interpreter creation. I changed that in response to multiple tickets,
    related to both performance and defects, to only initialize at program start with the
    premise that if zipfs archives are to be used TclZipfs_AppInit must be called.
    
    So the third possibility is to *partially* revert that requirement. I am loathe to do that
    because it leads to unpredictable and ad-hoc sequences of initialization steps (locating libraries,
    encoding etc.) depending on the order in which Tcl C API is called. Just as Tcl_Init must be
    called (not just Tcl_CreateInterp) to use encodings, auto-loading etc., it seems reasonable that
    TclZipfs_AppHook must be called to use bound zipfs archives.
    
    Something to discuss at the next online meet perhaps.
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"