diff options
author | Nico Weber <nicolasweber@gmx.de> | 2015-03-19 15:42:46 (GMT) |
---|---|---|
committer | Nico Weber <nicolasweber@gmx.de> | 2015-03-19 16:45:58 (GMT) |
commit | b334523f1da03adfcd23b6e7e7a66c8fcbf87840 (patch) | |
tree | aa073a311c1e3380e26592b85e437322757f2921 /src/graph.h | |
parent | bc38ef76ebfabe503b1b56a1e32827a851037766 (diff) | |
download | Ninja-b334523f1da03adfcd23b6e7e7a66c8fcbf87840.zip Ninja-b334523f1da03adfcd23b6e7e7a66c8fcbf87840.tar.gz Ninja-b334523f1da03adfcd23b6e7e7a66c8fcbf87840.tar.bz2 |
Make failing stat() calls abort the build.
Fixes #830, fixes #904.
In practice, this either happens with 64-bit inodes and a 32-bit
userspace when building without -D_FILE_OFFSET_BITS=64 in CFLAGS, or
when a filename is longer than the system file length limit.
Since DiskInterface::Stat() returns -1 on error, and Node used -1 on
"stat state unknown", not aborting the build lead to ninja stat()ing the
same file over and over again, until it finally ran out of stack. That's
now fixed.
* Change RecomputeOutputsDirty() to return success instead of dirty
state (like RecomputeDirty()) and return the dirty state in a bool
outparam
* Node::Stat()s old return value wasn't used anywhere, change the
function to return success instead and add an |err| outparam
* Node::StatIfNecessary()'s old return value was used only in one place.
Change that place to explicitly check status_known() and make
StatIfNecessary() return success and add an |err| outparam
* Plan::CleanNode() can now fail, make it return bool and add an |err|
outparam
Diffstat (limited to 'src/graph.h')
-rw-r--r-- | src/graph.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/graph.h b/src/graph.h index 9eafc05..9526712 100644 --- a/src/graph.h +++ b/src/graph.h @@ -41,15 +41,14 @@ struct Node { in_edge_(NULL), id_(-1) {} - /// Return true if the file exists (mtime_ got a value). - bool Stat(DiskInterface* disk_interface); + /// Return false on error. + bool Stat(DiskInterface* disk_interface, string* err); - /// Return true if we needed to stat. - bool StatIfNecessary(DiskInterface* disk_interface) { + /// Return false on error. + bool StatIfNecessary(DiskInterface* disk_interface, string* err) { if (status_known()) - return false; - Stat(disk_interface); - return true; + return true; + return Stat(disk_interface, err); } /// Mark as not-yet-stat()ed and not dirty. @@ -236,9 +235,10 @@ struct DependencyScan { /// Returns false on failure. bool RecomputeDirty(Edge* edge, string* err); - /// Recompute whether any output of the edge is dirty. - /// Returns true if so. - bool RecomputeOutputsDirty(Edge* edge, Node* most_recent_input); + /// Recompute whether any output of the edge is dirty, if so sets |*dirty|. + /// Returns false on failure. + bool RecomputeOutputsDirty(Edge* edge, Node* most_recent_input, + bool* dirty, string* err); BuildLog* build_log() const { return build_log_; |