[llvm] [lit] Fix to make "RUN: env PATH=..." work as intended (PR #165308)

Alexander Richardson via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 27 13:33:11 PDT 2025


================
@@ -949,7 +945,7 @@ def _executeShCmd(cmd, shenv, results, timeoutHelper):
             path = (
                 cmd_shenv.env["PATH"] if "PATH" in cmd_shenv.env else shenv.env["PATH"]
----------------
arichardson wrote:

I'm not sure using the parent env is correct, if PATH is not set it looks like bash and zsh use a default value.

```
env -i bash -c 'echo $PATH; printenv'
/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:.
PWD=/usr/local/google/home/alexrichardson
SHLVL=0
_=/usr/bin/printenv
```
https://unix.stackexchange.com/a/479083

https://github.com/llvm/llvm-project/pull/165308


More information about the llvm-commits mailing list