Tcl Source Code

View Ticket
Login
Ticket UUID: dad36af8e573011e034bff3bfa051292b6e0159d
Title: TCL_PACKAGE_PATH seems broken
Type: Bug Version: 8.6.15
Submitter: RogerO Created on: 2024-09-19 08:52:23
Subsystem: 55. Other Tools Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Important
Status: Closed Last Modified: 2024-09-19 09:57:19
Resolution: Works For Me Closed By: jan.nijtmans
    Closed on: 2024-09-19 09:57:19
Description:
I am trying to use Tcl 8.6.15 on a Linux (openSUSE Tumbleweed) system. Not a newbie here. In the build of the latest 8.6.15, I have a problem with TCL_PACKAGE_PATH. When building, we define it via an environment variable:

export TCL_PACKAGE_PATH="%scriptdir %_datadir/tcl"

The build sets it as follows in tclConfig.sh:

TCL_PACKAGE_PATH='/usr/lib64/tcl /usr/share/tcl'

So I'm happy with the paths. These are the two directories in which to find packages. It gets set this way in 8.6.15 (where there is an issue), and in 8.6.12 (where there is no issue).

When I package require a package in, say /usr/share/tcl, it says the package cannot be found.

I did a trace on the running program, and I see what I think are mysterious paths being explored. In #1 and #2 (below) there is a space after the path name. In #3 the full TCL_PACKAGE_PATH is being used. Close, but no cigar.

read(0, "package require rsoft\n", 4096) = 22
readlink("/usr", 0x7ffd5d2af6c0, 1023)  = -1 EINVAL (Invalid argument)
readlink("/usr/lib64", 0x7ffd5d2af6c0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/lib64/tcl ", 0x7ffd5d2af6c0, 1023) = -1 ENOENT (No such file or directory)    <--- Mysterious #1
access("/usr", F_OK)                    = 0
access("/usr/lib64", F_OK)              = 0
access("/usr/lib64/tcl ", F_OK)         = -1 ENOENT (No such file or directory)              <--- Mysterious #2
readlink("/usr", 0x7ffd5d2af6c0, 1023)  = -1 EINVAL (Invalid argument)
readlink("/usr/lib64", 0x7ffd5d2af6c0, 1023) = -1 EINVAL (Invalid argument) 
openat(AT_FDCWD, "/usr/lib64/tcl /usr/share/tcl/tclIndex", O_RDONLY) = -1 ENOENT (No such file or directory)  <--- Mysterious #3
readlink("/usr", 0x7ffd5d2af6c0, 1023)  = -1 EINVAL (Invalid argument)
readlink("/usr/lib", 0x7ffd5d2af6c0, 1023) = -1 EINVAL (Invalid argument)
openat(AT_FDCWD, "/usr/lib/tclIndex", O_RDONLY) = -1 ENOENT (No such file or directory)
readlink("/usr", 0x7ffd5d2af6c0, 1023)  = -1 EINVAL (Invalid argument)
readlink("/usr/lib64", 0x7ffd5d2af6c0, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/lib64/tcl", 0x7ffd5d2af6c0, 1023) = -1 EINVAL (Invalid argument)
openat(AT_FDCWD, "/usr/lib64/tcl/tclIndex", O_RDONLY) = -1 ENOENT (No such file or directory)
readlink("/usr", 0x7ffd5d2af720, 1023)  = -1 EINVAL (Invalid argument)
readlink("/usr/lib64", 0x7ffd5d2af720, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/lib64/tcl", 0x7ffd5d2af720, 1023) = -1 EINVAL (Invalid argument)
readlink("/usr/lib64/tcl/tcl8.6", 0x7ffd5d2af720, 1023) = -1 EINVAL (Invalid argument)
openat(AT_FDCWD, "/usr/lib64/tcl/tcl8.6/tclIndex", O_RDONLY) = 3

And there is this:

% puts $::auto_path
/usr/lib64/tcl/tcl8.6 /usr/lib64/tcl /usr/lib {/usr/lib64/tcl /usr/share/tcl}

With 8.6.12, for example, it is this:

% puts $::auto_path    
/usr/lib64/tcl/tcl8.6 /usr/lib64/tcl /usr/lib /usr/share/tcl


Are we specifying the paths incorrectly? This is how it has been done in previous releases. And it worked then. But not in 8.6.15.
User Comments: jan.nijtmans added on 2024-09-19 09:57:19:

Please have a look at [this] ticket.

It's a change done intentionally. If TCL_PACKAGE_PATH contains multiple directories, they should be separated now with ':'.

Yes, we are aware that this is a change in behavior. But is solves the problem arising if %scriptdir or %datadir contain spaces, which is common on Windows.