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

**URL:** https://discourse.cmake.org/t/bad-permissions-umask-on-cmakefiles-on-linux-with-ninja/5041
**Category:** Usage
**Tags:** os:linux, gen:ninja
**Created:** [February 17, 2022, 9:59am UTC](https://discourse.cmake.org/t/bad-permissions-umask-on-cmakefiles-on-linux-with-ninja/5041 "2022-02-17T09:59:44Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![emmenlau](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/e/8c91f0/32.png) [@emmenlau](https://discourse.cmake.org/u/emmenlau)
#### Post date: [February 17, 2022, 9:59am UTC](https://discourse.cmake.org/t/bad-permissions-umask-on-cmakefiles-on-linux-with-ninja/5041/1 "2022-02-17T09:59:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)
#### Post date: [February 17, 2022, 12:49pm UTC](https://discourse.cmake.org/t/bad-permissions-umask-on-cmakefiles-on-linux-with-ninja/5041/2 "2022-02-17T12:49:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![emmenlau](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/e/8c91f0/32.png) [@emmenlau](https://discourse.cmake.org/u/emmenlau)
#### Post date: [February 17, 2022, 2:34pm UTC](https://discourse.cmake.org/t/bad-permissions-umask-on-cmakefiles-on-linux-with-ninja/5041/3 "2022-02-17T14:34:06Z")

</div>

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!

---

<div class="post-metadata">

### Author: ![emmenlau](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/e/8c91f0/32.png) [@emmenlau](https://discourse.cmake.org/u/emmenlau)
#### Post date: [February 17, 2022, 2:50pm UTC](https://discourse.cmake.org/t/bad-permissions-umask-on-cmakefiles-on-linux-with-ninja/5041/4 "2022-02-17T14:50:14Z")

</div>

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