Bug 11155 - Log hash file open failure
Log hash file open failure
Status: CLOSED FIXED
Product: ccache
Classification: Unclassified
Component: ccache
dev
All All
: P5 normal
: 3.2.2
Assigned To: Joel Rosdahl
Joel Rosdahl
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2015-03-11 15:48 UTC by ishikawa
Modified: 2015-05-10 12:33 UTC (History)
1 user (show)

See Also:


Attachments
Log hash file creation failure. (602 bytes, patch)
2015-03-11 15:48 UTC, ishikawa
no flags Details
Log failure of opening hash file (take 2) (578 bytes, patch)
2015-03-18 15:37 UTC, ishikawa
ishikawa: review? (joel)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ishikawa 2015-03-11 15:48:37 UTC
Created attachment 10856 [details]
Log hash file creation failure.

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
dropped).

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).

 0001-Harden-logging-perror-replaced-with-cc_log-and-fatal.patch
*0002-hash-file-creation-failure-is-recorded-now.patch
 0003-Use-x_unlink-instead-of-unlink-per-HACKING.txt.patch
 0004-make-sure-the-result-of-stat-call-is-checked.patch
 0005-Enhance-log-message-add-prefix-var.-name-and-a-few-a.patch
 0006-warning-about-missing-x_unlinks-when-get_file_from_c.patch
 0007-Support-for-gsplit-dwarf.patch
 0008-Missing-copy-of-diagnostics-file-in-case-of-failure.patch

What this entry is about:

Short explanation.

2: 0002-hash-file-creation-failure-is-recorded-now.patch

   hash file creation failure is recorded now.
   This is to make error reporting more robust.

   This is actually not related to -gsplit-dwarf and so I am filing this
   a separate bugzilla.

   This is to hash.c only and so can be independent of main ccache.c
   change to support -gsplit-dwarf. (see bug 10005

TIA
Comment 1 Joel Rosdahl 2015-03-14 15:13:49 UTC
Thanks!

> hash file creation failure is recorded now.

Minor, but still: Please start the summary line with a capital letter and don't end it with a period (it's a title, and titles don't end with a period).

> +               cc_log("hash file creation (%s) failed\n", fname); /* to catch strange errors */

From the message, it sounds like ccache failed to create a hash file, but the error is about reading, not creating, right?

So perhaps reformulate as "Failed to open %s: %s" (with strerror(errno))?

Also, I don't think the "to catch strange errors" comment improves code readbility.
Comment 2 ishikawa 2015-03-17 06:32:05 UTC
(In reply to Joel Rosdahl from comment #1)

Thank you for your comment.

I will create a new patch.

TIA
Comment 3 ishikawa 2015-03-18 15:37:34 UTC
Created attachment 10881 [details]
Log failure of opening hash file (take 2)

Here is the modified patch.
I changed the message according to your suggestion and
took out the comment.

TIA
Comment 4 ishikawa 2015-03-18 15:38:25 UTC
I edited the title of this bugzilla. (Not creation, but simple open).
Comment 5 Joel Rosdahl 2015-03-18 19:01:59 UTC
Applied, thanks! (I took the liberty of editing the commit message slightly.)
Comment 6 Joel Rosdahl 2015-05-10 12:33:11 UTC
Included in v3.2.2.