Describe the bug
$ ./src/nix/nix --extra-experimental-features nix-command develop -f ~/nm gcc -L
gcc-wrapper> /nix/store/c6m8m8qjr3dxsli8iymc6js3jsyzg5cy-get-env.sh: line 70: expand-response-params: bad substitution
This should not fail.
Additional context
Looks like bash-5 no longer allows indirect variable dereference with invalid variable names. Simple reproducer:
$ LANG=C env 'my-hyphenated-variable=hello' bash
$ name='my-hyphenated-variable'
$ echo ${!name}
bash: my-hyphenated-variable: invalid variable name
Looks like it used to work in bash-4. This pattern is used in src/nix/get-env.sh:
__vars="$(declare -p)"
...
__dumpEnv() {
...
while read __line; do
if ! [[ $__line =~ ^declare\ (-[^ ])\ ([^=]*) ]]; then continue; fi
local type="${BASH_REMATCH[1]}"
local __var_name="${BASH_REMATCH[2]}"
...
if [[ $type == -x ]]; then
printf '"type": "exported", "value": '
__escapeString "${!__var_name}"
...
}
Describe the bug
This should not fail.
Additional context
Looks like
bash-5no longer allows indirect variable dereference with invalid variable names. Simple reproducer:Looks like it used to work in
bash-4. This pattern is used insrc/nix/get-env.sh: