mirror of
https://github.com/envmodules/modules.git
synced 2026-05-30 00:12:31 +08:00
Run "id" command to fetch groups with POSIX locale
Some checks failed
easybuild-tests / framework (Tcl) (push) Has been cancelled
lint-tests / lint-all (push) Has been cancelled
linux-tests / tcl86-nolibtclenvmodules (push) Has been cancelled
linux-tests / tcl85-nolibtclenvmodules (push) Has been cancelled
linux-tests / tcl85-2 (push) Has been cancelled
linux-tests / tcl86 (push) Has been cancelled
linux-tests / tcl85 (push) Has been cancelled
linux-tests / tcl87 (push) Has been cancelled
linux-tests / tcl90 (push) Has been cancelled
windows-tests / native-cmd (push) Has been cancelled
windows-tests / native-pwsh (push) Has been cancelled
windows-tests / cygwin (push) Has been cancelled
windows-tests / msys (push) Has been cancelled
Some checks failed
easybuild-tests / framework (Tcl) (push) Has been cancelled
lint-tests / lint-all (push) Has been cancelled
linux-tests / tcl86-nolibtclenvmodules (push) Has been cancelled
linux-tests / tcl85-nolibtclenvmodules (push) Has been cancelled
linux-tests / tcl85-2 (push) Has been cancelled
linux-tests / tcl86 (push) Has been cancelled
linux-tests / tcl85 (push) Has been cancelled
linux-tests / tcl87 (push) Has been cancelled
linux-tests / tcl90 (push) Has been cancelled
windows-tests / native-cmd (push) Has been cancelled
windows-tests / native-pwsh (push) Has been cancelled
windows-tests / cygwin (push) Has been cancelled
windows-tests / msys (push) Has been cancelled
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
This commit is contained in:
@@ -572,7 +572,7 @@ proc __initStateUsergroups {} {
|
||||
set user_group_list {}
|
||||
# parse regular "id" output to get all group, also those whose name cannot
|
||||
# be resolved or contain a space character
|
||||
set id_out [runCommand id]
|
||||
set id_out [runEnvCommand {LANG C} id]
|
||||
set id_out_grp_start [expr {[string first {groups=} $id_out] + 7}]
|
||||
set id_out_next_start [string first = $id_out $id_out_grp_start]
|
||||
##nagelfar ignore #2 Badly formed if statement
|
||||
|
||||
22
tcl/util.tcl
22
tcl/util.tcl
@@ -57,6 +57,28 @@ proc listTo {lang lst {esc 1}} {
|
||||
return [join $lout { }]
|
||||
}
|
||||
|
||||
proc runEnvCommand {env_list cmd args} {
|
||||
# set specific env
|
||||
set saved_env_list {}
|
||||
foreach {var val} $env_list {
|
||||
lappend saved_env_list $var [get-env $var <unset>]
|
||||
set ::env($var) $val
|
||||
}
|
||||
|
||||
set res [runCommand $cmd {*}$args]
|
||||
|
||||
# restore env
|
||||
foreach {var val} $saved_env_list {
|
||||
if {$val eq {<unset>}} {
|
||||
unset ::env($var)
|
||||
} else {
|
||||
set ::env($var) $val
|
||||
}
|
||||
}
|
||||
|
||||
return $res
|
||||
}
|
||||
|
||||
# find command path and remember it
|
||||
proc getCommandPath {cmd} {
|
||||
return [lindex [auto_execok $cmd] 0]
|
||||
|
||||
@@ -249,8 +249,17 @@ send_user "\tX11 setup is [expr {$is_xrdb_avail ? {KO} : {OK}}]\n"
|
||||
# check if domainname binary is available on this system
|
||||
set domainname [auto_execok domainname]
|
||||
|
||||
# display result of id command
|
||||
# ensure id command is run with POSIX locale to correctly parse it
|
||||
if {[info exists ::env(LANG)]} {
|
||||
set ORIG_LANG $::env(LANG)
|
||||
}
|
||||
set ::env(LANG) C
|
||||
set idoutput [exec id]
|
||||
if {[info exists ORIG_LANG]} {
|
||||
set ::env(LANG) $ORIG_LANG
|
||||
} else {
|
||||
unset ::env(LANG)
|
||||
}
|
||||
send_user "\tid output is '$idoutput'\n"
|
||||
|
||||
# get current working directory
|
||||
|
||||
Reference in New Issue
Block a user