[clang] [llvm] [Clang] Rewrite tests using subshells to set env variables (PR #158446)

Mikael Holmen via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 21 22:12:28 PDT 2025


================
@@ -1,13 +1,14 @@
 // Some assertions in this test use Linux style (/) file paths.
 // UNSUPPORTED: system-windows
+// RUN: bash -c env | grep LD_LIBRARY_PATH | tr -d '\n' > /tmp/ld_library_path
----------------
mikaelholmen wrote:

What if several users run this lit test at the same time on the same machine? If unlucky they will all try to read/write to ```/tmp/ld_library_path``` at the same time? Or what If I've run the lit test at some point and created the file and then another user tries to create it on the same machine and can't overwrite it?

I've already seen
```
02:11:18 bash -c env | grep LD_LIBRARY_PATH | tr -d '\n' > /tmp/ld_library_path # RUN: at line 3
02:11:18 + bash -c env
02:11:18 + tr -d '\n'
02:11:18 /repo/llvm/build/tools/clang/test/Driver/Output/env.c.script: line 1: /tmp/ld_library_path: Permission denied
```
in some downstream buildbots that I imagine is due to these kind of problems.

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


More information about the llvm-commits mailing list