Solène Rapenne <sol...@perso.pw> writes: > Hello, > > It seems that the game games/openxcom doesn't want to start if > the environment variable LC_ALL is not equal to "C". > > solene@ll:% openxcom > terminate called after throwing an instance of 'std::runtime_error' > what(): locale::facet::_S_create_c_locale name not valid > abort (core dumped) openxcom > > Using LC_ALL=C openxcom allow the game to start
This raises interesting questions. The root of the problem lies in src/gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.cc We're using generic code, as described in https://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html I can understand that it may be better to throw an exception, rather than showing inconsistent behaviour. On the other hand, we don't have newlocale/LC_NUMERIC/whatever support in libc, and I don't see that change in the near future. So I wonder what good this exception is doing. Given the amount of std::locale uses in code out there, I find it surprising that so far only boost and openxcom seem to trigger it... Index: c_locale.cc =================================================================== RCS file: /d/cvs/src/gnu/gcc/libstdc++-v3/config/locale/generic/c_locale.cc,v retrieving revision 1.1.1.1 diff -u -p -p -u -r1.1.1.1 c_locale.cc --- c_locale.cc 15 Oct 2009 17:11:33 -0000 1.1.1.1 +++ c_locale.cc 12 Dec 2016 12:05:48 -0000 @@ -137,9 +137,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std) // Currently, the generic model only supports the "C" locale. // See http://gcc.gnu.org/ml/libstdc++/2003-02/msg00345.html __cloc = NULL; - if (strcmp(__s, "C")) - __throw_runtime_error(__N("locale::facet::_S_create_c_locale " - "name not valid")); } void -- jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF DDCC 0DFA 74AE 1524 E7EE