[ccache] ccache changes file permissions unexpectedly
joel at rosdahl.net
Sat May 7 14:19:27 UTC 2022
Aleksey Midenkov wrote:
> After the software upgrade I noticed my IDE cannot compile a project
> after it was built from the terminal. It turned out that build
> directory now contains objects with such strange permissions:
> When I removed ccache from the compiling command it created normal rw
> files. My umask is 0002
Do you use the hard link mode? When the hard link mode is enabled, ccache
intentionally makes hard-linked output files (currently only object files)
read-only. From <https://ccache.dev/manual/4.6.html#config_hard_link>:
"If the resulting file is modified, the file in the cache will also be
modified since they share content, which corrupts the cache entry. As of
version 4.0, ccache makes stored and fetched object files read-only as a
So if your build fails because files have read-only permissions, it sounds like
ccache has saved you from corrupting the cache since something tried to write to
a file that is hard-linked to a file in ccache's cache. The solution to this is
to either not use tools that write to object files after compilation or to
disable the hard link mode.
If you don't use the hard link mode then it sounds like a ccache bug. If so,
please describe a way to reproduce the problem.
> I suspected it is because of the new `umask` setting in ccache which works
> differently by default (which is a really bad design choice).
There is no design decision to change how umask works, and I'm not aware of any
change in behavior between ccache 3.x and 4.x.
More information about the ccache