Overview
| Artifact ID: | f599e9b2c959b504f7fed24361ba8ea0a861e211ca81bb6d943ded33e1b767df |
|---|---|
| Ticket: | c35e347c6fb8df66917b1ab6974b3638925b4aa2
Concurrent Tcl_Init calls race in Unix locale initialization, causing crashes on OpenBSD |
| User & Date: | serhiy.storchaka on 2026-10-20 08:42:50 |
Changes
- icomment:
Since [63941fee4f] it already works mostly that way: the locale is read once, by <tt>TclpSetInitialEncodings()</tt> called from <tt>Tcl_FindExecutable()</tt> after <tt>Tcl_InitSubsystems()</tt>, and its call in <tt>Tcl_Init()</tt> returns at once as soon as the initial encoding is set. So the lock in [/timeline?r=unix-locale-init-lock|unix-locale-init-lock] is not taken when an interp is created, except while the initial encoding could not be set yet. It is needed for the public <tt>Tcl_GetEncodingNameFromEnvironment()</tt> and <tt>Tcl_GetEncodingNameForUser()</tt>, which call <tt>setlocale()</tt> every time, also from <nowiki>[encoding user]</nowiki>; that is what the attached reproducer crashes. Their result could be cached too, but then a later <tt>setlocale()</tt> by the application would not be seen.
- login: "serhiy.storchaka"
- mimetype: "text/x-fossil-wiki"