
#10046: Linker script patch in rts/Linker.c doesn't work for (non-C or non-en..) locales -------------------------------------+------------------------------------- Reporter: hgolden | Owner: simonmar Type: bug | Status: new Priority: normal | Milestone: 7.12.1 Component: Runtime System | Version: 7.8.4 Resolution: | Keywords: linker Operating System: Unknown/Multiple | script Type of failure: Incorrect result | Architecture: at runtime | Unknown/Multiple Blocked By: | Test Case: Related Tickets: 2615, 9237 | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- Comment (by rwbarton):
The only concern I have is in the case of multithreaded code that _might_ be affected if it is running while the locale is changed. I don't know enough to know if this is a real issue or not, nor do I know how to deal with it if necessary.
Yes, this is an issue with `setlocale`. POSIX has `uselocale` and related functions which allow setting the locale on a per-thread basis, though. `dlopen` can execute code from the shared library it loads (constructor functions), so as you say we should only modify the locale around the call to `dlerror`, which should be safe. Really the most correct thing to do would be to return both the localized error message and the `LC_MESSAGES=C` error message from `internal_dlopen`, and use the latter message to detect linker scripts, and present the former message to the user if we ultimately can't load the shared library. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/10046#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler