model-writtenrun 9759 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Tom Lane opened the thread with OpenBSD crashes traced to ecpg's setlocale() calls, explaining that both the function's thread safety and its process-wide effects made the existing numeric-locale handling unsafe #1.
- Michael Meskes supplied a patch using newlocale()/uselocale() to confine locale changes to the calling thread #2, after which discussion considered disabling thread safety, requiring the C locale, and replacing locale-sensitive number conversion; Tom regarded replacement conversion routines as a large and potentially nonportable undertaking #3 #4 #5 #6 #7.
- Tom ultimately favored preserving existing behavior on platforms lacking uselocale() #9, then revised Michael's patch with configure detection and macOS header support and confirmed that it fixed the OpenBSD failures #10.
- Takayuki Tsunakawa proposed _configthreadlocale() for Windows and checked its availability with Visual Studio 2008 #11 #13; Tom added it in #14, and Takayuki reviewed the Unix and Windows paths without building them #15.
- Tom committed #14 as 8eb4a9312c, additionally converting another setlocale() site in descriptor.c and initially limiting the landing to the development branch while awaiting buildfarm results #16.
- Andres Freund reported a MinGW build failure #18, and discussion established that _configthreadlocale() availability varied between toolchains #20 #21; Tom chose configure detection instead of disabling thread safety #22 #23, producing ee27584c4a.
- Takayuki subsequently found that the Windows path failed to restore thread-locale state when initialization failed #25, while Andrew Dunstan initially confirmed that a newer MinGW toolchain detected the function and built successfully #26.
- Broader testing by Andrew showed that newer MinGW versions still failed at runtime, hanging the regression suite and filling the disk; locally reverting the two locale commits removed the hangs #28, and further investigation pointed to a dummy _configthreadlocale() implementation that always returned -1 #30 #31.
- Tom kept the locale changes and committed a fallback for the dummy MinGW function, also correcting restoration after partial initialization, in 2cf91ccb73; he announced the fix in #32, and Andrew later confirmed that the upgraded jacana buildfarm member was happy #34.
- The hang exposed test loops that could run indefinitely after repeated statement failures #32, leading Tom to commit 100-iteration safeguards across the ecpg tests in d5a1fde397, with backports to supported branches.
- Tom also identified obsolete _configthreadlocale() calls in the threaded test programs #33 and removed them on the development branch in e3565fd61c, so the tests would exercise the library's own protection.
- After the fixes landed, Michael suggested using WHENEVER commands more consistently in the tests #35; Tom retained hard iteration limits while welcoming that cleanup #36, and the thread ended with Michael agreeing to make only small test cleanups, with no further patch attached #37.