Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1d1303efac13daa57238a5d2e2e60d7dc571844c04d0755bcdc6387fc2669f6f
Ticket: c35e347c6fb8df66917b1ab6974b3638925b4aa2
Concurrent Tcl_Init calls race in Unix locale initialization, causing crashes on OpenBSD
User & Date: gustafn3 on 2026-10-19 08:24:00
Changes

  1. icomment:
    Jan. By looking at the referenced change, I expect it to prevent the crash in the original reproducer: once initial encoding setup succeeds in the main thread, subsequent interpreter initializations no longer enter the locale-detection path. 
    
    However, the change does not synchronize the setlocale() / nl_langinfo() sequence itself. The initialEncodingSet flag is unsynchronized, and direct calls to Tcl_GetEncodingNameFromEnvironment() or Tcl_GetEncodingNameForUser() still reach that sequence.
    
    My original patch protects locale detection inside Tcl_GetEncodingNameFromEnvironment(), including copying the codeset while holding the lock. I therefore think the locking remains useful, even if the newer change removes the repeated-initialization trigger observed in NaviServer and in the rest script
    
    One one to distinguishing whether the original reproducer passes from whether concurrent calls to the locale-detection API are safe.
    
  2. login: "gustafn3"
  3. mimetype: "text/x-markdown"