Skip to content

Conversation

@rupprecht
Copy link
Collaborator

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.

@llvmbot
Copy link
Member

llvmbot commented Sep 9, 2025

@llvm/pr-subscribers-clang-tools-extra

Author: Jordan Rupprecht (rupprecht)

Changes

After #157572, the invocation to clang-tidy fails w/ Could not open &lt;...&gt;/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 --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

@rupprecht rupprecht merged commit 5c17af4 into llvm:main Sep 9, 2025
11 checks passed
@rupprecht rupprecht deleted the cte-chmod-src branch September 9, 2025 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants