[ET Trac] [Einstein Toolkit] #2152: simfactory's core detection code fails catastrophically for LANG=zh_CN.utf8

Einstein Toolkit trac-noreply at einsteintoolkit.org
Sun May 13 10:12:48 CDT 2018


#2152: simfactory's core detection code fails catastrophically for LANG=zh_CN.utf8
---------------------------------+---------------------------
 Reporter:  Roland Haas          |       Type:  defect
   Status:  new                  |   Priority:  major
Milestone:                       |  Component:  Other
  Version:  development version  |   Keywords:  GetComponents
---------------------------------+---------------------------
 There is a report on the ET mailing list
 (http://lists.einsteintoolkit.org/pipermail/users/2018-May/006250.html)
 about simfactory failing. This can be worked around by setting LANG=C
 LC_ALL=C (or an English locale for that matter).

 Naturally the code in simfactory only works for English locales since it
 parses the field names and looks for only English names of the field so
 eg:
 {{{
 $ LANG=de_DE.utf8 simfactory/bin/sim setup-silent
 Unknown machine name ekohaes8.ncsa.illinois.edu
 Warning: Cannot find Number of Cores per CPU, using default 1
 }}}
 which is expected. However setting LANG to a Chinese locale gives an error
 that aborts the code:
 {{{
 LANG=zh_CN.utf8 simfactory/bin/sim setup-silent
 Unknown machine name ekohaes8.ncsa.illinois.edu


 Here we will define some necessary Simulation Factory defaults.


 Determining local machine name: ekohaes8.ncsa.illinois.edu
 Traceback (most recent call last):
   File "simfactory/bin/../lib/sim.py", line 148, in <module>
     main()
   File "simfactory/bin/../lib/sim.py", line 144, in main
     CommandDispatch()
   File "simfactory/bin/../lib/sim.py", line 106, in CommandDispatch
     module.main()
   File "/data/rhaas/postdoc/gr/cactus/ET_trunk/repos/simfactory2/lib/sim-
 util.py", line 266, in main
     CommandDispatch()
   File "/data/rhaas/postdoc/gr/cactus/ET_trunk/repos/simfactory2/lib/sim-
 util.py", line 51, in CommandDispatch
     exec("command_%s()" % command)
   File "<string>", line 1, in <module>
   File "/data/rhaas/postdoc/gr/cactus/ET_trunk/repos/simfactory2/lib/sim-
 util.py", line 100, in command_setup_silent
     dt.begin()
   File
 "/data/rhaas/postdoc/gr/cactus/ET_trunk/repos/simfactory2/lib/simdt.py",
 line 135, in begin
     self.action(dd)
   File
 "/data/rhaas/postdoc/gr/cactus/ET_trunk/repos/simfactory2/lib/simdt.py",
 line 186, in action
     results = eval("self.macro_%s" % action)
   File "<string>", line 1, in <module>
   File
 "/data/rhaas/postdoc/gr/cactus/ET_trunk/repos/simfactory2/lib/simdt.py",
 line 471, in macro_CREATE_MACHINE
     cpu_info[l[0]] = l[1].strip('.\n ').strip('kB')
 IndexError: list index out of range
 }}}

 which should not happen. No matter the error, simfactory must at worst
 revert to "1 core per cpu" settings since it is the very first thing that
 people execute when using the ET.

 The issue ends up being that the Chinese locale uses a different ":"
 symbol that looks visually similar but (seems to) has the same width as a
 Chinese character and not that of a Latin one:
 {{{
 架构:           x86_64
 }}}
 where the difference is between ":" and ":".

 A simple fix may be to try and call lscpu with the "C" locale which must
 always exist (see https://www.gnu.org/software/libc/manual/html_node
 /Choosing-Locale.html).

 A similar issue may exist in other places where we parse command output.

-- 
Ticket URL: <https://trac.einsteintoolkit.org/ticket/2152>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit


More information about the Trac mailing list