This is an archive of the discontinued LLVM Phabricator instance.

[CMake][Clang] Copy folder without permissions
ClosedPublic

Authored by sebastian-ne on Jul 21 2022, 5:12 AM.

Details

Summary

Copying the folder keeps the original permissions by default. This
creates problems when the source folder is read-only, e.g. in a
packaging environment.
Then, the copied folder in the build directory is read-only as well.
Later on, with configure_file, ClangConfig.cmake is copied into that
directory (in the build tree), failing when the directory is read-only.

Fix that problem by copying the folder without keeping the original
permissions.

Diff Detail

Event Timeline

sebastian-ne created this revision.Jul 21 2022, 5:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 5:12 AM
Herald added a subscriber: mgorny. · View Herald Transcript
sebastian-ne requested review of this revision.Jul 21 2022, 5:12 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 5:12 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
tstellar accepted this revision.Jul 21 2022, 11:14 AM
tstellar added a subscriber: tstellar.

LGTM.

Those pre-commit failure seem to be unrelated.

This revision is now accepted and ready to land.Jul 21 2022, 11:14 AM

LGMT. Also thanks I saw the same failures and was worried they were not spurious on my own patch. Glad to know they are!

This revision was landed with ongoing or failed builds.Jul 22 2022, 1:39 AM
This revision was automatically updated to reflect the committed changes.

What about similar code in LLVM?

clang/cmake/modules/CMakeLists.txt
35

[nit] This comment tells me "what" is happening here, but that can be deduced from the code (i.e. NO_SOURCE_PERMISSIONS --> copy without source permissions). Explaining "why" this being read-only is a problem would be more helpful, IMHO.