Bad permissions (umask?) on CMakeFiles on Linux (with Ninja)

We have a strange problem since about half a year, where cmake sometimes creates all *.o files in the /CMakeFiles/ build folder with read-only permissions -r--r--r--. The problem is not fully reproducible, or at least we have not found a clear pattern yet. Removing the files and starting over seems to solve the problem. The problem does not affect the folders themselves, and also not some of the other files like the *.o.d files.

We usually update cmake to latest, from source, at least once a month, so this has been going on at least with the 3.20, 3.21 and 3.22 series of cmake.

Does that ring a bell with anyone? Any ideas what I could look for?

We do not set a specific umask in our build, and it happens sporadically on different Ubuntu desktop computers, so its also not tightly linked to a user account or machine.

Is it possible to get an strace -f over the build to see what might be doing this to the files? Some filters to only capture “important” syscalls would likely help quite a bit to cut down on the noise, but that would take some experimentation. If the files just get created this way by the compiler…that’s certainly odd.

Cc: @brad.king

Thanks @ben.boeckel for the quick response! I forgot to mention that we also include ccache in our setup. I’m not sure if that is related, but it may actually be?

Actually, now that I look at the ccache source code, there was a umask-related change about 8 months ago! I’ll close this question here and check with ccache first, ok? Thanks a lot!

Here is the issue report upstream in ccache: https://github.com/ccache/ccache/issues/1007