[clang-tools-extra] [clang-tools-extra][test] Ensure file is writeable after copying (PR #157728)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 9 10:57:55 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang-tools-extra
Author: Jordan Rupprecht (rupprecht)
<details>
<summary>Changes</summary>
After #<!-- -->157572, the invocation to clang-tidy fails w/ `Could not open <...>/crlf.cpp.tmp.dir/Inputs/crlf/crlf.cpp for writing` if run in an environment where the source tree is mounted read-only. This is because `cat` was creating a new file in a writeable dir, but running `cp` preserves the readonly file permissions from the source tree.
---
Full diff: https://github.com/llvm/llvm-project/pull/157728.diff
1 Files Affected:
- (modified) clang-tools-extra/test/clang-apply-replacements/crlf.cpp (+1)
``````````diff
diff --git a/clang-tools-extra/test/clang-apply-replacements/crlf.cpp b/clang-tools-extra/test/clang-apply-replacements/crlf.cpp
index 266f806e70b95..40c48fd5e79b8 100644
--- a/clang-tools-extra/test/clang-apply-replacements/crlf.cpp
+++ b/clang-tools-extra/test/clang-apply-replacements/crlf.cpp
@@ -1,5 +1,6 @@
// RUN: mkdir -p %t.dir/Inputs/crlf
// RUN: cp %S/Inputs/crlf/crlf.cpp %t.dir/Inputs/crlf/crlf.cpp
+// RUN: chmod u+w %t.dir/Inputs/crlf/crlf.cpp
// RUN: sed "s#\$(path)#%/t.dir/Inputs/crlf#" %S/Inputs/crlf/file1.yaml > %t.dir/Inputs/crlf/file1.yaml
// RUN: clang-apply-replacements %t.dir/Inputs/crlf
// RUN: diff %t.dir/Inputs/crlf/crlf.cpp %S/Inputs/crlf/crlf.cpp.expected
``````````
</details>
https://github.com/llvm/llvm-project/pull/157728
More information about the cfe-commits
mailing list