Skip to content

Always force LC_ALL=C

Chris Burr requested to merge force-locale into master

cc @gcorti @kreps @romanov

It's not clear to me why this showed up now, I can think of a few possible causes but I didn't easily manage to prove any of them.

When running Moore/v14r8p1g1 at some sites we found the application would crash with:

2024-03-23 09:49:12 UTC Hlt1LumiFilterS...   INFO Member list: GaudiSequencer/LumiRecoSeq, GaudiSequencer/LumiCountSeq
2024-03-23 09:49:12 UTC L0MuonFromRaw       FATAL  Standard std::exception is caught
2024-03-23 09:49:12 UTC L0MuonFromRaw       ERROR locale::facet::_S_create_c_locale name not valid

Further debugging revealed the source of the problem is in boost when LANG=en_US.UTF-8 (or any other UTF-8 locale) is used:

2024-03-23 09:40:48 UTC Hlt1LumiFilterS...   INFO Member list: GaudiSequencer/LumiRecoSeq, GaudiSequencer/LumiCountSeq

Breakpoint 1, 0x00007a4891857670 in std::locale::facet::_S_create_c_locale(__locale_struct*&, char const*, __locale_struct*)@plt () from /cvmfs/lhcb.cern.ch/lib/lcg/external/gcc/4.6.2/x86_64-slc5/lib64/libstdc++.so.6
(gdb) x/s
0x21c9d918:"LC_CTYPE=C.UTF-8;LC_NUMERIC=en_US.UTF-8;LC_TIME=en_US.UTF-8;LC_COLLATE=en_US.UTF-8;LC_MONETARY=en_US.UTF-8;LC_MESSAGES=en_US.UTF-8;LC_PAPER=en_US.UTF-8;LC_NAME=en_US.UTF-8;LC_ADDRESS=en_US.UTF-8;LC_TE"...
(gdb) bt
#0  0x00007a4891857670 in std::locale::facet::_S_create_c_locale(__locale_struct*&, char const*, __locale_struct*)@plt () from /cvmfs/lhcb.cern.ch/lib/lcg/external/gcc/4.6.2/x86_64-slc5/lib64/libstdc++.so.6
#1  0x00007a4891869124 in std::locale::_Impl::_Impl(char const*, unsigned long) () from /cvmfs/lhcb.cern.ch/lib/lcg/external/gcc/4.6.2/x86_64-slc5/lib64/libstdc++.so.6
#2  0x00007a489186a21b in std::locale::locale(char const*) () from /cvmfs/lhcb.cern.ch/lib/lcg/external/gcc/4.6.2/x86_64-slc5/lib64/libstdc++.so.6
#3  0x00007a4880015a0b in boost::filesystem3::path::wchar_t_codecvt_facet() () from /cvmfs/lhcb.cern.ch/lib/lcg/external/Boost/1.48.0_python2.6/x86_64-slc5-gcc46-opt/lib/libboost_filesystem-gcc46-mt-1_48.so.1.48.0
#4  0x00007a488001611b in boost::filesystem3::path::begin() const () from /cvmfs/lhcb.cern.ch/lib/lcg/external/Boost/1.48.0_python2.6/x86_64-slc5-gcc46-opt/lib/libboost_filesystem-gcc46-mt-1_48.so.1.48.0
#5  0x00007a485ccc66a2 in L0MuonUtils::SubstituteEnvVarInPath(std::string const&) () from /cvmfs/lhcb.cern.ch/lib/lhcb/LBCOM/LBCOM_v12r4/InstallArea/x86_64-slc5-gcc46-opt/lib/libL0Muon.so
#6  0x00007a485cc8d7d2 in L0MuonCandidatesFromRaw::initialize() () from /cvmfs/lhcb.cern.ch/lib/lhcb/LBCOM/LBCOM_v12r4/InstallArea/x86_64-slc5-gcc46-opt/lib/libL0Muon.so

The simplest solution is to just always set LC_ALL=C as there is no situation in which we want locale-specific behaviour.

Merge request reports