Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build doesn't fail when stat() fails #830

Closed
evmar opened this issue Oct 14, 2014 · 1 comment · Fixed by #937
Closed

Build doesn't fail when stat() fails #830

evmar opened this issue Oct 14, 2014 · 1 comment · Fixed by #937

Comments

@evmar
Copy link
Collaborator

evmar commented Oct 14, 2014

In #829, calls to stat() fail but the build doesn't abort.

ninja: error: stat(misc/ninja_syntax.py): Value too large for defined data type
[1/26] src/inline.sh kBrowsePy < src/browse.py > build/browse_py.h
[2/26] re2c -b -i --no-generation-date -o src/depfile_parser.cc src/depfile_parser.in.cc
[3/26] re2c -b -i --no-generation-date -o src/lexer.cc src/lexer.in.cc
...
[13/26] ccache i686-pld-linux-g++ -MMD -MT build/eval_env.o -MF build/eval_env.o.d -g -Wall -Wextra -Wno-deprecated -Wno-unused-parameter -fno-rtti -fno-exceptions -fvisibility=hidden -pipe -Wno-missing-field-initializers '-DNINJA_PYTHON="python"' -O2 -DNDEBUG -DUSE_PPOLL -O2 -fwrapv -pipe -Wformat -Werror=format-security -gdwarf-4 -fno-debug-types-section -fvar-tracking-assignments -g2 -Wp,-D_FORTIFY_SOURCE=2 -fstack-protector --param=ssp-buffer-size=4 -fomit-frame-pointer -march=i686 -fasynchronous-unwind-tables -mtune=pentium4 -gdwarf-4 -fno-debug-types-section -fvar-tracking-assignments -g2  -c src/eval_env.cc -o build/eval_env.o
ninja: error: stat(build/build.o): Value too large for defined data type  
ninja: error: stat(build/depfile_parser.o): Value too large for defined data type  
nico added a commit to nico/ninja that referenced this issue Mar 19, 2015
Fixes ninja-build#830, fixes ninja-build#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
@nico nico closed this as completed in #937 Mar 19, 2015
@nico
Copy link
Collaborator

nico commented Mar 19, 2015

Should now fail with:

ninja: error: stat(misc/ninja_syntax.py): Value too large for defined data type
ninja: error: stat failed

A bit lame that there are two error lines – there's a TODO to make that nicer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants