[PATCH] D56423: gn build: Copy file permissions from input file in configure_file() emulation.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 8 20:05:44 PST 2019


pcc added inline comments.


================
Comment at: llvm/utils/gn/build/write_cmake_config.py:105
 
+    os.chmod(args.output, os.stat(args.input).st_mode & 0777)
+
----------------
phosek wrote:
> Shouldn't this be inside the `if` block so the permissions are only changed if file is actually written?
I thought about doing it that way, but figured that we'd want to copy the permissions if the contents don't change but the permissions do. Admittedly this is a bit of an edge case and now that I think about it more I don't even think that ninja will rerun the command in that case. So it would probably be slightly better to move it inside so that we don't disturb the ctime if the file didn't change. I'll do that.


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56423/new/

https://reviews.llvm.org/D56423





More information about the llvm-commits mailing list