Tcl Source Code

View Ticket
Login
Ticket UUID: bf2652aedf42e59076d8f29da8d87b48d83948bb
Title: Tcl 9.1b1 with zipfs support: incorrect value for tcl_library variable
Type: Bug Created on: 2026-09-29 14:21:26
Submitter: anonymous Assigned to: jan.nijtmans
Subsystem: 07. Variables Severity: Minor
Priority: 5 Medium Last modified: 2026-10-02 15:40:03
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: Tcl 9.1b1
Description:
Today, I compiled the Unix version of Tcl/Tk 9.1b1 with zipfs support (the default). When I tried an old script, it failed on this line:

source [info library]/init.tcl

After some digging, I found that 'info library' was returning an incorrect value. Compare Tcl 9.0 to Tcl 9.1b1, both compiled with zipfs support on the same machine.

% ~/tcltk9.1/bin/wish9.1 
% echo [info library]
/Users/rmtrines/tcltk9.1/lib/tcl9
%
% ~/tcltk9/bin/wish9.0 
% echo [info library]
//zipfs:/lib/tcl/tcl_library
%

The problem with that: when Tcl 9.1 is compiled and installed with zipfs support, the directory tcltk9.1/lib/tcl9 does not contain the file init.tcl, needed by my script.

When I run this sequence of commands in wish9.1:
% set tcl_library //zipfs:/lib/tcl/tcl_library
//zipfs:/lib/tcl/tcl_library
% info library
//zipfs:/lib/tcl/tcl_library
% source [info library]/init.tcl
% 

Hey, it works fine, no errors. So it's purely the value of tcl_library that is causing the problem.
User Comments:
jan.nijtmans added on 2026-09-29 21:57:18:

I cannot reproduce this with Tcl/Tk 9.1.0 final:

$ wish9.1
% info library 
//zipfs:/lib/tcl/tcl_library
% set tcl_library
//zipfs:/lib/tcl/tcl_library
% set tk_library
//zipfs:/lib/tk/tk_library


anonymous added on 2026-10-02 14:10:19:
Let me add more info.

Here is a little C program that creates a Tcl interpreter and tries to run a little script.

#include <stdio.h>
#include <tcl.h>

int main() {

  char TclCommand[2048];
  int retval;

  printf("C start\n");
  Tcl_Interp *interp = Tcl_CreateInterp();
  Tcl_Init(interp);
  sprintf(TclCommand,"source setupscript.tcl\n");
  retval = Tcl_Eval(interp,TclCommand);
  if (retval !=TCL_OK) {
    printf("Error %d: %s\n", retval, 
	   Tcl_GetStringResult(interp));
  }
  Tcl_DeleteInterp(interp);
  printf("C end\n");
  return 0;
}

Here is the little script needed by the program:

puts "Tcl start"
puts -nonewline "Tcl version: "
puts [info tclversion]
puts [info library]
puts "Tcl end"

Here is how I compiled it:

#!/bin/sh

export TCLDIR=${HOME}/tcltk9.1

gcc-16 -o tcl_init_test -I${TCLDIR}/include tcl_init_test.c -L${TCLDIR}/lib -ltcl9.1

This is the output I get for Tcl 9.1:

% ./tcl_init_test
C start
Tcl start
Tcl version: 
9.1
Error 1: no library has been specified for Tcl
C end

To compare: this is the output I get for Tcl 9.0, in the same environment:

% ./tcl_init_test
C start
Tcl start
Tcl version: 9.0
//zipfs:/lib/tcl/tcl_library
Tcl end
C end

Note that both Tcl versions have been configured in the same way:

#!/bin/sh

export CC=gcc-16

./configure --prefix=${HOME}/tcltk9.1

Hope this helps.

jan.nijtmans added on 2026-10-02 14:29:21:

The release notes for Tcl 9.1 mention:

So, can you add a call to TclZipfs_AppHook(&argc, &argv); before doing the Tcl_CreateInterp() call? This will mount the zipfile packed with the Tcl shared library. That should help to find the init.tcl file.


anonymous added on 2026-10-02 15:40:03:
OH yes, that does indeed work, both for the little test problem and the actual code I was trying to build/fix.

Thanks.