[clang-tools-extra] [clang-tools-extra][test] Ensure file is writeable after copying (PR #157728)
Jordan Rupprecht via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 9 10:57:20 PDT 2025
https://github.com/rupprecht created https://github.com/llvm/llvm-project/pull/157728
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.
>From c810400a7df174536ead23804386e8c7065c4b24 Mon Sep 17 00:00:00 2001
From: Jordan Rupprecht <rupprecht at google.com>
Date: Tue, 9 Sep 2025 10:52:54 -0700
Subject: [PATCH] Make file readable
---
clang-tools-extra/test/clang-apply-replacements/crlf.cpp | 1 +
1 file changed, 1 insertion(+)
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
More information about the cfe-commits
mailing list