Created attachment 10860 [details]
Leave comments about missing invocations of x_unlinks when there is an error in get_file_from_cache() failed.
CAVEAT: The uploaded patch was created during the work to support
-gsplit-dwarf (FissionDwarf) of GCC. (See bug 10005 )
Some of the patches have interdependence and if earlier patches are
not applied, the later ones may fail. I will re-create patches
appropriately depending on how an earlier patch is incorporated (or
The whole list of broken patches below were uploaded in bug 10005 for
convenience, but now separate bugzilla is filed to follow up on each of it
(except for the main -gsplit-dwarf support, in bug 10005).
What this entry is about:
This patch is about adding comments that warn about missing
x_unlinks when get_file_from_cache() failed.
I noticed that during the development of -gsplit-dwarf support that
somehow unlinking of certain files using x_unlink when
get_file_from_cache() failed are gone in new code circa the
beginning of Jan 2014: these unlinking calls were in the summer of
2014, I think.
Before, get_file_from_cache() returned error code, and when failure
occurs, unlinking of files were done.
I wonder if this removal of unlinking behavior is quite
intentional, and I just wanted to remind developers these are now
gone by inserting comments.
This is actually not related to -gsplit-dwarf and so I am filing
this separate bugzilla.
Since this changes ccache.c, it may interfere with the later
patch application if this is not applied to ccache repository.
BTW, the changes for pure support of -gsplit-dwarf also have
similar comments. (see bug 10005)
If there is an error getting the file from cache (either because the file was missing or because there was a read error), failed() is called by get_file_from_cache. failed() in turn will invoke the real compiler, which will overwrite any output_* files that ccache may already have written, so I don't think there's a need for ccache to remove them. For the cached_* files, I agree that it wouldn't hurt to remove them to keep the cache consistent for the result. (It's not very important to do it, though, since the user using ccache will never see a partial result since failed() is called if any file is missing.)
I committed this in de701185bf2928d70ce732ab03f04a4a031caaa9. Thanks for the suggestion!
Included in v3.2.2.