[llvm] [lit] Ignore src permissions when copying lit_test_times (PR #121377)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 00:57:28 PST 2025


jh7370 wrote:

> > but I'm now confused by why [1dbcb79](https://github.com/llvm/llvm-project/commit/1dbcb79498d0db465234c68adf52b88e7f87a832) isn't sufficient?
> 
> This is not about bazel. If `%{inputs}/reorder/lit_test_times` is 0444 for any reason, then we need this fix.

Yes, I see your point. Missed that generality.
> 
> _It just so happens_ that in my peculiar bazel build environment, input files are presented as 0444. This is not the usual/default bazel setup, and it's unlikely that other bazel users will experience this same issue. But again: this is not about bazel. I can contrive other non-bazel scenarios where input source is read-only, if that will help.

I don't think this issue is even specifically about `%{inputs}/reorder/lit_test_times`, since there could be other cases of in-place modification after a copy that would be desirable. A slightly contrived example might be having a canned binary used as a test input for an llvm-objcopy test that modifies the binary in place: copying it before modification simply won't work.

That makes me wonder whether the "right" fix is to implement a built-in `cp` within lit (similar to other existing utilities that we've provided local implementations of), with an option to copy the file but without the original permissions (akin to a `cp` + `chmod 777` sequence or similar). What do you think?

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


More information about the llvm-commits mailing list