File tree Expand file tree Collapse file tree
testsuite/modules.00-init Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -572,7 +572,7 @@ proc __initStateUsergroups {} {
572572 set user_group_list {}
573573 # parse regular "id" output to get all group, also those whose name cannot
574574 # be resolved or contain a space character
575- set id_out [runCommand id]
575+ set id_out [runEnvCommand {LANG C} id]
576576 set id_out_grp_start [expr {[string first {groups=} $id_out ] + 7}]
577577 set id_out_next_start [string first = $id_out $id_out_grp_start ]
578578 # #nagelfar ignore #2 Badly formed if statement
Original file line number Diff line number Diff line change @@ -57,6 +57,28 @@ proc listTo {lang lst {esc 1}} {
5757 return [join $lout { }]
5858}
5959
60+ proc runEnvCommand {env_list cmd args} {
61+ # set specific env
62+ set saved_env_list {}
63+ foreach {var val} $env_list {
64+ lappend saved_env_list $var [get-env $var <unset>]
65+ set ::env($var ) $val
66+ }
67+
68+ set res [runCommand $cmd {*}$args ]
69+
70+ # restore env
71+ foreach {var val} $saved_env_list {
72+ if {$val eq {<unset>}} {
73+ unset ::env($var )
74+ } else {
75+ set ::env($var ) $val
76+ }
77+ }
78+
79+ return $res
80+ }
81+
6082# find command path and remember it
6183proc getCommandPath {cmd} {
6284 return [lindex [auto_execok $cmd ] 0]
Original file line number Diff line number Diff line change @@ -249,8 +249,17 @@ send_user "\tX11 setup is [expr {$is_xrdb_avail ? {KO} : {OK}}]\n"
249249# check if domainname binary is available on this system
250250set domainname [auto_execok domainname]
251251
252- # display result of id command
252+ # ensure id command is run with POSIX locale to correctly parse it
253+ if {[info exists ::env(LANG)]} {
254+ set ORIG_LANG $::env(LANG)
255+ }
256+ set ::env(LANG) C
253257set idoutput [exec id]
258+ if {[info exists ORIG_LANG]} {
259+ set ::env(LANG) $ORIG_LANG
260+ } else {
261+ unset ::env(LANG)
262+ }
254263send_user "\tid output is '$idoutput'\n"
255264
256265# get current working directory
You can’t perform that action at this time.
0 commit comments