nix-create-sandbox-rc generates bad shell code in the presence of exported shell functions
twhitehead opened this issue · 0 comments
twhitehead commented
In the particular setup I'm working on, there is a bash exported function module
which is tripping up the environment setup code
module ()
{
eval `/usr/bin/modulecmd bash $*`
}
declare -fx module
It produces the following environment variable definition under printenv
BASH_FUNC_module()=() { eval `/usr/bin/modulecmd bash $*`
}
Which gets translated into the nix-sandbox-rc-... file command
export BASH_FUNC_module()=\(\)\ \{\ \ eval\ \`/usr/bin/modulecmd\ bash\ \$\*\`'
'\}
Causing the shell to choke with the error message
/tmp/nix-sandbox-rc-26417EZN line 97 syntax error near unexpected token `('
One solution may be to have nix-create-sandbox-rc
just capture and use the output of
declare -x
declare -fx
for the shell script instead of using printenv -0
.
Cheers! -Tyson