|
From: <apn...@ya...> - 2025-11-02 07:35:36
|
<https://core.tcl-lang.org/tips/doc/trunk/tip/732.md> TIP 732: Changes to the Tcl script library search path is ready for comments. TL;DR formalizes the mechanisms by which that Tcl runs/locates its support scripts (init.tcl) and encodings. Currently this is partly undocumented and also has some inconsistencies between documentation and behaviour. Further, the TIP removes some search locations. See TIP for motivation and details. The accompanying implementation also moves some of the Tcl initialization scripts into C for a significant (25%) reduction in interp creation time. I'm particularly interested in feedback from Unix and macOS folks that build distributions if this impacts them in any way. /Ashok |
|
From: Jan N. <jan...@gm...> - 2025-11-03 10:29:42
|
Op zo 2 nov 2025 om 08:35 schreef apnmbx-public:
>
> TIP 732: Changes to the Tcl script library search path is ready for comments.
....
> I’m particularly interested in feedback from Unix and macOS folks that build distributions if this impacts them in any way.
Well, I like this TIP, but there is a test failure on MacOS:
<https://github.com/tcltk/tcl/actions/runs/18965835171/job/54162420957>
==== unixInit-3.2 TclpSetInitialEncodings FAILED
==== Contents of test case:
set env(LANG) japanese
set env(LC_ALL) japanese
set f [open "|[list [interpreter]]" w+]
chan configure $f -buffering none
puts $f {puts [encoding system]; exit}
set enc [gets $f]
close $f
set enc
---- Test generated error; Return code was: 1
---- Return code should have been one of: 0 2
---- errorInfo: application-specific initialization failed: Cannot
find a usable init.tcl in the following directories:
/Users/runner/work/tcl/tcl/lib/tcl9.1
This probably means that Tcl wasn't installed properly.
while executing
"close $f"
("uplevel" body line 8)
invoked from within
"uplevel 1 $script"
---- errorCode: NONE
==== unixInit-3.2 FAILED
Hope this helps,
Jan Nijtmans
|
|
From: <apn...@ya...> - 2025-11-05 09:05:53
|
Now having looked at the unixInit-3.2 test, reason for failure is obvious. As the constraints on the test show, the test expects init.tcl in either ../../library or ../../../library and since TIP 732 explicitly disallows those for reasons detailed in the TIP, the test fails. Note the test would also fail in 9.0 were it not for the constraints which disable it if the build directory is not one or two levels under the source root.
The test itself is flawed / limited. It spawns a new process after unsetting the TCL_LIBRARY env variable. The purpose is ostensibly to ensure Tcl correctly finds the tcl_library location (and encodings) even without TCL_LIBRARY being set. However, while what it *should* be testing is whether tcl does this correctly as per the build configure setting, what it actually does is test if it does this correctly when built from within the source tree. Which is somewhat pointless in my opinion. (No platform has ../../library as its default configure setting). The constraints on the test to prevent failures under xcode builds, builds outside the source tree itself etc. are an indication of its limited utility.
(Aside - this mostly pertains to non-zipfs builds. zipfs builds pick up from the zipfs archive anyways.)
I therefore don't plan on making any 732 changes other than modifying the constraints to only run the test on zipfs builds (this is already partially present).
-----Original Message-----
From: Jan Nijtmans <jan...@gm...>
Well, I like this TIP, but there is a test failure on MacOS:
<https://github.com/tcltk/tcl/actions/runs/18965835171/job/54162420957>
==== unixInit-3.2 TclpSetInitialEncodings FAILED
|
|
From: Marc C. <cul...@gm...> - 2025-11-03 12:59:38
|
It is not clear to me from the TIP what the default search path would be
for macOS. However, macOS is not a single platform in this context. It
can be built two ways:
(1) a framework build, which installs in /Library/Frameworks/Tcl.framework
(and an analogous Library/Frameworks/Tk.framework.
(2) a "prefix" build, which installs in <prefix>/{bin,lib.include,share}
In the past the default search path accommodated both build types.
For a framework build of Tcl X.Y, init.tcl was installed in:
/Library/Frameworks/Tcl.framework/Versions/X.Y/Resources/Scripts/
and that was also a place where third party packages could be installed.
(By the way this is a good way to handle different versions of Tcl and Tk.)
For a prefix build I believe that the install policy was the same as for
other unix systems.
However, other directories were included in the search path on macOS.
These included /Library/Tcl and / or /Library/Tcl/X.Y. In addition there
was a notion that a user might install a Tcl.framework in their personal
Library directory. So another location was
$HOME/Library/Frameworks/Tcl.framework/Versions/X.Y/Resources/Scripts.
Incidentally Apple's (flexible) rules for how files should be arranged in a
framework specify that executable scripts should go in the Resources
directory. However this conflicts with the fact that while some extension
packages contain only scripts, others contain dynamic libraries. However,
there seems to be no problem with installing a package that has a dynamic
library into
/Library/Frameworks/Tcl.framework/Versions/X.Y/Resources/Scriopts.
- Marc
On Mon, Nov 3, 2025 at 4:29 AM Jan Nijtmans <jan...@gm...> wrote:
> Op zo 2 nov 2025 om 08:35 schreef apnmbx-public:
> >
> > TIP 732: Changes to the Tcl script library search path is ready for
> comments.
> ....
> > I’m particularly interested in feedback from Unix and macOS folks that
> build distributions if this impacts them in any way.
>
> Well, I like this TIP, but there is a test failure on MacOS:
> <https://github.com/tcltk/tcl/actions/runs/18965835171/job/54162420957
> >
>
> ==== unixInit-3.2 TclpSetInitialEncodings FAILED
> ==== Contents of test case:
> set env(LANG) japanese
> set env(LC_ALL) japanese
> set f [open "|[list [interpreter]]" w+]
> chan configure $f -buffering none
> puts $f {puts [encoding system]; exit}
> set enc [gets $f]
> close $f
> set enc
> ---- Test generated error; Return code was: 1
> ---- Return code should have been one of: 0 2
> ---- errorInfo: application-specific initialization failed: Cannot
> find a usable init.tcl in the following directories:
> /Users/runner/work/tcl/tcl/lib/tcl9.1
> This probably means that Tcl wasn't installed properly.
> while executing
> "close $f"
> ("uplevel" body line 8)
> invoked from within
> "uplevel 1 $script"
> ---- errorCode: NONE
> ==== unixInit-3.2 FAILED
>
> Hope this helps,
> Jan Nijtmans
>
>
> _______________________________________________
> Tcl-Core mailing list
> Tcl...@li...
> https://lists.sourceforge.net/lists/listinfo/tcl-core
>
|
|
From: <apn...@ya...> - 2025-11-03 16:57:03
|
Marc, >From my reading of the code, the default search path on macOS is set through the $tclDefaultLibrary variable in TclpSetVariables <https://core.tcl-lang.org/tcl/file?ci=4ed06667a6d2d9fb&name=unix%2FtclUnixInit.c&ln=790> . This is *purportedly* unchanged in TIP 732 which includes it as step (2d). Of course, like politicians, TIP’s may say one thing and do another so I need to check that. Another possibility is the test run itself installs the library in locations that are not in the new search path (in particular, ancestor directories or directories without version components). In which case the test run needs to be fixed. Nought to do but iterate through github action runs and examine logs. Oh joy Thanks for the notes on build possibilities for my own edification. BTW, when you say “in the past”, I presume you mean 9.0 (as in pre-TIP732) ? From: Marc Culler <cul...@gm...> Sent: Monday, November 3, 2025 6:29 PM To: Jan Nijtmans <jan...@gm...> Cc: tcl...@li... Subject: Re: [TCLCORE] TIP 732 ready for comments It is not clear to me from the TIP what the default search path would be for macOS. However, macOS is not a single platform in this context. It can be built two ways: (1) a framework build, which installs in /Library/Frameworks/Tcl.framework (and an analogous Library/Frameworks/Tk.framework. (2) a "prefix" build, which installs in <prefix>/{bin,lib.include,share} In the past the default search path accommodated both build types. For a framework build of Tcl X.Y, init.tcl was installed in: /Library/Frameworks/Tcl.framework/Versions/X.Y/Resources/Scripts/ and that was also a place where third party packages could be installed. (By the way this is a good way to handle different versions of Tcl and Tk.) For a prefix build I believe that the install policy was the same as for other unix systems. However, other directories were included in the search path on macOS. These included /Library/Tcl and / or /Library/Tcl/X.Y. In addition there was a notion that a user might install a Tcl.framework in their personal Library directory. So another location was $HOME/Library/Frameworks/Tcl.framework/Versions/X.Y/Resources/Scripts. Incidentally Apple's (flexible) rules for how files should be arranged in a framework specify that executable scripts should go in the Resources directory. However this conflicts with the fact that while some extension packages contain only scripts, others contain dynamic libraries. However, there seems to be no problem with installing a package that has a dynamic library into /Library/Frameworks/Tcl.framework/Versions/X.Y/Resources/Scriopts. - Marc On Mon, Nov 3, 2025 at 4:29 AM Jan Nijtmans <jan...@gm... <mailto:jan...@gm...> > wrote: Op zo 2 nov 2025 om 08:35 schreef apnmbx-public: > > TIP 732: Changes to the Tcl script library search path is ready for comments. .... > I’m particularly interested in feedback from Unix and macOS folks that build distributions if this impacts them in any way. Well, I like this TIP, but there is a test failure on MacOS: <https://github.com/tcltk/tcl/actions/runs/18965835171/job/54162420957> ==== unixInit-3.2 TclpSetInitialEncodings FAILED ==== Contents of test case: set env(LANG) japanese set env(LC_ALL) japanese set f [open "|[list [interpreter]]" w+] chan configure $f -buffering none puts $f {puts [encoding system]; exit} set enc [gets $f] close $f set enc ---- Test generated error; Return code was: 1 ---- Return code should have been one of: 0 2 ---- errorInfo: application-specific initialization failed: Cannot find a usable init.tcl in the following directories: /Users/runner/work/tcl/tcl/lib/tcl9.1 This probably means that Tcl wasn't installed properly. while executing "close $f" ("uplevel" body line 8) invoked from within "uplevel 1 $script" ---- errorCode: NONE ==== unixInit-3.2 FAILED Hope this helps, Jan Nijtmans _______________________________________________ Tcl-Core mailing list Tcl...@li... <mailto:Tcl...@li...> https://lists.sourceforge.net/lists/listinfo/tcl-core |