Make failing stat() calls abort the build.
authorNico Weber <nicolasweber@gmx.de>
Thu, 19 Mar 2015 15:42:46 +0000 (08:42 -0700)
committerNico Weber <nicolasweber@gmx.de>
Thu, 19 Mar 2015 16:45:58 +0000 (09:45 -0700)
commitb334523f1da03adfcd23b6e7e7a66c8fcbf87840
treeaa073a311c1e3380e26592b85e437322757f2921
parentbc38ef76ebfabe503b1b56a1e32827a851037766
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
src/build.cc
src/build.h
src/build_test.cc
src/disk_interface_test.cc
src/graph.cc
src/graph.h