AcademySoftwareFoundation / AcademySoftwareFoundation/rez
rex var expansion is broken in multiple shells
- Dominant language
- Python
- Stars
- 1.1k
- Forks
- 374
- Avg merge
- 9d 12h
- Merged PRs (30d)
- 5
Description
Shells: pwsh, csh (other?)
In shells whose variable expansion syntax does not match native rex (ie, `$FOO`, `${FOO}`), variable expansion is broken. The tests don't catch this because these shells tend to deal with var expansion (via their `convert_tokens` func) in the `info` command - which is also used to get output from a shell to check the results(!).
A quick glance shows that the fix is probably to use convert_tokens in the expand_string function, so that var expansion happens in all relevant places.
A test should also be added that makes sure this expansion happens, _when_ it is supposed to. For example, consider the following bash:
```
export FOO=A
export BAH="hey $FOO"
export FOO=B
```
The rex equivalent in a test would be able to detect that $FOO was expanded when it was supposed to, like so:
```
env.FOO = "A"
env.BAH = "hey $FOO"
env.FOO = "B"
info("$BAH")
```
The test would then verify that the output is "hey A".
Contributor guide
Assessment
This issue has not been assessed yet.