Skip to content

Tests: Explicitly set permissions in CPack tests to avoid perimssions errors

William R. Dieter requested to merge williamr/cmake:tests-setgid into master

When the user has the setgid bit is set on the parent directory of the build directory, the setgid bit will be propagated throughout the build tree. Most tests do not care about permissions as long as they can read and write the files the need. The CPack tests, however, validate that permissions match an expected set, and fail with the setgid bit set.

Explicitly set permissions on directories created in the CPackTestHelpers to clear the setgid bit.

In looking at how permissions work for the file command, I noticed that the documentation did not mention a way to set the UID or GID bits. The C++ code does accept SETUID and SETGID as valid permissions, so I added them to the list in the documentation.

Users can work around the setgid bit being set by manually clearing it on the top-level build directory, however for tests that care about permissions, explicitly setting the starting state (permissions) will make the test more robust to variations in user environment.

Merge request reports