Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1aa7e19a58e61a9f7afa47661e788e9b35cc390d9ee8cad32b59820b7ccd5298
Ticket: 87b69745be15c2816574ec415dfe2c3c407cc5d6
interp creation resets encoding directory search path
User & Date: sebres on 2025-08-13 16:11:19
Changes

  1. icomment:
    After a quick review, I don't entirely agree with the changes in <code>Tcl_SetSystemEncoding</code>, because it may have an issue by moving of <code>Tcl_MutexLock(&encodingMutex)</code> to head of function, which now would cause that due to <code>Tcl_GetEncoding()</code> (which also locks mutex) would do that twice (enters the lock recursively).<br/>
    Note that the mutexes are not necessarily reentrant on all systems, so a recursive locking may be an UB (and may cause a deadlock). Also Tcls documentation says that "the result of locking a mutex twice from the same thread is undefined".
    
    Additionally note that this mutex only protect the hash table of encodings and encoding' refCount, it doesn't really protect static systemEncoding (nor the defaultEncoding) directly. Let alone it'd be still affected by [f2ff05fc84] and co.
    
    Commit [bf62ce24c60c7b8a] shall fix it now.
    
  2. login: "sebres"
  3. mimetype: "text/x-fossil-wiki"