[ccache] ccache interrupt handling bug

Nadav Har'El nyh at cloudius-systems.com
Sun Aug 16 21:56:07 UTC 2015

On Mon, Aug 17, 2015 at 12:50 AM, Tom Lane <tgl at sss.pgh.pa.us> wrote:

> * make launches "ccache gcc -o test.o test.c"
> * user types control-C
> * ccache receives SIGINT and exits
> * make does unlink("test.o") to clean up after failed compile step, which
>   it thinks is done
> * gcc creates test.o

Stupid question: Does ccache let gcc write to test.o directly, or does it
write to some temporary file and then ccache copies it?

> * gcc receives SIGINT and exits
> We're left with a probably-broken test.o in the filesystem, despite
> make's attempt to clean up.  Now, the window for this is pretty narrow,
> but I think it could happen: I don't believe that sending signals to
> multiple processes is atomic in most kernels.
> You really don't want ccache to exit until after all externally-observable
> things have stopped happening.  (I recently fixed a somewhat related bug
> in Postgres :-(, which is why this caught my eye.)
>                         regards, tom lane

Nadav Har'El
nyh at cloudius-systems.com

More information about the ccache mailing list